From 39200becd8c16f156749ce686e345960fbdb6dd4 Mon Sep 17 00:00:00 2001 From: azhe Date: Wed, 2 Aug 2023 14:56:34 +0800 Subject: [PATCH 1/4] Release/1.5.1 (#2647) * fix: changelog intent * feat: release 1.5.1 * feat: update common * chore: fix indent in changelog * chore: changelog's changes * chore: fix indent --------- Co-authored-by: github-actions[bot] --- .github/workflows/auto-release.yml | 2 +- CHANGELOG.md | 23 +++++++++++++++++++++-- package.json | 2 +- src/_common | 2 +- 4 files changed, 24 insertions(+), 5 deletions(-) diff --git a/.github/workflows/auto-release.yml b/.github/workflows/auto-release.yml index 37bcea9978..66a19bb03e 100644 --- a/.github/workflows/auto-release.yml +++ b/.github/workflows/auto-release.yml @@ -58,7 +58,7 @@ jobs: BODY: ${{ github.event.comment.body }} run: | txt=$(cat CHANGELOG.md) - echo "${txt%%##*} $BODY ${txt##*---}" > CHANGELOG.md + echo "${txt%%##*}$BODY${txt##*---}" > CHANGELOG.md git add . git config --local user.email "github-actions[bot]@users.noreply.github.com" git config --local user.name "github-actions[bot]" diff --git a/CHANGELOG.md b/CHANGELOG.md index e9c46dfda8..3bf2a839ff 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,26 @@ toc: false docClass: timeline --- - ## 🌈 1.5.0 `2023-07-25` +## 🌈 1.5.1 `2023-08-01` +### 🚀 Features +- `Table`: + - 可筛选表格,支持透传 attrs/style/classNames 属性、样式、类名等信息到自定义组件,[issue#2627](https://github.com/Tencent/tdesign-vue/issues/2627) @chaishi ([#2629](https://github.com/Tencent/tdesign-vue/pull/2629)) + - 虚拟滚动场景,支持通过行唯一标识跳转到指定行(通过行下标跳转到指定行,以前的版本已支持) @chaishi ([#2643](https://github.com/Tencent/tdesign-vue/pull/2643)) +- `Upload`: 拖拽上传场景,支持 accept 限制可上传的文件类型 @chaishi ([common#1547](https://github.com/Tencent/tdesign-common/pull/1547)) +### 🐞 Bug Fixes +- `Checkbox`: 支持 `value` 传入 `undefined` @chaishi ([#2623](https://github.com/Tencent/tdesign-vue/pull/2623)) +- `Table`: + - 可筛选表格场景,filterValue 透传优化,没有显示写明 value 值的筛选项,不再透传 `undefined` 到子组件,因有些组件的默认值不允许为 undefined @chaishi ([#2623](https://github.com/Tencent/tdesign-vue/pull/2623)) + - 树形结构表格,修复选中行的值 `selectedRowKeys` 不在数据 `data` 中时,报错问题 @chaishi ([#2629](https://github.com/Tencent/tdesign-vue/pull/2629)) + - 修复 1.5.0 版本空表格没有显示占位元素问题 @chaishi ([#2641](https://github.com/Tencent/tdesign-vue/pull/2641)) + - 固定列空数据场景,元素显示错位问题 @chaishi ([#2641](https://github.com/Tencent/tdesign-vue/pull/2641)) +- `Input`: form表单disabled状态下input异常显示clear @sinbadmaster ([#2634](https://github.com/Tencent/tdesign-vue/pull/2634)) +- `Dialog`: + - 修复 dialog 初始化时没有执行移动相关的初始化逻辑,导致 image-viewer 小窗口图片查看器无法移动的问题 @yusongh ([#2622](https://github.com/Tencent/tdesign-vue/pull/2622)) + - 反馈类对话框补齐body class @uyarn ([#2645](https://github.com/Tencent/tdesign-vue/pull/2645)) +- `TreeSelect`: 修复自定义标签,点击关闭异常的问题 @sinbadmaster ([#2631](https://github.com/Tencent/tdesign-vue/pull/2631)) + +## 🌈 1.5.0 `2023-07-25` ### 🚀 Features - `Table`: 新增 `lazyLoad` 表格元素懒加载,当出现在可视区域时,再渲染表格第一屏数据 @chaishi ([#2605](https://github.com/Tencent/tdesign-vue/pull/2605)) - `Transfer`: 新增 `targetDraggable` API , 支持对目标列表拖拽排序的功能 @uyarn ([#2612](https://github.com/Tencent/tdesign-vue/pull/2612)) @@ -36,7 +55,7 @@ docClass: timeline - 修复 `treeNodeModel` 实例未能同步 node 属性的问题 - 优化节点状态更新时的性能 - ## 🌈 1.4.8 `2023-07-18` +## 🌈 1.4.8 `2023-07-18` ### 🚀 Features - `DatePicker`: 优化关闭浮层后重置默认选中区域 @honkinglin ([#2585](https://github.com/Tencent/tdesign-vue/pull/2585)) - `Checkbox`: @chaishi ([#2583](https://github.com/Tencent/tdesign-vue/pull/2583) diff --git a/package.json b/package.json index 7274229ec7..4d88b0934f 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "tdesign-vue", "purename": "tdesign", - "version": "1.5.0", + "version": "1.5.1", "description": "tdesign-vue", "title": "tdesign-vue", "keywords": [ diff --git a/src/_common b/src/_common index 772d0a3638..05f588ae6c 160000 --- a/src/_common +++ b/src/_common @@ -1 +1 @@ -Subproject commit 772d0a36386f57d2e98e373f142f5e4e75e44ac1 +Subproject commit 05f588ae6c1d71255320a7d7f6ff61b7cd14318c From 5932335b608f1bd0113587f55df4aa1d66fab059 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?w=C5=AB=20y=C4=81ng?= Date: Wed, 2 Aug 2023 16:06:26 +0800 Subject: [PATCH 2/4] chore: release 1.5.2 (#2657) * chore: release 1.5.2 * chore: update rollup config --- CHANGELOG.md | 2 +- package.json | 4 ++-- script/rollup.config.js | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3bf2a839ff..b40fd752cc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,7 @@ toc: false docClass: timeline --- -## 🌈 1.5.1 `2023-08-01` +## 🌈 1.5.2 `2023-08-01` ### 🚀 Features - `Table`: - 可筛选表格,支持透传 attrs/style/classNames 属性、样式、类名等信息到自定义组件,[issue#2627](https://github.com/Tencent/tdesign-vue/issues/2627) @chaishi ([#2629](https://github.com/Tencent/tdesign-vue/pull/2629)) diff --git a/package.json b/package.json index 4d88b0934f..1d07abc17b 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "tdesign-vue", "purename": "tdesign", - "version": "1.5.1", + "version": "1.5.2", "description": "tdesign-vue", "title": "tdesign-vue", "keywords": [ @@ -63,7 +63,7 @@ "lint": "npm run lint:tsc && eslint --ext .vue,.js,.ts,.tsx ./ --max-warnings 0", "lint:tsc": "tsc --emitDeclarationOnly", "generate:usage": "node script/generate-usage/index.js", - "test": "npm run test:unit && npm run test:snap", + "test": "npm run test:unit && npm run test:snap", "test:unit": "vitest run --config vitest.config.js", "test:update": "vitest run -u && npm run test:snap-update", "test:unit-dev": "vitest", diff --git a/script/rollup.config.js b/script/rollup.config.js index c8a6b901c2..d38a041d3a 100644 --- a/script/rollup.config.js +++ b/script/rollup.config.js @@ -79,7 +79,7 @@ const getPlugins = ({ }), ignoreImport({ include: ['src/*/style/*'], - body: 'import "./css.js";', + body: 'import "./style/css.js";', }), ); } else if (ignoreLess) { @@ -91,7 +91,7 @@ const getPlugins = ({ }), ignoreImport({ include: ['src/*/style/*'], - body: 'import "./index.js";', + body: 'import "./style/index.js";', }), ); } From 69f3934d5df1268aee3421155e4445e8ca545610 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 3 Aug 2023 11:24:30 +0800 Subject: [PATCH 3/4] chore(deps-dev): bump fs-extra from 10.1.0 to 11.1.1 (#2651) Bumps [fs-extra](https://github.com/jprichardson/node-fs-extra) from 10.1.0 to 11.1.1. - [Changelog](https://github.com/jprichardson/node-fs-extra/blob/master/CHANGELOG.md) - [Commits](https://github.com/jprichardson/node-fs-extra/compare/10.1.0...11.1.1) --- updated-dependencies: - dependency-name: fs-extra dependency-type: direct:development update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 1d07abc17b..182902d490 100644 --- a/package.json +++ b/package.json @@ -150,7 +150,7 @@ "eslint-plugin-cypress": "^2.12.1", "eslint-plugin-import": "^2.23.4", "eslint-plugin-vue": "^8.1.1", - "fs-extra": "^10.1.0", + "fs-extra": "^11.1.1", "glob": "^8.0.3", "gray-matter": "^4.0.3", "husky": "^7.0.4", From 455e146d3c1ef0a4fcc9b4fa393e36c25c221b2d Mon Sep 17 00:00:00 2001 From: sheepluo Date: Thu, 3 Aug 2023 12:06:59 +0800 Subject: [PATCH 4/4] feat(table): support TableEditableCellConfig.keepEditMode (#2662) * feat(table): support TableEditableCellConfig.keepEditMode * test: update snapshots --- src/table/_example/editable-cell.vue | 11 +- src/table/editable-cell.tsx | 15 +- src/table/table.en-US.md | 1 + src/table/table.md | 1 + src/table/type.ts | 5 + test/snap/__snapshots__/csr.test.js.snap | 319 ++++++++++++++++++----- test/snap/__snapshots__/ssr.test.js.snap | 2 +- 7 files changed, 277 insertions(+), 77 deletions(-) diff --git a/src/table/_example/editable-cell.vue b/src/table/_example/editable-cell.vue index 31dec48cad..408b049fde 100644 --- a/src/table/_example/editable-cell.vue +++ b/src/table/_example/editable-cell.vue @@ -9,7 +9,6 @@ :editable-cell-state="editableCellState" bordered lazyLoad - @row-validate="onRowValidate" /> @@ -128,6 +127,8 @@ export default { cell: (h, { row }) => row.letters.join('、'), edit: { component: Select, + keepEditMode: true, + rules: [{ validator: (val) => val.length > 0, message: '至少选择一种' }], // props, 透传全部属性到 Select 组件 // props 为函数时,参数有:col, row, rowIndex, colIndex, editedRow。一般用于实现编辑组件之间的联动 props: ({ @@ -186,11 +187,9 @@ export default { methods: { // 用于控制哪些行或哪些单元格不允许出现编辑态 editableCellState(cellParams) { - const { row } = cellParams; - return row.status !== 2; - }, - onRowValidate(params) { - console.log('validate:', params); + const { rowIndex } = cellParams; + // return row.status !== 2; + return rowIndex !== 2; }, // 用于提交前校验数据(示例代码有效,勿删) diff --git a/src/table/editable-cell.tsx b/src/table/editable-cell.tsx index 8aa05bba8b..35b5f0999a 100644 --- a/src/table/editable-cell.tsx +++ b/src/table/editable-cell.tsx @@ -79,7 +79,10 @@ export default defineComponent({ setup(props: EditableCellProps, context: SetupContext) { const { row, col } = toRefs(props); const tableEditableCellRef = ref(null); - const isEdit = ref(props.col.edit?.defaultEditable || false); + + const isKeepEditMode = computed(() => col.value.edit?.keepEditMode); + + const isEdit = ref(isKeepEditMode.value || col.value.edit?.defaultEditable || false); const editValue = ref(); const errorList = ref(); const classPrefix = usePrefixClass(); @@ -90,6 +93,12 @@ export default defineComponent({ editValue.value = val; }; + watch([isKeepEditMode], (val) => { + if (val) { + isEdit.value = true; + } + }); + const editOnListeners = computed(() => { const listeners = col.value.edit?.on?.({ ...cellParams.value, editedRow: currentRow.value, updateEditedCellValue }) || {}; // example: onEnter-> enter @@ -213,7 +222,9 @@ export default defineComponent({ editOnListeners.value[eventName]?.(args[2]); // 此处必须在事件执行完成后异步销毁编辑组件,否则会导致事件清除不及时引起的其他问题 const timer = setTimeout(() => { - isEdit.value = false; + if (!isKeepEditMode.value) { + isEdit.value = false; + } errorList.value = []; props.onEditableChange?.({ ...cellParams.value, diff --git a/src/table/table.en-US.md b/src/table/table.en-US.md index 40e9e7fbe2..8f37081a8e 100644 --- a/src/table/table.en-US.md +++ b/src/table/table.en-US.md @@ -292,6 +292,7 @@ name | type | default | description | required abortEditOnEvent | Array | - | Typescript:`string[]` | N component | \- | - | component definition。Typescript:`ComponentType`。[see more ts definition](https://github.com/Tencent/tdesign-vue/blob/develop/src/common.ts) | N defaultEditable | Boolean | false | set default editable once | N +keepEditMode | Boolean | false | set table cell always to be editable | N on | Function | - | Typescript:`(context: TableEditableCellPropsParams) => { [eventName: string]: Function }` | N onEdited | Function | - | trigger on finishing editing。Typescript:`(context: PrimaryTableOnEditedContext) => void` `type PrimaryTableOnEditedContext = PrimaryTableCellParams & { trigger: string; newRowData: T; }`。[see more ts definition](https://github.com/Tencent/tdesign-vue/tree/develop/src/table/type.ts) | N props | Object | - | props of `edit.component`。Typescript:`TableEditableCellProps` `type TableEditableCellProps = TablePlainObject \| ((params: TableEditableCellPropsParams) => TablePlainObject)` `interface TableEditableCellPropsParams extends PrimaryTableCellParams { editedRow: T; updateEditedCellValue: (val: any) => void }` `interface TablePlainObject{ [key: string]: any }`。[see more ts definition](https://github.com/Tencent/tdesign-vue/blob/develop/src/common.ts)。[see more ts definition](https://github.com/Tencent/tdesign-vue/tree/develop/src/table/type.ts) | N diff --git a/src/table/table.md b/src/table/table.md index ec6370e5af..3b8e16846d 100644 --- a/src/table/table.md +++ b/src/table/table.md @@ -292,6 +292,7 @@ placement | String | top-right | 列配置按钮基于表格的放置位置: abortEditOnEvent | Array | - | 除了点击非自身元素退出编辑态之外,还有哪些事件退出编辑态。示例:`abortEditOnEvent: ['onChange']`。TS 类型:`string[]` | N component | \- | - | 组件定义,如:`Input` `Select`。对于完全自定义的组件(非组件库内的组件),组件需要支持 `value` 和 `onChange` ;如果还需要支持校验规则,则组件还需实现 `tips` 和 `status` 两个 API,实现规则可参考 `Input` 组件。TS 类型:`ComponentType`。[通用类型定义](https://github.com/Tencent/tdesign-vue/blob/develop/src/common.ts) | N defaultEditable | Boolean | false | 单元格默认状态是否为编辑态 | N +keepEditMode | Boolean | false | 设置当前列的单元格始终保持为编辑态 | N on | Function | - | 透传给编辑组件的事件。TS 类型:`(context: TableEditableCellPropsParams) => { [eventName: string]: Function }` | N onEdited | Function | - | 编辑完成后,退出编辑模式时触发。TS 类型:`(context: PrimaryTableOnEditedContext) => void` `type PrimaryTableOnEditedContext = PrimaryTableCellParams & { trigger: string; newRowData: T; }`。[详细类型定义](https://github.com/Tencent/tdesign-vue/tree/develop/src/table/type.ts) | N props | Object | - | 透传给组件 `edit.component` 的属性。TS 类型:`TableEditableCellProps` `type TableEditableCellProps = TablePlainObject \| ((params: TableEditableCellPropsParams) => TablePlainObject)` `interface TableEditableCellPropsParams extends PrimaryTableCellParams { editedRow: T; updateEditedCellValue: (val: any) => void }` `interface TablePlainObject{ [key: string]: any }`。[通用类型定义](https://github.com/Tencent/tdesign-vue/blob/develop/src/common.ts)。[详细类型定义](https://github.com/Tencent/tdesign-vue/tree/develop/src/table/type.ts) | N diff --git a/src/table/type.ts b/src/table/type.ts index 2285fb0bea..2686f52675 100644 --- a/src/table/type.ts +++ b/src/table/type.ts @@ -870,6 +870,11 @@ export interface TableEditableCellConfig * @default false */ defaultEditable?: boolean; + /** + * 设置当前列的单元格始终保持为编辑态 + * @default false + */ + keepEditMode?: boolean; /** * 透传给编辑组件的事件 */ diff --git a/test/snap/__snapshots__/csr.test.js.snap b/test/snap/__snapshots__/csr.test.js.snap index ddb86c021c..b07b9213c8 100644 --- a/test/snap/__snapshots__/csr.test.js.snap +++ b/test/snap/__snapshots__/csr.test.js.snap @@ -101524,26 +101524,70 @@ exports[`csr snapshot test > csr test ./src/table/_example/editable-cell.vue 1`] class="" >
- 宣传物料制作费用 - - - - - +
+
+
+ + + 宣传物料制作费用 + + + + + +
+ + + + + + +
+
+
+ csr test ./src/table/_example/editable-cell.vue 1`] class="" >
- 宣传物料制作费用 - - - - - +
+
+
+ + + 宣传物料制作费用 + + + + + +
+ + + + + + +
+
+
+ csr test ./src/table/_example/editable-cell.vue 1`] class="" >
- 宣传物料制作费用、algolia 服务报销 - - - - - +
+
+
+ + + 宣传物料制作费用 + + + + + + + + +1 + + +
+ + + + + + +
+
+
+ csr test ./src/table/_example/editable-cell.vue 1`] class="" >
- 宣传物料制作费用 - - - - - +
+
+
+ + + 宣传物料制作费用 + + + + + +
+ + + + + + +
+
+
+ renders ./src/table/_example/drag-sort.vue correctl exports[`ssr snapshot test > renders ./src/table/_example/drag-sort-handler.vue correctly 1`] = `"
排序
申请人
申请状态
签署方式
邮箱地址
申请时间
贾明审批通过电子签署
w.cezkdudy@lhll.au
2022-01-01
张三审批失败纸质签署
r.nmgw@peurezgn.sl
2022-02-01
王芳审批过期纸质签署
p.cumx@rampblpa.ru
2022-03-01
贾明审批通过电子签署
w.cezkdudy@lhll.au
2022-04-01
"`; -exports[`ssr snapshot test > renders ./src/table/_example/editable-cell.vue correctly 1`] = `"
申请人
申请状态
申请事项
创建日期
审批通过
宣传物料制作费用
2022-01-01
审批过期
宣传物料制作费用
2022-02-01
王芳
审批失败
宣传物料制作费用
2022-03-01
审批通过
宣传物料制作费用、algolia 服务报销
2022-04-01
审批过期
宣传物料制作费用
2022-01-01
"`; +exports[`ssr snapshot test > renders ./src/table/_example/editable-cell.vue correctly 1`] = `"
申请人
申请状态
申请事项
创建日期
审批通过
宣传物料制作费用
2022-01-01
审批过期
宣传物料制作费用
2022-02-01
王芳
审批失败
宣传物料制作费用
2022-03-01
审批通过
宣传物料制作费用+1
2022-04-01
审批过期
宣传物料制作费用
2022-01-01
"`; exports[`ssr snapshot test > renders ./src/table/_example/editable-row.vue correctly 1`] = `"

申请人
申请状态
申请事项
创建日期
操作栏
贾明
宣传物料制作费用
张三
审批过期
宣传物料制作费用
2022-02-01
王芳
审批失败
宣传物料制作费用
2022-03-01
贾明
审批通过
宣传物料制作费用、algolia 服务报销
2022-04-01
张三
审批过期
宣传物料制作费用
2022-01-01
"`;