element-less 0.0.13 → 0.0.14

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.
@@ -0,0 +1,735 @@
1
+ import { defineComponent, reactive, useModel, ref, computed, resolveComponent, openBlock, createElementBlock, normalizeStyle, createVNode, mergeProps, unref, withCtx, createElementVNode, createBlock, toDisplayString, Fragment, renderList, mergeModels, useAttrs, watchEffect, watch, resolveDynamicComponent, createSlots, createCommentVNode, normalizeClass, renderSlot, createTextVNode } from "vue";
2
+ import { u as useProps, a as useRender, b as utils, _ as _export_sfc, c as useComponentRef, D as DynamicRenderAsync } from "./index-ByP0XZDD.js";
3
+ import "file-saver";
4
+ import "xlsx";
5
+ import "element-plus";
6
+ import "axios";
7
+ const _hoisted_1$1 = ["innerHTML"];
8
+ const _hoisted_2 = { class: "els-dynamic-r-mobile-title" };
9
+ const _hoisted_3 = ["onClick"];
10
+ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
11
+ __name: "innerObjectArray",
12
+ props: {
13
+ "nodeItem": { default: () => {
14
+ return reactive([]);
15
+ } },
16
+ "nodeItemModifiers": {}
17
+ },
18
+ emits: ["update:nodeItem"],
19
+ setup(__props) {
20
+ const props = __props;
21
+ const { setValue } = useProps();
22
+ const nodeItem = useModel(__props, "nodeItem");
23
+ const { isMobile, componentProps, getArrayNodeValue, renderProps, getGlobalData, getRootNode, getParentNode, getCurrNode, getNodeValue } = useRender(props, nodeItem.value);
24
+ const list = ref();
25
+ const listProps = computed(() => {
26
+ const currProps = { ...nodeItem.value.config.arrayConfig };
27
+ return renderProps(currProps);
28
+ });
29
+ function handleAddItem() {
30
+ return utils.cloneObj(nodeItem.value.arrayObjData);
31
+ }
32
+ function handleRemove(index) {
33
+ list.value.remove(index);
34
+ }
35
+ const arrayConfig = computed(() => {
36
+ return nodeItem.value.config.arrayConfig;
37
+ });
38
+ function getItemTitle(arrayChildren) {
39
+ let currContent = nodeItem.value.config.arrayConfig.itemComponentTitle;
40
+ if (!currContent.startsWith(":")) {
41
+ return currContent;
42
+ }
43
+ currContent = currContent.substring(1);
44
+ if (!currContent) {
45
+ return "";
46
+ }
47
+ const item = getNodeValue(arrayChildren);
48
+ let currEvent = new Function("globalData,rootNode,parentNode,currNode,item,utils", currContent.indexOf("return") > -1 ? currContent : `return ${currContent}`);
49
+ return currEvent(getGlobalData(), getRootNode(), getParentNode(), getCurrNode(), item, utils);
50
+ }
51
+ setValue({
52
+ getCurrNode: () => {
53
+ return getArrayNodeValue(nodeItem.value.children);
54
+ },
55
+ getParentNode: () => {
56
+ return getArrayNodeValue(nodeItem.value.children);
57
+ }
58
+ });
59
+ return (_ctx, _cache) => {
60
+ var _a;
61
+ const _component_van_cell_group = resolveComponent("van-cell-group");
62
+ const _component_els_form = resolveComponent("els-form");
63
+ const _component_els_list = resolveComponent("els-list");
64
+ return openBlock(), createElementBlock("div", {
65
+ class: "els-dynamic-array",
66
+ style: normalizeStyle((_a = nodeItem.value.config.advancedConfig) == null ? void 0 : _a.style)
67
+ }, [
68
+ createVNode(_component_els_list, mergeProps({
69
+ modelValue: nodeItem.value.children,
70
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => nodeItem.value.children = $event),
71
+ ref_key: "list",
72
+ ref: list,
73
+ onAdd: handleAddItem,
74
+ sortable: !unref(isMobile),
75
+ isRemove: !unref(isMobile),
76
+ hasForm: false,
77
+ "item-class-name": [
78
+ { "els-dynamic-r-array": nodeItem.value.arrayDataTypeName === "Object" || nodeItem.value.componentTypeName === "DynamicRender" },
79
+ { "els-dynamic-r-array-mobile": unref(isMobile) }
80
+ ],
81
+ borderType: arrayConfig.value.borderType,
82
+ style: [
83
+ { "max-width": arrayConfig.value.maxWidth ? arrayConfig.value.maxWidth + "px" : "" },
84
+ { "max-height": arrayConfig.value.maxHeight ? arrayConfig.value.maxHeight + "px" : "" },
85
+ { "display": arrayConfig.value.arrangementType === "Horizontal" ? "flex" : "" }
86
+ ],
87
+ class: ["els-dynamic-array-render", { "horizontal": arrayConfig.value.arrangementType === "Horizontal" }]
88
+ }, listProps.value), {
89
+ itemTitle: withCtx(({ $item }) => [
90
+ createElementVNode("div", {
91
+ innerHTML: getItemTitle($item)
92
+ }, null, 8, _hoisted_1$1)
93
+ ]),
94
+ default: withCtx(({ element, $item, $index }) => [
95
+ (openBlock(), createElementBlock("div", {
96
+ key: element.keyID,
97
+ class: "els-dynamic-array-inner"
98
+ }, [
99
+ createVNode(_component_els_form, mergeProps({
100
+ modelValue: nodeItem.value.children[$index],
101
+ "onUpdate:modelValue": ($event) => nodeItem.value.children[$index] = $event
102
+ }, unref(componentProps)), {
103
+ default: withCtx(() => [
104
+ unref(isMobile) ? (openBlock(), createBlock(_component_van_cell_group, {
105
+ title: nodeItem.value.keyName,
106
+ key: element.itemKey
107
+ }, {
108
+ title: withCtx(() => [
109
+ createElementVNode("div", _hoisted_2, [
110
+ createElementVNode("span", null, toDisplayString(nodeItem.value.keyName + " " + ($index + 1)), 1),
111
+ createElementVNode("span", {
112
+ class: "els-dynamic-remove",
113
+ onClick: ($event) => handleRemove($index)
114
+ }, "删除", 8, _hoisted_3)
115
+ ])
116
+ ]),
117
+ default: withCtx(() => [
118
+ (openBlock(true), createElementBlock(Fragment, null, renderList($item, (item, index) => {
119
+ return openBlock(), createBlock(DynamicRenderInner, {
120
+ nodeItem: item,
121
+ key: item.keyID,
122
+ arrayIndex: $index,
123
+ index
124
+ }, null, 8, ["nodeItem", "arrayIndex", "index"]);
125
+ }), 128))
126
+ ]),
127
+ _: 2
128
+ }, 1032, ["title"])) : (openBlock(true), createElementBlock(Fragment, { key: 1 }, renderList($item, (item, index) => {
129
+ return openBlock(), createBlock(DynamicRenderInner, {
130
+ nodeItem: item,
131
+ key: item.keyID,
132
+ arrayIndex: $index,
133
+ index
134
+ }, null, 8, ["nodeItem", "arrayIndex", "index"]);
135
+ }), 128))
136
+ ]),
137
+ _: 2
138
+ }, 1040, ["modelValue", "onUpdate:modelValue"])
139
+ ]))
140
+ ]),
141
+ _: 1
142
+ }, 16, ["modelValue", "sortable", "isRemove", "item-class-name", "borderType", "style", "class"])
143
+ ], 4);
144
+ };
145
+ }
146
+ });
147
+ const DynamicRenderInnerObjectArray = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["__scopeId", "data-v-5cfb31ad"]]);
148
+ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
149
+ ...{
150
+ inheritAttrs: false
151
+ },
152
+ __name: "innerItem",
153
+ props: /* @__PURE__ */ mergeModels({
154
+ nodeItem: {},
155
+ currDepath: {},
156
+ parentNode: {},
157
+ currNode: {},
158
+ nodeType: {}
159
+ }, {
160
+ "modelValue": {},
161
+ "modelModifiers": {}
162
+ }),
163
+ emits: /* @__PURE__ */ mergeModels(["update:modelValue", "valueChange"], ["update:modelValue"]),
164
+ setup(__props, { emit: __emit }) {
165
+ const emits = __emit;
166
+ const dyComponent = ref();
167
+ const modelValue = useModel(__props, "modelValue");
168
+ const props = __props;
169
+ const attrs = useAttrs();
170
+ const currValue = ref();
171
+ const slotValue = ref({});
172
+ const { isMobile, componentProps } = useRender(props, props.nodeItem, modelValue, slotValue);
173
+ if (props.nodeItem.slots && props.nodeItem.slots.length) {
174
+ props.nodeItem.slots.forEach((slot) => {
175
+ if (props.nodeItem.dataTypeName === "String") {
176
+ slotValue.value[slot.name] = "";
177
+ } else {
178
+ slotValue.value[slot.name] = {};
179
+ }
180
+ });
181
+ }
182
+ watchEffect(() => {
183
+ currValue.value = modelValue.value;
184
+ });
185
+ watch(currValue, (val) => {
186
+ emits("update:modelValue", val);
187
+ emits("valueChange", val);
188
+ }, { deep: true, immediate: true });
189
+ const componentName = ref("");
190
+ watchEffect(() => {
191
+ componentName.value = props.nodeItem.componentName;
192
+ });
193
+ useComponentRef(props.nodeItem, dyComponent);
194
+ return (_ctx, _cache) => {
195
+ var _a;
196
+ return componentName.value ? (openBlock(), createBlock(resolveDynamicComponent(componentName.value), mergeProps({ key: 0 }, Object.assign({}, unref(componentProps), unref(attrs)), {
197
+ modelValue: currValue.value,
198
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => currValue.value = $event),
199
+ ref_key: "dyComponent",
200
+ ref: dyComponent
201
+ }), createSlots({ _: 2 }, [
202
+ renderList((_a = _ctx.nodeItem.slots) == null ? void 0 : _a.filter((ele) => ele.children.length), (slot) => {
203
+ return {
204
+ name: slot.name,
205
+ fn: withCtx((slotProps) => [
206
+ createVNode(DynamicRenderAsync, {
207
+ config: slot.children,
208
+ modelValue: slotValue.value[slot.name],
209
+ "onUpdate:modelValue": ($event) => slotValue.value[slot.name] = $event,
210
+ globalData: Object.assign({}, slotProps, { componentValue: currValue.value }),
211
+ isMobile: unref(isMobile)
212
+ }, null, 8, ["config", "modelValue", "onUpdate:modelValue", "globalData", "isMobile"])
213
+ ])
214
+ };
215
+ })
216
+ ]), 1040, ["modelValue"])) : createCommentVNode("", true);
217
+ };
218
+ }
219
+ });
220
+ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
221
+ __name: "innerArray",
222
+ props: /* @__PURE__ */ mergeModels({
223
+ parentNode: {}
224
+ }, {
225
+ "nodeItem": { default: () => {
226
+ return reactive([]);
227
+ } },
228
+ "nodeItemModifiers": {}
229
+ }),
230
+ emits: ["update:nodeItem"],
231
+ setup(__props) {
232
+ const props = __props;
233
+ const { getValue } = useProps();
234
+ const dataTypes = getValue("dataTypeData", []);
235
+ const nodeItem = useModel(__props, "nodeItem");
236
+ const { isMobile, formProps, componentProps, renderDisabled } = useRender(props, nodeItem.value);
237
+ function handleValueChange(val) {
238
+ if (nodeItem.value.config.advancedConfig && nodeItem.value.config.advancedConfig.eventChange) {
239
+ let currEvent = new Function("val,parentNode,currNode", nodeItem.value.config.advancedConfig.eventChange);
240
+ currEvent(val, props.parentNode, nodeItem.value);
241
+ }
242
+ }
243
+ function getItemDefaultValue() {
244
+ const currDataType = dataTypes.find((ele) => ele.value === nodeItem.value.arrayDataType);
245
+ if (currDataType && currDataType.defaultValue) {
246
+ return currDataType.defaultValue;
247
+ }
248
+ if (nodeItem.value.arrayDataTypeName == "String") {
249
+ if (nodeItem.value.defaultValue) {
250
+ return nodeItem.value.defaultValue;
251
+ }
252
+ return "";
253
+ } else if (nodeItem.value.arrayDataTypeName == "Bool") {
254
+ if (nodeItem.value.defaultValue === "true") {
255
+ return true;
256
+ } else {
257
+ return false;
258
+ }
259
+ } else if (nodeItem.value.arrayDataTypeName === "Number") {
260
+ if (nodeItem.value.defaultValue != void 0 && nodeItem.value.defaultValue !== "") {
261
+ return parseFloat(nodeItem.value.defaultValue);
262
+ } else {
263
+ return 0;
264
+ }
265
+ } else if (nodeItem.value.arrayDataTypeName === "Object") {
266
+ return {};
267
+ } else if (nodeItem.value.arrayDataTypeName === "Array") {
268
+ return [];
269
+ }
270
+ return {};
271
+ }
272
+ function handleAddItem() {
273
+ return getItemDefaultValue();
274
+ }
275
+ function initDefault(val) {
276
+ let defaultArrayData = [];
277
+ let defaultValue = getItemDefaultValue();
278
+ if (val === void 0 || val === "") {
279
+ defaultArrayData.push(defaultValue);
280
+ } else {
281
+ for (let i = 0; i < val; i++) {
282
+ defaultArrayData.push(defaultValue);
283
+ }
284
+ }
285
+ nodeItem.value.value = defaultArrayData;
286
+ }
287
+ watch(() => nodeItem.value.value, (val) => {
288
+ if (!val || !Array.isArray(val)) {
289
+ initDefault(nodeItem.value.config.arrayConfig.arrayDefaultLength);
290
+ }
291
+ }, { immediate: true });
292
+ watch(() => nodeItem.value.config.arrayConfig.arrayDefaultLength, (val) => {
293
+ initDefault(val);
294
+ });
295
+ const baseProps = computed(() => {
296
+ const currProps = Object.assign({}, componentProps.value, formProps.value);
297
+ delete currProps.label;
298
+ return currProps;
299
+ });
300
+ const isObject = computed(() => {
301
+ return nodeItem.value.arrayDataTypeName === "Object";
302
+ });
303
+ return (_ctx, _cache) => {
304
+ const _component_els_list = resolveComponent("els-list");
305
+ return openBlock(), createElementBlock("div", {
306
+ class: normalizeClass(["els-dynamic-array-render", { "horizontal": nodeItem.value.config.arrayConfig.arrangementType === "Horizontal" }]),
307
+ style: { "flex-grow": "1" }
308
+ }, [
309
+ createVNode(_component_els_list, {
310
+ modelValue: nodeItem.value.value,
311
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => nodeItem.value.value = $event),
312
+ onAdd: handleAddItem,
313
+ "item-class-name": nodeItem.value.arrayDataTypeName === "Object" || nodeItem.value.componentTypeName === "DynamicRender" ? "els-dynamic-r-array" : "",
314
+ borderType: nodeItem.value.config.arrayConfig.borderType,
315
+ style: normalizeStyle([
316
+ { "max-width": nodeItem.value.config.arrayConfig.maxWidth ? nodeItem.value.config.arrayConfig.maxWidth + "px" : "" },
317
+ { "max-height": nodeItem.value.config.arrayConfig.maxHeight ? nodeItem.value.config.arrayConfig.maxHeight + "px" : "" },
318
+ { "display": nodeItem.value.config.arrayConfig.arrangementType === "Horizontal" ? "flex" : "" },
319
+ { "flex-wrap": "wrap" },
320
+ { "gap": "5px" },
321
+ { "overflow": "scroll" },
322
+ { "padding-right": unref(isMobile) || isObject.value ? "0px" : "20px" }
323
+ ])
324
+ }, {
325
+ default: withCtx(({ element, index }) => [
326
+ (openBlock(), createBlock(_sfc_main$5, mergeProps({
327
+ class: { "els-dynamic-r-array-item": nodeItem.value.componentName === "ElsDynamicRender" }
328
+ }, baseProps.value, {
329
+ key: index,
330
+ "parent-node": _ctx.parentNode,
331
+ "curr-node": nodeItem.value,
332
+ disabled: unref(renderDisabled)(),
333
+ modelValue: element.value,
334
+ "onUpdate:modelValue": ($event) => element.value = $event,
335
+ prop: `[${index}]`,
336
+ requiredMessage: "不能为空",
337
+ nodeItem: nodeItem.value,
338
+ style: nodeItem.value.config.advancedConfig.style,
339
+ onValueChange: handleValueChange
340
+ }), null, 16, ["class", "parent-node", "curr-node", "disabled", "modelValue", "onUpdate:modelValue", "prop", "nodeItem", "style"]))
341
+ ]),
342
+ _: 1
343
+ }, 8, ["modelValue", "item-class-name", "borderType", "style"])
344
+ ], 2);
345
+ };
346
+ }
347
+ });
348
+ const DynamicRenderInnerArray = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-ce85fadb"]]);
349
+ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
350
+ ...{
351
+ inheritAttrs: false
352
+ },
353
+ __name: "innerWrap",
354
+ props: {
355
+ index: {},
356
+ nodeItem: {},
357
+ parentNode: {}
358
+ },
359
+ setup(__props) {
360
+ const props = __props;
361
+ const { getValue, setValue } = useProps();
362
+ const dyComponent = ref();
363
+ const { renderIf, componentProps, getNodeValue, getCurrNode } = useRender(props, props.nodeItem);
364
+ const getResult = getValue("getResult", () => {
365
+ return {};
366
+ });
367
+ const modelValue = computed(() => {
368
+ return getResult(props.nodeItem.children);
369
+ });
370
+ const getFormPropIndex = getValue("getFormPropIndex", () => {
371
+ return "";
372
+ });
373
+ useComponentRef(props.nodeItem, dyComponent);
374
+ if (props.nodeItem.keyCode && props.nodeItem.dataType === "Object") {
375
+ setValue({
376
+ getCurrNode: () => {
377
+ return getNodeValue(props.nodeItem.children);
378
+ },
379
+ getParentNode: () => {
380
+ return getCurrNode();
381
+ },
382
+ getFormPropIndex: () => {
383
+ let currPropIndex = getFormPropIndex();
384
+ currPropIndex += `[${props.index}].children`;
385
+ return currPropIndex;
386
+ }
387
+ });
388
+ } else {
389
+ setValue({
390
+ getFormPropIndex: () => {
391
+ let currPropIndex = getFormPropIndex();
392
+ currPropIndex += `[${props.index}].children`;
393
+ return currPropIndex;
394
+ }
395
+ });
396
+ }
397
+ return (_ctx, _cache) => {
398
+ var _a, _b, _c, _d, _e;
399
+ return ((_a = _ctx.nodeItem) == null ? void 0 : _a.componentName) === "ElsFormQuery" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
400
+ unref(renderIf)() ? (openBlock(), createBlock(resolveDynamicComponent((_b = _ctx.nodeItem) == null ? void 0 : _b.componentName), mergeProps({
401
+ key: 0,
402
+ style: (_c = _ctx.nodeItem.config.advancedConfig) == null ? void 0 : _c.style
403
+ }, unref(componentProps), {
404
+ ref_key: "dyComponent",
405
+ ref: dyComponent,
406
+ modelValue: modelValue.value,
407
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => modelValue.value = $event)
408
+ }), {
409
+ default: withCtx(() => [
410
+ (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.nodeItem.children, (item, index) => {
411
+ return openBlock(), createBlock(DynamicRenderInner, {
412
+ nodeItem: item,
413
+ index: -1,
414
+ key: item.keyID
415
+ }, null, 8, ["nodeItem"]);
416
+ }), 128))
417
+ ]),
418
+ _: 1
419
+ }, 16, ["style", "modelValue"])) : createCommentVNode("", true)
420
+ ], 64)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
421
+ unref(renderIf)() ? (openBlock(), createBlock(resolveDynamicComponent((_d = _ctx.nodeItem) == null ? void 0 : _d.componentName), mergeProps({
422
+ key: 0,
423
+ style: (_e = _ctx.nodeItem.config.advancedConfig) == null ? void 0 : _e.style
424
+ }, unref(componentProps), {
425
+ ref_key: "dyComponent",
426
+ ref: dyComponent
427
+ }), {
428
+ default: withCtx(() => [
429
+ (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.nodeItem.children, (item, index) => {
430
+ return openBlock(), createBlock(DynamicRenderInner, {
431
+ nodeItem: item,
432
+ index,
433
+ key: item.keyID
434
+ }, null, 8, ["nodeItem", "index"]);
435
+ }), 128))
436
+ ]),
437
+ _: 1
438
+ }, 16, ["style"])) : createCommentVNode("", true)
439
+ ], 64));
440
+ };
441
+ }
442
+ });
443
+ const _hoisted_1 = ["innerHTML"];
444
+ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
445
+ ...{
446
+ inheritAttrs: false
447
+ },
448
+ __name: "show",
449
+ props: /* @__PURE__ */ mergeModels({
450
+ nodeItem: {}
451
+ }, {
452
+ "modelValue": {},
453
+ "modelModifiers": {}
454
+ }),
455
+ emits: ["update:modelValue"],
456
+ setup(__props) {
457
+ const dyComponent = ref();
458
+ const modelValue = useModel(__props, "modelValue");
459
+ const slotValue = ref({});
460
+ const props = __props;
461
+ const { isMobile, componentProps, renderContent } = useRender(props, props.nodeItem, modelValue, slotValue);
462
+ useComponentRef(props.nodeItem, dyComponent);
463
+ const componentName = ref("");
464
+ const innerContent = ref(props.nodeItem.config.baseConfig.innerContent);
465
+ watchEffect(() => {
466
+ componentName.value = props.nodeItem.componentName;
467
+ });
468
+ return (_ctx, _cache) => {
469
+ const _component_els_tip = resolveComponent("els-tip");
470
+ return componentName.value ? (openBlock(), createBlock(resolveDynamicComponent(componentName.value), mergeProps({
471
+ key: 0,
472
+ modelValue: modelValue.value,
473
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => modelValue.value = $event)
474
+ }, unref(componentProps), {
475
+ ref_key: "dyComponent",
476
+ ref: dyComponent
477
+ }), {
478
+ default: withCtx(() => [
479
+ innerContent.value ? (openBlock(), createElementBlock("span", {
480
+ key: 0,
481
+ innerHTML: unref(renderContent)(innerContent.value)
482
+ }, null, 8, _hoisted_1)) : createCommentVNode("", true),
483
+ _ctx.nodeItem.slots && _ctx.nodeItem.slots.length ? (openBlock(true), createElementBlock(Fragment, { key: 1 }, renderList(_ctx.nodeItem.slots, (slot) => {
484
+ return renderSlot(_ctx.$slots, slot.name, {}, () => [
485
+ createVNode(DynamicRenderAsync, {
486
+ config: slot.children,
487
+ modelValue: slotValue.value[slot.name],
488
+ "onUpdate:modelValue": ($event) => slotValue.value[slot.name] = $event,
489
+ isMobile: unref(isMobile)
490
+ }, null, 8, ["config", "modelValue", "onUpdate:modelValue", "isMobile"])
491
+ ]);
492
+ }), 256)) : createCommentVNode("", true)
493
+ ]),
494
+ _: 3
495
+ }, 16, ["modelValue"])) : (openBlock(), createBlock(_component_els_tip, {
496
+ key: 1,
497
+ type: "danger"
498
+ }, {
499
+ default: withCtx(() => [
500
+ createTextVNode("未设置组件名")
501
+ ]),
502
+ _: 1
503
+ }));
504
+ };
505
+ }
506
+ });
507
+ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
508
+ __name: "form",
509
+ props: /* @__PURE__ */ mergeModels({
510
+ isRoot: { type: Boolean }
511
+ }, {
512
+ "nodeItem": { default: () => {
513
+ return reactive([]);
514
+ } },
515
+ "nodeItemModifiers": {}
516
+ }),
517
+ emits: ["update:nodeItem"],
518
+ setup(__props) {
519
+ const dyComponent = ref();
520
+ const props = __props;
521
+ const nodeItem = useModel(__props, "nodeItem");
522
+ const { setValue } = useProps();
523
+ const { isMobile, getNodeValue, getCurrNode, componentProps } = useRender(props, nodeItem.value);
524
+ useComponentRef(nodeItem.value, dyComponent);
525
+ setValue({
526
+ getCurrNode: () => {
527
+ return getNodeValue(nodeItem.value.children);
528
+ },
529
+ getParentNode: () => {
530
+ return getCurrNode();
531
+ }
532
+ });
533
+ return (_ctx, _cache) => {
534
+ const _component_els_form = resolveComponent("els-form");
535
+ return unref(isMobile) && !_ctx.isRoot ? (openBlock(), createBlock(_component_els_form, mergeProps({
536
+ key: 0,
537
+ modelValue: nodeItem.value.children,
538
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => nodeItem.value.children = $event)
539
+ }, unref(componentProps), {
540
+ ref_key: "dyComponent",
541
+ ref: dyComponent,
542
+ key: nodeItem.value.keyID
543
+ }), {
544
+ default: withCtx(() => [
545
+ (openBlock(), createBlock(resolveDynamicComponent("van-cell-group"), {
546
+ title: nodeItem.value.keyName
547
+ }, {
548
+ default: withCtx(() => [
549
+ (openBlock(true), createElementBlock(Fragment, null, renderList(nodeItem.value.children, (item, index) => {
550
+ return openBlock(), createBlock(DynamicRenderInner, {
551
+ index,
552
+ nodeItem: item,
553
+ key: item.keyID
554
+ }, null, 8, ["index", "nodeItem"]);
555
+ }), 128))
556
+ ]),
557
+ _: 1
558
+ }, 8, ["title"]))
559
+ ]),
560
+ _: 1
561
+ }, 16, ["modelValue"])) : (openBlock(), createBlock(_component_els_form, mergeProps({
562
+ key: 1,
563
+ modelValue: nodeItem.value.children,
564
+ "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => nodeItem.value.children = $event)
565
+ }, unref(componentProps), {
566
+ ref_key: "dyComponent",
567
+ ref: dyComponent,
568
+ key: nodeItem.value.keyID
569
+ }), {
570
+ default: withCtx(() => [
571
+ (openBlock(true), createElementBlock(Fragment, null, renderList(nodeItem.value.children, (item, index) => {
572
+ return openBlock(), createBlock(DynamicRenderInner, {
573
+ index,
574
+ nodeItem: item,
575
+ key: item.keyID
576
+ }, null, 8, ["index", "nodeItem"]);
577
+ }), 128))
578
+ ]),
579
+ _: 1
580
+ }, 16, ["modelValue"]));
581
+ };
582
+ }
583
+ });
584
+ const DynamicRenderForm = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-26a1bd2a"]]);
585
+ const form = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
586
+ __proto__: null,
587
+ default: DynamicRenderForm
588
+ }, Symbol.toStringTag, { value: "Module" }));
589
+ const _sfc_main = /* @__PURE__ */ defineComponent({
590
+ ...{
591
+ inheritAttrs: false
592
+ },
593
+ __name: "inner",
594
+ props: /* @__PURE__ */ mergeModels({
595
+ index: {},
596
+ arrayIndex: { default: -1 }
597
+ }, {
598
+ "nodeItem": { default: () => {
599
+ return reactive([]);
600
+ } },
601
+ "nodeItemModifiers": {}
602
+ }),
603
+ emits: ["update:nodeItem"],
604
+ setup(__props) {
605
+ const props = __props;
606
+ const { getValue, setValue } = useProps();
607
+ const nodeItem = useModel(__props, "nodeItem");
608
+ const { isMobile, formProps, getCurrNode, renderIf, renderValueChange } = useRender(props, nodeItem.value);
609
+ const hasForm = computed(() => {
610
+ var _a;
611
+ if ((nodeItem.value.dataTypeName === "Object" || nodeItem.value.arrayDataTypeName == "Object") && ((_a = nodeItem.value.config.baseConfig) == null ? void 0 : _a.componentName) == "ElsCaption") {
612
+ return false;
613
+ }
614
+ return true;
615
+ });
616
+ if (props.arrayIndex > -1) {
617
+ setValue({
618
+ getCurrNode: () => {
619
+ return getCurrNode();
620
+ }
621
+ });
622
+ }
623
+ return (_ctx, _cache) => {
624
+ var _a;
625
+ const _component_els_caption = resolveComponent("els-caption");
626
+ const _component_els_form_node = resolveComponent("els-form-node");
627
+ return unref(renderIf)() ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
628
+ (nodeItem.value.dataTypeName === "Object" || nodeItem.value.arrayDataTypeName == "Object") && ((_a = nodeItem.value.config.baseConfig) == null ? void 0 : _a.componentName) == "ElsCaption" ? (openBlock(), createBlock(_component_els_caption, mergeProps({ key: 0 }, nodeItem.value.config.baseConfig, {
629
+ title: nodeItem.value.config.baseConfig.title || nodeItem.value.keyName
630
+ }), null, 16, ["title"])) : createCommentVNode("", true),
631
+ nodeItem.value.componentTypeName && nodeItem.value.componentGroup === "Show" && nodeItem.value.keyCode ? (openBlock(), createBlock(_sfc_main$2, {
632
+ key: 1,
633
+ nodeItem: nodeItem.value,
634
+ style: normalizeStyle(nodeItem.value.config.advancedConfig.style),
635
+ modelValue: nodeItem.value.value,
636
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => nodeItem.value.value = $event),
637
+ title: nodeItem.value.keyName
638
+ }, null, 8, ["nodeItem", "style", "modelValue", "title"])) : nodeItem.value.componentTypeName && nodeItem.value.componentGroup === "Show" ? (openBlock(), createBlock(_sfc_main$2, {
639
+ key: 2,
640
+ nodeItem: nodeItem.value,
641
+ style: normalizeStyle(nodeItem.value.config.advancedConfig.style),
642
+ title: nodeItem.value.keyName
643
+ }, null, 8, ["nodeItem", "style", "title"])) : nodeItem.value.componentGroup == "Container" ? (openBlock(), createBlock(_sfc_main$3, {
644
+ key: 3,
645
+ parentNode: nodeItem.value,
646
+ nodeItem: nodeItem.value,
647
+ index: _ctx.index
648
+ }, null, 8, ["parentNode", "nodeItem", "index"])) : nodeItem.value.dataTypeName === "Array" && nodeItem.value.arrayDataType !== "Object" || nodeItem.value.dataTypeName === "Array" && nodeItem.value.componentTypeName ? (openBlock(), createBlock(_component_els_form_node, mergeProps({
649
+ key: 4,
650
+ childCreateFormItem: false,
651
+ createFormItem: hasForm.value
652
+ }, unref(formProps), {
653
+ prop: void 0,
654
+ childType: nodeItem.value.dataTypeName === "Array" ? "" : nodeItem.value.componentTypeName
655
+ }), {
656
+ default: withCtx(() => [
657
+ createVNode(DynamicRenderInnerArray, { nodeItem: nodeItem.value }, null, 8, ["nodeItem"])
658
+ ]),
659
+ _: 1
660
+ }, 16, ["createFormItem", "childType"])) : nodeItem.value.dataTypeName == "Object" || nodeItem.value.dataTypeName === "Array" && nodeItem.value.arrayDataType === "Object" ? (openBlock(), createBlock(_component_els_form_node, mergeProps({
661
+ key: 5,
662
+ childCreateFormItem: false,
663
+ createFormItem: !unref(isMobile) && hasForm.value
664
+ }, unref(formProps), {
665
+ childType: nodeItem.value.dataTypeName === "Array" ? "" : nodeItem.value.componentTypeName
666
+ }), {
667
+ default: withCtx(() => [
668
+ nodeItem.value.dataTypeName == "Object" && nodeItem.value.componentTypeName ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
669
+ unref(isMobile) ? (openBlock(), createBlock(resolveDynamicComponent("van-cell-group"), {
670
+ key: 0,
671
+ title: nodeItem.value.keyName
672
+ }, {
673
+ default: withCtx(() => [
674
+ nodeItem.value.dataTypeName == "Object" && nodeItem.value.componentTypeName ? (openBlock(), createBlock(_sfc_main$5, {
675
+ key: 0,
676
+ nodeItem: nodeItem.value,
677
+ modelValue: nodeItem.value.value,
678
+ "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => nodeItem.value.value = $event),
679
+ onValueChange: _cache[2] || (_cache[2] = ($event) => unref(renderValueChange)($event))
680
+ }, null, 8, ["nodeItem", "modelValue"])) : createCommentVNode("", true)
681
+ ]),
682
+ _: 1
683
+ }, 8, ["title"])) : (openBlock(), createBlock(_sfc_main$5, {
684
+ key: 1,
685
+ nodeItem: nodeItem.value,
686
+ modelValue: nodeItem.value.value,
687
+ "onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => nodeItem.value.value = $event),
688
+ onValueChange: _cache[4] || (_cache[4] = ($event) => unref(renderValueChange)($event))
689
+ }, null, 8, ["nodeItem", "modelValue"]))
690
+ ], 64)) : nodeItem.value.dataTypeName == "Object" ? (openBlock(), createBlock(DynamicRenderForm, {
691
+ key: 1,
692
+ nodeItem: nodeItem.value
693
+ }, null, 8, ["nodeItem"])) : (openBlock(), createBlock(DynamicRenderInnerObjectArray, {
694
+ key: 2,
695
+ nodeItem: nodeItem.value
696
+ }, null, 8, ["nodeItem"]))
697
+ ]),
698
+ _: 1
699
+ }, 16, ["createFormItem", "childType"])) : unref(isMobile) && nodeItem.value.componentTypeName && nodeItem.value.componentGroup === "Form" ? (openBlock(), createBlock(_sfc_main$5, mergeProps({
700
+ key: 6,
701
+ nodeItem: nodeItem.value,
702
+ modelValue: nodeItem.value.value,
703
+ "onUpdate:modelValue": _cache[5] || (_cache[5] = ($event) => nodeItem.value.value = $event)
704
+ }, unref(formProps), {
705
+ onValueChange: _cache[6] || (_cache[6] = ($event) => unref(renderValueChange)($event))
706
+ }), null, 16, ["nodeItem", "modelValue"])) : nodeItem.value.componentTypeName && nodeItem.value.componentGroup === "Form" ? (openBlock(), createBlock(_component_els_form_node, mergeProps({
707
+ key: 7,
708
+ childCreateFormItem: false,
709
+ createFormItem: hasForm.value
710
+ }, unref(formProps), {
711
+ childType: nodeItem.value.componentTypeName
712
+ }), {
713
+ default: withCtx(() => [
714
+ createVNode(_sfc_main$5, {
715
+ nodeItem: nodeItem.value,
716
+ modelValue: nodeItem.value.value,
717
+ "onUpdate:modelValue": _cache[7] || (_cache[7] = ($event) => nodeItem.value.value = $event),
718
+ onValueChange: _cache[8] || (_cache[8] = ($event) => unref(renderValueChange)($event))
719
+ }, null, 8, ["nodeItem", "modelValue"])
720
+ ]),
721
+ _: 1
722
+ }, 16, ["createFormItem", "childType"])) : createCommentVNode("", true)
723
+ ], 64)) : createCommentVNode("", true);
724
+ };
725
+ }
726
+ });
727
+ const DynamicRenderInner = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-77f43620"]]);
728
+ const inner = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
729
+ __proto__: null,
730
+ default: DynamicRenderInner
731
+ }, Symbol.toStringTag, { value: "Module" }));
732
+ export {
733
+ form as f,
734
+ inner as i
735
+ };