antdv-next 1.6.0 → 1.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (287) hide show
  1. package/dist/_util/ContextIsolator.js +12 -3
  2. package/dist/_util/hooks/useAllowClear.d.ts +22 -6
  3. package/dist/_util/hooks/useAllowClear.js +24 -6
  4. package/dist/_util/hooks/useClosable.js +1 -1
  5. package/dist/_util/tools.d.ts +3 -1
  6. package/dist/_util/tools.js +6 -1
  7. package/dist/_util/vueNode.d.ts +17 -3
  8. package/dist/_util/vueNode.js +17 -1
  9. package/dist/affix/index.js +12 -9
  10. package/dist/alert/Alert.js +4 -1
  11. package/dist/alert/style/index.d.ts +3 -3
  12. package/dist/alert/style/index.js +3 -3
  13. package/dist/anchor/Anchor.js +11 -6
  14. package/dist/anchor/style/index.js +2 -3
  15. package/dist/antd-with-locales.esm.js +16276 -17343
  16. package/dist/antd-with-locales.js +81 -88
  17. package/dist/antd.css +1 -1
  18. package/dist/antd.esm.js +14015 -15728
  19. package/dist/antd.js +82 -89
  20. package/dist/auto-complete/index.js +1 -0
  21. package/dist/avatar/Avatar.js +3 -5
  22. package/dist/avatar/AvatarGroup.js +3 -5
  23. package/dist/border-beam/BorderBeam.d.ts +8 -1
  24. package/dist/border-beam/BorderBeam.js +28 -14
  25. package/dist/border-beam/index.d.ts +2 -2
  26. package/dist/breadcrumb/BreadcrumbItem.js +1 -1
  27. package/dist/breadcrumb/index.d.ts +8 -1
  28. package/dist/calendar/generateCalendar.d.ts +10 -10
  29. package/dist/calendar/index.d.ts +1 -1
  30. package/dist/card/index.d.ts +8 -1
  31. package/dist/card/style/index.js +5 -9
  32. package/dist/cascader/Panel.js +3 -3
  33. package/dist/cascader/hooks/useIcons.js +3 -2
  34. package/dist/cascader/index.d.ts +2 -0
  35. package/dist/cascader/index.js +12 -5
  36. package/dist/checkbox/Checkbox.js +6 -4
  37. package/dist/checkbox/Group.d.ts +19 -1
  38. package/dist/checkbox/Group.js +38 -9
  39. package/dist/checkbox/GroupContext.d.ts +3 -0
  40. package/dist/checkbox/index.d.ts +2 -2
  41. package/dist/color-picker/ColorPicker.js +1 -1
  42. package/dist/color-picker/style/input.js +7 -12
  43. package/dist/components.d.ts +24 -24
  44. package/dist/components.js +1 -2
  45. package/dist/config-provider/context.d.ts +3 -2
  46. package/dist/date-picker/generatePicker/generateRangePicker.js +24 -6
  47. package/dist/date-picker/generatePicker/generateSinglePicker.js +24 -6
  48. package/dist/date-picker/generatePicker/interface.d.ts +21 -5
  49. package/dist/date-picker/generatePicker/useComponents.d.ts +1 -14
  50. package/dist/date-picker/style/panel.js +1 -1
  51. package/dist/date-picker/style/util.js +1 -1
  52. package/dist/date-picker/util.d.ts +8 -2
  53. package/dist/descriptions/hooks/useItems.d.ts +6 -6
  54. package/dist/descriptions/style/index.js +11 -13
  55. package/dist/divider/style/index.js +1 -1
  56. package/dist/drawer/DrawerPanel.js +1 -1
  57. package/dist/dropdown/dropdown.d.ts +2 -0
  58. package/dist/dropdown/dropdown.js +9 -2
  59. package/dist/dropdown/style/index.js +1 -7
  60. package/dist/empty/index.js +2 -1
  61. package/dist/float-button/BackTop.js +2 -1
  62. package/dist/form/ErrorList.js +1 -1
  63. package/dist/form/Form.js +9 -8
  64. package/dist/form/FormItem/ItemHolder.js +1 -1
  65. package/dist/form/FormItem/index.js +11 -9
  66. package/dist/form/FormItemInput.js +1 -1
  67. package/dist/form/FormItemLabel.js +2 -2
  68. package/dist/form/context.d.ts +2 -2
  69. package/dist/form/hooks/useVariant.d.ts +1 -1
  70. package/dist/form/hooks/useVariant.js +1 -1
  71. package/dist/grid/hooks/useBreakpoint.js +12 -6
  72. package/dist/image/PreviewGroup.d.ts +9 -2
  73. package/dist/image/hooks/useMergedPreviewConfig.d.ts +1 -0
  74. package/dist/image/hooks/useMergedPreviewConfig.js +2 -1
  75. package/dist/image/hooks/usePreviewConfig.d.ts +7 -7
  76. package/dist/image/index.d.ts +3 -3
  77. package/dist/index.d.ts +26 -24
  78. package/dist/index.js +1 -2
  79. package/dist/input/Group.js +1 -1
  80. package/dist/input/Input.d.ts +2 -1
  81. package/dist/input/Input.js +8 -5
  82. package/dist/input/OTP/OTPInput.d.ts +2 -1
  83. package/dist/input/OTP/OTPInput.js +12 -3
  84. package/dist/input/OTP/index.d.ts +3 -1
  85. package/dist/input/OTP/index.js +15 -6
  86. package/dist/input/Password.js +7 -5
  87. package/dist/input/Search.js +4 -2
  88. package/dist/input/TextArea.d.ts +3 -1
  89. package/dist/input/TextArea.js +13 -8
  90. package/dist/input/style/index.js +3 -16
  91. package/dist/input-number/index.d.ts +3 -6
  92. package/dist/input-number/index.js +8 -3
  93. package/dist/input-number/style/index.js +1 -5
  94. package/dist/listy/index.d.ts +1 -1
  95. package/dist/listy/index.js +9 -7
  96. package/dist/listy/interface.d.ts +29 -5
  97. package/dist/listy/style/index.js +5 -2
  98. package/dist/locale/ar_EG.js +9 -0
  99. package/dist/locale/az_AZ.js +9 -0
  100. package/dist/locale/bg_BG.js +9 -0
  101. package/dist/locale/bn_BD.js +9 -0
  102. package/dist/locale/by_BY.js +9 -0
  103. package/dist/locale/ca_ES.js +9 -0
  104. package/dist/locale/cs_CZ.js +9 -0
  105. package/dist/locale/da_DK.js +9 -0
  106. package/dist/locale/de_DE.js +9 -0
  107. package/dist/locale/el_GR.js +9 -0
  108. package/dist/locale/en_GB.js +11 -1
  109. package/dist/locale/en_US.js +11 -1
  110. package/dist/locale/es_ES.js +9 -0
  111. package/dist/locale/et_EE.js +9 -0
  112. package/dist/locale/eu_ES.js +9 -0
  113. package/dist/locale/fa_IR.js +9 -0
  114. package/dist/locale/fi_FI.js +10 -1
  115. package/dist/locale/fr_BE.js +9 -0
  116. package/dist/locale/fr_CA.js +9 -0
  117. package/dist/locale/fr_FR.js +9 -0
  118. package/dist/locale/ga_IE.js +9 -0
  119. package/dist/locale/gl_ES.js +9 -0
  120. package/dist/locale/he_IL.js +9 -0
  121. package/dist/locale/hi_IN.js +9 -0
  122. package/dist/locale/hr_HR.js +9 -0
  123. package/dist/locale/hu_HU.js +9 -0
  124. package/dist/locale/hy_AM.js +9 -0
  125. package/dist/locale/id_ID.js +9 -0
  126. package/dist/locale/index.d.ts +3 -0
  127. package/dist/locale/is_IS.js +9 -0
  128. package/dist/locale/it_IT.js +9 -0
  129. package/dist/locale/ja_JP.js +9 -0
  130. package/dist/locale/ka_GE.js +9 -0
  131. package/dist/locale/kk_KZ.js +9 -0
  132. package/dist/locale/km_KH.js +9 -0
  133. package/dist/locale/kmr_IQ.js +9 -0
  134. package/dist/locale/kn_IN.js +9 -0
  135. package/dist/locale/ko_KR.js +9 -0
  136. package/dist/locale/ku_IQ.js +9 -0
  137. package/dist/locale/lt_LT.js +9 -0
  138. package/dist/locale/lv_LV.js +9 -0
  139. package/dist/locale/mk_MK.js +9 -0
  140. package/dist/locale/ml_IN.js +9 -0
  141. package/dist/locale/mn_MN.js +9 -0
  142. package/dist/locale/mr_IN.js +9 -0
  143. package/dist/locale/ms_MY.js +9 -0
  144. package/dist/locale/my_MM.js +9 -0
  145. package/dist/locale/nb_NO.js +9 -0
  146. package/dist/locale/ne_NP.js +9 -0
  147. package/dist/locale/nl_BE.js +9 -0
  148. package/dist/locale/nl_NL.js +9 -0
  149. package/dist/locale/pl_PL.js +9 -0
  150. package/dist/locale/pt_BR.js +9 -0
  151. package/dist/locale/pt_PT.js +9 -0
  152. package/dist/locale/ro_RO.js +19 -10
  153. package/dist/locale/ru_RU.js +9 -0
  154. package/dist/locale/si_LK.js +9 -0
  155. package/dist/locale/sk_SK.js +9 -0
  156. package/dist/locale/sl_SI.js +9 -0
  157. package/dist/locale/sq_AL.js +9 -0
  158. package/dist/locale/sr_RS.js +9 -0
  159. package/dist/locale/sv_SE.js +9 -0
  160. package/dist/locale/ta_IN.js +10 -1
  161. package/dist/locale/th_TH.js +9 -0
  162. package/dist/locale/tk_TK.js +9 -0
  163. package/dist/locale/tr_TR.js +9 -0
  164. package/dist/locale/uk_UA.js +9 -0
  165. package/dist/locale/ur_PK.js +9 -0
  166. package/dist/locale/useLocale.d.ts +6 -1
  167. package/dist/locale/useLocale.js +12 -1
  168. package/dist/locale/uz_UZ.js +9 -0
  169. package/dist/locale/vi_VN.js +9 -0
  170. package/dist/locale/zh_CN.js +13 -3
  171. package/dist/locale/zh_HK.js +11 -1
  172. package/dist/locale/zh_TW.js +11 -1
  173. package/dist/masonry/Masonry.js +1 -1
  174. package/dist/mentions/index.d.ts +2 -3
  175. package/dist/mentions/index.js +9 -4
  176. package/dist/mentions/style/index.js +1 -1
  177. package/dist/menu/MenuContext.d.ts +2 -0
  178. package/dist/menu/MenuItem.js +23 -6
  179. package/dist/menu/index.js +5 -0
  180. package/dist/menu/menu.d.ts +3 -0
  181. package/dist/menu/menu.js +7 -0
  182. package/dist/message/style/index.js +2 -1
  183. package/dist/modal/ConfirmDialog.js +14 -7
  184. package/dist/modal/PurePanel.js +2 -2
  185. package/dist/modal/style/confirm.js +1 -1
  186. package/dist/notification/PurePanel.js +7 -12
  187. package/dist/notification/interface.d.ts +8 -0
  188. package/dist/notification/style/index.d.ts +3 -0
  189. package/dist/notification/style/index.js +4 -5
  190. package/dist/notification/style/placement.js +10 -7
  191. package/dist/notification/useNotification.js +5 -15
  192. package/dist/package.js +1 -1
  193. package/dist/pagination/Pagination.js +2 -2
  194. package/dist/pagination/style/index.js +12 -4
  195. package/dist/pagination/useShowSizeChanger.d.ts +3 -0
  196. package/dist/pagination/useShowSizeChanger.js +1 -1
  197. package/dist/popconfirm/index.js +6 -5
  198. package/dist/popconfirm/style/index.js +1 -1
  199. package/dist/popover/index.js +1 -1
  200. package/dist/popover/style/index.js +2 -2
  201. package/dist/progress/Circle.js +0 -8
  202. package/dist/progress/Line.js +3 -10
  203. package/dist/progress/Steps.js +0 -8
  204. package/dist/progress/progress.js +3 -15
  205. package/dist/qrcode/QrcodeStatus.js +2 -1
  206. package/dist/qrcode/index.js +4 -4
  207. package/dist/radio/group.js +40 -7
  208. package/dist/radio/index.d.ts +2 -2
  209. package/dist/radio/interface.d.ts +19 -1
  210. package/dist/radio/radio.js +5 -3
  211. package/dist/result/index.js +3 -3
  212. package/dist/result/noFound.js +120 -140
  213. package/dist/result/serverError.js +132 -147
  214. package/dist/result/unauthorized.js +115 -129
  215. package/dist/segmented/index.js +1 -1
  216. package/dist/select/index.js +10 -3
  217. package/dist/select/style/dropdown.js +1 -1
  218. package/dist/select/style/index.js +2 -2
  219. package/dist/select/style/select-input-multiple.js +1 -1
  220. package/dist/select/useIcons.d.ts +6 -2
  221. package/dist/select/usePopupRender.js +4 -1
  222. package/dist/slider/index.d.ts +6 -4
  223. package/dist/slider/index.js +7 -5
  224. package/dist/space/Compact.d.ts +1 -1
  225. package/dist/space/Item.d.ts +1 -0
  226. package/dist/space/Item.js +6 -2
  227. package/dist/space/index.js +1 -0
  228. package/dist/spin/Indicator/index.js +5 -1
  229. package/dist/splitter/SplitBar.js +9 -3
  230. package/dist/splitter/Splitter.js +8 -2
  231. package/dist/splitter/interface.d.ts +6 -1
  232. package/dist/statistic/Statistic.d.ts +3 -0
  233. package/dist/statistic/Statistic.js +2 -1
  234. package/dist/steps/index.js +9 -7
  235. package/dist/steps/style/index.js +1 -1
  236. package/dist/steps/style/inline.js +1 -1
  237. package/dist/style/motion/collapse.js +4 -10
  238. package/dist/switch/index.js +8 -2
  239. package/dist/table/ExpandIcon.d.ts +9 -4
  240. package/dist/table/ExpandIcon.js +42 -20
  241. package/dist/table/InternalTable.js +41 -20
  242. package/dist/table/hooks/useLazyKVMap.js +1 -1
  243. package/dist/table/hooks/useSelection.js +54 -9
  244. package/dist/table/index.d.ts +2 -2
  245. package/dist/table/interface.d.ts +8 -0
  246. package/dist/table/style/index.js +1 -1
  247. package/dist/table/style/sorter.js +2 -2
  248. package/dist/table/util.d.ts +1 -1
  249. package/dist/tabs/index.js +9 -2
  250. package/dist/tabs/style/index.js +3 -7
  251. package/dist/tag/hooks/useColor.d.ts +1 -1
  252. package/dist/time-picker/index.d.ts +10 -9
  253. package/dist/time-picker/index.js +54 -83
  254. package/dist/timeline/Timeline.js +1 -1
  255. package/dist/tooltip/style/index.js +1 -2
  256. package/dist/tour/panelRender.js +3 -2
  257. package/dist/transfer/Section.js +2 -1
  258. package/dist/transfer/Transfer.js +1 -1
  259. package/dist/tree/DirectoryTree.d.ts +19 -7
  260. package/dist/tree/Tree.d.ts +73 -58
  261. package/dist/tree/index.d.ts +8 -5
  262. package/dist/tree/index.js +4 -3
  263. package/dist/tree/style/index.js +1 -1
  264. package/dist/tree-select/index.js +14 -8
  265. package/dist/typography/Base/index.js +23 -2
  266. package/dist/typography/Link.js +5 -0
  267. package/dist/typography/Paragraph.js +5 -0
  268. package/dist/typography/Text.js +5 -0
  269. package/dist/typography/Title.js +5 -0
  270. package/dist/typography/hooks/useMergedConfig.js +1 -1
  271. package/dist/typography/interface.d.ts +8 -1
  272. package/dist/typography/style/index.js +2 -1
  273. package/dist/typography/style/mixins.d.ts +2 -1
  274. package/dist/typography/style/mixins.js +26 -3
  275. package/dist/upload/Upload.d.ts +1 -0
  276. package/dist/upload/Upload.js +10 -3
  277. package/dist/upload/UploadList/ListItem.js +8 -3
  278. package/dist/upload/interface.d.ts +1 -0
  279. package/dist/upload/utils.js +8 -3
  280. package/dist/version/token-meta.json +1 -1
  281. package/dist/version/token.json +1 -1
  282. package/dist/watermark/index.js +1 -1
  283. package/package.json +24 -24
  284. package/web-tags.json +79 -15
  285. package/web-types.json +196 -24
  286. package/dist/_util/getAllowClear.d.ts +0 -6
  287. package/dist/_util/getAllowClear.js +0 -11
