Skip to content

Commit

Permalink
fix(checkbox): upadte group props file
Browse files Browse the repository at this point in the history
  • Loading branch information
LeeJim committed Jan 9, 2023
1 parent 4e8ac2a commit 8095c6a
Show file tree
Hide file tree
Showing 7 changed files with 139 additions and 87 deletions.
2 changes: 1 addition & 1 deletion src/checkbox-group/checkbox-group.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { SuperComponent, wxComponent, RelationsOptions } from '../common/src/index';
import config from '../common/config';
import props from '../checkbox/checkbox-group-props';
import props from './props';

const { prefix } = config;
const name = `${prefix}-checkbox-group`;
Expand Down
46 changes: 46 additions & 0 deletions src/checkbox-group/props.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/* eslint-disable */

/**
* 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC
* */

import { TdCheckboxGroupProps } from './type';
const props: TdCheckboxGroupProps = {
/** 自定义组件样式 */
customStyle: {
type: String,
value: '',
},
/** 是否禁用组件 */
disabled: {
type: Boolean,
value: false,
},
/** 支持最多选中的数量 */
max: {
type: Number,
value: undefined,
},
/** 统一设置内部复选框 HTML 属性 */
name: {
type: String,
value: '',
},
/** 以配置形式设置子元素。示例1:`['北京', '上海']` ,示例2: `[{ label: '全选', checkAll: true }, { label: '上海', value: 'shanghai' }]`。checkAll 值为 true 表示当前选项为「全选选项」 */
options: {
type: Array,
value: [],
},
/** 选中值 */
value: {
type: Array,
value: null,
},
/** 选中值,非受控属性 */
defaultValue: {
type: Array,
value: [],
},
};

export default props;
74 changes: 74 additions & 0 deletions src/checkbox-group/type.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
/* eslint-disable */

/**
* 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC
* */

export interface TdCheckboxGroupProps {
/**
* 自定义组件样式
* @default ''
*/
customStyle?: {
type: StringConstructor;
value?: string;
};
/**
* 是否禁用组件
* @default false
*/
disabled?: {
type: BooleanConstructor;
value?: boolean;
};
/**
* 支持最多选中的数量
*/
max?: {
type: NumberConstructor;
value?: number;
};
/**
* 统一设置内部复选框 HTML 属性
* @default ''
*/
name?: {
type: StringConstructor;
value?: string;
};
/**
* 以配置形式设置子元素。示例1:`['北京', '上海']` ,示例2: `[{ label: '全选', checkAll: true }, { label: '上海', value: 'shanghai' }]`。checkAll 值为 true 表示当前选项为「全选选项」
* @default []
*/
options?: {
type: ArrayConstructor;
value?: Array<CheckboxOption>;
};
/**
* 选中值
* @default []
*/
value?: {
type: ArrayConstructor;
value?: CheckboxGroupValue;
};
/**
* 选中值,非受控属性
* @default []
*/
defaultValue?: {
type: ArrayConstructor;
value?: CheckboxGroupValue;
};
}

export type CheckboxOption = string | number | CheckboxOptionObj;

export interface CheckboxOptionObj {
label?: string;
value?: string | number;
disabled?: boolean;
checkAll?: true;
}

export type CheckboxGroupValue = Array<string | number>;
15 changes: 8 additions & 7 deletions src/checkbox/README.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,19 @@ block | Boolean | true | \- | N
check-all | Boolean | false | \- | N
checked | Boolean | false | \- | N
default-checked | Boolean | undefined | uncontrolled property | N
color | String | #0052d9 | \- | N
content | String / Slot | - | \- | N
content-disabled | Boolean | - | \- | N
custom-style | String | - | `0.25.0` | N
disabled | Boolean | undefined | \- | N
external-classes | Array | - | `['t-class', 't-class-icon', 't-class-label', 't-class-content', 't-class-border']` | N
icon | String / Array | circle | Typescript:`'circle' \| 'line' \| 'rectangle' \| string[]` | N
icon | String / Array | 'circle' | Typescript:`'circle' \| 'line' \| 'rectangle' \| string[]` | N
indeterminate | Boolean | false | \- | N
label | String / Slot | - | \- | N
max-content-row | Number | 5 | \- | N
max-label-row | Number | 3 | \- | N
name | String | - | \- | N
readonly | Boolean | false | \- | N
value | String / Number | - | Typescript:`string \| number` | N
value | String / Number | - | Typescript:`string \| number \| boolean` | N

### Checkbox Events

Expand All @@ -34,15 +34,16 @@ change | `(checked: boolean)` | \-

