@vunk/form 0.0.1-alpha.3 → 0.0.1-alpha.30

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (117) hide show
  1. package/components/button/index.d.ts +4 -0
  2. package/components/button/index.js +121 -0
  3. package/components/button/src/ctx.d.ts +91 -0
  4. package/components/button/src/ctx.js +39 -0
  5. package/components/button/src/index.vue.d.ts +241 -0
  6. package/components/button/src/types.d.ts +7 -0
  7. package/components/button/src/types.js +1 -0
  8. package/components/checkbox/index.css +38 -0
  9. package/components/checkbox/index.d.ts +4 -0
  10. package/components/checkbox/index.js +125 -0
  11. package/components/checkbox/src/ctx.d.ts +107 -0
  12. package/components/checkbox/src/ctx.js +43 -0
  13. package/components/checkbox/src/index.vue.d.ts +270 -0
  14. package/components/checkbox/src/types.d.ts +1 -0
  15. package/components/checkbox/src/types.js +1 -0
  16. package/components/color-picker/index.d.ts +4 -0
  17. package/components/color-picker/index.js +72 -0
  18. package/components/color-picker/src/ctx.d.ts +74 -0
  19. package/components/color-picker/src/ctx.js +23 -0
  20. package/components/color-picker/src/index.vue.d.ts +196 -0
  21. package/components/color-picker/src/types.d.ts +1 -0
  22. package/components/color-picker/src/types.js +1 -0
  23. package/components/date-picker/index.js +11 -5
  24. package/components/date-picker/src/ctx.d.ts +64 -57
  25. package/components/date-picker/src/ctx.js +1 -1
  26. package/components/date-picker/src/index.vue.d.ts +170 -140
  27. package/components/date-picker/src/types.d.ts +7 -7
  28. package/components/form/index.js +23 -7
  29. package/components/form/src/ctx.d.ts +93 -79
  30. package/components/form/src/ctx.js +5 -2
  31. package/components/form/src/index.vue.d.ts +270 -236
  32. package/components/form-item/index.css +4 -0
  33. package/components/form-item/index.js +19 -3
  34. package/components/form-item/src/ctx.d.ts +15 -7
  35. package/components/form-item/src/ctx.js +8 -0
  36. package/components/form-item/src/index.vue.d.ts +43 -13
  37. package/components/form-item-renderer/index.js +15 -1
  38. package/components/form-item-renderer/src/ctx.d.ts +3 -3
  39. package/components/form-item-renderer/src/index.vue.d.ts +9 -9
  40. package/components/form-item-renderer/src/types.d.ts +2 -0
  41. package/components/form-item-renderer-template/src/index.vue.d.ts +1 -1
  42. package/components/form-item-renderer-template-default/index.js +100 -22
  43. package/components/form-item-renderer-template-default/src/index.vue.d.ts +7 -7
  44. package/components/form-item-renderer-template-layout/index.js +22 -13
  45. package/components/form-item-renderer-template-layout/src/ctx.d.ts +3 -2
  46. package/components/form-item-renderer-template-layout/src/ctx.js +1 -1
  47. package/components/form-item-renderer-template-layout/src/index.vue.d.ts +18 -6
  48. package/components/input/index.js +23 -4
  49. package/components/input/src/ctx.d.ts +90 -48
  50. package/components/input/src/ctx.js +13 -1
  51. package/components/input/src/index.vue.d.ts +214 -117
  52. package/components/input-number/index.css +17 -0
  53. package/components/input-number/index.js +32 -5
  54. package/components/input-number/src/ctx.d.ts +22 -10
  55. package/components/input-number/src/ctx.js +13 -1
  56. package/components/input-number/src/index.vue.d.ts +92 -32
  57. package/components/radio/index.css +29 -0
  58. package/components/radio/index.d.ts +4 -0
  59. package/components/radio/index.js +121 -0
  60. package/components/radio/src/ctx.d.ts +77 -0
  61. package/components/radio/src/ctx.js +39 -0
  62. package/components/radio/src/index.vue.d.ts +204 -0
  63. package/components/radio/src/types.d.ts +1 -0
  64. package/components/radio/src/types.js +1 -0
  65. package/components/select/index.css +11 -0
  66. package/components/select/index.js +23 -7
  67. package/components/select/src/ctx.d.ts +34 -26
  68. package/components/select/src/index.vue.d.ts +170 -102
  69. package/components/switch/index.css +11 -0
  70. package/components/switch/index.js +41 -13
  71. package/components/switch/src/ctx.d.ts +48 -11
  72. package/components/switch/src/ctx.js +15 -2
  73. package/components/switch/src/index.vue.d.ts +150 -36
  74. package/components/upload/index.css +20 -0
  75. package/components/upload/index.d.ts +5 -0
  76. package/components/upload/index.js +496 -0
  77. package/components/upload/src/ctx.d.ts +173 -0
  78. package/components/upload/src/ctx.js +41 -0
  79. package/components/upload/src/file.vue.d.ts +96 -0
  80. package/components/upload/src/index.vue.d.ts +421 -0
  81. package/components/upload/src/types.d.ts +1 -0
  82. package/components/upload/src/types.js +1 -0
  83. package/composables/index.d.ts +1 -0
  84. package/composables/index.js +318 -7
  85. package/composables/useForm.d.ts +9 -0
  86. package/composables/useSourceManager.d.ts +2 -0
  87. package/index.css +137 -0
  88. package/index.d.ts +1 -0
  89. package/index.esm.js +4 -1
  90. package/package.json +4 -1
  91. package/shared/default-renderer-source/index.d.ts +12 -0
  92. package/shared/default-renderer-source/index.js +83 -0
  93. package/shared/element-plus/ctx.d.ts +76 -13
  94. package/shared/element-plus/index.js +71 -24
  95. package/shared/element-plus/instances.d.ts +56 -26
  96. package/shared/infer-prop/index.d.ts +17 -0
  97. package/shared/infer-prop/index.js +34 -0
  98. package/shared/types/basic-source/index.d.ts +7 -0
  99. package/shared/types/basic-source/index.js +1 -0
  100. package/shared/types/form/checkbox.d.ts +13 -0
  101. package/shared/types/form/index.d.ts +2 -0
  102. package/shared/types/form/index.js +1 -0
  103. package/shared/types/form/radio.d.ts +8 -0
  104. package/shared/types/index.d.ts +1 -0
  105. package/shared/types/layout-source/index.d.ts +6 -4
  106. package/shared/types/renderer-source/button.d.ts +7 -0
  107. package/shared/types/renderer-source/checkbox.d.ts +7 -0
  108. package/shared/types/renderer-source/color-picker.d.ts +7 -0
  109. package/shared/types/renderer-source/compoent.d.ts +3 -0
  110. package/shared/types/renderer-source/date-picker.d.ts +3 -2
  111. package/shared/types/renderer-source/index.d.ts +11 -1
  112. package/shared/types/renderer-source/input-number.d.ts +3 -2
  113. package/shared/types/renderer-source/input.d.ts +3 -2
  114. package/shared/types/renderer-source/radio.d.ts +7 -0
  115. package/shared/types/renderer-source/select.d.ts +3 -2
  116. package/shared/types/renderer-source/switch.d.ts +3 -2
  117. package/shared/types/renderer-source/upload.d.ts +7 -0
