@vunk/form 2.18.2 → 2.19.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 (320) hide show
  1. package/components/_plugin-vue_export-helper.cjs +1 -11
  2. package/components/api-tables-select/index.cjs +1 -467
  3. package/components/api-tables-select/index.mjs +56 -413
  4. package/components/api-tables-select/src/ctx.d.ts +147 -173
  5. package/components/api-tables-select/src/index.vue.d.ts +390 -983
  6. package/components/button/index.cjs +1 -112
  7. package/components/button/index.mjs +56 -85
  8. package/components/button/src/ctx.d.ts +28 -113
  9. package/components/button/src/index.vue.d.ts +314 -621
  10. package/components/card-input-collection/index.cjs +1 -370
  11. package/components/card-input-collection/index.mjs +175 -277
  12. package/components/card-input-collection/src/core.vue.d.ts +57 -950
  13. package/components/card-input-collection/src/ctx.d.ts +19 -49
  14. package/components/card-input-collection/src/index.vue.d.ts +49 -112
  15. package/components/cascader/index.cjs +1 -150
  16. package/components/cascader/index.mjs +88 -116
  17. package/components/cascader/src/ctx.d.ts +148 -207
  18. package/components/cascader/src/index.vue.d.ts +335 -525
  19. package/components/cascader/src/use.d.ts +1 -1
  20. package/components/checkbox/index.cjs +1 -152
  21. package/components/checkbox/index.mjs +75 -119
  22. package/components/checkbox/src/ctx.d.ts +46 -69
  23. package/components/checkbox/src/index.vue.d.ts +445 -1012
  24. package/components/cloneDeep.cjs +1 -2106
  25. package/components/color-picker/index.cjs +1 -80
  26. package/components/color-picker/index.mjs +46 -69
  27. package/components/color-picker/src/ctx.d.ts +138 -107
  28. package/components/color-picker/src/index.vue.d.ts +305 -255
  29. package/components/date-picker/index.cjs +1 -119
  30. package/components/date-picker/index.mjs +63 -97
  31. package/components/date-picker/src/ctx.d.ts +131 -206
  32. package/components/date-picker/src/index.vue.d.ts +287 -1359
  33. package/components/date-picker/src/types.d.ts +7 -7
  34. package/components/date-picker-range/index.cjs +1 -177
  35. package/components/date-picker-range/index.mjs +62 -113
  36. package/components/date-picker-range/src/ctx.d.ts +139 -207
  37. package/components/date-picker-range/src/index.vue.d.ts +896 -450
  38. package/components/debounce.cjs +1 -0
  39. package/components/dialog/index.cjs +1 -126
  40. package/components/dialog/index.mjs +65 -99
  41. package/components/dialog/src/ctx.d.ts +17 -108
  42. package/components/dialog/src/index.vue.d.ts +77 -1070
  43. package/components/dialog-input-collection/index.cjs +1 -624
  44. package/components/dialog-input-collection/index.mjs +276 -498
  45. package/components/dialog-input-collection/src/ctx.d.ts +20 -50
  46. package/components/dialog-input-collection/src/dialog-form.vue.d.ts +28 -6366
  47. package/components/dialog-input-collection/src/index.vue.d.ts +66 -7629
  48. package/components/dialog-input-collection/src/layout.vue.d.ts +16 -72
  49. package/components/download-plus/index.cjs +1 -456
  50. package/components/download-plus/index.mjs +214 -358
  51. package/components/download-plus/src/ctx.d.ts +20 -50
  52. package/components/download-plus/src/index.vue.d.ts +434 -1171
  53. package/components/editable-text/index.cjs +1 -295
  54. package/components/editable-text/index.mjs +113 -239
  55. package/components/editable-text/src/ctx.d.ts +20 -50
  56. package/components/editable-text/src/index.vue.d.ts +62 -3257
  57. package/components/el-slider/index.cjs +1 -0
  58. package/components/el-slider/index.d.ts +5 -0
  59. package/components/el-slider/index.mjs +475 -0
  60. package/components/el-slider/src/button.d.ts +36 -0
  61. package/components/el-slider/src/button.vue.d.ts +42 -0
  62. package/components/el-slider/src/composables/index.cjs +1 -0
  63. package/components/el-slider/src/composables/index.d.ts +6 -0
  64. package/components/el-slider/src/composables/index.mjs +9 -0
  65. package/components/el-slider/src/composables/use-lifecycle.d.ts +4 -0
  66. package/components/el-slider/src/composables/use-marks.d.ts +7 -0
  67. package/components/el-slider/src/composables/use-slide.d.ts +23 -0
  68. package/components/el-slider/src/composables/use-slider-button.d.ts +18 -0
  69. package/components/el-slider/src/composables/use-stops.d.ts +8 -0
  70. package/components/el-slider/src/composables/use-watch.d.ts +4 -0
  71. package/components/el-slider/src/constants.d.ts +14 -0
  72. package/components/el-slider/src/marker.d.ts +37 -0
  73. package/components/el-slider/src/slider-core.vue.d.ts +219 -0
  74. package/components/el-slider/src/slider.d.ts +175 -0
  75. package/components/esri-input-geojson/index.cjs +2 -1604
  76. package/components/esri-input-geojson/index.mjs +666 -1289
  77. package/components/esri-input-geojson/src/append.vue.d.ts +225 -1084
  78. package/components/esri-input-geojson/src/const.d.ts +1 -1
  79. package/components/esri-input-geojson/src/ctx.d.ts +62 -158
  80. package/components/esri-input-geojson/src/default-view.vue.d.ts +12 -132
  81. package/components/esri-input-geojson/src/index.vue.d.ts +1470 -789
  82. package/components/esri-input-geojson/src/viewer.vue.d.ts +424 -287
  83. package/components/fieldset/index.cjs +1 -110
  84. package/components/fieldset/index.mjs +62 -77
  85. package/components/fieldset/src/ctx.d.ts +4 -4
  86. package/components/fieldset/src/index.vue.d.ts +10 -9
  87. package/components/form/index.cjs +1 -248
  88. package/components/form/index.mjs +107 -161
  89. package/components/form/src/ctx.d.ts +15 -64
  90. package/components/form/src/index.vue.d.ts +360 -2416
  91. package/components/form-item/index.cjs +1 -294
  92. package/components/form-item/index.mjs +139 -229
  93. package/components/form-item/src/core.vue.d.ts +33 -1853
  94. package/components/form-item/src/ctx.d.ts +17 -47
  95. package/components/form-item/src/index.vue.d.ts +41 -103
  96. package/components/form-item-renderer/index.cjs +1 -193
  97. package/components/form-item-renderer/index.mjs +102 -162
  98. package/components/form-item-renderer/src/core.vue.d.ts +12 -11
  99. package/components/form-item-renderer/src/ctx.d.ts +3 -3
  100. package/components/form-item-renderer/src/index.vue.d.ts +25 -73
  101. package/components/form-item-renderer-template/index.cjs +1 -47
  102. package/components/form-item-renderer-template/index.mjs +19 -33
  103. package/components/form-item-renderer-template/src/index.vue.d.ts +4 -3
  104. package/components/forms-provider/index.cjs +1 -99
  105. package/components/forms-provider/index.mjs +44 -73
  106. package/components/forms-provider/src/core.d.ts +3 -2
  107. package/components/forms-provider/src/index.vue.d.ts +5 -2
  108. package/components/forms-provider/src/segment.vue.d.ts +12 -8
  109. package/components/forms-provider/src/view.vue.d.ts +17 -3
  110. package/components/index.cjs +1 -399
  111. package/components/index2.cjs +1 -17
  112. package/components/information/index.cjs +1 -65
  113. package/components/information/index.mjs +28 -38
  114. package/components/information/src/ctx.d.ts +2 -2
  115. package/components/information/src/index.vue.d.ts +7 -6
  116. package/components/information-collection/index.cjs +1 -81
  117. package/components/information-collection/index.mjs +44 -48
  118. package/components/information-collection/src/ctx.d.ts +20 -50
  119. package/components/information-collection/src/index.vue.d.ts +49 -112
  120. package/components/information-renderer/index.cjs +1 -16
  121. package/components/information-renderer/index.mjs +9 -10
  122. package/components/information-tag/index.cjs +1 -101
  123. package/components/information-tag/index.mjs +44 -54
  124. package/components/information-tag/src/ctx.d.ts +5 -19
  125. package/components/information-tag/src/index.vue.d.ts +24 -51
  126. package/components/information-templates-default/index.cjs +1 -101
  127. package/components/information-templates-default/index.mjs +63 -73
  128. package/components/information-templates-default/src/index.vue.d.ts +2 -1
  129. package/components/input/index.cjs +1 -115
  130. package/components/input/index.mjs +60 -83
  131. package/components/input/src/ctx.d.ts +50 -151
  132. package/components/input/src/index.vue.d.ts +389 -947
  133. package/components/input-array/index.cjs +1 -310
  134. package/components/input-array/index.mjs +114 -244
  135. package/components/input-array/src/ctx.d.ts +19 -49
  136. package/components/input-array/src/form-template.vue.d.ts +2 -901
  137. package/components/input-array/src/index.vue.d.ts +45 -731
  138. package/components/input-collection/index.cjs +1 -452
  139. package/components/input-collection/index.mjs +195 -355
  140. package/components/input-collection/src/core.vue.d.ts +59 -1019
  141. package/components/input-collection/src/ctx.d.ts +19 -49
  142. package/components/input-collection/src/index.vue.d.ts +47 -110
  143. package/components/input-file/index.cjs +1 -142
  144. package/components/input-file/index.mjs +68 -100
  145. package/components/input-file/src/ctx.d.ts +8 -29
  146. package/components/input-file/src/index.vue.d.ts +447 -76
  147. package/components/input-file/src/template.vue.d.ts +2 -124
  148. package/components/input-link/index.cjs +1 -167
  149. package/components/input-link/index.mjs +60 -83
  150. package/components/input-link/src/ctx.d.ts +48 -135
  151. package/components/input-link/src/index.vue.d.ts +835 -312
  152. package/components/input-number/index.cjs +1 -119
  153. package/components/input-number/index.mjs +73 -87
  154. package/components/input-number/src/ctx.d.ts +38 -131
  155. package/components/input-number/src/index.vue.d.ts +321 -682
  156. package/components/input-tag/index.cjs +1 -100
  157. package/components/input-tag/index.mjs +51 -78
  158. package/components/input-tag/src/ctx.d.ts +41 -143
  159. package/components/input-tag/src/index.vue.d.ts +322 -775
  160. package/components/isObject.cjs +1 -165
  161. package/components/monaco-editor/index.cjs +1 -83
  162. package/components/monaco-editor/index.mjs +40 -59
  163. package/components/monaco-editor/src/ctx.d.ts +19 -44
  164. package/components/monaco-editor/src/index.vue.d.ts +212 -111
  165. package/components/radio/index.cjs +1 -267
  166. package/components/radio/index.mjs +110 -209
  167. package/components/radio/src/ctx.d.ts +27 -91
  168. package/components/radio/src/index.vue.d.ts +299 -1279
  169. package/components/radio/src/option.vue.d.ts +28 -878
  170. package/components/radio/src/wraper.vue.d.ts +67 -198
  171. package/components/renderer-data/index.cjs +1 -41
  172. package/components/renderer-data/index.mjs +19 -26
  173. package/components/renderer-data/src/ctx.d.ts +1 -1
  174. package/components/renderer-data/src/index.vue.d.ts +5 -4
  175. package/components/select/index.cjs +1 -311
  176. package/components/select/index.mjs +156 -214
  177. package/components/select/src/core.vue.d.ts +446 -1028
  178. package/components/select/src/ctx.d.ts +60 -215
  179. package/components/select/src/index.vue.d.ts +318 -593
  180. package/components/select/src/options.vue.d.ts +4 -3
  181. package/components/slider/index.cjs +1 -88
  182. package/components/slider/index.mjs +41 -70
  183. package/components/slider/src/ctx.d.ts +63 -174
  184. package/components/slider/src/index.vue.d.ts +154 -419
  185. package/components/style.css +1 -0
  186. package/components/switch/index.cjs +1 -88
  187. package/components/switch/index.mjs +37 -69
  188. package/components/switch/src/ctx.d.ts +30 -109
  189. package/components/switch/src/index.vue.d.ts +90 -697
  190. package/components/switch/src/types.d.ts +2 -2
  191. package/components/tables-select/index.cjs +1 -263
  192. package/components/tables-select/index.mjs +101 -172
  193. package/components/tables-select/src/ctx.d.ts +68 -99
  194. package/components/tables-select/src/index.vue.d.ts +233 -4988
  195. package/components/template-instances-provider/index.cjs +1 -31
  196. package/components/template-instances-provider/index.mjs +18 -22
  197. package/components/template-instances-provider/src/index.vue.d.ts +5 -4
  198. package/components/templates-default/index.cjs +1 -235
  199. package/components/templates-default/index.mjs +152 -211
  200. package/components/templates-default/src/ctx.d.ts +2 -2
  201. package/components/templates-default/src/index.vue.d.ts +7337 -145
  202. package/components/templates-element-plus/index.cjs +1 -112
  203. package/components/templates-element-plus/index.mjs +49 -91
  204. package/components/templates-element-plus/src/ctx.d.ts +1 -1
  205. package/components/templates-element-plus/src/index.vue.d.ts +59 -251
  206. package/components/templates-esri/index.cjs +1 -65
  207. package/components/templates-esri/index.mjs +29 -39
  208. package/components/templates-esri/src/ctx.d.ts +1 -1
  209. package/components/templates-esri/src/index.vue.d.ts +2184 -25
  210. package/components/templates-layout/index.cjs +1 -137
  211. package/components/templates-layout/index.mjs +78 -116
  212. package/components/templates-layout/src/ctx.d.ts +1 -1
  213. package/components/templates-layout/src/index.vue.d.ts +73 -404
  214. package/components/templates-variant/index.cjs +1 -70
  215. package/components/templates-variant/index.mjs +33 -43
  216. package/components/templates-variant/src/ctx.d.ts +1 -1
  217. package/components/templates-variant/src/index.vue.d.ts +1272 -25
  218. package/components/time-picker/index.cjs +1 -104
  219. package/components/time-picker/index.mjs +57 -87
  220. package/components/time-picker/src/ctx.d.ts +130 -212
  221. package/components/time-picker/src/index.vue.d.ts +283 -1371
  222. package/components/upload/index.cjs +1 -663
  223. package/components/upload/index.mjs +343 -537
  224. package/components/upload/src/ctx.d.ts +106 -191
  225. package/components/upload/src/file.vue.d.ts +168 -745
  226. package/components/upload/src/index.vue.d.ts +647 -1888
  227. package/components/upload/src/types.d.ts +1 -1
  228. package/components/upload/src/wraper.vue.d.ts +233 -407
  229. package/components/upload-plus/index.cjs +21 -18673
  230. package/components/upload-plus/index.mjs +4566 -18366
  231. package/components/upload-plus/src/api.d.ts +1 -1
  232. package/components/upload-plus/src/ctx.d.ts +21 -51
  233. package/components/upload-plus/src/index.vue.d.ts +53 -1657
  234. package/components/use-watch.cjs +1 -0
  235. package/components/van-cascader/index.cjs +1 -125
  236. package/components/van-cascader/index.mjs +51 -96
  237. package/components/van-cascader/src/ctx.d.ts +143 -203
  238. package/components/van-cascader/src/index.vue.d.ts +332 -988
  239. package/components/var-datetime-picker/index.cjs +1 -333
  240. package/components/var-datetime-picker/index.mjs +173 -254
  241. package/components/var-datetime-picker/src/ctx.d.ts +18 -48
  242. package/components/var-datetime-picker/src/index.vue.d.ts +628 -1090
  243. package/components/vditor/index.cjs +1 -86
  244. package/components/vditor/index.mjs +40 -66
  245. package/components/vditor/src/ctx.d.ts +15 -45
  246. package/components/vditor/src/index.vue.d.ts +195 -120
  247. package/composables/element-plus/index.cjs +1 -23
  248. package/composables/element-plus/index.mjs +14 -18
  249. package/composables/index.cjs +1 -161
  250. package/composables/index.d.ts +1 -0
  251. package/composables/index.mjs +100 -135
  252. package/composables/useForm.d.ts +2 -2
  253. package/composables/useRtl.d.ts +18 -0
  254. package/composables/useTemplateInstances.d.ts +3 -3
  255. package/index.css +1 -562
  256. package/index.d.ts +0 -3
  257. package/index.esm.js +23 -48
  258. package/locale/index.cjs +1 -102
  259. package/locale/index.mjs +34 -34
  260. package/locale/lang/index.cjs +1 -2
  261. package/locale/lang/index.d.ts +1 -0
  262. package/package.json +14 -85
  263. package/shared/const/index.cjs +1 -59
  264. package/shared/const/index.d.ts +1 -1
  265. package/shared/const/index.mjs +18 -20
  266. package/shared/element-plus/ctx.d.ts +40 -37
  267. package/shared/element-plus/index.cjs +1 -211
  268. package/shared/element-plus/index.mjs +93 -161
  269. package/shared/element-plus/instances.d.ts +224 -321
  270. package/shared/form/index.cjs +1 -33
  271. package/shared/form/index.mjs +23 -25
  272. package/shared/helper/index.cjs +1 -11
  273. package/shared/helper/index.mjs +7 -8
  274. package/shared/index.cjs +1 -8
  275. package/shared/index.mjs +5 -1
  276. package/shared/infer-prop/index.cjs +1 -36
  277. package/shared/infer-prop/index.mjs +22 -28
  278. package/shared/progress-it/index.cjs +1 -42
  279. package/shared/progress-it/index.mjs +15 -31
  280. package/shared/rules/index.cjs +1 -56
  281. package/shared/rules/index.mjs +19 -18
  282. package/shared/types/form/index.cjs +1 -2
  283. package/shared/types/index.cjs +1 -2
  284. package/shared/types/source/index.cjs +1 -2
  285. package/shared/types/source-manager/index.cjs +1 -2
  286. package/shared/upload/index.cjs +1 -774
  287. package/shared/upload/index.mjs +180 -764
  288. package/component.d.ts +0 -3
  289. package/components/_plugin-vue_export-helper.mjs +0 -9
  290. package/components/card-input-collection/index.css +0 -21
  291. package/components/cascader/index.css +0 -9
  292. package/components/checkbox/index.css +0 -30
  293. package/components/cloneDeep.mjs +0 -2104
  294. package/components/date-picker-range/index.css +0 -18
  295. package/components/dialog-input-collection/index.css +0 -21
  296. package/components/download-plus/index.css +0 -68
  297. package/components/editable-text/index.css +0 -9
  298. package/components/esri-input-geojson/index.css +0 -32
  299. package/components/fieldset/index.css +0 -5
  300. package/components/form-item/index.css +0 -35
  301. package/components/index.mjs +0 -378
  302. package/components/index2.mjs +0 -14
  303. package/components/information-tag/index.css +0 -6
  304. package/components/information-templates-default/index.css +0 -16
  305. package/components/input-array/index.css +0 -14
  306. package/components/input-collection/index.css +0 -20
  307. package/components/input-link/index.css +0 -4
  308. package/components/input-number/index.css +0 -13
  309. package/components/isObject.mjs +0 -158
  310. package/components/monaco-editor/index.css +0 -4
  311. package/components/radio/index.css +0 -40
  312. package/components/select/index.css +0 -15
  313. package/components/switch/index.css +0 -10
  314. package/components/tables-select/index.css +0 -3
  315. package/components/templates-layout/index.css +0 -3
  316. package/components/upload/index.css +0 -34
  317. package/components/upload-plus/index.css +0 -84
  318. package/components/van-cascader/index.css +0 -6
  319. package/components/var-datetime-picker/index.css +0 -17
  320. package/defaults.d.ts +0 -5
