@vunk/form 0.0.1-alpha.4 → 0.0.1-alpha.41

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 (138) hide show
  1. package/components/button/index.d.ts +4 -0
  2. package/components/button/index.js +126 -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/cascader/index.d.ts +4 -0
  9. package/components/cascader/index.js +108 -0
  10. package/components/cascader/src/ctx.d.ts +130 -0
  11. package/components/cascader/src/ctx.js +38 -0
  12. package/components/cascader/src/index.vue.d.ts +313 -0
  13. package/components/cascader/src/types.d.ts +1 -0
  14. package/components/cascader/src/types.js +1 -0
  15. package/components/checkbox/index.css +38 -0
  16. package/components/checkbox/index.d.ts +4 -0
  17. package/components/checkbox/index.js +127 -0
  18. package/components/checkbox/src/ctx.d.ts +82 -0
  19. package/components/checkbox/src/ctx.js +43 -0
  20. package/components/checkbox/src/index.vue.d.ts +213 -0
  21. package/components/checkbox/src/types.d.ts +1 -0
  22. package/components/checkbox/src/types.js +1 -0
  23. package/components/color-picker/index.d.ts +4 -0
  24. package/components/color-picker/index.js +77 -0
  25. package/components/color-picker/src/ctx.d.ts +74 -0
  26. package/components/color-picker/src/ctx.js +23 -0
  27. package/components/color-picker/src/index.vue.d.ts +196 -0
  28. package/components/color-picker/src/types.d.ts +1 -0
  29. package/components/color-picker/src/types.js +1 -0
  30. package/components/date-picker/index.js +26 -15
  31. package/components/date-picker/src/ctx.d.ts +64 -57
  32. package/components/date-picker/src/ctx.js +1 -1
  33. package/components/date-picker/src/index.vue.d.ts +183 -153
  34. package/components/date-picker/src/types.d.ts +7 -7
  35. package/components/firt-ep/index.d.ts +4 -0
  36. package/components/firt-ep/index.js +80 -0
  37. package/components/firt-ep/src/ctx.d.ts +9 -0
  38. package/components/firt-ep/src/ctx.js +9 -0
  39. package/components/firt-ep/src/index.vue.d.ts +19 -0
  40. package/components/firt-ep/src/types.d.ts +1 -0
  41. package/components/firt-ep/src/types.js +1 -0
  42. package/components/form/index.js +37 -16
  43. package/components/form/src/ctx.d.ts +95 -81
  44. package/components/form/src/ctx.js +5 -2
  45. package/components/form/src/index.vue.d.ts +284 -250
  46. package/components/form-item/index.css +4 -0
  47. package/components/form-item/index.js +34 -13
  48. package/components/form-item/src/ctx.d.ts +15 -7
  49. package/components/form-item/src/ctx.js +8 -0
  50. package/components/form-item/src/index.vue.d.ts +44 -14
  51. package/components/form-item-renderer/index.js +34 -30
  52. package/components/form-item-renderer/src/ctx.d.ts +3 -3
  53. package/components/form-item-renderer/src/index.vue.d.ts +8 -8
  54. package/components/form-item-renderer/src/types.d.ts +2 -0
  55. package/components/form-item-renderer-template/index.js +13 -6
  56. package/components/form-item-renderer-template/src/index.vue.d.ts +1 -1
  57. package/components/form-item-renderer-template-default/index.js +130 -31
  58. package/components/form-item-renderer-template-default/src/index.vue.d.ts +7 -7
  59. package/components/form-item-renderer-template-layout/index.js +41 -24
  60. package/components/form-item-renderer-template-layout/src/ctx.d.ts +3 -2
  61. package/components/form-item-renderer-template-layout/src/ctx.js +1 -1
  62. package/components/form-item-renderer-template-layout/src/index.vue.d.ts +18 -6
  63. package/components/input/index.js +39 -14
  64. package/components/input/src/ctx.d.ts +96 -49
  65. package/components/input/src/ctx.js +13 -1
  66. package/components/input/src/index.vue.d.ts +234 -128
  67. package/components/input-number/index.css +17 -0
  68. package/components/input-number/index.js +46 -14
  69. package/components/input-number/src/ctx.d.ts +28 -16
  70. package/components/input-number/src/ctx.js +13 -1
  71. package/components/input-number/src/index.vue.d.ts +104 -44
  72. package/components/radio/index.css +29 -0
  73. package/components/radio/index.d.ts +4 -0
  74. package/components/radio/index.js +123 -0
  75. package/components/radio/src/ctx.d.ts +77 -0
  76. package/components/radio/src/ctx.js +39 -0
  77. package/components/radio/src/index.vue.d.ts +204 -0
  78. package/components/radio/src/types.d.ts +1 -0
  79. package/components/radio/src/types.js +1 -0
  80. package/components/select/index.css +11 -0
  81. package/components/select/index.js +69 -49
  82. package/components/select/src/ctx.d.ts +48 -36
  83. package/components/select/src/ctx.js +4 -0
  84. package/components/select/src/index.vue.d.ts +206 -129
  85. package/components/switch/index.css +11 -0
  86. package/components/switch/index.js +44 -16
  87. package/components/switch/src/ctx.d.ts +46 -11
  88. package/components/switch/src/ctx.js +13 -2
  89. package/components/switch/src/index.vue.d.ts +147 -37
  90. package/components/upload/index.css +29 -0
  91. package/components/upload/index.d.ts +5 -0
  92. package/components/upload/index.js +522 -0
  93. package/components/upload/src/ctx.d.ts +173 -0
  94. package/components/upload/src/ctx.js +41 -0
  95. package/components/upload/src/file.vue.d.ts +96 -0
  96. package/components/upload/src/index.vue.d.ts +421 -0
  97. package/components/upload/src/types.d.ts +1 -0
  98. package/components/upload/src/types.js +1 -0
  99. package/composables/index.d.ts +1 -0
  100. package/composables/index.js +311 -7
  101. package/composables/useForm.d.ts +9 -0
  102. package/composables/useSourceManager.d.ts +2 -0
  103. package/index.css +146 -0
  104. package/index.d.ts +1 -0
  105. package/index.esm.js +4 -1
  106. package/package.json +4 -1
  107. package/shared/default-renderer-source/index.d.ts +12 -0
  108. package/shared/default-renderer-source/index.js +83 -0
  109. package/shared/element-plus/ctx.d.ts +86 -13
  110. package/shared/element-plus/index.js +18165 -32
  111. package/shared/element-plus/instances.d.ts +129 -27
  112. package/shared/infer-prop/index.d.ts +17 -0
  113. package/shared/infer-prop/index.js +34 -0
  114. package/shared/types/basic-source/index.d.ts +7 -0
  115. package/shared/types/basic-source/index.js +1 -0
  116. package/shared/types/ep-source/el-divider.d.ts +7 -0
  117. package/shared/types/ep-source/el-link.d.ts +8 -0
  118. package/shared/types/ep-source/index.d.ts +3 -0
  119. package/shared/types/ep-source/index.js +1 -0
  120. package/shared/types/form/checkbox.d.ts +13 -0
  121. package/shared/types/form/index.d.ts +2 -0
  122. package/shared/types/form/index.js +1 -0
  123. package/shared/types/form/radio.d.ts +8 -0
  124. package/shared/types/index.d.ts +2 -0
  125. package/shared/types/layout-source/index.d.ts +6 -4
  126. package/shared/types/renderer-source/button.d.ts +7 -0
  127. package/shared/types/renderer-source/cascader.d.ts +7 -0
  128. package/shared/types/renderer-source/checkbox.d.ts +7 -0
  129. package/shared/types/renderer-source/color-picker.d.ts +7 -0
  130. package/shared/types/renderer-source/compoent.d.ts +3 -0
  131. package/shared/types/renderer-source/date-picker.d.ts +3 -2
  132. package/shared/types/renderer-source/index.d.ts +13 -1
  133. package/shared/types/renderer-source/input-number.d.ts +3 -2
  134. package/shared/types/renderer-source/input.d.ts +3 -2
  135. package/shared/types/renderer-source/radio.d.ts +7 -0
  136. package/shared/types/renderer-source/select.d.ts +3 -2
  137. package/shared/types/renderer-source/switch.d.ts +3 -2
  138. package/shared/types/renderer-source/upload.d.ts +7 -0
