antdv-next 1.5.4 → 1.5.5
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/PurePanel.js +2 -1
- package/dist/_util/hooks/useMergeSemantic.js +3 -2
- package/dist/_util/styleUtils.d.ts +19 -1
- package/dist/_util/styleUtils.js +24 -1
- package/dist/_util/vnode/index.js +5 -5
- package/dist/_util/warning.d.ts +0 -1
- package/dist/affix/index.js +7 -18
- package/dist/alert/Alert.js +11 -12
- package/dist/anchor/Anchor.d.ts +1 -1
- package/dist/anchor/Anchor.js +16 -7
- package/dist/anchor/AnchorLink.js +3 -2
- package/dist/antd-with-locales.esm.js +17385 -16357
- package/dist/antd-with-locales.js +82 -82
- package/dist/antd.css +1 -1
- package/dist/antd.esm.js +14426 -13585
- package/dist/antd.js +94 -94
- package/dist/app/App.js +1 -1
- package/dist/app/index.js +0 -3
- package/dist/auto-complete/index.js +11 -4
- package/dist/avatar/Avatar.d.ts +4 -1
- package/dist/avatar/Avatar.js +21 -13
- package/dist/avatar/AvatarGroup.js +2 -2
- package/dist/avatar/index.d.ts +2 -2
- package/dist/badge/Ribbon.js +3 -4
- package/dist/badge/index.js +11 -9
- package/dist/breadcrumb/Breadcrumb.js +6 -3
- package/dist/breadcrumb/BreadcrumbItem.js +4 -3
- package/dist/breadcrumb/useItemRender.js +5 -8
- package/dist/button/Button.js +2 -0
- package/dist/card/Card.js +6 -7
- package/dist/carousel/index.d.ts +1 -1
- package/dist/carousel/index.js +7 -8
- package/dist/cascader/Panel.d.ts +1 -0
- package/dist/cascader/Panel.js +2 -1
- package/dist/cascader/index.d.ts +5 -4
- package/dist/cascader/index.js +8 -6
- package/dist/checkbox/Checkbox.js +14 -28
- package/dist/collapse/Collapse.d.ts +0 -3
- package/dist/collapse/Collapse.js +2 -2
- package/dist/color-picker/ColorPicker.js +2 -2
- package/dist/color-picker/components/ColorClear.d.ts +1 -0
- package/dist/color-picker/components/ColorClear.js +14 -4
- package/dist/color-picker/components/ColorPresets.js +4 -4
- package/dist/color-picker/components/ColorSlider.js +8 -2
- package/dist/color-picker/components/ColorTrigger.js +3 -2
- package/dist/color-picker/interface.d.ts +0 -2
- package/dist/color-picker/style/index.js +5 -6
- package/dist/components.d.ts +2 -2
- package/dist/config-provider/context.d.ts +2 -5
- package/dist/config-provider/index.d.ts +2 -2
- package/dist/date-picker/generatePicker/generateRangePicker.d.ts +4 -3
- package/dist/date-picker/generatePicker/generateRangePicker.js +3 -1
- package/dist/date-picker/generatePicker/generateSinglePicker.d.ts +1 -0
- package/dist/date-picker/generatePicker/generateSinglePicker.js +3 -1
- package/dist/date-picker/generatePicker/index.d.ts +1 -1
- package/dist/date-picker/generatePicker/interface.d.ts +0 -2
- package/dist/date-picker/generatePicker/useComponents.d.ts +3 -3
- package/dist/date-picker/index.d.ts +3 -2
- package/dist/date-picker/locale/bn_BD.js +1 -0
- package/dist/date-picker/locale/et_EE.js +8 -0
- package/dist/date-picker/locale/eu_ES.js +8 -0
- package/dist/date-picker/locale/ga_IE.js +1 -0
- package/dist/date-picker/locale/is_IS.js +8 -0
- package/dist/date-picker/locale/ka_GE.js +1 -0
- package/dist/date-picker/locale/kk_KZ.js +1 -0
- package/dist/date-picker/locale/km_KH.js +1 -0
- package/dist/date-picker/locale/kmr_IQ.js +8 -0
- package/dist/date-picker/locale/lv_LV.js +8 -0
- package/dist/date-picker/locale/mk_MK.js +8 -0
- package/dist/date-picker/locale/ml_IN.js +1 -0
- package/dist/date-picker/locale/mn_MN.js +8 -0
- package/dist/date-picker/locale/sl_SI.js +8 -0
- package/dist/date-picker/locale/ta_IN.js +1 -0
- package/dist/date-picker/locale/ur_PK.js +1 -0
- package/dist/date-picker/locale/uz_UZ.js +1 -0
- package/dist/descriptions/Row.js +3 -2
- package/dist/descriptions/hooks/useItems.d.ts +8 -8
- package/dist/descriptions/index.js +6 -3
- package/dist/divider/index.d.ts +0 -1
- package/dist/drawer/DrawerPanel.js +4 -1
- package/dist/drawer/index.d.ts +0 -3
- package/dist/drawer/index.js +15 -3
- package/dist/dropdown/index.js +0 -3
- package/dist/float-button/BackTop.d.ts +4 -2
- package/dist/float-button/BackTop.js +12 -4
- package/dist/float-button/FloatButton.d.ts +2 -2
- package/dist/float-button/FloatButton.js +10 -3
- package/dist/float-button/FloatButtonGroup.d.ts +2 -2
- package/dist/float-button/FloatButtonGroup.js +10 -3
- package/dist/float-button/PurePanel.js +20 -8
- package/dist/form/FormItem/index.js +4 -3
- package/dist/form/FormItemInput.js +4 -2
- package/dist/form/context.d.ts +1 -1
- package/dist/form/hooks/useVariant.d.ts +1 -1
- package/dist/grid/col.js +1 -1
- package/dist/grid/row.js +1 -1
- package/dist/image/PreviewGroup.js +7 -5
- package/dist/image/hooks/usePreviewConfig.d.ts +5 -5
- package/dist/image/hooks/usePreviewConfig.js +1 -1
- package/dist/image/index.js +3 -4
- package/dist/index.d.ts +2 -2
- package/dist/input/Input.d.ts +0 -1
- package/dist/input/Input.js +16 -4
- package/dist/input/OTP/OTPInput.js +16 -4
- package/dist/input/Password.js +12 -3
- package/dist/input/Search.js +16 -4
- package/dist/input/TextArea.d.ts +0 -1
- package/dist/input/TextArea.js +17 -2
- package/dist/input/style/index.d.ts +2 -1
- package/dist/input/style/index.js +12 -11
- package/dist/input/style/variants.js +1 -4
- package/dist/input-number/index.d.ts +0 -1
- package/dist/input-number/index.js +30 -9
- package/dist/input-number/style/index.js +13 -39
- package/dist/listy/index.js +13 -8
- package/dist/listy/interface.d.ts +2 -2
- package/dist/locale/az_AZ.js +4 -0
- package/dist/locale/bn_BD.js +4 -0
- package/dist/locale/by_BY.js +4 -0
- package/dist/locale/eu_ES.js +4 -0
- package/dist/locale/ga_IE.js +4 -0
- package/dist/locale/hy_AM.js +20 -2
- package/dist/locale/is_IS.js +4 -0
- package/dist/locale/ka_GE.js +4 -0
- package/dist/locale/kk_KZ.js +4 -0
- package/dist/locale/km_KH.js +4 -0
- package/dist/locale/kmr_IQ.js +4 -0
- package/dist/locale/kn_IN.js +4 -0
- package/dist/locale/ku_IQ.js +4 -0
- package/dist/locale/mk_MK.js +4 -0
- package/dist/locale/ml_IN.js +4 -0
- package/dist/locale/mn_MN.js +4 -0
- package/dist/locale/mr_IN.js +4 -0
- package/dist/locale/my_MM.js +4 -0
- package/dist/locale/ne_NP.js +4 -0
- package/dist/locale/si_LK.js +4 -0
- package/dist/locale/sq_AL.js +4 -0
- package/dist/locale/ta_IN.js +4 -0
- package/dist/locale/tk_TK.js +4 -0
- package/dist/locale/ur_PK.js +4 -0
- package/dist/locale/uz_UZ.js +4 -0
- package/dist/masonry/Masonry.js +9 -1
- package/dist/mentions/index.d.ts +1 -1
- package/dist/mentions/index.js +7 -3
- package/dist/menu/MenuContext.js +4 -1
- package/dist/menu/MenuItem.js +2 -2
- package/dist/menu/OverrideContext.js +4 -1
- package/dist/message/PurePanel.js +2 -1
- package/dist/message/index.js +14 -9
- package/dist/message/interface.d.ts +8 -0
- package/dist/message/useMessage.d.ts +1 -1
- package/dist/message/useMessage.js +26 -32
- package/dist/modal/ConfirmDialog.js +1 -1
- package/dist/modal/Modal.js +3 -2
- package/dist/modal/PurePanel.js +2 -2
- package/dist/modal/interface.d.ts +0 -6
- package/dist/modal/shared.js +2 -1
- package/dist/notification/PurePanel.d.ts +1 -1
- package/dist/notification/PurePanel.js +12 -10
- package/dist/notification/index.js +4 -1
- package/dist/notification/interface.d.ts +4 -0
- package/dist/notification/useNotification.js +19 -21
- package/dist/package.js +1 -1
- package/dist/pagination/Pagination.js +3 -4
- package/dist/popconfirm/index.js +4 -1
- package/dist/popover/PurePanel.js +8 -2
- package/dist/popover/index.js +4 -1
- package/dist/qrcode/QrcodeStatus.js +4 -1
- package/dist/qrcode/index.js +2 -1
- package/dist/radio/group.js +2 -2
- package/dist/radio/radio.js +2 -2
- package/dist/rate/index.d.ts +1 -1
- package/dist/rate/index.js +1 -5
- package/dist/result/index.js +4 -3
- package/dist/segmented/index.js +8 -2
- package/dist/select/index.d.ts +2 -3
- package/dist/select/index.js +2 -2
- package/dist/skeleton/Element.js +2 -2
- package/dist/slider/SliderTooltip.js +4 -1
- package/dist/slider/index.d.ts +1 -0
- package/dist/slider/index.js +5 -3
- package/dist/space/Compact.d.ts +1 -1
- package/dist/spin/index.js +2 -2
- package/dist/splitter/Panel.js +12 -3
- package/dist/splitter/SplitBar.js +12 -1
- package/dist/splitter/Splitter.js +2 -1
- package/dist/splitter/hooks/sizeUtil.js +17 -1
- package/dist/splitter/interface.d.ts +3 -1
- package/dist/splitter/style/index.js +6 -1
- package/dist/statistic/Number.js +2 -1
- package/dist/statistic/Statistic.js +2 -2
- package/dist/steps/index.js +3 -4
- package/dist/switch/index.d.ts +0 -2
- package/dist/table/Column.d.ts +5 -1
- package/dist/table/Column.js +10 -1
- package/dist/table/ColumnGroup.js +5 -0
- package/dist/table/InternalTable.d.ts +4 -1
- package/dist/table/InternalTable.js +28 -18
- package/dist/table/Table.js +16 -5
- package/dist/table/hooks/useFilter/index.d.ts +3 -1
- package/dist/table/hooks/useFilter/index.js +2 -2
- package/dist/table/hooks/useSelection.js +7 -3
- package/dist/table/interface.d.ts +10 -3
- package/dist/table/style/index.js +30 -2
- package/dist/table/util.d.ts +1 -1
- package/dist/table/utils.js +20 -2
- package/dist/tabs/index.d.ts +2 -0
- package/dist/tabs/index.js +11 -6
- package/dist/tag/CheckableTag.d.ts +0 -3
- package/dist/tag/CheckableTagGroup.js +18 -2
- package/dist/tag/hooks/useColor.d.ts +1 -1
- package/dist/tag/index.js +2 -1
- package/dist/theme/context.d.ts +0 -1
- package/dist/theme/util/alias.js +3 -0
- package/dist/theme/util/genStyleUtils.d.ts +4 -0
- package/dist/time-picker/index.d.ts +8 -3
- package/dist/time-picker/index.js +46 -8
- package/dist/timeline/TimelineItem.js +4 -1
- package/dist/timeline/useItems.js +2 -1
- package/dist/tooltip/PurePanel.js +4 -1
- package/dist/tooltip/index.d.ts +5 -2
- package/dist/tooltip/index.js +4 -1
- package/dist/tooltip/style/index.d.ts +0 -1
- package/dist/tour/index.js +2 -3
- package/dist/tour/interface.d.ts +7 -5
- package/dist/tour/panelRender.js +6 -6
- package/dist/transfer/ListBody.js +1 -1
- package/dist/transfer/Section.js +3 -2
- package/dist/transfer/Transfer.js +37 -13
- package/dist/transfer/hooks/useSelection.js +1 -1
- package/dist/transfer/interface.d.ts +1 -1
- package/dist/tree/DirectoryTree.js +2 -1
- package/dist/tree/Tree.js +6 -6
- package/dist/tree/utils/dictUtil.js +2 -2
- package/dist/tree-select/index.d.ts +2 -3
- package/dist/tree-select/index.js +16 -8
- package/dist/typography/Base/Ellipsis.js +2 -1
- package/dist/typography/Base/index.js +6 -3
- package/dist/typography/Editable.js +2 -1
- package/dist/upload/Dragger.js +2 -4
- package/dist/upload/Upload.d.ts +0 -1
- package/dist/upload/Upload.js +2 -2
- package/dist/upload/UploadList/ListItem.d.ts +1 -0
- package/dist/upload/UploadList/ListItem.js +15 -9
- package/dist/upload/UploadList/index.js +1 -0
- package/dist/upload/interface.d.ts +6 -7
- package/dist/version/token.json +1 -1
- package/package.json +22 -22
- package/web-tags.json +1780 -1774
- package/web-types.json +6125 -6244
package/dist/_util/PurePanel.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { useBaseConfig } from "../config-provider/context.js";
|
|
2
|
+
import { normalizeStyle as normalizeStyle$1 } from "./styleUtils.js";
|
|
2
3
|
import ConfigProvider from "../config-provider/index.js";
|
|
3
4
|
import { createVNode, defineComponent, mergeProps, shallowRef, useAttrs, useSlots, watch } from "vue";
|
|
4
5
|
//#region src/_util/PurePanel.tsx
|
|
@@ -60,7 +61,7 @@ function genPurePanel(Component, alignPropName, postProps, defaultPrefixCls, get
|
|
|
60
61
|
let mergedProps = {
|
|
61
62
|
...props,
|
|
62
63
|
style: {
|
|
63
|
-
...style,
|
|
64
|
+
...normalizeStyle$1(style) || {},
|
|
64
65
|
margin: 0
|
|
65
66
|
},
|
|
66
67
|
open: open.value,
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { normalizeStyle as normalizeStyle$1 } from "../styleUtils.js";
|
|
1
2
|
import { computed, unref } from "vue";
|
|
2
3
|
import { classNames } from "@v-c/util";
|
|
3
4
|
import { omit } from "es-toolkit";
|
|
@@ -29,7 +30,7 @@ function mergeStyles(...styles) {
|
|
|
29
30
|
Object.keys(cur).forEach((key) => {
|
|
30
31
|
acc[key] = {
|
|
31
32
|
...acc[key],
|
|
32
|
-
...cur[key]
|
|
33
|
+
...normalizeStyle$1(cur[key])
|
|
33
34
|
};
|
|
34
35
|
});
|
|
35
36
|
return acc;
|
|
@@ -121,7 +122,7 @@ function pureAttrs(attrs, options = defaultOptions) {
|
|
|
121
122
|
function getAttrStyleAndClass(attrs, options, props) {
|
|
122
123
|
return {
|
|
123
124
|
className: attrs.class ?? props?.class,
|
|
124
|
-
style: attrs.style ?? props?.style,
|
|
125
|
+
style: normalizeStyle$1(attrs.style ?? props?.style),
|
|
125
126
|
restAttrs: pureAttrs(attrs, options)
|
|
126
127
|
};
|
|
127
128
|
}
|
|
@@ -1,4 +1,22 @@
|
|
|
1
1
|
//#region src/_util/styleUtils.d.ts
|
|
2
2
|
declare function formatUnit(value: string | number | undefined | null): string | undefined;
|
|
3
|
+
/**
|
|
4
|
+
* Normalize a user-provided `style` (string | object | array of them) into a
|
|
5
|
+
* plain style object.
|
|
6
|
+
*
|
|
7
|
+
* Vue passes string styles through `props.style` untouched (a string is a
|
|
8
|
+
* legal vnode style, applied as `cssText`), so components that spread or
|
|
9
|
+
* merge the user style into an object must normalize it first: spreading a
|
|
10
|
+
* string produces numeric keys (`{0:'w', 1:'i', ...}`) which makes Vue's
|
|
11
|
+
* `patchStyle` throw "Failed to set an indexed property [0] on
|
|
12
|
+
* 'CSSStyleDeclaration'".
|
|
13
|
+
*
|
|
14
|
+
* Delegates to Vue's own `normalizeStyle`, which merges arrays (parsing each
|
|
15
|
+
* string entry with its parenthesis-aware cssText split, so values like
|
|
16
|
+
* `background-image: url("data:image/svg+xml;...")` stay intact). The only
|
|
17
|
+
* addition here is parsing a *top-level* string, which Vue intentionally
|
|
18
|
+
* leaves as-is because `patchStyle` can apply it directly as `cssText`.
|
|
19
|
+
*/
|
|
20
|
+
declare function normalizeStyle(style?: unknown): Record<PropertyKey, unknown> | undefined;
|
|
3
21
|
//#endregion
|
|
4
|
-
export { formatUnit };
|
|
22
|
+
export { formatUnit, normalizeStyle };
|
package/dist/_util/styleUtils.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { normalizeStyle as normalizeStyle$1 } from "vue";
|
|
1
2
|
//#region src/_util/styleUtils.ts
|
|
2
3
|
function formatUnit(value) {
|
|
3
4
|
if (value === void 0 || value === null) return;
|
|
@@ -5,5 +6,27 @@ function formatUnit(value) {
|
|
|
5
6
|
if (typeof value === "string" && !value.endsWith("px") && !Number.isNaN(Number(value))) return `${value}px`;
|
|
6
7
|
return value;
|
|
7
8
|
}
|
|
9
|
+
/**
|
|
10
|
+
* Normalize a user-provided `style` (string | object | array of them) into a
|
|
11
|
+
* plain style object.
|
|
12
|
+
*
|
|
13
|
+
* Vue passes string styles through `props.style` untouched (a string is a
|
|
14
|
+
* legal vnode style, applied as `cssText`), so components that spread or
|
|
15
|
+
* merge the user style into an object must normalize it first: spreading a
|
|
16
|
+
* string produces numeric keys (`{0:'w', 1:'i', ...}`) which makes Vue's
|
|
17
|
+
* `patchStyle` throw "Failed to set an indexed property [0] on
|
|
18
|
+
* 'CSSStyleDeclaration'".
|
|
19
|
+
*
|
|
20
|
+
* Delegates to Vue's own `normalizeStyle`, which merges arrays (parsing each
|
|
21
|
+
* string entry with its parenthesis-aware cssText split, so values like
|
|
22
|
+
* `background-image: url("data:image/svg+xml;...")` stay intact). The only
|
|
23
|
+
* addition here is parsing a *top-level* string, which Vue intentionally
|
|
24
|
+
* leaves as-is because `patchStyle` can apply it directly as `cssText`.
|
|
25
|
+
*/
|
|
26
|
+
function normalizeStyle(style) {
|
|
27
|
+
const normalized = normalizeStyle$1(style);
|
|
28
|
+
if (typeof normalized === "string") return normalizeStyle$1([normalized]);
|
|
29
|
+
return normalized || void 0;
|
|
30
|
+
}
|
|
8
31
|
//#endregion
|
|
9
|
-
export { formatUnit };
|
|
32
|
+
export { formatUnit, normalizeStyle };
|
|
@@ -8,7 +8,7 @@ function hasOwn(obj, key) {
|
|
|
8
8
|
function isFunction(value) {
|
|
9
9
|
return typeof value === "function";
|
|
10
10
|
}
|
|
11
|
-
function camelize(str) {
|
|
11
|
+
function camelize$1(str) {
|
|
12
12
|
return str.replace(/-(\w)/g, (_, c) => c ? c.toUpperCase() : "");
|
|
13
13
|
}
|
|
14
14
|
function hyphenate(str) {
|
|
@@ -46,10 +46,10 @@ function normalizePropsOptions(vnode) {
|
|
|
46
46
|
const needCastKeys = [];
|
|
47
47
|
if (Array.isArray(raw)) raw.forEach((key) => {
|
|
48
48
|
if (typeof key !== "string") return;
|
|
49
|
-
normalized[camelize(key)] = {};
|
|
49
|
+
normalized[camelize$1(key)] = {};
|
|
50
50
|
});
|
|
51
51
|
else if (typeof raw === "object") Object.keys(raw).forEach((key) => {
|
|
52
|
-
const normalizedKey = camelize(key);
|
|
52
|
+
const normalizedKey = camelize$1(key);
|
|
53
53
|
const opt = raw[key];
|
|
54
54
|
const prop = Array.isArray(opt) || isFunction(opt) ? { type: opt } : opt ? { ...opt } : {};
|
|
55
55
|
const propType = prop.type;
|
|
@@ -105,7 +105,7 @@ function resolveVNodeProps(vnode, name, markerKey) {
|
|
|
105
105
|
Object.keys(rawProps).forEach((key) => {
|
|
106
106
|
if (isReservedProp(key)) return;
|
|
107
107
|
const value = rawProps[key];
|
|
108
|
-
const camelKey = camelize(key);
|
|
108
|
+
const camelKey = camelize$1(key);
|
|
109
109
|
if (hasOwn(options, camelKey)) if (!needCastKeySet.has(camelKey)) resolvedProps[camelKey] = value;
|
|
110
110
|
else rawCastValues[camelKey] = value;
|
|
111
111
|
else attrs[key] = value;
|
|
@@ -134,7 +134,7 @@ function resolveVNodeProps(vnode, name, markerKey) {
|
|
|
134
134
|
result.children = value;
|
|
135
135
|
return;
|
|
136
136
|
}
|
|
137
|
-
result[camelize(slotName)] = value;
|
|
137
|
+
result[camelize$1(slotName)] = value;
|
|
138
138
|
});
|
|
139
139
|
return result;
|
|
140
140
|
}
|
package/dist/_util/warning.d.ts
CHANGED
|
@@ -19,7 +19,6 @@ interface WarningContextProps {
|
|
|
19
19
|
/**
|
|
20
20
|
* @descCN 设置警告等级,设置 `false` 时会将废弃相关信息聚合为单条信息。
|
|
21
21
|
* @descEN Set the warning level. When set to `false`, discard related information will be aggregated into a single message.
|
|
22
|
-
* @since 5.10.0
|
|
23
22
|
*/
|
|
24
23
|
strict?: boolean;
|
|
25
24
|
}
|
package/dist/affix/index.js
CHANGED
|
@@ -40,7 +40,7 @@ const Affix = /* @__PURE__ */ defineComponent((props, { slots, attrs, expose, em
|
|
|
40
40
|
return offsetBottom === void 0 && offsetTop === void 0 ? 0 : offsetTop;
|
|
41
41
|
});
|
|
42
42
|
const measure = () => {
|
|
43
|
-
if (status.value !== AFFIX_STATUS_PREPARE || !fixedNodeRef.value || !placeholderNodeRef.value
|
|
43
|
+
if (status.value !== AFFIX_STATUS_PREPARE || !fixedNodeRef.value || !placeholderNodeRef.value) return;
|
|
44
44
|
const targetNode = targetFunc.value();
|
|
45
45
|
if (targetNode) {
|
|
46
46
|
const newState = { status: AFFIX_STATUS_NONE };
|
|
@@ -50,21 +50,10 @@ const Affix = /* @__PURE__ */ defineComponent((props, { slots, attrs, expose, em
|
|
|
50
50
|
const targetRect = getTargetRect(targetNode);
|
|
51
51
|
const fixedTop = getFixedTop(placeholderRect, targetRect, internalOffsetTop.value);
|
|
52
52
|
const fixedBottom = getFixedBottom(placeholderRect, targetRect, props.offsetBottom);
|
|
53
|
-
if (fixedTop !== void 0) {
|
|
53
|
+
if (fixedTop !== void 0 || fixedBottom !== void 0) {
|
|
54
54
|
newState.affixStyle = {
|
|
55
55
|
position: "fixed",
|
|
56
|
-
top: `${fixedTop}px
|
|
57
|
-
width: `${placeholderRect.width}px`,
|
|
58
|
-
height: `${contentHeight}px`
|
|
59
|
-
};
|
|
60
|
-
newState.placeholderStyle = {
|
|
61
|
-
width: `${placeholderRect.width}px`,
|
|
62
|
-
height: `${contentHeight}px`
|
|
63
|
-
};
|
|
64
|
-
} else if (fixedBottom !== void 0) {
|
|
65
|
-
newState.affixStyle = {
|
|
66
|
-
position: "fixed",
|
|
67
|
-
bottom: `${fixedBottom}px`,
|
|
56
|
+
...fixedTop !== void 0 ? { top: `${fixedTop}px` } : { bottom: `${fixedBottom}px` },
|
|
68
57
|
width: `${placeholderRect.width}px`,
|
|
69
58
|
height: `${contentHeight}px`
|
|
70
59
|
};
|
|
@@ -89,20 +78,20 @@ const Affix = /* @__PURE__ */ defineComponent((props, { slots, attrs, expose, em
|
|
|
89
78
|
prepareMeasure();
|
|
90
79
|
});
|
|
91
80
|
const lazyUpdatePosition = throttleByAnimationFrame(() => {
|
|
92
|
-
if (
|
|
81
|
+
if (affixStyle.value) {
|
|
93
82
|
const targetNode = targetFunc.value();
|
|
94
83
|
if (targetNode && placeholderNodeRef.value) {
|
|
95
84
|
const targetRect = getTargetRect(targetNode);
|
|
96
85
|
const placeholderRect = getTargetRect(placeholderNodeRef.value);
|
|
97
86
|
const fixedTop = getFixedTop(placeholderRect, targetRect, internalOffsetTop.value);
|
|
98
87
|
const fixedBottom = getFixedBottom(placeholderRect, targetRect, props.offsetBottom);
|
|
99
|
-
if (fixedTop !== void 0 && affixStyle.value.top === fixedTop || fixedBottom !== void 0 && affixStyle.value.bottom === fixedBottom) return;
|
|
88
|
+
if (fixedTop !== void 0 && affixStyle.value.top === `${fixedTop}px` || fixedBottom !== void 0 && affixStyle.value.bottom === `${fixedBottom}px`) return;
|
|
100
89
|
}
|
|
101
90
|
}
|
|
102
91
|
prepareMeasure();
|
|
103
92
|
});
|
|
104
93
|
const addListeners = () => {
|
|
105
|
-
const listenerTarget = targetFunc.value
|
|
94
|
+
const listenerTarget = targetFunc.value();
|
|
106
95
|
if (!listenerTarget) return;
|
|
107
96
|
TRIGGER_EVENTS.forEach((eventName) => {
|
|
108
97
|
if (prevListener.value) prevTarget.value?.removeEventListener(eventName, prevListener.value);
|
|
@@ -112,7 +101,7 @@ const Affix = /* @__PURE__ */ defineComponent((props, { slots, attrs, expose, em
|
|
|
112
101
|
prevListener.value = lazyUpdatePosition;
|
|
113
102
|
};
|
|
114
103
|
const removeListeners = () => {
|
|
115
|
-
const newTarget = targetFunc.value
|
|
104
|
+
const newTarget = targetFunc.value();
|
|
116
105
|
TRIGGER_EVENTS.forEach((eventName) => {
|
|
117
106
|
newTarget?.removeEventListener(eventName, lazyUpdatePosition);
|
|
118
107
|
if (prevListener.value) prevTarget.value?.removeEventListener(eventName, prevListener.value);
|
package/dist/alert/Alert.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { useComponentBaseConfig } from "../config-provider/context.js";
|
|
2
|
-
import { pureAttrs, useMergeSemanticNoRef } from "../_util/hooks/useMergeSemantic.js";
|
|
2
|
+
import { getAttrStyleAndClass, pureAttrs, useMergeSemanticNoRef } from "../_util/hooks/useMergeSemantic.js";
|
|
3
3
|
import { getSlotPropFn, getSlotPropsFnRun, toPropsRefs as toPropsRefs$1 } from "../_util/tools.js";
|
|
4
4
|
import { isRenderable } from "../_util/is.js";
|
|
5
5
|
import style_default from "./style/index.js";
|
|
6
6
|
import { Transition, computed, createVNode, defineComponent, mergeDefaults, mergeProps, shallowRef } from "vue";
|
|
7
7
|
import { classNames, clsx } from "@v-c/util";
|
|
8
|
-
import { filterEmpty
|
|
8
|
+
import { filterEmpty } from "@v-c/util/dist/props-util";
|
|
9
9
|
import { CheckCircleFilled, CloseCircleFilled, CloseOutlined, ExclamationCircleFilled, InfoCircleFilled } from "@antdv-next/icons";
|
|
10
10
|
//#region src/alert/Alert.tsx
|
|
11
11
|
const alertDefaultProps = { showIcon: void 0 };
|
|
@@ -199,6 +199,7 @@ const Alert = /* @__PURE__ */ defineComponent((props, { slots, emit, attrs }) =>
|
|
|
199
199
|
const mergedTitle = getSlotPropsFnRun(slots, props, "title") ?? message;
|
|
200
200
|
const description = getSlotPropsFnRun(slots, props, "description");
|
|
201
201
|
const action = getSlotPropsFnRun(slots, props, "action");
|
|
202
|
+
const icon = getSlotPropsFnRun(slots, props, "icon");
|
|
202
203
|
const isShowIcon = banner && showIcon === void 0 ? true : showIcon;
|
|
203
204
|
const mergedProps = {
|
|
204
205
|
...props,
|
|
@@ -240,9 +241,9 @@ const Alert = /* @__PURE__ */ defineComponent((props, { slots, emit, attrs }) =>
|
|
|
240
241
|
return createVNode(Transition, {
|
|
241
242
|
"name": `${prefixCls.value}-motion`,
|
|
242
243
|
"appear": false,
|
|
243
|
-
"leaveFromClass":
|
|
244
|
-
"leaveActiveClass":
|
|
245
|
-
"leaveToClass":
|
|
244
|
+
"leaveFromClass": `${prefixCls.value}-motion-leave`,
|
|
245
|
+
"leaveActiveClass": `${prefixCls.value}-motion-leave ${prefixCls.value}-motion-leave-active`,
|
|
246
|
+
"leaveToClass": `${prefixCls.value}-motion-leave ${prefixCls.value}-motion-leave-active`,
|
|
246
247
|
"onBeforeLeave": handleBeforeLeave,
|
|
247
248
|
"onAfterLeave": () => props?.afterClose?.()
|
|
248
249
|
}, { default: () => [!closed.value ? createVNode("div", mergeProps({
|
|
@@ -257,7 +258,7 @@ const Alert = /* @__PURE__ */ defineComponent((props, { slots, emit, attrs }) =>
|
|
|
257
258
|
"class": mergedClassNames.icon,
|
|
258
259
|
"style": mergedStyles.icon,
|
|
259
260
|
"description": description,
|
|
260
|
-
"icon":
|
|
261
|
+
"icon": icon,
|
|
261
262
|
"prefixCls": prefixCls.value,
|
|
262
263
|
"type": type.value,
|
|
263
264
|
"successIcon": successIcon.value,
|
|
@@ -355,14 +356,12 @@ const Alert = /* @__PURE__ */ defineComponent((props, { slots, emit, attrs }) =>
|
|
|
355
356
|
required: false
|
|
356
357
|
},
|
|
357
358
|
classes: {
|
|
358
|
-
type: Function,
|
|
359
|
-
required: false
|
|
360
|
-
skipCheck: true
|
|
359
|
+
type: [Object, Function],
|
|
360
|
+
required: false
|
|
361
361
|
},
|
|
362
362
|
styles: {
|
|
363
|
-
type: Function,
|
|
364
|
-
required: false
|
|
365
|
-
skipCheck: true
|
|
363
|
+
type: [Object, Function],
|
|
364
|
+
required: false
|
|
366
365
|
},
|
|
367
366
|
banner: {
|
|
368
367
|
type: Boolean,
|
package/dist/anchor/Anchor.d.ts
CHANGED
|
@@ -58,7 +58,7 @@ type AnchorSlots = SlotsDefineType<{
|
|
|
58
58
|
item: (item: AnchorLinkItemProps) => any;
|
|
59
59
|
}>;
|
|
60
60
|
interface AntAnchor {
|
|
61
|
-
registerLink: (link: string) => void;
|
|
61
|
+
registerLink: (link: string, targetOffset?: number) => void;
|
|
62
62
|
unregisterLink: (link: string) => void;
|
|
63
63
|
activeLink: string | null;
|
|
64
64
|
scrollTo: (link: string, linkTargetOffset?: number) => void;
|
package/dist/anchor/Anchor.js
CHANGED
|
@@ -36,6 +36,7 @@ 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
40
|
const activeLink = shallowRef();
|
|
40
41
|
const _activeLink = shallowRef(activeLink.value);
|
|
41
42
|
const activeLinkRef = computed({
|
|
@@ -47,18 +48,21 @@ const Anchor = /* @__PURE__ */ defineComponent((props, { slots, emit, attrs }) =
|
|
|
47
48
|
const rawActiveLink = shallowRef(activeLink.value);
|
|
48
49
|
const wrapperRef = shallowRef();
|
|
49
50
|
const spanLinkNode = shallowRef();
|
|
50
|
-
const
|
|
51
|
+
const animatingRef = shallowRef(false);
|
|
52
|
+
const scrollRequestIdRef = shallowRef(null);
|
|
51
53
|
const { prefixCls, direction, class: contextClassName, style: contextStyle, classes: contextClassNames, styles: contextStyles, getTargetContainer } = useComponentBaseConfig("anchor", props);
|
|
52
54
|
const { direction: anchorDirection, classes, styles } = toPropsRefs$1(props, "direction", "classes", "styles");
|
|
53
55
|
const rootCls = useCSSVarCls(prefixCls);
|
|
54
56
|
const [hashId, cssVarCls] = style_default(prefixCls, rootCls);
|
|
55
57
|
const getCurrentContainer = () => props?.getContainer?.() ?? getTargetContainer?.() ?? getDefaultContainer?.();
|
|
56
58
|
const dependencyListItem = computed(() => JSON.stringify(links.value));
|
|
57
|
-
const registerLink = (link) => {
|
|
59
|
+
const registerLink = (link, targetOffset) => {
|
|
58
60
|
if (!links.value.includes(link)) links.value.push(link);
|
|
61
|
+
if (targetOffset !== void 0) linkTargetOffsetRef.value[link] = targetOffset;
|
|
59
62
|
};
|
|
60
63
|
const unregisterLink = (link) => {
|
|
61
64
|
links.value = links.value.filter((item) => item !== link);
|
|
65
|
+
delete linkTargetOffsetRef.value[link];
|
|
62
66
|
};
|
|
63
67
|
const updateInk = () => {
|
|
64
68
|
const linkNode = wrapperRef.value?.querySelector(`.${prefixCls.value}-link-title-active`);
|
|
@@ -84,7 +88,7 @@ const Anchor = /* @__PURE__ */ defineComponent((props, { slots, emit, attrs }) =
|
|
|
84
88
|
const target = document.getElementById(sharpLinkMatch[1]);
|
|
85
89
|
if (target) {
|
|
86
90
|
const top = getOffsetTop(target, container);
|
|
87
|
-
if (top <= _offsetTop + _bounds) linkSections.push({
|
|
91
|
+
if (top <= (linkTargetOffsetRef.value[link] ?? _offsetTop) + _bounds) linkSections.push({
|
|
88
92
|
link,
|
|
89
93
|
top
|
|
90
94
|
});
|
|
@@ -106,7 +110,7 @@ const Anchor = /* @__PURE__ */ defineComponent((props, { slots, emit, attrs }) =
|
|
|
106
110
|
emit("change", link);
|
|
107
111
|
};
|
|
108
112
|
const handleScroll = () => {
|
|
109
|
-
if (
|
|
113
|
+
if (animatingRef.value) return;
|
|
110
114
|
const currentActiveLink = getInternalCurrentAnchor(links.value, props.targetOffset !== void 0 ? props.targetOffset : props.offsetTop || 0, props.bounds);
|
|
111
115
|
setCurrentActiveLink(currentActiveLink);
|
|
112
116
|
};
|
|
@@ -118,14 +122,19 @@ const Anchor = /* @__PURE__ */ defineComponent((props, { slots, emit, attrs }) =
|
|
|
118
122
|
if (!sharpLinkMatch) return;
|
|
119
123
|
const targetElement = document.getElementById(sharpLinkMatch[1]);
|
|
120
124
|
if (!targetElement) return;
|
|
125
|
+
if (animatingRef.value) {
|
|
126
|
+
if (previousRawActiveLink === link) return;
|
|
127
|
+
scrollRequestIdRef.value?.();
|
|
128
|
+
}
|
|
121
129
|
const container = getCurrentContainer();
|
|
122
130
|
let y = getScroll(container) + getOffsetTop(targetElement, container);
|
|
123
131
|
y -= linkTargetOffset ?? (targetOffset !== void 0 ? targetOffset : offsetTop || 0);
|
|
124
|
-
|
|
125
|
-
scrollTo(y, {
|
|
132
|
+
animatingRef.value = true;
|
|
133
|
+
scrollRequestIdRef.value = scrollTo(y, {
|
|
126
134
|
getContainer: getCurrentContainer,
|
|
127
135
|
callback() {
|
|
128
|
-
|
|
136
|
+
animatingRef.value = false;
|
|
137
|
+
scrollRequestIdRef.value = null;
|
|
129
138
|
}
|
|
130
139
|
});
|
|
131
140
|
};
|
|
@@ -7,9 +7,9 @@ import { classNames } from "@v-c/util";
|
|
|
7
7
|
const AnchorLink = /* @__PURE__ */ defineComponent((props, { slots, attrs }) => {
|
|
8
8
|
const { registerLink, direction, unregisterLink, activeLink, scrollTo, onClick, classes: mergedClassNames, styles: mergedStyles } = useAnchorContext() ?? {};
|
|
9
9
|
const { prefixCls } = useBaseConfig("anchor", props);
|
|
10
|
-
watch(() => props.href, async (href, _, onCleanup) => {
|
|
10
|
+
watch([() => props.href, () => props.targetOffset], async ([href, targetOffset], _, onCleanup) => {
|
|
11
11
|
await nextTick();
|
|
12
|
-
registerLink?.(href);
|
|
12
|
+
registerLink?.(href, targetOffset);
|
|
13
13
|
onCleanup(() => {
|
|
14
14
|
unregisterLink?.(href);
|
|
15
15
|
});
|
|
@@ -28,6 +28,7 @@ const AnchorLink = /* @__PURE__ */ defineComponent((props, { slots, attrs }) =>
|
|
|
28
28
|
e.preventDefault();
|
|
29
29
|
window.location.replace(href);
|
|
30
30
|
}
|
|
31
|
+
return;
|
|
31
32
|
}
|
|
32
33
|
e.preventDefault();
|
|
33
34
|
const historyMethod = replace ? "replaceState" : "pushState";
|