Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: update readonly default value to undefined #473

Merged
merged 10 commits into from
Nov 19, 2024
Binary file modified db/TDesign.db
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ const props: TdCheckboxGroupProps = {
type: Array,
value: [],
},
/** 只读状态 */
readonly: {
type: null,
value: undefined,
},
/** 选中值 */
value: {
type: Array,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,13 @@ export interface TdCheckboxGroupProps<T = CheckboxGroupValue> {
type: ArrayConstructor;
value?: Array<CheckboxOption>;
};
/**
* 只读状态
*/
readonly?: {
type: BooleanConstructor;
value?: boolean;
};
/**
* 选中值
* @default []
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ max-content-row | Number | 5 | \- | N
max-label-row | Number | 3 | \- | N
name | String | - | \- | N
placement | String | left | options: left/right | N
readonly | Boolean | false | \- | N
readonly | Boolean | undefined | \- | N
value | String / Number / Boolean | - | value of checkbox。Typescript:`string \| number \| boolean` | N

### Checkbox Events
Expand Down Expand Up @@ -55,6 +55,7 @@ keys | Object | - | Typescript:`KeysType`。[see more ts definition](https://g
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-group/type.ts) | N
readonly | Boolean | undefined | \- | N
value | Array | [] | Typescript:`T` `type CheckboxGroupValue = Array<string \| number \| boolean>`。[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:`T` `type CheckboxGroupValue = Array<string \| number \| boolean>`。[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/checkbox-group/type.ts) | N

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ max-content-row | Number | 5 | 内容最大行数限制 | N
max-label-row | Number | 3 | 主文案最大行数限制 | N
name | String | - | HTML 元素原生属性 | N
placement | String | left | 多选框和内容相对位置。可选项:left/right | N
readonly | Boolean | false | 只读状态 | N
readonly | Boolean | undefined | 只读状态 | N
value | String / Number / Boolean | - | 多选框的值。TS 类型:`string \| number \| boolean` | N

### Checkbox Events
Expand Down Expand Up @@ -55,6 +55,7 @@ keys | Object | - | 用来定义 value / label 在 `options` 中对应的字段
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-group/type.ts) | N
readonly | Boolean | undefined | 只读状态 | N
value | Array | [] | 选中值。TS 类型:`T` `type CheckboxGroupValue = Array<string \| number \| boolean>`。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/checkbox-group/type.ts) | N
default-value | Array | undefined | 选中值。非受控属性。TS 类型:`T` `type CheckboxGroupValue = Array<string \| number \| boolean>`。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/checkbox-group/type.ts) | N

Expand Down
4 changes: 2 additions & 2 deletions packages/products/tdesign-miniprogram/src/checkbox/props.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ const props: TdCheckboxProps = {
},
/** 只读状态 */
readonly: {
type: Boolean,
value: false,
type: null,
value: undefined,
},
/** 多选框的值 */
value: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,6 @@ export interface TdCheckboxProps {
};
/**
* 只读状态
* @default false
*/
readonly?: {
type: BooleanConstructor;
Expand Down
2 changes: 2 additions & 0 deletions packages/products/tdesign-miniprogram/src/form/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,13 +117,15 @@ export interface FormInstanceFunctions {
clearValidate: {
type: undefined;
value?: (fields?: Array<keyof FormData>) => void;
required?: boolean;
};
/**
* 重置表单,表单里面没有重置按钮`<button type=\"reset\" />`时可以使用该方法,默认重置全部字段为空,该方法会触发 `reset` 事件。<br />如果表单属性 `resetType='empty'` 或者 `reset.type='empty'` 会重置为空;<br />如果表单属性 `resetType='initial'` 或者 `reset.type='initial'` 会重置为表单初始值。<br />`reset.fields` 用于设置具体重置哪些字段,示例:`reset({ type: 'initial', fields: ['name', 'age'] })`
*/
reset: {
type: undefined;
value?: (params?: FormResetParams<FormData>) => void;
required?: boolean;
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ const props: TdRadioGroupProps = {
type: String,
value: 'left',
},
/** 只读状态 */
readonly: {
type: null,
value: undefined,
},
/** 选中的值 */
value: {
type: null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,13 @@ export interface TdRadioGroupProps<T = RadioValue> {
type: StringConstructor;
value?: 'left' | 'right';
};
/**
* 只读状态
*/
readonly?: {
type: BooleanConstructor;
value?: boolean;
};
/**
* 选中的值
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ keys | Object | - | Typescript:`KeysType`。[see more ts definition](https://g
name | String | - | \- | N
options | Array | - | Typescript:`Array<RadioOption>` `type RadioOption = string \| number \| RadioOptionObj` `interface RadioOptionObj { label?: string; value?: string \| number; readonly?: boolean; disabled?: boolean; allowUncheck?: boolean; }`。[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/radio-group/type.ts) | N
placement | String | left | options: left/right | N
readonly | Boolean | undefined | \- | N
value | String / Number / Boolean | - | Typescript:`T` `type RadioValue = string \| number \| boolean`。[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/radio-group/type.ts) | N
default-value | String / Number / Boolean | undefined | uncontrolled property。Typescript:`T` `type RadioValue = string \| number \| boolean`。[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/radio-group/type.ts) | N

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ keys | Object | - | 用来定义 value / label 在 `options` 中对应的字段
name | String | - | HTML 元素原生属性 | N
options | Array | - | 单选组件按钮形式。RadioOption 数据类型为 string 或 number 时,表示 label 和 value 值相同。TS 类型:`Array<RadioOption>` `type RadioOption = string \| number \| RadioOptionObj` `interface RadioOptionObj { label?: string; value?: string \| number; readonly?: boolean; disabled?: boolean; allowUncheck?: boolean; }`。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/radio-group/type.ts) | N
placement | String | left | 复选框和内容相对位置。可选项:left/right | N
readonly | Boolean | undefined | 只读状态 | N
value | String / Number / Boolean | - | 选中的值。TS 类型:`T` `type RadioValue = string \| number \| boolean`。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/radio-group/type.ts) | N
default-value | String / Number / Boolean | undefined | 选中的值。非受控属性。TS 类型:`T` `type RadioValue = string \| number \| boolean`。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/radio-group/type.ts) | N

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ style | Object | - | CSS(Cascading Style Sheets) | N
custom-style | Object | - | CSS(Cascading Style Sheets),used to set style on virtual component | N
active-index | Number | - | \- | N
clearable | Boolean | false | \- | N
disabled | Boolean | - | \- | N
disabled | Boolean | undefined | \- | N
format | Array / Function | - | Typescript:`InputFormatType \| Array<InputFormatType>` | N
input-props | Object / Array | - | Typescript:`InputProps \| Array<InputProps>`,[Input API Documents](./input?tab=api)。[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/range-input/type.ts) | N
label | String / Slot | - | [see more ts definition](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ style | Object | - | 样式 | N
custom-style | Object | - | 样式,一般用于开启虚拟化组件节点场景 | N
active-index | Number | - | 输入框高亮状态序号 | N
clearable | Boolean | false | 是否可清空 | N
disabled | Boolean | - | 是否禁用范围输入框 | N
disabled | Boolean | undefined | 是否禁用范围输入框 | N
format | Array / Function | - | 指定输入框展示值的格式。TS 类型:`InputFormatType \| Array<InputFormatType>` | N
input-props | Object / Array | - | 透传 Input 输入框组件全部属性,数组第一项表示第一个输入框属性,第二项表示第二个输入框属性。示例:`[{ label: 'A', name: 'A-name' }, { label: 'B', name: 'B-name' }]`。TS 类型:`InputProps \| Array<InputProps>`,[Input API Documents](./input?tab=api)。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/range-input/type.ts) | N
label | String / Slot | - | 左侧内容。[通用类型定义](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
Expand Down
69 changes: 69 additions & 0 deletions packages/products/tdesign-miniprogram/src/range-input/props.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
/* eslint-disable */

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

import { TdRangeInputProps } from './type';
const props: TdRangeInputProps = {
/** 输入框高亮状态序号 */
activeIndex: {
type: Number,
},
/** 是否可清空 */
clearable: {
type: Boolean,
value: false,
},
/** 是否禁用范围输入框 */
disabled: {
type: null,
value: undefined,
},
/** 指定输入框展示值的格式 */
format: {
type: null,
},
/** 透传 Input 输入框组件全部属性,数组第一项表示第一个输入框属性,第二项表示第二个输入框属性。示例:`[{ label: 'A', name: 'A-name' }, { label: 'B', name: 'B-name' }]` */
inputProps: {
type: null,
},
/** 左侧内容 */
label: {
type: String,
},
/** 占位符,示例:'请输入' 或者 ['开始日期', '结束日期'] */
placeholder: {
type: null,
},
/** 范围分隔符 */
separator: {
type: String,
value: '-',
},
/** 输入框状态 */
status: {
type: String,
value: 'default',
},
/** 后置图标前的后置内容 */
suffix: {
type: String,
},
/** 输入框下方提示文本,会根据不同的 `status` 呈现不同的样式 */
tips: {
type: String,
},
/** 范围输入框的值 */
value: {
type: Array,
value: null,
},
/** 范围输入框的值,非受控属性 */
defaultValue: {
type: Array,
value: [],
},
};

export default props;
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/* eslint-disable */

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

import { TdRangeInputPopupProps } from './type';
const props: TdRangeInputPopupProps = {
/** 输入框状态 */
status: {
type: String,
value: 'default',
},
/** 输入框下方提示文本,会根据不同的 `status` 呈现不同的样式 */
tips: {
type: String,
},
};

export default props;
126 changes: 126 additions & 0 deletions packages/products/tdesign-miniprogram/src/range-input/type.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
/* eslint-disable */

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

import { InputProps, InputValue, InputFormatType } from '../input/index';

export interface TdRangeInputProps {
/**
* 输入框高亮状态序号
*/
activeIndex?: {
type: NumberConstructor;
value?: number;
};
/**
* 是否可清空
* @default false
*/
clearable?: {
type: BooleanConstructor;
value?: boolean;
};
/**
* 是否禁用范围输入框
*/
disabled?: {
type: BooleanConstructor;
value?: boolean;
};
/**
* 指定输入框展示值的格式
*/
format?: {
type: ArrayConstructor;
value?: InputFormatType | Array<InputFormatType>;
};
/**
* 透传 Input 输入框组件全部属性,数组第一项表示第一个输入框属性,第二项表示第二个输入框属性。示例:`[{ label: 'A', name: 'A-name' }, { label: 'B', name: 'B-name' }]`
*/
inputProps?: {
type: null;
value?: InputProps | Array<InputProps>;
};
/**
* 左侧内容
*/
label?: {
type: StringConstructor;
value?: string;
};
/**
* 占位符,示例:'请输入' 或者 ['开始日期', '结束日期']
*/
placeholder?: {
type: null;
value?: string | Array<string>;
};
/**
* 范围分隔符
* @default '-'
*/
separator?: {
type: StringConstructor;
value?: string;
};
/**
* 输入框状态
* @default default
*/
status?: {
type: StringConstructor;
value?: 'default' | 'success' | 'warning' | 'error';
};
/**
* 后置图标前的后置内容
*/
suffix?: {
type: StringConstructor;
value?: string;
};
/**
* 输入框下方提示文本,会根据不同的 `status` 呈现不同的样式
*/
tips?: {
type: StringConstructor;
value?: string;
};
/**
* 范围输入框的值
* @default []
*/
value?: {
type: ArrayConstructor;
value?: RangeInputValue;
};
/**
* 范围输入框的值,非受控属性
* @default []
*/
defaultValue?: {
type: ArrayConstructor;
value?: RangeInputValue;
};
}

export interface TdRangeInputPopupProps {
/**
* 输入框状态
* @default default
*/
status?: {
type: StringConstructor;
value?: 'default' | 'success' | 'warning' | 'error';
};
/**
* 输入框下方提示文本,会根据不同的 `status` 呈现不同的样式
*/
tips?: {
type: StringConstructor;
value?: string;
};
}

export type RangeInputValue = Array<InputValue>;
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ current | String / Number | - | \- | N
default-current | String / Number | undefined | uncontrolled property | N
current-status | String | process | options: default/process/finish/error | N
layout | String | horizontal | options: horizontal/vertical | N
readonly | Boolean | false | \- | N
readonly | Boolean | undefined | \- | N
separator | String | line | options: line/dashed/arrow | N
sequence | String | positive | options: positive/reverse | N
theme | String | default | options: default/dot | N

Expand All @@ -21,6 +22,7 @@ theme | String | default | options: default/dot | N
name | params | description
-- | -- | --
change | `({current: string \| number, previous: string \| number})` | \-

### Steps External Classes

className | Description
Expand All @@ -39,6 +41,7 @@ icon | String / Slot | - | [see more ts definition](https://github.com/Tencent/t
status | String | default | options: default/process/finish/error。Typescript:`StepStatus` `type StepStatus = 'default' \| 'process' \| 'finish' \| 'error'`。[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/step-item/type.ts) | N
sub-step-items | Array | [] | `deprecated`。Typescript:`SubStepItem[]` `interface SubStepItem { status: StepStatus, title: string }`。[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/step-item/type.ts) | N
title | String / Slot | '' | [see more ts definition](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N

### StepItem External Classes

className | Description
Expand Down
Loading
Loading