name | type | default | description | required
-- | -- | -- | -- | --
custom-style | String | - | `0.25.0` | N
disabled | Boolean | false | \- | N
max | Number | undefined | \- | N
name | String | - | \- | N
options | Array | [] | Typescript:`Array<CheckboxOption>` `type CheckboxOption = string \| number \| CheckboxOptionObj` `interface CheckboxOptionObj { label?: string; value?: string \| number; disabled?: boolean; checkAll?: true }`[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/checkbox/type.ts) | N
value | Array | [] | Typescript:`CheckboxGroupValue` `type CheckboxGroupValue = Array<string \| number>`[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/checkbox/type.ts) | N
default-value | Array | undefined | uncontrolled property。Typescript:`CheckboxGroupValue` `type CheckboxGroupValue = Array<string \| number>`[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/checkbox/type.ts) | N
options | Array | [] | Typescript:`Array<CheckboxOption>` `type CheckboxOption = string \| number \| CheckboxOptionObj` `interface CheckboxOptionObj { label?: string; value?: string \| number; disabled?: boolean; checkAll?: true }`[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/checkbox-group/type.ts) | N
value | Array | [] | Typescript:`CheckboxGroupValue` `type CheckboxGroupValue = Array<string \| number>`[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/checkbox-group/type.ts) | N
default-value | Array | undefined | uncontrolled property。Typescript:`CheckboxGroupValue` `type CheckboxGroupValue = Array<string \| number>`[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/checkbox-group/type.ts) | N

### CheckboxGroup Events

name | params | description
-- | -- | --
change | `(value: CheckboxGroupValue, context: CheckboxGroupChangeContext)` | [see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/checkbox/type.ts)。<br/>`interface CheckboxGroupChangeContext { e: Event; current: string \| number; option: CheckboxOption \| TdCheckboxProps; type: 'check' \| 'uncheck' }`<br/>
change | `(value: CheckboxGroupValue, context: CheckboxGroupChangeContext)` | [see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/checkbox-group/type.ts)。<br/>`interface CheckboxGroupChangeContext { e: Event; current: string \| number; option: CheckboxOption \| TdCheckboxProps; type: 'check' \| 'uncheck' }`<br/>
14 changes: 7 additions & 7 deletions src/checkbox/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,10 @@ checked | Boolean | false | 是否选中 | N
default-checked | Boolean | undefined | 是否选中。非受控属性 | N
content | String / Slot | - | 多选框内容 | N
content-disabled | Boolean | - | 是否禁用组件内容(content)触发选中 | N
custom-style `v0.25.0` | String | - | 自定义组件样式 | N
custom-style | String | - | `0.25.0`自定义组件样式 | N
disabled | Boolean | undefined | 是否禁用组件 | N
external-classes | Array | - | 组件类名,分别用于设置 组件外层、多选框图标、主文案、内容 等元素类名。`['t-class', 't-class-icon', 't-class-label', 't-class-content', 't-class-border']` | N
icon | String / Array | circle | 自定义选中图标和非选中图标。使用 Array 时表示:`[选中态图标,非选中态图标]`。使用 String 时,值为 circle 表示填充圆形图标、值为 line 表示描边型图标、值为 rectangle 表示填充矩形图标。TS 类型:`'circle' \| 'line' \| 'rectangle' \| string[]` | N
icon | String / Array | 'circle' | 自定义选中图标和非选中图标。使用 Array 时表示:`[选中态图标,非选中态图标]`。使用 String 时,值为 circle 表示填充圆形图标、值为 line 表示描边型图标、值为 rectangle 表示填充矩形图标。TS 类型:`'circle' \| 'line' \| 'rectangle' \| string[]` | N
indeterminate | Boolean | false | 是否为半选 | N
label | String / Slot | - | 主文案 | N
max-content-row | Number | 5 | 内容最大行数限制 | N
Expand All @@ -93,16 +93,16 @@ change | `(checked: boolean)` | 值变化时触发

名称 | 类型 | 默认值 | 说明 | 必传
-- | -- | -- | -- | --
custom-style | String | - | 自定义组件样式 | N
custom-style | String | - | `0.25.0`自定义组件样式 | N
disabled | Boolean | false | 是否禁用组件 | N
max | Number | undefined | 支持最多选中的数量 | N
name | String | - | 统一设置内部复选框 HTML 属性 | N
options | Array | [] | 以配置形式设置子元素。示例1:`['北京', '上海']` ,示例2: `[{ label: '全选', checkAll: true }, { label: '上海', value: 'shanghai' }]`。checkAll 值为 true 表示当前选项为「全选选项」。TS 类型:`Array<CheckboxOption>` `type CheckboxOption = string \| number \| CheckboxOptionObj` `interface CheckboxOptionObj { label?: string; value?: string \| number; disabled?: boolean; checkAll?: true }`[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/checkbox/type.ts) | N
value | Array | [] | 选中值。TS 类型:`CheckboxGroupValue` `type CheckboxGroupValue = Array<string \| number>`[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/checkbox/type.ts) | N
default-value | Array | undefined | 选中值。非受控属性。TS 类型:`CheckboxGroupValue` `type CheckboxGroupValue = Array<string \| number>`[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/checkbox/type.ts) | N
options | Array | [] | 以配置形式设置子元素。示例1:`['北京', '上海']` ,示例2: `[{ label: '全选', checkAll: true }, { label: '上海', value: 'shanghai' }]`。checkAll 值为 true 表示当前选项为「全选选项」。TS 类型:`Array<CheckboxOption>` `type CheckboxOption = string \| number \| CheckboxOptionObj` `interface CheckboxOptionObj { label?: string; value?: string \| number; disabled?: boolean; checkAll?: true }`[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/checkbox-group/type.ts) | N
value | Array | [] | 选中值。TS 类型:`CheckboxGroupValue` `type CheckboxGroupValue = Array<string \| number>`[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/checkbox-group/type.ts) | N
default-value | Array | undefined | 选中值。非受控属性。TS 类型:`CheckboxGroupValue` `type CheckboxGroupValue = Array<string \| number>`[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/checkbox-group/type.ts) | N

