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