From 1d0433478af59e281205f93cdddacec0e5a6faf1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?w=C5=AB=20y=C4=81ng?= Date: Thu, 23 Nov 2023 19:07:56 +0800 Subject: [PATCH] chore: release 1.8.0-naruto (#2926) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix(tree): tree 组件,解决 watch 回调时间过迟的问题 (#2873) * fix(tree): tree 组件,解决 watch 回调时间过迟的问题 * style(tree): tree 组件,代码样式改进 * test(tree): tree 组件,完善单元测试,验证 mounted 赋值可在 nextTick 触发数据变更 * [cascader]选项disabled修改后,选项不是禁用状态#2859 (#2872) * [cascader]选项disabled修改后,选项不是禁用状态#2859 * chore: fix lint --------- Co-authored-by: wū yāng * feat(tree): add api getTreeData (#2888) * refactor(tree): tree 组件完善数据初始化时机问题的解决方案 * feat(tree): tree 组件添加 api: getTreeData * test(tree): tree 组件,完善 getTreeData 方法的单元测试 * test(tree): 完善单元测试 * docs(tree): tree 组件完善文档 * feat(upload): support fileListDisplay=null to hide file list (#2889) * feat(image-viewer): support closeOnEscKeydown (#2890) * feat(Upload): add Some Features and Bugs (#2891) * feat: rebase develo * feat(upload): some features * test: update snapshots * fix: remove unsued code * feat(select): props collapsedItems to add onClose function (#2863) * fix: 修正 lodash 引入 (#2893) * fix(slider): step < 1 is not working (#2894) * fix(slider): fix step is not working * chore: update common * chore: update demo * fix(checkbox): value.splice does not work (#2896) * feat(checkbox): support Array.splice * revert: demo * chore: release 1.7.2 (#2895) * chore: release 1.7.2 * chore: changelog's changes --------- Co-authored-by: github-actions[bot] * chore: fix api docs (#2904) * chore: fix api docs * chore: fix api docs * fix: 误判断删除键(backspace)是空格键(space) (#2905) * docs(Input): value type remove Number * fix: 删除键(backspace)触发误判断成空格(space) * fix(popup): ignore mouseenter when destroyOnClose is true and is leaving (#2898) * feat(loading): support v-loading unbind (#2902) * fix(table): do not calculate th width if props.showHeader=false (#2909) * feat(space): compatibility problems (#2887) * fix(space): compatibility problems * test: unit tests * feat: update common and snapshots * test: update common and unit tests * test: update snapshots * chore: add ignore async expamle list test * fix(checkbox): unexpected behavior when disabled is handled (#2911) * fix(checkbox): unexpected behavior when disabled is handled * fix(checkbox): max disabled state --------- Co-authored-by: chaishi <974383157@qq.com> * feat(table): support update edited cell value (#2917) * [Checkbox] fix set value checked before options pushed, while checkbox UI is not checked (#2914) * fix: useElementLazyRender default value * fix(checkbox): set value before options change does not work * fix: useElementLazyRender * [Table] fix column resize problem; column controller of multiple header improvement (#2916) * docs: demo inprovement * fix(table): multi header column config * fix: 修复列宽调整问题 * fix(table): column controller of multiple header does not work * test: update snapshots * test: update snapshots * feat(input): support number type (#2906) * feat(input): support number type * feat(input): default type is string * fix: add ts * feat: inputvalue string * fix: lint error * feat(taginput): support prefixIcon * chore: remove api not implemented --------- Co-authored-by: wū yāng * feat(statistic): add Statistic component (#2397) * Merge branch 'docs/statistic' into feat/statistic * feat(statistic): add new component for statistic add new component for statistic BREAKING CHANGE: add statistic * perf(renamed icons for consistency): renamed icons for consistency Renamed icons for consistency * feat(statistic): add component tests and update examples add component tests and update examples * chore(submodules): submodules * docs(statistic): add file description * chore: update snapshot * chore: fix ui feedback * chore: update snapshot * chore: update common * chore: update common --------- Co-authored-by: Uyarn * fix(Textarea): autosize nextTick null err (#2921) * feat(table): lazyLoad works not properly (#2915) * fix: useElementLazyRender * test: update snapshots --------- Co-authored-by: Uyarn * chore: update docs (#2923) * chore: update docs * chore: update docs * chore: update CONTRIBUTING.md * fix(cascader): fix placeholder warning (#2924) * chore: release 1.8.0 (#2925) * chore: release 1.8.0 * chore: remove deprecated CHANGELOG * chore: changelog's changes --------- Co-authored-by: github-actions[bot] * chore: release 1.8.0-naruto --------- Co-authored-by: TabSpace Co-authored-by: lxc-orange <108909689+lxc-orange@users.noreply.github.com> Co-authored-by: sheepluo Co-authored-by: bloglab <37498563+ubloglab@users.noreply.github.com> Co-authored-by: fennghuang <89014758+fennghuang@users.noreply.github.com> Co-authored-by: github-actions[bot] Co-authored-by: liweijie0812 <674416404@qq.com> Co-authored-by: Guxi11 Co-authored-by: Zz-ZzzZ <48228016+Zz-ZzzZ@users.noreply.github.com> Co-authored-by: betavs <34408516+betavs@users.noreply.github.com> Co-authored-by: chaishi <974383157@qq.com> Co-authored-by: 李江辰 Co-authored-by: Nined --- CHANGELOG.md | 334 +- CONTRIBUTING.md | 184 +- PUBLISH.md | 2 - README-zh_CN.md | 6 + README.md | 6 + package.json | 2 +- site/site.config.mjs | 8 + src/_common | 2 +- src/anchor/__tests__/anchor-link.test.jsx | 2 +- src/anchor/anchor-item.tsx | 2 +- src/anchor/anchor.tsx | 2 +- src/auto-complete/auto-complete.tsx | 10 +- src/cascader/cascader.tsx | 16 +- src/cascader/hooks.ts | 2 +- src/checkbox/checkbox.tsx | 17 +- src/checkbox/group.tsx | 4 +- src/checkbox/hooks/useKeyboardEvent.ts | 4 +- src/checkbox/store.ts | 3 + src/color-picker/panel/swatches.tsx | 2 +- src/components.ts | 1 + src/grid/row.tsx | 2 +- src/hooks/useElementLazyRender.ts | 2 +- src/image-viewer/_example/base.vue | 2 +- src/image-viewer/image-viewer.en-US.md | 10 +- src/image-viewer/image-viewer.md | 8 +- src/image-viewer/image-viewer.tsx | 4 +- src/image-viewer/props.ts | 6 + src/image-viewer/type.ts | 9 +- src/image-viewer/utils.ts | 2 +- .../__snapshots__/index.test.jsx.snap | 1 - src/input/__tests__/vitest-input.test.jsx | 108 +- src/input/_example/base.vue | 28 +- src/input/index.ts | 6 +- src/input/input.en-US.md | 75 +- src/input/input.md | 47 +- src/input/input.tsx | 35 +- src/input/props.ts | 14 +- src/input/type.ts | 41 +- src/loading/directive.ts | 7 +- src/popup/popup.tsx | 16 +- src/radio/group.tsx | 4 +- src/select-input/select-input.en-US.md | 19 +- src/select-input/select-input.md | 17 +- src/select-input/type.ts | 16 +- src/select-input/useSingle.tsx | 8 +- .../__snapshots__/index.test.jsx.snap | 1 - src/select/_example/collapsed.vue | 27 +- src/select/props.ts | 2 +- src/select/select.en-US.md | 2 +- src/select/select.md | 4 +- src/select/select.tsx | 1 + src/select/type.ts | 4 +- src/slider/_example/input-number.vue | 2 +- src/slider/slider.tsx | 1 - src/space/__tests__/index.test.jsx | 2 +- src/space/__tests__/mount.jsx | 2 +- src/space/__tests__/vitest-space.test.jsx | 14 +- src/space/space.en-US.md | 4 +- src/space/space.tsx | 30 +- src/statistic/__tests__/index.test.jsx | 114 + src/statistic/_example/animation.vue | 32 + src/statistic/_example/base.vue | 6 + src/statistic/_example/color.vue | 9 + src/statistic/_example/combination.vue | 55 + src/statistic/_example/loading.vue | 16 + src/statistic/_example/slot.vue | 26 + src/statistic/_example/trend.vue | 7 + src/statistic/index.ts | 12 + src/statistic/props.ts | 81 + src/statistic/statistic.en-US.md | 22 + src/statistic/statistic.md | 22 + src/statistic/statistic.tsx | 142 + src/statistic/style/css.js | 1 + src/statistic/style/index.js | 1 + src/statistic/type.ts | 79 + src/table/_example/affix.vue | 79 +- src/table/_example/editable-row.vue | 27 +- src/table/_example/multi-header.vue | 2 +- src/table/editable-cell.tsx | 17 +- src/table/hooks/useAffix.ts | 1 + src/table/hooks/useColumnController.tsx | 8 +- src/table/hooks/useEditableCell.tsx | 8 +- src/table/hooks/useEditableRow.ts | 55 +- src/table/hooks/useFixed.ts | 11 +- src/table/primary-table.tsx | 29 +- src/table/table.en-US.md | 4 +- src/table/table.md | 4 +- src/table/type.ts | 8 +- src/tag-input/props.ts | 4 + src/tag-input/tag-input.en-US.md | 27 +- src/tag-input/tag-input.md | 21 +- src/tag-input/tag-input.tsx | 16 +- src/tag-input/type.ts | 17 +- src/tag-input/useTagList.tsx | 2 +- src/textarea/textarea.tsx | 1 + .../__snapshots__/index.test.jsx.snap | 1 - src/tree-select/type.ts | 7 +- src/tree-select/useTreeSelect.ts | 3 +- src/tree/__tests__/api.test.jsx | 126 +- src/tree/__tests__/event.test.jsx | 5 +- src/tree/_example/checkable.vue | 182 +- src/tree/_example/operations.vue | 55 +- src/tree/hooks/useTreeStore.ts | 11 +- src/tree/tree.en-US.md | 3 +- src/tree/tree.md | 3 +- src/tree/tree.tsx | 64 +- src/tree/type.ts | 4 + .../__snapshots__/vitest-upload.test.jsx.snap | 96 +- src/upload/_example/base.vue | 4 +- src/upload/_example/file-flow-list.vue | 7 + src/upload/_example/image.vue | 18 +- src/upload/_example/img-flow-list.vue | 60 +- src/upload/constants.ts | 1 + src/upload/hooks/useUpload.ts | 2 +- src/upload/interface.ts | 2 + src/upload/props.ts | 21 +- src/upload/themes/dragger-file.tsx | 16 +- src/upload/themes/image-card.tsx | 25 +- src/upload/themes/multiple-flow-list.tsx | 107 +- src/upload/themes/normal-file.tsx | 17 +- src/upload/type.ts | 35 +- src/upload/upload.en-US.md | 8 +- src/upload/upload.md | 10 +- src/upload/upload.tsx | 12 + test/snap/__snapshots__/csr.test.js.snap | 35967 ++-------------- test/snap/__snapshots__/ssr.test.js.snap | 224 +- test/snap/ssr.test.js | 6 +- 127 files changed, 6976 insertions(+), 32284 deletions(-) create mode 100644 src/statistic/__tests__/index.test.jsx create mode 100644 src/statistic/_example/animation.vue create mode 100644 src/statistic/_example/base.vue create mode 100644 src/statistic/_example/color.vue create mode 100644 src/statistic/_example/combination.vue create mode 100644 src/statistic/_example/loading.vue create mode 100644 src/statistic/_example/slot.vue create mode 100644 src/statistic/_example/trend.vue create mode 100644 src/statistic/index.ts create mode 100644 src/statistic/props.ts create mode 100644 src/statistic/statistic.en-US.md create mode 100644 src/statistic/statistic.md create mode 100644 src/statistic/statistic.tsx create mode 100644 src/statistic/style/css.js create mode 100644 src/statistic/style/index.js create mode 100644 src/statistic/type.ts diff --git a/CHANGELOG.md b/CHANGELOG.md index 04319a809..9987029c6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,63 @@ toc: false docClass: timeline --- +## 🌈 1.8.0 `2023-11-23` + +### 🚀 Features + +- `Statistic`: 新增`Statistic`统计数值组件 @LIjiAngChen8 ([#2397](https://github.com/Tencent/tdesign-vue/pull/2397)) +- `Loading`: 支持使用 v-if 和 v-loading 混用的场景 @Zz-ZzzZ ([#2902](https://github.com/Tencent/tdesign-vue/pull/2902)) +- `Space`: 支持老旧浏览器也能正常显示子元素之间的间距,[#1901](https://github.com/Tencent/tdesign-vue/issues/1901) @chaishi ([#2887](https://github.com/Tencent/tdesign-vue/pull/2887)) +- `Table`: 可编辑单元格/可编辑行场景,支持使用参数 `updateEditedCellValue` 更新其他处于编辑态的列数据 @chaishi ([#2917](https://github.com/Tencent/tdesign-vue/pull/2917)) +- `Input`: 恢复 `value` 对`number`的支持 @chaishi ([#2906](https://github.com/Tencent/tdesign-vue/pull/2906)) + +### 🐞 Bug Fixes + +- `Radio`: 修复误判删除键(backspace)是空格键(space)的问题 @liweijie0812 ([#2905](https://github.com/Tencent/tdesign-vue/pull/2905)) +- `Checkbox`: 修复误判删除键(backspace)是空格键(space)的问题 @liweijie0812 ([#2905](https://github.com/Tencent/tdesign-vue/pull/2905)) +- `Table`: @chaishi + - 列配置操作场景,修复表头不显示时,报错问题 ([#2909](https://github.com/Tencent/tdesign-vue/pull/2909)) + - 优化多级表头的列配置功能,不再显示非叶子节点 ([#2916](https://github.com/Tencent/tdesign-vue/pull/2916)) + - 修复列宽调整在某种情况下的列宽问题 ([#2916](https://github.com/Tencent/tdesign-vue/pull/2916)) + - 修复懒加载场景默认依然会执行内部逻辑问题 @chaishi ([#2915](https://github.com/Tencent/tdesign-vue/pull/2915)) +- `Checkbox`: 修复 `CheckboxGroup.max` 超出数量限制时的禁用态显示问题,[issue#2908](https://github.com/Tencent/tdesign-vue/issues/2908) @betavs ([#2911](https://github.com/Tencent/tdesign-vue/pull/2911)) +- `Checkbox`: 修复提前设置某个选项的值在选中项 `CheckboxGorup.value` 里面,再放入选项到 `options` 中,选项呈现状态为非选中问题 @chaishi ([#2914](https://github.com/Tencent/tdesign-vue/pull/2914)) +- `Checkbox`: 修复懒加载场景默认依然会执行内部逻辑问题 @chaishi ([#2915](https://github.com/Tencent/tdesign-vue/pull/2915)) +- `Cascader`: 修复数字为 value 时的告警问题 @uyarn ([#2924](https://github.com/Tencent/tdesign-vue/pull/2924)) +- `TreeSelect`: 修复数字为 value 时的告警问题 @uyarn ([#2924](https://github.com/Tencent/tdesign-vue/pull/2924)) +- `Popup`: 修复`destroyOnClose`时,快速重复 hover 后组件无法正常展示的问题 @guxi11 ([#2898](https://github.com/Tencent/tdesign-vue/pull/2898)) +- `Textarea`: 修复表格中使用 `Textarea` 且设置`autosize`为 true 报错的问题 ([#2912](https://github.com/Tencent/tdesign-vue/issues/2912)) @nined9 ([#2921](https://github.com/Tencent/tdesign-vue/pull/2921)) + +### 🚧 Others + +- `Table`: 优化吸顶表头/表尾示例代码 @chaishi ([#2916](https://github.com/Tencent/tdesign-vue/pull/2916)) + + +## 🌈 1.7.2 `2023-11-07` +### 🚀 Features +- `ImageViewer`: 新增支持 `closeOnEscKeydown` ,用于控制是否允许 ESC 键关闭预览 @chaishi ([#2890](https://github.com/Tencent/tdesign-vue/pull/2890)) +- `Upload`: @chaishi + - 批量文件上传支持在列表中显示上传失败的原因,[tdesign-vue-next#2518](https://github.com/Tencent/tdesign-vue-next/issues/2518) ([#2891](https://github.com/Tencent/tdesign-vue/pull/2891)) + - 支持使用 `fileListDisplay=null` 隐藏文件或文件列表显示 ([#2889](https://github.com/Tencent/tdesign-vue/pull/2889)) + - 图片预览功能,新增支持透传图片预览全部属性 `imageViewerProps`,[tdesign-vue-next#2928](https://github.com/Tencent/tdesign-vue-next/issues/2928) ([#2891](https://github.com/Tencent/tdesign-vue/pull/2891)) + - ⚠️新增图片上传大小超出限制提醒,有额外单独实现此功能的业务需注意是否存在重复显示大小限制提醒问题,[tdesign-vue-next#2736](https://github.com/Tencent/tdesign-vue-next/issues/2736) ([#2891](https://github.com/Tencent/tdesign-vue/pull/2891)) + - 多文件/图片上传场景下,`autoUpload=false` 时,支持使用 Props 属性/函数/插槽等方法自定义上传按钮和取消上传按钮,[tdesign-vue-next#2469](https://github.com/Tencent/tdesign-vue-next/issues/2469) ([#2891](https://github.com/Tencent/tdesign-vue/pull/2891)) + - 多文件/图片上传场景下,`autoUpload=false` 时,区分已上传状态和待上传状态 [tdesign-vue-next#2518](https://github.com/Tencent/tdesign-vue-next/issues/2518) ([#2891](https://github.com/Tencent/tdesign-vue/pull/2891)) +- `Select`: + - `collapsedItems` 属性或插槽新增参数 `onClose`,用于删除标签 @ubloglab ([#2863](https://github.com/Tencent/tdesign-vue/pull/2863)) +### 🐞 Bug Fixes +- `Tree` + - 解决 `watch` 回调时间过迟的问题 @TabSpace ([#2873](https://github.com/Tencent/tdesign-vue/pull/2873)) + - 提供获取树结构数据的API getTreeData @TabSpace ([#2888](https://github.com/Tencent/tdesign-vue/pull/2888)) +- `Upload`: 修复 `max=1 multiple=false` 情况下,无法替换上传文件问题,[tdesign-vue-next#2909](https://github.com/Tencent/tdesign-vue-next/issues/2909) @chaishi ([#2891](https://github.com/Tencent/tdesign-vue/pull/2891)) +- `Cascader`: 选项`disabled`修改后,选项不是禁用状态的问题 #2859 @lxc-orange ([#2872](https://github.com/Tencent/tdesign-vue/pull/2872)) +- 修正部分组件使用 `lodash` 非按需引入导致全量引入的问题 @fennghuang ([#2893](https://github.com/Tencent/tdesign-vue/pull/2893)) +- `Slider`: 修复step小于1无法正常使用的问题 @uyarn ([#2894](https://github.com/Tencent/tdesign-vue/pull/2894)) +- `Link`: 修复样式居中的缺陷 @uyarn ([#2894](https://github.com/Tencent/tdesign-vue/pull/2894)) +- `Checkbox`: 修复 value.splice 无法设置选中项变化问题 @chaishi + + + ## 🌈 1.7.1 `2023-10-20` ### 🚀 Features - `Table`: 可筛选表格,支持设置 `confirmEvents: ['onChange']` 后,单选筛选器(Radio) 选择完成后自动关闭筛选器浮层 @chaishi ([#2850](https://github.com/Tencent/tdesign-vue/pull/2850)) @@ -2540,280 +2597,3 @@ CSS 类名规范: - Form: 过滤 validate 结果,当字段校验不通过时,只返回校验失败的结果,[pr 55](https://github.com/TDesignOteam/tdesign-vue/pull/55),[@dellyoung](https://github.com/dellyoung) - Pagination: 支持受控用法,[pr 42](https://github.com/TDesignOteam/tdesign-vue/pull/42),[@chaishi](https://github.com/chaishi) - Tabs: 没有选项卡时依然可以显示新增选项卡按钮,[pr 10](https://github.com/Tencent/tdesign-vue/pull/10),[@start940315](https://github.com/start940315) - -## 🌈 0.31.0 `2021-12-09` - -### ❗️ BREAKING CHANGES - -- Loading: CSS 类名规范,[@chaishi](https://github.com/chaishi) -- Anchor: CSS 类名规范,[@zWingz](https://github.com/zWingz) -- Slider: - - `inputNumberProps` 默认值改为 `false`,[@pengYYYYY](https://github.com/pengYYYYY) - - 内置 inputNumber 组件 DOM 层级调整,[@pengYYYYY](https://github.com/pengYYYYY) - -### 🐞 Bug Fixes - -- Table: - - 修复第一列跨行且夸列时,单元格合并设置不生效的问题,[@realyuyanan](https://github.com/realyuyanan) - - 修复表格二级行数据使用 $set 无法更新的问题,[@chaishi](https://github.com/chaishi) -- Swiper: 修复在 esm 引用下样式丢失的问题,[@cong-min](https://github.com/cong-min) -- Radio: 修复 `click` 事件被 emit 两次的问题,[@chaishi](https://github.com/chaishi) -- Checkbox: 修复 `click` 事件没有 emit,[@chaishi](https://github.com/chaishi) -- Dialog: 修复切换显示/隐藏动画存在闪动的问题,[@pengYYYYY](https://github.com/pengYYYYY) -- Nofication: 修复 icon 不能自定义配置的问题,[@chaishi](https://github.com/chaishi) -- Radio: 修复 Radio Group 初始化未被渲染导致滑块缺失的问题,[@HQ-Lin](https://github.com/HQ-Lin) -- Datepicker: [@xiaosansiji](https://github.com/xiaosansiji) - - 修复 `prefixIcon` 和 `suffixIcon` 支持 slot 用法的问题 - - 修复清空操作会唤起日期选择框的问题 - -### 🚀 Features - -- Loading: `size` 支持传入 `string` 类型字体大小单位,[@chaishi](https://github.com/chaishi) -- Menu: 优化侧边导航栏滚动条样式,[@pengYYYYY](https://github.com/pengYYYYY) -- 兼容项目中使用了 [@vue/composition-api](https://www.npmjs.com/package/@vue/composition-api) 的情况:默认使用项目中引入的 `composition-api` 包,[@LeeJim](https://github.com/LeeJim) -- Dropdown: [@uyarn](https://github.com/uyarn) - - `minColumnWidth` 和 `maxColumnWidth` 支持 `string` 类型 - - DropdownItem `value` 支持 `object` 类型 -- Cascader: [@pengYYYYY](https://github.com/pengYYYYY) - - 补充 `onChange` args - - 空数据时下拉框宽度跟随 input 宽度设置 - -## 🌈 0.30.0 `2021-12-02` - -### ❗️ BREAKING CHANGES - -- CSS 类名规范: [@chaishi](https://github.com/chaishi) - - Dialog: `t-dialog-confirm` 更为 `t-dialog__confirm`,`t-dialog-cancel` 更为 `t-dialog__cancel` - - Drawer: `t-drawer-confirm` 更为 `t-drawer__confirm`,`t-drawer-cancel` 更为 `t-drawer__cancel` - -### 🐞 Bug Fixes - -- Dialog: 修复设置按钮为 null,无法隐藏按钮的问题 [@chaishi](https://github.com/chaishi) -- Drawer: 修复确认/取消按钮无法支持插槽渲染问题 [@chaishi](https://github.com/chaishi) -- Transfer: 修复全选状态展示有误的问题 [@BigLiao](https://github.com/BigLiao) -- Checkbox: 修复 `change` 事件值返回不正确的问题 [@chaishi](https://github.com/chaishi) -- Button: 修复幽灵按钮无点击动效的问题 [@xiaosansiji](https://github.com/xiaosansiji) -- Memu: 修复暗黑模式下菜单分组标题颜色使用错误的问题 [@LeeJim](https://github.com/LeeJim) -- Input: [@chaishi](https://github.com/chaishi) - - 修复 `change` 事件无法获取到最新数据的问题 - - 修复重复触发 `onChange` 事件的问题 -- Datepicker: 修复区间选择跨年情况下月份展示错误的问题 [@xiaosansiji](https://github.com/xiaosansiji) - -### 🚀 Features - -- Upload: [@chaishi](https://github.com/chaishi) - - 自动上传模式删除非必要上传按钮 - - 输入框模式新增删除按钮 -- Popconfirm: 移除 确认/取消按钮 外层元素 `` [@chaishi](https://github.com/chaishi) -- Textarea: 支持 `maxcharacter` 用于字符文本长度控制 [@zhaodanchun](https://github.com/zhaodanchun) -- Table: `expandedRow` 支持插槽写法 [@realyuyanan](https://github.com/realyuyanan) -- Cascader: 补充 `change` 事件缺失的 `context` 参数,包含触发节点和触发来源 `{ node, source }` [@chaishi](https://github.com/chaishi) -- TreeSelect: 补充 `blur` 和 `focus` 事件参数 `FocusEvent` [@chaishi](https://github.com/chaishi) -- Checkbox: 全选功能支持插槽写法 [@chaishi](https://github.com/chaishi) - -## 🌈 0.29.1 `2021-11-30` - -### 🐞 Bug Fixes - -- Popup: 修复嵌套使用 Popup 时不能正确响应 hover trigger 的问题 [@ikeq](https://github.com/ikeq) -- Datepicker: 修复 0.29.0 版本中星期显示错误的问题 -- Upload: 修复图片预览框闪动的问题 [@chaishi](https://github.com/chaishi) - -### 🚀 Features - -- Upload: 新增开关,用于控制是否显示为模拟进度 [@chaishi](https://github.com/chaishi) -- Datepicker [@xiaosansiji](https://github.com/xiaosansiji) -- `firstDayOfWeek` API 重构,官网新增设置星期开始样例 -- 全局配置星期和月份文案格式修改 - -## 🌈 0.29.0 `2021-11-24` - -### ❗️ BREAKING CHANGES - -- Menu: `expanded` 优化为受控属性,`defaultExpanded` 为非受控属性 [@LeeJim](https://github.com/LeeJim) -- LocalProvider 配置多语言方案已废弃,请升级为 ConfigProvider,参考 [文档](https://tdesign.tencent.com/vue/components/config),[@chaishi](https://github.com/chaishi) -- Select: TS 类型 `Options` 更为 `SelectOption`,[@chaishi](https://github.com/chaishi) - -### 🐞 Bug Fixes - -- TreeSelect: - - 修复 `data` 为空时,显示异常的问题 [@Godlike-meteor](https://github.com/Godlike-meteor) - - 修复节点选择后重新展开了子树的问题,[@LeeJim](https://github.com/LeeJim) -- Popup: 优化动画实现,修复基于 Popup 组件的相关组件收起动画未正常展示的问题 [@uyarn](https://github.com/uyarn) -- Select: - - 修复 `options` 有相同 `value` 时不重新渲染的问题,[@geff1991](https://github.com/geff1991) - - 修复透传 `popupProps` 属性失效的问题,[@HQ-Lin](https://github.com/HQ-Lin) - - 修复多选情况下,选项宽度不够时 Checkbox 选择框展示不全的问题 [@uyarn](https://github.com/uyarn) -- Table: ,[@realyuyanan](https://github.com/realyuyanan) - - 修复表格内容溢出问题,、 - - 修复只有一列时,固定表头与内容无法对齐的问题, -- Tree: 修复节点数据更新后,丢失选中状态的问题 [@TabSpace](https://github.com/TabSpace) -- Radio: 修复 `radio-group` value 不存在时渲染异常的问题 [@HQ-Lin](https://github.com/HQ-Lin) -- 修复构建后 d.ts 文件丢失的问题,[@BuptStEve](https://github.com/BuptStEve) - -### 🚀 Features - -- Steps: 组件部分逻辑重构,`direction` 即将在下个版本废弃,请改用 `layout` API,可选项类型不变,[@LeeJim](https://github.com/LeeJim) -- Menu: 支持子菜单 `disabled` 配置,[@LeeJim](https://github.com/LeeJim) -- Cascader: `checkStrictly=true` 时,点击选项,级联选择器不会收起;`collapsedItems` 支持 function/slot 自定义配置用法,[@yc910920](https://github.com/yc910920) -- Select: ,[@chaishi](https://github.com/chaishi) - - 优化分组选择器标签语义, - - 加载状态新增显示右侧加载图标, - - `options` 配置支持分组选择器, - - `options` 新增参数 `content`,用于定义复杂的选项内容,如:`content: (h) =>
复杂标签内容
` - - `t-option` 支持 `content: TNode`,用于渲染子元素,支持 function/slot 用法,同 `default` - - 分组选择器支持使用 `divider` 控制分隔线是否显示 -- Tree: 实现 `disableCheck` 属性,优化减少使用 `watch` 特性,[@TabSpace](https://github.com/TabSpace) -- Upload: ,[@chaishi](https://github.com/chaishi) - - 补充上传失败判定条件,`formatResponse` 返回值 `error` 为真,则表示上传失败 - - progress 事件参数新增 `type: 'real' | 'mock'`,分别表示真实进度和模拟进度 - - 如果接口和 `formatResponse` 都没有返回 url,组件会默认填充一个图片预览地址 - - progress 事件返回的进度不会超过 100 - - 上传成功后执行 `formatResponse` -- Tabs: 优化 Panel 渲染实现 [@start940315](https://github.com/start940315) - -## 🌈 0.28.2 `2021-11-16` - -### ❗️ BREAKING CHANGES - -- 从 0.28.0 版本开始,将只在外网 npm registry 上发布,请安装外网包 [tdesign-vue](https://www.npmjs.com/package/tdesign-vue) -- 有单独引入图标使用的小伙伴请改为引入外网包 `tdesign-icons-vue` - -### 🐞 Bug Fixes - -- Select: 监听 options 中 label value 变化,修复多选模式下默认值传字符串的展示问题,[@geff1991](https://github.com/geff1991) -- Menu: ,[@LeeJim](https://github.com/LeeJim) - - 修复顶部导航下拉菜单与双层导航激活样式效果丢失的问题, - - 修复动态设置菜单内容时交互异常的问题, - - 修复切换菜单收起时,`expanded` 状态不同步的问题, -- Radio: 修复 `value` 不支持 `boolean` 类型的问题 [@ikeq](https://github.com/ikeq) -- Loading: 修复 Safari 浏览器下加载中样式展示异常的问题,[@uyarn](https://github.com/uyarn) -- Popup: 修复 Popup/Popconfirm 等弹出组件 arrow 定位未跟随弹出框内容的问题,[@HQ-Lin](https://github.com/HQ-Lin) -- Upload: 修复组件 disabled 态下依然响应点击事件的问题,[@pengYYYYY](https://github.com/pengYYYYY) -- Input/InputNumber: 修复小键盘未能正常触发 Enter 事件的问题 [@mokywu](https://github.com/mokywu) -- Transfer: 修复 Tree 属性结构模式无法使用的问题,[@BigLiao](https://github.com/BigLiao) -- Table: - - 修复 `Column.width` 传入百分比不生效的问题 [@LeeJim](https://github.com/LeeJim) - - 修复树型结构 disabled 状态的行数据仍可被选择的问题,[@chaishi](https://github.com/chaishi) -- Form: - - 修复配置自定义校验规则时,清空输入框以及下拉框无法触发自定义校验函数的问题 [@dellyoung](https://github.com/dellyoung) - - Form 组件去除校验成功后的绿色边框,如果需要可以添加 `successBorder` 设置 [@dellyoung](https://github.com/dellyoung) -- TimePicker: ,[@uyarn](https://github.com/uyarn) - - 修复 `step` 设置值大于 1 时处理逻辑, - - 修复清空输入框图标展示逻辑, -- InputNumber: - - 修复小键盘未能正常触发 Enter 事件的问题,[@chaishi](https://github.com/chaishi) - - 修复过程数据未清空导致显示异常的问题 [@jchalex](https://github.com/jchalex) -- CheckBox: 修复 CheckBox Group 受控用法数据同步问题 [@uyarn](https://github.com/uyarn) - -### 🚀 Features - -- Menu: 优化多级菜单的缩进,处理 popup 箭头旋转,[@LeeJim](https://github.com/LeeJim) -- Avatar: 新增头像组件,使用请参考 [官网文档](https://tdesign.tencent.com/vue/components/avatar),[@gh1198843222](https://github.com/gh1198843222) -- Loading: 所有官方组件中的加载状态,统一修改为 Loading 组件实现,统一体验,[@uyarn](https://github.com/uyarn) -- Table: `rowClassName` 支持传入 `string` 类型,[@realyuyanan](https://github.com/realyuyanan) -- Calendar: 组件及 ConfigProvider 均新增 `fillWithZero` 属性,用于控制日期以 'dd' 格式展示,[@PsTiu](https://github.com/PsTiu) -- Tabs: 组件重构,修复滚动问题,[@start940315](https://github.com/start940315) - -## 🌈 0.27.2 `2021-11-09` - -### 🐞 Bug Fixes - -- Table: 修复 `size=small` 时,排序按钮被遮挡的问题 [@realyuyanan](https://github.com/realyuyanan) - -### 🚀 Features - -- Popconfirm: 确认及取消按钮支持 slot 用法 [@zhaodanchun](https://github.com/zhaodanchun) -- Icon: 包中默认导出及注册 Icon 组件,兼容全量引入图标的用法,[@uyarn](https://github.com/uyarn) - -## 🌈 0.27.0 `2021-11-08` - -### ❗️ BREAKING CHANGES - -- Icon: 官方提供的默认 Icon 拆分为 npm 独立包发布,有单独引入图标使用的小伙伴请改为引入 `tdesign-icons-vue`。 -- Table: 优化样式类名,`t-table-row--selected` 更为 `t-table__row--selected`,`t-table-row--disabled` 更为 `t-table__row--disabled` - -### 🐞 Bug Fixes - -- Tree: 修复异步加载用法下 `checkStrictly === true` 未生效的问题 [@TabSpace](https://github.com/TabSpace) -- TreeSelect: 修复 v-model 绑定数据展示异常的问题 [@Godlike-meteor](https://github.com/Godlike-meteor) -- Tab: 修复 `destroyOnHide` 不生效的问题 [@zhaodanchun](https://github.com/zhaodanchun) -- Tag: 修复 `icon` 属性只实现了 render function, 不支持 `slot` 用法的问题,[@pengYYYYY](https://github.com/pengYYYYY) -- Pagination: 修复 `totalContent` 不支持 Function 用法的问题 [@uyarn](https://github.com/uyarn) -- Select: 修复未提供默认 `placeholder` 内容的问题,[@pengYYYYY](https://github.com/pengYYYYY) -- Radio: 修复动态修改数据时,选中渲染展示异常的问题 [@HQ-Lin](https://github.com/HQ-Lin) -- Datepicker: 修复快捷选项较多时,展示异常的问题 [@xiaosansiji](https://github.com/xiaosansiji) -- Select: 修复在 Form 表单中使用时,表单验证样式异常的问题 [@uyarn](https://github.com/uyarn) -- Table: - - 修复切换分页配置会重复触发 pageChange 事件的问题 [@uyarn](https://github.com/uyarn) - - 修复空数据状态下样式展示问题 [@realyuyanan](https://github.com/realyuyanan) - - 修复 `small` 尺寸下展开按钮被遮挡的问题 [@realyuyanan](https://github.com/realyuyanan) - - 修复设置 `maxHeight` 后固定滚动展示异常的问题 [@realyuyanan](https://github.com/realyuyanan) - - 修复配置多级表头时,表格列排序消失的问题 [@realyuyanan](https://github.com/realyuyanan) - - 修复 Table 类型定义问题 [@chaishi](https://github.com/chaishi) - -### 🚀 Features - -- Upload: 支持抛出上传模拟进度,[@byq1213](https://github.com/byq1213) -- Form: FormItem 支持 `requiredMark` 属性,用于控制是否显示必填符号 [@dellyoung](https://github.com/dellyoung) -- Table: 新增 `filter.component` 属性用于自定义表格中的过滤组件,[@chaishi](https://github.com/chaishi) -- Popconfirm、Dialog: 新增主题相关的样式 `class` 配置 [@uyarn](https://github.com/uyarn) -- Grid: 优化 `gutter` 计算逻辑,[@HQ-Lin](https://github.com/HQ-Lin) -- Table: 新增 `tree` 属性,支持在表格中展示树形结构,[@chaishi](https://github.com/chaishi) - - `tree.indent` 控制树结点缩进距离,单位:px,默认为 24px - - `tree.treeNodeColumnIndex` 控制树结点在第几列渲染,默认为 0 ,第一列 - - `tree.childrenKey` 控制树形结构子节点字段,默认为 children - - `tree.checkStrictly` 控制树形结构的行选中(多选),父子行选中是否独立,默认独立,值为 true - - `selectChange` 事件回调参数新增 `type`,用以区分操作类型 - -## 🌈 0.26.0 `2021-11-01` - -### 🐞 Bug Fixes - -- 全局注册:自动全局注册所有组件,防止使用 umd 资源时组件无法渲染的问题 [@BuptStEve](https://github.com/BuptStEve) -- Popup: 修复 popperjs 2.10.0 版本类型校验导致的报错 ,[@ikeq](https://github.com/ikeq) -- InputNumber: 修复增加/减少控制按钮 Icon 无法正常显示的问题 [@HQ-Lin](https://github.com/HQ-Lin) -- Table: 修复隐藏行展开控制图标时,点击仍然响应的问题 [@chaishi](https://github.com/chaishi) -- Cascader: ,[@pengYYYYY](https://github.com/pengYYYYY) - - 修复 `filterable` 属性设置无效的问题, - - 修复 Cascader 不支持完全受控用法的问题, - - 修复 设置为 `check-strictly` 模式时,点击非叶子节点报错的问题, -- Datepicker: 修复 `placeholder` 属性传入数组类型报错的问题 [@xiaosansiji](https://github.com/xiaosansiji) - -### 🚀 Features - -- 暗黑模式:组件支持暗黑模式在线切换,使用请参考 [文档](http://tdesign.tencent.com/vue/components/dark-mode),[@xiaosansiji](https://github.com/xiaosansiji) -- Cascader: ,[@pengYYYYY](https://github.com/pengYYYYY) - - 新增 `minCollapsedNum` 属性,用于多选情况下,控制超出该数值的选中项折叠显示 - - 新增 `collapsedItems` 属性,用于设置折叠项内容,默认为 `+N` -- Form: 优化 FormItem 提示文案展示效果,防止出现提示时出现页面闪动或滚动的效果,[@HQ-Lin](https://github.com/HQ-Lin) -- Textarea: 透传外层属性,[@zhaodanchun](https://github.com/zhaodanchun) -- Datepicker: [@xiaosansiji](https://github.com/xiaosansiji) - - 新增 `pick` 事件,面板中选中日期时触发, - - 选择时间段时,开始时间优化为 `00:00:00`,结束时间为 `23:59:59`, - -## 🌈 0.25.0 `2021-10-21` - -### ❗️ BREAKING CHANGES - -- Button: `shape` 默认值由 `square` 调整为 `rectangle`,支持正方形按钮展示,手动设置 `shape = square` 的小伙伴请删除设置,没有设置过 `shape` 属性的可以忽略,[@HQ-Lin](https://github.com/HQ-Lin) - -### 🐞 Bug Fixes - -- InputNumber: 修复 `value = undefined` 时报错的问题 [@jchalex](https://github.com/jchalex) -- Radio: 修复 RadioButton `options` 为空数组时报错的问题 [@HQ-Lin](https://github.com/HQ-Lin) -- Popup/Tooltip: 修复 reference 宽度过小时箭头位置展示错位的问题 [@ikeq](https://github.com/ikeq) -- Select: 修复多选模式下,选项无法点击选中的问题 [@geff1991](https://github.com/geff1991) -- Table: - - 修复固定列时投影样式溢出的问题 [@realyuyanan](https://github.com/realyuyanan) - - 修复跨表格拖拽时会交换行的问题,[@cool-518](https://github.com/cool-518) - -### 🚀 Features - -- Tooltip: `theme` 新增可选值 `light`,支持白色风格 tooltip 弹窗 [@ikeq](https://github.com/ikeq) -- Table: ,[@chaishi](https://github.com/chaishi) - - 新增 `expandIcon` 属性,支持自定义展开图标 - - 新增 `expandOnRowClick` 属性,允许点击整行展开/收起 - - 支持 `row-mouseenter` 和 `row-mouseleave` 事件 -- Dropdown: 支持 `dropdown-item` slot 用法,[@uyarn](https://github.com/uyarn) -- Popup: 优化弹出层方向判断逻辑 [@uyarn](https://github.com/uyarn) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 014e3f4a8..f2e5c2f4c 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,36 +1,174 @@ -# 参与贡献 +# CONTRIBUTING -非常感谢你对 TDesign 的关注,如果你想为组件库或其他产品贡献一份力量,请先了解下以下内容。 +`tdesign-vue` 包含 `vue` 代码和一个子仓库,子仓库指向 `tdesign-common`仓库 -## 开启 issue +## 开发 + +### 安装依赖 -如果你想要贡献一个新特性,请在实际写代码前先开一个 issue 与社区里的小伙伴一起讨论必要性及实现方案。 +```bash +npm i +``` -## Github flow 贡献流程 +### 本地开发 -- 请将本项目 clone 至本地 -- 创建 feature/fix 分支 -- 开发过程中可以使用 `git fetch` 或 `git rebase` 来同步上游分支代码 -- 提交代码到 forked 仓库,commit message 撰写请参照 [Angular Commits 规范](https://github.com/angular/angular.js/blob/master/DEVELOPERS.md#commits) -- 发起 pr -- 会有 PMC 同学来 CR 本次提交的代码,请及时关注 CR 评论通知信息 -- CR 通过后会合并进入 develop 分支,等待周迭代或紧急 patch 版本发布 npm +```bash +npm run start +``` -## 开发 +浏览器访问 + +### 目录结构 + +```text +├── script // 构建代码 +├── site // 站点代码 +├── src // 组件代码 + └─ componentA + ├── _example // 组件示例文档 + ├── _usage // 组件 live demo + └─ __tests__ // 组件测试用例 +└─ test // 测试配置文件 +``` + +### 组件页路由配置 + +每一个组件页,都是一个 md 文件,参考 `/site/config/index.js` 已有定义,直接按照模板添加即可 + +```js +{ + title: '基础组件', + type: 'component', // 组件文档 + children: [ + { + title: 'Button 按钮', + name: 'button', + component: () => import(`@/examples/components/button/button.md`), + }, + { + title: 'Icon 图标', + name: 'icon', + component: () => import(`@/examples/components/icon/icon.md`), + }, + ... + ], +}, +``` + +### Markdown 文件 demo 引用 + +文档 demo 排列与 common 仓库中的 UI demo 展示一致 + +```markdown +{{ base }} +[demo 描述(可不填)] +``` + +### Demo 调试 + +当一个 md 文件插入了很多个 demo 之后,一些组件生命周期方法调试起来会变得困难,若想对某个 demo 单独调试,可以访问路由:/demos/组件名/demo 名, + +例如: + +### 单元测试 & e2e 测试文档 + +[组件测试文档](./test/README.md) + +## git + +### 分支 + +主仓库遵循使用 `git flow` 规范,新组件分支从 `develop checkout`:[https://nvie.com/posts/a-successful-git-branching-model/](https://nvie.com/posts/a-successful-git-branching-model/) + +如果是贡献组件,则从 `develop checkout` 分支如:`feature/button`,记得如果同时要在子仓库开发 UI,子仓库也要 `checkout` 同名分支 + +> 关于 fork + +以下内容处理 `fork` 仓库后,远端仓库的更新如何同步到 `fork` 仓库 ```bash -# 子仓库需要ssh拉取,如果出现类似Host Key verification failed的错误,请先配置ssh,参考文档(https://git-scm.com/book/zh/v2/%E6%9C%8D%E5%8A%A1%E5%99%A8%E4%B8%8A%E7%9A%84-Git-%E7%94%9F%E6%88%90-SSH-%E5%85%AC%E9%92%A5) -git clone --recurse-submodules https://github.com/Tencent/tdesign-vue.git -cd tdesign-vue +# 建立 upstream remote +git remote add upstream git@github.com:Tencent/tdesign-vue.git -# 开发预览 -npm i -npm run dev +# 更新 upstream +git fetch upstream develop + +# 合并 upstream develop 到本地 +git checkout develop -# 打开浏览器访问 http://127.0.0.1:16000 +git merge upstream/develop ``` -更多指引请参考: +## 提交说明 + +项目使用基于 angular 提交规范:[https://github.com/conventional-changelog/commitlint/tree/master/@commitlint/config-conventional](https://github.com/conventional-changelog/commitlint/tree/master/@commitlint/config-conventional) + +每次提交会自动触发提交验证 + +- 使用工具 commitizen 协助规范 git commit 信息 +- fix & feat 的提交会被用来生成 changelog +- 提交会触发 git pre-commit 检查,修复提示的 eslint 错误, + +## 公共子仓库 tdesign-common + +本项目以子仓库的形式引入 `tdesign-common` 公共仓库,对应 `src/\_common` 文件夹 +公共仓库中包含 + +- 一些公共的工具函数 +- 组件库 `UI` 开发内容,既 `html` 结构和 `css` 样式(React/Vue 共用) + +### 初始化子仓库 + +- 初次克隆代码后需要初始化子仓库: `git submodule init && git submodule update` +- git submodule update 之后子仓库不指向任何分支,只是一个指向某一个提交的游离状态 + +### 子仓库开发 + +子仓库组件分支从 `develop checkout` 示例:`feature/button`,提交代码时先进入子仓库完成提交,然在回到主仓库完成提交 + +- 先进入 `src/\_common` 文件夹,正常将样式修改添加提交 +- 回到主仓库,此时应该会看到 `src/\_common` 文件夹是修改状态,按照正常步骤添加提交即可 + +## 关于组件库 UI + +UI 开发(HTML & CSS)是多个框架共用的,比如 React-web/Vue-web/Vue-next web。各个框架组件实现应该要复用 UI 开发的 html 结构,引用其组件 CSS 与 Demo CSS(本仓库已在入口处引用了),UI 开发一般可由单独的 UI 开发同学认领完成或各框架组件开发同学的其中一名同学完成 + +- 如果开发前已有某个组件的 UI 开发内容,直接在主仓库使用即可 +- 如果没有,且你也负责 UI 开发:参考 UI 开发规范完成 UI 开发内容、然后再开发主仓库组件 +- 如果没有,且 UI 开发工作已有其他同学负责或认领:可以先在主仓库开发组件功能,待 UI 开发输出之后对齐即可 + +如果 UI 内容和样式(其他同学负责开发)还未完成,而你开发组件功能时需要写一些样式,可以直接在组件文件夹先写一个临时的 less 文件,在 js 中引入即可,如: + +```bash +├── button.less +├── button.tsx +``` + +```js +// button.tsx + +// 先引入临时的样式文件用于开发功能,待 UI 开发完成之后需要与 UI 样式对齐并删除 less 文件 +import './button.less'; +``` + +## 开发规范 + +UI 开发规范参考子仓库 README [子仓库 README](https://github.com/Tencent/tdesign-common/blob/main/style/web/README.md) + +### 新建组件 + +```shell +npm run generate:component +``` + +### API 规范 + +API 由 API 平台统一管理生成 https://github.com/tdesignoteam/tdesign-api + +### 前缀 + +组件和 `CSS` 前缀以 `t-` 开头,无论 `js` 还是 `css` 都使用变量定义前缀,方便后续替换 + +### CSS -- [开发指南](./DEVELOP_GUIDE.md) -- [测试指南](./TEST_GUIDE.md) +组件样式在 `common` 子仓库开发,遵循 [tdesign-common 仓库 UI 开发规范](https://github.com/Tencent/tdesign-common/blob/main/style/web/README.md) diff --git a/PUBLISH.md b/PUBLISH.md index f92ec14d5..e0127d94f 100644 --- a/PUBLISH.md +++ b/PUBLISH.md @@ -11,8 +11,6 @@ ## 版本号说明 -目前还没有发布 1.0.0 正式版本,因此可以随时发布 PATCH、MINOR 及 MAJOR 版本,1.0.0 发布后 MINOR 及 MAJOR 版本的发布需要 PMC 团队决策后发布。 - 版本号设置遵循 [SemVer 语义化版本控制规范 2.0.0](https://semver.org/lang/zh-CN/),一切以保证用户版本稳定性为前提,原则如下: - 当进行不兼容的 API 更改时,升级 MAJOR 版本 diff --git a/README-zh_CN.md b/README-zh_CN.md index 8806e628c..74e870593 100644 --- a/README-zh_CN.md +++ b/README-zh_CN.md @@ -74,6 +74,12 @@ npm package 中提供了多种构建产物,可以阅读 [这里](https://githu TDesign 欢迎任何愿意参与贡献的参与者。如果需要本地运行代码或参与贡献,请先阅读[参与贡献](https://github.com/Tencent/tdesign-vue/blob/develop/CONTRIBUTING.md)。 +## 贡献成员 + + + + + # 反馈 有任何问题,建议通过 [Github issues](https://github.com/Tencent/tdesign-vue/issues) 反馈或扫码加入用户微信群。 diff --git a/README.md b/README.md index e1f8f3968..f702d1602 100644 --- a/README.md +++ b/README.md @@ -76,6 +76,12 @@ TDesign also provides component libraries for other platforms and frameworks. Contributing is welcome. Read [guidelines for contributing](https://github.com/Tencent/tdesign-vue/blob/develop/CONTRIBUTING.md) before submitting your [Pull Request](https://github.com/Tencent/tdesign-vue/pulls). +## Contributors + + + + + # Feedback Create your [Github issues](https://github.com/Tencent/tdesign-vue/issues) or scan the QR code below to join our user groups diff --git a/package.json b/package.json index 03c53612d..3612cc595 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "tdesign-vue", "purename": "tdesign", - "version": "1.7.1-naruto", + "version": "1.8.0-naruto", "description": "tdesign-vue", "title": "tdesign-vue", "keywords": [ diff --git a/site/site.config.mjs b/site/site.config.mjs index 149565574..8a5a95ce1 100644 --- a/site/site.config.mjs +++ b/site/site.config.mjs @@ -504,6 +504,14 @@ const docs = [ component: () => import('tdesign-vue/skeleton/skeleton.md'), componentEn: () => import('tdesign-vue/skeleton/skeleton.en-US.md'), }, + { + title: 'Statistic 统计数值', + titleEn: 'Statistic', + name: 'statistic', + path: '/vue/components/statistic', + component: () => import('tdesign-vue/statistic/statistic.md'), + componentEn: () => import('tdesign-vue/statistic/statistic.en-US.md'), + }, { title: 'Swiper 轮播框', titleEn: 'Swiper', diff --git a/src/_common b/src/_common index 8d29d8199..3506c0dd4 160000 --- a/src/_common +++ b/src/_common @@ -1 +1 @@ -Subproject commit 8d29d81998e3f2fb25fc9696507bffc20dfb9d56 +Subproject commit 3506c0dd4ec5ebd28c81ead1a84f26b0ab3a561e diff --git a/src/anchor/__tests__/anchor-link.test.jsx b/src/anchor/__tests__/anchor-link.test.jsx index 7472352fa..c9adc963a 100644 --- a/src/anchor/__tests__/anchor-link.test.jsx +++ b/src/anchor/__tests__/anchor-link.test.jsx @@ -1,6 +1,6 @@ import { mount } from '@vue/test-utils'; import Vue from 'vue'; -import { omit } from 'lodash'; +import omit from 'lodash/omit'; import { AnchorItem } from '@/src/anchor/index.ts'; const defaultProvide = { diff --git a/src/anchor/anchor-item.tsx b/src/anchor/anchor-item.tsx index e9ec75c89..ad5e9c591 100644 --- a/src/anchor/anchor-item.tsx +++ b/src/anchor/anchor-item.tsx @@ -1,6 +1,6 @@ import Vue, { VueConstructor } from 'vue'; import { ScopedSlotReturnValue } from 'vue/types/vnode'; -import { isEmpty } from 'lodash'; +import isEmpty from 'lodash/isEmpty'; import { VNode } from 'vue/types/umd'; import { ANCHOR_SHARP_REGEXP } from './utils'; import props from './anchor-item-props'; diff --git a/src/anchor/anchor.tsx b/src/anchor/anchor.tsx index df4e44468..0f306fdfd 100644 --- a/src/anchor/anchor.tsx +++ b/src/anchor/anchor.tsx @@ -1,6 +1,6 @@ import Vue, { VueConstructor } from 'vue'; import { ScopedSlotReturnValue } from 'vue/types/vnode'; -import { isFunction } from 'lodash'; +import isFunction from 'lodash/isFunction'; import { ANCHOR_SHARP_REGEXP, ANCHOR_CONTAINER, getOffsetTop } from './utils'; import { on, off, getScroll, scrollTo, getScrollContainer, diff --git a/src/auto-complete/auto-complete.tsx b/src/auto-complete/auto-complete.tsx index 4d1408a3c..00bb96257 100644 --- a/src/auto-complete/auto-complete.tsx +++ b/src/auto-complete/auto-complete.tsx @@ -3,7 +3,7 @@ import { } from 'vue'; import props from './props'; import { TdAutoCompleteProps } from './type'; -import Input, { InputProps, TdInputProps } from '../input'; +import Input, { InputProps, StrInputProps } from '../input'; import Popup, { PopupProps } from '../popup'; import useCommonClassName from '../hooks/useCommonClassName'; import AutoCompleteOptionList from './option-list'; @@ -51,7 +51,7 @@ export default defineComponent({ return classes; }); - const onInputChange: TdInputProps['onChange'] = (value, context) => { + const onInputChange: StrInputProps['onChange'] = (value, context) => { setTValue(value, context); }; @@ -64,7 +64,7 @@ export default defineComponent({ return tProps; }); - const onInnerFocus: InputProps['onFocus'] = (value, context) => { + const onInnerFocus: StrInputProps['onFocus'] = (value, context) => { popupVisible.value = true; emit('focus', { ...context, value }); props.onFocus?.({ ...context, value }); @@ -73,7 +73,7 @@ export default defineComponent({ }); }; - const onInnerBlur: InputProps['onBlur'] = (value, context) => { + const onInnerBlur: StrInputProps['onBlur'] = (value, context) => { emit('blur', { ...context, value }); props.onBlur?.({ ...context, value }); }; @@ -88,7 +88,7 @@ export default defineComponent({ props.onCompositionstart?.({ ...context, value }); }; - const onInnerEnter: InputProps['onEnter'] = (value, context) => { + const onInnerEnter: StrInputProps['onEnter'] = (value, context) => { emit('enter', { ...context, value }); props.onEnter?.({ ...context, value }); }; diff --git a/src/cascader/cascader.tsx b/src/cascader/cascader.tsx index 86735794b..3aba8ba6b 100644 --- a/src/cascader/cascader.tsx +++ b/src/cascader/cascader.tsx @@ -15,8 +15,6 @@ import { } from './interface'; import { useConfig, usePrefixClass, useCommonClassName } from '../hooks/useConfig'; import { PopupVisibleChangeContext } from '../popup'; -import { InputValue } from '../input'; - import { closeIconClickEffect, handleRemoveTagEffect } from './core/effect'; import { getPanels, getSingleContent, getMultipleContent } from './core/helper'; import { getFakeArrowIconClass } from './core/className'; @@ -49,10 +47,14 @@ export default defineComponent({ const panels = computed(() => getPanels(cascaderContext.value.treeNodes)); - const inputPlaceholder = computed( - () => (cascaderContext.value.visible && !props.multiple && getSingleContent(cascaderContext.value)) - || (props.placeholder ?? global.value.placeholder), - ); + const inputPlaceholder = computed(() => { + if (cascaderContext.value.visible && !props.multiple) { + let placeholder = getSingleContent(cascaderContext.value); + if (typeof placeholder === 'number') placeholder = String(placeholder); + return placeholder; + } + return props.placeholder ?? global.value.placeholder; + }); const { formDisabled } = useFormDisabled(); const isDisabled = computed(() => formDisabled.value || cascaderContext.value.disabled); @@ -160,7 +162,7 @@ export default defineComponent({ inputProps: { size: this.size, ...(this.inputProps as TdCascaderProps['inputProps']) }, tagInputProps: { size: this.size, ...(this.tagInputProps as TdCascaderProps['tagInputProps']) }, tagProps: { ...(this.tagProps as TdCascaderProps['tagProps']) }, - onInputChange: (value: InputValue, ctx: SelectInputValueChangeContext) => { + onInputChange: (value: string, ctx: SelectInputValueChangeContext) => { if (!this.isFilterable) return; setInputVal(`${value}`); (this?.selectInputProps as TdSelectInputProps)?.onInputChange?.(value, ctx); diff --git a/src/cascader/hooks.ts b/src/cascader/hooks.ts index abeef71f4..7620857fa 100644 --- a/src/cascader/hooks.ts +++ b/src/cascader/hooks.ts @@ -188,7 +188,7 @@ export const useCascaderContext = (props: TdCascaderProps) => { updateExpend(); updatedTreeNodes(); }, - { immediate: true }, + { immediate: true, deep: true }, ); // tree插件配置变化 diff --git a/src/checkbox/checkbox.tsx b/src/checkbox/checkbox.tsx index 62dbe2fd9..674f0a98a 100644 --- a/src/checkbox/checkbox.tsx +++ b/src/checkbox/checkbox.tsx @@ -1,5 +1,5 @@ import { - defineComponent, ref, toRefs, inject, watch, onBeforeUnmount, computed, + defineComponent, ref, toRefs, inject, watch, onBeforeUnmount, computed, nextTick, } from 'vue'; import props from './props'; import { @@ -110,7 +110,9 @@ export default defineComponent({ } if (parentDisabled !== undefined) { tDisabled.value = parentDisabled; + return; } + tDisabled.value = disabled; }; watch([checkboxStore], () => { @@ -149,7 +151,13 @@ export default defineComponent({ if (data.type === 'checked') { handleParentCheckedChange(data); } else if (data.type === 'checkbox') { - handleParentDisabled(data); + /** + * checked state can influence disabled state because of `max`, + * therefore we need to update disabled state after checked state changed + */ + nextTick(() => { + handleParentDisabled(data); + }); if (data.checkboxName) { tName.value = data.checkboxName; } @@ -161,6 +169,9 @@ export default defineComponent({ [data, label, storeKey], () => { if (!storeKey.value) return; + if (!tChecked.value && checkboxStore.value?.parentChecked?.includes(props.value)) { + tChecked.value = true; + } subscribeParentData(props.checkAll ? 'CHECK_ALL' : value.value); }, { immediate: true }, @@ -174,7 +185,7 @@ export default defineComponent({ if (props.readonly) return; const checked = !tChecked.value; setInnerChecked(checked, { e }); - if (checkboxGroupData?.value.handleCheckboxChange) { + if (checkboxGroupData?.value.onCheckedChange) { checkboxGroupData.value.onCheckedChange({ checked, checkAll: props.checkAll, diff --git a/src/checkbox/group.tsx b/src/checkbox/group.tsx index f20188c5a..3a8f884e4 100644 --- a/src/checkbox/group.tsx +++ b/src/checkbox/group.tsx @@ -159,8 +159,8 @@ export default defineComponent({ ); watch( - [innerValue], - ([val], [oldValue]) => { + () => [...innerValue.value], + (val, oldValue) => { nextTick(() => { checkboxStore.updateChecked({ checked: val, diff --git a/src/checkbox/hooks/useKeyboardEvent.ts b/src/checkbox/hooks/useKeyboardEvent.ts index 1433afd68..a4f9ebecb 100644 --- a/src/checkbox/hooks/useKeyboardEvent.ts +++ b/src/checkbox/hooks/useKeyboardEvent.ts @@ -1,8 +1,8 @@ -export const CHECKED_CODE_REG = /(enter|space)/i; +export const CHECKED_CODE = ['Enter', 'Space']; export function useKeyboardEvent(handleChange: (e: Event) => void) { const keyboardEventListener = (e: KeyboardEvent) => { - const isCheckedCode = CHECKED_CODE_REG.test(e.key) || CHECKED_CODE_REG.test(e.code); + const isCheckedCode = CHECKED_CODE.includes(e.key) || CHECKED_CODE.includes(e.code); if (isCheckedCode) { e.preventDefault(); const { disabled } = (e.currentTarget as HTMLElement).querySelector('input'); diff --git a/src/checkbox/store.ts b/src/checkbox/store.ts index 0603d7c43..f4379da84 100644 --- a/src/checkbox/store.ts +++ b/src/checkbox/store.ts @@ -36,6 +36,8 @@ export type ObserverListenerParams = { class CheckboxStore { observerMap: ObserverMap = {}; + parentChecked: CheckboxGroupValue; + parentExist: boolean; init() { @@ -45,6 +47,7 @@ class CheckboxStore { updateChecked({ checked, isCheckAll, oldChecked, indeterminate, }: UpdateCheckedData) { + this.parentChecked = checked; const changedChecked = oldChecked ? getChangedChecked(checked, oldChecked) : checked; const checkedParams: ObserverListenerParams = { parentChecked: checked, diff --git a/src/color-picker/panel/swatches.tsx b/src/color-picker/panel/swatches.tsx index 7aeffe187..8e983a78d 100644 --- a/src/color-picker/panel/swatches.tsx +++ b/src/color-picker/panel/swatches.tsx @@ -2,7 +2,7 @@ import { computed, defineComponent, PropType, ref, } from 'vue'; import { DeleteIcon as TdDeleteIcon, AddIcon as TdAddIcon } from 'tdesign-icons-vue'; -import { cloneDeep } from 'lodash'; +import cloneDeep from 'lodash/cloneDeep'; import { Select as TSelect, Option as TOption } from '../../select'; import { Color } from '../utils'; import { useBaseClassName } from '../hooks'; diff --git a/src/components.ts b/src/components.ts index 4bed40b19..1ad64ac30 100644 --- a/src/components.ts +++ b/src/components.ts @@ -55,6 +55,7 @@ export * from './list'; export * from './loading'; export * from './progress'; export * from './skeleton'; +export * from './statistic'; export * from './swiper'; export * from './table'; export * from './tag'; diff --git a/src/grid/row.tsx b/src/grid/row.tsx index 562400397..c2a6893c0 100644 --- a/src/grid/row.tsx +++ b/src/grid/row.tsx @@ -24,7 +24,7 @@ export default mixins(classPrefixMixins).extend({ props: { ...props }, setup(props) { - provide('rowContext', props.gutter); + provide('rowContext', { gutter: props.gutter }); }, data() { diff --git a/src/hooks/useElementLazyRender.ts b/src/hooks/useElementLazyRender.ts index ac1362fdb..df35b59bf 100644 --- a/src/hooks/useElementLazyRender.ts +++ b/src/hooks/useElementLazyRender.ts @@ -5,7 +5,7 @@ import observe from '../_common/js/utils/observe'; export function useElementLazyRender(labelRef: Ref, lazyLoad: Ref) { const ioObserver = ref(); - const showElement = ref(true); + const showElement = ref(!lazyLoad.value); const handleLazyLoad = () => { if (!lazyLoad.value || !labelRef.value || ioObserver.value) return; diff --git a/src/image-viewer/_example/base.vue b/src/image-viewer/_example/base.vue index aa8e7668d..5952c12f3 100644 --- a/src/image-viewer/_example/base.vue +++ b/src/image-viewer/_example/base.vue @@ -1,7 +1,7 @@