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: [],
};