@@ -0,0 +1,496 @@
1
+ import { _VkfFormItemCtx, VkfFormItem } from '@vunk/form/components/form-item';
2
+ import { bindPropsFactory, onEmitsFactory } from '@vunk/core/shared/utils-vue';
3
+ import { uploadProps, ElProgress, ElIcon, useNamespace, useLocale, ElUpload, ElLink } from 'element-plus';
4
+ import { openBlock, createElementBlock, createElementVNode, defineComponent, resolveComponent, Fragment, createCommentVNode, normalizeClass, createBlock, withModifiers, createVNode, withCtx, toDisplayString, normalizeStyle, shallowRef, normalizeProps, guardReactiveProps, mergeProps, createSlots, renderSlot, createTextVNode } from 'vue';
5
+ import { pickObject } from '@vunk/core/shared/utils-object';
6
+ import { createUploadBindProps } from '@vunk/form/shared/element-plus';
7
+ import { NOOP } from '@vunk/core/shared/utils-function';
8
+ import { RestFetch } from '@vunk/core/shared/utils-fetch';
9
+ import { useComputedReadonly } from '@vunk/form/composables';
10
+
11
+ var __defProp = Object.defineProperty;
12
+ var __defProps = Object.defineProperties;
13
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
14
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
15
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
16
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
17
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
18
+ var __spreadValues = (a, b) => {
19
+ for (var prop in b || (b = {}))
20
+ if (__hasOwnProp.call(b, prop))
21
+ __defNormalProp(a, prop, b[prop]);
22
+ if (__getOwnPropSymbols)
23
+ for (var prop of __getOwnPropSymbols(b)) {
24
+ if (__propIsEnum.call(b, prop))
25
+ __defNormalProp(a, prop, b[prop]);
26
+ }
27
+ return a;
28
+ };
29
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
30
+ const props = __spreadProps(__spreadValues(__spreadValues({}, _VkfFormItemCtx.props), uploadProps), {
31
+ tip: {
32
+ type: String,
33
+ default: ""
34
+ },
35
+ preview: {
36
+ type: String,
37
+ default: ""
38
+ }
39
+ });
40
+ const createBindProps = bindPropsFactory(props);
41
+ const emits = {
42
+ "update:fileList": null,
43
+ "remove": (e) => e
44
+ };
45
+ const createOnEmits = onEmitsFactory(emits);
46
+
47
+ var ctx = /*#__PURE__*/Object.freeze({
48
+ __proto__: null,
49
+ props: props,
50
+ createBindProps: createBindProps,
51
+ emits: emits,
52
+ createOnEmits: createOnEmits
53
+ });
54
+
55
+ /*! Element Plus Icons Vue v2.0.9 */
56
+
57
+ // unplugin-vue:/plugin-vue/export-helper
58
+ var export_helper_default = (sfc, props) => {
59
+ let target = sfc.__vccOpts || sfc;
60
+ for (let [key, val] of props)
61
+ target[key] = val;
62
+ return target;
63
+ };
64
+ var _sfc_main43 = {
65
+ name: "Check"
66
+ }, _hoisted_143 = {
67
+ viewBox: "0 0 1024 1024",
68
+ xmlns: "http://www.w3.org/2000/svg"
69
+ }, _hoisted_243 = /* @__PURE__ */ createElementVNode("path", {
70
+ fill: "currentColor",
71
+ d: "M406.656 706.944 195.84 496.256a32 32 0 1 0-45.248 45.248l256 256 512-512a32 32 0 0 0-45.248-45.248L406.592 706.944z"
72
+ }, null, -1), _hoisted_342 = [
73
+ _hoisted_243
74
+ ];
75
+ function _sfc_render43(_ctx, _cache, $props, $setup, $data, $options) {
76
+ return openBlock(), createElementBlock("svg", _hoisted_143, _hoisted_342);
77
+ }
78
+ var check_default = /* @__PURE__ */ export_helper_default(_sfc_main43, [["render", _sfc_render43], ["__file", "check.vue"]]);
79
+ var _sfc_main49 = {
80
+ name: "CircleCheck"
81
+ }, _hoisted_149 = {
82
+ viewBox: "0 0 1024 1024",
83
+ xmlns: "http://www.w3.org/2000/svg"
84
+ }, _hoisted_249 = /* @__PURE__ */ createElementVNode("path", {
85
+ fill: "currentColor",
86
+ d: "M512 896a384 384 0 1 0 0-768 384 384 0 0 0 0 768zm0 64a448 448 0 1 1 0-896 448 448 0 0 1 0 896z"
87
+ }, null, -1), _hoisted_348 = /* @__PURE__ */ createElementVNode("path", {
88
+ fill: "currentColor",
89
+ d: "M745.344 361.344a32 32 0 0 1 45.312 45.312l-288 288a32 32 0 0 1-45.312 0l-160-160a32 32 0 1 1 45.312-45.312L480 626.752l265.344-265.408z"
90
+ }, null, -1), _hoisted_415 = [
91
+ _hoisted_249,
92
+ _hoisted_348
93
+ ];
94
+ function _sfc_render49(_ctx, _cache, $props, $setup, $data, $options) {
95
+ return openBlock(), createElementBlock("svg", _hoisted_149, _hoisted_415);
96
+ }
97
+ var circle_check_default = /* @__PURE__ */ export_helper_default(_sfc_main49, [["render", _sfc_render49], ["__file", "circle-check.vue"]]);
98
+ var _sfc_main56 = {
99
+ name: "Close"
100
+ }, _hoisted_156 = {
101
+ viewBox: "0 0 1024 1024",
102
+ xmlns: "http://www.w3.org/2000/svg"
103
+ }, _hoisted_256 = /* @__PURE__ */ createElementVNode("path", {
104
+ fill: "currentColor",
105
+ d: "M764.288 214.592 512 466.88 259.712 214.592a31.936 31.936 0 0 0-45.12 45.12L466.752 512 214.528 764.224a31.936 31.936 0 1 0 45.12 45.184L512 557.184l252.288 252.288a31.936 31.936 0 0 0 45.12-45.12L557.12 512.064l252.288-252.352a31.936 31.936 0 1 0-45.12-45.184z"
106
+ }, null, -1), _hoisted_355 = [
107
+ _hoisted_256
108
+ ];
109
+ function _sfc_render56(_ctx, _cache, $props, $setup, $data, $options) {
110
+ return openBlock(), createElementBlock("svg", _hoisted_156, _hoisted_355);
111
+ }
112
+ var close_default = /* @__PURE__ */ export_helper_default(_sfc_main56, [["render", _sfc_render56], ["__file", "close.vue"]]);
113
+ var _sfc_main80 = {
114
+ name: "Delete"
115
+ }, _hoisted_180 = {
116
+ viewBox: "0 0 1024 1024",
117
+ xmlns: "http://www.w3.org/2000/svg"
118
+ }, _hoisted_280 = /* @__PURE__ */ createElementVNode("path", {
119
+ fill: "currentColor",
120
+ d: "M160 256H96a32 32 0 0 1 0-64h256V95.936a32 32 0 0 1 32-32h256a32 32 0 0 1 32 32V192h256a32 32 0 1 1 0 64h-64v672a32 32 0 0 1-32 32H192a32 32 0 0 1-32-32V256zm448-64v-64H416v64h192zM224 896h576V256H224v640zm192-128a32 32 0 0 1-32-32V416a32 32 0 0 1 64 0v320a32 32 0 0 1-32 32zm192 0a32 32 0 0 1-32-32V416a32 32 0 0 1 64 0v320a32 32 0 0 1-32 32z"
121
+ }, null, -1), _hoisted_379 = [
122
+ _hoisted_280
123
+ ];
124
+ function _sfc_render80(_ctx, _cache, $props, $setup, $data, $options) {
125
+ return openBlock(), createElementBlock("svg", _hoisted_180, _hoisted_379);
126
+ }
127
+ var delete_default = /* @__PURE__ */ export_helper_default(_sfc_main80, [["render", _sfc_render80], ["__file", "delete.vue"]]);
128
+ var _sfc_main90 = {
129
+ name: "Document"
130
+ }, _hoisted_190 = {
131
+ viewBox: "0 0 1024 1024",
132
+ xmlns: "http://www.w3.org/2000/svg"
133
+ }, _hoisted_290 = /* @__PURE__ */ createElementVNode("path", {
134
+ fill: "currentColor",
135
+ d: "M832 384H576V128H192v768h640V384zm-26.496-64L640 154.496V320h165.504zM160 64h480l256 256v608a32 32 0 0 1-32 32H160a32 32 0 0 1-32-32V96a32 32 0 0 1 32-32zm160 448h384v64H320v-64zm0-192h160v64H320v-64zm0 384h384v64H320v-64z"
136
+ }, null, -1), _hoisted_389 = [
137
+ _hoisted_290
138
+ ];
139
+ function _sfc_render90(_ctx, _cache, $props, $setup, $data, $options) {
140
+ return openBlock(), createElementBlock("svg", _hoisted_190, _hoisted_389);
141
+ }
142
+ var document_default = /* @__PURE__ */ export_helper_default(_sfc_main90, [["render", _sfc_render90], ["__file", "document.vue"]]);
143
+ var _sfc_main91 = {
144
+ name: "Download"
145
+ }, _hoisted_191 = {
146
+ viewBox: "0 0 1024 1024",
147
+ xmlns: "http://www.w3.org/2000/svg"
148
+ }, _hoisted_291 = /* @__PURE__ */ createElementVNode("path", {
149
+ fill: "currentColor",
150
+ d: "M160 832h704a32 32 0 1 1 0 64H160a32 32 0 1 1 0-64zm384-253.696 236.288-236.352 45.248 45.248L508.8 704 192 387.2l45.248-45.248L480 584.704V128h64v450.304z"
151
+ }, null, -1), _hoisted_390 = [
152
+ _hoisted_291
153
+ ];
154
+ function _sfc_render91(_ctx, _cache, $props, $setup, $data, $options) {
155
+ return openBlock(), createElementBlock("svg", _hoisted_191, _hoisted_390);
156
+ }
157
+ var download_default = /* @__PURE__ */ export_helper_default(_sfc_main91, [["render", _sfc_render91], ["__file", "download.vue"]]);
158
+ var _sfc_main292 = {
159
+ name: "ZoomIn"
160
+ }, _hoisted_1292 = {
161
+ viewBox: "0 0 1024 1024",
162
+ xmlns: "http://www.w3.org/2000/svg"
163
+ }, _hoisted_2292 = /* @__PURE__ */ createElementVNode("path", {
164
+ fill: "currentColor",
165
+ d: "m795.904 750.72 124.992 124.928a32 32 0 0 1-45.248 45.248L750.656 795.904a416 416 0 1 1 45.248-45.248zM480 832a352 352 0 1 0 0-704 352 352 0 0 0 0 704zm-32-384v-96a32 32 0 0 1 64 0v96h96a32 32 0 0 1 0 64h-96v96a32 32 0 0 1-64 0v-96h-96a32 32 0 0 1 0-64h96z"
166
+ }, null, -1), _hoisted_3291 = [
167
+ _hoisted_2292
168
+ ];
169
+ function _sfc_render292(_ctx, _cache, $props, $setup, $data, $options) {
170
+ return openBlock(), createElementBlock("svg", _hoisted_1292, _hoisted_3291);
171
+ }
172
+ var zoom_in_default = /* @__PURE__ */ export_helper_default(_sfc_main292, [["render", _sfc_render292], ["__file", "zoom-in.vue"]]);
173
+
174
+ const restFetch = new RestFetch({
175
+ baseURL: ""
176
+ });
177
+ var script$1 = defineComponent({
178
+ components: {
179
+ ElProgress,
180
+ ElIcon,
181
+ Check: check_default,
182
+ ZoomIn: zoom_in_default,
183
+ Delete: delete_default,
184
+ Close: close_default,
185
+ CircleCheck: circle_check_default,
186
+ Document: document_default,
187
+ Download: download_default
188
+ },
189
+ props: {
190
+ listType: {
191
+ type: String,
192
+ default: "text"
193
+ },
194
+ file: {
195
+ type: Object,
196
+ default: () => ({})
197
+ },
198
+ disabled: {
199
+ type: Boolean,
200
+ default: false
201
+ },
202
+ onPreview: {
203
+ type: Function,
204
+ default: () => NOOP
205
+ },
206
+ preview: {
207
+ type: Boolean,
208
+ default: false
209
+ }
210
+ },
211
+ emits: {
212
+ "remove": (e) => e
213
+ },
214
+ setup(props, { emit }) {
215
+ const nsUpload = useNamespace("upload");
216
+ const nsIcon = useNamespace("icon");
217
+ const { t } = useLocale();
218
+ const handleRemove = (file = props.file) => {
219
+ emit("remove", file);
220
+ };
221
+ const handleDownload = (file = props.file) => {
222
+ let url = "";
223
+ if (file.url) {
224
+ url = file.url;
225
+ } else if (file.raw) {
226
+ url = window.URL.createObjectURL(file.raw);
227
+ }
228
+ url && restFetch.download({
229
+ url,
230
+ fileName: file.name
231
+ }, {
232
+ method: "GET"
233
+ });
234
+ };
235
+ return {
236
+ handleRemove,
237
+ t,
238
+ nsIcon,
239
+ nsUpload,
240
+ handleDownload
241
+ };
242
+ }
243
+ });
244
+
245
+ const _hoisted_1$1 = ["src"];
246
+ function render$1(_ctx, _cache, $props, $setup, $data, $options) {
247
+ const _component_Document = resolveComponent("Document");
248
+ const _component_el_icon = resolveComponent("el-icon");
249
+ const _component_Download = resolveComponent("Download");
250
+ const _component_el_progress = resolveComponent("el-progress");
251
+ const _component_circle_check = resolveComponent("circle-check");
252
+ const _component_Check = resolveComponent("Check");
253
+ const _component_Close = resolveComponent("Close");
254
+ const _component_zoom_in = resolveComponent("zoom-in");
255
+ const _component_Delete = resolveComponent("Delete");
256
+ return openBlock(), createElementBlock(Fragment, null, [
257
+ createCommentVNode(" picture "),
258
+ _ctx.listType === "picture" || _ctx.file.status !== "uploading" && _ctx.listType === "picture-card" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
259
+ /\.(svg|png|jpg|jpeg)$/.test(_ctx.file.name) ? (openBlock(), createElementBlock("img", {
260
+ key: 0,
261
+ class: normalizeClass(_ctx.nsUpload.be("list", "item-thumbnail")),
262
+ src: _ctx.file.url,
263
+ alt: ""
264
+ }, null, 10, _hoisted_1$1)) : (openBlock(), createBlock(_component_Document, { key: 1 }))
265
+ ], 64)) : createCommentVNode("v-if", true),
266
+ createCommentVNode(" text "),
267
+ _ctx.listType !== "picture" && (_ctx.file.status === "uploading" || _ctx.listType !== "picture-card") ? (openBlock(), createElementBlock("div", {
268
+ key: 1,
269
+ class: normalizeClass(_ctx.nsUpload.be("list", "item-info"))
270
+ }, [
271
+ createElementVNode("a", {
272
+ class: normalizeClass(_ctx.nsUpload.be("list", "item-name")),
273
+ onClick: _cache[1] || (_cache[1] = withModifiers(($event) => _ctx.onPreview(_ctx.file), ["prevent"]))
274
+ }, [
275
+ createVNode(_component_el_icon, {
276
+ class: normalizeClass(_ctx.nsIcon.m("document"))
277
+ }, {
278
+ default: withCtx(() => [
279
+ createVNode(_component_Document)
280
+ ]),
281
+ _: 1
282
+ }, 8, ["class"]),
283
+ createVNode(_component_el_icon, {
284
+ class: normalizeClass([
285
+ _ctx.nsIcon.m("download"),
286
+ _ctx.nsIcon.m("download-primary")
287
+ ]),
288
+ onClick: _cache[0] || (_cache[0] = ($event) => _ctx.handleDownload(_ctx.file))
289
+ }, {
290
+ default: withCtx(() => [
291
+ createVNode(_component_Download)
292
+ ]),
293
+ _: 1
294
+ }, 8, ["class"]),
295
+ createElementVNode("span", {
296
+ class: normalizeClass(_ctx.nsUpload.be("list", "item-file-name"))
297
+ }, toDisplayString(_ctx.file.name), 3)
298
+ ], 2),
299
+ _ctx.file.status === "uploading" ? (openBlock(), createBlock(_component_el_progress, {
300
+ key: 0,
301
+ type: _ctx.listType === "picture-card" ? "circle" : "line",
302
+ "stroke-width": _ctx.listType === "picture-card" ? 6 : 2,
303
+ percentage: Number(_ctx.file.percentage),
304
+ style: normalizeStyle(_ctx.listType === "picture-card" ? "" : "margin-top: 0.5rem")
305
+ }, null, 8, ["type", "stroke-width", "percentage", "style"])) : createCommentVNode("v-if", true)
306
+ ], 2)) : createCommentVNode("v-if", true),
307
+ createElementVNode("label", {
308
+ class: normalizeClass(_ctx.nsUpload.be("list", "item-status-label"))
309
+ }, [
310
+ _ctx.listType === "text" ? (openBlock(), createBlock(_component_el_icon, {
311
+ key: 0,
312
+ class: normalizeClass([
313
+ _ctx.nsIcon.m("upload-success"),
314
+ _ctx.nsIcon.m("circle-check")
315
+ ])
316
+ }, {
317
+ default: withCtx(() => [
318
+ createVNode(_component_circle_check)
319
+ ]),
320
+ _: 1
321
+ }, 8, ["class"])) : ["picture-card", "picture"].includes(_ctx.listType) ? (openBlock(), createBlock(_component_el_icon, {
322
+ key: 1,
323
+ class: normalizeClass([_ctx.nsIcon.m("upload-success"), _ctx.nsIcon.m("check")])
324
+ }, {
325
+ default: withCtx(() => [
326
+ createVNode(_component_Check)
327
+ ]),
328
+ _: 1
329
+ }, 8, ["class"])) : createCommentVNode("v-if", true)
330
+ ], 2),
331
+ !_ctx.disabled ? (openBlock(), createBlock(_component_el_icon, {
332
+ key: 2,
333
+ class: normalizeClass(_ctx.nsIcon.m("close")),
334
+ onClick: _ctx.handleRemove
335
+ }, {
336
+ default: withCtx(() => [
337
+ createVNode(_component_Close)
338
+ ]),
339
+ _: 1
340
+ }, 8, ["class", "onClick"])) : createCommentVNode("v-if", true),
341
+ createCommentVNode(" Due to close btn only appears when li gets focused disappears after li gets blurred, thus keyboard navigation can never reach close btn"),
342
+ createCommentVNode(" This is a bug which needs to be fixed "),
343
+ createCommentVNode(" TODO: Fix the incorrect navigation interaction "),
344
+ createCommentVNode(` <i v-if="!disabled" :class="nsIcon.m('close-tip')">{{\r
345
+ t('el.upload.deleteTip')\r
346
+ }}</i> `),
347
+ createCommentVNode(" picture-card "),
348
+ _ctx.listType === "picture-card" ? (openBlock(), createElementBlock("span", {
349
+ key: 3,
350
+ class: normalizeClass(_ctx.nsUpload.be("list", "item-actions"))
351
+ }, [
352
+ _ctx.preview ? (openBlock(), createElementBlock("span", {
353
+ key: 0,
354
+ class: normalizeClass(_ctx.nsUpload.be("list", "item-preview")),
355
+ onClick: _cache[2] || (_cache[2] = ($event) => _ctx.onPreview(_ctx.file))
356
+ }, [
357
+ createVNode(_component_el_icon, {
358
+ class: normalizeClass(_ctx.nsIcon.m("zoom-in"))
359
+ }, {
360
+ default: withCtx(() => [
361
+ createVNode(_component_zoom_in)
362
+ ]),
363
+ _: 1
364
+ }, 8, ["class"])
365
+ ], 2)) : createCommentVNode("v-if", true),
366
+ createCommentVNode(" \u4E0B\u8F7D "),
367
+ createElementVNode("span", {
368
+ class: normalizeClass(_ctx.nsUpload.be("list", "item-download")),
369
+ onClick: _cache[3] || (_cache[3] = ($event) => _ctx.handleDownload(_ctx.file))
370
+ }, [
371
+ createVNode(_component_el_icon, {
372
+ class: normalizeClass(_ctx.nsIcon.m("download"))
373
+ }, {
374
+ default: withCtx(() => [
375
+ createVNode(_component_Download)
376
+ ]),
377
+ _: 1
378
+ }, 8, ["class"])
379
+ ], 2),
380
+ !_ctx.disabled ? (openBlock(), createElementBlock("span", {
381
+ key: 1,
382
+ class: normalizeClass(_ctx.nsUpload.be("list", "item-delete")),
383
+ onClick: _cache[4] || (_cache[4] = ($event) => _ctx.handleRemove(_ctx.file))
384
+ }, [
385
+ createVNode(_component_el_icon, {
386
+ class: normalizeClass(_ctx.nsIcon.m("delete"))
387
+ }, {
388
+ default: withCtx(() => [
389
+ createVNode(_component_Delete)
390
+ ]),
391
+ _: 1
392
+ }, 8, ["class"])
393
+ ], 2)) : createCommentVNode("v-if", true)
394
+ ], 2)) : createCommentVNode("v-if", true)
395
+ ], 64);
396
+ }
397
+
398
+ script$1.render = render$1;
399
+ script$1.__file = "upload/src/file.vue";
400
+
401
+ var script = defineComponent({
402
+ name: "VkfUpload",
403
+ components: {
404
+ VkfFormItem,
405
+ ElUpload,
406
+ FileVue: script$1,
407
+ ElLink
408
+ },
409
+ emits,
410
+ props,
411
+ setup(props2) {
412
+ const formItemBindProps = _VkfFormItemCtx.createBindProps(props2);
413
+ const coreBindProps = createUploadBindProps(props2, ["disabled", "fileList"]);
414
+ const uploadRef = shallowRef();
415
+ const handleRemove = (file) => {
416
+ var _a;
417
+ (_a = uploadRef.value) == null ? void 0 : _a.handleRemove(file);
418
+ };
419
+ const readonly = useComputedReadonly(props2);
420
+ return {
421
+ formItemBindProps,
422
+ pickObject,
423
+ coreBindProps,
424
+ uploadRef,
425
+ handleRemove,
426
+ readonly
427
+ };
428
+ }
429
+ });
430
+
431
+ const _hoisted_1 = /* @__PURE__ */ createTextVNode("+ \u9009\u62E9\u6587\u4EF6");
432
+ const _hoisted_2 = { class: "el-upload__tip" };
433
+ function render(_ctx, _cache, $props, $setup, $data, $options) {
434
+ const _component_ElLink = resolveComponent("ElLink");
435
+ const _component_FileVue = resolveComponent("FileVue");
436
+ const _component_ElUpload = resolveComponent("ElUpload");
437
+ const _component_VkfFormItem = resolveComponent("VkfFormItem");
438
+ return openBlock(), createBlock(_component_VkfFormItem, normalizeProps(guardReactiveProps(_ctx.formItemBindProps)), {
439
+ default: withCtx(() => {
440
+ var _a;
441
+ return [
442
+ createVNode(_component_ElUpload, mergeProps({
443
+ class: ["vkf-upload", {
444
+ "is-readonly": _ctx.readonly
445
+ }]
446
+ }, _ctx.coreBindProps, {
447
+ fileList: (_a = _ctx.fileList) != null ? _a : [],
448
+ "onUpdate:fileList": _cache[0] || (_cache[0] = ($event) => _ctx.$emit("update:fileList", $event)),
449
+ ref: "uploadRef",
450
+ disabled: _ctx.readonly || _ctx.disabled
451
+ }), createSlots({
452
+ file: withCtx(({ file }) => [
453
+ createVNode(_component_FileVue, {
454
+ file,
455
+ listType: _ctx.listType,
456
+ disabled: _ctx.readonly || _ctx.disabled,
457
+ onPreview: _ctx.onPreview,
458
+ onRemove: _ctx.handleRemove
459
+ }, null, 8, ["file", "listType", "disabled", "onPreview", "onRemove"])
460
+ ]),
461
+ default: withCtx(() => [
462
+ createVNode(_component_ElLink, { type: "primary" }, {
463
+ default: withCtx(() => [
464
+ _hoisted_1
465
+ ]),
466
+ _: 1
467
+ }),
468
+ renderSlot(_ctx.$slots, "default")
469
+ ]),
470
+ _: 2
471
+ }, [
472
+ _ctx.tip ? {
473
+ name: "tip",
474
+ fn: withCtx(() => [
475
+ createElementVNode("div", _hoisted_2, toDisplayString(_ctx.tip), 1)
476
+ ])
477
+ } : void 0
478
+ ]), 1040, ["class", "fileList", "disabled"])
479
+ ];
480
+ }),
481
+ _: 3
482
+ }, 16);
483
+ }
484
+
485
+ script.render = render;
486
+ script.__file = "upload/src/index.vue";
487
+
488
+ var types = /*#__PURE__*/Object.freeze({
489
+ __proto__: null
490
+ });
491
+
492
+ script.install = (app) => {
493
+ app.component(script.name, script);
494
+ };
495
+
496
+ export { script as VkfUpload, ctx as _VkfUploadCtx, types as __VkfUpload, script as default };