@silver-formily/element-plus 0.0.1-alpha.0 → 0.0.1-alpha.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/package.json +1 -1
- package/esm/__builtins__/configs/index.d.ts +0 -1
- package/esm/__builtins__/configs/index.mjs +0 -5
- package/esm/__builtins__/configs/index.mjs.map +0 -1
- package/esm/__builtins__/index.d.ts +0 -2
- package/esm/__builtins__/index.mjs +0 -27
- package/esm/__builtins__/index.mjs.map +0 -1
- package/esm/__builtins__/shared/hooks.d.ts +0 -7
- package/esm/__builtins__/shared/hooks.mjs +0 -59
- package/esm/__builtins__/shared/hooks.mjs.map +0 -1
- package/esm/__builtins__/shared/index.d.ts +0 -7
- package/esm/__builtins__/shared/index.mjs +0 -25
- package/esm/__builtins__/shared/index.mjs.map +0 -1
- package/esm/__builtins__/shared/load-config-provider.d.ts +0 -2
- package/esm/__builtins__/shared/load-config-provider.mjs +0 -13
- package/esm/__builtins__/shared/load-config-provider.mjs.map +0 -1
- package/esm/__builtins__/shared/loading.d.ts +0 -12
- package/esm/__builtins__/shared/loading.mjs +0 -49
- package/esm/__builtins__/shared/loading.mjs.map +0 -1
- package/esm/__builtins__/shared/simple-version-compare.d.ts +0 -2
- package/esm/__builtins__/shared/simple-version-compare.mjs +0 -18
- package/esm/__builtins__/shared/simple-version-compare.mjs.map +0 -1
- package/esm/__builtins__/shared/transform-component.d.ts +0 -8
- package/esm/__builtins__/shared/transform-component.mjs +0 -50
- package/esm/__builtins__/shared/transform-component.mjs.map +0 -1
- package/esm/__builtins__/shared/types.d.ts +0 -2
- package/esm/__builtins__/shared/types.mjs +0 -2
- package/esm/__builtins__/shared/types.mjs.map +0 -1
- package/esm/__builtins__/shared/utils.d.ts +0 -8
- package/esm/__builtins__/shared/utils.mjs +0 -34
- package/esm/__builtins__/shared/utils.mjs.map +0 -1
- package/esm/array-base/array-base-addition.d.ts +0 -5
- package/esm/array-base/array-base-index.d.ts +0 -19
- package/esm/array-base/array-base-inner.d.ts +0 -18
- package/esm/array-base/array-base-item.d.ts +0 -18
- package/esm/array-base/array-base-move-down.d.ts +0 -18
- package/esm/array-base/array-base-move-up.d.ts +0 -18
- package/esm/array-base/array-base-remove.d.ts +0 -18
- package/esm/array-base/array-base-sort-handle.d.ts +0 -2
- package/esm/array-base/index.d.ts +0 -114
- package/esm/array-base/index.mjs +0 -225
- package/esm/array-base/index.mjs.map +0 -1
- package/esm/array-base/symbols.d.ts +0 -4
- package/esm/array-base/symbols.mjs +0 -6
- package/esm/array-base/symbols.mjs.map +0 -1
- package/esm/array-base/types.d.ts +0 -28
- package/esm/array-base/types.mjs +0 -2
- package/esm/array-base/types.mjs.map +0 -1
- package/esm/array-base/utils.d.ts +0 -18
- package/esm/array-base/utils.mjs +0 -88
- package/esm/array-base/utils.mjs.map +0 -1
- package/esm/array-cards/array-cards.d.ts +0 -13
- package/esm/array-cards/index.d.ts +0 -122
- package/esm/array-cards/index.mjs +0 -119
- package/esm/array-cards/index.mjs.map +0 -1
- package/esm/array-collapse/array-collapse-item.d.ts +0 -18
- package/esm/array-collapse/array-collapse.d.ts +0 -16
- package/esm/array-collapse/index.d.ts +0 -134
- package/esm/array-collapse/index.mjs +0 -180
- package/esm/array-collapse/index.mjs.map +0 -1
- package/esm/array-collapse/utils.d.ts +0 -1
- package/esm/array-collapse/utils.mjs +0 -12
- package/esm/array-collapse/utils.mjs.map +0 -1
- package/esm/array-items/array-items-item.d.ts +0 -30
- package/esm/array-items/array-items.d.ts +0 -2
- package/esm/array-items/index.d.ts +0 -130
- package/esm/array-items/index.mjs +0 -105
- package/esm/array-items/index.mjs.map +0 -1
- package/esm/array-list-tabs/array-list-tabs.d.ts +0 -31
- package/esm/array-list-tabs/index.d.ts +0 -83
- package/esm/array-list-tabs/index.mjs +0 -183
- package/esm/array-list-tabs/index.mjs.map +0 -1
- package/esm/array-list-tabs/utils.d.ts +0 -3
- package/esm/array-list-tabs/utils.mjs +0 -16
- package/esm/array-list-tabs/utils.mjs.map +0 -1
- package/esm/array-table/index.mjs +0 -230
- package/esm/array-table/index.mjs.map +0 -1
- package/esm/array-table/types.d.ts +0 -6
- package/esm/array-table/types.mjs +0 -2
- package/esm/array-table/types.mjs.map +0 -1
- package/esm/array-table/utils.d.ts +0 -5
- package/esm/array-table/utils.mjs +0 -26
- package/esm/array-table/utils.mjs.map +0 -1
- package/esm/array-tabs/array-tabs.d.ts +0 -2
- package/esm/array-tabs/index.d.ts +0 -2
- package/esm/array-tabs/index.mjs +0 -88
- package/esm/array-tabs/index.mjs.map +0 -1
- package/esm/cascader/cascader.d.ts +0 -30
- package/esm/cascader/index.d.ts +0 -41
- package/esm/cascader/index.mjs +0 -54
- package/esm/cascader/index.mjs.map +0 -1
- package/esm/checkbox/checkbox-group.d.ts +0 -58
- package/esm/checkbox/index.d.ts +0 -716
- package/esm/checkbox/index.mjs +0 -86
- package/esm/checkbox/index.mjs.map +0 -1
- package/esm/date-picker/index.d.ts +0 -2
- package/esm/date-picker/index.mjs +0 -57
- package/esm/date-picker/index.mjs.map +0 -1
- package/esm/editable/editable-popover.d.ts +0 -25
- package/esm/editable/editable.d.ts +0 -187
- package/esm/editable/index.d.ts +0 -147
- package/esm/editable/index.mjs +0 -231
- package/esm/editable/index.mjs.map +0 -1
- package/esm/form/form.d.ts +0 -46
- package/esm/form/form.mjs +0 -77
- package/esm/form/form.mjs.map +0 -1
- package/esm/form/index.d.ts +0 -1
- package/esm/form/index.mjs +0 -6
- package/esm/form/index.mjs.map +0 -1
- package/esm/form-button-group/form-button-group-sticky.d.ts +0 -17
- package/esm/form-button-group/form-button-group.d.ts +0 -48
- package/esm/form-button-group/index.d.ts +0 -87
- package/esm/form-button-group/index.mjs +0 -90
- package/esm/form-button-group/index.mjs.map +0 -1
- package/esm/form-button-group/utils.d.ts +0 -1
- package/esm/form-button-group/utils.mjs +0 -12
- package/esm/form-button-group/utils.mjs.map +0 -1
- package/esm/form-collapse/form-collapse.d.ts +0 -18
- package/esm/form-collapse/index.d.ts +0 -45
- package/esm/form-collapse/index.mjs +0 -103
- package/esm/form-collapse/index.mjs.map +0 -1
- package/esm/form-collapse/utils.d.ts +0 -31
- package/esm/form-collapse/utils.mjs +0 -54
- package/esm/form-collapse/utils.mjs.map +0 -1
- package/esm/form-dialog/dialog-content.d.ts +0 -60
- package/esm/form-dialog/index.d.ts +0 -4
- package/esm/form-dialog/index.mjs +0 -209
- package/esm/form-dialog/index.mjs.map +0 -1
- package/esm/form-dialog/types.d.ts +0 -32
- package/esm/form-dialog/types.mjs +0 -2
- package/esm/form-dialog/types.mjs.map +0 -1
- package/esm/form-drawer/drawer-content.d.ts +0 -60
- package/esm/form-drawer/index.d.ts +0 -4
- package/esm/form-drawer/index.mjs +0 -203
- package/esm/form-drawer/index.mjs.map +0 -1
- package/esm/form-drawer/types.d.ts +0 -32
- package/esm/form-drawer/types.mjs +0 -2
- package/esm/form-drawer/types.mjs.map +0 -1
- package/esm/form-grid/form-grid-column.d.ts +0 -29
- package/esm/form-grid/form-grid.d.ts +0 -101
- package/esm/form-grid/hooks.d.ts +0 -4
- package/esm/form-grid/hooks.mjs +0 -7
- package/esm/form-grid/hooks.mjs.map +0 -1
- package/esm/form-grid/index.d.ts +0 -182
- package/esm/form-grid/index.mjs +0 -106
- package/esm/form-grid/index.mjs.map +0 -1
- package/esm/form-item/form-item.d.ts +0 -18
- package/esm/form-item/index.d.ts +0 -70
- package/esm/form-item/index.mjs +0 -346
- package/esm/form-item/index.mjs.map +0 -1
- package/esm/form-item/types.d.ts +0 -25
- package/esm/form-item/types.mjs +0 -2
- package/esm/form-item/types.mjs.map +0 -1
- package/esm/form-item/utils.d.ts +0 -3
- package/esm/form-item/utils.mjs +0 -18
- package/esm/form-item/utils.mjs.map +0 -1
- package/esm/form-layout/form-layout.d.ts +0 -32
- package/esm/form-layout/form-layout.mjs +0 -86
- package/esm/form-layout/form-layout.mjs.map +0 -1
- package/esm/form-layout/index.d.ts +0 -1
- package/esm/form-layout/index.mjs +0 -6
- package/esm/form-layout/index.mjs.map +0 -1
- package/esm/form-layout/types.d.ts +0 -43
- package/esm/form-layout/types.mjs +0 -2
- package/esm/form-layout/types.mjs.map +0 -1
- package/esm/form-layout/utils.d.ts +0 -57
- package/esm/form-layout/utils.mjs +0 -109
- package/esm/form-layout/utils.mjs.map +0 -1
- package/esm/form-step/form-step-pane.d.ts +0 -2
- package/esm/form-step/form-step.d.ts +0 -5
- package/esm/form-step/index.d.ts +0 -24
- package/esm/form-step/index.mjs +0 -96
- package/esm/form-step/index.mjs.map +0 -1
- package/esm/form-step/types.d.ts +0 -21
- package/esm/form-step/types.mjs +0 -2
- package/esm/form-step/types.mjs.map +0 -1
- package/esm/form-step/utils.d.ts +0 -11
- package/esm/form-step/utils.mjs +0 -66
- package/esm/form-step/utils.mjs.map +0 -1
- package/esm/form-tab/form-tab.d.ts +0 -7
- package/esm/form-tab/hooks.d.ts +0 -7
- package/esm/form-tab/hooks.mjs +0 -32
- package/esm/form-tab/hooks.mjs.map +0 -1
- package/esm/form-tab/index.d.ts +0 -28
- package/esm/form-tab/index.mjs +0 -80
- package/esm/form-tab/index.mjs.map +0 -1
- package/esm/form-tab/types.d.ts +0 -12
- package/esm/form-tab/types.mjs +0 -2
- package/esm/form-tab/types.mjs.map +0 -1
- package/esm/form-tab/utils.d.ts +0 -4
- package/esm/form-tab/utils.mjs +0 -14
- package/esm/form-tab/utils.mjs.map +0 -1
- package/esm/index.d.ts +0 -37
- package/esm/index.mjs +0 -81
- package/esm/index.mjs.map +0 -1
- package/esm/input/index.d.ts +0 -84
- package/esm/input/index.mjs +0 -77
- package/esm/input/index.mjs.map +0 -1
- package/esm/input/input.d.ts +0 -32
- package/esm/input-number/index.d.ts +0 -4
- package/esm/input-number/index.mjs +0 -30
- package/esm/input-number/index.mjs.map +0 -1
- package/esm/pagination/components/jumper.d.ts +0 -16
- package/esm/pagination/components/jumper.mjs +0 -12
- package/esm/pagination/components/jumper.mjs.map +0 -1
- package/esm/pagination/components/next.d.ts +0 -42
- package/esm/pagination/components/next.mjs +0 -23
- package/esm/pagination/components/next.mjs.map +0 -1
- package/esm/pagination/components/pager.d.ts +0 -42
- package/esm/pagination/components/pager.mjs +0 -23
- package/esm/pagination/components/pager.mjs.map +0 -1
- package/esm/pagination/components/prev.d.ts +0 -39
- package/esm/pagination/components/prev.mjs +0 -22
- package/esm/pagination/components/prev.mjs.map +0 -1
- package/esm/pagination/components/sizes.d.ts +0 -56
- package/esm/pagination/components/sizes.mjs +0 -7
- package/esm/pagination/components/sizes.mjs.map +0 -1
- package/esm/pagination/components/total.d.ts +0 -8
- package/esm/pagination/components/total.mjs +0 -11
- package/esm/pagination/components/total.mjs.map +0 -1
- package/esm/pagination/pagination.d.ts +0 -128
- package/esm/pagination/pagination.mjs +0 -631
- package/esm/pagination/pagination.mjs.map +0 -1
- package/esm/password/index.d.ts +0 -86
- package/esm/password/index.mjs +0 -14
- package/esm/password/index.mjs.map +0 -1
- package/esm/preview-text/cascader.d.ts +0 -5
- package/esm/preview-text/date-picker.d.ts +0 -5
- package/esm/preview-text/index.d.ts +0 -102
- package/esm/preview-text/index.mjs +0 -321
- package/esm/preview-text/index.mjs.map +0 -1
- package/esm/preview-text/input.d.ts +0 -28
- package/esm/preview-text/preview.d.ts +0 -18
- package/esm/preview-text/select.d.ts +0 -5
- package/esm/preview-text/time-picker.d.ts +0 -5
- package/esm/preview-text/tree.d.ts +0 -22
- package/esm/preview-text/utils.d.ts +0 -14
- package/esm/preview-text/utils.mjs +0 -16
- package/esm/preview-text/utils.mjs.map +0 -1
- package/esm/radio/index.d.ts +0 -634
- package/esm/radio/index.mjs +0 -80
- package/esm/radio/index.mjs.map +0 -1
- package/esm/radio/radio-group.d.ts +0 -44
- package/esm/reset/index.d.ts +0 -63
- package/esm/reset/index.mjs +0 -48
- package/esm/reset/index.mjs.map +0 -1
- package/esm/reset/reset.d.ts +0 -45
- package/esm/select/index.d.ts +0 -142
- package/esm/select/index.mjs +0 -132
- package/esm/select/index.mjs.map +0 -1
- package/esm/select/select.d.ts +0 -50
- package/esm/select-table/index.mjs +0 -204
- package/esm/select-table/index.mjs.map +0 -1
- package/esm/select-table/types.d.ts +0 -14
- package/esm/select-table/types.mjs +0 -2
- package/esm/select-table/types.mjs.map +0 -1
- package/esm/space/index.d.ts +0 -1
- package/esm/space/index.mjs +0 -6
- package/esm/space/index.mjs.map +0 -1
- package/esm/styles/array-base/index.css +0 -1
- package/esm/styles/array-cards/index.css +0 -1
- package/esm/styles/array-collapse/index.css +0 -1
- package/esm/styles/array-items/index.css +0 -1
- package/esm/styles/array-list-tabs/index.css +0 -1
- package/esm/styles/array-table/index.css +0 -1
- package/esm/styles/array-tabs/index.css +0 -1
- package/esm/styles/editable/index.css +0 -1
- package/esm/styles/form-button-group/index.css +0 -1
- package/esm/styles/form-collapse/index.css +0 -1
- package/esm/styles/form-grid/index.css +0 -1
- package/esm/styles/form-item/index.css +0 -1
- package/esm/styles/form-tab/index.css +0 -1
- package/esm/styles/preview-text/index.css +0 -1
- package/esm/styles/radio/index.css +0 -1
- package/esm/styles/select-table/index.css +0 -1
- package/esm/submit/index.d.ts +0 -48
- package/esm/submit/index.mjs +0 -47
- package/esm/submit/index.mjs.map +0 -1
- package/esm/submit/submit.d.ts +0 -36
- package/esm/switch/index.d.ts +0 -4
- package/esm/switch/index.mjs +0 -19
- package/esm/switch/index.mjs.map +0 -1
- package/esm/time-picker/index.d.ts +0 -4
- package/esm/time-picker/index.mjs +0 -21
- package/esm/time-picker/index.mjs.map +0 -1
- package/esm/time-select/index.d.ts +0 -2
- package/esm/time-select/index.mjs +0 -21
- package/esm/time-select/index.mjs.map +0 -1
- package/esm/transfer/index.d.ts +0 -1509
- package/esm/transfer/index.mjs +0 -11
- package/esm/transfer/index.mjs.map +0 -1
- package/esm/tree/index.d.ts +0 -42
- package/esm/tree/index.mjs +0 -105
- package/esm/tree/index.mjs.map +0 -1
- package/esm/tree/tree.d.ts +0 -20
- package/esm/tree/types.d.ts +0 -13
- package/esm/tree/types.mjs +0 -2
- package/esm/tree/types.mjs.map +0 -1
- package/esm/tree/utils.d.ts +0 -45
- package/esm/tree/utils.mjs +0 -161
- package/esm/tree/utils.mjs.map +0 -1
- package/esm/tree-select/index.d.ts +0 -32
- package/esm/tree-select/index.mjs +0 -51
- package/esm/tree-select/index.mjs.map +0 -1
- package/esm/tree-select/tree-select.d.ts +0 -17
- package/esm/upload/index.d.ts +0 -889
- package/esm/upload/index.mjs +0 -185
- package/esm/upload/index.mjs.map +0 -1
- package/esm/upload/upload.d.ts +0 -1613
- package/esm/vendor/icon.mjs +0 -11
- package/esm/vendor/icon.mjs.map +0 -1
- package/esm/vendor/lodash.mjs +0 -1400
- package/esm/vendor/lodash.mjs.map +0 -1
- package/esm/vendor/runtime.mjs +0 -29
- package/esm/vendor/runtime.mjs.map +0 -1
- package/esm/vendor/shared.esm-bundler.mjs +0 -14
- package/esm/vendor/shared.esm-bundler.mjs.map +0 -1
- package/esm/vendor/sizes.mjs +0 -27
- package/esm/vendor/sizes.mjs.map +0 -1
- package/esm/vendor/types.mjs +0 -19
- package/esm/vendor/types.mjs.map +0 -1
package/esm/upload/index.mjs
DELETED
|
@@ -1,185 +0,0 @@
|
|
|
1
|
-
import { useField as N, connect as j, mapProps as O } from "@formily/vue";
|
|
2
|
-
import { defineComponent as z, ref as f, useAttrs as T, computed as P, onBeforeUnmount as q, createElementBlock as y, openBlock as s, Fragment as h, createVNode as p, createBlock as k, createCommentVNode as G, unref as n, mergeProps as C, createSlots as H, withCtx as u, renderSlot as m, createElementVNode as S, toDisplayString as R } from "vue";
|
|
3
|
-
import { UploadFilled as J, Plus as K, Upload as M } from "@element-plus/icons-vue";
|
|
4
|
-
import { reaction as Q } from "@formily/reactive";
|
|
5
|
-
import { isFn as c } from "@formily/shared";
|
|
6
|
-
import { ElUpload as W, ElIcon as X, ElButton as Y, ElImageViewer as Z, genFileId as ee } from "element-plus";
|
|
7
|
-
import "@formily/core";
|
|
8
|
-
import "@formily/reactive-vue";
|
|
9
|
-
import { hasSlotContent as te } from "../__builtins__/shared/utils.mjs";
|
|
10
|
-
import { o as oe } from "../vendor/lodash.mjs";
|
|
11
|
-
const re = { class: "el-upload__text" }, ne = { style: { "margin-left": "6px" } }, ie = /* @__PURE__ */ z({
|
|
12
|
-
name: "FUpload",
|
|
13
|
-
inheritAttrs: !1,
|
|
14
|
-
__name: "upload",
|
|
15
|
-
props: {
|
|
16
|
-
textContent: {
|
|
17
|
-
type: String,
|
|
18
|
-
default: ""
|
|
19
|
-
},
|
|
20
|
-
errorAdaptor: {
|
|
21
|
-
type: Function,
|
|
22
|
-
default: (i) => i == null ? void 0 : i.message
|
|
23
|
-
},
|
|
24
|
-
formatValue: {
|
|
25
|
-
type: Function,
|
|
26
|
-
default: (i) => i
|
|
27
|
-
},
|
|
28
|
-
fileList: {
|
|
29
|
-
type: Array,
|
|
30
|
-
default: () => []
|
|
31
|
-
},
|
|
32
|
-
imageViewerProps: {
|
|
33
|
-
type: Object,
|
|
34
|
-
default: () => ({ teleported: !0, showProgress: !0 })
|
|
35
|
-
}
|
|
36
|
-
},
|
|
37
|
-
emits: ["change"],
|
|
38
|
-
setup(i, { emit: U }) {
|
|
39
|
-
var x;
|
|
40
|
-
const l = i, $ = U, d = f(), r = T(), V = P(() => oe(r, [
|
|
41
|
-
"onChange",
|
|
42
|
-
"onRemove",
|
|
43
|
-
"onExceed",
|
|
44
|
-
"onError",
|
|
45
|
-
"onPreview",
|
|
46
|
-
"fileList",
|
|
47
|
-
"onUpdate:fileList"
|
|
48
|
-
])), a = N();
|
|
49
|
-
(x = a.value) == null || x.inject({
|
|
50
|
-
getElUploadRef: () => d
|
|
51
|
-
});
|
|
52
|
-
const F = f(), E = f(0), g = f(!1), I = P(() => l.fileList.map((e) => e.url));
|
|
53
|
-
function w(e) {
|
|
54
|
-
var t;
|
|
55
|
-
const o = l.errorAdaptor(e);
|
|
56
|
-
(t = a.value) == null || t.setFeedback({
|
|
57
|
-
type: "error",
|
|
58
|
-
code: "UploadError",
|
|
59
|
-
messages: o ? [o] : []
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
function L(e, o) {
|
|
63
|
-
var t;
|
|
64
|
-
(t = a.value) == null || t.setDataSource([...o]), w();
|
|
65
|
-
}
|
|
66
|
-
function A(e, o) {
|
|
67
|
-
c(r.onRemove) && r.onRemove(e, o), a.value.setDataSource([...o]), w();
|
|
68
|
-
}
|
|
69
|
-
function B(e, o) {
|
|
70
|
-
if (c(r.onExceed) && r.onExceed(e, o), r.limit !== 1)
|
|
71
|
-
return;
|
|
72
|
-
d.value.clearFiles();
|
|
73
|
-
const t = e[0];
|
|
74
|
-
t.uid = ee(), d.value.handleStart(t), (r.autoUpload ?? !0) && d.value.submit();
|
|
75
|
-
}
|
|
76
|
-
function _(e, o, t) {
|
|
77
|
-
c(r.onError) && r.onError(e, o, t);
|
|
78
|
-
}
|
|
79
|
-
function b(e) {
|
|
80
|
-
var t;
|
|
81
|
-
if (c(r.onPreview)) {
|
|
82
|
-
r.onPreview(e);
|
|
83
|
-
return;
|
|
84
|
-
}
|
|
85
|
-
if (!e.url && !((t = r.accept) != null && t.includes("image")))
|
|
86
|
-
return;
|
|
87
|
-
const o = l.fileList.findIndex((v) => v.uid === e.uid);
|
|
88
|
-
E.value = o, g.value = !0;
|
|
89
|
-
}
|
|
90
|
-
const D = Q(() => {
|
|
91
|
-
var e;
|
|
92
|
-
return ((e = a.value) == null ? void 0 : e.dataSource) ?? [];
|
|
93
|
-
}, () => {
|
|
94
|
-
const e = l.formatValue(a.value.dataSource);
|
|
95
|
-
$("change", e);
|
|
96
|
-
});
|
|
97
|
-
return q(() => {
|
|
98
|
-
D();
|
|
99
|
-
}), (e, o) => (s(), y(h, null, [
|
|
100
|
-
p(n(W), C({
|
|
101
|
-
ref_key: "uploadRef",
|
|
102
|
-
ref: d
|
|
103
|
-
}, V.value, {
|
|
104
|
-
"file-list": e.$props.fileList,
|
|
105
|
-
onChange: L,
|
|
106
|
-
onRemove: A,
|
|
107
|
-
onExceed: B,
|
|
108
|
-
onError: _,
|
|
109
|
-
onPreview: b
|
|
110
|
-
}), H({
|
|
111
|
-
default: u(() => {
|
|
112
|
-
var t;
|
|
113
|
-
return [
|
|
114
|
-
n(te)((t = e.$slots) == null ? void 0 : t.default) ? m(e.$slots, "default", { key: 0 }) : (s(), y(h, { key: 1 }, [
|
|
115
|
-
n(r).drag ? (s(), y(h, { key: 0 }, [
|
|
116
|
-
p(n(X), { style: { "font-size": "60px", margin: "40px 0 16px" } }, {
|
|
117
|
-
default: u(() => [
|
|
118
|
-
p(n(J), { color: "gray" })
|
|
119
|
-
]),
|
|
120
|
-
_: 1
|
|
121
|
-
}),
|
|
122
|
-
S("div", re, R(l.textContent), 1)
|
|
123
|
-
], 64)) : n(r).listType === "picture-card" ? (s(), k(n(K), {
|
|
124
|
-
key: 1,
|
|
125
|
-
style: { width: "28px", height: "28px", color: "gray" }
|
|
126
|
-
})) : (s(), k(n(Y), { key: 2 }, {
|
|
127
|
-
default: u(() => [
|
|
128
|
-
p(n(M), {
|
|
129
|
-
width: "16px",
|
|
130
|
-
height: "16px"
|
|
131
|
-
}),
|
|
132
|
-
S("span", ne, R(l.textContent), 1)
|
|
133
|
-
]),
|
|
134
|
-
_: 1
|
|
135
|
-
}))
|
|
136
|
-
], 64))
|
|
137
|
-
];
|
|
138
|
-
}),
|
|
139
|
-
_: 2
|
|
140
|
-
}, [
|
|
141
|
-
e.$slots.file ? {
|
|
142
|
-
name: "file",
|
|
143
|
-
fn: u(({ file: t, index: v }) => [
|
|
144
|
-
m(e.$slots, "file", {
|
|
145
|
-
file: t,
|
|
146
|
-
index: v
|
|
147
|
-
})
|
|
148
|
-
]),
|
|
149
|
-
key: "0"
|
|
150
|
-
} : void 0,
|
|
151
|
-
e.$slots.tip ? {
|
|
152
|
-
name: "tip",
|
|
153
|
-
fn: u(() => [
|
|
154
|
-
m(e.$slots, "tip")
|
|
155
|
-
]),
|
|
156
|
-
key: "1"
|
|
157
|
-
} : void 0,
|
|
158
|
-
e.$slots.trigger ? {
|
|
159
|
-
name: "trigger",
|
|
160
|
-
fn: u(() => [
|
|
161
|
-
m(e.$slots, "trigger")
|
|
162
|
-
]),
|
|
163
|
-
key: "2"
|
|
164
|
-
} : void 0
|
|
165
|
-
]), 1040, ["file-list"]),
|
|
166
|
-
g.value ? (s(), k(n(Z), C({
|
|
167
|
-
key: 0,
|
|
168
|
-
ref_key: "imgPreviewRef",
|
|
169
|
-
ref: F,
|
|
170
|
-
"url-list": I.value,
|
|
171
|
-
"initial-index": E.value
|
|
172
|
-
}, l.imageViewerProps, {
|
|
173
|
-
onClose: o[0] || (o[0] = (t) => g.value = !1)
|
|
174
|
-
}), null, 16, ["url-list", "initial-index"])) : G("", !0)
|
|
175
|
-
], 64));
|
|
176
|
-
}
|
|
177
|
-
}), ve = j(
|
|
178
|
-
ie,
|
|
179
|
-
O({ readOnly: "readonly", dataSource: "fileList" })
|
|
180
|
-
);
|
|
181
|
-
export {
|
|
182
|
-
ve as Upload,
|
|
183
|
-
ve as default
|
|
184
|
-
};
|
|
185
|
-
//# sourceMappingURL=index.mjs.map
|
package/esm/upload/index.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../../src/upload/upload.vue","../../src/upload/index.ts"],"sourcesContent":["<script lang=\"ts\" setup>\nimport type { Field } from '@formily/core'\nimport type { ImageViewerInstance, ImageViewerProps, UploadFile, UploadInstance, UploadProps, UploadRawFile } from 'element-plus'\nimport type { PropType } from 'vue'\nimport {\n Plus as PlusIcon,\n UploadFilled as UploadFilledIcon,\n Upload as UploadIcon,\n} from '@element-plus/icons-vue'\nimport { reaction } from '@formily/reactive'\nimport { isFn } from '@formily/shared'\nimport { useField } from '@formily/vue'\nimport { ElButton, ElIcon, ElImageViewer, ElUpload, genFileId } from 'element-plus'\nimport { omit } from 'lodash-es'\nimport { computed, onBeforeUnmount, ref, useAttrs } from 'vue'\nimport { hasSlotContent } from '../__builtins__'\n\ndefineOptions({\n name: 'FUpload',\n inheritAttrs: false,\n})\n\nconst props = defineProps({\n textContent: {\n type: String,\n default: '',\n },\n errorAdaptor: {\n type: Function as PropType<(error?: Error) => string>,\n default: (error?: Error) => error?.message,\n },\n formatValue: {\n type: Function as PropType<(fileList?: UploadFile[]) => any>,\n default: item => item,\n },\n fileList: {\n type: Array as PropType<UploadFile[]>,\n default: () => [],\n },\n imageViewerProps: {\n type: Object as PropType<ImageViewerProps>,\n default: () => ({ teleported: true, showProgress: true }),\n },\n})\n\nconst emit = defineEmits(['change'])\n\nconst uploadRef = ref<UploadInstance>()\nconst attrs = useAttrs() as UploadProps\nconst innerAttrs = computed(() => {\n return omit(attrs, [\n 'onChange',\n 'onRemove',\n 'onExceed',\n 'onError',\n 'onPreview',\n 'fileList',\n 'onUpdate:fileList',\n ])\n})\nconst fieldRef = useField<Field>()\nfieldRef.value?.inject({\n getElUploadRef: () => {\n return uploadRef\n },\n})\n\nconst imgPreviewRef = ref<ImageViewerInstance>()\nconst activeImageIndex = ref(0)\nconst isShowImgViewer = ref(false)\nconst imgPreviewList = computed(() => {\n return props.fileList.map(item => item.url)\n})\n\nfunction setFeedBack(error?: Error) {\n const message = props.errorAdaptor(error)\n fieldRef.value?.setFeedback({\n type: 'error',\n code: 'UploadError',\n messages: message ? [message] : [],\n })\n}\n\nfunction handleChange(file: UploadFile, fileList: UploadFile[]) {\n fieldRef.value?.setDataSource([...fileList])\n setFeedBack()\n}\n\nfunction handleRemove(file: UploadFile, fileList: UploadFile[]) {\n if (isFn(attrs.onRemove)) {\n attrs.onRemove(file, fileList)\n }\n fieldRef.value.setDataSource([...fileList])\n setFeedBack()\n}\n\nfunction handleExceed(files: File[], uploadFIles) {\n if (isFn(attrs.onExceed)) {\n attrs.onExceed(files, uploadFIles)\n }\n if (attrs.limit !== 1)\n return\n uploadRef.value!.clearFiles()\n const file = files[0] as UploadRawFile\n file.uid = genFileId()\n uploadRef.value!.handleStart(file)\n if (attrs.autoUpload ?? true) {\n uploadRef.value!.submit()\n }\n}\n\nfunction handleError(error: Error, file: UploadFile, fileList: UploadFile[]) {\n if (isFn(attrs.onError)) {\n (attrs.onError)(error, file, fileList)\n }\n}\n\nfunction onPreviewClick(uploadFile: UploadFile) {\n if (isFn(attrs.onPreview)) {\n (attrs.onPreview)(uploadFile)\n return\n }\n if (!uploadFile.url && !attrs.accept?.includes('image'))\n return\n const clickIndex = props.fileList.findIndex((element: UploadFile) => element.uid === uploadFile.uid)\n activeImageIndex.value = clickIndex\n isShowImgViewer.value = true\n}\n\nconst dispose = reaction(() => {\n return fieldRef.value?.dataSource ?? []\n}, () => {\n const emitValue = props.formatValue(fieldRef.value.dataSource as UploadFile[])\n emit('change', emitValue)\n})\nonBeforeUnmount(() => {\n dispose()\n})\n</script>\n\n<template>\n <ElUpload\n ref=\"uploadRef\"\n v-bind=\"innerAttrs\"\n :file-list=\"$props.fileList\"\n @change=\"handleChange\"\n @remove=\"handleRemove\"\n @exceed=\"handleExceed\"\n @error=\"handleError\"\n @preview=\"onPreviewClick\"\n >\n <slot v-if=\"hasSlotContent($slots?.default)\" />\n <template v-else>\n <template v-if=\"attrs.drag\">\n <ElIcon style=\"font-size: 60px; margin: 40px 0 16px;\">\n <UploadFilledIcon color=\"gray\" />\n </ElIcon>\n <div class=\"el-upload__text\">\n {{ props.textContent }}\n </div>\n </template>\n <template v-else-if=\"attrs.listType === 'picture-card'\">\n <PlusIcon style=\"width: 28px; height: 28px; color: gray\" />\n </template>\n <template v-else>\n <ElButton>\n <UploadIcon width=\"16px\" height=\"16px\" />\n <span style=\"margin-left: 6px\">\n {{ props.textContent }}\n </span>\n </ElButton>\n </template>\n </template>\n <template v-if=\"$slots.file\" #file=\"{ file, index }\">\n <slot name=\"file\" :file=\"file\" :index=\"index\" />\n </template>\n <template v-if=\"$slots.tip\" #tip>\n <slot name=\"tip\" />\n </template>\n <template v-if=\"$slots.trigger\" #trigger>\n <slot name=\"trigger\" />\n </template>\n </ElUpload>\n <ElImageViewer\n v-if=\"isShowImgViewer\"\n ref=\"imgPreviewRef\"\n :url-list=\"imgPreviewList\"\n :initial-index=\"activeImageIndex\"\n v-bind=\"props.imageViewerProps\"\n @close=\"isShowImgViewer = false\"\n />\n</template>\n","import { connect, mapProps } from '@formily/vue'\r\nimport FUpload from './upload.vue'\r\n\r\nexport const Upload = connect(\r\n FUpload,\r\n mapProps({ readOnly: 'readonly', dataSource: 'fileList' }),\r\n)\r\n\r\nexport default Upload\r\n"],"names":["props","__props","emit","__emit","uploadRef","ref","attrs","useAttrs","innerAttrs","computed","omit","fieldRef","useField","_a","imgPreviewRef","activeImageIndex","isShowImgViewer","imgPreviewList","item","setFeedBack","error","message","handleChange","file","fileList","handleRemove","isFn","handleExceed","files","uploadFIles","genFileId","handleError","onPreviewClick","uploadFile","clickIndex","element","dispose","reaction","emitValue","onBeforeUnmount","_createVNode","_unref","_mergeProps","$props","hasSlotContent","$slots","_renderSlot","_ctx","_createElementBlock","_Fragment","ElIcon","UploadFilledIcon","_createElementVNode","_hoisted_1","_toDisplayString","_createBlock","PlusIcon","ElButton","UploadIcon","_hoisted_2","index","_openBlock","Upload","connect","FUpload","mapProps"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsBA,UAAMA,IAAQC,GAuBRC,IAAOC,GAEPC,IAAYC,EAAA,GACZC,IAAQC,EAAA,GACRC,IAAaC,EAAS,MACnBC,GAAKJ,GAAO;AAAA,MACjB;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IAAA,CACD,CACF,GACKK,IAAWC,EAAA;AACjB,KAAAC,IAAAF,EAAS,UAAT,QAAAE,EAAgB,OAAO;AAAA,MACrB,gBAAgB,MACPT;AAAA,IACT;AAGF,UAAMU,IAAgBT,EAAA,GAChBU,IAAmBV,EAAI,CAAC,GACxBW,IAAkBX,EAAI,EAAK,GAC3BY,IAAiB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