@vunk/form 1.1.84 → 1.2.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 +11 -0
- package/components/button/index.cjs +112 -0
- package/components/cascader/index.cjs +130 -0
- package/components/checkbox/index.cjs +153 -0
- package/components/color-picker/index.cjs +80 -0
- package/components/date-picker/index.cjs +120 -0
- package/components/date-picker-range/index.cjs +170 -0
- package/components/download-plus/index.cjs +445 -0
- package/components/esri-input-geojson/index.cjs +1120 -0
- package/components/form/index.cjs +220 -0
- package/components/form-item/index.cjs +162 -0
- package/components/form-item-renderer/index.cjs +103 -0
- package/components/form-item-renderer-template/index.cjs +47 -0
- package/components/geoinput/index.cjs +95 -0
- package/components/geoinput-read/index.cjs +304 -0
- package/components/geoinput-update/index.cjs +406 -0
- package/components/index.cjs +13 -0
- package/components/index2.cjs +323 -0
- package/components/index3.cjs +486 -0
- package/components/input/index.cjs +119 -0
- package/components/input-link/index.cjs +157 -0
- package/components/input-number/index.cjs +100 -0
- package/components/radio/index.cjs +142 -0
- package/components/select/index.cjs +165 -0
- package/components/slider/index.cjs +89 -0
- package/components/switch/index.cjs +92 -0
- package/components/templates-default/index.cjs +308 -0
- package/components/templates-element-plus/index.cjs +112 -0
- package/components/templates-esri/index.cjs +65 -0
- package/components/templates-layout/index.cjs +137 -0
- package/components/templates-mapbox/index.cjs +65 -0
- package/components/templates-variant/index.cjs +70 -0
- package/components/upload/index.cjs +508 -0
- package/components/upload-plus/index.cjs +18658 -0
- package/components/van-cascader/index.cjs +128 -0
- package/components/var-datetime-picker/index.cjs +330 -0
- package/components/vditor/index.cjs +451 -0
- package/composables/index.cjs +89 -0
- package/package.json +97 -49
- package/shared/const/index.cjs +59 -0
- package/shared/element-plus/index.cjs +317 -0
- package/shared/form/index.cjs +33 -0
- package/shared/helper/index.cjs +11 -0
- package/shared/index.cjs +8 -0
- package/shared/infer-prop/index.cjs +36 -0
- package/shared/progress-it/index.cjs +40 -0
- package/shared/rules/index.cjs +56 -0
- package/shared/types/form/index.cjs +2 -0
- package/shared/types/index.cjs +2 -0
- package/shared/types/source/index.cjs +2 -0
- package/shared/types/source-manager/index.cjs +2 -0
- package/shared/upload/index.cjs +774 -0
|
@@ -0,0 +1,220 @@
|
|
|
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 _pluginVue_exportHelper = require('../_plugin-vue_export-helper.cjs');
|
|
17
|
+
|
|
18
|
+
const props = {
|
|
19
|
+
...elementPlus.formProps,
|
|
20
|
+
data: {
|
|
21
|
+
type: Object,
|
|
22
|
+
default: () => ({})
|
|
23
|
+
},
|
|
24
|
+
formItems: {
|
|
25
|
+
type: Array,
|
|
26
|
+
default: () => []
|
|
27
|
+
},
|
|
28
|
+
readonly: {
|
|
29
|
+
type: Boolean
|
|
30
|
+
},
|
|
31
|
+
elRef: {
|
|
32
|
+
type: Function,
|
|
33
|
+
default: () => utilsFunction.NOOP
|
|
34
|
+
},
|
|
35
|
+
/**
|
|
36
|
+
* 是否开启布局模式
|
|
37
|
+
*/
|
|
38
|
+
layout: {
|
|
39
|
+
type: Boolean,
|
|
40
|
+
default: false
|
|
41
|
+
},
|
|
42
|
+
/**
|
|
43
|
+
* layout 为 true 时,
|
|
44
|
+
* 该值生效
|
|
45
|
+
* el-row 添加额外属性
|
|
46
|
+
*/
|
|
47
|
+
rowSource: {
|
|
48
|
+
type: Object,
|
|
49
|
+
default: () => ({})
|
|
50
|
+
},
|
|
51
|
+
/**
|
|
52
|
+
* layout 为 true 时,
|
|
53
|
+
* 该值生效
|
|
54
|
+
* el-col 添加额外属性
|
|
55
|
+
*/
|
|
56
|
+
colSource: {
|
|
57
|
+
type: Object,
|
|
58
|
+
default: () => ({})
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
const createBindProps = utilsVue.bindPropsFactory(props);
|
|
62
|
+
const emits = {
|
|
63
|
+
...elementPlus.formEmits,
|
|
64
|
+
setData: (e) => e,
|
|
65
|
+
validate: null,
|
|
66
|
+
submit: null
|
|
67
|
+
};
|
|
68
|
+
const createOnEmits = utilsVue.onEmitsFactory(emits);
|
|
69
|
+
|
|
70
|
+
var ctx = /*#__PURE__*/Object.freeze({
|
|
71
|
+
__proto__: null,
|
|
72
|
+
createBindProps: createBindProps,
|
|
73
|
+
createOnEmits: createOnEmits,
|
|
74
|
+
emits: emits,
|
|
75
|
+
props: props
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
const getRowEmptySpan = (row) => {
|
|
79
|
+
return 24 - row.templateSlots.reduce((a, c) => {
|
|
80
|
+
if (!c.span) {
|
|
81
|
+
throw new Error("ElColSource span is required");
|
|
82
|
+
}
|
|
83
|
+
return a + c.span;
|
|
84
|
+
}, 0);
|
|
85
|
+
};
|
|
86
|
+
const genColItem = (formItem, options = {}) => {
|
|
87
|
+
const span = formItem.span ?? options.span;
|
|
88
|
+
if (span === void 0 || span === null) {
|
|
89
|
+
throw new Error("genColItem ElColSource span is required");
|
|
90
|
+
}
|
|
91
|
+
return {
|
|
92
|
+
...options,
|
|
93
|
+
templateType: "ElCol",
|
|
94
|
+
span,
|
|
95
|
+
templateSlots: [
|
|
96
|
+
utilsObject.pickObject(formItem, {
|
|
97
|
+
excludes: ["span"]
|
|
98
|
+
})
|
|
99
|
+
]
|
|
100
|
+
};
|
|
101
|
+
};
|
|
102
|
+
const genRowItem = (defaultItem, options = {}) => {
|
|
103
|
+
return {
|
|
104
|
+
...options,
|
|
105
|
+
templateType: "ElRow",
|
|
106
|
+
templateSlots: defaultItem ? [
|
|
107
|
+
defaultItem
|
|
108
|
+
] : []
|
|
109
|
+
};
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
var _sfc_main = vue.defineComponent({
|
|
113
|
+
name: "VkfForm",
|
|
114
|
+
components: {
|
|
115
|
+
ElForm: elementPlus.ElForm,
|
|
116
|
+
VkfFormItemRenderer: formItemRenderer.VkfFormItemRenderer,
|
|
117
|
+
VkfTemplatesDefault: templatesDefault.VkfTemplatesDefault,
|
|
118
|
+
VkfTemplatesLayout: templatesLayout.VkfTemplatesLayout
|
|
119
|
+
},
|
|
120
|
+
props,
|
|
121
|
+
emits,
|
|
122
|
+
setup(props2, { emit }) {
|
|
123
|
+
const formProps = elementPlus$1.createFormBindProps(props2, ["model"]);
|
|
124
|
+
const formEmits = elementPlus$1.createFormOnEmits(emit);
|
|
125
|
+
const formRef = vue.shallowRef();
|
|
126
|
+
const vm = vue.getCurrentInstance();
|
|
127
|
+
vue.provide("vkfFormVm", vm);
|
|
128
|
+
vue.provide("elFormRef", formRef);
|
|
129
|
+
const getRef = (e) => {
|
|
130
|
+
formRef.value = e;
|
|
131
|
+
props2.elRef(e);
|
|
132
|
+
};
|
|
133
|
+
const rendererSource = vue.computed(() => {
|
|
134
|
+
if (props2.layout) {
|
|
135
|
+
return props2.formItems.reduce((a, c) => {
|
|
136
|
+
const lastRow = a[a.length - 1];
|
|
137
|
+
const itemSpan = c.span ?? props2.colSource.span;
|
|
138
|
+
if (!itemSpan) {
|
|
139
|
+
a.push(c);
|
|
140
|
+
return a;
|
|
141
|
+
}
|
|
142
|
+
if (Reflect.has(c, "templateIf")) {
|
|
143
|
+
const templateIfFunc = form.genTemplateIfFunc(c.templateIf);
|
|
144
|
+
const flag = templateIfFunc(props2.data);
|
|
145
|
+
if (!flag) {
|
|
146
|
+
return a;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
const colItem = genColItem(c, props2.colSource);
|
|
150
|
+
if (!lastRow || getRowEmptySpan(lastRow) < itemSpan) {
|
|
151
|
+
a.push(genRowItem(colItem, props2.rowSource));
|
|
152
|
+
} else {
|
|
153
|
+
lastRow.templateSlots.push(colItem);
|
|
154
|
+
}
|
|
155
|
+
return a;
|
|
156
|
+
}, []);
|
|
157
|
+
}
|
|
158
|
+
return props2.formItems;
|
|
159
|
+
});
|
|
160
|
+
const handleSubmit = (e) => {
|
|
161
|
+
e.preventDefault();
|
|
162
|
+
emit("submit", e);
|
|
163
|
+
};
|
|
164
|
+
return {
|
|
165
|
+
formProps,
|
|
166
|
+
formEmits,
|
|
167
|
+
getValue: helper.getValue,
|
|
168
|
+
getRef,
|
|
169
|
+
computed: vue.computed,
|
|
170
|
+
rendererSource,
|
|
171
|
+
handleSubmit
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
});
|
|
175
|
+
|
|
176
|
+
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
177
|
+
const _component_VkfTemplatesDefault = vue.resolveComponent("VkfTemplatesDefault");
|
|
178
|
+
const _component_VkfTemplatesLayout = vue.resolveComponent("VkfTemplatesLayout");
|
|
179
|
+
const _component_VkfFormItemRenderer = vue.resolveComponent("VkfFormItemRenderer");
|
|
180
|
+
const _component_ElForm = vue.resolveComponent("ElForm");
|
|
181
|
+
return vue.openBlock(), vue.createBlock(_component_ElForm, vue.mergeProps(_ctx.formProps, {
|
|
182
|
+
ref: _ctx.getRef,
|
|
183
|
+
class: {
|
|
184
|
+
"is-readonly": _ctx.readonly
|
|
185
|
+
},
|
|
186
|
+
model: _ctx.model || _ctx.data
|
|
187
|
+
}, vue.toHandlers(_ctx.formEmits), { onSubmit: _ctx.handleSubmit }), {
|
|
188
|
+
default: vue.withCtx(() => [
|
|
189
|
+
vue.createVNode(_component_VkfFormItemRenderer, { source: _ctx.rendererSource }, {
|
|
190
|
+
default: vue.withCtx(() => [
|
|
191
|
+
vue.createVNode(_component_VkfTemplatesDefault, {
|
|
192
|
+
data: _ctx.data,
|
|
193
|
+
onSetData: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("setData", $event))
|
|
194
|
+
}, null, 8, ["data"]),
|
|
195
|
+
vue.createVNode(_component_VkfTemplatesLayout, { data: _ctx.data }, null, 8, ["data"]),
|
|
196
|
+
vue.renderSlot(_ctx.$slots, "rendererTemplate")
|
|
197
|
+
]),
|
|
198
|
+
_: 3
|
|
199
|
+
/* FORWARDED */
|
|
200
|
+
}, 8, ["source"]),
|
|
201
|
+
vue.renderSlot(_ctx.$slots, "default")
|
|
202
|
+
]),
|
|
203
|
+
_: 3
|
|
204
|
+
/* FORWARDED */
|
|
205
|
+
}, 16, ["class", "model", "onSubmit"]);
|
|
206
|
+
}
|
|
207
|
+
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"]]);
|
|
208
|
+
|
|
209
|
+
var types = /*#__PURE__*/Object.freeze({
|
|
210
|
+
__proto__: null
|
|
211
|
+
});
|
|
212
|
+
|
|
213
|
+
VkfForm.install = (app) => {
|
|
214
|
+
app.component(VkfForm.name, VkfForm);
|
|
215
|
+
};
|
|
216
|
+
|
|
217
|
+
exports.VkfForm = VkfForm;
|
|
218
|
+
exports._VkfFormCtx = ctx;
|
|
219
|
+
exports.__VkfForm = types;
|
|
220
|
+
exports.default = VkfForm;
|
|
@@ -0,0 +1,162 @@
|
|
|
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 vue = require('vue');
|
|
8
|
+
var elementPlus$1 = require('@vunk/form/shared/element-plus');
|
|
9
|
+
var composables = require('@vunk/form/composables');
|
|
10
|
+
var utilsObject = require('@vunk/core/shared/utils-object');
|
|
11
|
+
var rules = require('@vunk/form/shared/rules');
|
|
12
|
+
var _pluginVue_exportHelper = require('../_plugin-vue_export-helper.cjs');
|
|
13
|
+
|
|
14
|
+
const _props = {
|
|
15
|
+
...elementPlus.formItemProps,
|
|
16
|
+
formItemSize: {
|
|
17
|
+
type: String,
|
|
18
|
+
default: void 0
|
|
19
|
+
},
|
|
20
|
+
formItemSlots: {
|
|
21
|
+
type: Object,
|
|
22
|
+
default: void 0
|
|
23
|
+
},
|
|
24
|
+
elRef: {
|
|
25
|
+
type: Function,
|
|
26
|
+
required: false
|
|
27
|
+
},
|
|
28
|
+
inline: {
|
|
29
|
+
type: Boolean,
|
|
30
|
+
default: false
|
|
31
|
+
},
|
|
32
|
+
readonly: {
|
|
33
|
+
type: Boolean,
|
|
34
|
+
default: void 0
|
|
35
|
+
},
|
|
36
|
+
labelPosition: {
|
|
37
|
+
type: String,
|
|
38
|
+
default: ""
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
Reflect.deleteProperty(_props, "size");
|
|
42
|
+
const props = _props;
|
|
43
|
+
const createBindProps = utilsVue.bindPropsFactory(props);
|
|
44
|
+
|
|
45
|
+
var ctx = /*#__PURE__*/Object.freeze({
|
|
46
|
+
__proto__: null,
|
|
47
|
+
createBindProps: createBindProps,
|
|
48
|
+
props: props
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
var _sfc_main = vue.defineComponent({
|
|
52
|
+
name: "VkfFormItem",
|
|
53
|
+
components: {
|
|
54
|
+
ElFormItem: elementPlus.ElFormItem
|
|
55
|
+
},
|
|
56
|
+
props,
|
|
57
|
+
setup(props2) {
|
|
58
|
+
const formItemBindProps = elementPlus$1.createFormItemBindProps(props2, ["rules"]);
|
|
59
|
+
const readonly = composables.useComputedReadonly(props2);
|
|
60
|
+
const globalConfig = elementPlus.useGlobalConfig();
|
|
61
|
+
const localeName = vue.computed(() => {
|
|
62
|
+
return globalConfig.value?.locale?.name;
|
|
63
|
+
});
|
|
64
|
+
const requiredMessage = `${props2.label || "\u8BE5\u5B57\u6BB5"}\u4E0D\u80FD\u4E3A\u7A7A`;
|
|
65
|
+
const setDefaultMessage = (rule) => {
|
|
66
|
+
if (localeName.value === "zh-cn") {
|
|
67
|
+
if (rule.message) return;
|
|
68
|
+
if (rule.required) {
|
|
69
|
+
rule.message = requiredMessage;
|
|
70
|
+
}
|
|
71
|
+
const ruleInfo = rules.PATTERN_OPTIONS.find((i) => i.value === rule.pattern);
|
|
72
|
+
if (ruleInfo) {
|
|
73
|
+
rule.message = `\u8F93\u5165 ${props2.label || "\u8BE5\u5B57\u6BB5"} ${ruleInfo.title}`;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
const rules$1 = vue.computed(() => {
|
|
78
|
+
let data = [];
|
|
79
|
+
if (!props2.rules) {
|
|
80
|
+
if (props2.required) {
|
|
81
|
+
data.push({
|
|
82
|
+
required: true
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
if (utilsObject.isPlainObject(props2.rules)) {
|
|
87
|
+
data = [props2.rules];
|
|
88
|
+
}
|
|
89
|
+
if (Array.isArray(props2.rules)) {
|
|
90
|
+
data = props2.rules;
|
|
91
|
+
if (props2.required) {
|
|
92
|
+
if (!props2.rules.find((item) => item.required)) {
|
|
93
|
+
data.push({
|
|
94
|
+
required: true
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
data = data.filter((rule) => {
|
|
100
|
+
if (!rule) return;
|
|
101
|
+
if (utilsObject.isPlainObject(rule)) {
|
|
102
|
+
const enableKeys = Object.keys(rule).filter((key) => !key.startsWith("data-"));
|
|
103
|
+
return enableKeys.length > 0;
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
data.forEach((rule) => {
|
|
107
|
+
setDefaultMessage(rule);
|
|
108
|
+
});
|
|
109
|
+
return data;
|
|
110
|
+
});
|
|
111
|
+
return {
|
|
112
|
+
formItemBindProps,
|
|
113
|
+
readonly,
|
|
114
|
+
rules: rules$1,
|
|
115
|
+
localeName
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
121
|
+
const _component_ElFormItem = vue.resolveComponent("ElFormItem");
|
|
122
|
+
return vue.openBlock(), vue.createBlock(_component_ElFormItem, vue.mergeProps({
|
|
123
|
+
class: ["vkf-form-item", {
|
|
124
|
+
"is-readonly": _ctx.readonly,
|
|
125
|
+
"vkf-form-item--inline": _ctx.inline,
|
|
126
|
+
"vkf-form-item--label-right": _ctx.labelPosition === "right"
|
|
127
|
+
}]
|
|
128
|
+
}, _ctx.formItemBindProps, {
|
|
129
|
+
size: _ctx.formItemSize,
|
|
130
|
+
ref: _ctx.elRef,
|
|
131
|
+
rules: _ctx.rules
|
|
132
|
+
}), vue.createSlots({
|
|
133
|
+
default: vue.withCtx(() => [
|
|
134
|
+
vue.renderSlot(_ctx.$slots, "default")
|
|
135
|
+
]),
|
|
136
|
+
_: 2
|
|
137
|
+
/* DYNAMIC */
|
|
138
|
+
}, [
|
|
139
|
+
vue.renderList(_ctx.formItemSlots, (item, key) => {
|
|
140
|
+
return {
|
|
141
|
+
name: key,
|
|
142
|
+
fn: vue.withCtx((e) => [
|
|
143
|
+
(vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(item?.(e))))
|
|
144
|
+
])
|
|
145
|
+
};
|
|
146
|
+
})
|
|
147
|
+
]), 1040, ["class", "size", "rules"]);
|
|
148
|
+
}
|
|
149
|
+
var VkfFormItem = /* @__PURE__ */ _pluginVue_exportHelper._export_sfc(_sfc_main, [["render", _sfc_render], ["__file", "/home/runner/work/private-vunk-form/private-vunk-form/packages/components/form-item/src/index.vue"]]);
|
|
150
|
+
|
|
151
|
+
var types = /*#__PURE__*/Object.freeze({
|
|
152
|
+
__proto__: null
|
|
153
|
+
});
|
|
154
|
+
|
|
155
|
+
VkfFormItem.install = (app) => {
|
|
156
|
+
app.component(VkfFormItem.name, VkfFormItem);
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
exports.VkfFormItem = VkfFormItem;
|
|
160
|
+
exports._VkfFormItemCtx = ctx;
|
|
161
|
+
exports.__VkfFormItem = types;
|
|
162
|
+
exports.default = VkfFormItem;
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var vue = require('vue');
|
|
6
|
+
var form = require('@vunk/form/shared/form');
|
|
7
|
+
var _pluginVue_exportHelper = require('../_plugin-vue_export-helper.cjs');
|
|
8
|
+
|
|
9
|
+
const props = {
|
|
10
|
+
source: {
|
|
11
|
+
type: Array,
|
|
12
|
+
default: () => []
|
|
13
|
+
},
|
|
14
|
+
templateInstances: {
|
|
15
|
+
type: Object,
|
|
16
|
+
default: void 0
|
|
17
|
+
},
|
|
18
|
+
k: {
|
|
19
|
+
// 在递归调用的情况下 标记当前 source 相对于 原source,所处的位置
|
|
20
|
+
type: Array,
|
|
21
|
+
default: () => []
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
const S_TEMPLATE_INSTANCES = Symbol("templateInstances");
|
|
26
|
+
|
|
27
|
+
const VkfFormItemRenderer$1 = vue.defineComponent({
|
|
28
|
+
name: "VkfFormItemRenderer",
|
|
29
|
+
props: props,
|
|
30
|
+
setup(props$1, ctx) {
|
|
31
|
+
const templateInstances = props$1.templateInstances ?? vue.shallowReactive({});
|
|
32
|
+
vue.provide(S_TEMPLATE_INSTANCES, templateInstances);
|
|
33
|
+
const Renderer = vue.defineComponent({
|
|
34
|
+
props: props,
|
|
35
|
+
setup(props2) {
|
|
36
|
+
return () => vue.h(VkfFormItemRenderer$1, {
|
|
37
|
+
templateInstances,
|
|
38
|
+
source: props2.source,
|
|
39
|
+
k: props2.k
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
const renderFormItems = (data, pK = []) => {
|
|
44
|
+
return data.reduce((a, c, index) => {
|
|
45
|
+
const currentK = [...props$1.k, ...pK, index];
|
|
46
|
+
const validateTemplateType = () => {
|
|
47
|
+
vue.nextTick(() => {
|
|
48
|
+
if (c.templateType && !templateInstances[c.templateType]) {
|
|
49
|
+
console.warn(c.templateType, "templateType\u4E0D\u5B58\u5728\u5C06\u8DF3\u8FC7");
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
};
|
|
53
|
+
if (c.templateType && templateInstances[c.templateType]) {
|
|
54
|
+
const slotData = { ...c };
|
|
55
|
+
Reflect.deleteProperty(slotData, "templateType");
|
|
56
|
+
Reflect.deleteProperty(slotData, "templateSlots");
|
|
57
|
+
Reflect.deleteProperty(slotData, "templateIf");
|
|
58
|
+
const nodes = templateInstances[c.templateType].slots.default?.({
|
|
59
|
+
data: slotData,
|
|
60
|
+
raw: c,
|
|
61
|
+
Renderer,
|
|
62
|
+
k: currentK,
|
|
63
|
+
key: currentK.join(",") + "-" + c.templateType + "-" + c?.prop || "no-prop",
|
|
64
|
+
templateIf: form.genTemplateIfFunc(c.templateIf)
|
|
65
|
+
});
|
|
66
|
+
nodes && a.push(nodes);
|
|
67
|
+
} else if (c.templateSlots?.default) {
|
|
68
|
+
validateTemplateType();
|
|
69
|
+
currentK.push("templateSlots", "default");
|
|
70
|
+
if (Array.isArray(c.templateSlots?.default)) {
|
|
71
|
+
const subNode = renderFormItems(c.templateSlots.default, currentK);
|
|
72
|
+
a = a.concat(subNode);
|
|
73
|
+
}
|
|
74
|
+
} else {
|
|
75
|
+
validateTemplateType();
|
|
76
|
+
}
|
|
77
|
+
return a;
|
|
78
|
+
}, []);
|
|
79
|
+
};
|
|
80
|
+
return () => {
|
|
81
|
+
const tempSlots = ctx.slots.default?.();
|
|
82
|
+
return [
|
|
83
|
+
tempSlots,
|
|
84
|
+
renderFormItems(props$1.source)
|
|
85
|
+
];
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
var VkfFormItemRenderer = /* @__PURE__ */ _pluginVue_exportHelper._export_sfc(VkfFormItemRenderer$1, [["__file", "/home/runner/work/private-vunk-form/private-vunk-form/packages/components/form-item-renderer/src/index.vue"]]);
|
|
91
|
+
|
|
92
|
+
var types = /*#__PURE__*/Object.freeze({
|
|
93
|
+
__proto__: null
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
VkfFormItemRenderer.install = (app) => {
|
|
97
|
+
app.component(VkfFormItemRenderer.name, VkfFormItemRenderer);
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
exports.S_TEMPLATE_INSTANCES = S_TEMPLATE_INSTANCES;
|
|
101
|
+
exports.VkfFormItemRenderer = VkfFormItemRenderer;
|
|
102
|
+
exports.__VkfFormItemRenderer = types;
|
|
103
|
+
exports.default = VkfFormItemRenderer;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var vue = require('vue');
|
|
6
|
+
var formItemRenderer = require('@vunk/form/components/form-item-renderer');
|
|
7
|
+
var _pluginVue_exportHelper = require('../_plugin-vue_export-helper.cjs');
|
|
8
|
+
|
|
9
|
+
const props = {
|
|
10
|
+
type: {
|
|
11
|
+
type: String,
|
|
12
|
+
required: true,
|
|
13
|
+
default: ""
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
var _sfc_main = vue.defineComponent({
|
|
18
|
+
name: "VkfFormItemRendererTemplate",
|
|
19
|
+
props,
|
|
20
|
+
setup(props2) {
|
|
21
|
+
const templateInstances = vue.inject(formItemRenderer.S_TEMPLATE_INSTANCES);
|
|
22
|
+
if (!templateInstances) throw new Error();
|
|
23
|
+
const vm = vue.getCurrentInstance();
|
|
24
|
+
const oVm = templateInstances[props2.type];
|
|
25
|
+
if (vm && templateInstances) {
|
|
26
|
+
templateInstances[props2.type] = vm;
|
|
27
|
+
}
|
|
28
|
+
vue.onUnmounted(() => {
|
|
29
|
+
templateInstances[props2.type] = oVm;
|
|
30
|
+
});
|
|
31
|
+
return () => null;
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
var VkfFormItemRendererTemplate = /* @__PURE__ */ _pluginVue_exportHelper._export_sfc(_sfc_main, [["__file", "/home/runner/work/private-vunk-form/private-vunk-form/packages/components/form-item-renderer-template/src/index.vue"]]);
|
|
36
|
+
|
|
37
|
+
var types = /*#__PURE__*/Object.freeze({
|
|
38
|
+
__proto__: null
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
VkfFormItemRendererTemplate.install = (app) => {
|
|
42
|
+
app.component(VkfFormItemRendererTemplate.name, VkfFormItemRendererTemplate);
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
exports.VkfFormItemRendererTemplate = VkfFormItemRendererTemplate;
|
|
46
|
+
exports.__VkfFormItemRendererTemplate = types;
|
|
47
|
+
exports.default = VkfFormItemRendererTemplate;
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var vue = require('vue');
|
|
6
|
+
var geoinputRead = require('@vunk/form/components/geoinput-read');
|
|
7
|
+
var geoinputUpdate = require('@vunk/form/components/geoinput-update');
|
|
8
|
+
var composables = require('@vunk/form/composables');
|
|
9
|
+
var _pluginVue_exportHelper = require('../_plugin-vue_export-helper.cjs');
|
|
10
|
+
|
|
11
|
+
const props = {
|
|
12
|
+
...geoinputRead._VkfGeoinputReadCtx.props,
|
|
13
|
+
...geoinputUpdate._VkfGeoinputUpdateCtx.props,
|
|
14
|
+
readonly: {
|
|
15
|
+
type: Boolean,
|
|
16
|
+
default: void 0
|
|
17
|
+
},
|
|
18
|
+
showMap: {
|
|
19
|
+
type: Boolean,
|
|
20
|
+
default: true
|
|
21
|
+
},
|
|
22
|
+
/**
|
|
23
|
+
* @description geoinput-read GeojsonLayer 的 type
|
|
24
|
+
*/
|
|
25
|
+
type: {
|
|
26
|
+
type: String,
|
|
27
|
+
default: ""
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
const emits = {
|
|
31
|
+
...geoinputRead._VkfGeoinputReadCtx.emits,
|
|
32
|
+
...geoinputUpdate._VkfGeoinputUpdateCtx.emits
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
var _sfc_main = vue.defineComponent({
|
|
36
|
+
name: "VkfGeoinput",
|
|
37
|
+
inheritAttrs: false,
|
|
38
|
+
components: {
|
|
39
|
+
VkfGeoinputRead: geoinputRead.VkfGeoinputRead,
|
|
40
|
+
VkfGeoinputUpdate: geoinputUpdate.VkfGeoinputUpdate
|
|
41
|
+
},
|
|
42
|
+
emits,
|
|
43
|
+
props,
|
|
44
|
+
setup(props2, { emit }) {
|
|
45
|
+
const readonly = composables.useComputedReadonly(props2);
|
|
46
|
+
const readProps = geoinputRead._VkfGeoinputReadCtx.createBindProps(props2);
|
|
47
|
+
const updateProps = geoinputUpdate._VkfGeoinputUpdateCtx.createBindProps(props2);
|
|
48
|
+
const readEmits = geoinputRead._VkfGeoinputReadCtx.createOnEmits(emit);
|
|
49
|
+
const updateEmits = geoinputUpdate._VkfGeoinputUpdateCtx.createOnEmits(emit);
|
|
50
|
+
return {
|
|
51
|
+
readonly,
|
|
52
|
+
readProps,
|
|
53
|
+
updateProps,
|
|
54
|
+
readEmits,
|
|
55
|
+
updateEmits
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
61
|
+
const _component_VkfGeoinputRead = vue.resolveComponent("VkfGeoinputRead");
|
|
62
|
+
const _component_VkfGeoinputUpdate = vue.resolveComponent("VkfGeoinputUpdate");
|
|
63
|
+
return _ctx.readonly ? (vue.openBlock(), vue.createBlock(
|
|
64
|
+
_component_VkfGeoinputRead,
|
|
65
|
+
vue.mergeProps({ key: 0 }, {
|
|
66
|
+
..._ctx.readProps,
|
|
67
|
+
..._ctx.$attrs
|
|
68
|
+
}, vue.toHandlers(_ctx.readEmits)),
|
|
69
|
+
null,
|
|
70
|
+
16
|
|
71
|
+
/* FULL_PROPS */
|
|
72
|
+
)) : (vue.openBlock(), vue.createBlock(
|
|
73
|
+
_component_VkfGeoinputUpdate,
|
|
74
|
+
vue.mergeProps({ key: 1 }, {
|
|
75
|
+
..._ctx.updateProps,
|
|
76
|
+
..._ctx.$attrs
|
|
77
|
+
}, vue.toHandlers(_ctx.updateEmits)),
|
|
78
|
+
null,
|
|
79
|
+
16
|
|
80
|
+
/* FULL_PROPS */
|
|
81
|
+
));
|
|
82
|
+
}
|
|
83
|
+
var VkfGeoinput = /* @__PURE__ */ _pluginVue_exportHelper._export_sfc(_sfc_main, [["render", _sfc_render], ["__file", "/home/runner/work/private-vunk-form/private-vunk-form/packages/components/geoinput/src/index.vue"]]);
|
|
84
|
+
|
|
85
|
+
var types = /*#__PURE__*/Object.freeze({
|
|
86
|
+
__proto__: null
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
VkfGeoinput.install = (app) => {
|
|
90
|
+
app.component(VkfGeoinput.name, VkfGeoinput);
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
exports.VkfGeoinput = VkfGeoinput;
|
|
94
|
+
exports.__VkfGeoinput = types;
|
|
95
|
+
exports.default = VkfGeoinput;
|