diff --git a/CHANGELOG.md b/CHANGELOG.md index 0513802c2..bb3252fec 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,23 @@ toc: false docClass: timeline --- +## 🌈 1.2.3 `2023-03-23` +### 🚀 Features +- `Table`: @chaishi ([#2251](https://github.com/Tencent/tdesign-vue/pull/2251)) + - 支持使用 `filterIcon` 支持不同列显示不同的筛选图标,[issue#2088](https://github.com/Tencent/tdesign-vue/issues/2088) + - 支持横向滚动到固定列,[issue#1992](https://github.com/Tencent/tdesign-vue/issues/1992) +- `ColorPicker`: 新增`enableMultipleGradient`, 支持渐变色只存在起始和结束梯度 @uyarn ([#2260](https://github.com/Tencent/tdesign-vue/pull/2260)) +- `TimePicker`: 新增`size` API , 用于控制时间输入框大小,`pick`事件增加`context`回调参数 @uyarn ([#2260](https://github.com/Tencent/tdesign-vue/pull/2260)) +- `Dropdown`: 支持透传popupProps的`on-visible-change`的写法 @uyarn ([#2260](https://github.com/Tencent/tdesign-vue/pull/2260)) +### 🐞 Bug Fixes +- `Popup`: 修复需多次点击才能关闭的问题 @ikeq ([#2247](https://github.com/Tencent/tdesign-vue/pull/2247)) +- `TreeSelect`: + - 修复树选择组件,在表格组件里面时,显示两个 Tips 的问题,[issue#2131](https://github.com/Tencent/tdesign-vue/issues/2131) @chaishi ([#2251](https://github.com/Tencent/tdesign-vue/pull/2251)) +- `Tree`: 修复空初始值或不存在的初始值的问题,@uyarn ([common #1213](https://github.com/Tencent/tdesign-common/pull/1213)) +- `Table`: + - 单行选中功能,修复 `allowUncheck: false` 无效问题,[tdesign-vue-next#2561](https://github.com/Tencent/tdesign-vue-next/issues/2561) @chaishi ([#2256](https://github.com/Tencent/tdesign-vue/pull/2256)) + - 修复 lazyload 的问题 @yanxugong ([#2250](https://github.com/Tencent/tdesign-vue/pull/2250)) + ## 🌈 1.2.2 `2023-03-16` ### 🚀 Features - `Table`: @chaishi ([#2227](https://github.com/Tencent/tdesign-vue/pull/2227)) diff --git a/package.json b/package.json index 22ab9d0e3..715bc1526 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "tdesign-vue", "purename": "tdesign", - "version": "1.2.2", + "version": "1.2.3", "description": "tdesign-vue", "title": "tdesign-vue", "keywords": [ diff --git a/src/_common b/src/_common index 111eed27f..db13c2489 160000 --- a/src/_common +++ b/src/_common @@ -1 +1 @@ -Subproject commit 111eed27f8297df6b79a6b5f5666e67ad2e0d26e +Subproject commit db13c2489701f8e5693c222899e9fa2487ad6559 diff --git a/src/form/form.en-US.md b/src/form/form.en-US.md index fbb78d2d0..bdae87ac1 100644 --- a/src/form/form.en-US.md +++ b/src/form/form.en-US.md @@ -7,7 +7,7 @@ name | type | default | description | required -- | -- | -- | -- | -- colon | Boolean | false | \- | N data | Object | {} | Typescript:`FormData` | N -disabled | Boolean | - | \- | N +disabled | Boolean | undefined | \- | N errorMessage | Object | - | Typescript:`FormErrorMessage` | N formControlledComponents | Array | - | Typescript:`Array` | N labelAlign | String | right | options:left/right/top | N @@ -16,14 +16,14 @@ layout | String | vertical | options:vertical/inline | N preventSubmitDefault | Boolean | true | \- | N requiredMark | Boolean | true | \- | N resetType | String | empty | options:empty/initial | N -rules | Object | - | Typescript:`{ [field in keyof FormData]: Array }` | N +rules | Object | - | Typescript:`FormRules` `type FormRules = { [field in keyof T]?: Array }`。[see more ts definition](https://github.com/Tencent/tdesign-vue/tree/develop/src/form/type.ts) | N scrollToFirstError | String | - | options:''/smooth/auto | N showErrorMessage | Boolean | true | \- | N -statusIcon | Boolean / Slot / Function | - | Typescript:`boolean \| TNode`。[see more ts definition](https://github.com/Tencent/tdesign-vue/blob/develop/src/common.ts) | N +statusIcon | Boolean / Slot / Function | undefined | Typescript:`boolean \| TNode`。[see more ts definition](https://github.com/Tencent/tdesign-vue/blob/develop/src/common.ts) | N submitWithWarningMessage | Boolean | false | \- | N onReset | Function | | Typescript:`(context: { e?: FormResetEvent }) => void`
| N onSubmit | Function | | Typescript:`(context: SubmitContext) => void`
[see more ts definition](https://github.com/Tencent/tdesign-vue/tree/develop/src/form/type.ts)。
`interface SubmitContext { e?: FormSubmitEvent; validateResult: FormValidateResult; firstError?: string }`

`type FormValidateResult = boolean \| ValidateResultObj`

`type ValidateResultObj = { [key in keyof T]: boolean \| ValidateResultList }`

`type ValidateResultList = Array`

`type AllValidateResult = CustomValidateObj \| ValidateResultType`

`interface ValidateResultType extends FormRule { result: boolean }`

`type ValidateResult = { [key in keyof T]: boolean \| ErrorList }`

`type ErrorList = Array`
| N -onValidate | Function | | Typescript:`(result: ValidateResultContext) => void`
[see more ts definition](https://github.com/Tencent/tdesign-vue/tree/develop/src/form/type.ts)。
`type ValidateResultContext = Omit, 'e'>`
| N +onValidate | Function | | Typescript:`(result: ValidateResultContext) => void`
[see more ts definition](https://github.com/Tencent/tdesign-vue/tree/develop/src/form/type.ts)。
`type ValidateResultContext = Omit, 'e'>`
| N ### Form Events @@ -31,18 +31,18 @@ name | params | description -- | -- | -- reset | `(context: { e?: FormResetEvent })` | \- submit | `(context: SubmitContext)` | [see more ts definition](https://github.com/Tencent/tdesign-vue/tree/develop/src/form/type.ts)。
`interface SubmitContext { e?: FormSubmitEvent; validateResult: FormValidateResult; firstError?: string }`

`type FormValidateResult = boolean \| ValidateResultObj`

`type ValidateResultObj = { [key in keyof T]: boolean \| ValidateResultList }`

`type ValidateResultList = Array`

`type AllValidateResult = CustomValidateObj \| ValidateResultType`

`interface ValidateResultType extends FormRule { result: boolean }`

`type ValidateResult = { [key in keyof T]: boolean \| ErrorList }`

`type ErrorList = Array`
-validate | `(result: ValidateResultContext)` | [see more ts definition](https://github.com/Tencent/tdesign-vue/tree/develop/src/form/type.ts)。
`type ValidateResultContext = Omit, 'e'>`
+validate | `(result: ValidateResultContext)` | [see more ts definition](https://github.com/Tencent/tdesign-vue/tree/develop/src/form/type.ts)。
`type ValidateResultContext = Omit, 'e'>`
### FormInstanceFunctions 组件实例方法 name | params | return | description -- | -- | -- | -- -clearValidate | `(fields?: Array)` | \- | \- -reset | `(params?: FormResetParams)` | \- | [see more ts definition](https://github.com/Tencent/tdesign-vue/tree/develop/src/form/type.ts)。
`interface FormResetParams { type?: 'initial' \| 'empty'; fields?: Array }`
-setValidateMessage | `(message: FormValidateMessage)` | \- | [see more ts definition](https://github.com/Tencent/tdesign-vue/tree/develop/src/form/type.ts)。
`type FormValidateMessage = { [field in keyof FormData]: FormItemValidateMessage[] }`

`interface FormItemValidateMessage { type: 'warning' \| 'error'; message: string }`
-submit | `(params?: { showErrorMessage?: boolean })` | \- | \- -validate | `(params?: FormValidateParams)` | `Promise>` | [see more ts definition](https://github.com/Tencent/tdesign-vue/tree/develop/src/form/type.ts)。
`interface FormValidateParams { fields?: Array; showErrorMessage?: boolean; trigger?: ValidateTriggerType }`

`type ValidateTriggerType = 'blur' \| 'change' \| 'all'`
-validateOnly | `(params?: Pick)` | `Promise>` | \- +clearValidate | `(fields?: Array)` | \- | required +reset | `(params?: FormResetParams)` | \- | required。[see more ts definition](https://github.com/Tencent/tdesign-vue/tree/develop/src/form/type.ts)。
`interface FormResetParams { type?: 'initial' \| 'empty'; fields?: Array }`
+setValidateMessage | `(message: FormValidateMessage)` | \- | required。[see more ts definition](https://github.com/Tencent/tdesign-vue/tree/develop/src/form/type.ts)。
`type FormValidateMessage = { [field in keyof FormData]: FormItemValidateMessage[] }`

`interface FormItemValidateMessage { type: 'warning' \| 'error'; message: string }`
+submit | `(params?: { showErrorMessage?: boolean })` | \- | required +validate | `(params?: FormValidateParams)` | `Promise>` | required。[see more ts definition](https://github.com/Tencent/tdesign-vue/tree/develop/src/form/type.ts)。
`interface FormValidateParams { fields?: Array; showErrorMessage?: boolean; trigger?: ValidateTriggerType }`

`type ValidateTriggerType = 'blur' \| 'change' \| 'all'`
+validateOnly | `(params?: Pick)` | `Promise>` | required ### FormItem Props @@ -50,15 +50,15 @@ name | type | default | description | required -- | -- | -- | -- | -- for | String | - | \- | N help | String / Slot / Function | - | Typescript:`string \| TNode`。[see more ts definition](https://github.com/Tencent/tdesign-vue/blob/develop/src/common.ts) | N -label | String / Slot / Function | - | Typescript:`string \| TNode`。[see more ts definition](https://github.com/Tencent/tdesign-vue/blob/develop/src/common.ts) | N +label | String / Slot / Function | '' | Typescript:`string \| TNode`。[see more ts definition](https://github.com/Tencent/tdesign-vue/blob/develop/src/common.ts) | N labelAlign | String | - | options:left/right/top | N labelWidth | String / Number | - | \- | N name | String / Number | - | Typescript:`string \| number` | N -requiredMark | Boolean | - | \- | N +requiredMark | Boolean | undefined | \- | N rules | Array | - | Typescript:`Array` | N -showErrorMessage | Boolean | - | \- | N +showErrorMessage | Boolean | undefined | \- | N status | String | - | Typescript:`'error' \| 'warning' \| 'success' \| 'validating'` | N -statusIcon | Boolean / Slot / Function | - | Typescript:`boolean \| TNode`。[see more ts definition](https://github.com/Tencent/tdesign-vue/blob/develop/src/common.ts) | N +statusIcon | Boolean / Slot / Function | undefined | Typescript:`boolean \| TNode`。[see more ts definition](https://github.com/Tencent/tdesign-vue/blob/develop/src/common.ts) | N successBorder | Boolean | false | \- | N tips | String / Slot / Function | - | Typescript:`string \| TNode`。[see more ts definition](https://github.com/Tencent/tdesign-vue/blob/develop/src/common.ts) | N diff --git a/src/form/form.md b/src/form/form.md index a648d00ef..5f68a1d37 100644 --- a/src/form/form.md +++ b/src/form/form.md @@ -9,7 +9,7 @@ -- | -- | -- | -- | -- colon | Boolean | false | 是否在表单标签字段右侧显示冒号 | N data | Object | {} | 表单数据。TS 类型:`FormData` | N -disabled | Boolean | - | 是否禁用整个表单 | N +disabled | Boolean | undefined | 是否禁用整个表单 | N errorMessage | Object | - | 表单错误信息配置,示例:`{ idcard: '请输入正确的身份证号码', max: '字符长度不能超过 ${max}' }`。TS 类型:`FormErrorMessage` | N formControlledComponents | Array | - | 允许表单统一控制禁用状态的自定义组件名称列表。默认会有组件库的全部输入类组件:TInput、TInputNumber、TCascader、TSelect、TOption、TSwitch、TCheckbox、TCheckboxGroup、TRadio、TRadioGroup、TTreeSelect、TDatePicker、TTimePicker、TUpload、TTransfer、TSlider。对于自定义组件,组件内部需要包含可以控制表单禁用状态的变量 `formDisabled`。示例:`['CustomUpload', 'CustomInput']`。TS 类型:`Array` | N labelAlign | String | right | 表单字段标签对齐方式:左对齐、右对齐、顶部对齐。可选项:left/right/top | N @@ -18,14 +18,14 @@ layout | String | vertical | 表单布局,有两种方式:纵向布局 和 preventSubmitDefault | Boolean | true | 是否阻止表单提交默认事件(表单提交默认事件会刷新页面),设置为 `true` 可以避免刷新 | N requiredMark | Boolean | true | 是否显示必填符号(*),默认显示 | N resetType | String | empty | 重置表单的方式,值为 empty 表示重置表单为空,值为 initial 表示重置表单数据为初始值。可选项:empty/initial | N -rules | Object | - | 表单字段校验规则。TS 类型:`{ [field in keyof FormData]: Array }` | N +rules | Object | - | 表单字段校验规则。TS 类型:`FormRules` `type FormRules = { [field in keyof T]?: Array }`。[详细类型定义](https://github.com/Tencent/tdesign-vue/tree/develop/src/form/type.ts) | N scrollToFirstError | String | - | 表单校验不通过时,是否自动滚动到第一个校验不通过的字段,平滑滚动或是瞬间直达。值为空则表示不滚动。可选项:''/smooth/auto | N showErrorMessage | Boolean | true | 校验不通过时,是否显示错误提示信息,统一控制全部表单项。如果希望控制单个表单项,请给 FormItem 设置该属性 | N -statusIcon | Boolean / Slot / Function | - | 校验状态图标,值为 `true` 显示默认图标,默认图标有 成功、失败、警告 等,不同的状态图标不同。`statusIcon` 值为 `false`,不显示图标。`statusIcon` 值类型为渲染函数,则可以自定义右侧状态图标。TS 类型:`boolean \| TNode`。[通用类型定义](https://github.com/Tencent/tdesign-vue/blob/develop/src/common.ts) | N +statusIcon | Boolean / Slot / Function | undefined | 校验状态图标,值为 `true` 显示默认图标,默认图标有 成功、失败、警告 等,不同的状态图标不同。`statusIcon` 值为 `false`,不显示图标。`statusIcon` 值类型为渲染函数,则可以自定义右侧状态图标。TS 类型:`boolean \| TNode`。[通用类型定义](https://github.com/Tencent/tdesign-vue/blob/develop/src/common.ts) | N submitWithWarningMessage | Boolean | false | 【讨论中】当校验结果只有告警信息时,是否触发 `submit` 提交事件 | N onReset | Function | | TS 类型:`(context: { e?: FormResetEvent }) => void`
表单重置时触发 | N onSubmit | Function | | TS 类型:`(context: SubmitContext) => void`
表单提交时触发。其中 `context.validateResult` 表示校验结果,`context.firstError` 表示校验不通过的第一个规则提醒。`context.validateResult` 值为 `true` 表示校验通过;如果校验不通过,`context.validateResult` 值为校验结果列表。
【注意】⚠️ 默认情况,输入框按下 Enter 键会自动触发提交事件,如果希望禁用这个默认行为,可以给输入框添加 enter 事件,并在事件中设置 `e.preventDefault()`。[详细类型定义](https://github.com/Tencent/tdesign-vue/tree/develop/src/form/type.ts)。
`interface SubmitContext { e?: FormSubmitEvent; validateResult: FormValidateResult; firstError?: string }`

`type FormValidateResult = boolean \| ValidateResultObj`

`type ValidateResultObj = { [key in keyof T]: boolean \| ValidateResultList }`

`type ValidateResultList = Array`

`type AllValidateResult = CustomValidateObj \| ValidateResultType`

`interface ValidateResultType extends FormRule { result: boolean }`

`type ValidateResult = { [key in keyof T]: boolean \| ErrorList }`

`type ErrorList = Array`
| N -onValidate | Function | | TS 类型:`(result: ValidateResultContext) => void`
校验结束后触发,result 值为 true 表示校验通过;如果校验不通过,result 值为校验结果列表。[详细类型定义](https://github.com/Tencent/tdesign-vue/tree/develop/src/form/type.ts)。
`type ValidateResultContext = Omit, 'e'>`
| N +onValidate | Function | | TS 类型:`(result: ValidateResultContext) => void`
校验结束后触发,result 值为 true 表示校验通过;如果校验不通过,result 值为校验结果列表。[详细类型定义](https://github.com/Tencent/tdesign-vue/tree/develop/src/form/type.ts)。
`type ValidateResultContext = Omit, 'e'>`
| N ### Form Events @@ -33,18 +33,18 @@ onValidate | Function | | TS 类型:`(result: ValidateResultContext -- | -- | -- reset | `(context: { e?: FormResetEvent })` | 表单重置时触发 submit | `(context: SubmitContext)` | 表单提交时触发。其中 `context.validateResult` 表示校验结果,`context.firstError` 表示校验不通过的第一个规则提醒。`context.validateResult` 值为 `true` 表示校验通过;如果校验不通过,`context.validateResult` 值为校验结果列表。
【注意】⚠️ 默认情况,输入框按下 Enter 键会自动触发提交事件,如果希望禁用这个默认行为,可以给输入框添加 enter 事件,并在事件中设置 `e.preventDefault()`。[详细类型定义](https://github.com/Tencent/tdesign-vue/tree/develop/src/form/type.ts)。
`interface SubmitContext { e?: FormSubmitEvent; validateResult: FormValidateResult; firstError?: string }`

`type FormValidateResult = boolean \| ValidateResultObj`

`type ValidateResultObj = { [key in keyof T]: boolean \| ValidateResultList }`

`type ValidateResultList = Array`

`type AllValidateResult = CustomValidateObj \| ValidateResultType`

`interface ValidateResultType extends FormRule { result: boolean }`

`type ValidateResult = { [key in keyof T]: boolean \| ErrorList }`

`type ErrorList = Array`
-validate | `(result: ValidateResultContext)` | 校验结束后触发,result 值为 true 表示校验通过;如果校验不通过,result 值为校验结果列表。[详细类型定义](https://github.com/Tencent/tdesign-vue/tree/develop/src/form/type.ts)。
`type ValidateResultContext = Omit, 'e'>`
+validate | `(result: ValidateResultContext)` | 校验结束后触发,result 值为 true 表示校验通过;如果校验不通过,result 值为校验结果列表。[详细类型定义](https://github.com/Tencent/tdesign-vue/tree/develop/src/form/type.ts)。
`type ValidateResultContext = Omit, 'e'>`
### FormInstanceFunctions 组件实例方法 名称 | 参数 | 返回值 | 描述 -- | -- | -- | -- -clearValidate | `(fields?: Array)` | \- | 清空校验结果。可使用 fields 指定清除部分字段的校验结果,fields 值为空则表示清除所有字段校验结果。清除邮箱校验结果示例:`clearValidate(['email'])` -reset | `(params?: FormResetParams)` | \- | 重置表单,表单里面没有重置按钮`