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.
- package/dist/_util/ContextIsolator.js +12 -3
- package/dist/_util/hooks/useAllowClear.d.ts +22 -6
- package/dist/_util/hooks/useAllowClear.js +24 -6
- package/dist/_util/hooks/useClosable.js +1 -1
- package/dist/_util/tools.d.ts +3 -1
- package/dist/_util/tools.js +6 -1
- package/dist/_util/vueNode.d.ts +17 -3
- package/dist/_util/vueNode.js +17 -1
- package/dist/affix/index.js +12 -9
- package/dist/alert/Alert.js +4 -1
- package/dist/alert/style/index.d.ts +3 -3
- package/dist/alert/style/index.js +3 -3
- package/dist/anchor/Anchor.js +11 -6
- package/dist/anchor/style/index.js +2 -3
- package/dist/antd-with-locales.esm.js +16276 -17343
- package/dist/antd-with-locales.js +81 -88
- package/dist/antd.css +1 -1
- package/dist/antd.esm.js +14015 -15728
- package/dist/antd.js +82 -89
- package/dist/auto-complete/index.js +1 -0
- package/dist/avatar/Avatar.js +3 -5
- package/dist/avatar/AvatarGroup.js +3 -5
- package/dist/border-beam/BorderBeam.d.ts +8 -1
- package/dist/border-beam/BorderBeam.js +28 -14
- package/dist/border-beam/index.d.ts +2 -2
- package/dist/breadcrumb/BreadcrumbItem.js +1 -1
- package/dist/breadcrumb/index.d.ts +8 -1
- package/dist/calendar/generateCalendar.d.ts +10 -10
- package/dist/calendar/index.d.ts +1 -1
- package/dist/card/index.d.ts +8 -1
- package/dist/card/style/index.js +5 -9
- package/dist/cascader/Panel.js +3 -3
- package/dist/cascader/hooks/useIcons.js +3 -2
- package/dist/cascader/index.d.ts +2 -0
- package/dist/cascader/index.js +12 -5
- package/dist/checkbox/Checkbox.js +6 -4
- package/dist/checkbox/Group.d.ts +19 -1
- package/dist/checkbox/Group.js +38 -9
- package/dist/checkbox/GroupContext.d.ts +3 -0
- package/dist/checkbox/index.d.ts +2 -2
- package/dist/color-picker/ColorPicker.js +1 -1
- package/dist/color-picker/style/input.js +7 -12
- package/dist/components.d.ts +24 -24
- package/dist/components.js +1 -2
- package/dist/config-provider/context.d.ts +3 -2
- package/dist/date-picker/generatePicker/generateRangePicker.js +24 -6
- package/dist/date-picker/generatePicker/generateSinglePicker.js +24 -6
- package/dist/date-picker/generatePicker/interface.d.ts +21 -5
- package/dist/date-picker/generatePicker/useComponents.d.ts +1 -14
- package/dist/date-picker/style/panel.js +1 -1
- package/dist/date-picker/style/util.js +1 -1
- package/dist/date-picker/util.d.ts +8 -2
- package/dist/descriptions/hooks/useItems.d.ts +6 -6
- package/dist/descriptions/style/index.js +11 -13
- package/dist/divider/style/index.js +1 -1
- package/dist/drawer/DrawerPanel.js +1 -1
- package/dist/dropdown/dropdown.d.ts +2 -0
- package/dist/dropdown/dropdown.js +9 -2
- package/dist/dropdown/style/index.js +1 -7
- package/dist/empty/index.js +2 -1
- package/dist/float-button/BackTop.js +2 -1
- package/dist/form/ErrorList.js +1 -1
- package/dist/form/Form.js +9 -8
- package/dist/form/FormItem/ItemHolder.js +1 -1
- package/dist/form/FormItem/index.js +11 -9
- package/dist/form/FormItemInput.js +1 -1
- package/dist/form/FormItemLabel.js +2 -2
- package/dist/form/context.d.ts +2 -2
- package/dist/form/hooks/useVariant.d.ts +1 -1
- package/dist/form/hooks/useVariant.js +1 -1
- package/dist/grid/hooks/useBreakpoint.js +12 -6
- package/dist/image/PreviewGroup.d.ts +9 -2
- package/dist/image/hooks/useMergedPreviewConfig.d.ts +1 -0
- package/dist/image/hooks/useMergedPreviewConfig.js +2 -1
- package/dist/image/hooks/usePreviewConfig.d.ts +7 -7
- package/dist/image/index.d.ts +3 -3
- package/dist/index.d.ts +26 -24
- package/dist/index.js +1 -2
- package/dist/input/Group.js +1 -1
- package/dist/input/Input.d.ts +2 -1
- package/dist/input/Input.js +8 -5
- package/dist/input/OTP/OTPInput.d.ts +2 -1
- package/dist/input/OTP/OTPInput.js +12 -3
- package/dist/input/OTP/index.d.ts +3 -1
- package/dist/input/OTP/index.js +15 -6
- package/dist/input/Password.js +7 -5
- package/dist/input/Search.js +4 -2
- package/dist/input/TextArea.d.ts +3 -1
- package/dist/input/TextArea.js +13 -8
- package/dist/input/style/index.js +3 -16
- package/dist/input-number/index.d.ts +3 -6
- package/dist/input-number/index.js +8 -3
- package/dist/input-number/style/index.js +1 -5
- package/dist/listy/index.d.ts +1 -1
- package/dist/listy/index.js +9 -7
- package/dist/listy/interface.d.ts +29 -5
- package/dist/listy/style/index.js +5 -2
- package/dist/locale/ar_EG.js +9 -0
- package/dist/locale/az_AZ.js +9 -0
- package/dist/locale/bg_BG.js +9 -0
- package/dist/locale/bn_BD.js +9 -0
- package/dist/locale/by_BY.js +9 -0
- package/dist/locale/ca_ES.js +9 -0
- package/dist/locale/cs_CZ.js +9 -0
- package/dist/locale/da_DK.js +9 -0
- package/dist/locale/de_DE.js +9 -0
- package/dist/locale/el_GR.js +9 -0
- package/dist/locale/en_GB.js +11 -1
- package/dist/locale/en_US.js +11 -1
- package/dist/locale/es_ES.js +9 -0
- package/dist/locale/et_EE.js +9 -0
- package/dist/locale/eu_ES.js +9 -0
- package/dist/locale/fa_IR.js +9 -0
- package/dist/locale/fi_FI.js +10 -1
- package/dist/locale/fr_BE.js +9 -0
- package/dist/locale/fr_CA.js +9 -0
- package/dist/locale/fr_FR.js +9 -0
- package/dist/locale/ga_IE.js +9 -0
- package/dist/locale/gl_ES.js +9 -0
- package/dist/locale/he_IL.js +9 -0
- package/dist/locale/hi_IN.js +9 -0
- package/dist/locale/hr_HR.js +9 -0
- package/dist/locale/hu_HU.js +9 -0
- package/dist/locale/hy_AM.js +9 -0
- package/dist/locale/id_ID.js +9 -0
- package/dist/locale/index.d.ts +3 -0
- package/dist/locale/is_IS.js +9 -0
- package/dist/locale/it_IT.js +9 -0
- package/dist/locale/ja_JP.js +9 -0
- package/dist/locale/ka_GE.js +9 -0
- package/dist/locale/kk_KZ.js +9 -0
- package/dist/locale/km_KH.js +9 -0
- package/dist/locale/kmr_IQ.js +9 -0
- package/dist/locale/kn_IN.js +9 -0
- package/dist/locale/ko_KR.js +9 -0
- package/dist/locale/ku_IQ.js +9 -0
- package/dist/locale/lt_LT.js +9 -0
- package/dist/locale/lv_LV.js +9 -0
- package/dist/locale/mk_MK.js +9 -0
- package/dist/locale/ml_IN.js +9 -0
- package/dist/locale/mn_MN.js +9 -0
- package/dist/locale/mr_IN.js +9 -0
- package/dist/locale/ms_MY.js +9 -0
- package/dist/locale/my_MM.js +9 -0
- package/dist/locale/nb_NO.js +9 -0
- package/dist/locale/ne_NP.js +9 -0
- package/dist/locale/nl_BE.js +9 -0
- package/dist/locale/nl_NL.js +9 -0
- package/dist/locale/pl_PL.js +9 -0
- package/dist/locale/pt_BR.js +9 -0
- package/dist/locale/pt_PT.js +9 -0
- package/dist/locale/ro_RO.js +19 -10
- package/dist/locale/ru_RU.js +9 -0
- package/dist/locale/si_LK.js +9 -0
- package/dist/locale/sk_SK.js +9 -0
- package/dist/locale/sl_SI.js +9 -0
- package/dist/locale/sq_AL.js +9 -0
- package/dist/locale/sr_RS.js +9 -0
- package/dist/locale/sv_SE.js +9 -0
- package/dist/locale/ta_IN.js +10 -1
- package/dist/locale/th_TH.js +9 -0
- package/dist/locale/tk_TK.js +9 -0
- package/dist/locale/tr_TR.js +9 -0
- package/dist/locale/uk_UA.js +9 -0
- package/dist/locale/ur_PK.js +9 -0
- package/dist/locale/useLocale.d.ts +6 -1
- package/dist/locale/useLocale.js +12 -1
- package/dist/locale/uz_UZ.js +9 -0
- package/dist/locale/vi_VN.js +9 -0
- package/dist/locale/zh_CN.js +13 -3
- package/dist/locale/zh_HK.js +11 -1
- package/dist/locale/zh_TW.js +11 -1
- package/dist/masonry/Masonry.js +1 -1
- package/dist/mentions/index.d.ts +2 -3
- package/dist/mentions/index.js +9 -4
- package/dist/mentions/style/index.js +1 -1
- package/dist/menu/MenuContext.d.ts +2 -0
- package/dist/menu/MenuItem.js +23 -6
- package/dist/menu/index.js +5 -0
- package/dist/menu/menu.d.ts +3 -0
- package/dist/menu/menu.js +7 -0
- package/dist/message/style/index.js +2 -1
- package/dist/modal/ConfirmDialog.js +14 -7
- package/dist/modal/PurePanel.js +2 -2
- package/dist/modal/style/confirm.js +1 -1
- package/dist/notification/PurePanel.js +7 -12
- package/dist/notification/interface.d.ts +8 -0
- package/dist/notification/style/index.d.ts +3 -0
- package/dist/notification/style/index.js +4 -5
- package/dist/notification/style/placement.js +10 -7
- package/dist/notification/useNotification.js +5 -15
- package/dist/package.js +1 -1
- package/dist/pagination/Pagination.js +2 -2
- package/dist/pagination/style/index.js +12 -4
- package/dist/pagination/useShowSizeChanger.d.ts +3 -0
- package/dist/pagination/useShowSizeChanger.js +1 -1
- package/dist/popconfirm/index.js +6 -5
- package/dist/popconfirm/style/index.js +1 -1
- package/dist/popover/index.js +1 -1
- package/dist/popover/style/index.js +2 -2
- package/dist/progress/Circle.js +0 -8
- package/dist/progress/Line.js +3 -10
- package/dist/progress/Steps.js +0 -8
- package/dist/progress/progress.js +3 -15
- package/dist/qrcode/QrcodeStatus.js +2 -1
- package/dist/qrcode/index.js +4 -4
- package/dist/radio/group.js +40 -7
- package/dist/radio/index.d.ts +2 -2
- package/dist/radio/interface.d.ts +19 -1
- package/dist/radio/radio.js +5 -3
- package/dist/result/index.js +3 -3
- package/dist/result/noFound.js +120 -140
- package/dist/result/serverError.js +132 -147
- package/dist/result/unauthorized.js +115 -129
- package/dist/segmented/index.js +1 -1
- package/dist/select/index.js +10 -3
- package/dist/select/style/dropdown.js +1 -1
- package/dist/select/style/index.js +2 -2
- package/dist/select/style/select-input-multiple.js +1 -1
- package/dist/select/useIcons.d.ts +6 -2
- package/dist/select/usePopupRender.js +4 -1
- package/dist/slider/index.d.ts +6 -4
- package/dist/slider/index.js +7 -5
- package/dist/space/Compact.d.ts +1 -1
- package/dist/space/Item.d.ts +1 -0
- package/dist/space/Item.js +6 -2
- package/dist/space/index.js +1 -0
- package/dist/spin/Indicator/index.js +5 -1
- package/dist/splitter/SplitBar.js +9 -3
- package/dist/splitter/Splitter.js +8 -2
- package/dist/splitter/interface.d.ts +6 -1
- package/dist/statistic/Statistic.d.ts +3 -0
- package/dist/statistic/Statistic.js +2 -1
- package/dist/steps/index.js +9 -7
- package/dist/steps/style/index.js +1 -1
- package/dist/steps/style/inline.js +1 -1
- package/dist/style/motion/collapse.js +4 -10
- package/dist/switch/index.js +8 -2
- package/dist/table/ExpandIcon.d.ts +9 -4
- package/dist/table/ExpandIcon.js +42 -20
- package/dist/table/InternalTable.js +41 -20
- package/dist/table/hooks/useLazyKVMap.js +1 -1
- package/dist/table/hooks/useSelection.js +54 -9
- package/dist/table/index.d.ts +2 -2
- package/dist/table/interface.d.ts +8 -0
- package/dist/table/style/index.js +1 -1
- package/dist/table/style/sorter.js +2 -2
- package/dist/table/util.d.ts +1 -1
- package/dist/tabs/index.js +9 -2
- package/dist/tabs/style/index.js +3 -7
- package/dist/tag/hooks/useColor.d.ts +1 -1
- package/dist/time-picker/index.d.ts +10 -9
- package/dist/time-picker/index.js +54 -83
- package/dist/timeline/Timeline.js +1 -1
- package/dist/tooltip/style/index.js +1 -2
- package/dist/tour/panelRender.js +3 -2
- package/dist/transfer/Section.js +2 -1
- package/dist/transfer/Transfer.js +1 -1
- package/dist/tree/DirectoryTree.d.ts +19 -7
- package/dist/tree/Tree.d.ts +73 -58
- package/dist/tree/index.d.ts +8 -5
- package/dist/tree/index.js +4 -3
- package/dist/tree/style/index.js +1 -1
- package/dist/tree-select/index.js +14 -8
- package/dist/typography/Base/index.js +23 -2
- package/dist/typography/Link.js +5 -0
- package/dist/typography/Paragraph.js +5 -0
- package/dist/typography/Text.js +5 -0
- package/dist/typography/Title.js +5 -0
- package/dist/typography/hooks/useMergedConfig.js +1 -1
- package/dist/typography/interface.d.ts +8 -1
- package/dist/typography/style/index.js +2 -1
- package/dist/typography/style/mixins.d.ts +2 -1
- package/dist/typography/style/mixins.js +26 -3
- package/dist/upload/Upload.d.ts +1 -0
- package/dist/upload/Upload.js +10 -3
- package/dist/upload/UploadList/ListItem.js +8 -3
- package/dist/upload/interface.d.ts +1 -0
- package/dist/upload/utils.js +8 -3
- package/dist/version/token-meta.json +1 -1
- package/dist/version/token.json +1 -1
- package/dist/watermark/index.js +1 -1
- package/package.json +24 -24
- package/web-tags.json +79 -15
- package/web-types.json +196 -24
- package/dist/_util/getAllowClear.d.ts +0 -6
- 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(
|
|
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
|
|
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 |
|
|
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 =
|
|
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
|
-
/**
|
|
17
|
-
|
|
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,
|
|
35
|
+
export { AllowClear, AllowClearConfig, MergedAllowClear, UseAllowClearOptions, useAllowClear as default, useAllowClearLabel };
|
|
@@ -1,16 +1,34 @@
|
|
|
1
|
-
import {
|
|
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
|
-
/**
|
|
8
|
-
|
|
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(
|
|
12
|
-
disabled:
|
|
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";
|
package/dist/_util/tools.d.ts
CHANGED
|
@@ -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 };
|
package/dist/_util/tools.js
CHANGED
|
@@ -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 };
|
package/dist/_util/vueNode.d.ts
CHANGED
|
@@ -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):
|
|
7
|
-
|
|
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 };
|
package/dist/_util/vueNode.js
CHANGED
|
@@ -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 };
|
package/dist/affix/index.js
CHANGED
|
@@ -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
|
-
|
|
32
|
-
|
|
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
|
|
97
|
+
if (prevListener) prevTarget?.removeEventListener(eventName, prevListener);
|
|
98
98
|
listenerTarget?.addEventListener(eventName, lazyUpdatePosition);
|
|
99
99
|
});
|
|
100
|
-
prevTarget
|
|
101
|
-
prevListener
|
|
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
|
|
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
|
-
|
|
134
|
+
const target = prevTarget;
|
|
135
|
+
onCleanup(() => removeListeners(target));
|
|
133
136
|
});
|
|
134
137
|
watch([
|
|
135
138
|
() => props.target,
|
package/dist/alert/Alert.js
CHANGED
|
@@ -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
|
|
12
|
+
* @desc 容器圆角
|
|
13
|
+
* @descEN Border radius of the container
|
|
14
14
|
*/
|
|
15
|
-
|
|
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,
|
|
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
|
-
|
|
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`
|
package/dist/anchor/Anchor.js
CHANGED
|
@@ -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
|
-
|
|
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 (!
|
|
61
|
-
|
|
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
|
-
|
|
65
|
-
|
|
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 <= (
|
|
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,
|
|
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);
|