### CheckboxGroup Events

名称 | 参数 | 描述
-- | -- | --
change | `(value: CheckboxGroupValue, context: CheckboxGroupChangeContext)` | 值变化时触发。`context.current` 表示当前变化的数据项,如果是全选则为空;`context.type` 表示引起选中数据变化的是选中或是取消选中,`context.option` 表示当前变化的数据项。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/checkbox/type.ts)。<br/>`interface CheckboxGroupChangeContext { e: Event; current: string \| number; option: CheckboxOption \| TdCheckboxProps; type: 'check' \| 'uncheck' }`<br/>
change | `(value: CheckboxGroupValue, context: CheckboxGroupChangeContext)` | 值变化时触发。`context.current` 表示当前变化的数据项,如果是全选则为空;`context.type` 表示引起选中数据变化的是选中或是取消选中,`context.option` 表示当前变化的数据项。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/checkbox-group/type.ts)。<br/>`interface CheckboxGroupChangeContext { e: Event; current: string \| number; option: CheckboxOption \| TdCheckboxProps; type: 'check' \| 'uncheck' }`<br/>
2 changes: 1 addition & 1 deletion src/checkbox/props.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ const props: TdCheckboxProps = {
externalClasses: {
type: Array,
},
/** 自定义选中图标和非选中图标。使用 Array 时表示:`[选中态图标,非选中态图标]`。使用 String 时,值为 fill-circle 表示填充圆形图标、值为 stroke-line 表示描边型图标、值为 fill-rectangle 表示填充矩形图标 */
/** 自定义选中图标和非选中图标。使用 Array 时表示:`[选中态图标,非选中态图标]`。使用 String 时,值为 circle 表示填充圆形图标、值为 line 表示描边型图标、值为 rectangle 表示填充矩形图标 */
icon: {
type: null,
value: 'circle',
Expand Down
73 changes: 2 additions & 71 deletions src/checkbox/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export interface TdCheckboxProps {
};
/**
* 自定义选中图标和非选中图标。使用 Array 时表示:`[选中态图标,非选中态图标]`。使用 String 时,值为 circle 表示填充圆形图标、值为 line 表示描边型图标、值为 rectangle 表示填充矩形图标
* @default circle
* @default 'circle'
*/
icon?: {
type: null;
Expand Down Expand Up @@ -141,75 +141,6 @@ export interface TdCheckboxProps {
*/
value?: {
type: null;
value?: string | number;
value?: string | number | boolean;
};
}

export interface TdCheckboxGroupProps {
/**
* 自定义组件样式
* @default ''
*/
customStyle?: {
type: StringConstructor;
value?: string;
};
/**
* 是否禁用组件
* @default false
*/
disabled?: {
type: BooleanConstructor;
value?: boolean;
};
/**
* 支持最多选中的数量
*/
max?: {
type: NumberConstructor;
value?: number;
};
/**
* 统一设置内部复选框 HTML 属性
* @default ''
*/
name?: {
type: StringConstructor;
value?: string;
};
/**
* 以配置形式设置子元素。示例1:`['北京', '上海']` ,示例2: `[{ label: '全选', checkAll: true }, { label: '上海', value: 'shanghai' }]`。checkAll 值为 true 表示当前选项为「全选选项」
* @default []
*/
options?: {
type: ArrayConstructor;
value?: Array<CheckboxOption>;
};
/**
* 选中值
* @default []
*/
value?: {
type: ArrayConstructor;
value?: CheckboxGroupValue;
};
/**
* 选中值,非受控属性
* @default []
*/
defaultValue?: {
type: ArrayConstructor;
value?: CheckboxGroupValue;
};
}

export type CheckboxOption = string | number | CheckboxOptionObj;

export interface CheckboxOptionObj {
label?: string;
value?: string | number;
disabled?: boolean;
checkAll?: true;
}

export type CheckboxGroupValue = Array<string | number>;

0 comments on commit 8095c6a

Please sign in to comment.