diff --git a/CHANGELOG.en-US.md b/CHANGELOG.en-US.md index 742f704ca8d..e3aafc826d9 100644 --- a/CHANGELOG.en-US.md +++ b/CHANGELOG.en-US.md @@ -1,6 +1,6 @@ # CHANGELOG -## NEXT_VERSION +## 2.41.0 ### Breaking Changes @@ -9,6 +9,7 @@ ### i18n - Add kmKH locale. +- Add ugCN locale. ### Features diff --git a/CHANGELOG.zh-CN.md b/CHANGELOG.zh-CN.md index 2740c468397..dd6c97db9d9 100644 --- a/CHANGELOG.zh-CN.md +++ b/CHANGELOG.zh-CN.md @@ -1,6 +1,8 @@ # CHANGELOG -## NEXT_VERSION +## 2.41.0 + +`2025-01-05` ### Breaking Changes @@ -9,10 +11,11 @@ ### i18n - 添加 kmKH 国际化 +- 添加 ugCN 国际化 ### Features -- `n-modal` 新增 `draggable` 属性,关闭 [#6525](https://github.com/tusen-ai/naive-ui/issues/6525),[#5792](https://github.com/tusen-ai/naive-ui/issues/5792),[#5711](https://github.com/tusen-ai/naive-ui/issues/5711),[#5501](https://github.com/tusen-ai/naive-ui/issues/5501),[#2152](https://github.com/tusen-ai/naive-ui/issues/2152) +- `n-modal` 新增 `draggable` 属性,关闭 [#6525](https://github.com/tusen-ai/naive-ui/issues/6525)、[#5792](https://github.com/tusen-ai/naive-ui/issues/5792)、[#5711](https://github.com/tusen-ai/naive-ui/issues/5711)、[#5501](https://github.com/tusen-ai/naive-ui/issues/5501)、[#2152](https://github.com/tusen-ai/naive-ui/issues/2152) - `useDialog` 支持 `draggable` 参数 - `useModal` 支持 `draggable` 参数 diff --git a/demo/pages/docs/community/enUS/index.md b/demo/pages/docs/community/enUS/index.md index 24b6206fb01..370baa35124 100644 --- a/demo/pages/docs/community/enUS/index.md +++ b/demo/pages/docs/community/enUS/index.md @@ -22,4 +22,4 @@ If you want to contribute excellent resources, please contact 07akioni or amadeu | [Dumogu-admin](https://admin.dumogu.top/base-naive-ui/) | Vue3, Vite5, Naive UI, Minimalist clean background management template. | | [chatgpt-web](https://github.com/Chanzhaoyu/chatgpt-web) | ChatGPT demo web page built with Express and Vue3 | | [pro-components-naive-ui](https://github.com/Zheng-Changfu/pro-components-naive-ui) | Based on Naive UI secondary encapsulation, more functions are extended on the original components | -| [vue3-dynamic-form](https://vue3-dynamic-form.dumogu.top/) | A dynamic form designer based on Vue3, Naive UI, to implement a lot of basic controls, can be very convenient to customize the control. | +| [vue3-dynamic-form](https://github.com/yayaluoya/vue3-dynamic-form) | A dynamic form designer based on Vue3, Naive UI, to implement a lot of basic controls, can be very convenient to customize the control. | diff --git a/demo/pages/docs/community/zhCN/index.md b/demo/pages/docs/community/zhCN/index.md index d63e93107cc..0ee25165e03 100644 --- a/demo/pages/docs/community/zhCN/index.md +++ b/demo/pages/docs/community/zhCN/index.md @@ -22,4 +22,4 @@ Naive UI 是统一设计规范的高质量 Vue 组件库,我们倾向于只提 | [Dumogu-admin](https://admin.dumogu.top/base-naive-ui/) | 一个基于Vue3、Vite5、Naive UI, 简洁干净后台管理模板,方便二次开发,易于上手,只有基础功能。 | | [chatgpt-web](https://github.com/Chanzhaoyu/chatgpt-web) | 使用 Express 和 Vue3 搭建的 ChatGPT 演示网页 | | [pro-components-naive-ui](https://github.com/Zheng-Changfu/pro-components-naive-ui) | 基于 Naive UI 二次封装, 基于原有组件扩展了更多功能 | -| [vue3-dynamic-form](https://vue3-dynamic-form.dumogu.top/) | 一个基于Vue3、Naive UI, 的动态表单设计器,实现了很多基础控件,能非常方便的自定义控件。 | +| [vue3-dynamic-form](https://github.com/yayaluoya/vue3-dynamic-form) | 一个基于Vue3、Naive UI, 的动态表单设计器,实现了很多基础控件,能非常方便的自定义控件。 | diff --git a/demo/pages/docs/i18n/enUS/index.md b/demo/pages/docs/i18n/enUS/index.md index a299f2a466d..6f2e0e88d21 100644 --- a/demo/pages/docs/i18n/enUS/index.md +++ b/demo/pages/docs/i18n/enUS/index.md @@ -60,6 +60,7 @@ The following list is sorted by 'Config' column. | Bahasa Indonesia | idID | dateIdID | | | Italiano | itIT | dateItIT | 2.24.2 | | Japanese | jaJP | dateJaJP | | +| Khmer (Cambodia) | kmKH | dateKmKH | 2.41.0 | | Korean (South Korea) | koKR | dateKoKR | 2.28.1 | | Norwegian Bokmål (Norway) | nbNO | dateNbNO | | | Dutch (Netherlands) | nlNL | dateNlNL | 2.29.0 | @@ -70,12 +71,12 @@ The following list is sorted by 'Config' column. | Swedish | svSE | dateSvSE | 2.35.0 | | Thai (Thailand) | thTH | dateThTH | 2.27.0 | | Turkish | trTR | dateTrTR | 2.34.0 | +| Uyghur (China) | ugCN | dateUgCN | | | Ukrainian | ukUA | dateUkUA | | | Uzbek (Uzbekistan) | uzUZ | dateUzUZ | 2.39.0 | | Vietnamese (Vietnam) | viVN | dateViVN | 2.30.7 | | Chinese (Simplified) | zhCN | dateZhCN | | | Chinese (Traditional) | zhTW | dateZhTW | | -| Uyghur(China) | ugCN | dateUgCN | | ## Customize the existing locale diff --git a/demo/pages/docs/i18n/zhCN/index.md b/demo/pages/docs/i18n/zhCN/index.md index da60c6fdc63..95ccf61c2d2 100644 --- a/demo/pages/docs/i18n/zhCN/index.md +++ b/demo/pages/docs/i18n/zhCN/index.md @@ -60,6 +60,7 @@ Naive-ui 通过使用 `n-config-provider` 调整语言,默认情况下所有 | 印度尼西亚语 | idID | dateIdID | | | 意大利语 | itIT | dateItIT | 2.24.2 | | 日语 | jaJP | dateJaJP | | +| 高棉语(柬埔寨) | kmKH | dateKmKH | 2.41.0 | | 韩语 | koKR | dateKoKR | 2.28.1 | | 书面挪威语 | nbNO | dateNbNO | | | 荷兰语(荷兰) | nlNL | dateNlNL | 2.29.0 | @@ -70,12 +71,12 @@ Naive-ui 通过使用 `n-config-provider` 调整语言,默认情况下所有 | 瑞典語 | svSE | dateSvSE | 2.35.0 | | 泰语(泰国) | thTH | dateThTH | 2.27.0 | | 土耳其语 | trTR | dateTrTR | 2.34.0 | +| 维吾尔语 | ugCN | dateUgCN | 2.41.0 | | 乌克兰语 | ukUA | dateUkUA | | | 乌兹别克语 | uzUZ | dateUzUZ | 2.39.0 | | 越南语(越南) | viVN | dateViVN | 2.30.7 | | 简体中文 | zhCN | dateZhCN | | | 繁体中文 | zhTW | dateZhTW | | -| 维吾尔语 | ugCN | dateUgCN | | ## 在现有国际化基础上调整 diff --git a/package.json b/package.json index 82a4066a248..937bf3eec17 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "naive-ui", - "version": "2.40.4", + "version": "2.41.0", "packageManager": "pnpm@9.5.0", "description": "A Vue 3 Component Library. Fairly Complete, Theme Customizable, Uses TypeScript, Fast", "author": "07akioni", diff --git a/src/_utils/env/is-jsdom.ts b/src/_utils/env/is-jsdom.ts index 7a4dfa43b52..09336d83a0f 100644 --- a/src/_utils/env/is-jsdom.ts +++ b/src/_utils/env/is-jsdom.ts @@ -4,7 +4,7 @@ export function isJsdom(): boolean { if (_isJsdom === undefined) { _isJsdom = navigator.userAgent.includes('Node.js') - || navigator.userAgent.includes('jsdom') + || navigator.userAgent.includes('jsdom') } return _isJsdom } diff --git a/src/avatar/src/Avatar.tsx b/src/avatar/src/Avatar.tsx index 84473833e02..67f36919549 100644 --- a/src/avatar/src/Avatar.tsx +++ b/src/avatar/src/Avatar.tsx @@ -281,10 +281,10 @@ export default defineComponent({ let img: VNodeChild const placeholderNode = !loaded - && !hasLoadError - && (this.renderPlaceholder - ? this.renderPlaceholder() - : this.$slots.placeholder?.()) + && !hasLoadError + && (this.renderPlaceholder + ? this.renderPlaceholder() + : this.$slots.placeholder?.()) if (this.hasLoadError) { img = this.renderFallback diff --git a/src/back-top/src/BackTop.tsx b/src/back-top/src/BackTop.tsx index 225d28bbeda..5bc074eb88a 100644 --- a/src/back-top/src/BackTop.tsx +++ b/src/back-top/src/BackTop.tsx @@ -158,8 +158,8 @@ export default defineComponent({ scrollListenerRegistered = true const scrollEl = props.target?.() - || unwrapElement(props.listenTo) - || getScrollParent(placeholderRef.value) + || unwrapElement(props.listenTo) + || getScrollParent(placeholderRef.value) if (!scrollEl) { if (__DEV__) { warn( diff --git a/src/carousel/src/utils/index.ts b/src/carousel/src/utils/index.ts index c377eac5574..204fd166d61 100644 --- a/src/carousel/src/utils/index.ts +++ b/src/carousel/src/utils/index.ts @@ -9,12 +9,12 @@ export function calculateSize(element: HTMLElement, innerOnly?: boolean): Size { const style = getComputedStyle(element) width = width - - Number.parseFloat(style.getPropertyValue('padding-left')) - - Number.parseFloat(style.getPropertyValue('padding-right')) + - Number.parseFloat(style.getPropertyValue('padding-left')) + - Number.parseFloat(style.getPropertyValue('padding-right')) height = height - - Number.parseFloat(style.getPropertyValue('padding-top')) - - Number.parseFloat(style.getPropertyValue('padding-bottom')) + - Number.parseFloat(style.getPropertyValue('padding-top')) + - Number.parseFloat(style.getPropertyValue('padding-bottom')) } return { width, height } } diff --git a/src/data-table/demos/enUS/ajax-usage.demo.md b/src/data-table/demos/enUS/ajax-usage.demo.vue similarity index 54% rename from src/data-table/demos/enUS/ajax-usage.demo.md rename to src/data-table/demos/enUS/ajax-usage.demo.vue index 81de148ddb0..acf6f8347ab 100644 --- a/src/data-table/demos/enUS/ajax-usage.demo.md +++ b/src/data-table/demos/enUS/ajax-usage.demo.vue @@ -1,31 +1,33 @@ -# Async + + # Async + -```html - -``` - -```js + + + diff --git a/src/data-table/demos/enUS/controlled-multiple-sorter.demo.md b/src/data-table/demos/enUS/controlled-multiple-sorter.demo.vue similarity index 64% rename from src/data-table/demos/enUS/controlled-multiple-sorter.demo.md rename to src/data-table/demos/enUS/controlled-multiple-sorter.demo.vue index 1a3b6a3b932..164a81cbe7b 100644 --- a/src/data-table/demos/enUS/controlled-multiple-sorter.demo.md +++ b/src/data-table/demos/enUS/controlled-multiple-sorter.demo.vue @@ -1,22 +1,30 @@ + # Controlled multi-column sorting If column object's `sortOrder` is set to `'ascend'`, `'descend'` or `false`, the data table would be in controlled state. If you only want UI to display multiple sort state, you can leave `compare` empty. + -```html - -``` - -```js + + + diff --git a/src/data-table/demos/enUS/filter-and-sorter.demo.md b/src/data-table/demos/enUS/filter-and-sorter.demo.vue similarity index 54% rename from src/data-table/demos/enUS/filter-and-sorter.demo.md rename to src/data-table/demos/enUS/filter-and-sorter.demo.vue index 8c6e20e7612..c229d588fa3 100644 --- a/src/data-table/demos/enUS/filter-and-sorter.demo.md +++ b/src/data-table/demos/enUS/filter-and-sorter.demo.vue @@ -1,26 +1,19 @@ -# Uncontrolled filter and sorter + + # Uncontrolled filter and sorter + -```html - - - Sort By Name (Ascend) - Filter Address (London) - Clear Filters - Clear Sorter - - - -``` - -```js + + + diff --git a/src/data-table/demos/enUS/index.demo-entry.md b/src/data-table/demos/enUS/index.demo-entry.md index 87a34fcdc1b..076b3d3021f 100644 --- a/src/data-table/demos/enUS/index.demo-entry.md +++ b/src/data-table/demos/enUS/index.demo-entry.md @@ -26,10 +26,10 @@ empty.vue border.vue size.vue row-props.vue -merge-cell -filter-and-sorter +merge-cell.vue +filter-and-sorter.vue pagination-behavior-on-filter.vue -multiple-sorter +multiple-sorter.vue column-draggable.vue select.vue select-single.vue @@ -38,16 +38,16 @@ group-header.vue controlled-page.vue controlled-filter.vue controlled-sorter.vue -controlled-multiple-sorter +controlled-multiple-sorter.vue fixed-header.vue fixed-header-column.vue summary.vue ellipsis.vue ellipsis-tooltip.vue expand.vue -render-header +render-header.vue custom-style.vue -ajax-usage +ajax-usage.vue virtual.vue virtual-x.vue custom-filter-menu.vue @@ -55,7 +55,7 @@ tree.vue flex-height.vue striped.vue simple-editable.vue -switchable-editable +switchable-editable.vue context-menu.vue async-expand.vue render-cell.vue diff --git a/src/data-table/demos/enUS/merge-cell.demo.md b/src/data-table/demos/enUS/merge-cell.demo.vue similarity index 73% rename from src/data-table/demos/enUS/merge-cell.demo.md rename to src/data-table/demos/enUS/merge-cell.demo.vue index 035d8f11cc6..f4b3bc59957 100644 --- a/src/data-table/demos/enUS/merge-cell.demo.md +++ b/src/data-table/demos/enUS/merge-cell.demo.vue @@ -1,24 +1,35 @@ + # Merge cell Set colspan and rowspan by setting `colSpan` and `rowSpan` of column object. Set colspan in header by setting `titleColSpan` of column object. + -```html - -``` - -```js + + + diff --git a/src/data-table/demos/enUS/multiple-sorter.demo.md b/src/data-table/demos/enUS/multiple-sorter.demo.vue similarity index 63% rename from src/data-table/demos/enUS/multiple-sorter.demo.md rename to src/data-table/demos/enUS/multiple-sorter.demo.vue index cac60221015..472f733b47a 100644 --- a/src/data-table/demos/enUS/multiple-sorter.demo.md +++ b/src/data-table/demos/enUS/multiple-sorter.demo.vue @@ -1,28 +1,24 @@ + # Multiple column sorting Set `multiple` and `compare` on `sorter` to enable multiple column sorting. `multiple` is the priority of sorting (larger value means higher priority). + -```html - - - Sort By Name (Ascend) - Filter Address (London) - Clear Filters - Clear Sorter - - - -``` - -```js + + + diff --git a/src/data-table/demos/enUS/render-header.demo.md b/src/data-table/demos/enUS/render-header.demo.vue similarity index 60% rename from src/data-table/demos/enUS/render-header.demo.md rename to src/data-table/demos/enUS/render-header.demo.vue index 27cf20c692c..6dc5796deda 100644 --- a/src/data-table/demos/enUS/render-header.demo.md +++ b/src/data-table/demos/enUS/render-header.demo.vue @@ -1,25 +1,34 @@ + # Customized column header rendering + -```html - -``` - -```js + + + diff --git a/src/data-table/demos/enUS/switchable-editable.demo.md b/src/data-table/demos/enUS/switchable-editable.demo.vue similarity index 67% rename from src/data-table/demos/enUS/switchable-editable.demo.md rename to src/data-table/demos/enUS/switchable-editable.demo.vue index 21e4afbf669..5a9b615ba2f 100644 --- a/src/data-table/demos/enUS/switchable-editable.demo.md +++ b/src/data-table/demos/enUS/switchable-editable.demo.vue @@ -1,20 +1,25 @@ + # Switchable Editable Table + -```html - -``` - -```js + + + diff --git a/src/data-table/demos/zhCN/ajax-usage.demo.md b/src/data-table/demos/zhCN/ajax-usage.demo.vue similarity index 55% rename from src/data-table/demos/zhCN/ajax-usage.demo.md rename to src/data-table/demos/zhCN/ajax-usage.demo.vue index 18f7f8a8f2b..640028a6e41 100644 --- a/src/data-table/demos/zhCN/ajax-usage.demo.md +++ b/src/data-table/demos/zhCN/ajax-usage.demo.vue @@ -1,31 +1,33 @@ + # 异步 + -```html - -``` - -```js + + + diff --git a/src/data-table/demos/zhCN/controlled-multiple-sorter.demo.md b/src/data-table/demos/zhCN/controlled-multiple-sorter.demo.vue similarity index 64% rename from src/data-table/demos/zhCN/controlled-multiple-sorter.demo.md rename to src/data-table/demos/zhCN/controlled-multiple-sorter.demo.vue index 95c1ca70932..d89b6455759 100644 --- a/src/data-table/demos/zhCN/controlled-multiple-sorter.demo.md +++ b/src/data-table/demos/zhCN/controlled-multiple-sorter.demo.vue @@ -1,22 +1,30 @@ + # 受控的多列排序 如果列对象的 `sortOrder` 属性被设为 `'ascend'`、`'descend'` 或者 `false`,表格的排序将为受控状态。 如果你只需要 UI 显示多列排序的状态,那么不传 `compare` 即可。 + -```html - -``` - -```js + + + diff --git a/src/data-table/demos/zhCN/filter-and-sorter.demo.md b/src/data-table/demos/zhCN/filter-and-sorter.demo.vue similarity index 55% rename from src/data-table/demos/zhCN/filter-and-sorter.demo.md rename to src/data-table/demos/zhCN/filter-and-sorter.demo.vue index 3448f39838e..5034dbbd303 100644 --- a/src/data-table/demos/zhCN/filter-and-sorter.demo.md +++ b/src/data-table/demos/zhCN/filter-and-sorter.demo.vue @@ -1,26 +1,19 @@ + # 非受控过滤 & 排序 + -```html - - - Sort By Name (Ascend) - Filter Address (London) - Clear Filters - Clear Sorter - - - -``` - -```js + + + diff --git a/src/data-table/demos/zhCN/filter-and-sortor.demo.md b/src/data-table/demos/zhCN/filter-and-sortor.demo.md deleted file mode 100644 index 3448f39838e..00000000000 --- a/src/data-table/demos/zhCN/filter-and-sortor.demo.md +++ /dev/null @@ -1,108 +0,0 @@ -# 非受控过滤 & 排序 - -```html - - - Sort By Name (Ascend) - Filter Address (London) - Clear Filters - Clear Sorter - - - -``` - -```js -import { defineComponent, ref } from 'vue' - -const columns = [ - { - title: 'Name', - key: 'name', - defaultSortOrder: 'ascend', - sorter: 'default' - }, - { - title: 'Age', - key: 'age', - sorter: (row1, row2) => row1.age - row2.age - }, - { - title: 'Address', - key: 'address', - defaultFilterOptionValues: ['London', 'New York'], - filterOptions: [ - { - label: 'London', - value: 'London' - }, - { - label: 'New York', - value: 'New York' - } - ], - filter(value, row) { - return ~row.address.indexOf(value) - } - } -] - -const data = [ - { - key: 0, - name: 'John Brown', - age: 32, - address: 'New York No. 1 Lake Park' - }, - { - key: 1, - name: 'Jim Green', - age: 42, - address: 'London No. 1 Lake Park' - }, - { - key: 2, - name: 'Joe Black', - age: 32, - address: 'Sidney No. 1 Lake Park' - }, - { - key: 3, - name: 'Jim Red', - age: 32, - address: 'London No. 2 Lake Park' - } -] - -export default defineComponent({ - setup() { - const tableRef = ref(null) - - return { - table: tableRef, - data, - columns, - pagination: { pageSize: 5 }, - filterAddress() { - tableRef.value.filter({ - address: ['London'] - }) - }, - sortName() { - tableRef.value.sort('name', 'ascend') - }, - clearFilters() { - tableRef.value.filter(null) - }, - clearSorter() { - tableRef.value.sort(null) - } - } - } -}) -``` diff --git a/src/data-table/demos/zhCN/index.demo-entry.md b/src/data-table/demos/zhCN/index.demo-entry.md index 73978e01842..37405b50d9d 100644 --- a/src/data-table/demos/zhCN/index.demo-entry.md +++ b/src/data-table/demos/zhCN/index.demo-entry.md @@ -28,10 +28,10 @@ empty.vue border.vue size.vue row-props.vue -merge-cell -filter-and-sorter +merge-cell.vue +filter-and-sorter.vue pagination-behavior-on-filter.vue -multiple-sorter +multiple-sorter.vue column-draggable.vue select.vue select-single.vue @@ -40,16 +40,16 @@ group-header.vue controlled-page.vue controlled-filter.vue controlled-sorter.vue -controlled-multiple-sorter +controlled-multiple-sorter.vue fixed-header.vue fixed-header-column.vue summary.vue ellipsis.vue ellipsis-tooltip.vue expand.vue -render-header +render-header.vue custom-style.vue -ajax-usage +ajax-usage.vue virtual.vue virtual-x.vue custom-filter-menu.vue @@ -57,7 +57,7 @@ tree.vue flex-height.vue striped.vue simple-editable.vue -switchable-editable +switchable-editable.vue context-menu.vue async-expand.vue render-cell.vue diff --git a/src/data-table/demos/zhCN/merge-cell.demo.md b/src/data-table/demos/zhCN/merge-cell.demo.vue similarity index 75% rename from src/data-table/demos/zhCN/merge-cell.demo.md rename to src/data-table/demos/zhCN/merge-cell.demo.vue index 8f9afebe4d4..4fc027590ba 100644 --- a/src/data-table/demos/zhCN/merge-cell.demo.md +++ b/src/data-table/demos/zhCN/merge-cell.demo.vue @@ -1,21 +1,31 @@ + # 合并单元格 设定列的 `colSpan` 和 `rowSpan` 来控制单元格的 `colspan` 和 `rowspan`。设定列的 `titleColSpan` 控制表头的 colspan。 + -```html - -``` - -```js + + + diff --git a/src/data-table/demos/zhCN/multiple-sorter.demo.md b/src/data-table/demos/zhCN/multiple-sorter.demo.vue similarity index 63% rename from src/data-table/demos/zhCN/multiple-sorter.demo.md rename to src/data-table/demos/zhCN/multiple-sorter.demo.vue index eb5e143f1cf..f60f9123a1c 100644 --- a/src/data-table/demos/zhCN/multiple-sorter.demo.md +++ b/src/data-table/demos/zhCN/multiple-sorter.demo.vue @@ -1,28 +1,24 @@ + # 多列排序 为 `sorter` 设定 `multiple` 和 `compare` 来开启多列排序,其中 `multiple` 为多列排序的优先级,越高优先级越高。 + -```html - - - Sort By Name (Ascend) - Filter Address (London) - Clear Filters - Clear Sorter - - - -``` - -```js + + + diff --git a/src/data-table/demos/zhCN/render-header.demo.md b/src/data-table/demos/zhCN/render-header.demo.vue similarity index 59% rename from src/data-table/demos/zhCN/render-header.demo.md rename to src/data-table/demos/zhCN/render-header.demo.vue index ad6e984ca79..f5af0063ba2 100644 --- a/src/data-table/demos/zhCN/render-header.demo.md +++ b/src/data-table/demos/zhCN/render-header.demo.vue @@ -1,25 +1,34 @@ + # 自定义渲染列头 + -```html - -``` - -```js + + + diff --git a/src/data-table/demos/zhCN/switchable-editable.demo.md b/src/data-table/demos/zhCN/switchable-editable.demo.vue similarity index 67% rename from src/data-table/demos/zhCN/switchable-editable.demo.md rename to src/data-table/demos/zhCN/switchable-editable.demo.vue index 5531dcb092f..39751f22ec0 100644 --- a/src/data-table/demos/zhCN/switchable-editable.demo.md +++ b/src/data-table/demos/zhCN/switchable-editable.demo.vue @@ -1,20 +1,25 @@ + # 可切换的可编辑表格 + -```html - -``` - -```js + + + diff --git a/src/data-table/index.ts b/src/data-table/index.ts index 6e44afd22db..a32c5f98e7a 100644 --- a/src/data-table/index.ts +++ b/src/data-table/index.ts @@ -11,6 +11,7 @@ export type { CreateRowProps as DataTableCreateRowProps, CreateSummary as DataTableCreateSummary, TableExpandColumn as DataTableExpandColumn, + FilterOptionValue as DataTableFilterOptionValue, FilterState as DataTableFilterState, DataTableInst, DataTableProps, diff --git a/src/data-table/src/interface.ts b/src/data-table/src/interface.ts index b965367cd76..c1dda47c348 100644 --- a/src/data-table/src/interface.ts +++ b/src/data-table/src/interface.ts @@ -545,7 +545,7 @@ export interface DataTableInst { clearFilters: () => void clearSorter: () => void page: (page: number) => void - sort: (columnKey: ColumnKey, order: SortOrder) => void + sort: (columnKey: ColumnKey | null, order?: SortOrder) => void scrollTo: ScrollTo downloadCsv: (options?: CsvOptionsType) => void /** @deprecated it but just leave it here, it does no harm */ diff --git a/src/data-table/src/use-sorter.ts b/src/data-table/src/use-sorter.ts index e86410fab25..56a5b086743 100644 --- a/src/data-table/src/use-sorter.ts +++ b/src/data-table/src/use-sorter.ts @@ -220,7 +220,10 @@ export function useSorter( uncontrolledSortStateRef.value = sortState } - function sort(columnKey: ColumnKey, order: SortOrder = 'ascend'): void { + function sort( + columnKey: ColumnKey | null, + order: SortOrder = 'ascend' + ): void { if (!columnKey) { clearSorter() } diff --git a/src/data-table/tests/DataTable.spec.tsx b/src/data-table/tests/DataTable.spec.tsx index fea293061db..3f4d490ce48 100644 --- a/src/data-table/tests/DataTable.spec.tsx +++ b/src/data-table/tests/DataTable.spec.tsx @@ -388,8 +388,8 @@ describe('n-data-table', () => { ): Promise => { const matchResult = (await checkIsMatched('.chinese-col', targets[0])) - && (await checkIsMatched('.math-col', targets[1])) - && (await checkIsMatched('.english-col', targets[2])) + && (await checkIsMatched('.math-col', targets[1])) + && (await checkIsMatched('.english-col', targets[2])) return matchResult } @@ -517,11 +517,11 @@ describe('n-data-table', () => { await nextTick() const result = (await checkIsMatched('.age-col', [42, 32, 32, 32])) - && (await checkScoreIsMatched([ - [98, 98, 98, 88], - [66, 60, 66, 99], - [89, 70, 89, 89] - ])) + && (await checkScoreIsMatched([ + [98, 98, 98, 88], + [66, 60, 66, 99], + [89, 70, 89, 89] + ])) expect(result).toEqual(true) }) }) diff --git a/src/date-picker/src/panel/use-dual-calendar.ts b/src/date-picker/src/panel/use-dual-calendar.ts index 1d8c84ec9c2..6fb5974e170 100644 --- a/src/date-picker/src/panel/use-dual-calendar.ts +++ b/src/date-picker/src/panel/use-dual-calendar.ts @@ -112,9 +112,9 @@ function useDualCalendar( const { value } = props const defaultCalendarStartTime = props.defaultCalendarStartTime - ?? (Array.isArray(value) && typeof value[0] === 'number' - ? value[0] - : Date.now()) + ?? (Array.isArray(value) && typeof value[0] === 'number' + ? value[0] + : Date.now()) const startCalendarDateTimeRef = ref(defaultCalendarStartTime) const endCalendarDateTimeRef = ref( props.defaultCalendarEndTime diff --git a/src/date-picker/src/utils.ts b/src/date-picker/src/utils.ts index 12f90f2192b..b3d31797026 100644 --- a/src/date-picker/src/utils.ts +++ b/src/date-picker/src/utils.ts @@ -173,10 +173,10 @@ function dateItem( } const selected = valueTs !== null - && (Array.isArray(valueTs) - ? matchDate(valueTs[0], time, 'date') - || matchDate(valueTs[1], time, 'date') - : matchDate(valueTs, time, 'date')) + && (Array.isArray(valueTs) + ? matchDate(valueTs[0], time, 'date') + || matchDate(valueTs[1], time, 'date') + : matchDate(valueTs, time, 'date')) return { type: 'date', dateObject: { @@ -243,10 +243,10 @@ function weekItem( } const inSelectedWeek = valueTs !== null - && (Array.isArray(valueTs) - ? matchDate(valueTs[0], time, 'week', firstDayOfWeek) - || matchDate(valueTs[1], time, 'week', firstDayOfWeek) - : matchDate(valueTs, time, 'week', firstDayOfWeek)) + && (Array.isArray(valueTs) + ? matchDate(valueTs[0], time, 'week', firstDayOfWeek) + || matchDate(valueTs[1], time, 'week', firstDayOfWeek) + : matchDate(valueTs, time, 'week', firstDayOfWeek)) return { type: 'date', dateObject: { diff --git a/src/dialog/demos/enUS/index.demo-entry.md b/src/dialog/demos/enUS/index.demo-entry.md index 43c07334add..7ac9f3bb7a0 100644 --- a/src/dialog/demos/enUS/index.demo-entry.md +++ b/src/dialog/demos/enUS/index.demo-entry.md @@ -76,7 +76,7 @@ use-dialog-reactive-list.vue | content | `string \| (() => VNodeChild)` | `undefined` | Content, can be a render function. | | | contentClass | `string` | `undefined` | The class name of the content. | 2.38.2 | | contentStyle | `Object \| string` | `undefined` | The style of the content. | 2.38.2 | -| draggable | `boolean \| { bounds?: 'none' }` | `false` | Whether it is draggable. | NEXT_VERSION | +| draggable | `boolean \| { bounds?: 'none' }` | `false` | Whether it is draggable. | 2.41.0 | | iconPlacement | `'left' \| 'top'` | `'left'` | Icon placement. | | | icon | `() => VNodeChild` | `undefined` | `Render` function of `icon`. | | | loading | `boolean` | `false` | Whether to display `loading` status. | | diff --git a/src/dialog/demos/zhCN/index.demo-entry.md b/src/dialog/demos/zhCN/index.demo-entry.md index a37754a9555..a2a675f4690 100644 --- a/src/dialog/demos/zhCN/index.demo-entry.md +++ b/src/dialog/demos/zhCN/index.demo-entry.md @@ -78,7 +78,7 @@ rtl-debug.vue | content | `string \| (() => VNodeChild)` | `undefined` | 对话框内容,可以是渲染函数 | | | contentClass | `string` | `undefined` | 内容的类名 | 2.38.2 | | contentStyle | `Object \| string` | `undefined` | 内容的样式 | 2.38.2 | -| draggable | `boolean \| { bounds?: 'none' }` | `false` | 是否可拖拽 | NEXT_VERSION | +| draggable | `boolean \| { bounds?: 'none' }` | `false` | 是否可拖拽 | 2.41.0 | | iconPlacement | `'left' \| 'top'` | `'left'` | 图标的位置 | | | icon | `() => VNodeChild` | `undefined` | 对话框 `icon`, 需要是渲染函数 | | | loading | `boolean` | `false` | 是否显示 `loading` 状态 | | diff --git a/src/ellipsis/src/Ellipsis.tsx b/src/ellipsis/src/Ellipsis.tsx index abb937530e3..efc12dc7501 100644 --- a/src/ellipsis/src/Ellipsis.tsx +++ b/src/ellipsis/src/Ellipsis.tsx @@ -99,7 +99,7 @@ export default defineComponent({ if (triggerInner) { tooltipDisabled = triggerInner.getBoundingClientRect().width - <= trigger.getBoundingClientRect().width + <= trigger.getBoundingClientRect().width } } syncCursorStyle(trigger, tooltipDisabled) diff --git a/src/mention/src/Mention.tsx b/src/mention/src/Mention.tsx index 85656890176..780dc611a2b 100644 --- a/src/mention/src/Mention.tsx +++ b/src/mention/src/Mention.tsx @@ -404,8 +404,8 @@ export default defineComponent({ props.onSelect?.(tmNode.rawNode as MentionOption, cachedPrefix) const nextSelectionEnd = cachedPartialPatternStart - + nextMiddlePart.length - + (alreadySeparated ? 1 : 0) + + nextMiddlePart.length + + (alreadySeparated ? 1 : 0) void nextTick().then(() => { // input value is updated inputEl.selectionStart = nextSelectionEnd diff --git a/src/mention/src/utils.ts b/src/mention/src/utils.ts index 42e12dc3a22..a9b7eda746d 100644 --- a/src/mention/src/utils.ts +++ b/src/mention/src/utils.ts @@ -168,9 +168,9 @@ export function getRelativePosition( const height = Number.parseInt(computed.height as string) const outerHeight = Number.parseInt(computed.paddingTop as string) - + Number.parseInt(computed.paddingBottom as string) - + Number.parseInt(computed.borderTopWidth as string) - + Number.parseInt(computed.borderBottomWidth as string) + + Number.parseInt(computed.paddingBottom as string) + + Number.parseInt(computed.borderTopWidth as string) + + Number.parseInt(computed.borderBottomWidth as string) const targetHeight = outerHeight + Number.parseInt(computed.lineHeight as string) if (height > targetHeight) { @@ -263,13 +263,13 @@ export function setElementPositionBasedOnCaret( if (detectBoundary) { pos.left = pos.left + (element.clientWidth + margin) + offset.left - > window.scrollX + window.innerWidth + > window.scrollX + window.innerWidth ? (pos.left = window.scrollX + window.innerWidth - (element.clientWidth + margin)) : (pos.left += offset.left) pos.top = pos.top + (element.clientWidth + margin) + offset.top - > window.scrollY + window.innerHeight + > window.scrollY + window.innerHeight ? (pos.top -= element.clientWidth + margin) : (pos.top += offset.top) } diff --git a/src/modal/demos/enUS/index.demo-entry.md b/src/modal/demos/enUS/index.demo-entry.md index baaebe3b368..17982469c3a 100644 --- a/src/modal/demos/enUS/index.demo-entry.md +++ b/src/modal/demos/enUS/index.demo-entry.md @@ -59,7 +59,7 @@ Provided since `2.38.0`. | block-scroll | `boolean` | `true` | Whether to disabled body scrolling when it's active. | 2.28.3 | | close-on-esc | `boolean` | `true` | Whether to close modal on Esc is pressed. | 2.24.2 | | display-directive | `'if' \| 'show'` | `'if'` | Use which directive to control the rendering of modal body. | | -| draggable | `boolean \| { bounds?: 'window' }` | `false` | Whether the modal is draggable. Make its position not bound inside window using `bounds === 'none'`. | NEXT_VERSION | +| draggable | `boolean \| { bounds?: 'window' }` | `false` | Whether the modal is draggable. Make its position not bound inside window using `bounds === 'none'`. | 2.41.0 | | mask-closable | `boolean` | `true` | Whether to emit `hide` event when click mask. | | | preset | `'dialog' \| 'card'` | `undefined` | The preset of `n-modal`. | | | show | `boolean` | `false` | Whether to show modal. | | diff --git a/src/modal/demos/zhCN/index.demo-entry.md b/src/modal/demos/zhCN/index.demo-entry.md index 4d195265d61..a12443ca797 100644 --- a/src/modal/demos/zhCN/index.demo-entry.md +++ b/src/modal/demos/zhCN/index.demo-entry.md @@ -74,7 +74,7 @@ mask-click-debug.vue | block-scroll | `boolean` | `true` | 是否在打开时禁用 body 滚动 | 2.28.3 | | close-on-esc | `boolean` | `true` | 是否在摁下 Esc 键的时候关闭 Modal | 2.24.2 | | display-directive | `'if' \| 'show'` | `'if'` | 使用何种指令控制模态框主体的条件渲染 | | -| draggable | `boolean \| { bounds?: 'none' }` | `false` | 是否可拖拽,`bounds === 'none'` 时拖拽可超出视口 | NEXT_VERSION | +| draggable | `boolean \| { bounds?: 'none' }` | `false` | 是否可拖拽,`bounds === 'none'` 时拖拽可超出视口 | 2.41.0 | | mask-closable | `boolean` | `true` | 点击遮罩时是否发出 `update:show` 事件 | | | preset | `'dialog' \| 'card'` | `undefined` | 模态框使用何种预设 | | | show | `boolean` | `false` | 是否展示 Modal | | diff --git a/src/popover/src/PopoverBody.tsx b/src/popover/src/PopoverBody.tsx index cb7229dc5e3..16779600d89 100644 --- a/src/popover/src/PopoverBody.tsx +++ b/src/popover/src/PopoverBody.tsx @@ -298,8 +298,8 @@ export default defineComponent({ themeClassHandle?.onRender() const shouldRenderDom = props.displayDirective === 'show' - || props.show - || (props.animated && displayedRef.value) + || props.show + || (props.animated && displayedRef.value) if (!shouldRenderDom) { return null } diff --git a/src/qr-code/src/qrcodegen.ts b/src/qr-code/src/qrcodegen.ts index d7e0c39bee5..1da2577ccc0 100644 --- a/src/qr-code/src/qrcodegen.ts +++ b/src/qr-code/src/qrcodegen.ts @@ -560,7 +560,7 @@ namespace qrcodegen { } result += this.finderPenaltyTerminateAndCount(runColor, runX, runHistory) - * QrCode.PENALTY_N3 + * QrCode.PENALTY_N3 } // Adjacent modules in column having same color, and finder-like patterns for (let x = 0; x < this.size; x++) { @@ -589,7 +589,7 @@ namespace qrcodegen { } result += this.finderPenaltyTerminateAndCount(runColor, runY, runHistory) - * QrCode.PENALTY_N3 + * QrCode.PENALTY_N3 } // 2*2 blocks of modules having same color @@ -739,10 +739,10 @@ namespace qrcodegen { const n: int = runHistory[1] const core: boolean = n > 0 - && runHistory[2] === n - && runHistory[3] === n * 3 - && runHistory[4] === n - && runHistory[5] === n + && runHistory[2] === n + && runHistory[3] === n * 3 + && runHistory[4] === n + && runHistory[5] === n return ( (core && runHistory[0] >= n * 4 && runHistory[6] >= n ? 1 : 0) + (core && runHistory[6] >= n * 4 && runHistory[0] >= n ? 1 : 0) diff --git a/src/tree/src/Tree.tsx b/src/tree/src/Tree.tsx index 8ee3cafb78f..56e1bc3e994 100644 --- a/src/tree/src/Tree.tsx +++ b/src/tree/src/Tree.tsx @@ -86,9 +86,9 @@ export function createTreeMateOptions( ): TreeMateOptions { const settledGetChildren: GetChildren = getChildren - || ((node: T) => { - return (node as any)[childrenField] - }) + || ((node: T) => { + return (node as any)[childrenField] + }) return { getIsGroup() { return false diff --git a/src/version.ts b/src/version.ts index cb39e3fae16..4b54002a318 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export default '2.40.4' +export default '2.41.0' diff --git a/src/watermark/src/Watermark.tsx b/src/watermark/src/Watermark.tsx index a4495677b83..01306ea606b 100644 --- a/src/watermark/src/Watermark.tsx +++ b/src/watermark/src/Watermark.tsx @@ -12,12 +12,12 @@ function getRatio(context: any): number { } const backingStore = context.backingStorePixelRatio - || context.webkitBackingStorePixelRatio - || context.mozBackingStorePixelRatio - || context.msBackingStorePixelRatio - || context.oBackingStorePixelRatio - || context.backingStorePixelRatio - || 1 + || context.webkitBackingStorePixelRatio + || context.mozBackingStorePixelRatio + || context.msBackingStorePixelRatio + || context.oBackingStorePixelRatio + || context.backingStorePixelRatio + || 1 return (window.devicePixelRatio || 1) / backingStore }