@@ -1,110 +1 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var vue = require('vue');
6
- var elementPlus = require('element-plus');
7
- var _function = require('@vunk/shared/function');
8
- var _pluginVue_exportHelper = require('../_plugin-vue_export-helper.cjs');
9
-
10
- const props = {
11
- labelWidth: {
12
- type: [String, Number],
13
- default: void 0
14
- },
15
- labelPosition: {
16
- type: String,
17
- default: void 0
18
- },
19
- labelSuffix: {
20
- type: String,
21
- default: void 0
22
- }
23
- };
24
- const emits = {};
25
-
26
- function useFormLabelWidth() {
27
- const potentialLabelWidthArr = vue.ref([]);
28
- const autoLabelWidth = vue.computed(() => {
29
- if (!potentialLabelWidthArr.value.length)
30
- return "0";
31
- const max = Math.max(...potentialLabelWidthArr.value);
32
- return max ? `${max}px` : "";
33
- });
34
- function getLabelWidthIndex(width) {
35
- const index = potentialLabelWidthArr.value.indexOf(width);
36
- if (index === -1 && autoLabelWidth.value === "0") ;
37
- return index;
38
- }
39
- function registerLabelWidth(val, oldVal) {
40
- if (val && oldVal) {
41
- const index = getLabelWidthIndex(oldVal);
42
- potentialLabelWidthArr.value.splice(index, 1, val);
43
- } else if (val) {
44
- potentialLabelWidthArr.value.push(val);
45
- }
46
- }
47
- function deregisterLabelWidth(val) {
48
- const index = getLabelWidthIndex(val);
49
- if (index > -1) {
50
- potentialLabelWidthArr.value.splice(index, 1);
51
- }
52
- }
53
- return {
54
- autoLabelWidth,
55
- registerLabelWidth,
56
- deregisterLabelWidth
57
- };
58
- }
59
-
60
- var _sfc_main = vue.defineComponent({
61
- name: "VkfFieldset",
62
- props,
63
- emits,
64
- setup(props2) {
65
- const backupFormContext = {
66
- addField: _function.noop
67
- };
68
- const formContext = vue.inject(elementPlus.formContextKey, backupFormContext);
69
- const labelWidth = vue.computed(() => {
70
- return props2.labelWidth ?? formContext.labelWidth;
71
- });
72
- const labelPosition = vue.computed(() => {
73
- return props2.labelPosition ?? formContext.labelPosition;
74
- });
75
- const labelSuffix = vue.computed(() => {
76
- return props2.labelSuffix ?? formContext.labelSuffix;
77
- });
78
- vue.provide(
79
- elementPlus.formContextKey,
80
- vue.reactive({
81
- ...formContext === backupFormContext ? backupFormContext : vue.toRefs(formContext),
82
- labelWidth,
83
- labelPosition,
84
- labelSuffix,
85
- ...useFormLabelWidth()
86
- })
87
- );
88
- return {};
89
- }
90
- });
91
-
92
- const _hoisted_1 = { class: "vkf-fieldset" };
93
- function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
94
- return vue.openBlock(), vue.createElementBlock("fieldset", _hoisted_1, [
95
- vue.renderSlot(_ctx.$slots, "default")
96
- ]);
97
- }
98
- var VkfFieldset = /* @__PURE__ */ _pluginVue_exportHelper._export_sfc(_sfc_main, [["render", _sfc_render], ["__file", "/home/runner/work/private-vunk-form/private-vunk-form/packages/components/fieldset/src/index.vue"]]);
99
-
100
- var types = /*#__PURE__*/Object.freeze({
101
- __proto__: null
102
- });
103
-
104
- VkfFieldset.install = (app) => {
105
- app.component(VkfFieldset.name || "VkfFieldset", VkfFieldset);
106
- };
107
-
108
- exports.VkfFieldset = VkfFieldset;
109
- exports.__VkfFieldset = types;
110
- exports.default = VkfFieldset;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=require("vue"),u=require("element-plus"),d=require("@vunk/shared/function"),f=require("../_plugin-vue_export-helper.cjs"),p={labelWidth:{type:[String,Number],default:void 0},labelPosition:{type:String,default:void 0},labelSuffix:{type:String,default:void 0}},b={};var m=class extends Error{constructor(e){super(e),this.name="ElementPlusError"}};function x(e,r){{const o=new m(`[${e}] ${r}`);console.warn(o)}}const _="ElForm";function h(){const e=n.ref([]),r=n.computed(()=>{if(!e.value.length)return"0";const t=Math.max(...e.value);return t?`${t}px`:""});function o(t){const i=e.value.indexOf(t);return i===-1&&r.value==="0"&&x(_,`unexpected width ${t}`),i}function l(t,i){if(t&&i){const a=o(i);e.value.splice(a,1,t)}else t&&e.value.push(t)}function s(t){const i=o(t);i>-1&&e.value.splice(i,1)}return{autoLabelWidth:r,registerLabelWidth:l,deregisterLabelWidth:s}}const v=n.defineComponent({name:"VkfFieldset",props:p,emits:b,setup(e){const r={addField:d.noop},o=n.inject(u.formContextKey,r),l=n.computed(()=>e.labelWidth??o.labelWidth),s=n.computed(()=>e.labelPosition??o.labelPosition),t=n.computed(()=>e.labelSuffix??o.labelSuffix);return n.provide(u.formContextKey,n.reactive({...o===r?r:n.toRefs(o),labelWidth:l,labelPosition:s,labelSuffix:t,...h()})),{}}}),g={class:"vkf-fieldset"};function S(e,r,o,l,s,t){return n.openBlock(),n.createElementBlock("fieldset",g,[n.renderSlot(e.$slots,"default")])}const c=f._export_sfc(v,[["render",S]]),W=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));exports.VkfFieldset=c;exports.__VkfFieldset=W;exports.default=c;
@@ -1,9 +1,8 @@
1
- import { ref, computed, defineComponent, inject, provide, reactive, toRefs, openBlock, createElementBlock, renderSlot } from 'vue';
2
- import { formContextKey } from 'element-plus';
3
- import { noop } from '@vunk/shared/function';
4
- import { _ as _export_sfc } from '../_plugin-vue_export-helper.mjs';
5
-
6
- const props = {
1
+ import { ref as c, computed as s, defineComponent as f, inject as d, provide as p, reactive as m, toRefs as b, openBlock as x, createElementBlock as h, renderSlot as _ } from "vue";
2
+ import { formContextKey as a } from "element-plus";
3
+ import { noop as v } from "@vunk/shared/function";
4
+ import { _ as S } from "../_plugin-vue_export-helper.cjs";
5
+ const W = {
7
6
  labelWidth: {
8
7
  type: [String, Number],
9
8
  default: void 0
@@ -16,89 +15,75 @@ const props = {
16
15
  type: String,
17
16
  default: void 0
18
17
  }
18
+ }, g = {};
19
+ var $ = class extends Error {
20
+ constructor(e) {
21
+ super(e), this.name = "ElementPlusError";
22
+ }
19
23
  };
20
- const emits = {};
21
-
22
- function useFormLabelWidth() {
23
- const potentialLabelWidthArr = ref([]);
24
- const autoLabelWidth = computed(() => {
25
- if (!potentialLabelWidthArr.value.length)
26
- return "0";
27
- const max = Math.max(...potentialLabelWidthArr.value);
28
- return max ? `${max}px` : "";
24
+ function E(e, n) {
25
+ {
26
+ const o = new $(`[${e}] ${n}`);
27
+ console.warn(o);
28
+ }
29
+ }
30
+ const P = "ElForm";
31
+ function k() {
32
+ const e = c([]), n = s(() => {
33
+ if (!e.value.length) return "0";
34
+ const t = Math.max(...e.value);
35
+ return t ? `${t}px` : "";
29
36
  });
30
- function getLabelWidthIndex(width) {
31
- const index = potentialLabelWidthArr.value.indexOf(width);
32
- if (index === -1 && autoLabelWidth.value === "0") ;
33
- return index;
37
+ function o(t) {
38
+ const r = e.value.indexOf(t);
39
+ return r === -1 && n.value === "0" && E(P, `unexpected width ${t}`), r;
34
40
  }
35
- function registerLabelWidth(val, oldVal) {
36
- if (val && oldVal) {
37
- const index = getLabelWidthIndex(oldVal);
38
- potentialLabelWidthArr.value.splice(index, 1, val);
39
- } else if (val) {
40
- potentialLabelWidthArr.value.push(val);
41
- }
41
+ function i(t, r) {
42
+ if (t && r) {
43
+ const u = o(r);
44
+ e.value.splice(u, 1, t);
45
+ } else t && e.value.push(t);
42
46
  }
43
- function deregisterLabelWidth(val) {
44
- const index = getLabelWidthIndex(val);
45
- if (index > -1) {
46
- potentialLabelWidthArr.value.splice(index, 1);
47
- }
47
+ function l(t) {
48
+ const r = o(t);
49
+ r > -1 && e.value.splice(r, 1);
48
50
  }
49
51
  return {
50
- autoLabelWidth,
51
- registerLabelWidth,
52
- deregisterLabelWidth
52
+ autoLabelWidth: n,
53
+ registerLabelWidth: i,
54
+ deregisterLabelWidth: l
53
55
  };
54
56
  }
55
-
56
- var _sfc_main = defineComponent({
57
+ const y = f({
57
58
  name: "VkfFieldset",
58
- props,
59
- emits,
60
- setup(props2) {
61
- const backupFormContext = {
62
- addField: noop
63
- };
64
- const formContext = inject(formContextKey, backupFormContext);
65
- const labelWidth = computed(() => {
66
- return props2.labelWidth ?? formContext.labelWidth;
67
- });
68
- const labelPosition = computed(() => {
69
- return props2.labelPosition ?? formContext.labelPosition;
70
- });
71
- const labelSuffix = computed(() => {
72
- return props2.labelSuffix ?? formContext.labelSuffix;
73
- });
74
- provide(
75
- formContextKey,
76
- reactive({
77
- ...formContext === backupFormContext ? backupFormContext : toRefs(formContext),
78
- labelWidth,
79
- labelPosition,
80
- labelSuffix,
81
- ...useFormLabelWidth()
59
+ props: W,
60
+ emits: g,
61
+ setup(e) {
62
+ const n = {
63
+ addField: v
64
+ }, o = d(a, n), i = s(() => e.labelWidth ?? o.labelWidth), l = s(() => e.labelPosition ?? o.labelPosition), t = s(() => e.labelSuffix ?? o.labelSuffix);
65
+ return p(
66
+ a,
67
+ m({
68
+ ...o === n ? n : b(o),
69
+ labelWidth: i,
70
+ labelPosition: l,
71
+ labelSuffix: t,
72
+ ...k()
82
73
  })
83
- );
84
- return {};
74
+ ), {};
85
75
  }
86
- });
87
-
88
- const _hoisted_1 = { class: "vkf-fieldset" };
89
- function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
90
- return openBlock(), createElementBlock("fieldset", _hoisted_1, [
91
- renderSlot(_ctx.$slots, "default")
76
+ }), F = { class: "vkf-fieldset" };
77
+ function L(e, n, o, i, l, t) {
78
+ return x(), h("fieldset", F, [
79
+ _(e.$slots, "default")
92
80
  ]);
93
81
  }
94
- var VkfFieldset = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render], ["__file", "/home/runner/work/private-vunk-form/private-vunk-form/packages/components/fieldset/src/index.vue"]]);
95
-
96
- var types = /*#__PURE__*/Object.freeze({
82
+ const B = /* @__PURE__ */ S(y, [["render", L]]), M = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
97
83
  __proto__: null
98
- });
99
-
100
- VkfFieldset.install = (app) => {
101
- app.component(VkfFieldset.name || "VkfFieldset", VkfFieldset);
84
+ }, Symbol.toStringTag, { value: "Module" }));
85
+ export {
86
+ B as VkfFieldset,
87
+ M as __VkfFieldset,
88
+ B as default
102
89
  };
103
-
104
- export { VkfFieldset, types as __VkfFieldset, VkfFieldset as default };
@@ -1,16 +1,16 @@
1
- import { PropType } from 'vue';
1
+ import type { PropType } from 'vue';
2
2
  export declare const props: {
3
3
  labelWidth: {
4
4
  type: (StringConstructor | NumberConstructor)[];
5
- default: any;
5
+ default: undefined;
6
6
  };
7
7
  labelPosition: {
8
8
  type: PropType<"left" | "right" | "top">;
9
- default: any;
9
+ default: undefined;
10
10
  };
11
11
  labelSuffix: {
12
12
  type: StringConstructor;
13
- default: any;
13
+ default: undefined;
14
14
  };
15
15
  };
16
16
  export declare const emits: {};
@@ -1,32 +1,33 @@
1
- declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
1
+ declare const _default: typeof __VLS_export;
2
+ export default _default;
3
+ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
2
4
  labelWidth: {
3
5
  type: (StringConstructor | NumberConstructor)[];
4
- default: any;
6
+ default: undefined;
5
7
  };
6
8
  labelPosition: {
7
9
  type: import("vue").PropType<"left" | "right" | "top">;
8
- default: any;
10
+ default: undefined;
9
11
  };
10
12
  labelSuffix: {
11
13
  type: StringConstructor;
12
- default: any;
14
+ default: undefined;
13
15
  };
14
16
  }>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
15
17
  labelWidth: {
16
18
  type: (StringConstructor | NumberConstructor)[];
17
- default: any;
19
+ default: undefined;
18
20
  };
19
21
  labelPosition: {
20
22
  type: import("vue").PropType<"left" | "right" | "top">;
21
- default: any;
23
+ default: undefined;
22
24
  };
23
25
  labelSuffix: {
24
26
  type: StringConstructor;
25
- default: any;
27
+ default: undefined;
26
28
  };
27
29
  }>> & Readonly<{}>, {
28
30
  labelWidth: string | number;
29
- labelPosition: "top" | "left" | "right";
31
+ labelPosition: "left" | "right" | "top";
30
32
  labelSuffix: string;
31
33
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
32
- export default _default;
@@ -1,248 +1 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var elementPlus = require('element-plus');
6
- var utilsVue = require('@vunk/core/shared/utils-vue');
7
- var utilsFunction = require('@vunk/core/shared/utils-function');
8
- var vue = require('vue');
9
- var formItemRenderer = require('@vunk/form/components/form-item-renderer');
10
- var elementPlus$1 = require('@vunk/form/shared/element-plus');
11
- var helper = require('@vunk/core/shared/helper');
12
- var templatesDefault = require('@vunk/form/components/templates-default');
13
- var templatesLayout = require('@vunk/form/components/templates-layout');
14
- var utilsObject = require('@vunk/core/shared/utils-object');
15
- var form = require('@vunk/form/shared/form');
16
- var rendererData = require('@vunk/form/components/renderer-data');
17
- var object = require('@vunk/shared/object');
18
- var formsProvider = require('@vunk/form/components/forms-provider');
19
- var _pluginVue_exportHelper = require('../_plugin-vue_export-helper.cjs');
20
-
21
- const props = {
22
- ...elementPlus.formProps,
23
- data: {
24
- type: Object,
25
- default: () => ({})
26
- },
27
- formItems: {
28
- type: Array,
29
- default: () => []
30
- },
31
- readonly: {
32
- type: Boolean
33
- },
34
- elRef: {
35
- type: Function,
36
- default: () => utilsFunction.NOOP
37
- },
38
- /**
39
- * 是否开启布局模式
40
- */
41
- layout: {
42
- type: Boolean,
43
- default: false
44
- },
45
- /**
46
- * layout 为 true 时,
47
- * 该值生效
48
- * el-row 添加额外属性
49
- */
50
- rowSource: {
51
- type: Object,
52
- default: () => ({})
53
- },
54
- /**
55
- * layout 为 true 时,
56
- * 该值生效
57
- * el-col 添加额外属性
58
- */
59
- colSource: {
60
- type: Object,
61
- default: () => ({})
62
- },
63
- /**
64
- * 需要传递给 FormsProvider 的属性
65
- */
66
- segmentAttrs: {
67
- type: Object,
68
- default: () => ({})
69
- }
70
- };
71
- const createBindProps = utilsVue.bindPropsFactory(props);
72
- const emits = {
73
- ...elementPlus.formEmits,
74
- setData: (e) => e,
75
- validate: null,
76
- submit: null
77
- };
78
- const createOnEmits = utilsVue.onEmitsFactory(emits);
79
-
80
- var ctx = /*#__PURE__*/Object.freeze({
81
- __proto__: null,
82
- createBindProps: createBindProps,
83
- createOnEmits: createOnEmits,
84
- emits: emits,
85
- props: props
86
- });
87
-
88
- const getRowEmptySpan = (row) => {
89
- return 24 - row.templateSlots.reduce((a, c) => {
90
- if (!c.span) {
91
- throw new Error("ElColSource span is required");
92
- }
93
- return a + c.span;
94
- }, 0);
95
- };
96
- const genColItem = (formItem, options = {}) => {
97
- const span = formItem.span ?? options.span;
98
- if (span === void 0 || span === null) {
99
- throw new Error("genColItem ElColSource span is required");
100
- }
101
- return {
102
- ...options,
103
- templateType: "ElCol",
104
- span,
105
- templateSlots: [
106
- utilsObject.pickObject(formItem, {
107
- excludes: ["span"]
108
- })
109
- ]
110
- };
111
- };
112
- const genRowItem = (defaultItem, options = {}) => {
113
- return {
114
- ...options,
115
- templateType: "ElRow",
116
- templateSlots: defaultItem ? [
117
- defaultItem
118
- ] : []
119
- };
120
- };
121
-
122
- var _sfc_main = vue.defineComponent({
123
- name: "VkfForm",
124
- components: {
125
- VkfRendererData: rendererData.VkfRendererData,
126
- ElForm: elementPlus.ElForm,
127
- VkfFormItemRenderer: formItemRenderer.VkfFormItemRenderer,
128
- VkfTemplatesDefault: templatesDefault.VkfTemplatesDefault,
129
- VkfTemplatesLayout: templatesLayout.VkfTemplatesLayout,
130
- VkfFormsSegment: formsProvider.VkfFormsSegment
131
- },
132
- props,
133
- emits,
134
- setup(props2, { emit }) {
135
- const formProps = elementPlus$1.createFormBindProps(props2, ["model"]);
136
- const formEmits = elementPlus$1.createFormOnEmits(emit);
137
- const formRef = vue.shallowRef();
138
- const vm = vue.getCurrentInstance();
139
- vue.provide("vkfFormVm", vm);
140
- vue.provide("elFormRef", formRef);
141
- const getRef = (e) => {
142
- formRef.value = e;
143
- props2.elRef(e);
144
- };
145
- const rendererSource = vue.computed(() => {
146
- if (props2.layout) {
147
- return props2.formItems.reduce((a, c) => {
148
- const lastRow = a.findLast((item) => item.templateType === "ElRow");
149
- const itemSpan = c.span ?? props2.colSource.span;
150
- if (!itemSpan) {
151
- a.push(c);
152
- return a;
153
- }
154
- if (!c.templateLayout?.allowEmpty && Reflect.has(c, "templateIf")) {
155
- const templateIfFunc = form.genTemplateIfFunc(c.templateIf);
156
- const flag = templateIfFunc(props2.data);
157
- if (!flag) {
158
- return a;
159
- }
160
- }
161
- const colItem = genColItem(c, object.pickObject({
162
- ...props2.colSource,
163
- ...c.templateLayout
164
- }, {
165
- excludes: ["allowEmpty"]
166
- }));
167
- if (!lastRow || getRowEmptySpan(lastRow) < itemSpan) {
168
- a.push(genRowItem(colItem, props2.rowSource));
169
- } else {
170
- lastRow.templateSlots.push(colItem);
171
- }
172
- return a;
173
- }, []);
174
- }
175
- return props2.formItems;
176
- });
177
- const handleSubmit = (e) => {
178
- e.preventDefault();
179
- emit("submit", e);
180
- };
181
- return {
182
- formProps,
183
- formEmits,
184
- getValue: helper.getValue,
185
- getRef,
186
- computed: vue.computed,
187
- rendererSource,
188
- handleSubmit
189
- };
190
- }
191
- });
192
-
193
- function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
194
- const _component_VkfFormsSegment = vue.resolveComponent("VkfFormsSegment");
195
- const _component_VkfTemplatesDefault = vue.resolveComponent("VkfTemplatesDefault");
196
- const _component_VkfTemplatesLayout = vue.resolveComponent("VkfTemplatesLayout");
197
- const _component_VkfFormItemRenderer = vue.resolveComponent("VkfFormItemRenderer");
198
- const _component_VkfRendererData = vue.resolveComponent("VkfRendererData");
199
- const _component_ElForm = vue.resolveComponent("ElForm");
200
- return vue.openBlock(), vue.createBlock(_component_ElForm, vue.mergeProps(_ctx.formProps, {
201
- ref: _ctx.getRef,
202
- class: {
203
- "is-readonly": _ctx.readonly
204
- },
205
- model: _ctx.model || _ctx.data
206
- }, vue.toHandlers(_ctx.formEmits), { onSubmit: _ctx.handleSubmit }), {
207
- default: vue.withCtx(() => [
208
- vue.createVNode(_component_VkfRendererData, {
209
- data: _ctx.data,
210
- onSetData: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("setData", $event))
211
- }, {
212
- default: vue.withCtx(() => [
213
- vue.createVNode(_component_VkfFormsSegment, vue.mergeProps({ data: _ctx.data }, _ctx.segmentAttrs), null, 16, ["data"]),
214
- vue.createVNode(_component_VkfFormItemRenderer, { source: _ctx.rendererSource }, {
215
- placeholder: vue.withCtx(() => [
216
- vue.createVNode(_component_VkfTemplatesDefault),
217
- vue.createVNode(_component_VkfTemplatesLayout)
218
- ]),
219
- default: vue.withCtx(() => [
220
- vue.renderSlot(_ctx.$slots, "rendererTemplate")
221
- ]),
222
- _: 3
223
- /* FORWARDED */
224
- }, 8, ["source"]),
225
- vue.renderSlot(_ctx.$slots, "default")
226
- ]),
227
- _: 3
228
- /* FORWARDED */
229
- }, 8, ["data"])
230
- ]),
231
- _: 3
232
- /* FORWARDED */
233
- }, 16, ["class", "model", "onSubmit"]);
234
- }
235
- var VkfForm = /* @__PURE__ */ _pluginVue_exportHelper._export_sfc(_sfc_main, [["render", _sfc_render], ["__file", "/home/runner/work/private-vunk-form/private-vunk-form/packages/components/form/src/index.vue"]]);
236
-
237
- var types = /*#__PURE__*/Object.freeze({
238
- __proto__: null
239
- });
240
-
241
- VkfForm.install = (app) => {
242
- app.component(VkfForm.name, VkfForm);
243
- };
244
-
245
- exports.VkfForm = VkfForm;
246
- exports._VkfFormCtx = ctx;
247
- exports.__VkfForm = types;
248
- exports.default = VkfForm;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const p=require("element-plus"),b=require("@vunk/core/shared/utils-vue"),_=require("@vunk/core/shared/utils-function"),t=require("vue"),v=require("@vunk/form/components/form-item-renderer"),g=require("@vunk/form/shared/element-plus"),E=require("@vunk/core/shared/helper"),w=require("@vunk/form/components/templates-default"),C=require("@vunk/form/components/templates-layout"),q=require("@vunk/core/shared/utils-object"),I=require("@vunk/form/shared/form"),O=require("@vunk/form/components/renderer-data"),T=require("@vunk/shared/object"),P=require("@vunk/form/components/forms-provider"),h=require("../_plugin-vue_export-helper.cjs"),d={...p.formProps,data:{type:Object,default:()=>({})},formItems:{type:Array,default:()=>[]},readonly:{type:Boolean},elRef:{type:Function,default:()=>_.NOOP},layout:{type:Boolean,default:!1},rowSource:{type:Object,default:()=>({})},colSource:{type:Object,default:()=>({})},segmentAttrs:{type:Object,default:()=>({})}},D=b.bindPropsFactory(d),i={...p.formEmits,setData:e=>e,validate:null,submit:null},j=b.onEmitsFactory(i),L=Object.freeze(Object.defineProperty({__proto__:null,createBindProps:D,createOnEmits:j,emits:i,props:d},Symbol.toStringTag,{value:"Module"})),$=e=>24-e.templateSlots.reduce((r,n)=>{if(!n.span)throw new Error("ElColSource span is required");return r+n.span},0),B=(e,r={})=>{const n=e.span??r.span;if(n==null)throw new Error("genColItem ElColSource span is required");return{...r,templateType:"ElCol",span:n,templateSlots:[q.pickObject(e,{excludes:["span"]})]}},N=(e,r={})=>({...r,templateType:"ElRow",templateSlots:e?[e]:[]}),M=t.defineComponent({name:"VkfForm",components:{VkfRendererData:O.VkfRendererData,ElForm:p.ElForm,VkfFormItemRenderer:v.VkfFormItemRenderer,VkfTemplatesDefault:w.VkfTemplatesDefault,VkfTemplatesLayout:C.VkfTemplatesLayout,VkfFormsSegment:P.VkfFormsSegment},props:d,emits:i,setup(e,{emit:r}){const n=g.createFormBindProps(e,["model"]),y=g.createFormOnEmits(r),m=t.shallowRef(),V=t.getCurrentInstance();t.provide("vkfFormVm",V),t.provide("elFormRef",m);const u=o=>{m.value=o,e.elRef(o)},c=t.computed(()=>e.layout?e.formItems.reduce((o,l)=>{var k;const s=o.findLast(F=>F.templateType==="ElRow"),a=l.span??e.colSource.span;if(!a)return o.push(l),o;if(!((k=l.templateLayout)!=null&&k.allowEmpty)&&Reflect.has(l,"templateIf")&&!I.genTemplateIfFunc(l.templateIf)(e.data))return o;const S=B(l,T.pickObject({...e.colSource,...l.templateLayout},{excludes:["allowEmpty"]}));return!s||$(s)<a?o.push(N(S,e.rowSource)):s.templateSlots.push(S),o},[]):e.formItems),f=o=>{o.preventDefault(),r("submit",o)};return{formProps:n,formEmits:y,getValue:E.getValue,getRef:u,computed:t.computed,rendererSource:c,handleSubmit:f}}});function A(e,r,n,y,m,V){const u=t.resolveComponent("VkfFormsSegment"),c=t.resolveComponent("VkfTemplatesDefault"),f=t.resolveComponent("VkfTemplatesLayout"),o=t.resolveComponent("VkfFormItemRenderer"),l=t.resolveComponent("VkfRendererData"),s=t.resolveComponent("ElForm");return t.openBlock(),t.createBlock(s,t.mergeProps(e.formProps,{ref:e.getRef,class:{"is-readonly":e.readonly},model:e.model||e.data},t.toHandlers(e.formEmits),{onSubmit:e.handleSubmit}),{default:t.withCtx(()=>[t.createVNode(l,{data:e.data,onSetData:r[0]||(r[0]=a=>e.$emit("setData",a))},{default:t.withCtx(()=>[t.createVNode(u,t.mergeProps({data:e.data},e.segmentAttrs),null,16,["data"]),t.createVNode(o,{source:e.rendererSource},{placeholder:t.withCtx(()=>[t.createVNode(c),t.createVNode(f)]),default:t.withCtx(()=>[t.renderSlot(e.$slots,"rendererTemplate")]),_:3},8,["source"]),t.renderSlot(e.$slots,"default")]),_:3},8,["data"])]),_:3},16,["class","model","onSubmit"])}const R=h._export_sfc(M,[["render",A]]),z=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));exports.VkfForm=R;exports._VkfFormCtx=L;exports.__VkfForm=z;exports.default=R;