antdv-next 1.8.2 → 1.8.4
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/hooks/index.d.ts +2 -1
- package/dist/_util/hooks/index.js +2 -1
- package/dist/_util/hooks/useClosable.d.ts +3 -3
- package/dist/_util/hooks/useClosable.js +9 -9
- package/dist/_util/hooks/useScopeId.d.ts +7 -0
- package/dist/_util/hooks/useScopeId.js +15 -0
- package/dist/_util/scrollTo.js +1 -1
- package/dist/_util/statusUtils.js +1 -1
- package/dist/_util/vueNode.d.ts +2 -6
- package/dist/affix/index.js +2 -7
- package/dist/anchor/Anchor.js +4 -2
- package/dist/antd-with-locales.esm.js +17314 -16799
- package/dist/antd-with-locales.js +81 -81
- package/dist/antd.css +1 -1
- package/dist/antd.esm.js +14978 -14467
- package/dist/antd.js +81 -81
- package/dist/badge/SingleNumber.js +11 -2
- package/dist/badge/index.d.ts +4 -1
- package/dist/badge/index.js +4 -4
- package/dist/button/buttonHelper.d.ts +1 -1
- package/dist/button/style/index.js +8 -2
- package/dist/calendar/generateCalendar.d.ts +5 -4
- package/dist/calendar/generateCalendar.js +4 -7
- package/dist/card/Card.d.ts +4 -1
- package/dist/card/Card.js +24 -18
- package/dist/card/index.d.ts +2 -2
- package/dist/cascader/index.d.ts +5 -2
- package/dist/cascader/index.js +10 -7
- package/dist/checkbox/Checkbox.js +3 -0
- package/dist/checkbox/Group.d.ts +2 -1
- package/dist/checkbox/Group.js +3 -7
- package/dist/color-picker/ColorPicker.js +4 -0
- package/dist/color-picker/ColorPickerPanel.js +4 -0
- package/dist/color-picker/components/ColorSlider.js +12 -4
- package/dist/color-picker/components/PanelPicker/GradientColorBar.js +2 -0
- package/dist/components.d.ts +13 -9
- package/dist/components.js +3 -3
- package/dist/config-provider/context.d.ts +3 -3
- package/dist/config-provider/context.js +3 -3
- package/dist/date-picker/generatePicker/generateRangePicker.js +4 -5
- package/dist/date-picker/generatePicker/generateSinglePicker.js +4 -6
- package/dist/descriptions/hooks/useItems.d.ts +6 -6
- package/dist/descriptions/hooks/useRow.js +1 -1
- package/dist/float-button/FloatButtonGroup.js +3 -1
- package/dist/float-button/style/button.js +2 -2
- package/dist/form/Form.d.ts +17 -44
- package/dist/form/Form.js +54 -5
- package/dist/form/FormItem/ItemHolder.js +1 -1
- package/dist/form/FormItem/index.d.ts +3 -3
- package/dist/form/FormItem/index.js +4 -0
- package/dist/form/context.d.ts +3 -3
- package/dist/form/hooks/useForm.d.ts +4 -5
- package/dist/form/index.d.ts +29 -3
- package/dist/form/index.js +6 -6
- package/dist/form/types.d.ts +15 -7
- package/dist/image/hooks/usePreviewConfig.d.ts +6 -6
- package/dist/image/index.d.ts +5 -5
- package/dist/index.d.ts +15 -8
- package/dist/index.js +2 -2
- package/dist/input/Group.d.ts +3 -2
- package/dist/input/Group.js +23 -19
- package/dist/input/Input.d.ts +8 -1
- package/dist/input/Input.js +4 -0
- package/dist/input/OTP/OTPInput.js +4 -0
- package/dist/input/Password.js +4 -0
- package/dist/input/Search.js +4 -0
- package/dist/input/TextArea.d.ts +2 -0
- package/dist/input/TextArea.js +8 -0
- package/dist/input/index.d.ts +2 -2
- package/dist/input-number/style/index.js +3 -2
- package/dist/layout/layout.js +2 -3
- package/dist/listy/index.js +4 -3
- package/dist/locale/ko_KR.js +25 -23
- package/dist/locale/pt_BR.js +9 -7
- package/dist/mentions/index.js +10 -1
- package/dist/menu/MenuItem.js +1 -1
- package/dist/menu/index.d.ts +2 -1
- package/dist/menu/index.js +29 -5
- package/dist/menu/menu.js +41 -15
- package/dist/message/index.js +11 -9
- package/dist/modal/confirm.js +2 -3
- package/dist/modal/index.d.ts +2 -2
- package/dist/modal/interface.d.ts +1 -1
- package/dist/modal/useModal/index.js +9 -4
- package/dist/notification/index.js +3 -7
- package/dist/package.js +1 -1
- package/dist/package.json.d.ts +1 -0
- package/dist/pagination/Pagination.js +3 -1
- package/dist/radio/group.d.ts +1 -0
- package/dist/radio/group.js +2 -5
- package/dist/radio/interface.d.ts +1 -1
- package/dist/segmented/style/index.js +3 -2
- package/dist/select/index.d.ts +1 -0
- package/dist/select/index.js +3 -7
- package/dist/select/useIcons.d.ts +3 -1
- package/dist/select/useIcons.js +5 -2
- package/dist/skeleton/style/index.js +9 -13
- package/dist/slider/SliderTooltip.js +0 -1
- package/dist/slider/index.d.ts +2 -0
- package/dist/slider/index.js +4 -0
- package/dist/splitter/Splitter.d.ts +2 -3
- package/dist/splitter/Splitter.js +18 -34
- package/dist/splitter/interface.d.ts +17 -8
- package/dist/statistic/Timer.d.ts +2 -2
- package/dist/steps/index.js +2 -1
- package/dist/table/hooks/useFilter/FilterDropdown.js +1 -1
- package/dist/table/hooks/usePagination.d.ts +1 -2
- package/dist/table/hooks/usePagination.js +1 -3
- package/dist/table/hooks/useSorter.js +4 -8
- package/dist/table/style/index.js +1 -0
- package/dist/table/style/size.js +1 -0
- package/dist/tabs/style/index.js +5 -1
- package/dist/tag/hooks/useColor.d.ts +1 -1
- package/dist/theme/themes/dark/colors.d.ts +2 -1
- package/dist/theme/themes/dark/colors.js +19 -3
- package/dist/theme/themes/dark/index.js +2 -3
- package/dist/tour/index.js +4 -1
- package/dist/tour/style/index.js +6 -6
- package/dist/transfer/ListItem.js +1 -0
- package/dist/transfer/Section.js +1 -0
- package/dist/transfer/hooks/useSelection.js +2 -1
- package/dist/tree/DirectoryTree.js +11 -6
- package/dist/tree/utils/dictUtil.js +5 -8
- package/dist/typography/Base/EllipsisTooltip.js +5 -1
- package/dist/typography/Base/index.js +11 -8
- package/dist/typography/Base/util.js +2 -1
- package/dist/upload/Dragger.js +0 -8
- package/dist/upload/Upload.d.ts +2 -0
- package/dist/upload/Upload.js +23 -22
- package/dist/upload/UploadList/ListItem.js +4 -0
- package/dist/upload/UploadList/index.js +6 -1
- package/dist/upload/interface.d.ts +4 -2
- package/dist/version/token.json +1 -1
- package/dist/watermark/utils.js +1 -1
- package/package.json +44 -43
- package/web-tags.json +22 -14
- package/web-types.json +64 -31
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import InternalTooltip from "../../tooltip/index.js";
|
|
2
2
|
import { createVNode, defineComponent, mergeProps } from "vue";
|
|
3
|
+
import { filterEmpty } from "@v-c/util/dist/props-util";
|
|
3
4
|
//#region src/typography/Base/EllipsisTooltip.tsx
|
|
4
5
|
const EllipsisTooltip = /* @__PURE__ */ defineComponent({
|
|
5
6
|
props: {
|
|
@@ -25,7 +26,10 @@ const EllipsisTooltip = /* @__PURE__ */ defineComponent({
|
|
|
25
26
|
inheritAttrs: false,
|
|
26
27
|
setup(props, { slots }) {
|
|
27
28
|
return () => {
|
|
28
|
-
if (!props.tooltipProps?.title || !props.enableEllipsis)
|
|
29
|
+
if (!props.tooltipProps?.title || !props.enableEllipsis) {
|
|
30
|
+
const children = filterEmpty(slots.default?.() ?? []);
|
|
31
|
+
return children.length === 1 ? children[0] : children;
|
|
32
|
+
}
|
|
29
33
|
return createVNode(InternalTooltip, mergeProps(props.tooltipProps, { "disabled": !props.isEllipsis || props.disabled }), { default: () => [slots.default?.()] });
|
|
30
34
|
};
|
|
31
35
|
}
|
|
@@ -20,7 +20,7 @@ import { classNames } from "@v-c/util";
|
|
|
20
20
|
import { filterEmpty } from "@v-c/util/dist/props-util";
|
|
21
21
|
import { EditOutlined } from "@antdv-next/icons";
|
|
22
22
|
import useDelayState from "@v-c/util/dist/hooks/useDelayState";
|
|
23
|
-
import
|
|
23
|
+
import { useResizeObserver } from "@v-c/resize-observer";
|
|
24
24
|
//#region src/typography/Base/index.tsx
|
|
25
25
|
const ELLIPSIS_STR = "...";
|
|
26
26
|
const DEFAULT_SHIMMER_DURATION = 1;
|
|
@@ -51,12 +51,16 @@ function wrapperDecorations(props, content) {
|
|
|
51
51
|
}
|
|
52
52
|
const Base = /* @__PURE__ */ defineComponent((props, { slots, attrs, emit }) => {
|
|
53
53
|
const typographyRef = shallowRef();
|
|
54
|
+
const setTypographyRef = (instance) => {
|
|
55
|
+
typographyRef.value = instance;
|
|
56
|
+
};
|
|
54
57
|
const typographyDom = computed(() => {
|
|
55
58
|
const val = typographyRef.value;
|
|
56
59
|
if (val && typeof val === "object" && "el" in val) return val.el;
|
|
57
60
|
return val;
|
|
58
61
|
});
|
|
59
62
|
const editIconRef = shallowRef();
|
|
63
|
+
let editClickEvent = null;
|
|
60
64
|
const { prefixCls, rootPrefixCls, direction: contextDirection, class: contextClassName, style: contextStyle, classes: contextClassNames, styles: contextStyles } = useComponentBaseConfig("typography", props);
|
|
61
65
|
const mergedDirection = computed(() => props.direction ?? contextDirection.value);
|
|
62
66
|
const { classes, styles } = toPropsRefs$1(props, "classes", "styles");
|
|
@@ -87,6 +91,7 @@ const Base = /* @__PURE__ */ defineComponent((props, { slots, attrs, emit }) =>
|
|
|
87
91
|
}, { flush: "post" });
|
|
88
92
|
const onEditClick = (e) => {
|
|
89
93
|
e?.preventDefault();
|
|
94
|
+
if (e) editClickEvent = e;
|
|
90
95
|
triggerEdit(true);
|
|
91
96
|
};
|
|
92
97
|
const onEditChange = (value) => {
|
|
@@ -166,6 +171,7 @@ const Base = /* @__PURE__ */ defineComponent((props, { slots, attrs, emit }) =>
|
|
|
166
171
|
const onResize = ({ offsetWidth }) => {
|
|
167
172
|
ellipsisWidth.value = offsetWidth;
|
|
168
173
|
};
|
|
174
|
+
useResizeObserver(mergedEnableEllipsis, typographyDom, onResize);
|
|
169
175
|
const onJsEllipsis = (jsEllipsis) => {
|
|
170
176
|
const changed = isJsEllipsis.value !== jsEllipsis;
|
|
171
177
|
isJsEllipsis.value = jsEllipsis;
|
|
@@ -296,7 +302,7 @@ const Base = /* @__PURE__ */ defineComponent((props, { slots, attrs, emit }) =>
|
|
|
296
302
|
const children = filterEmpty(slots?.default?.());
|
|
297
303
|
childrenNodes.value = children;
|
|
298
304
|
const clickHandler = (e) => {
|
|
299
|
-
if (triggerType.value.includes("text")) onEditClick(e);
|
|
305
|
+
if (triggerType.value.includes("text") && editClickEvent !== e) onEditClick(e);
|
|
300
306
|
emit("click", e);
|
|
301
307
|
};
|
|
302
308
|
const mergedClassName = classNames(componentCls.value, attrClass);
|
|
@@ -333,10 +339,7 @@ const Base = /* @__PURE__ */ defineComponent((props, { slots, attrs, emit }) =>
|
|
|
333
339
|
"classes": mergedClassNames.value,
|
|
334
340
|
"styles": mergedStyles.value
|
|
335
341
|
}, null);
|
|
336
|
-
return createVNode(
|
|
337
|
-
"onResize": onResize,
|
|
338
|
-
"disabled": !mergedEnableEllipsis.value
|
|
339
|
-
}, { default: () => [createVNode(EllipsisTooltip, {
|
|
342
|
+
return createVNode(EllipsisTooltip, {
|
|
340
343
|
"tooltipProps": tooltipProps.value,
|
|
341
344
|
"enableEllipsis": mergedEnableEllipsis.value,
|
|
342
345
|
"isEllipsis": isMergedEllipsis.value,
|
|
@@ -346,7 +349,7 @@ const Base = /* @__PURE__ */ defineComponent((props, { slots, attrs, emit }) =>
|
|
|
346
349
|
"prefixCls": prefixCls.value,
|
|
347
350
|
"style": mergedStyle,
|
|
348
351
|
"component": props.component,
|
|
349
|
-
"ref":
|
|
352
|
+
"ref": setTypographyRef,
|
|
350
353
|
"direction": mergedDirection.value,
|
|
351
354
|
"onClick": clickHandler,
|
|
352
355
|
"title": props.title,
|
|
@@ -380,7 +383,7 @@ const Base = /* @__PURE__ */ defineComponent((props, { slots, attrs, emit }) =>
|
|
|
380
383
|
createVNode(Fragment, null, [renderEllipsis(canEllipsis)]),
|
|
381
384
|
placement.value === "start" ? null : renderOperations(canEllipsis)
|
|
382
385
|
]));
|
|
383
|
-
} })] })] })
|
|
386
|
+
} })] })] });
|
|
384
387
|
};
|
|
385
388
|
}, {
|
|
386
389
|
props: {
|
|
@@ -24,7 +24,8 @@ function isEleEllipsis(ele) {
|
|
|
24
24
|
const rect = ele.getBoundingClientRect();
|
|
25
25
|
const childRect = childDiv.getBoundingClientRect();
|
|
26
26
|
ele.removeChild(childDiv);
|
|
27
|
-
|
|
27
|
+
const horizontalTolerance = .001;
|
|
28
|
+
return rect.left - childRect.left > horizontalTolerance || childRect.right - rect.right > horizontalTolerance || rect.top > childRect.top || childRect.bottom > rect.bottom;
|
|
28
29
|
}
|
|
29
30
|
const isValidText = (val) => ["string", "number"].includes(typeof val);
|
|
30
31
|
//#endregion
|
package/dist/upload/Dragger.js
CHANGED
|
@@ -163,14 +163,6 @@ const Dragger = /* @__PURE__ */ defineComponent((props, { slots, attrs, expose }
|
|
|
163
163
|
type: Function,
|
|
164
164
|
required: false
|
|
165
165
|
},
|
|
166
|
-
onPreview: {
|
|
167
|
-
type: Function,
|
|
168
|
-
required: false
|
|
169
|
-
},
|
|
170
|
-
onDownload: {
|
|
171
|
-
type: Function,
|
|
172
|
-
required: false
|
|
173
|
-
},
|
|
174
166
|
capture: {
|
|
175
167
|
type: [String, Boolean],
|
|
176
168
|
required: false,
|
package/dist/upload/Upload.d.ts
CHANGED
|
@@ -22,6 +22,8 @@ interface UploadEmitsProps {
|
|
|
22
22
|
onChange?: UploadEmits['change'];
|
|
23
23
|
onDrop?: UploadEmits['drop'];
|
|
24
24
|
onFocus?: UploadEmits['focus'];
|
|
25
|
+
onPreview?: UploadEmits['preview'];
|
|
26
|
+
onDownload?: UploadEmits['download'];
|
|
25
27
|
'onUpdate:fileList'?: UploadEmits['update:fileList'];
|
|
26
28
|
}
|
|
27
29
|
declare const InternalUpload: import("vue").DefineSetupFnComponent<InternalUploadProps, UploadEmits<any>, SlotsType<UploadSlots<any>>, InternalUploadProps, import("vue").PublicProps>;
|
package/dist/upload/Upload.js
CHANGED
|
@@ -9,7 +9,7 @@ import useLocale from "../locale/useLocale.js";
|
|
|
9
9
|
import style_default from "./style/index.js";
|
|
10
10
|
import { file2Obj, getFileItem, removeFileItem, updateFileList } from "./utils.js";
|
|
11
11
|
import UploadList from "./UploadList/index.js";
|
|
12
|
-
import { computed, createVNode, defineComponent, isVNode, mergeDefaults, mergeProps, nextTick, shallowRef, watch } from "vue";
|
|
12
|
+
import { computed, createVNode, defineComponent, getCurrentInstance, isVNode, mergeDefaults, mergeProps, nextTick, shallowRef, watch } from "vue";
|
|
13
13
|
import { clsx } from "@v-c/util";
|
|
14
14
|
import { filterEmpty } from "@v-c/util/dist/props-util";
|
|
15
15
|
import { omit as omit$1 } from "es-toolkit";
|
|
@@ -20,6 +20,7 @@ function _isSlot(s) {
|
|
|
20
20
|
}
|
|
21
21
|
const LIST_IGNORE = `__LIST_IGNORE_${Date.now()}__`;
|
|
22
22
|
const InternalUpload = /* @__PURE__ */ defineComponent((props, { slots, attrs, expose, emit }) => {
|
|
23
|
+
const instance = getCurrentInstance();
|
|
23
24
|
const { prefixCls, direction, class: contextClassName, style: contextStyle, classes: contextClassNames, styles: contextStyles, customRequest: contextCustomRequest, progress: contextProgress, accept: contextAccept } = useComponentBaseConfig("upload", props, [
|
|
24
25
|
"customRequest",
|
|
25
26
|
"progress",
|
|
@@ -58,9 +59,13 @@ const InternalUpload = /* @__PURE__ */ defineComponent((props, { slots, attrs, e
|
|
|
58
59
|
exceedMaxCount = cloneList.length > maxCount;
|
|
59
60
|
cloneList = cloneList.slice(0, maxCount);
|
|
60
61
|
}
|
|
61
|
-
|
|
62
|
+
internalFileList.value = cloneList;
|
|
62
63
|
nextTick(() => {
|
|
63
64
|
emit("update:fileList", cloneList);
|
|
65
|
+
if (props.fileList === void 0) return;
|
|
66
|
+
nextTick(() => {
|
|
67
|
+
if (internalFileList.value === cloneList) internalFileList.value = props.fileList ?? [];
|
|
68
|
+
});
|
|
64
69
|
});
|
|
65
70
|
const changeInfo = {
|
|
66
71
|
file,
|
|
@@ -93,7 +98,7 @@ const InternalUpload = /* @__PURE__ */ defineComponent((props, { slots, attrs, e
|
|
|
93
98
|
const filteredFileInfoList = batchFileInfoList.filter((info) => !info.file[LIST_IGNORE]);
|
|
94
99
|
if (!filteredFileInfoList.length) return;
|
|
95
100
|
const objectFileList = filteredFileInfoList.map((info) => file2Obj(info.file));
|
|
96
|
-
let newFileList = [...
|
|
101
|
+
let newFileList = [...internalFileList.value];
|
|
97
102
|
objectFileList.forEach((fileObj) => {
|
|
98
103
|
newFileList = updateFileList(fileObj, newFileList);
|
|
99
104
|
});
|
|
@@ -123,43 +128,43 @@ const InternalUpload = /* @__PURE__ */ defineComponent((props, { slots, attrs, e
|
|
|
123
128
|
} catch {
|
|
124
129
|
parsedResponse = response;
|
|
125
130
|
}
|
|
126
|
-
if (!getFileItem(file,
|
|
131
|
+
if (!getFileItem(file, internalFileList.value)) return;
|
|
127
132
|
const targetItem = file2Obj(file);
|
|
128
133
|
targetItem.status = "done";
|
|
129
134
|
targetItem.percent = 100;
|
|
130
135
|
targetItem.response = parsedResponse;
|
|
131
136
|
targetItem.xhr = xhr;
|
|
132
|
-
const nextFileList = updateFileList(targetItem,
|
|
137
|
+
const nextFileList = updateFileList(targetItem, internalFileList.value);
|
|
133
138
|
onInternalChange(targetItem, nextFileList);
|
|
134
139
|
};
|
|
135
140
|
const onProgress = (e, file) => {
|
|
136
|
-
if (!getFileItem(file,
|
|
141
|
+
if (!getFileItem(file, internalFileList.value)) return;
|
|
137
142
|
const targetItem = file2Obj(file);
|
|
138
143
|
targetItem.status = "uploading";
|
|
139
144
|
targetItem.percent = e.percent;
|
|
140
|
-
const nextFileList = updateFileList(targetItem,
|
|
145
|
+
const nextFileList = updateFileList(targetItem, internalFileList.value);
|
|
141
146
|
onInternalChange(targetItem, nextFileList, e);
|
|
142
147
|
};
|
|
143
148
|
const onError = (error, response, file) => {
|
|
144
|
-
if (!getFileItem(file,
|
|
149
|
+
if (!getFileItem(file, internalFileList.value)) return;
|
|
145
150
|
const targetItem = file2Obj(file);
|
|
146
151
|
targetItem.error = error;
|
|
147
152
|
targetItem.response = response;
|
|
148
153
|
targetItem.status = "error";
|
|
149
|
-
const nextFileList = updateFileList(targetItem,
|
|
154
|
+
const nextFileList = updateFileList(targetItem, internalFileList.value);
|
|
150
155
|
onInternalChange(targetItem, nextFileList);
|
|
151
156
|
};
|
|
152
157
|
const handleRemove = (file) => {
|
|
153
158
|
let currentFile;
|
|
154
159
|
Promise.resolve(typeof props.onRemove === "function" ? props.onRemove(file) : props.onRemove).then((ret) => {
|
|
155
160
|
if (ret === false) return;
|
|
156
|
-
const removedFileList = removeFileItem(file,
|
|
161
|
+
const removedFileList = removeFileItem(file, internalFileList.value);
|
|
157
162
|
if (removedFileList) {
|
|
158
163
|
currentFile = {
|
|
159
164
|
...file,
|
|
160
165
|
status: "removed"
|
|
161
166
|
};
|
|
162
|
-
|
|
167
|
+
internalFileList.value?.forEach((item) => {
|
|
163
168
|
const matchKey = currentFile.uid !== void 0 ? "uid" : "name";
|
|
164
169
|
if (item[matchKey] === currentFile[matchKey] && !Object.isFrozen(item)) item.status = "removed";
|
|
165
170
|
});
|
|
@@ -226,10 +231,12 @@ const InternalUpload = /* @__PURE__ */ defineComponent((props, { slots, attrs, e
|
|
|
226
231
|
"listType": listType.value,
|
|
227
232
|
"items": mergedFileList.value,
|
|
228
233
|
"previewFile": props.previewFile,
|
|
229
|
-
"
|
|
234
|
+
"hasPreview": !!(instance?.vnode.props?.onPreview || instance?.vnode.props?.onPreviewOnce),
|
|
235
|
+
"onPreview": (file) => emit("preview", file),
|
|
230
236
|
"onDownload": (file) => {
|
|
231
|
-
|
|
232
|
-
|
|
237
|
+
const hasDownloadListener = !!(instance?.vnode.props?.onDownload || instance?.vnode.props?.onDownloadOnce);
|
|
238
|
+
emit("download", file);
|
|
239
|
+
if (!hasDownloadListener && file.url) window.open(file.url, "_blank", "noopener");
|
|
233
240
|
},
|
|
234
241
|
"onRemove": handleRemove,
|
|
235
242
|
"showRemoveIcon": realShowRemoveIcon,
|
|
@@ -479,14 +486,6 @@ const InternalUpload = /* @__PURE__ */ defineComponent((props, { slots, attrs, e
|
|
|
479
486
|
type: Function,
|
|
480
487
|
required: false
|
|
481
488
|
},
|
|
482
|
-
onPreview: {
|
|
483
|
-
type: Function,
|
|
484
|
-
required: false
|
|
485
|
-
},
|
|
486
|
-
onDownload: {
|
|
487
|
-
type: Function,
|
|
488
|
-
required: false
|
|
489
|
-
},
|
|
490
489
|
capture: {
|
|
491
490
|
type: [String, Boolean],
|
|
492
491
|
required: false,
|
|
@@ -516,6 +515,8 @@ const InternalUpload = /* @__PURE__ */ defineComponent((props, { slots, attrs, e
|
|
|
516
515
|
"change",
|
|
517
516
|
"drop",
|
|
518
517
|
"focus",
|
|
518
|
+
"preview",
|
|
519
|
+
"download",
|
|
519
520
|
"update:fileList"
|
|
520
521
|
],
|
|
521
522
|
name: "AUpload",
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { getAttrStyleAndClass } from "../../_util/hooks/useMergeSemantic.js";
|
|
2
2
|
import { useComponentBaseConfig } from "../../config-provider/context.js";
|
|
3
|
+
import { devUseWarning, isDev } from "../../_util/warning.js";
|
|
3
4
|
import InternalTooltip from "../../tooltip/index.js";
|
|
4
5
|
import { isRenderable } from "../../_util/is.js";
|
|
5
6
|
import progress_default from "../../progress/index.js";
|
|
@@ -46,11 +47,14 @@ const ListItem = /* @__PURE__ */ defineComponent((props, { attrs }) => {
|
|
|
46
47
|
}
|
|
47
48
|
const listItemClassName = clsx(`${prefixCls}-list-item`, `${prefixCls}-list-item-${mergedStatus.value}`, classes?.item);
|
|
48
49
|
let linkProps = file.linkProps;
|
|
50
|
+
let invalidLinkProps = false;
|
|
49
51
|
if (typeof linkProps === "string") try {
|
|
50
52
|
linkProps = JSON.parse(linkProps);
|
|
51
53
|
} catch {
|
|
52
54
|
linkProps = {};
|
|
55
|
+
invalidLinkProps = true;
|
|
53
56
|
}
|
|
57
|
+
if (isDev) devUseWarning("Upload")(!invalidLinkProps, "usage", "`linkProps` is not a valid JSON string. It will be ignored.");
|
|
54
58
|
const { onClick: linkOnClick, ...restLinkProps } = linkProps || {};
|
|
55
59
|
const removeIcon = (typeof showRemoveIcon === "function" ? showRemoveIcon(file) : showRemoveIcon) ? actionIconRender((typeof customRemoveIcon === "function" ? customRemoveIcon(file) : customRemoveIcon) || createVNode(DeleteOutlined, null, null), () => onClose(file), prefixCls, locale.removeFile, true) : null;
|
|
56
60
|
const downloadIcon = (typeof showDownloadIcon === "function" ? showDownloadIcon(file) : showDownloadIcon) && mergedStatus.value === "done" ? actionIconRender((typeof customDownloadIcon === "function" ? customDownloadIcon(file) : customDownloadIcon) || createVNode(DownloadOutlined, null, null), () => onDownload(file), prefixCls, locale.downloadFile) : null;
|
|
@@ -12,7 +12,7 @@ const UploadList = /* @__PURE__ */ defineComponent((props, { slots }) => {
|
|
|
12
12
|
const forceUpdate = shallowRef(0);
|
|
13
13
|
const motionAppear = shallowRef(false);
|
|
14
14
|
const instance = getCurrentInstance();
|
|
15
|
-
const hasPreviewListener = computed(() => !!instance?.vnode.props?.onPreview);
|
|
15
|
+
const hasPreviewListener = computed(() => props.hasPreview ?? !!instance?.vnode.props?.onPreview);
|
|
16
16
|
onMounted(() => {
|
|
17
17
|
motionAppear.value = true;
|
|
18
18
|
});
|
|
@@ -290,6 +290,11 @@ const UploadList = /* @__PURE__ */ defineComponent((props, { slots }) => {
|
|
|
290
290
|
onDownload: {
|
|
291
291
|
type: Function,
|
|
292
292
|
required: false
|
|
293
|
+
},
|
|
294
|
+
hasPreview: {
|
|
295
|
+
type: Boolean,
|
|
296
|
+
required: false,
|
|
297
|
+
default: void 0
|
|
293
298
|
}
|
|
294
299
|
}, {
|
|
295
300
|
listType: "text",
|
|
@@ -121,8 +121,6 @@ interface UploadProps<T = any> {
|
|
|
121
121
|
/** Config max count of `fileList`. Will replace current one when `maxCount` is 1 */
|
|
122
122
|
maxCount?: number;
|
|
123
123
|
onRemove?: (file: UploadFile<T>) => void | boolean | Promise<void | boolean>;
|
|
124
|
-
onPreview?: (file: UploadFile<T>) => void;
|
|
125
|
-
onDownload?: (file: UploadFile<T>) => void;
|
|
126
124
|
capture?: string | boolean;
|
|
127
125
|
hasControlInside?: boolean;
|
|
128
126
|
pastable?: boolean;
|
|
@@ -131,6 +129,8 @@ interface UploadEmits<T = any> {
|
|
|
131
129
|
'change': (info: UploadChangeParam<UploadFile<T>>) => void;
|
|
132
130
|
'drop': (event: DragEvent) => void;
|
|
133
131
|
'focus': (event: FocusEvent) => void;
|
|
132
|
+
'preview': (file: UploadFile<T>) => void;
|
|
133
|
+
'download': (file: UploadFile<T>) => void;
|
|
134
134
|
'update:fileList': (fileList: UploadFile<T>[]) => void;
|
|
135
135
|
}
|
|
136
136
|
interface UploadSlots<T = any> {
|
|
@@ -182,6 +182,8 @@ interface UploadListProps<T = any> {
|
|
|
182
182
|
onRemove?: (file: UploadFile<T>) => void | boolean;
|
|
183
183
|
onPreview?: (file: UploadFile<T>) => void;
|
|
184
184
|
onDownload?: (file: UploadFile<T>) => void;
|
|
185
|
+
/** @internal Only used internally by Upload to pass whether a preview listener is registered */
|
|
186
|
+
hasPreview?: boolean;
|
|
185
187
|
}
|
|
186
188
|
interface UploadListEmits {}
|
|
187
189
|
interface UploadListSlots<T = any> {
|