This commit is contained in:
Ling53666
2025-08-18 09:11:51 +08:00
commit 02554225da
2516 changed files with 133155 additions and 0 deletions

View File

@ -0,0 +1 @@
.ant-checkbox-group-horizontal .ant-checkbox-group-body{display:flex;flex-wrap:wrap;justify-content:flex-start}.ant-checkbox-group-horizontal .ant-checkbox-group-body .ant-list-item-line{padding-right:0}.ant-checkbox-group-horizontal .ant-checkbox-group-body .ant-checkbox-item{flex-flow:0}.ant-checkbox-group-horizontal .ant-checkbox-group-body .ant-list-item-line::after{display:none}.ant-checkbox-group-footer:empty,.ant-checkbox-group-header:empty{display:none}.ant-checkbox-group-footer,.ant-checkbox-group-header{display:flex;align-items:center;padding:8px 12px;line-height:1.4;font-size:15px;color:#999}.ant-checkbox-group-body{position:relative;overflow:hidden}.ant-checkbox-group-body .ant-checkbox-item-content .ant-checkbox-group-item-label-default:not(:nth-child(1)){display:none}

View File

@ -0,0 +1,70 @@
<import-sjs
from="../index.sjs"
name="componentUtils"
></import-sjs>
<list
className="ant-checkbox-group {{className ? className : ''}} ant-checkbox-group-{{position}}"
style="{{style}}"
>
<checkbox-group
name="{{name}}"
value="{{mixin.value}}"
>
<view class="ant-checkbox-group-body">
<block a:if="{{position === 'vertical'}}">
<block
a:for="{{options}}"
a:for-index="index"
a:for-item="item"
>
<list-item>
<ant-checkbox
color="{{color}}"
checked="{{componentUtils.getCheckboxChecked(item, mixin.value)}}"
data-index="{{index}}"
value="{{item.value}}"
disabled="{{disabled || item.disabled}}"
onChange="onChange"
>
<slot
name="label"
value="{{item}}"
index="{{index}}"
>
<view class="ant-checkbox-group-item-label-default">
{{item.label}}
</view>
</slot>
</ant-checkbox>
</list-item>
</block>
</block>
<block a:else>
<block
a:for="{{options}}"
a:for-index="index"
a:for-item="item"
>
<ant-checkbox
color="{{color}}"
checked="{{componentUtils.getCheckboxChecked(item, mixin.value)}}"
data-index="{{index}}"
value="{{item.value}}"
disabled="{{disabled || item.disabled}}"
onChange="onChange"
>
<slot
name="label"
value="{{item}}"
index="{{index}}"
>
<view class="ant-checkbox-group-item-label-default">
{{item.label}}
</view>
</slot>
</ant-checkbox>
</block>
</block>
</view>
</checkbox-group>
</list>

View File

@ -0,0 +1 @@
export {};

View File

@ -0,0 +1,36 @@
import { __spreadArray } from "tslib";
import { Component, triggerEvent, getValueFromProps } from '../../_util/simply';
import { CheckboxGroupDefaultProps } from './props';
import mixinValue from '../../mixins/value';
Component(CheckboxGroupDefaultProps, {
onChange: function (args, e) {
if (getValueFromProps(this, 'disabled')) {
return;
}
var event;
event = e;
var currentValue = this.getValue();
var index = event.currentTarget.dataset.index;
var selectValue = getValueFromProps(this, 'options')[index].value;
if (currentValue.indexOf(selectValue) > -1) {
currentValue = currentValue.filter(function (v) { return v !== selectValue; });
}
else {
currentValue = __spreadArray(__spreadArray([], currentValue, true), [selectValue], false);
}
if (!this.isControlled()) {
this.update(currentValue);
}
triggerEvent(this, 'change', currentValue, e);
},
}, null, [
mixinValue({
transformValue: function (val) {
var value = val || [];
return {
needUpdate: true,
value: value,
};
},
}),
]);

View File

@ -0,0 +1,8 @@
{
"component": true,
"usingComponents": {
"list": "../../List/index",
"list-item": "../../List/ListItem/index",
"ant-checkbox": "../index"
}
}

View File

@ -0,0 +1,15 @@
import { IBaseProps } from '../../_util/base';
export interface ICheckboxGroupProps extends IBaseProps {
value: string[];
defaultValue: string[];
disabled?: boolean;
position: 'horizontal' | 'vertical';
color: string;
options: {
label?: string;
value?: string;
disabled?: boolean;
}[];
onChange?: (value: string[], e: any) => void;
}
export declare const CheckboxGroupDefaultProps: Partial<ICheckboxGroupProps>;

View File

@ -0,0 +1,8 @@
export var CheckboxGroupDefaultProps = {
value: null,
defaultValue: [],
disabled: false,
position: 'vertical',
color: '',
options: [],
};

View File

@ -0,0 +1 @@
.ant-checkbox-item{color:#333;margin-right:8px}.ant-checkbox-item-container{display:flex;align-items:center}.ant-checkbox-item-content{padding-left:5px;text-align:left}.ant-checkbox-item-wrap{position:relative;width:22px;height:22px;flex:0 0 22px}.ant-checkbox-item-base{position:absolute;top:0;left:0;width:100%;height:100%;opacity:0}.ant-checkbox-item-fake{position:absolute;top:0;left:0;width:100%;height:100%;overflow:hidden;pointer-events:none;display:flex;justify-content:center;align-items:center}.ant-checkbox-item-fake-icon{background-color:#fff;border:1px solid #ccc;border-radius:50vh;width:100%;height:100%;box-sizing:border-box}.ant-checkbox-item-fake-checkedIcon{border-radius:50vh;background-color:#1677ff;width:100%;height:100%;display:flex;align-items:center;justify-content:center}.ant-checkbox-item-fake-checkedIcon-icon{color:#fff;font-size:14px}.ant-checkbox-item-fake-disbaledIcon{box-sizing:border-box;border:1px solid #ccc;border-radius:50vh;width:100%;height:100%;background-color:#f5f5f5}.ant-checkbox-item-fake-disabledCheckedIcon{box-sizing:border-box;border:1px solid #ccc;background-color:#f5f5f5;border-radius:50vh;width:100%;height:100%;display:flex;align-items:center;justify-content:center}.ant-checkbox-item-fake-disabledCheckedIcon-icon{color:#ccc;font-size:14px}.ant-checkbox-item-disabled{opacity:.4}

View File

@ -0,0 +1,35 @@
<import-sjs
from="./index.sjs"
name="componentUtils"
></import-sjs>
<label
class="ant-checkbox-item {{className || ''}}"
style="{{style || ''}}"
>
<view class="ant-checkbox-item-container">
<view class="ant-checkbox-item-wrap">
<checkbox
class="ant-checkbox-item-base"
value="{{value}}"
onChange="onChange"
checked="{{mixin.value}}"
disabled="{{disabled}}"
></checkbox>
<view class="ant-checkbox-item-fake">
<view
class="ant-checkbox-item-fake-{{componentUtils.getClassName(mixin.value, disabled)}}"
style="{{mixin.value && !disabled && color ? 'background:' + color : ''}}"
>
<ant-icon
a:if="{{mixin.value}}"
type="CheckOutline"
className="ant-checkbox-item-fake-{{componentUtils.getClassName(mixin.value, disabled)}}-icon"
></ant-icon>
</view>
</view>
</view>
<view class="ant-checkbox-item-content {{disabled ? 'ant-checkbox-item-disabled' : ''}}">
<slot></slot>
</view>
</view>
</label>

View File

@ -0,0 +1 @@
export {};

View File

@ -0,0 +1,17 @@
import { CheckboxDefaultProps } from './props';
import { Component, triggerEvent } from '../_util/simply';
import mixinValue from '../mixins/value';
Component(CheckboxDefaultProps, {
onChange: function (e) {
var value = !this.getValue();
if (!this.isControlled()) {
this.update(value);
}
triggerEvent(this, 'change', value, e);
},
}, null, [
mixinValue({
valueKey: 'checked',
defaultValueKey: 'defaultChecked',
}),
]);

View File

@ -0,0 +1,6 @@
{
"component": true,
"usingComponents": {
"ant-icon": "../Icon/index"
}
}

View File

@ -0,0 +1,21 @@
function getClassName(checked, disabled) {
if (!checked && !disabled) {
return 'icon';
}
if (checked && !disabled) {
return 'checkedIcon';
}
if (!checked && disabled) {
return 'disbaledIcon';
}
if (checked && disabled) {
return 'disabledCheckedIcon';
}
}
function getCheckboxChecked(item, value) {
return (value || []).indexOf(item.value) > -1;
}
export default {
getClassName: getClassName,
getCheckboxChecked: getCheckboxChecked
};

View File

@ -0,0 +1,13 @@
import { IBaseProps } from '../_util/base';
/**
* @description 复选框,表单组件。
*/
export interface ICheckboxProps extends IBaseProps {
value?: any;
checked: boolean;
defaultChecked?: boolean;
disabled: boolean;
color: string;
onChange?: (checked: boolean, e: any) => void;
}
export declare const CheckboxDefaultProps: Partial<ICheckboxProps>;

View File

@ -0,0 +1,7 @@
export var CheckboxDefaultProps = {
value: null,
checked: null,
defaultChecked: null,
disabled: false,
color: '',
};