@@ -1,3 +1,4 @@
1
+ import { NoFormStyle } from "../form/context.js";
1
2
  import { NoCompactStyle } from "../space/Compact.js";
2
3
  import { createVNode, defineComponent, isVNode } from "vue";
3
4
  import { filterEmpty } from "@v-c/util/dist/props-util";
@@ -11,12 +12,20 @@ const ContextIsolator = /* @__PURE__ */ defineComponent((props, { slots }) => {
11
12
  const children = filterEmpty(slots?.default?.());
12
13
  if (children.length === 0) return null;
13
14
  let result = children;
14
- if (form) {}
15
- if (space) {
15
+ if (form) {
16
16
  const _result = function() {
17
17
  return result;
18
18
  }();
19
- result = createVNode(NoCompactStyle, null, _isSlot(result) ? result : { default: () => [_result] });
19
+ result = createVNode(NoFormStyle, {
20
+ "override": true,
21
+ "status": true
22
+ }, _isSlot(result) ? result : { default: () => [_result] });
23
+ }
24
+ if (space) {
25
+ const _result2 = function() {
26
+ return result;
27
+ }();
28
+ result = createVNode(NoCompactStyle, null, _isSlot(result) ? result : { default: () => [_result2] });
20
29
  }
21
30
  return result;
22
31
  };
@@ -1,19 +1,35 @@
1
1
  //#region src/_util/hooks/useAllowClear.d.ts
2
- interface AllowClearObject {
2
+ interface AllowClearConfig {
3
+ /** Custom clear icon */
3
4
  clearIcon?: any;
5
+ /** Disable the clear button */
4
6
  disabled?: boolean;
7
+ /** Tab order of the clear button. `-1` excludes it from Tab navigation */
8
+ tabIndex?: number;
9
+ /** Accessible name of the clear button */
10
+ label?: string;
5
11
  }
6
- type AllowClear = boolean | AllowClearObject;
12
+ type AllowClear = boolean | AllowClearConfig;
7
13
  /** The hook never returns plain `true`: a truthy allowClear is normalized to the object form. */
8
- type MergedAllowClear = AllowClearObject | false;
14
+ type MergedAllowClear = AllowClearConfig | false;
9
15
  interface UseAllowClearOptions {
10
16
  allowClear?: AllowClear;
11
17
  clearIcon?: any;
12
18
  contextAllowClear?: AllowClear;
13
19
  contextClearIcon?: any;
14
20
  defaultAllowClear?: boolean;
21
+ defaultLabel?: string;
15
22
  }
16
- /** Merge component- and ConfigProvider-level `allowClear` / `clearIcon` (priority: props → context → `defaultAllowClear`). */
17
- declare function useAllowClear({ allowClear, clearIcon, contextAllowClear, contextClearIcon, defaultAllowClear }: UseAllowClearOptions): MergedAllowClear;
23
+ /**
24
+ * Getter for the localized clear button label (`locale.global.clear`).
25
+ * Reads the locale context lazily so callers can use it inside their own `computed` without extra reactive objects.
26
+ */
27
+ declare function useAllowClearLabel(): () => string | undefined;
28
+ /**
29
+ * Merge component- and ConfigProvider-level `allowClear` / `clearIcon`.
30
+ * Each field is resolved on its own (priority: props → context → default), so `allowClear: true`
31
+ * inherits the global config while `disabled: false` / `tabIndex: 0` / `label: ''` still override it.
32
+ */
33
+ declare function useAllowClear({ allowClear, clearIcon, contextAllowClear, contextClearIcon, defaultAllowClear, defaultLabel }: UseAllowClearOptions): MergedAllowClear;
18
34
  //#endregion
19
- export { AllowClear, AllowClearObject, MergedAllowClear, UseAllowClearOptions, useAllowClear as default };
35
+ export { AllowClear, AllowClearConfig, MergedAllowClear, UseAllowClearOptions, useAllowClear as default, useAllowClearLabel };
@@ -1,16 +1,34 @@
1
- import { isPlainObject } from "../is.js";
1
+ import { useLocaleContext } from "../../locale/index.js";
2
2
  import fallbackProp from "../fallbackProp.js";
3
+ import { isPlainObject } from "../is.js";
4
+ import localeValues from "../../locale/en_US.js";
3
5
  import { createVNode } from "vue";
4
6
  import { CloseCircleFilled } from "@antdv-next/icons";
5
7
  //#region src/_util/hooks/useAllowClear.tsx
6
8
  /** The hook never returns plain `true`: a truthy allowClear is normalized to the object form. */
7
- /** Merge component- and ConfigProvider-level `allowClear` / `clearIcon` (priority: props → context → `defaultAllowClear`). */
8
- function useAllowClear({ allowClear, clearIcon, contextAllowClear, contextClearIcon, defaultAllowClear }) {
9
+ /**
10
+ * Getter for the localized clear button label (`locale.global.clear`).
11
+ * Reads the locale context lazily so callers can use it inside their own `computed` without extra reactive objects.
12
+ */
13
+ function useAllowClearLabel() {
14
+ const { locale } = useLocaleContext();
15
+ return () => locale.value?.global?.clear ?? localeValues.global?.clear;
16
+ }
17
+ /**
18
+ * Merge component- and ConfigProvider-level `allowClear` / `clearIcon`.
19
+ * Each field is resolved on its own (priority: props → context → default), so `allowClear: true`
20
+ * inherits the global config while `disabled: false` / `tabIndex: 0` / `label: ''` still override it.
21
+ */
22
+ function useAllowClear({ allowClear, clearIcon, contextAllowClear, contextClearIcon, defaultAllowClear, defaultLabel }) {
9
23
  if (!(allowClear ?? contextAllowClear ?? defaultAllowClear)) return false;
24
+ const config = isPlainObject(allowClear) ? allowClear : void 0;
25
+ const contextConfig = isPlainObject(contextAllowClear) ? contextAllowClear : void 0;
10
26
  return {
11
- clearIcon: fallbackProp(isPlainObject(allowClear) ? allowClear?.clearIcon : clearIcon, isPlainObject(contextAllowClear) ? contextAllowClear?.clearIcon : contextClearIcon, createVNode(CloseCircleFilled, null, null)),
12
- disabled: (isPlainObject(allowClear) ? allowClear?.disabled : void 0) ?? (isPlainObject(contextAllowClear) ? contextAllowClear?.disabled : void 0)
27
+ clearIcon: fallbackProp(config?.clearIcon, clearIcon, contextConfig?.clearIcon, contextClearIcon, createVNode(CloseCircleFilled, null, null)),
28
+ disabled: config?.disabled ?? contextConfig?.disabled,
29
+ tabIndex: config?.tabIndex ?? contextConfig?.tabIndex,
30
+ label: config?.label ?? contextConfig?.label ?? defaultLabel
13
31
  };
14
32
  }
15
33
  //#endregion
16
- export { useAllowClear as default };
34
+ export { useAllowClear as default, useAllowClearLabel };
@@ -1,9 +1,9 @@
1
1
  import { getSlotPropsFnRun } from "../tools.js";
2
- import isNonNullable from "../isNonNullable.js";
3
2
  import localeValues from "../../locale/en_US.js";
4
3
  import useLocale from "../../locale/useLocale.js";
5
4
  import { getVNode } from "../vueNode.js";
6
5
  import mergeProps$1 from "../extendsObject.js";
6
+ import isNonNullable from "../isNonNullable.js";
7
7
  import { computed, createVNode, isVNode, mergeProps, ref, unref } from "vue";
8
8
  import { filterEmpty } from "@v-c/util/dist/props-util";
9
9
  import { CloseOutlined } from "@antdv-next/icons";
@@ -3,6 +3,8 @@ import { classNames } from "@v-c/util";
3
3
  //#region src/_util/tools.d.ts
4
4
  declare function getSlotPropFn(slots: any, props: any, key: string): any;
5
5
  declare function getSlotPropsFnRun(slots: any, props: any, key: string, isNull?: boolean, params?: any): any;
6
+ /** Resolve a slot/prop render prop: slot first, empty slot (undefined / []) falls back to prop; explicit null is kept; function props are invoked, never leaked. */
7
+ declare function getSlotPropsFnRunWithFallback(slots: any, props: any, key: string, params?: any): any;
6
8
  declare function toPropsRefs<T extends Record<string, any>, K extends keyof T>(obj: T, ...args: K[]): { [key in K]-?: Ref<T[key]>; };
7
9
  /**
8
10
  * 返回一个「稳定引用」的事件转发器,调用时实时读取组件当前 vnode 上的监听器。
@@ -19,4 +21,4 @@ declare function toPropsRefs<T extends Record<string, any>, K extends keyof T>(o
19
21
  declare function useLiveListener<Args extends any[] = any[], R = any>(name: string): (...args: Args) => R | undefined;
20
22
  declare const clsx: typeof classNames;
21
23
  //#endregion
22
- export { clsx, getSlotPropFn, getSlotPropsFnRun, toPropsRefs, useLiveListener };
24
+ export { clsx, getSlotPropFn, getSlotPropsFnRun, getSlotPropsFnRunWithFallback, toPropsRefs, useLiveListener };
@@ -1,3 +1,4 @@
1
+ import fallbackProp from "./fallbackProp.js";
1
2
  import { getCurrentInstance, toHandlerKey, toRef } from "vue";
2
3
  import { classNames } from "@v-c/util";
3
4
  import { filterEmpty } from "@v-c/util/dist/props-util";
@@ -22,6 +23,10 @@ function getSlotPropsFnRun(slots, props, key, isNull = true, params) {
22
23
  }
23
24
  return fn;
24
25
  }
26
+ /** Resolve a slot/prop render prop: slot first, empty slot (undefined / []) falls back to prop; explicit null is kept; function props are invoked, never leaked. */
27
+ function getSlotPropsFnRunWithFallback(slots, props, key, params) {
28
+ return fallbackProp(getSlotPropsFnRun(slots, {}, key, false, params), getSlotPropsFnRun({}, props, key, false, params));
29
+ }
25
30
  function toPropsRefs(obj, ...args) {
26
31
  const _res = {};
27
32
  args.forEach((key) => {
@@ -58,4 +63,4 @@ function useLiveListener(name) {
58
63
  }
59
64
  const clsx = classNames;
60
65
  //#endregion
61
- export { clsx, getSlotPropFn, getSlotPropsFnRun, toPropsRefs, useLiveListener };
66
+ export { clsx, getSlotPropFn, getSlotPropsFnRun, getSlotPropsFnRunWithFallback, toPropsRefs, useLiveListener };
@@ -3,12 +3,26 @@ import { VNodeChild } from "vue";
3
3
  import { isFragment } from "@v-c/util/dist/Children/isFragment";
4
4
  //#region src/_util/vueNode.d.ts
5
5
  type RenderProps = AnyObject | ((originProps: AnyObject) => AnyObject | undefined);
6
- declare function replaceElement(element: VNodeChild, replacement: VNodeChild, props?: RenderProps): VNodeChild;
7
- declare function cloneElement(element: VNodeChild, props?: RenderProps): VNodeChild;
6
+ declare function replaceElement(element: VNodeChild, replacement: VNodeChild, props?: RenderProps): string | number | boolean | void | import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
7
+ [key: string]: any;
8
+ }> | import("vue").VNodeArrayChildren | null;
9
+ declare function cloneElement(element: VNodeChild, props?: RenderProps): string | number | boolean | void | import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
10
+ [key: string]: any;
11
+ }> | import("vue").VNodeArrayChildren | null;
12
+ /**
13
+ * 当传入值是 VNode 时返回一个全新的克隆,数组会逐项处理,其余值原样返回。
14
+ *
15
+ * 用于模块级共享的默认 vnode(图标 / 图片等)。一旦原始 vnode 被真正挂载,
16
+ * Vue 会把 el / component 写回它身上;而模块级常量是常驻的 GC Root,Vue 在
17
+ * unmount 时又不会清空这些字段,于是这条引用会把已卸载页面的整条实例链一直
18
+ * 保留下来,造成内存泄漏。渲染前克隆可让模块原始 vnode 永远保持未挂载
19
+ * (el 恒为 null),从而彻底切断该引用链。
20
+ */
21
+ declare function cloneIfVNode<T>(node: T): T;
8
22
  declare function getVNode(node: VueNode): VNodeChild;
9
23
  declare function checkRenderNode(node: any): any;
10
24
  declare function getTextByNode(node: any): any;
11
25
  declare function getTextNodeArr(nodes: any[]): any[];
12
26
  type EmitToProps<T extends Record<string, any>> = { [K in keyof T as `on${Capitalize<K & string>}`]: T[K]; };
13
27
  //#endregion
14
- export { EmitToProps, checkRenderNode, cloneElement, getTextByNode, getTextNodeArr, getVNode, isFragment, replaceElement };
28
+ export { EmitToProps, checkRenderNode, cloneElement, cloneIfVNode, getTextByNode, getTextNodeArr, getVNode, isFragment, replaceElement };
@@ -9,6 +9,22 @@ function replaceElement(element, replacement, props) {
9
9
  function cloneElement(element, props) {
10
10
  return replaceElement(element, element, props);
11
11
  }
12
+ /**
13
+ * 当传入值是 VNode 时返回一个全新的克隆,数组会逐项处理,其余值原样返回。
14
+ *
15
+ * 用于模块级共享的默认 vnode(图标 / 图片等)。一旦原始 vnode 被真正挂载,
16
+ * Vue 会把 el / component 写回它身上;而模块级常量是常驻的 GC Root,Vue 在
17
+ * unmount 时又不会清空这些字段,于是这条引用会把已卸载页面的整条实例链一直
18
+ * 保留下来,造成内存泄漏。渲染前克隆可让模块原始 vnode 永远保持未挂载
19
+ * (el 恒为 null),从而彻底切断该引用链。
20
+ */
21
+ function cloneIfVNode(node) {
22
+ if (Array.isArray(node)) return node.map((item) => cloneIfVNode(item));
23
+ if (!isVNode(node)) return node;
24
+ const cloned = cloneVNode(node);
25
+ if (Array.isArray(cloned.children)) cloned.children = cloned.children.map((item) => cloneIfVNode(item));
26
+ return cloned;
27
+ }
12
28
  function getVNode(node) {
13
29
  if (typeof node === "function") return node?.();
14
30
  return node;
@@ -33,4 +49,4 @@ function getTextNodeArr(nodes) {
33
49
  return res;
34
50
  }
35
51
  //#endregion
36
- export { checkRenderNode, cloneElement, getTextByNode, getTextNodeArr, getVNode, isFragment, replaceElement };
52
+ export { checkRenderNode, cloneElement, cloneIfVNode, getTextByNode, getTextNodeArr, getVNode, isFragment, replaceElement };
@@ -28,8 +28,8 @@ const Affix = /* @__PURE__ */ defineComponent((props, { slots, attrs, expose, em
28
28
  const affixStyle = shallowRef();
29
29
  const placeholderStyle = shallowRef();
30
30
  const status = shallowRef(AFFIX_STATUS_NONE);
31
- const prevTarget = shallowRef(null);
32
- const prevListener = shallowRef(null);
31
+ let prevTarget = null;
32
+ let prevListener = null;
33
33
  const placeholderNodeRef = shallowRef();
34
34
  const fixedNodeRef = shallowRef();
35
35
  const contextRef = shallowRef();
@@ -94,17 +94,16 @@ const Affix = /* @__PURE__ */ defineComponent((props, { slots, attrs, expose, em
94
94
  const listenerTarget = targetFunc.value();
95
95
  if (!listenerTarget) return;
96
96
  TRIGGER_EVENTS.forEach((eventName) => {
97
- if (prevListener.value) prevTarget.value?.removeEventListener(eventName, prevListener.value);
97
+ if (prevListener) prevTarget?.removeEventListener(eventName, prevListener);
98
98
  listenerTarget?.addEventListener(eventName, lazyUpdatePosition);
99
99
  });
100
- prevTarget.value = listenerTarget;
101
- prevListener.value = lazyUpdatePosition;
100
+ prevTarget = listenerTarget;
101
+ prevListener = lazyUpdatePosition;
102
102
  };
103
- const removeListeners = () => {
104
- const newTarget = targetFunc.value();
103
+ const removeListeners = (newTarget = targetFunc.value()) => {
105
104
  TRIGGER_EVENTS.forEach((eventName) => {
106
105
  newTarget?.removeEventListener(eventName, lazyUpdatePosition);
107
- if (prevListener.value) prevTarget.value?.removeEventListener(eventName, prevListener.value);
106
+ if (prevListener) prevTarget?.removeEventListener(eventName, prevListener);
108
107
  });
109
108
  updatePosition.cancel();
110
109
  lazyUpdatePosition.cancel();
@@ -113,7 +112,9 @@ const Affix = /* @__PURE__ */ defineComponent((props, { slots, attrs, expose, em
113
112
  onMounted(() => {
114
113
  timer.value = setTimeout(addListeners);
115
114
  });
115
+ let unmounted = false;
116
116
  onBeforeUnmount(() => {
117
+ unmounted = true;
117
118
  if (timer.value) {
118
119
  clearTimeout(timer.value);
119
120
  timer.value = null;
@@ -128,8 +129,10 @@ const Affix = /* @__PURE__ */ defineComponent((props, { slots, attrs, expose, em
128
129
  () => props.offsetBottom
129
130
  ], async (_new, _old, onCleanup) => {
130
131
  await nextTick();
132
+ if (unmounted) return;
131
133
  addListeners();
132
- onCleanup(removeListeners);
134
+ const target = prevTarget;
135
+ onCleanup(() => removeListeners(target));
133
136
  });
134
137
  watch([
135
138
  () => props.target,
@@ -256,7 +256,10 @@ const Alert = /* @__PURE__ */ defineComponent((props, { slots, emit, attrs, expo
256
256
  "data-show": !closed.value,
257
257
  "role": props.role || "alert",
258
258
  "class": alertCls,
259
- "style": [mergedStyles.root, style]
259
+ "style": [mergedStyles.root, style],
260
+ "onMouseenter": (e) => emit("mouseenter", e),
261
+ "onMouseleave": (e) => emit("mouseleave", e),
262
+ "onClick": (e) => emit("click", e)
260
263
  }, pureAttrs(attrs)), [
261
264
  isShowIcon ? createVNode(IconNode, {
262
265
  "class": clsx(`${prefixCls.value}-icon`, mergedClassNames.icon),
@@ -9,10 +9,10 @@ import { CSSObject } from "@antdv-next/cssinjs";
9
9
  //#region src/alert/style/index.d.ts
10
10
  interface ComponentToken {
11
11
  /**
12
- * @desc 组件圆角
13
- * @descEN Border radius of alert
12
+ * @desc 容器圆角
13
+ * @descEN Border radius of the container
14
14
  */
15
- borderRadius: CSSProperties['borderRadius'];
15
+ containerBorderRadius: CSSProperties['borderRadius'];
16
16
  /**
17
17
  * @desc 默认内间距
18
18
  * @descEN Default padding
@@ -10,7 +10,7 @@ function genAlertTypeStyle(bgColor, borderColor, iconColor, token, alertCls) {
10
10
  };
11
11
  }
12
12
  const genBaseStyle = (token) => {
13
- const { componentCls, motionDurationSlow: duration, marginXS, marginSM, fontSize, fontSizeLG, lineHeight, motionEaseInOutCirc, borderRadius, withDescriptionIconSize, colorText, colorTextHeading, withDescriptionPadding, defaultPadding } = token;
13
+ const { componentCls, motionDurationSlow: duration, marginXS, marginSM, fontSize, fontSizeLG, lineHeight, motionEaseInOutCirc, containerBorderRadius, withDescriptionIconSize, colorText, colorTextHeading, withDescriptionPadding, defaultPadding } = token;
14
14
  return { [componentCls]: {
15
15
  ...resetComponent(token),
16
16
  position: "relative",
@@ -18,7 +18,7 @@ const genBaseStyle = (token) => {
18
18
  alignItems: "center",
19
19
  padding: defaultPadding,
20
20
  wordWrap: "break-word",
21
- borderRadius,
21
+ borderRadius: containerBorderRadius,
22
22
  [`&${componentCls}-rtl`]: { direction: "rtl" },
23
23
  [`${componentCls}-section`]: {
24
24
  flex: 1,
@@ -125,7 +125,7 @@ const genActionStyle = (token) => {
125
125
  };
126
126
  const prepareComponentToken = (token) => {
127
127
  return {
128
- borderRadius: token.borderRadiusLG,
128
+ containerBorderRadius: token.borderRadiusLG,
129
129
  withDescriptionIconSize: token.fontSizeHeading3,
130
130
  defaultPadding: `${token.paddingContentVerticalSM}px 12px`,
131
131
  withDescriptionPadding: `${token.paddingMD}px ${token.paddingContentHorizontalLG}px`
@@ -36,7 +36,8 @@ function getOffsetTop(element, container) {
36
36
  }
37
37
  const Anchor = /* @__PURE__ */ defineComponent((props, { slots, emit, attrs }) => {
38
38
  const links = ref([]);
39
- const linkTargetOffsetRef = ref({});
39
+ let linkList = [];
40
+ const linkTargetOffsets = {};
40
41
  const activeLink = shallowRef();
41
42
  const _activeLink = shallowRef(activeLink.value);
42
43
  const activeLinkRef = computed({
@@ -57,12 +58,16 @@ const Anchor = /* @__PURE__ */ defineComponent((props, { slots, emit, attrs }) =
57
58
  const getCurrentContainer = () => props?.getContainer?.() ?? getTargetContainer?.() ?? getDefaultContainer?.();
58
59
  const dependencyListItem = computed(() => JSON.stringify(links.value));
59
60
  const registerLink = (link, targetOffset) => {
60
- if (!links.value.includes(link)) links.value.push(link);
61
- if (targetOffset !== void 0) linkTargetOffsetRef.value[link] = targetOffset;
61
+ if (!linkList.includes(link)) {
62
+ linkList = [...linkList, link];
63
+ links.value = linkList;
64
+ }
65
+ if (targetOffset !== void 0) linkTargetOffsets[link] = targetOffset;
62
66
  };
63
67
  const unregisterLink = (link) => {
64
- links.value = links.value.filter((item) => item !== link);
65
- delete linkTargetOffsetRef.value[link];
68
+ linkList = linkList.filter((item) => item !== link);
69
+ links.value = linkList;
70
+ delete linkTargetOffsets[link];
66
71
  };
67
72
  const updateInk = () => {
68
73
  const linkNode = wrapperRef.value?.querySelector(`.${prefixCls.value}-link-title-active`);
@@ -88,7 +93,7 @@ const Anchor = /* @__PURE__ */ defineComponent((props, { slots, emit, attrs }) =
88
93
  const target = document.getElementById(sharpLinkMatch[1]);
89
94
  if (target) {
90
95
  const top = getOffsetTop(target, container);
91
- if (top <= (linkTargetOffsetRef.value[link] ?? _offsetTop) + _bounds) linkSections.push({
96
+ if (top <= (linkTargetOffsets[link] ?? _offsetTop) + _bounds) linkSections.push({
92
97
  link,
93
98
  top
94
99
  });
@@ -91,12 +91,11 @@ const prepareComponentToken = (token) => ({
91
91
  linkPaddingInlineStart: token.padding
92
92
  });
93
93
  var style_default = genStyleHooks("Anchor", (token) => {
94
- const { fontSize, fontSizeLG, paddingXXS, calc } = token;
94
+ const { fontSize, paddingXXS, calc } = token;
95
95
  const anchorToken = mergeToken(token, {
96
96
  holderOffsetBlock: paddingXXS,
97
97
  anchorPaddingBlockSecondary: calc(paddingXXS).div(2).equal(),
98
- anchorTitleBlock: calc(fontSize).div(14).mul(3).equal(),
99
- anchorBallSize: calc(fontSizeLG).div(2).equal()
98
+ anchorTitleBlock: calc(fontSize).div(14).mul(3).equal()
100
99
  });
101
100
  return [genSharedAnchorStyle(anchorToken), genSharedAnchorHorizontalStyle(anchorToken)];
102
101
  }, prepareComponentToken);