diff --git a/CHANGELOG.en-US.md b/CHANGELOG.en-US.md index 159dbe40492..1ba7730f0a3 100644 --- a/CHANGELOG.en-US.md +++ b/CHANGELOG.en-US.md @@ -25,6 +25,7 @@ - `n-data-table`'s `render-expand-icon` add `expanded` param, closes [#4439](https://github.com/tusen-ai/naive-ui/issues/4439). - `n-tabs` adds `pane-wrapper-class` `pane-wrapper-style` prop. - `n-collapse` adds `titlePadding` theme variable, closes [#4728](https://github.com/tusen-ai/naive-ui/issues/4728). +- `n-tabs` adds `placement` prop. ### i18n diff --git a/CHANGELOG.zh-CN.md b/CHANGELOG.zh-CN.md index 7ac1a9dd2dd..b9814b02f96 100644 --- a/CHANGELOG.zh-CN.md +++ b/CHANGELOG.zh-CN.md @@ -4,13 +4,13 @@ ### Fixes -- 修复 `n-notification` 的 `description` 有英文时没有自动换行, closes [#4609](https://github.com/tusen-ai/naive-ui/issues/4609) +- 修复 `n-notification` 的 `description` 有英文时没有自动换行,关闭 [#4609](https://github.com/tusen-ai/naive-ui/issues/4609) - 修复 `n-dynamic-input` 的 `on-remove` 方法返回被删除的数据下标 `index` 时 `value[index]` 已经不存在 - 修复 `n-dynamic-input` 在点击添加按钮后 `on-create` 返回的 `index` 不正确 - 修复 `trTR` 国际化,关闭 [#4231](https://github.com/tusen-ai/naive-ui/issues/4231) - 修复 `n-input` 同时使用 `password` 和 `disabled` 时,显示密码图标偏移的问题,关闭 [#4364](https://github.com/tusen-ai/naive-ui/issues/4364) -- 修复 `n-image` 设置 `fallback-src` 属性和懒加载无效,closes[#4480](https://github.com/tusen-ai/naive-ui/issues/4480) -- 修复 `n-upload` 内部使用 vue `TransitionGroup` 组件时, 传递了未声明的 prop 且未被自动继承导致警告, 关闭[#4447](https://github.com/tusen-ai/naive-ui/issues/4447) +- 修复 `n-image` 设置 `fallback-src` 属性和懒加载无效,关闭 [#4480](https://github.com/tusen-ai/naive-ui/issues/4480) +- 修复 `n-upload` 内部使用 vue `TransitionGroup` 组件时, 传递了未声明的 prop 且未被自动继承导致警告,关闭[#4447](https://github.com/tusen-ai/naive-ui/issues/4447) - 修复 `n-menu` `show` `default` 属性拼写问题,关闭 [#4750](https://github.com/tusen-ai/naive-ui/issues/4750) - 修复 `n-icon-wrapper` 的主题异常,关闭 [#4768](https://github.com/tusen-ai/naive-ui/issues/4768) @@ -25,6 +25,7 @@ - `n-data-table` 的 `render-expand-icon` 属性新增 `expanded` 参数,关闭 [#4439](https://github.com/tusen-ai/naive-ui/issues/4439) - `n-tabs` 新增 `pane-wrapper-class` `pane-wrapper-style` 属性 - `n-collapse` 新增 `titlePadding` 主题变量,关闭 [#4728](https://github.com/tusen-ai/naive-ui/issues/4728) +- `n-tabs` 新增 `placement` 属性 ### i18n diff --git a/src/_internal/fade-in-expand-transition/src/FadeInExpandTransition.ts b/src/_internal/fade-in-expand-transition/src/FadeInExpandTransition.ts index ad7314e34e1..5fa868c2a7d 100644 --- a/src/_internal/fade-in-expand-transition/src/FadeInExpandTransition.ts +++ b/src/_internal/fade-in-expand-transition/src/FadeInExpandTransition.ts @@ -1,4 +1,11 @@ -import { h, Transition, TransitionGroup, defineComponent, type PropType } from 'vue' +import { + h, + Transition, + TransitionGroup, + type TransitionProps, + defineComponent, + type PropType +} from 'vue' export default defineComponent({ name: 'FadeInExpandTransition', @@ -77,24 +84,23 @@ export default defineComponent({ props.onAfterEnter?.() } return () => { - const type = props.group ? TransitionGroup : Transition - const differentProps = props.group ? undefined : { mode: props.mode } - return h( - type as any, - { - name: props.width - ? 'fade-in-width-expand-transition' - : 'fade-in-height-expand-transition', - appear: props.appear, - onEnter: handleEnter, - onAfterEnter: handleAfterEnter, - onBeforeLeave: handleBeforeLeave, - onLeave: handleLeave, - onAfterLeave: handleAfterLeave, - ...differentProps - }, - slots - ) + const { group, width, appear, mode } = props + const type = group ? TransitionGroup : Transition + const resolvedProps = { + name: width + ? 'fade-in-width-expand-transition' + : 'fade-in-height-expand-transition', + appear, + onEnter: handleEnter, + onAfterEnter: handleAfterEnter, + onBeforeLeave: handleBeforeLeave, + onLeave: handleLeave, + onAfterLeave: handleAfterLeave + } + if (!group) { + ;(resolvedProps as unknown as TransitionProps).mode = mode + } + return h(type as any, resolvedProps, slots) } } }) diff --git a/src/_mixins/use-theme.ts b/src/_mixins/use-theme.ts index 4757be54496..41c0fa75d3b 100644 --- a/src/_mixins/use-theme.ts +++ b/src/_mixins/use-theme.ts @@ -90,7 +90,7 @@ function useTheme ( style: CNode | undefined, defaultTheme: Theme, props: UseThemeProps>, - clsPrefixRef?: Ref + clsPrefixRef: Ref | undefined ): ComputedRef>> { const ssrAdapter = useSsrAdapter() const NConfigProvider = inject(configProviderInjectionKey, null) diff --git a/src/dynamic-input/demos/enUS/index.demo-entry.md b/src/dynamic-input/demos/enUS/index.demo-entry.md index 7969b88bdbc..fdc69ee60e5 100644 --- a/src/dynamic-input/demos/enUS/index.demo-entry.md +++ b/src/dynamic-input/demos/enUS/index.demo-entry.md @@ -27,7 +27,7 @@ custom-action.vue | --- | --- | --- | --- | --- | | create-button-props | `ButtonProps` | `undefined` | Props of create item button. | 2.25.0 | | default-value | `unknown[]` | `[]` | Default value. | | -| disabled | `boolean` | `false` | Whether to disable the dynamic-input. | NEXT_VERSION | +| disabled | `boolean` | `false` | Whether to disable the dynamic-input. It won't work for custom content. | NEXT_VERSION | | item-style | `string \| Object` | `undefined` | The style of each item of the dynamic input. | | | key-field | `string` | `undefined` | The key of each item that should be used in the rendering of the list. | | | min | `number` | `0` | Minimum number of items. | | diff --git a/src/dynamic-input/demos/zhCN/index.demo-entry.md b/src/dynamic-input/demos/zhCN/index.demo-entry.md index ce6c6be1396..5172298de80 100644 --- a/src/dynamic-input/demos/zhCN/index.demo-entry.md +++ b/src/dynamic-input/demos/zhCN/index.demo-entry.md @@ -29,15 +29,15 @@ create-debug.vue | --- | --- | --- | --- | --- | | create-button-props | `ButtonProps` | `undefined` | 新建项按钮的属性 | 2.25.0 | | default-value | `unknown[]` | `[]` | 非受控模式下的默认值 | | -| disabled | `boolean` | `false` | 是否禁用 | NEXT_VERSION | +| disabled | `boolean` | `false` | 是否禁用,对自定义内容无效 | NEXT_VERSION | | item-style | `string \| Object` | `undefined` | 动态录入中每项的样式 | | | key-field | `string` | `undefined` | 每一项的 key 值,会被用于列表渲染中 | | | min | `number` | `0` | 最少有几项内容 | | | max | `number` | `undefined` | 最多有几项内容 | | -| preset | `'input' \| 'pair'` | `'input'` | 动态录入使用的预设,在不设定 `$slots.default` 的时候生效。 | | +| preset | `'input' \| 'pair'` | `'input'` | 动态录入使用的预设,在不设定 `$slots.default` 的时候生效 | | | show-sort-button | `boolean` | `false` | 是否显示排序按钮 | 2.25.0 | | value | `unknown[]` | `undefined` | 受控模式下的值 | | -| on-create | `(index: number) => void` | `undefined` | 点击添加按钮时的回调,如果设定则返回值会被用作新添加的初始值。其中 `index` 是创建内容将要被放置到的位置对应的数组索引,从 1 (第二项)开始计算 | | +| on-create | `(index: number) => void` | `undefined` | 点击添加按钮时的回调,如果设定则返回值会被用作新添加的初始值。其中 `index` 是创建内容将要被放置到的位置对应的数组索引,从 1(第二项)开始计算 | | | on-remove | `(index: number) => void` | `undefined` | 点击第 index 项删除按钮的回调 | | | on-update:value | `(value: any) => void` | `undefined` | 组件值发生变化的回调 | | diff --git a/src/popselect/src/Popselect.tsx b/src/popselect/src/Popselect.tsx index 0471bc26708..f1394834567 100644 --- a/src/popselect/src/Popselect.tsx +++ b/src/popselect/src/Popselect.tsx @@ -13,7 +13,7 @@ import type { PopoverInst, PopoverTrigger } from '../../popover' import NPopselectPanel, { panelPropKeys, panelProps } from './PopselectPanel' import { omit, keep, createRefSetter, mergeEventHandlers } from '../../_utils' import type { ExtractPublicPropTypes } from '../../_utils' -import { useTheme } from '../../_mixins' +import { useConfig, useTheme } from '../../_mixins' import type { ThemeProps } from '../../_mixins' import { popselectLight } from '../styles' import type { PopselectTheme } from '../styles' @@ -42,12 +42,14 @@ export default defineComponent({ inheritAttrs: false, __popover__: true, setup (props) { + const { mergedClsPrefixRef } = useConfig(props) const themeRef = useTheme( 'Popselect', '-popselect', undefined, popselectLight, - props + props, + mergedClsPrefixRef ) const popoverInstRef = ref(null) function syncPosition (): void { diff --git a/src/tooltip/src/Tooltip.ts b/src/tooltip/src/Tooltip.ts index 4dd3ebe66ff..3fe2febde44 100644 --- a/src/tooltip/src/Tooltip.ts +++ b/src/tooltip/src/Tooltip.ts @@ -3,7 +3,7 @@ import { h, defineComponent, ref, computed } from 'vue' import { NPopover } from '../../popover' import { popoverBaseProps } from '../../popover/src/Popover' import type { PopoverInst } from '../../popover' -import { useTheme } from '../../_mixins' +import { useConfig, useTheme } from '../../_mixins' import type { ThemeProps } from '../../_mixins' import { tooltipLight } from '../styles' import type { TooltipTheme } from '../styles' @@ -23,12 +23,14 @@ export default defineComponent({ props: tooltipProps, __popover__: true, setup (props) { + const { mergedClsPrefixRef } = useConfig(props) const themeRef = useTheme( 'Tooltip', '-tooltip', undefined, tooltipLight, - props + props, + mergedClsPrefixRef ) const popoverRef = ref(null) const tooltipExposedMethod: TooltipInst = {