@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,452 +1 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var vue = require('vue');
6
- var index = require('../index.cjs');
7
- var core = require('@vunk/core');
8
- var fieldset = require('@vunk/form/components/fieldset');
9
- var formItem = require('@vunk/form/components/form-item');
10
- var formItemRenderer = require('@vunk/form/components/form-item-renderer');
11
- var rendererData = require('@vunk/form/components/renderer-data');
12
- var templateInstancesProvider = require('@vunk/form/components/template-instances-provider');
13
- var templatesDefault = require('@vunk/form/components/templates-default');
14
- var composables = require('@vunk/form/composables');
15
- var elementPlus = require('@vunk/form/composables/element-plus');
16
- var tableColumns = require('@vunk/plus/components/table-columns');
17
- var elementPlus$1 = require('element-plus');
18
- var _function = require('@vunk/shared/function');
19
- var cloneDeep = require('../cloneDeep.cjs');
20
- var _pluginVue_exportHelper = require('../_plugin-vue_export-helper.cjs');
21
- require('../isObject.cjs');
22
-
23
- const props = {
24
- ...formItem._VkfFormItemCtx.props,
25
- columns: {
26
- type: Array,
27
- default: () => []
28
- },
29
- modelValue: {
30
- type: Array,
31
- default: () => []
32
- },
33
- readonly: {
34
- type: Boolean,
35
- default: void 0
36
- },
37
- /**
38
- * @description 是否可以splice
39
- */
40
- splicable: {
41
- type: Boolean,
42
- default: true
43
- },
44
- /**
45
- * @description 开启 form-item 的 label 上的操作区域, 在labelPosition为top时生效
46
- */
47
- labelActions: {
48
- type: Boolean,
49
- default: false
50
- },
51
- /**
52
- * @description 是否展开所有
53
- */
54
- defaultExpandAll: {
55
- type: Boolean,
56
- default: false
57
- },
58
- /**
59
- * @description 添加记录时的默认值
60
- */
61
- defaultItemValue: {
62
- type: [Object, Function],
63
- default: () => ({})
64
- },
65
- /**
66
- * @description 保留最后一个不被删除
67
- */
68
- keepLast: {
69
- type: Boolean,
70
- default: false
71
- },
72
- /**
73
- * @description 是否开启顶部的添加按钮
74
- */
75
- topSplicable: {
76
- type: Boolean,
77
- default: true
78
- },
79
- slots: {
80
- type: Object,
81
- default: () => ({})
82
- }
83
- };
84
- const emits = {
85
- "update:modelValue": null
86
- };
87
-
88
- const ROW_KEY = "_row_key";
89
- var _sfc_main$1 = /* @__PURE__ */vue.defineComponent({
90
- ...{
91
- inheritAttrs: false
92
- },
93
- __name: "core",
94
- props: props,
95
- emits,
96
- setup(__props, {
97
- expose: __expose,
98
- emit: __emit
99
- }) {
100
- __expose();
101
- const ElTable = elementPlus$1.ElTable;
102
- const props = __props;
103
- const emit = __emit;
104
- const {
105
- tr
106
- } = elementPlus.useLocale();
107
- const formItemBindProps = formItem._VkfFormItemCtx.createBindProps(props);
108
- const readonly = composables.useComputedReadonly(props);
109
- const formData = vue.computed(() => {
110
- if (!props.prop || props.prop.length === 0) {
111
- return props.modelValue;
112
- }
113
- const data = {};
114
- core.ensetData(data, {
115
- k: props.prop,
116
- v: props.modelValue
117
- });
118
- return data;
119
- });
120
- const innerCtx = {
121
- addExpandRowKey,
122
- removeExpandRowKey,
123
- getExpandRowKeys
124
- };
125
- const fullColumns = vue.computed(() => {
126
- return props.columns.map(column => {
127
- return {
128
- ...column,
129
- slots: e => {
130
- const prop = [props.prop ?? [], e.$index, column.prop].flat();
131
- const formItemProps = {
132
- prop,
133
- readonly: readonly.value,
134
- templateType: column.templateType,
135
- templateProps: column.templateProps
136
- };
137
- if (_function.isCallable(column.templateProps)) {
138
- formItemProps.templateProps = () => {
139
- return column.templateProps(e.row);
140
- };
141
- }
142
- return vue.createVNode(formItemRenderer.VkfFormItemRenderer, {
143
- "source": [{
144
- ...formItemProps,
145
- ...column.createTemplateProps?.(e, formItemProps, innerCtx)
146
- }]
147
- }, null);
148
- }
149
- };
150
- });
151
- });
152
- const expandFormItemRaws = vue.computed(() => props.columns.filter(e => e.expandVisible));
153
- const expandColumn = {
154
- type: "expand",
155
- slots: e => {
156
- const source = expandFormItemRaws.value.map(column => {
157
- const prop = [props.prop ?? [], e.$index, column.prop].flat();
158
- const formItemProps = {
159
- prop,
160
- label: column.label,
161
- readonly: readonly.value,
162
- templateType: column.templateType,
163
- templateProps: column.templateProps
164
- };
165
- return {
166
- ...formItemProps,
167
- ...column.createTemplateProps?.(e, formItemProps, innerCtx)
168
- };
169
- });
170
- return vue.createVNode(fieldset.VkfFieldset, {
171
- "class": "vk-input-collection__expand-fieldset",
172
- "label-width": "auto",
173
- "label-position": "right"
174
- }, {
175
- default: () => [vue.createVNode(formItemRenderer.VkfFormItemRenderer, {
176
- "source": source
177
- }, null)]
178
- });
179
- }
180
- };
181
- const buttonsColumn = vue.computed(() => ({
182
- label: tr("vkf.common.operations", "\u64CD\u4F5C"),
183
- align: "center",
184
- width: "85",
185
- hidden: readonly.value || !props.splicable,
186
- className: "vk-input-collection__buttons",
187
- slots: ({
188
- $index
189
- }) => vue.createVNode(vue.Fragment, null, [vue.createVNode(elementPlus$1.ElButton, {
190
- "size": "small",
191
- "icon": index.plus_default,
192
- "type": "primary",
193
- "link": true,
194
- "circle": true,
195
- "onClick": () => handlePlus($index)
196
- }, null), vue.createVNode(elementPlus$1.ElButton, {
197
- "size": "small",
198
- "icon": index.minus_default,
199
- "type": "primary",
200
- "link": true,
201
- "circle": true,
202
- "disabled": props.modelValue.length <= 1 && props.keepLast,
203
- "onClick": () => handleMinus($index)
204
- }, null)])
205
- }));
206
- const allColumns = vue.computed(() => {
207
- const data = [...fullColumns.value, buttonsColumn.value];
208
- if (expandFormItemRaws.value.length) {
209
- data.unshift(expandColumn);
210
- }
211
- return data;
212
- });
213
- function handlePlus(index) {
214
- const data = cloneDeep.cloneDeep(props.modelValue);
215
- const defaultItemValue = _function.isCallable(props.defaultItemValue) ? props.defaultItemValue() : props.defaultItemValue;
216
- data.splice(index + 1, 0, cloneDeep.cloneDeep(defaultItemValue));
217
- emit("update:modelValue", data);
218
- setExpandRowKeys([]);
219
- }
220
- function handleMinus(index) {
221
- if (props.keepLast && props.modelValue.length <= 1) {
222
- return;
223
- }
224
- const data = cloneDeep.cloneDeep(props.modelValue);
225
- data.splice(index, 1);
226
- emit("update:modelValue", data);
227
- setExpandRowKeys([]);
228
- }
229
- const addToFirst = () => {
230
- const defaultItemValue = _function.isCallable(props.defaultItemValue) ? props.defaultItemValue() : props.defaultItemValue;
231
- emit("update:modelValue", [cloneDeep.cloneDeep(defaultItemValue), ...(props.modelValue ?? [])]);
232
- setExpandRowKeys([]);
233
- };
234
- const handleFormSetData = e => {
235
- const data = cloneDeep.cloneDeep(formData.value);
236
- core.ensetData(data, e);
237
- emit("update:modelValue", core.getValue(data, props.prop));
238
- };
239
- const tableData = vue.computed(() => {
240
- return props.modelValue?.map((e, index) => {
241
- return {
242
- ...e,
243
- [ROW_KEY]: `${index}`
244
- };
245
- });
246
- });
247
- const expandRowKeys = vue.ref([]);
248
- if (props.defaultExpandAll) {
249
- expandRowKeys.value = tableData.value.map(e => e[ROW_KEY]);
250
- }
251
- const handleExpandChange = (row, expandedRows) => {
252
- expandRowKeys.value = expandedRows.map(e => e[ROW_KEY]);
253
- };
254
- function setExpandRowKeys(v) {
255
- expandRowKeys.value = v;
256
- }
257
- function addExpandRowKey(v) {
258
- if (expandRowKeys.value.indexOf(v) === -1) {
259
- expandRowKeys.value.push(v);
260
- }
261
- }
262
- function removeExpandRowKey(v) {
263
- for (let i = 0; i < expandRowKeys.value.length; i++) {
264
- if (expandRowKeys.value[i] === v) {
265
- expandRowKeys.value.splice(i, 1);
266
- break;
267
- }
268
- }
269
- }
270
- function getExpandRowKeys() {
271
- return expandRowKeys.value;
272
- }
273
- const __returned__ = {
274
- ElTable,
275
- props,
276
- emit,
277
- tr,
278
- formItemBindProps,
279
- readonly,
280
- formData,
281
- innerCtx,
282
- fullColumns,
283
- expandFormItemRaws,
284
- expandColumn,
285
- buttonsColumn,
286
- allColumns,
287
- handlePlus,
288
- handleMinus,
289
- addToFirst,
290
- handleFormSetData,
291
- ROW_KEY,
292
- tableData,
293
- expandRowKeys,
294
- handleExpandChange,
295
- setExpandRowKeys,
296
- addExpandRowKey,
297
- removeExpandRowKey,
298
- getExpandRowKeys,
299
- get Plus() {
300
- return index.plus_default;
301
- },
302
- get VkfFormItem() {
303
- return formItem.VkfFormItem;
304
- },
305
- get VkfRendererData() {
306
- return rendererData.VkfRendererData;
307
- },
308
- get VkfTemplateInstancesProvider() {
309
- return templateInstancesProvider.VkfTemplateInstancesProvider;
310
- },
311
- get VkfTemplatesDefault() {
312
- return templatesDefault.VkfTemplatesDefault;
313
- },
314
- get VkTableColumns() {
315
- return tableColumns.VkTableColumns;
316
- },
317
- get ElButton() {
318
- return elementPlus$1.ElButton;
319
- }
320
- };
321
- Object.defineProperty(__returned__, "__isScriptSetup", {
322
- enumerable: false,
323
- value: true
324
- });
325
- return __returned__;
326
- }
327
- });
328
-
329
- const _hoisted_1 = {
330
- key: 0,
331
- class: "vkf-input-collection-options"
332
- };
333
- function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
334
- return vue.openBlock(), vue.createBlock($setup["VkfTemplateInstancesProvider"], null, {
335
- placeholder: vue.withCtx(() => [
336
- vue.createVNode($setup["VkfTemplatesDefault"])
337
- ]),
338
- default: vue.withCtx(() => [
339
- vue.createVNode(
340
- $setup["VkfFormItem"],
341
- vue.normalizeProps(vue.guardReactiveProps({
342
- ...$setup.formItemBindProps,
343
- ..._ctx.$attrs
344
- })),
345
- vue.createSlots({
346
- default: vue.withCtx(() => [
347
- !$setup.readonly && _ctx.splicable && !_ctx.labelActions && _ctx.topSplicable ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1, [
348
- vue.createVNode($setup["ElButton"], {
349
- type: "primary",
350
- onClick: $setup.addToFirst
351
- }, {
352
- default: vue.withCtx(() => [
353
- vue.createTextVNode(
354
- vue.toDisplayString($setup.tr("vkf.common.add", "\u6DFB\u52A0")),
355
- 1
356
- /* TEXT */
357
- )
358
- ]),
359
- _: 1
360
- /* STABLE */
361
- })
362
- ])) : vue.createCommentVNode("v-if", true),
363
- vue.createVNode($setup["VkfRendererData"], {
364
- data: $setup.formData,
365
- onSetData: $setup.handleFormSetData
366
- }, {
367
- default: vue.withCtx(() => [
368
- vue.createVNode($setup["ElTable"], {
369
- data: $setup.tableData,
370
- class: "vkf-input-collection-table",
371
- "row-key": $setup.ROW_KEY,
372
- "expand-row-keys": $setup.expandRowKeys,
373
- "preserve-expanded-content": true,
374
- onExpandChange: $setup.handleExpandChange
375
- }, {
376
- default: vue.withCtx(() => [
377
- vue.createVNode($setup["VkTableColumns"], { source: $setup.allColumns }, null, 8, ["source"])
378
- ]),
379
- _: 1
380
- /* STABLE */
381
- }, 8, ["data", "expand-row-keys"])
382
- ]),
383
- _: 1
384
- /* STABLE */
385
- }, 8, ["data"])
386
- ]),
387
- _: 2
388
- /* DYNAMIC */
389
- }, [
390
- _ctx.labelActions ? {
391
- name: "labelActions",
392
- fn: vue.withCtx(() => [
393
- vue.renderSlot(_ctx.$slots, "labelActions"),
394
- !$setup.readonly && _ctx.splicable && _ctx.topSplicable ? (vue.openBlock(), vue.createBlock($setup["ElButton"], {
395
- key: 0,
396
- size: "small",
397
- icon: $setup.Plus,
398
- onClick: $setup.addToFirst
399
- }, {
400
- default: vue.withCtx(() => [
401
- vue.createTextVNode(
402
- vue.toDisplayString($setup.tr("vkf.common.add", "\u6DFB\u52A0")),
403
- 1
404
- /* TEXT */
405
- )
406
- ]),
407
- _: 1
408
- /* STABLE */
409
- }, 8, ["icon"])) : vue.createCommentVNode("v-if", true)
410
- ]),
411
- key: "0"
412
- } : void 0
413
- ]),
414
- 1040
415
- /* FULL_PROPS, DYNAMIC_SLOTS */
416
- ),
417
- vue.renderSlot(_ctx.$slots, "default")
418
- ]),
419
- _: 3
420
- /* FORWARDED */
421
- });
422
- }
423
- var Core = /* @__PURE__ */ _pluginVue_exportHelper._export_sfc(_sfc_main$1, [["render", _sfc_render], ["__file", "/home/runner/work/private-vunk-form/private-vunk-form/packages/components/input-collection/src/core.vue"]]);
424
-
425
- var _sfc_main = vue.defineComponent({
426
- name: "VkfInputCollection",
427
- props,
428
- emits,
429
- setup(props2, { emit, slots }) {
430
- return () => vue.h(Core, {
431
- ...props2,
432
- "onUpdate:modelValue": (v) => emit("update:modelValue", v)
433
- }, {
434
- ...props2.slots,
435
- ...slots
436
- });
437
- }
438
- });
439
-
440
- var VkfInputCollection = /* @__PURE__ */ _pluginVue_exportHelper._export_sfc(_sfc_main, [["__file", "/home/runner/work/private-vunk-form/private-vunk-form/packages/components/input-collection/src/index.vue"]]);
441
-
442
- var types = /*#__PURE__*/Object.freeze({
443
- __proto__: null
444
- });
445
-
446
- VkfInputCollection.install = (app) => {
447
- app.component(VkfInputCollection.name || "VkfInputCollection", VkfInputCollection);
448
- };
449
-
450
- exports.VkfInputCollection = VkfInputCollection;
451
- exports.__VkfInputCollection = types;
452
- exports.default = VkfInputCollection;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),v=require("../index.cjs"),b=require("@vunk/core"),M=require("@vunk/form/components/fieldset"),h=require("@vunk/form/components/form-item"),B=require("@vunk/form/components/form-item-renderer"),U=require("@vunk/form/components/renderer-data"),W=require("@vunk/form/components/template-instances-provider"),Y=require("@vunk/form/components/templates-default"),G=require("@vunk/form/composables"),H=require("@vunk/form/composables/element-plus"),J=require("@vunk/plus/components/table-columns"),s=require("element-plus"),C=require("@vunk/shared/function"),p=require("../cloneDeep.cjs"),D={...h._VkfFormItemCtx.props,columns:{type:Array,default:()=>[]},modelValue:{type:Array,default:()=>[]},readonly:{type:Boolean,default:void 0},splicable:{type:Boolean,default:!0},labelActions:{type:Boolean,default:!1},defaultExpandAll:{type:Boolean,default:!1},defaultItemValue:{type:[Object,Function],default:()=>({})},keepLast:{type:Boolean,default:!1},topSplicable:{type:Boolean,default:!0},slots:{type:Object,default:()=>({})}},N={"update:modelValue":null},Q={key:0,class:"vkf-input-collection-options"},f="_row_key",X=e.defineComponent({inheritAttrs:!1,__name:"core",props:D,emits:N,setup(d,{emit:m}){const V=s.ElTable,l=d,c=m,{tr:y}=H.useLocale(),T=h._VkfFormItemCtx.createBindProps(l),r=G.useComputedReadonly(l),_=e.computed(()=>{if(!l.prop||l.prop.length===0)return l.modelValue;const t={};return b.ensetData(t,{k:l.prop,v:l.modelValue}),t}),x={addExpandRowKey:j,removeExpandRowKey:z,getExpandRowKeys:L},q=e.computed(()=>l.columns.map(t=>({...t,slots:a=>{var u;const i={prop:[l.prop??[],a.$index,t.prop].flat(),readonly:r.value,templateType:t.templateType,templateProps:t.templateProps};return C.isCallable(t.templateProps)&&(i.templateProps=()=>t.templateProps(a.row)),e.createVNode(B.VkfFormItemRenderer,{source:[{...i,...(u=t.createTemplateProps)==null?void 0:u.call(t,a,i,x)}]},null)}}))),I=e.computed(()=>l.columns.filter(t=>t.expandVisible)),S={type:"expand",slots:t=>{const a=I.value.map(o=>{var g;const u={prop:[l.prop??[],t.$index,o.prop].flat(),label:o.label,readonly:r.value,templateType:o.templateType,templateProps:o.templateProps};return{...u,...(g=o.createTemplateProps)==null?void 0:g.call(o,t,u,x)}});return e.createVNode(M.VkfFieldset,{class:"vk-input-collection__expand-fieldset","label-width":"auto","label-position":"right"},{default:()=>[e.createVNode(B.VkfFormItemRenderer,{source:a},null)]})}},R=e.computed(()=>({label:y("vkf.common.operations","操作"),align:"center",width:"85",hidden:r.value||!l.splicable,className:"vk-input-collection__buttons",slots:({$index:t})=>e.createVNode(e.Fragment,null,[e.createVNode(s.ElButton,{size:"small",icon:v.plus_default,type:"primary",link:!0,circle:!0,onClick:()=>A(t)},null),e.createVNode(s.ElButton,{size:"small",icon:v.minus_default,type:"primary",link:!0,circle:!0,disabled:l.modelValue.length<=1&&l.keepLast,onClick:()=>O(t)},null)])})),F=e.computed(()=>{const t=[...q.value,R.value];return I.value.length&&t.unshift(S),t});function A(t){const a=p.cloneDeep(l.modelValue),o=C.isCallable(l.defaultItemValue)?l.defaultItemValue():l.defaultItemValue;a.splice(t+1,0,p.cloneDeep(o)),c("update:modelValue",a),k([])}function O(t){if(l.keepLast&&l.modelValue.length<=1)return;const a=p.cloneDeep(l.modelValue);a.splice(t,1),c("update:modelValue",a),k([])}const w=()=>{const t=C.isCallable(l.defaultItemValue)?l.defaultItemValue():l.defaultItemValue;c("update:modelValue",[p.cloneDeep(t),...l.modelValue??[]]),k([])},$=t=>{const a=p.cloneDeep(_.value);b.ensetData(a,t),c("update:modelValue",b.getValue(a,l.prop))},P=e.computed(()=>{var t;return(t=l.modelValue)==null?void 0:t.map((a,o)=>({...a,[f]:`${o}`}))}),n=e.ref([]);l.defaultExpandAll&&(n.value=P.value.map(t=>t[f]));const K=(t,a)=>{n.value=a.map(o=>o[f])};function k(t){n.value=t}function j(t){n.value.indexOf(t)===-1&&n.value.push(t)}function z(t){for(let a=0;a<n.value.length;a++)if(n.value[a]===t){n.value.splice(a,1);break}}function L(){return n.value}return(t,a)=>(e.openBlock(),e.createBlock(e.unref(W.VkfTemplateInstancesProvider),null,{placeholder:e.withCtx(()=>[e.createVNode(e.unref(Y.VkfTemplatesDefault))]),default:e.withCtx(()=>[e.createVNode(e.unref(h.VkfFormItem),e.normalizeProps(e.guardReactiveProps({...e.unref(T),...t.$attrs})),e.createSlots({default:e.withCtx(()=>[!e.unref(r)&&t.splicable&&!t.labelActions&&t.topSplicable?(e.openBlock(),e.createElementBlock("div",Q,[e.createVNode(e.unref(s.ElButton),{type:"primary",onClick:w},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(y)("vkf.common.add","添加")),1)]),_:1})])):e.createCommentVNode("",!0),e.createVNode(e.unref(U.VkfRendererData),{data:_.value,onSetData:$},{default:e.withCtx(()=>[e.createVNode(e.unref(V),{data:P.value,class:"vkf-input-collection-table","row-key":f,"expand-row-keys":n.value,"preserve-expanded-content":!0,onExpandChange:K},{default:e.withCtx(()=>[e.createVNode(e.unref(J.VkTableColumns),{source:F.value},null,8,["source"])]),_:1},8,["data","expand-row-keys"])]),_:1},8,["data"])]),_:2},[t.labelActions?{name:"labelActions",fn:e.withCtx(()=>[e.renderSlot(t.$slots,"labelActions"),!e.unref(r)&&t.splicable&&t.topSplicable?(e.openBlock(),e.createBlock(e.unref(s.ElButton),{key:0,size:"small",icon:e.unref(v.plus_default),onClick:w},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(y)("vkf.common.add","添加")),1)]),_:1},8,["icon"])):e.createCommentVNode("",!0)]),key:"0"}:void 0]),1040),e.renderSlot(t.$slots,"default")]),_:3}))}}),E=e.defineComponent({name:"VkfInputCollection",props:D,emits:N,setup(d,{emit:m,slots:V}){return()=>e.h(X,{...d,"onUpdate:modelValue":l=>m("update:modelValue",l)},{...d.slots,...V})}}),Z=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));exports.VkfInputCollection=E;exports.__VkfInputCollection=Z;exports.default=E;