@@ -0,0 +1,522 @@
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, createTextVNode, renderSlot } 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.10 */
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
+
65
+ // unplugin-vue:/home/runner/work/element-plus-icons/element-plus-icons/packages/vue/src/components/check.vue?vue&type=script&lang.ts
66
+ var check_vue_vue_type_script_lang_default = {
67
+ name: "Check"
68
+ };
69
+ var _hoisted_143 = {
70
+ viewBox: "0 0 1024 1024",
71
+ xmlns: "http://www.w3.org/2000/svg"
72
+ }, _hoisted_243 = /* @__PURE__ */ createElementVNode("path", {
73
+ fill: "currentColor",
74
+ 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"
75
+ }, null, -1), _hoisted_342 = [
76
+ _hoisted_243
77
+ ];
78
+ function _sfc_render43(_ctx, _cache, $props, $setup, $data, $options) {
79
+ return openBlock(), createElementBlock("svg", _hoisted_143, _hoisted_342);
80
+ }
81
+ var check_default = /* @__PURE__ */ export_helper_default(check_vue_vue_type_script_lang_default, [["render", _sfc_render43], ["__file", "check.vue"]]);
82
+
83
+ // unplugin-vue:/home/runner/work/element-plus-icons/element-plus-icons/packages/vue/src/components/circle-check.vue?vue&type=script&lang.ts
84
+ var circle_check_vue_vue_type_script_lang_default = {
85
+ name: "CircleCheck"
86
+ };
87
+ var _hoisted_149 = {
88
+ viewBox: "0 0 1024 1024",
89
+ xmlns: "http://www.w3.org/2000/svg"
90
+ }, _hoisted_249 = /* @__PURE__ */ createElementVNode("path", {
91
+ fill: "currentColor",
92
+ 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"
93
+ }, null, -1), _hoisted_348 = /* @__PURE__ */ createElementVNode("path", {
94
+ fill: "currentColor",
95
+ 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"
96
+ }, null, -1), _hoisted_415 = [
97
+ _hoisted_249,
98
+ _hoisted_348
99
+ ];
100
+ function _sfc_render49(_ctx, _cache, $props, $setup, $data, $options) {
101
+ return openBlock(), createElementBlock("svg", _hoisted_149, _hoisted_415);
102
+ }
103
+ var circle_check_default = /* @__PURE__ */ export_helper_default(circle_check_vue_vue_type_script_lang_default, [["render", _sfc_render49], ["__file", "circle-check.vue"]]);
104
+
105
+ // unplugin-vue:/home/runner/work/element-plus-icons/element-plus-icons/packages/vue/src/components/close.vue?vue&type=script&lang.ts
106
+ var close_vue_vue_type_script_lang_default = {
107
+ name: "Close"
108
+ };
109
+ var _hoisted_156 = {
110
+ viewBox: "0 0 1024 1024",
111
+ xmlns: "http://www.w3.org/2000/svg"
112
+ }, _hoisted_256 = /* @__PURE__ */ createElementVNode("path", {
113
+ fill: "currentColor",
114
+ 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"
115
+ }, null, -1), _hoisted_355 = [
116
+ _hoisted_256
117
+ ];
118
+ function _sfc_render56(_ctx, _cache, $props, $setup, $data, $options) {
119
+ return openBlock(), createElementBlock("svg", _hoisted_156, _hoisted_355);
120
+ }
121
+ var close_default = /* @__PURE__ */ export_helper_default(close_vue_vue_type_script_lang_default, [["render", _sfc_render56], ["__file", "close.vue"]]);
122
+
123
+ // unplugin-vue:/home/runner/work/element-plus-icons/element-plus-icons/packages/vue/src/components/delete.vue?vue&type=script&lang.ts
124
+ var delete_vue_vue_type_script_lang_default = {
125
+ name: "Delete"
126
+ };
127
+ var _hoisted_180 = {
128
+ viewBox: "0 0 1024 1024",
129
+ xmlns: "http://www.w3.org/2000/svg"
130
+ }, _hoisted_280 = /* @__PURE__ */ createElementVNode("path", {
131
+ fill: "currentColor",
132
+ 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"
133
+ }, null, -1), _hoisted_379 = [
134
+ _hoisted_280
135
+ ];
136
+ function _sfc_render80(_ctx, _cache, $props, $setup, $data, $options) {
137
+ return openBlock(), createElementBlock("svg", _hoisted_180, _hoisted_379);
138
+ }
139
+ var delete_default = /* @__PURE__ */ export_helper_default(delete_vue_vue_type_script_lang_default, [["render", _sfc_render80], ["__file", "delete.vue"]]);
140
+
141
+ // unplugin-vue:/home/runner/work/element-plus-icons/element-plus-icons/packages/vue/src/components/document.vue?vue&type=script&lang.ts
142
+ var document_vue_vue_type_script_lang_default = {
143
+ name: "Document"
144
+ };
145
+ var _hoisted_190 = {
146
+ viewBox: "0 0 1024 1024",
147
+ xmlns: "http://www.w3.org/2000/svg"
148
+ }, _hoisted_290 = /* @__PURE__ */ createElementVNode("path", {
149
+ fill: "currentColor",
150
+ 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"
151
+ }, null, -1), _hoisted_389 = [
152
+ _hoisted_290
153
+ ];
154
+ function _sfc_render90(_ctx, _cache, $props, $setup, $data, $options) {
155
+ return openBlock(), createElementBlock("svg", _hoisted_190, _hoisted_389);
156
+ }
157
+ var document_default = /* @__PURE__ */ export_helper_default(document_vue_vue_type_script_lang_default, [["render", _sfc_render90], ["__file", "document.vue"]]);
158
+
159
+ // unplugin-vue:/home/runner/work/element-plus-icons/element-plus-icons/packages/vue/src/components/download.vue?vue&type=script&lang.ts
160
+ var download_vue_vue_type_script_lang_default = {
161
+ name: "Download"
162
+ };
163
+ var _hoisted_191 = {
164
+ viewBox: "0 0 1024 1024",
165
+ xmlns: "http://www.w3.org/2000/svg"
166
+ }, _hoisted_291 = /* @__PURE__ */ createElementVNode("path", {
167
+ fill: "currentColor",
168
+ 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"
169
+ }, null, -1), _hoisted_390 = [
170
+ _hoisted_291
171
+ ];
172
+ function _sfc_render91(_ctx, _cache, $props, $setup, $data, $options) {
173
+ return openBlock(), createElementBlock("svg", _hoisted_191, _hoisted_390);
174
+ }
175
+ var download_default = /* @__PURE__ */ export_helper_default(download_vue_vue_type_script_lang_default, [["render", _sfc_render91], ["__file", "download.vue"]]);
176
+
177
+ // unplugin-vue:/home/runner/work/element-plus-icons/element-plus-icons/packages/vue/src/components/zoom-in.vue?vue&type=script&lang.ts
178
+ var zoom_in_vue_vue_type_script_lang_default = {
179
+ name: "ZoomIn"
180
+ };
181
+ var _hoisted_1292 = {
182
+ viewBox: "0 0 1024 1024",
183
+ xmlns: "http://www.w3.org/2000/svg"
184
+ }, _hoisted_2292 = /* @__PURE__ */ createElementVNode("path", {
185
+ fill: "currentColor",
186
+ 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"
187
+ }, null, -1), _hoisted_3291 = [
188
+ _hoisted_2292
189
+ ];
190
+ function _sfc_render292(_ctx, _cache, $props, $setup, $data, $options) {
191
+ return openBlock(), createElementBlock("svg", _hoisted_1292, _hoisted_3291);
192
+ }
193
+ var zoom_in_default = /* @__PURE__ */ export_helper_default(zoom_in_vue_vue_type_script_lang_default, [["render", _sfc_render292], ["__file", "zoom-in.vue"]]);
194
+
195
+ var _export_sfc = (sfc, props) => {
196
+ const target = sfc.__vccOpts || sfc;
197
+ for (const [key, val] of props) {
198
+ target[key] = val;
199
+ }
200
+ return target;
201
+ };
202
+
203
+ const restFetch = new RestFetch({
204
+ baseURL: ""
205
+ });
206
+ const _sfc_main$1 = defineComponent({
207
+ components: {
208
+ ElProgress,
209
+ ElIcon,
210
+ Check: check_default,
211
+ ZoomIn: zoom_in_default,
212
+ Delete: delete_default,
213
+ Close: close_default,
214
+ CircleCheck: circle_check_default,
215
+ Document: document_default,
216
+ Download: download_default
217
+ },
218
+ props: {
219
+ listType: {
220
+ type: String,
221
+ default: "text"
222
+ },
223
+ file: {
224
+ type: Object,
225
+ default: () => ({})
226
+ },
227
+ disabled: {
228
+ type: Boolean,
229
+ default: false
230
+ },
231
+ onPreview: {
232
+ type: Function,
233
+ default: () => NOOP
234
+ },
235
+ preview: {
236
+ type: Boolean,
237
+ default: false
238
+ }
239
+ },
240
+ emits: {
241
+ "remove": (e) => e
242
+ },
243
+ setup(props, { emit }) {
244
+ const nsUpload = useNamespace("upload");
245
+ const nsIcon = useNamespace("icon");
246
+ const { t } = useLocale();
247
+ const handleRemove = (file = props.file) => {
248
+ emit("remove", file);
249
+ };
250
+ const handleDownload = (file = props.file) => {
251
+ let url = "";
252
+ if (file.url) {
253
+ url = file.url;
254
+ } else if (file.raw) {
255
+ url = window.URL.createObjectURL(file.raw);
256
+ }
257
+ url && restFetch.download({
258
+ url,
259
+ fileName: file.name
260
+ }, {
261
+ method: "GET"
262
+ });
263
+ };
264
+ return {
265
+ handleRemove,
266
+ t,
267
+ nsIcon,
268
+ nsUpload,
269
+ handleDownload
270
+ };
271
+ }
272
+ });
273
+ const _hoisted_1$1 = ["src"];
274
+ function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
275
+ const _component_Document = resolveComponent("Document");
276
+ const _component_el_icon = resolveComponent("el-icon");
277
+ const _component_Download = resolveComponent("Download");
278
+ const _component_el_progress = resolveComponent("el-progress");
279
+ const _component_circle_check = resolveComponent("circle-check");
280
+ const _component_Check = resolveComponent("Check");
281
+ const _component_Close = resolveComponent("Close");
282
+ const _component_zoom_in = resolveComponent("zoom-in");
283
+ const _component_Delete = resolveComponent("Delete");
284
+ return openBlock(), createElementBlock(Fragment, null, [
285
+ createCommentVNode(" picture "),
286
+ _ctx.listType === "picture" || _ctx.file.status !== "uploading" && _ctx.listType === "picture-card" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
287
+ /\.(svg|png|jpg|jpeg)$/.test(_ctx.file.name) ? (openBlock(), createElementBlock("img", {
288
+ key: 0,
289
+ class: normalizeClass(_ctx.nsUpload.be("list", "item-thumbnail")),
290
+ src: _ctx.file.url,
291
+ alt: ""
292
+ }, null, 10, _hoisted_1$1)) : (openBlock(), createBlock(_component_Document, { key: 1 }))
293
+ ], 64)) : createCommentVNode("v-if", true),
294
+ createCommentVNode(" text "),
295
+ _ctx.listType !== "picture" && (_ctx.file.status === "uploading" || _ctx.listType !== "picture-card") ? (openBlock(), createElementBlock("div", {
296
+ key: 1,
297
+ class: normalizeClass(_ctx.nsUpload.be("list", "item-info"))
298
+ }, [
299
+ createElementVNode("a", {
300
+ class: normalizeClass(_ctx.nsUpload.be("list", "item-name")),
301
+ onClick: _cache[1] || (_cache[1] = withModifiers(($event) => _ctx.onPreview(_ctx.file), ["prevent"]))
302
+ }, [
303
+ createVNode(_component_el_icon, {
304
+ class: normalizeClass(_ctx.nsIcon.m("document"))
305
+ }, {
306
+ default: withCtx(() => [
307
+ createVNode(_component_Document)
308
+ ]),
309
+ _: 1
310
+ }, 8, ["class"]),
311
+ createVNode(_component_el_icon, {
312
+ class: normalizeClass([
313
+ _ctx.nsIcon.m("download"),
314
+ _ctx.nsIcon.m("download-primary")
315
+ ]),
316
+ onClick: _cache[0] || (_cache[0] = ($event) => _ctx.handleDownload(_ctx.file))
317
+ }, {
318
+ default: withCtx(() => [
319
+ createVNode(_component_Download)
320
+ ]),
321
+ _: 1
322
+ }, 8, ["class"]),
323
+ createElementVNode("span", {
324
+ class: normalizeClass(_ctx.nsUpload.be("list", "item-file-name"))
325
+ }, toDisplayString(_ctx.file.name), 3)
326
+ ], 2),
327
+ _ctx.file.status === "uploading" ? (openBlock(), createBlock(_component_el_progress, {
328
+ key: 0,
329
+ type: _ctx.listType === "picture-card" ? "circle" : "line",
330
+ "stroke-width": _ctx.listType === "picture-card" ? 6 : 2,
331
+ percentage: Number(_ctx.file.percentage),
332
+ style: normalizeStyle(_ctx.listType === "picture-card" ? "" : "margin-top: 0.5rem")
333
+ }, null, 8, ["type", "stroke-width", "percentage", "style"])) : createCommentVNode("v-if", true)
334
+ ], 2)) : createCommentVNode("v-if", true),
335
+ createElementVNode("label", {
336
+ class: normalizeClass(_ctx.nsUpload.be("list", "item-status-label"))
337
+ }, [
338
+ _ctx.listType === "text" ? (openBlock(), createBlock(_component_el_icon, {
339
+ key: 0,
340
+ class: normalizeClass([
341
+ _ctx.nsIcon.m("upload-success"),
342
+ _ctx.nsIcon.m("circle-check")
343
+ ])
344
+ }, {
345
+ default: withCtx(() => [
346
+ createVNode(_component_circle_check)
347
+ ]),
348
+ _: 1
349
+ }, 8, ["class"])) : ["picture-card", "picture"].includes(_ctx.listType) ? (openBlock(), createBlock(_component_el_icon, {
350
+ key: 1,
351
+ class: normalizeClass([_ctx.nsIcon.m("upload-success"), _ctx.nsIcon.m("check")])
352
+ }, {
353
+ default: withCtx(() => [
354
+ createVNode(_component_Check)
355
+ ]),
356
+ _: 1
357
+ }, 8, ["class"])) : createCommentVNode("v-if", true)
358
+ ], 2),
359
+ !_ctx.disabled ? (openBlock(), createBlock(_component_el_icon, {
360
+ key: 2,
361
+ class: normalizeClass(_ctx.nsIcon.m("close")),
362
+ onClick: _ctx.handleRemove
363
+ }, {
364
+ default: withCtx(() => [
365
+ createVNode(_component_Close)
366
+ ]),
367
+ _: 1
368
+ }, 8, ["class", "onClick"])) : createCommentVNode("v-if", true),
369
+ createCommentVNode(" Due to close btn only appears when li gets focused disappears after li gets blurred, thus keyboard navigation can never reach close btn"),
370
+ createCommentVNode(" This is a bug which needs to be fixed "),
371
+ createCommentVNode(" TODO: Fix the incorrect navigation interaction "),
372
+ createCommentVNode(` <i v-if="!disabled" :class="nsIcon.m('close-tip')">{{\r
373
+ t('el.upload.deleteTip')\r
374
+ }}</i> `),
375
+ createCommentVNode(" picture-card "),
376
+ _ctx.listType === "picture-card" ? (openBlock(), createElementBlock("span", {
377
+ key: 3,
378
+ class: normalizeClass(_ctx.nsUpload.be("list", "item-actions"))
379
+ }, [
380
+ _ctx.preview ? (openBlock(), createElementBlock("span", {
381
+ key: 0,
382
+ class: normalizeClass(_ctx.nsUpload.be("list", "item-preview")),
383
+ onClick: _cache[2] || (_cache[2] = ($event) => _ctx.onPreview(_ctx.file))
384
+ }, [
385
+ createVNode(_component_el_icon, {
386
+ class: normalizeClass(_ctx.nsIcon.m("zoom-in"))
387
+ }, {
388
+ default: withCtx(() => [
389
+ createVNode(_component_zoom_in)
390
+ ]),
391
+ _: 1
392
+ }, 8, ["class"])
393
+ ], 2)) : createCommentVNode("v-if", true),
394
+ createCommentVNode(" \u4E0B\u8F7D "),
395
+ createElementVNode("span", {
396
+ class: normalizeClass(_ctx.nsUpload.be("list", "item-download")),
397
+ onClick: _cache[3] || (_cache[3] = ($event) => _ctx.handleDownload(_ctx.file))
398
+ }, [
399
+ createVNode(_component_el_icon, {
400
+ class: normalizeClass(_ctx.nsIcon.m("download"))
401
+ }, {
402
+ default: withCtx(() => [
403
+ createVNode(_component_Download)
404
+ ]),
405
+ _: 1
406
+ }, 8, ["class"])
407
+ ], 2),
408
+ !_ctx.disabled ? (openBlock(), createElementBlock("span", {
409
+ key: 1,
410
+ class: normalizeClass(_ctx.nsUpload.be("list", "item-delete")),
411
+ onClick: _cache[4] || (_cache[4] = ($event) => _ctx.handleRemove(_ctx.file))
412
+ }, [
413
+ createVNode(_component_el_icon, {
414
+ class: normalizeClass(_ctx.nsIcon.m("delete"))
415
+ }, {
416
+ default: withCtx(() => [
417
+ createVNode(_component_Delete)
418
+ ]),
419
+ _: 1
420
+ }, 8, ["class"])
421
+ ], 2)) : createCommentVNode("v-if", true)
422
+ ], 2)) : createCommentVNode("v-if", true)
423
+ ], 64);
424
+ }
425
+ var FileVue = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["render", _sfc_render$1], ["__file", "file.vue"]]);
426
+
427
+ const _sfc_main = defineComponent({
428
+ name: "VkfUpload",
429
+ components: {
430
+ VkfFormItem,
431
+ ElUpload,
432
+ FileVue,
433
+ ElLink
434
+ },
435
+ emits,
436
+ props,
437
+ setup(props2) {
438
+ const formItemBindProps = _VkfFormItemCtx.createBindProps(props2);
439
+ const coreBindProps = createUploadBindProps(props2, ["disabled", "fileList"]);
440
+ const uploadRef = shallowRef();
441
+ const handleRemove = (file) => {
442
+ uploadRef.value?.handleRemove(file);
443
+ };
444
+ const readonly = useComputedReadonly(props2);
445
+ return {
446
+ formItemBindProps,
447
+ pickObject,
448
+ coreBindProps,
449
+ uploadRef,
450
+ handleRemove,
451
+ readonly
452
+ };
453
+ }
454
+ });
455
+ const _hoisted_1 = { class: "el-upload__tip" };
456
+ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
457
+ const _component_ElLink = resolveComponent("ElLink");
458
+ const _component_FileVue = resolveComponent("FileVue");
459
+ const _component_ElUpload = resolveComponent("ElUpload");
460
+ const _component_VkfFormItem = resolveComponent("VkfFormItem");
461
+ return openBlock(), createBlock(_component_VkfFormItem, normalizeProps(guardReactiveProps(_ctx.formItemBindProps)), {
462
+ default: withCtx(() => [
463
+ createVNode(_component_ElUpload, mergeProps({
464
+ class: ["vkf-upload", {
465
+ "is-readonly": _ctx.readonly,
466
+ "is-empty": _ctx.fileList?.length === 0
467
+ }]
468
+ }, _ctx.coreBindProps, {
469
+ fileList: _ctx.fileList ?? [],
470
+ "onUpdate:fileList": _cache[0] || (_cache[0] = ($event) => _ctx.$emit("update:fileList", $event)),
471
+ ref: "uploadRef",
472
+ disabled: _ctx.readonly || _ctx.disabled
473
+ }), createSlots({
474
+ file: withCtx(({ file }) => [
475
+ createVNode(_component_FileVue, {
476
+ file,
477
+ listType: _ctx.listType,
478
+ disabled: _ctx.readonly || _ctx.disabled,
479
+ onPreview: _ctx.onPreview,
480
+ onRemove: _ctx.handleRemove
481
+ }, null, 8, ["file", "listType", "disabled", "onPreview", "onRemove"])
482
+ ]),
483
+ default: withCtx(() => [
484
+ createVNode(_component_ElLink, { type: "primary" }, {
485
+ default: withCtx(() => [
486
+ createTextVNode("+ \u9009\u62E9\u6587\u4EF6")
487
+ ]),
488
+ _: 1
489
+ }),
490
+ renderSlot(_ctx.$slots, "default")
491
+ ]),
492
+ _: 2
493
+ }, [
494
+ _ctx.tip ? {
495
+ name: "tip",
496
+ fn: withCtx(() => [
497
+ createElementVNode("div", _hoisted_1, toDisplayString(_ctx.tip), 1)
498
+ ]),
499
+ key: "0"
500
+ } : void 0
501
+ ]), 1040, ["class", "fileList", "disabled"]),
502
+ createElementVNode("span", {
503
+ class: normalizeClass(["vkf-upload-empty-tip", {
504
+ "is-readonly": _ctx.readonly,
505
+ "is-empty": _ctx.fileList?.length === 0
506
+ }])
507
+ }, "\u6682\u65E0", 2)
508
+ ]),
509
+ _: 3
510
+ }, 16);
511
+ }
512
+ var VkfUpload = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render], ["__file", "index.vue"]]);
513
+
514
+ var types = /*#__PURE__*/Object.freeze({
515
+ __proto__: null
516
+ });
517
+
518
+ VkfUpload.install = (app) => {
519
+ app.component(VkfUpload.name, VkfUpload);
520
+ };
521
+
522
+ export { VkfUpload, ctx as _VkfUploadCtx, types as __VkfUpload, VkfUpload as default };