@vunk/form 2.18.2 → 2.19.0
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.
- package/components/_plugin-vue_export-helper.cjs +1 -11
- package/components/api-tables-select/index.cjs +1 -467
- package/components/api-tables-select/index.mjs +56 -413
- package/components/api-tables-select/src/ctx.d.ts +152 -172
- package/components/api-tables-select/src/index.vue.d.ts +394 -983
- package/components/button/index.cjs +1 -112
- package/components/button/index.mjs +57 -85
- package/components/button/src/ctx.d.ts +28 -113
- package/components/button/src/index.vue.d.ts +317 -625
- package/components/card-input-collection/index.cjs +1 -370
- package/components/card-input-collection/index.mjs +175 -277
- package/components/card-input-collection/src/core.vue.d.ts +54 -951
- package/components/card-input-collection/src/ctx.d.ts +19 -49
- package/components/card-input-collection/src/index.vue.d.ts +46 -110
- package/components/cascader/index.cjs +1 -150
- package/components/cascader/index.mjs +88 -116
- package/components/cascader/src/ctx.d.ts +140 -207
- package/components/cascader/src/index.vue.d.ts +315 -522
- package/components/cascader/src/use.d.ts +1 -1
- package/components/checkbox/index.cjs +1 -152
- package/components/checkbox/index.mjs +75 -119
- package/components/checkbox/src/ctx.d.ts +46 -69
- package/components/checkbox/src/index.vue.d.ts +448 -1016
- package/components/cloneDeep.cjs +1 -2106
- package/components/color-picker/index.cjs +1 -80
- package/components/color-picker/index.mjs +46 -69
- package/components/color-picker/src/ctx.d.ts +130 -107
- package/components/color-picker/src/index.vue.d.ts +285 -255
- package/components/date-picker/index.cjs +1 -119
- package/components/date-picker/index.mjs +63 -97
- package/components/date-picker/src/ctx.d.ts +123 -206
- package/components/date-picker/src/index.vue.d.ts +269 -1358
- package/components/date-picker/src/types.d.ts +7 -7
- package/components/date-picker-range/index.cjs +1 -177
- package/components/date-picker-range/index.mjs +62 -113
- package/components/date-picker-range/src/ctx.d.ts +130 -206
- package/components/date-picker-range/src/index.vue.d.ts +861 -448
- package/components/debounce.cjs +1 -0
- package/components/dialog/index.cjs +1 -126
- package/components/dialog/index.mjs +65 -99
- package/components/dialog/src/ctx.d.ts +17 -108
- package/components/dialog/src/index.vue.d.ts +77 -1072
- package/components/dialog-input-collection/index.cjs +1 -624
- package/components/dialog-input-collection/index.mjs +276 -498
- package/components/dialog-input-collection/src/ctx.d.ts +21 -52
- package/components/dialog-input-collection/src/dialog-form.vue.d.ts +29 -6371
- package/components/dialog-input-collection/src/index.vue.d.ts +65 -7630
- package/components/dialog-input-collection/src/layout.vue.d.ts +13 -73
- package/components/download-plus/index.cjs +1 -456
- package/components/download-plus/index.mjs +215 -358
- package/components/download-plus/src/api.d.ts +1 -1
- package/components/download-plus/src/ctx.d.ts +21 -52
- package/components/download-plus/src/index.vue.d.ts +437 -1177
- package/components/editable-text/index.cjs +1 -295
- package/components/editable-text/index.mjs +113 -239
- package/components/editable-text/src/ctx.d.ts +24 -50
- package/components/editable-text/src/index.vue.d.ts +59 -3258
- package/components/el-slider/index.cjs +1 -0
- package/components/el-slider/index.d.ts +5 -0
- package/components/el-slider/index.mjs +475 -0
- package/components/el-slider/src/button.d.ts +36 -0
- package/components/el-slider/src/button.vue.d.ts +41 -0
- package/components/el-slider/src/composables/index.cjs +1 -0
- package/components/el-slider/src/composables/index.d.ts +6 -0
- package/components/el-slider/src/composables/index.mjs +9 -0
- package/components/el-slider/src/composables/use-lifecycle.d.ts +4 -0
- package/components/el-slider/src/composables/use-marks.d.ts +7 -0
- package/components/el-slider/src/composables/use-slide.d.ts +23 -0
- package/components/el-slider/src/composables/use-slider-button.d.ts +18 -0
- package/components/el-slider/src/composables/use-stops.d.ts +8 -0
- package/components/el-slider/src/composables/use-watch.d.ts +4 -0
- package/components/el-slider/src/constants.d.ts +14 -0
- package/components/el-slider/src/marker.d.ts +37 -0
- package/components/el-slider/src/slider-core.vue.d.ts +218 -0
- package/components/el-slider/src/slider.d.ts +174 -0
- package/components/esri-input-geojson/index.cjs +2 -1604
- package/components/esri-input-geojson/index.mjs +682 -1290
- package/components/esri-input-geojson/src/append.vue.d.ts +239 -1099
- package/components/esri-input-geojson/src/const.d.ts +1 -1
- package/components/esri-input-geojson/src/ctx.d.ts +66 -161
- package/components/esri-input-geojson/src/default-view.vue.d.ts +8 -132
- package/components/esri-input-geojson/src/index.vue.d.ts +982 -708
- package/components/esri-input-geojson/src/types.d.ts +1 -0
- package/components/esri-input-geojson/src/viewer.vue.d.ts +53 -282
- package/components/fieldset/index.cjs +1 -110
- package/components/fieldset/index.mjs +63 -76
- package/components/fieldset/src/ctx.d.ts +4 -4
- package/components/fieldset/src/index.vue.d.ts +7 -7
- package/components/form/index.cjs +1 -248
- package/components/form/index.mjs +107 -161
- package/components/form/src/ctx.d.ts +15 -64
- package/components/form/src/index.vue.d.ts +374 -2431
- package/components/form-item/index.cjs +1 -294
- package/components/form-item/index.mjs +140 -229
- package/components/form-item/src/core.vue.d.ts +32 -1854
- package/components/form-item/src/ctx.d.ts +19 -51
- package/components/form-item/src/index.vue.d.ts +38 -101
- package/components/form-item-renderer/index.cjs +1 -193
- package/components/form-item-renderer/index.mjs +103 -162
- package/components/form-item-renderer/src/core.vue.d.ts +9 -9
- package/components/form-item-renderer/src/ctx.d.ts +3 -3
- package/components/form-item-renderer/src/index.vue.d.ts +24 -74
- package/components/form-item-renderer-template/index.cjs +1 -47
- package/components/form-item-renderer-template/index.mjs +20 -33
- package/components/form-item-renderer-template/src/index.vue.d.ts +1 -1
- package/components/forms-provider/index.cjs +1 -99
- package/components/forms-provider/index.mjs +44 -73
- package/components/forms-provider/src/core.d.ts +3 -2
- package/components/forms-provider/src/segment.vue.d.ts +8 -8
- package/components/forms-provider/src/view.vue.d.ts +14 -4
- package/components/index.cjs +1 -399
- package/components/index2.cjs +1 -17
- package/components/information/index.cjs +1 -65
- package/components/information/index.mjs +28 -38
- package/components/information/src/ctx.d.ts +2 -2
- package/components/information/src/index.vue.d.ts +4 -4
- package/components/information-collection/index.cjs +1 -81
- package/components/information-collection/index.mjs +44 -48
- package/components/information-collection/src/ctx.d.ts +29 -65
- package/components/information-collection/src/index.vue.d.ts +64 -136
- package/components/information-renderer/index.cjs +1 -16
- package/components/information-renderer/index.d.ts +9 -9
- package/components/information-renderer/index.mjs +9 -10
- package/components/information-tag/index.cjs +1 -101
- package/components/information-tag/index.mjs +44 -54
- package/components/information-tag/src/ctx.d.ts +6 -21
- package/components/information-tag/src/index.vue.d.ts +23 -51
- package/components/information-templates-default/index.cjs +1 -101
- package/components/information-templates-default/index.mjs +63 -73
- package/components/information-templates-default/src/index.vue.d.ts +1 -1
- package/components/input/index.cjs +1 -115
- package/components/input/index.mjs +60 -83
- package/components/input/src/ctx.d.ts +51 -152
- package/components/input/src/index.vue.d.ts +392 -951
- package/components/input-array/index.cjs +1 -310
- package/components/input-array/index.mjs +114 -244
- package/components/input-array/src/ctx.d.ts +19 -49
- package/components/input-array/src/form-template.vue.d.ts +1 -901
- package/components/input-array/src/index.vue.d.ts +43 -730
- package/components/input-collection/index.cjs +1 -452
- package/components/input-collection/index.mjs +195 -355
- package/components/input-collection/src/core.vue.d.ts +64 -1026
- package/components/input-collection/src/ctx.d.ts +21 -51
- package/components/input-collection/src/index.vue.d.ts +50 -114
- package/components/input-file/index.cjs +1 -142
- package/components/input-file/index.mjs +68 -100
- package/components/input-file/src/ctx.d.ts +8 -29
- package/components/input-file/src/index.vue.d.ts +444 -74
- package/components/input-file/src/template.vue.d.ts +1 -124
- package/components/input-link/index.cjs +1 -167
- package/components/input-link/index.mjs +60 -83
- package/components/input-link/src/ctx.d.ts +52 -137
- package/components/input-link/src/index.vue.d.ts +833 -311
- package/components/input-number/index.cjs +1 -119
- package/components/input-number/index.mjs +73 -87
- package/components/input-number/src/ctx.d.ts +38 -131
- package/components/input-number/src/index.vue.d.ts +321 -683
- package/components/input-tag/index.cjs +1 -100
- package/components/input-tag/index.mjs +51 -78
- package/components/input-tag/src/ctx.d.ts +43 -145
- package/components/input-tag/src/index.vue.d.ts +324 -778
- package/components/isObject.cjs +1 -165
- package/components/monaco-editor/index.cjs +1 -83
- package/components/monaco-editor/index.mjs +40 -59
- package/components/monaco-editor/src/ctx.d.ts +19 -44
- package/components/monaco-editor/src/index.vue.d.ts +209 -109
- package/components/radio/index.cjs +1 -267
- package/components/radio/index.mjs +110 -209
- package/components/radio/src/ctx.d.ts +27 -91
- package/components/radio/src/index.vue.d.ts +298 -1279
- package/components/radio/src/option.vue.d.ts +29 -881
- package/components/radio/src/wraper.vue.d.ts +64 -196
- package/components/renderer-data/index.cjs +1 -41
- package/components/renderer-data/index.mjs +19 -26
- package/components/renderer-data/src/ctx.d.ts +1 -1
- package/components/renderer-data/src/index.vue.d.ts +2 -2
- package/components/select/index.cjs +1 -311
- package/components/select/index.mjs +156 -214
- package/components/select/src/core.vue.d.ts +638 -1080
- package/components/select/src/ctx.d.ts +140 -223
- package/components/select/src/index.vue.d.ts +334 -610
- package/components/select/src/options.vue.d.ts +1 -1
- package/components/slider/index.cjs +1 -88
- package/components/slider/index.mjs +41 -70
- package/components/slider/src/ctx.d.ts +63 -174
- package/components/slider/src/index.vue.d.ts +151 -420
- package/components/style.css +1 -0
- package/components/switch/index.cjs +1 -88
- package/components/switch/index.mjs +37 -69
- package/components/switch/src/ctx.d.ts +34 -113
- package/components/switch/src/index.vue.d.ts +88 -699
- package/components/switch/src/types.d.ts +2 -2
- package/components/tables-select/index.cjs +1 -263
- package/components/tables-select/index.mjs +102 -172
- package/components/tables-select/src/ctx.d.ts +76 -91
- package/components/tables-select/src/index.vue.d.ts +228 -4969
- package/components/template-instances-provider/index.cjs +1 -31
- package/components/template-instances-provider/index.mjs +18 -22
- package/components/template-instances-provider/src/index.vue.d.ts +2 -2
- package/components/templates-default/index.cjs +1 -235
- package/components/templates-default/index.mjs +152 -211
- package/components/templates-default/src/ctx.d.ts +5 -3
- package/components/templates-default/src/index.vue.d.ts +7298 -157
- package/components/templates-element-plus/index.cjs +1 -112
- package/components/templates-element-plus/index.mjs +49 -91
- package/components/templates-element-plus/src/ctx.d.ts +1 -1
- package/components/templates-element-plus/src/index.vue.d.ts +65 -258
- package/components/templates-esri/index.cjs +1 -65
- package/components/templates-esri/index.mjs +29 -39
- package/components/templates-esri/src/ctx.d.ts +1 -1
- package/components/templates-esri/src/index.vue.d.ts +1776 -24
- package/components/templates-layout/index.cjs +1 -137
- package/components/templates-layout/index.mjs +78 -116
- package/components/templates-layout/src/ctx.d.ts +1 -1
- package/components/templates-layout/src/index.vue.d.ts +79 -411
- package/components/templates-variant/index.cjs +1 -70
- package/components/templates-variant/index.mjs +33 -43
- package/components/templates-variant/src/ctx.d.ts +1 -1
- package/components/templates-variant/src/index.vue.d.ts +1238 -24
- package/components/time-picker/index.cjs +1 -104
- package/components/time-picker/index.mjs +57 -87
- package/components/time-picker/src/ctx.d.ts +121 -211
- package/components/time-picker/src/index.vue.d.ts +263 -1368
- package/components/upload/index.cjs +1 -663
- package/components/upload/index.mjs +343 -537
- package/components/upload/src/ctx.d.ts +108 -195
- package/components/upload/src/file.vue.d.ts +197 -776
- package/components/upload/src/index.vue.d.ts +689 -1931
- package/components/upload/src/types.d.ts +1 -1
- package/components/upload/src/wraper.vue.d.ts +232 -407
- package/components/upload-plus/index.cjs +21 -18673
- package/components/upload-plus/index.mjs +4598 -18372
- package/components/upload-plus/src/api.d.ts +2 -2
- package/components/upload-plus/src/ctx.d.ts +24 -51
- package/components/upload-plus/src/index.vue.d.ts +51 -1656
- package/components/use-watch.cjs +1 -0
- package/components/van-cascader/index.cjs +1 -125
- package/components/van-cascader/index.mjs +51 -96
- package/components/van-cascader/src/ctx.d.ts +135 -203
- package/components/van-cascader/src/index.vue.d.ts +312 -985
- package/components/var-datetime-picker/index.cjs +1 -333
- package/components/var-datetime-picker/index.mjs +175 -254
- package/components/var-datetime-picker/src/ctx.d.ts +19 -50
- package/components/var-datetime-picker/src/index.vue.d.ts +688 -1115
- package/components/vditor/index.cjs +1 -86
- package/components/vditor/index.mjs +40 -66
- package/components/vditor/src/ctx.d.ts +16 -45
- package/components/vditor/src/index.vue.d.ts +195 -120
- package/composables/element-plus/index.cjs +1 -23
- package/composables/element-plus/index.mjs +14 -18
- package/composables/index.cjs +1 -161
- package/composables/index.d.ts +1 -0
- package/composables/index.mjs +102 -135
- package/composables/useForm.d.ts +2 -2
- package/composables/useRtl.d.ts +18 -0
- package/composables/useSourceManager.d.ts +2 -2
- package/composables/useTemplateInstances.d.ts +3 -3
- package/index.css +1 -562
- package/index.d.ts +0 -3
- package/index.esm.js +23 -48
- package/locale/index.cjs +1 -102
- package/locale/index.mjs +34 -34
- package/locale/lang/index.cjs +1 -2
- package/locale/lang/index.d.ts +1 -0
- package/package.json +14 -85
- package/shared/const/index.cjs +1 -59
- package/shared/const/index.d.ts +1 -1
- package/shared/const/index.mjs +18 -20
- package/shared/element-plus/ctx.d.ts +40 -37
- package/shared/element-plus/index.cjs +1 -211
- package/shared/element-plus/index.mjs +93 -161
- package/shared/element-plus/instances.d.ts +207 -321
- package/shared/form/index.cjs +1 -33
- package/shared/form/index.mjs +23 -25
- package/shared/helper/index.cjs +1 -11
- package/shared/helper/index.mjs +7 -8
- package/shared/index.cjs +1 -8
- package/shared/index.mjs +5 -1
- package/shared/infer-prop/index.cjs +1 -36
- package/shared/infer-prop/index.mjs +22 -28
- package/shared/progress-it/index.cjs +1 -42
- package/shared/progress-it/index.mjs +15 -31
- package/shared/rules/index.cjs +1 -56
- package/shared/rules/index.mjs +19 -18
- package/shared/types/form/index.cjs +1 -2
- package/shared/types/index.cjs +1 -2
- package/shared/types/source/index.cjs +1 -2
- package/shared/types/source-manager/index.cjs +1 -2
- package/shared/upload/index.cjs +1 -774
- package/shared/upload/index.mjs +180 -764
- package/component.d.ts +0 -3
- package/components/_plugin-vue_export-helper.mjs +0 -9
- package/components/card-input-collection/index.css +0 -21
- package/components/cascader/index.css +0 -9
- package/components/checkbox/index.css +0 -30
- package/components/cloneDeep.mjs +0 -2104
- package/components/date-picker-range/index.css +0 -18
- package/components/dialog-input-collection/index.css +0 -21
- package/components/download-plus/index.css +0 -68
- package/components/editable-text/index.css +0 -9
- package/components/esri-input-geojson/index.css +0 -32
- package/components/fieldset/index.css +0 -5
- package/components/form-item/index.css +0 -35
- package/components/index.mjs +0 -378
- package/components/index2.mjs +0 -14
- package/components/information-tag/index.css +0 -6
- package/components/information-templates-default/index.css +0 -16
- package/components/input-array/index.css +0 -14
- package/components/input-collection/index.css +0 -20
- package/components/input-link/index.css +0 -4
- package/components/input-number/index.css +0 -13
- package/components/isObject.mjs +0 -158
- package/components/monaco-editor/index.css +0 -4
- package/components/radio/index.css +0 -40
- package/components/select/index.css +0 -15
- package/components/switch/index.css +0 -10
- package/components/tables-select/index.css +0 -3
- package/components/templates-layout/index.css +0 -3
- package/components/upload/index.css +0 -34
- package/components/upload-plus/index.css +0 -84
- package/components/van-cascader/index.css +0 -6
- package/components/var-datetime-picker/index.css +0 -17
- package/defaults.d.ts +0 -5
|
@@ -1,452 +1 @@
|
|
|
1
|
-
|
|
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;
|