element-less 0.0.72 → 0.0.74

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/custom/dynamic/common/aiSystemPrompt.d.ts +6 -0
  2. package/custom/dynamic/common/propertys/checkbox.d.ts +3 -0
  3. package/custom/dynamic/common/propertys/radio.d.ts +9 -0
  4. package/custom/dynamic/common/propertys/select.d.ts +9 -0
  5. package/custom/dynamic/common/propertys/table.d.ts +145 -17
  6. package/custom/dynamic/designerView/index.d.ts +76 -0
  7. package/custom/dynamic/designerView/src/designerView.d.ts +24 -0
  8. package/custom/dynamic/designerView/src/designerView.vue.d.ts +48 -0
  9. package/custom/dynamic/render/src/nodeValueUtils.d.ts +2 -0
  10. package/custom/requestForm/index.d.ts +12 -0
  11. package/custom/requestForm/src/requestForm.d.ts +3 -0
  12. package/custom/requestForm/src/requestForm.vue.d.ts +6 -0
  13. package/element-less.cjs +1 -1
  14. package/element-less.iife.js +1 -1
  15. package/element-less.js +1 -1
  16. package/element-less.umd.cjs +1 -1
  17. package/{index-Ckj1UiS8.js → index-BkcWYzI_.js} +862 -190
  18. package/index-DjrC26ts.cjs +1 -0
  19. package/inner-0Qwbn1gV.cjs +1 -0
  20. package/{inner-Cn9E8KV4.js → inner-Ba84wZRD.js} +16 -4
  21. package/{innerItem-CnLhfK-G.js → innerItem-5Au5l5Jf.js} +1 -1
  22. package/{innerItem-BhWaV5z6.cjs → innerItem-vGvvhSD8.cjs} +1 -1
  23. package/{mode-csharp-BqjzW6u-.cjs → mode-csharp-C2oUrQH_.cjs} +1 -1
  24. package/{mode-csharp-CWbGgzjG.js → mode-csharp-DpcfdC7v.js} +1 -1
  25. package/{mode-css-CorxJdP-.js → mode-css-Bw3HxevP.js} +1 -1
  26. package/{mode-css-BOWKzLQj.cjs → mode-css-DaOZ-Kyt.cjs} +1 -1
  27. package/{mode-javascript-DE9c49cw.js → mode-javascript-B4nfmHwI.js} +1 -1
  28. package/{mode-javascript-CU4-gDSi.cjs → mode-javascript-BW2Gtk1B.cjs} +1 -1
  29. package/{mode-json-CIyvEhnr.js → mode-json-B_6Rc56R.js} +1 -1
  30. package/{mode-json-BM-YsleU.cjs → mode-json-Dj69lfnz.cjs} +1 -1
  31. package/{mode-mysql-DPV59SE4.cjs → mode-mysql-CGxHP8j2.cjs} +1 -1
  32. package/{mode-mysql-BwT2SuQq.js → mode-mysql-D25NsOyA.js} +1 -1
  33. package/package.json +1 -1
  34. package/style.css +1 -1
  35. package/index-_ZAzzf-F.cjs +0 -1
  36. package/inner-jxs-nG3b.cjs +0 -1
@@ -42503,6 +42503,13 @@ const _sfc_main$1_ = /* @__PURE__ */ defineComponent({
42503
42503
  tableData.push(newRow);
42504
42504
  emits2("update:editStatus", true);
42505
42505
  }
42506
+ function handleEditCellChange(column, row, val) {
42507
+ const syncTo = column.syncTo;
42508
+ if (syncTo && (!row[syncTo] || row[syncTo] === row[column.prop])) {
42509
+ row[syncTo] = val;
42510
+ }
42511
+ row[column.prop] = val;
42512
+ }
42506
42513
  setValue({
42507
42514
  "menuClick": handleMenuCommand,
42508
42515
  setEditData,
@@ -42633,7 +42640,7 @@ const _sfc_main$1_ = /* @__PURE__ */ defineComponent({
42633
42640
  requiredMessage: column.requiredMessage,
42634
42641
  prop: column.prop,
42635
42642
  modelValue: slotProps.row[column.prop],
42636
- "onUpdate:modelValue": ($event) => slotProps.row[column.prop] = $event
42643
+ "onUpdate:modelValue": (val) => handleEditCellChange(column, slotProps.row, val)
42637
42644
  }, { ref_for: true }, (column.editComponent || {}).props || {}, {
42638
42645
  aIndex: slotProps.$index
42639
42646
  }), null, 16, ["required", "requiredMessage", "prop", "modelValue", "onUpdate:modelValue", "aIndex"]))
@@ -42812,7 +42819,7 @@ const _sfc_main$1_ = /* @__PURE__ */ defineComponent({
42812
42819
  };
42813
42820
  }
42814
42821
  });
42815
- const Table$1 = /* @__PURE__ */ _export_sfc$1(_sfc_main$1_, [["__scopeId", "data-v-3219fa3f"]]);
42822
+ const Table$1 = /* @__PURE__ */ _export_sfc$1(_sfc_main$1_, [["__scopeId", "data-v-b7ccc2a8"]]);
42816
42823
  const ElsTable = withInstall$1(Table$1);
42817
42824
  const treeProps = buildProps({
42818
42825
  ...formItemProps$1,
@@ -48338,7 +48345,10 @@ const requestFormProps = buildProps({
48338
48345
  /**
48339
48346
  * @description 节点自身的字段标识,由渲染层自动传入。设置时返回数据整体挂载到 globalData[keyCode] 下,未设置则扁平合并到 globalData 根节点
48340
48347
  */
48341
- keyCode: String
48348
+ keyCode: String,
48349
+ labelPosition: String,
48350
+ labelWidth: String,
48351
+ labelSuffix: String
48342
48352
  });
48343
48353
  const _hoisted_1$19 = { class: "els-request-form__meta" };
48344
48354
  const _hoisted_2$m = { class: "els-request-form__method" };
@@ -48374,6 +48384,9 @@ const _sfc_main$1v = /* @__PURE__ */ defineComponent({
48374
48384
  const { getValue: getValue2 } = useProps();
48375
48385
  const getGlobalData = getValue2("getGlobalData", () => ({}));
48376
48386
  const setRootNodeValueByPath = getValue2("setRootNodeValueByPath", null);
48387
+ const getFormLabelPosition = getValue2("getFormLabelPosition", () => "");
48388
+ const getFormLabelWidth = getValue2("getFormLabelWidth", () => "");
48389
+ const getFormLabelSuffix = getValue2("getFormLabelSuffix", () => "");
48377
48390
  const { $codeField, $messageField, $dataField, $success } = utils.getApiConfig();
48378
48391
  const modelValue = useModel$1(__props, "modelValue");
48379
48392
  const loading = ref(false);
@@ -48533,7 +48546,7 @@ const _sfc_main$1v = /* @__PURE__ */ defineComponent({
48533
48546
  }
48534
48547
  __expose({ submit: handleSubmit, abort: handleAbort });
48535
48548
  return (_ctx, _cache) => {
48536
- const _component_el_form = resolveComponent("el-form");
48549
+ const _component_els_form = resolveComponent("els-form");
48537
48550
  const _component_el_icon = resolveComponent("el-icon");
48538
48551
  const _component_el_tag = resolveComponent("el-tag");
48539
48552
  const _component_el_button = resolveComponent("el-button");
@@ -48542,7 +48555,7 @@ const _sfc_main$1v = /* @__PURE__ */ defineComponent({
48542
48555
  return openBlock(), createElementBlock("div", {
48543
48556
  class: normalizeClass(["els-request-form", [`els-request-form--${methodTheme.value}`, { "is-loading": loading.value }]])
48544
48557
  }, [
48545
- _cache[1] || (_cache[1] = createElementVNode("span", { class: "els-request-form__accent" }, null, -1)),
48558
+ _cache[2] || (_cache[2] = createElementVNode("span", { class: "els-request-form__accent" }, null, -1)),
48546
48559
  createElementVNode("div", _hoisted_1$19, [
48547
48560
  createElementVNode("span", _hoisted_2$m, toDisplayString(_ctx.requestMethod), 1),
48548
48561
  createElementVNode("span", {
@@ -48550,15 +48563,19 @@ const _sfc_main$1v = /* @__PURE__ */ defineComponent({
48550
48563
  title: _ctx.requestUrl
48551
48564
  }, toDisplayString(_ctx.requestUrl || "未配置接口地址"), 9, _hoisted_3$i)
48552
48565
  ]),
48553
- createVNode(_component_el_form, {
48554
- model: modelValue.value,
48555
- class: "els-request-form__body"
48566
+ createVNode(_component_els_form, {
48567
+ modelValue: modelValue.value,
48568
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => modelValue.value = $event),
48569
+ class: "els-request-form__body",
48570
+ "label-position": _ctx.labelPosition || unref(getFormLabelPosition)() || void 0,
48571
+ "label-width": _ctx.labelWidth || unref(getFormLabelWidth)() || void 0,
48572
+ "label-suffix": _ctx.labelSuffix || unref(getFormLabelSuffix)() || void 0
48556
48573
  }, {
48557
48574
  default: withCtx(() => [
48558
48575
  renderSlot(_ctx.$slots, "default", {}, void 0, true)
48559
48576
  ]),
48560
48577
  _: 3
48561
- }, 8, ["model"]),
48578
+ }, 8, ["modelValue", "label-position", "label-width", "label-suffix"]),
48562
48579
  resultVisible.value || loading.value ? (openBlock(), createElementBlock("div", _hoisted_4$c, [
48563
48580
  createElementVNode("div", _hoisted_5$c, [
48564
48581
  createElementVNode("div", _hoisted_6$a, [
@@ -48619,7 +48636,7 @@ const _sfc_main$1v = /* @__PURE__ */ defineComponent({
48619
48636
  createVNode(_component_el_button, {
48620
48637
  text: "",
48621
48638
  icon: resultExpanded.value ? unref(arrow_up_default) : unref(arrow_down_default),
48622
- onClick: _cache[0] || (_cache[0] = ($event) => resultExpanded.value = !resultExpanded.value)
48639
+ onClick: _cache[1] || (_cache[1] = ($event) => resultExpanded.value = !resultExpanded.value)
48623
48640
  }, null, 8, ["icon"])
48624
48641
  ]),
48625
48642
  _: 1
@@ -48658,7 +48675,7 @@ const _sfc_main$1v = /* @__PURE__ */ defineComponent({
48658
48675
  };
48659
48676
  }
48660
48677
  });
48661
- const RequestForm = /* @__PURE__ */ _export_sfc$1(_sfc_main$1v, [["__scopeId", "data-v-9fe784ab"]]);
48678
+ const RequestForm = /* @__PURE__ */ _export_sfc$1(_sfc_main$1v, [["__scopeId", "data-v-b51ce04e"]]);
48662
48679
  const ElsRequestForm = withInstall$1(RequestForm);
48663
48680
  const dataModalProps = buildProps({
48664
48681
  ...formItemProps$1,
@@ -51798,6 +51815,7 @@ const property_radio = [
51798
51815
  "id": "label",
51799
51816
  "label": "Label",
51800
51817
  "prop": "label",
51818
+ "syncTo": "value",
51801
51819
  "width": "",
51802
51820
  "showSummary": false,
51803
51821
  "sortable": false,
@@ -52004,6 +52022,7 @@ const property_radio = [
52004
52022
  "id": "label",
52005
52023
  "label": "Label",
52006
52024
  "prop": "label",
52025
+ "syncTo": "value",
52007
52026
  "width": "",
52008
52027
  "showSummary": false,
52009
52028
  "sortable": false,
@@ -52209,6 +52228,7 @@ const property_radio = [
52209
52228
  "id": "label",
52210
52229
  "label": "Label",
52211
52230
  "prop": "label",
52231
+ "syncTo": "value",
52212
52232
  "width": "",
52213
52233
  "showSummary": false,
52214
52234
  "sortable": false,
@@ -52830,6 +52850,7 @@ const property_checkbox = [
52830
52850
  {
52831
52851
  "label": "Label",
52832
52852
  "prop": "label",
52853
+ "syncTo": "value",
52833
52854
  "width": "",
52834
52855
  "showSummary": false,
52835
52856
  "sortable": false,
@@ -53331,6 +53352,7 @@ const property_select = [
53331
53352
  "id": "label",
53332
53353
  "label": "Label",
53333
53354
  "prop": "label",
53355
+ "syncTo": "value",
53334
53356
  "width": "",
53335
53357
  "showSummary": false,
53336
53358
  "sortable": false,
@@ -53537,6 +53559,7 @@ const property_select = [
53537
53559
  "id": "label",
53538
53560
  "label": "Label",
53539
53561
  "prop": "label",
53562
+ "syncTo": "value",
53540
53563
  "width": "",
53541
53564
  "showSummary": false,
53542
53565
  "sortable": false,
@@ -53742,6 +53765,7 @@ const property_select = [
53742
53765
  "id": "label",
53743
53766
  "label": "Label",
53744
53767
  "prop": "label",
53768
+ "syncTo": "value",
53745
53769
  "width": "",
53746
53770
  "showSummary": false,
53747
53771
  "sortable": false,
@@ -67128,45 +67152,109 @@ const property_table = [
67128
67152
  "name": "default",
67129
67153
  "children": [
67130
67154
  {
67131
- "keyID": "key_92800",
67155
+ "keyID": "key_data_tip_nocolumns",
67156
+ "keyName": "",
67157
+ "keyCode": "",
67158
+ "children": [],
67159
+ "dataType": "None",
67160
+ "dataTypeName": "None",
67161
+ "arrayDataTypeName": "",
67162
+ "arrayDataType": "",
67163
+ "componentGroup": "Show",
67164
+ "componentTypeLabel": "页面提示",
67165
+ "componentTypeName": "Tip",
67166
+ "componentName": "ElsTip",
67167
+ "componentType": "Tip",
67168
+ "formItem": false,
67169
+ "componentShow": true,
67170
+ "icon": "tips",
67171
+ "slots": [],
67172
+ "config": {
67173
+ "formConfig": {},
67174
+ "baseConfig": {
67175
+ "title": "请先配置列",
67176
+ "content": "请先在「列配置」中添加列,然后再配置数据列表"
67177
+ },
67178
+ "advancedConfig": {
67179
+ "style": "",
67180
+ "vif": "!globalData._parentGlobalData?.config?.baseConfig?.columns?.length",
67181
+ "disabled": "",
67182
+ "eventChange": ""
67183
+ },
67184
+ "arrayConfig": {}
67185
+ }
67186
+ },
67187
+ {
67188
+ "keyID": "key_data_table",
67132
67189
  "keyName": "数据列表",
67133
67190
  "keyCode": "default",
67134
67191
  "children": [],
67135
- "dataType": "Object",
67136
- "dataTypeName": "Object",
67192
+ "dataType": "Array",
67193
+ "dataTypeName": "Array",
67137
67194
  "arrayDataTypeName": "",
67138
67195
  "arrayDataType": "",
67139
- "componentGroup": "Form",
67140
- "componentTypeLabel": "Json编辑器",
67141
- "componentTypeName": "JsonEditor",
67142
- "componentName": "ElsJsonEditor",
67143
- "componentType": "JsonEditor",
67196
+ "componentGroup": "Show",
67197
+ "componentTypeLabel": "Table表格",
67198
+ "componentTypeName": "Table",
67199
+ "componentName": "ElsTable",
67200
+ "componentType": "Table",
67144
67201
  "formItem": true,
67145
67202
  "componentShow": true,
67146
- "icon": "text-style",
67203
+ "icon": "table",
67147
67204
  "slots": [],
67148
67205
  "config": {
67149
- "formConfig": {
67150
- "labelWidth": "",
67151
- "suffixContent": "",
67152
- "required": false,
67153
- "requiredMessage": "",
67154
- "tip": "",
67155
- "tipPosition": "left",
67156
- "validType": "",
67157
- "validMessage": "",
67158
- "validExpression": "",
67159
- "validMethod": ""
67206
+ "formConfig": {},
67207
+ "baseConfig": {
67208
+ "rowKey": "_id",
67209
+ "columns": [],
67210
+ "re_columns": ":globalData._parentGlobalData?.config?.baseConfig?.columns?.map(c=>({label:c.label,prop:c.prop,isEdit:true,editComponent:{name:'els-input',props:{}}}))||[]",
67211
+ "height": "",
67212
+ "maxHeight": "400",
67213
+ "align": "center",
67214
+ "isEdit": true,
67215
+ "dragRow": true,
67216
+ "hasPage": false
67160
67217
  },
67218
+ "advancedConfig": {
67219
+ "style": "",
67220
+ "vif": "globalData._parentGlobalData?.config?.baseConfig?.columns?.length",
67221
+ "disabled": "",
67222
+ "eventChange": ""
67223
+ },
67224
+ "arrayConfig": {}
67225
+ },
67226
+ "value": []
67227
+ },
67228
+ {
67229
+ "keyID": "key_data_addrow_btn",
67230
+ "keyName": "Button按钮",
67231
+ "keyCode": "",
67232
+ "children": [],
67233
+ "dataType": "None",
67234
+ "dataTypeName": "None",
67235
+ "arrayDataTypeName": "",
67236
+ "arrayDataType": "",
67237
+ "componentGroup": "Show",
67238
+ "componentTypeLabel": "Button按钮",
67239
+ "componentTypeName": "Button",
67240
+ "componentName": "ElButton",
67241
+ "componentType": "Button",
67242
+ "formItem": false,
67243
+ "componentShow": true,
67244
+ "icon": "button",
67245
+ "slots": [],
67246
+ "config": {
67247
+ "formConfig": {},
67161
67248
  "baseConfig": {
67162
- "navigationBar": true,
67163
- "mainMenuBar": true,
67164
- "readOnly": false,
67165
- "statusBar": true
67249
+ "innerContent": "新增行",
67250
+ "type": "info",
67251
+ "text": true,
67252
+ "bg": true,
67253
+ "eventClick": "const cols=globalData._parentGlobalData?.config?.baseConfig?.columns||[];const row={_id:utils.shortid()};cols.forEach(c=>{row[c.prop]=''});refs['key_data_table']?.addRow(row)"
67166
67254
  },
67167
67255
  "advancedConfig": {
67168
- "style": "height:450px",
67169
- "vif": "",
67256
+ "style": "margin-top:8px",
67257
+ "vif": "globalData._parentGlobalData?.config?.baseConfig?.columns?.length",
67170
67258
  "disabled": "",
67171
67259
  "eventChange": ""
67172
67260
  },
@@ -67205,7 +67293,8 @@ const property_table = [
67205
67293
  "bg": true,
67206
67294
  "type": "info"
67207
67295
  },
67208
- "function_confirm": ""
67296
+ "function_confirm": "const rows=slotValue?.default?.default;if(Array.isArray(rows)){globalData.config.baseConfig.data=rows.map(({_id:_,...r})=>r)}return Promise.resolve(true)",
67297
+ "function_open": "if(slotValue)slotValue['default']={default:(globalData.config.baseConfig.data||[]).map(r=>({...r,_id:utils.shortid()}))}"
67209
67298
  },
67210
67299
  "advancedConfig": {},
67211
67300
  "arrayConfig": {
@@ -67263,6 +67352,7 @@ const property_table = [
67263
67352
  "id": "label",
67264
67353
  "label": "列名称",
67265
67354
  "prop": "label",
67355
+ "syncTo": "prop",
67266
67356
  "width": "",
67267
67357
  "showSummary": false,
67268
67358
  "sortable": false,
@@ -74965,7 +75055,7 @@ const _sfc_main$1l = /* @__PURE__ */ defineComponent({
74965
75055
  emits: /* @__PURE__ */ mergeModels(["removeItem"], ["update:children"]),
74966
75056
  setup(__props, { emit: __emit }) {
74967
75057
  const DynamicDesignerInnerItem = defineAsyncComponent(() => {
74968
- return import("./innerItem-CnLhfK-G.js");
75058
+ return import("./innerItem-5Au5l5Jf.js");
74969
75059
  });
74970
75060
  const { getValue: getValue2 } = useProps();
74971
75061
  const tagID = getValue2("tagID");
@@ -75954,6 +76044,44 @@ const renderProps = buildProps({
75954
76044
  default: {}
75955
76045
  }
75956
76046
  });
76047
+ function parseNodePath(path) {
76048
+ return String(path || "").split(".").map((p) => p.trim()).filter(Boolean);
76049
+ }
76050
+ function castNodeValue(item, value) {
76051
+ if (value === null || value === "") return value;
76052
+ const dataType = item.dataTypeName || item.dataType;
76053
+ if (dataType === "Number") {
76054
+ const n = Number(value);
76055
+ return Number.isNaN(n) ? value : n;
76056
+ }
76057
+ if (dataType === "Bool") {
76058
+ if (typeof value === "boolean") return value;
76059
+ if (typeof value === "number") return value !== 0;
76060
+ if (typeof value === "string") {
76061
+ const lower = value.toLowerCase();
76062
+ if (lower === "true" || lower === "1") return true;
76063
+ if (lower === "false" || lower === "0") return false;
76064
+ }
76065
+ }
76066
+ return value;
76067
+ }
76068
+ function setNodeValueByParts(items, parts, value) {
76069
+ if (!(items == null ? void 0 : items.length) || !parts.length) return false;
76070
+ const [current, ...rest] = parts;
76071
+ for (const item of items) {
76072
+ const isObjectContainer = (item.dataTypeName === "Object" || item.dataType === "Object") && item.keyCode && !item.componentTypeName;
76073
+ const isLayoutContainer = item.componentGroup === "Container" && !isObjectContainer;
76074
+ if (item.keyCode === current) {
76075
+ if (!rest.length) {
76076
+ item.value = castNodeValue(item, value);
76077
+ return true;
76078
+ }
76079
+ if (setNodeValueByParts(item.children || [], rest, value)) return true;
76080
+ }
76081
+ if (isLayoutContainer && setNodeValueByParts(item.children || [], parts, value)) return true;
76082
+ }
76083
+ return false;
76084
+ }
75957
76085
  const _hoisted_1$12 = { class: "els-node els-dynamic-render" };
75958
76086
  const _hoisted_2$h = { class: "els-dynamic-render-inner" };
75959
76087
  const _sfc_main$1j = /* @__PURE__ */ defineComponent({
@@ -75965,10 +76093,10 @@ const _sfc_main$1j = /* @__PURE__ */ defineComponent({
75965
76093
  emits: ["update:modelValue"],
75966
76094
  setup(__props, { expose: __expose, emit: __emit }) {
75967
76095
  const DynamicRenderInner = defineAsyncComponent(() => {
75968
- return import("./inner-Cn9E8KV4.js").then((n) => n.i);
76096
+ return import("./inner-Ba84wZRD.js").then((n) => n.i);
75969
76097
  });
75970
76098
  const DynamicRenderForm = defineAsyncComponent(() => {
75971
- return import("./inner-Cn9E8KV4.js").then((n) => n.f);
76099
+ return import("./inner-Ba84wZRD.js").then((n) => n.f);
75972
76100
  });
75973
76101
  const props2 = __props;
75974
76102
  const { getValue: getValue2, setValue, formNodeProps } = useProps(props2);
@@ -76120,46 +76248,6 @@ const _sfc_main$1j = /* @__PURE__ */ defineComponent({
76120
76248
  const result = getNodeValue(renderData.value);
76121
76249
  return result;
76122
76250
  };
76123
- function parseNodePath(path) {
76124
- return String(path || "").split(".").map((p) => p.trim()).filter(Boolean);
76125
- }
76126
- function castNodeValue(item, value) {
76127
- if (value === null || value === "") return value;
76128
- const dataType = item.dataTypeName || item.dataType;
76129
- if (dataType === "Number") {
76130
- const numberValue = Number(value);
76131
- return Number.isNaN(numberValue) ? value : numberValue;
76132
- }
76133
- if (dataType === "Bool") {
76134
- if (typeof value === "boolean") return value;
76135
- if (typeof value === "number") return value !== 0;
76136
- if (typeof value === "string") {
76137
- const lower = value.toLowerCase();
76138
- if (lower === "true") return true;
76139
- if (lower === "false") return false;
76140
- if (lower === "1") return true;
76141
- if (lower === "0") return false;
76142
- }
76143
- }
76144
- return value;
76145
- }
76146
- function setNodeValueByParts(items, parts, value) {
76147
- if (!(items == null ? void 0 : items.length) || !parts.length) return false;
76148
- const [current, ...rest] = parts;
76149
- for (const item of items) {
76150
- const isObjectContainer = (item.dataTypeName === "Object" || item.dataType === "Object") && item.keyCode && !item.componentTypeName;
76151
- const isLayoutContainer = item.componentGroup === "Container" && !isObjectContainer;
76152
- if (item.keyCode === current) {
76153
- if (!rest.length) {
76154
- item.value = castNodeValue(item, value);
76155
- return true;
76156
- }
76157
- if (setNodeValueByParts(item.children || [], rest, value)) return true;
76158
- }
76159
- if (isLayoutContainer && setNodeValueByParts(item.children || [], parts, value)) return true;
76160
- }
76161
- return false;
76162
- }
76163
76251
  function setRootNodeValueByPath(path, value) {
76164
76252
  const parts = parseNodePath(path);
76165
76253
  if (!parts.length) return false;
@@ -76236,7 +76324,7 @@ const _sfc_main$1j = /* @__PURE__ */ defineComponent({
76236
76324
  };
76237
76325
  }
76238
76326
  });
76239
- const DynamicRender = /* @__PURE__ */ _export_sfc$1(_sfc_main$1j, [["__scopeId", "data-v-f26f8fe8"]]);
76327
+ const DynamicRender = /* @__PURE__ */ _export_sfc$1(_sfc_main$1j, [["__scopeId", "data-v-c6839b6d"]]);
76240
76328
  const _hoisted_1$11 = { class: "els-node els-dynamic-render" };
76241
76329
  const _hoisted_2$g = { class: "els-dynamic-render-inner" };
76242
76330
  const _sfc_main$1i = /* @__PURE__ */ defineComponent({
@@ -76248,10 +76336,10 @@ const _sfc_main$1i = /* @__PURE__ */ defineComponent({
76248
76336
  emits: ["update:modelValue"],
76249
76337
  setup(__props, { expose: __expose, emit: __emit }) {
76250
76338
  const DynamicRenderInnerAsync = defineAsyncComponent(() => {
76251
- return import("./inner-Cn9E8KV4.js").then((n) => n.i);
76339
+ return import("./inner-Ba84wZRD.js").then((n) => n.i);
76252
76340
  });
76253
76341
  const DynamicRenderFormAsync = defineAsyncComponent(() => {
76254
- return import("./inner-Cn9E8KV4.js").then((n) => n.f);
76342
+ return import("./inner-Ba84wZRD.js").then((n) => n.f);
76255
76343
  });
76256
76344
  const props2 = __props;
76257
76345
  const { getValue: getValue2, setValue, formNodeProps } = useProps(props2);
@@ -76387,46 +76475,6 @@ const _sfc_main$1i = /* @__PURE__ */ defineComponent({
76387
76475
  const getCurrNode = function() {
76388
76476
  return getNodeValue(renderData.value);
76389
76477
  };
76390
- function parseNodePath(path) {
76391
- return String(path || "").split(".").map((p) => p.trim()).filter(Boolean);
76392
- }
76393
- function castNodeValue(item, value) {
76394
- if (value === null || value === "") return value;
76395
- const dataType = item.dataTypeName || item.dataType;
76396
- if (dataType === "Number") {
76397
- const numberValue = Number(value);
76398
- return Number.isNaN(numberValue) ? value : numberValue;
76399
- }
76400
- if (dataType === "Bool") {
76401
- if (typeof value === "boolean") return value;
76402
- if (typeof value === "number") return value !== 0;
76403
- if (typeof value === "string") {
76404
- const lower = value.toLowerCase();
76405
- if (lower === "true") return true;
76406
- if (lower === "false") return false;
76407
- if (lower === "1") return true;
76408
- if (lower === "0") return false;
76409
- }
76410
- }
76411
- return value;
76412
- }
76413
- function setNodeValueByParts(items, parts, value) {
76414
- if (!(items == null ? void 0 : items.length) || !parts.length) return false;
76415
- const [current, ...rest] = parts;
76416
- for (const item of items) {
76417
- const isObjectContainer = (item.dataTypeName === "Object" || item.dataType === "Object") && item.keyCode && !item.componentTypeName;
76418
- const isLayoutContainer = item.componentGroup === "Container" && !isObjectContainer;
76419
- if (item.keyCode === current) {
76420
- if (!rest.length) {
76421
- item.value = castNodeValue(item, value);
76422
- return true;
76423
- }
76424
- if (setNodeValueByParts(item.children || [], rest, value)) return true;
76425
- }
76426
- if (isLayoutContainer && setNodeValueByParts(item.children || [], parts, value)) return true;
76427
- }
76428
- return false;
76429
- }
76430
76478
  function setRootNodeValueByPath(path, value) {
76431
76479
  const parts = parseNodePath(path);
76432
76480
  if (!parts.length) return false;
@@ -76509,7 +76557,7 @@ const _sfc_main$1i = /* @__PURE__ */ defineComponent({
76509
76557
  };
76510
76558
  }
76511
76559
  });
76512
- const DynamicRenderAsync = /* @__PURE__ */ _export_sfc$1(_sfc_main$1i, [["__scopeId", "data-v-cd8d8a25"]]);
76560
+ const DynamicRenderAsync = /* @__PURE__ */ _export_sfc$1(_sfc_main$1i, [["__scopeId", "data-v-742ccd6b"]]);
76513
76561
  const renderAsync = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
76514
76562
  __proto__: null,
76515
76563
  default: DynamicRenderAsync
@@ -78662,6 +78710,9 @@ const _sfc_main$z = /* @__PURE__ */ defineComponent({
78662
78710
  });
78663
78711
  const setSlotVisible = getValue2("setSlotVisible", () => {
78664
78712
  });
78713
+ const triggerAiGenerate = getValue2("triggerAiGenerate", () => {
78714
+ });
78715
+ const aiUrl = getValue2("aiUrl", "");
78665
78716
  const slotVisible = ref();
78666
78717
  function handleRemove(item) {
78667
78718
  removeItem(item);
@@ -78671,21 +78722,34 @@ const _sfc_main$z = /* @__PURE__ */ defineComponent({
78671
78722
  setSlotVisible();
78672
78723
  slotVisible.value = !slotVisible.value;
78673
78724
  }
78725
+ const arrayTypeLabelMap = {
78726
+ String: "字符串数组",
78727
+ Number: "数字数组",
78728
+ Bool: "Bool数组",
78729
+ Object: "对象数组"
78730
+ };
78731
+ function formatDataTypeLabel(item) {
78732
+ if (item.dataTypeName === "Array") {
78733
+ return item.arrayDataTypeName ? arrayTypeLabelMap[item.arrayDataTypeName] || `${item.arrayDataTypeName}数组` : "数组";
78734
+ }
78735
+ if (item.dataTypeName === "Object") return "对象表单";
78736
+ return item.dataTypeName;
78737
+ }
78674
78738
  return (_ctx, _cache) => {
78675
78739
  const _component_View = resolveComponent("View");
78676
78740
  const _component_el_icon = resolveComponent("el-icon");
78677
78741
  const _component_ArrowDown = resolveComponent("ArrowDown");
78678
78742
  const _component_ArrowUp = resolveComponent("ArrowUp");
78743
+ const _component_MagicStick = resolveComponent("MagicStick");
78679
78744
  const _component_Delete = resolveComponent("Delete");
78680
78745
  const _component_Rank = resolveComponent("Rank");
78681
78746
  return openBlock(), createElementBlock(Fragment$1, null, [
78682
78747
  !__props.nodeItem.excludeFromResult && (__props.nodeItem.componentGroup == "Form" || __props.nodeItem.formItem && __props.nodeItem.keyCode) ? (openBlock(), createElementBlock("span", _hoisted_1$l, [
78683
78748
  createElementVNode("span", null, toDisplayString(__props.nodeItem.keyCode), 1),
78684
- createElementVNode("span", null, toDisplayString(__props.nodeItem.dataTypeName === "Array" && !__props.nodeItem.componentType || __props.nodeItem.arrayDataTypeName ? `Array
78685
- <${__props.nodeItem.arrayDataTypeName ? __props.nodeItem.arrayDataTypeName : "T"}>` : __props.nodeItem.dataTypeName), 1)
78749
+ createElementVNode("span", null, toDisplayString(formatDataTypeLabel(__props.nodeItem)), 1)
78686
78750
  ])) : createCommentVNode("", true),
78687
78751
  createElementVNode("span", _hoisted_2$e, [
78688
- __props.nodeItem.componentTypeLabel != "Object" && __props.nodeItem.componentTypeLabel != "Array<T>" ? (openBlock(), createElementBlock("span", _hoisted_3$d, toDisplayString(__props.nodeItem.componentTypeLabel), 1)) : createCommentVNode("", true),
78752
+ __props.nodeItem.componentTypeLabel != "对象表单" && __props.nodeItem.componentTypeLabel != "数组" ? (openBlock(), createElementBlock("span", _hoisted_3$d, toDisplayString(__props.nodeItem.componentTypeLabel), 1)) : createCommentVNode("", true),
78689
78753
  __props.nodeItem.config.advancedConfig.vif ? (openBlock(), createBlock(_component_el_icon, {
78690
78754
  key: 1,
78691
78755
  title: "v-if:" + __props.nodeItem.config.advancedConfig.vif
@@ -78699,7 +78763,7 @@ const _sfc_main$z = /* @__PURE__ */ defineComponent({
78699
78763
  key: 2,
78700
78764
  onClick: handleSetSlotVisible
78701
78765
  }, [
78702
- _cache[1] || (_cache[1] = createTextVNode("插槽", -1)),
78766
+ _cache[2] || (_cache[2] = createTextVNode("插槽", -1)),
78703
78767
  !slotVisible.value ? (openBlock(), createBlock(_component_el_icon, { key: 0 }, {
78704
78768
  default: withCtx(() => [
78705
78769
  createVNode(_component_ArrowDown)
@@ -78712,9 +78776,19 @@ const _sfc_main$z = /* @__PURE__ */ defineComponent({
78712
78776
  _: 1
78713
78777
  }))
78714
78778
  ])) : createCommentVNode("", true),
78779
+ unref(aiUrl) && __props.nodeItem.componentGroup === "Container" ? (openBlock(), createBlock(_component_el_icon, {
78780
+ key: 3,
78781
+ onClick: _cache[0] || (_cache[0] = ($event) => unref(triggerAiGenerate)(__props.nodeItem)),
78782
+ title: "AI生成"
78783
+ }, {
78784
+ default: withCtx(() => [
78785
+ createVNode(_component_MagicStick)
78786
+ ]),
78787
+ _: 1
78788
+ })) : createCommentVNode("", true),
78715
78789
  createVNode(_component_el_icon, {
78716
78790
  class: "el-icon-remove",
78717
- onClick: _cache[0] || (_cache[0] = ($event) => handleRemove(__props.nodeItem))
78791
+ onClick: _cache[1] || (_cache[1] = ($event) => handleRemove(__props.nodeItem))
78718
78792
  }, {
78719
78793
  default: withCtx(() => [
78720
78794
  createVNode(_component_Delete)
@@ -78732,7 +78806,7 @@ const _sfc_main$z = /* @__PURE__ */ defineComponent({
78732
78806
  };
78733
78807
  }
78734
78808
  });
78735
- const DynamicDesignerViewOperate = /* @__PURE__ */ _export_sfc$1(_sfc_main$z, [["__scopeId", "data-v-7cc3e387"]]);
78809
+ const DynamicDesignerViewOperate = /* @__PURE__ */ _export_sfc$1(_sfc_main$z, [["__scopeId", "data-v-5b4a8315"]]);
78736
78810
  const _hoisted_1$k = { key: 1 };
78737
78811
  const _sfc_main$y = /* @__PURE__ */ defineComponent({
78738
78812
  __name: "wrap",
@@ -79106,7 +79180,7 @@ const _sfc_main$w = /* @__PURE__ */ defineComponent({
79106
79180
  default: withCtx(() => [
79107
79181
  createElementVNode("div", _hoisted_2$d, [
79108
79182
  createElementVNode("div", _hoisted_3$c, [
79109
- createVNode(_sfc_main$u, {
79183
+ createVNode(DynamicDesignerViewBody, {
79110
79184
  renderData: slot.children,
79111
79185
  minHeight: "100",
79112
79186
  isMobile: unref(isMobile)
@@ -79197,14 +79271,15 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
79197
79271
  }
79198
79272
  });
79199
79273
  return (_ctx, _cache) => {
79200
- var _a;
79274
+ var _a, _b, _c, _d, _e;
79201
79275
  const _component_els_form = resolveComponent("els-form");
79202
79276
  return __props.isRoot ? (openBlock(), createBlock(_component_els_form, mergeProps({
79203
79277
  key: 0,
79204
79278
  modelValue: nodeItem.value,
79205
79279
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => nodeItem.value = $event)
79206
79280
  }, unref(componentProps), {
79207
- class: { "selected": ((_a = unref(getSelectItem)()) == null ? void 0 : _a.keyID) == nodeItem.value.keyID },
79281
+ key: (_b = (_a = nodeItem.value.config) == null ? void 0 : _a.baseConfig) == null ? void 0 : _b.labelPosition,
79282
+ class: { "selected": ((_c = unref(getSelectItem)()) == null ? void 0 : _c.keyID) == nodeItem.value.keyID },
79208
79283
  onClick: _cache[1] || (_cache[1] = withModifiers(($event) => unref(setSelectItem)(nodeItem.value), ["stop"]))
79209
79284
  }), {
79210
79285
  default: withCtx(() => [
@@ -79234,14 +79309,16 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
79234
79309
  key: 1,
79235
79310
  modelValue: nodeItem.value,
79236
79311
  "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => nodeItem.value = $event)
79237
- }, unref(componentProps)), {
79312
+ }, unref(componentProps), {
79313
+ key: (_e = (_d = nodeItem.value.config) == null ? void 0 : _d.baseConfig) == null ? void 0 : _e.labelPosition
79314
+ }), {
79238
79315
  default: withCtx(() => [
79239
79316
  (openBlock(), createBlock(resolveDynamicComponent(unref(isMobile) ? "van-cell-group" : "div"), {
79240
79317
  title: nodeItem.value.keyName
79241
79318
  }, {
79242
79319
  default: withCtx(() => [
79243
79320
  createVNode(unref(draggable), mergeProps({
79244
- class: [{ "els-dynamic-designer-empty": nodeItem.value.children.length == 0 }],
79321
+ class: [{ "els-dynamic-designer-empty": nodeItem.value.children.length == 0 && nodeItem.value.componentTypeName !== "Form" }, { "els-dynamic-array-undetermined": nodeItem.value.dataTypeName === "Array" && !nodeItem.value.arrayDataTypeName }],
79245
79322
  list: nodeItem.value.children
79246
79323
  }, { group: "dragGroup", ghostClass: "ghost", animation: 300 }, {
79247
79324
  style: [{ "min-height": "50px" }],
@@ -79268,7 +79345,7 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
79268
79345
  };
79269
79346
  }
79270
79347
  });
79271
- const DynamicDesignerViewForm = /* @__PURE__ */ _export_sfc$1(_sfc_main$v, [["__scopeId", "data-v-06406908"]]);
79348
+ const DynamicDesignerViewForm = /* @__PURE__ */ _export_sfc$1(_sfc_main$v, [["__scopeId", "data-v-d658c3e9"]]);
79272
79349
  const _sfc_main$u = /* @__PURE__ */ defineComponent({
79273
79350
  __name: "body",
79274
79351
  props: /* @__PURE__ */ mergeModels({
@@ -79360,6 +79437,7 @@ const _sfc_main$u = /* @__PURE__ */ defineComponent({
79360
79437
  };
79361
79438
  }
79362
79439
  });
79440
+ const DynamicDesignerViewBody = /* @__PURE__ */ _export_sfc$1(_sfc_main$u, [["__scopeId", "data-v-82f9f850"]]);
79363
79441
  const designerViewProps = buildProps({
79364
79442
  ...formItemProps$1,
79365
79443
  /**
@@ -79456,6 +79534,14 @@ const designerViewProps = buildProps({
79456
79534
  toolbar: {
79457
79535
  type: Array
79458
79536
  },
79537
+ /** AI 生成接口地址,有值时显示 AI 按钮 */
79538
+ aiUrl: { type: String },
79539
+ /** AI 系统提示词(不传则用内置默认) */
79540
+ aiSystemPrompt: { type: String },
79541
+ /** 自定义 AI 请求体构造 (systemPrompt, userPrompt) => body */
79542
+ aiBuildRequest: { type: Function },
79543
+ /** 自定义 AI 响应提取 (responseData) => string */
79544
+ aiPickResponse: { type: Function },
79459
79545
  /**
79460
79546
  * @description 左侧宽度
79461
79547
  */
@@ -79498,6 +79584,496 @@ const designerViewProps = buildProps({
79498
79584
  default: () => []
79499
79585
  }
79500
79586
  });
79587
+ const AI_SYSTEM_PROMPT = `你是一个低代码表单配置生成器。根据用户描述,输出符合以下格式的 JSON 数组。只输出 JSON,不要有任何额外文字、注释或代码块标记。
79588
+
79589
+ # 节点结构
79590
+
79591
+ 每个节点必须包含以下字段:
79592
+ - keyID: 唯一ID,格式 "key_" + 6位数字(如 "key_123456")
79593
+ - keyName: 显示名称(中文)
79594
+ - keyCode: 字段名(小驼峰,容器类节点为空字符串"")
79595
+ - componentType: 组件类型(见下方清单;Object/Array 数据节点不填此字段)
79596
+ - dataType: 数据类型(String/Number/Bool/Object/Array/None)
79597
+ - arrayDataType: 数组元素类型,仅当 dataType="Array" 时填写(Object/String/Number/Bool)
79598
+ - children: 子节点数组(叶子节点为 [])
79599
+ - config: 包含 formConfig、baseConfig、advancedConfig、arrayConfig 四个对象
79600
+
79601
+ 不要输出 componentName、componentGroup、dataTypeName、formItem 等字段(由系统自动填充)。
79602
+
79603
+ # 组件清单
79604
+
79605
+ ## 表单组件(有字段值输出,需填 keyCode)
79606
+
79607
+ | componentType | dataType | 说明 | 常用 baseConfig |
79608
+ |---|---|---|---|
79609
+ | Input | String | 单行输入框 | placeholder, clearable, maxlength, showWordLimit, isTrim, width, prefixIcon, suffixIcon |
79610
+ | Textarea | String | 多行文本 | placeholder, rows, maxlength, clearable, resize, width |
79611
+ | InputNumber | Number | 数字输入框 | min, max, step, precision, controls-position, width |
79612
+ | Slider | Number | 滑块 | min, max, step, showInput |
79613
+ | Switch | Bool/String/Number | 开关 | active-text, inactive-text, active-value, inactive-value |
79614
+ | Select | String/Number/Bool | 下拉选择 | data[{label,value}], multiple, filterable, clearable, placeholder, width, url, labelField, valueField |
79615
+ | Radio | String/Number/Bool | 单选 | type(radio/button), data[{label,value}], width, url |
79616
+ | Checkbox | String | 多选 | type(checkbox/button), data[{label,value}], width, url |
79617
+ | Cascader | String | 级联选择 | url, labelField, valueField, childrenField, clearable, multiple |
79618
+ | Datepicker | String/Number | 日期选择 | type(date/daterange/datetime/datetimerange/year/month/monthrange), format, valueFormat, clearable, width |
79619
+ | Timepicker | String/Number | 时间选择 | format, valueFormat, clearable, width |
79620
+ | Switch | Bool | 开关 | active-text, inactive-text |
79621
+ | Tree | String/Number | 树形选择 | url, labelField, valueField, clearable, multiple |
79622
+ | ColorPicker | String | 取色器 | showAlpha |
79623
+ | UploadPic | String | 上传图片 | width, height, limit |
79624
+ | UploadMutiPic | String | 上传图集(多图)| width, height, limit |
79625
+ | UploadFile | String | 上传文件 | accept, limit |
79626
+ | WangEditor | String | 富文本编辑器 | height |
79627
+ | AceEditor | String | 代码编辑器 | mode(javascript/json/html/css/python/sql), height |
79628
+ | JsonEditor | String/Object | JSON 编辑器 | height |
79629
+ | DataModal | String/Object/Array | 弹窗选择 | title, width, buttonLabel |
79630
+ | Caption | None/String | 分隔描述(formItem:true)| title, description, type(primary/success/warning/danger) |
79631
+ | Table | Array | 数据表格(formItem:true)| columns[{label,prop,width,sortable}], data, hasPage, maxHeight, url |
79632
+
79633
+ ## 容器组件(不含字段值,keyCode 为 "",dataType 为 None)
79634
+
79635
+ | componentType | 说明 | 主要 baseConfig |
79636
+ |---|---|---|
79637
+ | Row | 栅格行,子节点必须是 Col | gutter(默认10), justify(start/end/center/space-between/space-around), align(top/middle/bottom) |
79638
+ | Col | 栅格列,必须在 Row 内 | span(1-24,合计24), offset |
79639
+ | Card | 卡片容器 | header, shadow(always/hover/never) |
79640
+ | Collapse | 折叠面板,子节点是 CollapseItem | accordion |
79641
+ | CollapseItem | 折叠节点,必须在 Collapse 内 | title, name |
79642
+ | Tabs | 标签页,子节点是 TabPane | type(border-card/card), tabPosition(top/right/bottom/left) |
79643
+ | TabPane | 标签选项,必须在 Tabs 内 | label, name |
79644
+ | Dialog | 对话框 | title, width, fullscreen |
79645
+ | Drawer | 抽屉 | title, size, direction(rtl/ltr/ttb/btt) |
79646
+ | Html | 通用 div | display(flex), flex-wrap, justify-content, align-items, width, height, padding, background |
79647
+ | FormItem | 表单项容器 | label, labelWidth |
79648
+ | FormQuery | 查询表单(Object类型) | labelWidth |
79649
+ | RequestForm | 接口请求表单 | url, method(GET/POST), buttonLabel |
79650
+
79651
+ ## 展示组件(不含字段值,keyCode 为 "")
79652
+
79653
+ | componentType | 说明 | 主要 baseConfig |
79654
+ |---|---|---|
79655
+ | Button | 普通按钮 | innerContent, type(primary/success/warning/danger/info), plain, text, round, eventClick |
79656
+ | ButtonSearch | 查询按钮 | innerContent |
79657
+ | ButtonExport | 导出按钮 | innerContent |
79658
+ | Tip | 提示块 | title, content, type(primary/warning) |
79659
+ | Alert | 警告提示 | title, type(success/warning/info/error), description, closable |
79660
+ | Tag | 标签 | innerContent, type(success/info/warning/danger) |
79661
+ | Link | 链接 | innerContent, href, type, underline |
79662
+ | Text | 文本 | innerContent, type, size |
79663
+ | Image | 图片 | src, width, height, fit(fill/contain/cover/none) |
79664
+ | Tooltip | 文字提示 | content, placement(top/bottom/left/right), effect(dark/light) |
79665
+
79666
+ ## Object/Array 数据节点(无 componentType,由 dataType 驱动)
79667
+
79668
+ - dataType="Object":对象节点,children 放子字段,输出 {keyCode: {子字段...}}
79669
+ - dataType="Array" + arrayDataType="Object":对象数组节点(不含 componentType),children 定义数组元素的字段结构,每个子节点就是一行数据的字段
79670
+ - dataType="Array" + arrayDataType="String/Number":简单值数组
79671
+ - 这类节点没有 componentType 字段
79672
+
79673
+ ## Table 可编辑表格(推荐用于对象数组)
79674
+
79675
+ 当需要让用户在表格中编辑多行数据时,使用 componentType="Table",dataType="Array"。
79676
+ Table 通过 baseConfig.columns 定义列,每列需要 id(随机字符串)、label(列标题)、prop(字段名)、editComponent(编辑组件)。
79677
+ 设置 isEdit:true 开启行内编辑,canAddRow:true 允许新增行。
79678
+
79679
+ Table 节点的 slots 数组中每个 slot 对应一列的编辑插槽(name 格式为 "edit-{列id}"),slot.children 为空时使用 editComponent 默认编辑器,也可以在 children 中放入自定义组件。
79680
+
79681
+ Table 节点格式:
79682
+ \`\`\`json
79683
+ {
79684
+ "keyID": "key_xxxxxx",
79685
+ "keyCode": "列表字段名",
79686
+ "keyName": "显示名称",
79687
+ "dataType": "Array",
79688
+ "arrayDataType": "",
79689
+ "componentType": "Table",
79690
+ "children": [],
79691
+ "slots": [
79692
+ { "name": "edit-{列id1}", "label": "{列1标题} 编辑", "children": [] },
79693
+ { "name": "edit-{列id2}", "label": "{列2标题} 编辑", "children": [] }
79694
+ ],
79695
+ "config": {
79696
+ "formConfig": {},
79697
+ "baseConfig": {
79698
+ "rowKey": "",
79699
+ "url": "",
79700
+ "data": {},
79701
+ "columns": [
79702
+ { "id": "{列id1}", "label": "{列1标题}", "prop": "{字段名1}", "type": "default", "width": "", "editComponent": { "name": "els-input", "props": {} } },
79703
+ { "id": "{列id2}", "label": "{列2标题}", "prop": "{字段名2}", "type": "default", "width": "", "editComponent": { "name": "els-input", "props": {} } }
79704
+ ],
79705
+ "align": "center",
79706
+ "isEdit": true,
79707
+ "canAddRow": true,
79708
+ "hasPage": false,
79709
+ "maxHeight": ""
79710
+ },
79711
+ "advancedConfig": {},
79712
+ "arrayConfig": {}
79713
+ }
79714
+ }
79715
+ \`\`\`
79716
+ 列 id 使用8位随机字母数字串,slot name 格式必须与列 id 保持一致("edit-" + 列id)。
79717
+
79718
+ # 配置说明
79719
+
79720
+ ## formConfig(字段级表单配置)
79721
+ - re_required: 必填表达式("" 不必填,"true" 始终必填,"currNode['field']?.value=='A'" 条件必填)
79722
+ - requiredMessage: 必填提示文字
79723
+ - validType: 内置验证(email/phone/idcard/url)
79724
+ - validExpression: 自定义验证表达式
79725
+ - validMessage: 验证失败提示
79726
+ - tip: 字段提示文字
79727
+ - tipPosition: 提示位置(left/right/top)
79728
+
79729
+ ## advancedConfig(高级配置,所有组件均支持)
79730
+ - vif: 条件显示表达式(true显示,false隐藏)。访问其他字段用 currNode['keyCode'].value
79731
+ - disabled: 禁用表达式,同上
79732
+ - eventChange: 值变化时触发的 JS 代码
79733
+ - style: 动态样式字符串
79734
+
79735
+ # 配置案例
79736
+
79737
+ ## 案例1 - 基本表单
79738
+ \`\`\`json
79739
+ [
79740
+ {
79741
+ "keyID": "key_001001",
79742
+ "keyCode": "username",
79743
+ "keyName": "用户名",
79744
+ "componentType": "Input",
79745
+ "dataType": "String",
79746
+ "arrayDataType": "",
79747
+ "children": [],
79748
+ "config": {
79749
+ "formConfig": { "re_required": "true", "requiredMessage": "请输入用户名" },
79750
+ "baseConfig": { "placeholder": "请输入用户名", "clearable": true, "maxlength": "50" },
79751
+ "advancedConfig": { "style": "", "vif": "", "disabled": "", "eventChange": "" },
79752
+ "arrayConfig": {}
79753
+ }
79754
+ },
79755
+ {
79756
+ "keyID": "key_001002",
79757
+ "keyCode": "gender",
79758
+ "keyName": "性别",
79759
+ "componentType": "Radio",
79760
+ "dataType": "String",
79761
+ "arrayDataType": "",
79762
+ "children": [],
79763
+ "config": {
79764
+ "formConfig": {},
79765
+ "baseConfig": { "type": "radio", "data": [{"label": "男", "value": "male"}, {"label": "女", "value": "female"}] },
79766
+ "advancedConfig": { "style": "", "vif": "", "disabled": "", "eventChange": "" },
79767
+ "arrayConfig": {}
79768
+ }
79769
+ },
79770
+ {
79771
+ "keyID": "key_001003",
79772
+ "keyCode": "role",
79773
+ "keyName": "角色",
79774
+ "componentType": "Select",
79775
+ "dataType": "String",
79776
+ "arrayDataType": "",
79777
+ "children": [],
79778
+ "config": {
79779
+ "formConfig": {},
79780
+ "baseConfig": { "data": [{"label": "管理员", "value": "admin"}, {"label": "普通用户", "value": "user"}], "placeholder": "请选择角色", "clearable": true },
79781
+ "advancedConfig": { "style": "", "vif": "", "disabled": "", "eventChange": "" },
79782
+ "arrayConfig": {}
79783
+ }
79784
+ }
79785
+ ]
79786
+ \`\`\`
79787
+
79788
+ ## 案例2 - 栅格布局(Row + Col)
79789
+ \`\`\`json
79790
+ [
79791
+ {
79792
+ "keyID": "row_002001",
79793
+ "keyCode": "",
79794
+ "keyName": "栅格行",
79795
+ "componentType": "Row",
79796
+ "dataType": "None",
79797
+ "arrayDataType": "",
79798
+ "children": [
79799
+ {
79800
+ "keyID": "col_002001",
79801
+ "keyCode": "",
79802
+ "keyName": "左列",
79803
+ "componentType": "Col",
79804
+ "dataType": "None",
79805
+ "arrayDataType": "",
79806
+ "children": [
79807
+ {
79808
+ "keyID": "key_002001",
79809
+ "keyCode": "startDate",
79810
+ "keyName": "开始日期",
79811
+ "componentType": "Datepicker",
79812
+ "dataType": "String",
79813
+ "arrayDataType": "",
79814
+ "children": [],
79815
+ "config": { "formConfig": {}, "baseConfig": { "type": "date", "valueFormat": "YYYY-MM-DD", "clearable": true }, "advancedConfig": { "style": "", "vif": "", "disabled": "", "eventChange": "" }, "arrayConfig": {} }
79816
+ }
79817
+ ],
79818
+ "config": { "formConfig": {}, "baseConfig": { "span": 12 }, "advancedConfig": {}, "arrayConfig": {} }
79819
+ },
79820
+ {
79821
+ "keyID": "col_002002",
79822
+ "keyCode": "",
79823
+ "keyName": "右列",
79824
+ "componentType": "Col",
79825
+ "dataType": "None",
79826
+ "arrayDataType": "",
79827
+ "children": [
79828
+ {
79829
+ "keyID": "key_002002",
79830
+ "keyCode": "endDate",
79831
+ "keyName": "结束日期",
79832
+ "componentType": "Datepicker",
79833
+ "dataType": "String",
79834
+ "arrayDataType": "",
79835
+ "children": [],
79836
+ "config": { "formConfig": {}, "baseConfig": { "type": "date", "valueFormat": "YYYY-MM-DD", "clearable": true }, "advancedConfig": { "style": "", "vif": "", "disabled": "", "eventChange": "" }, "arrayConfig": {} }
79837
+ }
79838
+ ],
79839
+ "config": { "formConfig": {}, "baseConfig": { "span": 12 }, "advancedConfig": {}, "arrayConfig": {} }
79840
+ }
79841
+ ],
79842
+ "config": { "formConfig": {}, "baseConfig": { "gutter": 10 }, "advancedConfig": {}, "arrayConfig": {} }
79843
+ }
79844
+ ]
79845
+ \`\`\`
79846
+
79847
+ ## 案例3 - Object 嵌套对象
79848
+ \`\`\`json
79849
+ [
79850
+ {
79851
+ "keyID": "key_003001",
79852
+ "keyCode": "address",
79853
+ "keyName": "地址",
79854
+ "dataType": "Object",
79855
+ "arrayDataType": "",
79856
+ "children": [
79857
+ {
79858
+ "keyID": "key_003002",
79859
+ "keyCode": "province",
79860
+ "keyName": "省份",
79861
+ "componentType": "Input",
79862
+ "dataType": "String",
79863
+ "arrayDataType": "",
79864
+ "children": [],
79865
+ "config": { "formConfig": {}, "baseConfig": { "placeholder": "请输入省份" }, "advancedConfig": { "style": "", "vif": "", "disabled": "", "eventChange": "" }, "arrayConfig": {} }
79866
+ },
79867
+ {
79868
+ "keyID": "key_003003",
79869
+ "keyCode": "city",
79870
+ "keyName": "城市",
79871
+ "componentType": "Input",
79872
+ "dataType": "String",
79873
+ "arrayDataType": "",
79874
+ "children": [],
79875
+ "config": { "formConfig": {}, "baseConfig": { "placeholder": "请输入城市" }, "advancedConfig": { "style": "", "vif": "", "disabled": "", "eventChange": "" }, "arrayConfig": {} }
79876
+ }
79877
+ ],
79878
+ "config": { "formConfig": {}, "baseConfig": {}, "advancedConfig": {}, "arrayConfig": {} }
79879
+ }
79880
+ ]
79881
+ \`\`\`
79882
+
79883
+ ## 案例4 - 普通对象数组(无 componentType,dataType=Array + arrayDataType=Object)
79884
+
79885
+ 这种方式生成嵌套表单,每行数据是一个对象,children 定义每个对象的字段:
79886
+ \`\`\`json
79887
+ [
79888
+ {
79889
+ "keyID": "key_arr001",
79890
+ "keyCode": "members",
79891
+ "keyName": "成员列表",
79892
+ "dataType": "Array",
79893
+ "arrayDataType": "Object",
79894
+ "children": [
79895
+ {
79896
+ "keyID": "key_arr002",
79897
+ "keyCode": "name",
79898
+ "keyName": "姓名",
79899
+ "componentType": "Input",
79900
+ "dataType": "String",
79901
+ "arrayDataType": "",
79902
+ "children": [],
79903
+ "config": { "formConfig": {}, "baseConfig": { "placeholder": "请输入姓名" }, "advancedConfig": { "style": "", "vif": "", "disabled": "", "eventChange": "" }, "arrayConfig": {} }
79904
+ },
79905
+ {
79906
+ "keyID": "key_arr003",
79907
+ "keyCode": "age",
79908
+ "keyName": "年龄",
79909
+ "componentType": "InputNumber",
79910
+ "dataType": "Number",
79911
+ "arrayDataType": "",
79912
+ "children": [],
79913
+ "config": { "formConfig": {}, "baseConfig": { "min": "0", "max": "150" }, "advancedConfig": { "style": "", "vif": "", "disabled": "", "eventChange": "" }, "arrayConfig": {} }
79914
+ }
79915
+ ],
79916
+ "config": { "formConfig": {}, "baseConfig": {}, "advancedConfig": {}, "arrayConfig": {} }
79917
+ }
79918
+ ]
79919
+ \`\`\`
79920
+
79921
+ ## 案例5 - Table 可编辑表格(推荐,比对象数组更直观)
79922
+
79923
+ Table 表格适合需要用户编辑多行数据的场景,isEdit:true 开启行内编辑,canAddRow:true 允许新增行:
79924
+ \`\`\`json
79925
+ [
79926
+ {
79927
+ "keyID": "key_tbl001",
79928
+ "keyCode": "users",
79929
+ "keyName": "用户列表",
79930
+ "dataType": "Array",
79931
+ "arrayDataType": "",
79932
+ "componentType": "Table",
79933
+ "children": [],
79934
+ "slots": [
79935
+ { "name": "edit-AbC12345", "label": "姓名 编辑", "children": [] },
79936
+ { "name": "edit-DeF67890", "label": "年龄 编辑", "children": [] },
79937
+ { "name": "edit-GhI11223", "label": "部门 编辑", "children": [] }
79938
+ ],
79939
+ "config": {
79940
+ "formConfig": {},
79941
+ "baseConfig": {
79942
+ "rowKey": "",
79943
+ "url": "",
79944
+ "data": {},
79945
+ "columns": [
79946
+ { "id": "AbC12345", "label": "姓名", "prop": "name", "type": "default", "width": "", "editComponent": { "name": "els-input", "props": {} } },
79947
+ { "id": "DeF67890", "label": "年龄", "prop": "age", "type": "default", "width": "100", "editComponent": { "name": "els-input-number", "props": { "min": 0 } } },
79948
+ { "id": "GhI11223", "label": "部门", "prop": "dept", "type": "default", "width": "", "editComponent": { "name": "els-input", "props": {} } }
79949
+ ],
79950
+ "align": "center",
79951
+ "isEdit": true,
79952
+ "canAddRow": true,
79953
+ "hasPage": false,
79954
+ "maxHeight": ""
79955
+ },
79956
+ "advancedConfig": {},
79957
+ "arrayConfig": {}
79958
+ }
79959
+ }
79960
+ ]
79961
+ \`\`\`
79962
+
79963
+ ## 案例6 - 条件显示/禁用(advancedConfig.vif / disabled)
79964
+ \`\`\`json
79965
+ [
79966
+ {
79967
+ "keyID": "key_004001",
79968
+ "keyCode": "isVip",
79969
+ "keyName": "是否VIP",
79970
+ "componentType": "Switch",
79971
+ "dataType": "Bool",
79972
+ "arrayDataType": "",
79973
+ "children": [],
79974
+ "config": {
79975
+ "formConfig": {},
79976
+ "baseConfig": { "active-text": "是", "inactive-text": "否" },
79977
+ "advancedConfig": { "style": "", "vif": "", "disabled": "", "eventChange": "" },
79978
+ "arrayConfig": {}
79979
+ }
79980
+ },
79981
+ {
79982
+ "keyID": "key_004002",
79983
+ "keyCode": "vipLevel",
79984
+ "keyName": "VIP等级",
79985
+ "componentType": "Select",
79986
+ "dataType": "String",
79987
+ "arrayDataType": "",
79988
+ "children": [],
79989
+ "config": {
79990
+ "formConfig": {},
79991
+ "baseConfig": { "data": [{"label": "黄金", "value": "gold"}, {"label": "铂金", "value": "platinum"}, {"label": "钻石", "value": "diamond"}], "placeholder": "请选择VIP等级" },
79992
+ "advancedConfig": { "style": "", "vif": "currNode['isVip']?.value == true", "disabled": "", "eventChange": "" },
79993
+ "arrayConfig": {}
79994
+ }
79995
+ },
79996
+ {
79997
+ "keyID": "key_004003",
79998
+ "keyCode": "country",
79999
+ "keyName": "国家",
80000
+ "componentType": "Select",
80001
+ "dataType": "String",
80002
+ "arrayDataType": "",
80003
+ "children": [],
80004
+ "config": {
80005
+ "formConfig": {},
80006
+ "baseConfig": { "data": [{"label": "中国", "value": "CN"}, {"label": "美国", "value": "US"}], "clearable": true, "placeholder": "请选择国家" },
80007
+ "advancedConfig": { "style": "", "vif": "", "disabled": "", "eventChange": "" },
80008
+ "arrayConfig": {}
80009
+ }
80010
+ },
80011
+ {
80012
+ "keyID": "key_004004",
80013
+ "keyCode": "province",
80014
+ "keyName": "省份",
80015
+ "componentType": "Input",
80016
+ "dataType": "String",
80017
+ "arrayDataType": "",
80018
+ "children": [],
80019
+ "config": {
80020
+ "formConfig": { "re_required": "currNode['country']?.value == 'CN'", "requiredMessage": "请输入省份" },
80021
+ "baseConfig": { "placeholder": "请输入省份" },
80022
+ "advancedConfig": { "style": "", "vif": "currNode['country']?.value == 'CN'", "disabled": "", "eventChange": "" },
80023
+ "arrayConfig": {}
80024
+ }
80025
+ }
80026
+ ]
80027
+ \`\`\`
80028
+
80029
+ ## 案例5 - 必填验证与格式校验
80030
+ \`\`\`json
80031
+ [
80032
+ {
80033
+ "keyID": "key_005001",
80034
+ "keyCode": "email",
80035
+ "keyName": "邮箱",
80036
+ "componentType": "Input",
80037
+ "dataType": "String",
80038
+ "arrayDataType": "",
80039
+ "children": [],
80040
+ "config": {
80041
+ "formConfig": { "re_required": "true", "requiredMessage": "请输入邮箱", "validType": "email", "validMessage": "请输入正确的邮箱格式", "tip": "用于接收通知", "tipPosition": "right" },
80042
+ "baseConfig": { "placeholder": "请输入邮箱地址", "clearable": true },
80043
+ "advancedConfig": { "style": "", "vif": "", "disabled": "", "eventChange": "" },
80044
+ "arrayConfig": {}
80045
+ }
80046
+ },
80047
+ {
80048
+ "keyID": "key_005002",
80049
+ "keyCode": "phone",
80050
+ "keyName": "手机号",
80051
+ "componentType": "Input",
80052
+ "dataType": "String",
80053
+ "arrayDataType": "",
80054
+ "children": [],
80055
+ "config": {
80056
+ "formConfig": { "re_required": "true", "requiredMessage": "请输入手机号", "validType": "phone", "validMessage": "请输入正确的11位手机号" },
80057
+ "baseConfig": { "placeholder": "请输入手机号", "maxlength": "11" },
80058
+ "advancedConfig": { "style": "", "vif": "", "disabled": "", "eventChange": "" },
80059
+ "arrayConfig": {}
80060
+ }
80061
+ }
80062
+ ]
80063
+ \`\`\``;
80064
+ async function callAI(url, userPrompt, options2) {
80065
+ var _a, _b, _c;
80066
+ const sys = (options2 == null ? void 0 : options2.systemPrompt) || AI_SYSTEM_PROMPT;
80067
+ const body = (options2 == null ? void 0 : options2.buildRequest) ? options2.buildRequest(sys, userPrompt) : { system: sys, user: userPrompt };
80068
+ const res = await fetch(url, {
80069
+ method: "POST",
80070
+ headers: { "Content-Type": "application/json" },
80071
+ body: JSON.stringify(body)
80072
+ });
80073
+ const data = await res.json();
80074
+ const text = (options2 == null ? void 0 : options2.pickResponse) ? options2.pickResponse(data) : ((_c = (_b = (_a = data == null ? void 0 : data.choices) == null ? void 0 : _a[0]) == null ? void 0 : _b.message) == null ? void 0 : _c.content) ?? (data == null ? void 0 : data.content) ?? (data == null ? void 0 : data.data) ?? "";
80075
+ return JSON.parse(text);
80076
+ }
79501
80077
  const useDesign = defineStore("dynamic-design", () => {
79502
80078
  const queue = ref([]);
79503
80079
  const pointer = ref(-1);
@@ -79723,7 +80299,7 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
79723
80299
  const objectData = ref([
79724
80300
  {
79725
80301
  keyID: "id_" + utils.randomNumber().toString(),
79726
- keyName: "Object",
80302
+ keyName: "对象表单",
79727
80303
  keyCode: "key_" + utils.randomNumber().toString(),
79728
80304
  children: [],
79729
80305
  dataType: (_a = currDynamicDataType.value.find((cele) => cele.type == "Object")) == null ? void 0 : _a.value,
@@ -79732,7 +80308,7 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
79732
80308
  arrayDataType: "",
79733
80309
  componentGroup: "Form",
79734
80310
  componentTypeName: "",
79735
- componentTypeLabel: "Object",
80311
+ componentTypeLabel: "对象表单",
79736
80312
  componentName: "",
79737
80313
  componentType: "",
79738
80314
  formItem: true,
@@ -79751,14 +80327,14 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
79751
80327
  },
79752
80328
  {
79753
80329
  keyID: "id_" + utils.randomNumber().toString(),
79754
- keyName: "Array",
80330
+ keyName: "数组",
79755
80331
  keyCode: "key_" + utils.randomNumber().toString(),
79756
80332
  children: [],
79757
80333
  dataType: (_b = currDynamicDataType.value.find((cele) => cele.type == "Array")) == null ? void 0 : _b.value,
79758
80334
  dataTypeName: "Array",
79759
80335
  componentGroup: "Form",
79760
80336
  componentTypeName: "",
79761
- componentTypeLabel: "Array<T>",
80337
+ componentTypeLabel: "数组",
79762
80338
  componentName: "",
79763
80339
  componentType: "",
79764
80340
  arrayDataTypeName: "",
@@ -80393,8 +80969,46 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
80393
80969
  const parentSiblings = ((parentCtx == null ? void 0 : parentCtx.siblings) || []).filter(isFormField).map(toFieldItem);
80394
80970
  const parentSelf = isFormField(ctx.parent) ? [toFieldItem(ctx.parent)] : [];
80395
80971
  return [...parentSelf, ...parentSiblings];
80972
+ },
80973
+ triggerAiGenerate: (targetNode) => handleAiGenerate(targetNode),
80974
+ get aiUrl() {
80975
+ return props2.aiUrl;
80976
+ }
80977
+ });
80978
+ const aiPrompt = ref("");
80979
+ const aiGenerating = ref(false);
80980
+ const showAiDialog = ref(false);
80981
+ const aiTargetNode = ref(null);
80982
+ function handleAiGenerate(targetNode) {
80983
+ aiTargetNode.value = targetNode;
80984
+ showAiDialog.value = true;
80985
+ }
80986
+ async function confirmAiGenerate() {
80987
+ if (!aiPrompt.value.trim()) return;
80988
+ aiGenerating.value = true;
80989
+ try {
80990
+ const nodes = await callAI(props2.aiUrl, aiPrompt.value, {
80991
+ systemPrompt: props2.aiSystemPrompt,
80992
+ buildRequest: props2.aiBuildRequest,
80993
+ pickResponse: props2.aiPickResponse
80994
+ });
80995
+ const processed = dynamicHandler.compatibleVersion(nodes);
80996
+ dynamicHandler.initConfig(processed);
80997
+ dynamicHandler.initConfigType(processed);
80998
+ if (aiTargetNode.value) {
80999
+ aiTargetNode.value.children.push(...processed);
81000
+ } else {
81001
+ renderData.value.length = 0;
81002
+ renderData.value.push(...processed);
81003
+ }
81004
+ showAiDialog.value = false;
81005
+ aiPrompt.value = "";
81006
+ } catch (e) {
81007
+ ProxyElsMessage.error("AI 生成失败,请检查接口地址或重试");
81008
+ } finally {
81009
+ aiGenerating.value = false;
80396
81010
  }
80397
- });
81011
+ }
80398
81012
  function handleMenuCommand(menu) {
80399
81013
  if (menu.Action === "copy") {
80400
81014
  handleCopyNode();
@@ -80427,6 +81041,7 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
80427
81041
  const _component_el_icon = resolveComponent("el-icon");
80428
81042
  const _component_el_link = resolveComponent("el-link");
80429
81043
  const _component_Delete = resolveComponent("Delete");
81044
+ const _component_MagicStick = resolveComponent("MagicStick");
80430
81045
  const _component_ElsJsonEditor = resolveComponent("ElsJsonEditor");
80431
81046
  const _component_els_data_modal = resolveComponent("els-data-modal");
80432
81047
  const _component_View = resolveComponent("View");
@@ -80443,6 +81058,8 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
80443
81058
  const _component_ElsJsonViewer = resolveComponent("ElsJsonViewer");
80444
81059
  const _component_els_dialog = resolveComponent("els-dialog");
80445
81060
  const _component_els_menu_context = resolveComponent("els-menu-context");
81061
+ const _component_el_input = resolveComponent("el-input");
81062
+ const _component_el_dialog = resolveComponent("el-dialog");
80446
81063
  return openBlock(), createElementBlock(Fragment$1, null, [
80447
81064
  createElementVNode("div", mergeProps({
80448
81065
  ref_key: "designer",
@@ -80790,13 +81407,13 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
80790
81407
  }, {
80791
81408
  default: withCtx(() => [
80792
81409
  createVNode(_component_els_option, null, {
80793
- default: withCtx(() => [..._cache[21] || (_cache[21] = [
81410
+ default: withCtx(() => [..._cache[25] || (_cache[25] = [
80794
81411
  createTextVNode("PC", -1)
80795
81412
  ])]),
80796
81413
  _: 1
80797
81414
  }),
80798
81415
  createVNode(_component_els_option, null, {
80799
- default: withCtx(() => [..._cache[22] || (_cache[22] = [
81416
+ default: withCtx(() => [..._cache[26] || (_cache[26] = [
80800
81417
  createTextVNode("H5", -1)
80801
81418
  ])]),
80802
81419
  _: 1
@@ -80818,7 +81435,7 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
80818
81435
  ]),
80819
81436
  _: 1
80820
81437
  }),
80821
- _cache[23] || (_cache[23] = createTextVNode("返回 ", -1))
81438
+ _cache[27] || (_cache[27] = createTextVNode("返回 ", -1))
80822
81439
  ]),
80823
81440
  _: 1
80824
81441
  })) : createCommentVNode("", true),
@@ -80834,12 +81451,28 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
80834
81451
  ]),
80835
81452
  _: 1
80836
81453
  }),
80837
- _cache[24] || (_cache[24] = createTextVNode("清空 ", -1))
81454
+ _cache[28] || (_cache[28] = createTextVNode("清空 ", -1))
80838
81455
  ]),
80839
81456
  _: 1
80840
81457
  })) : createCommentVNode("", true),
80841
- !_ctx.toolbar || _ctx.toolbar.includes("import") ? (openBlock(), createBlock(_component_els_data_modal, {
81458
+ props2.aiUrl && (!_ctx.toolbar || _ctx.toolbar.includes("ai")) ? (openBlock(), createBlock(_component_el_link, {
80842
81459
  key: 2,
81460
+ type: "primary",
81461
+ onClick: _cache[3] || (_cache[3] = ($event) => handleAiGenerate(null))
81462
+ }, {
81463
+ default: withCtx(() => [
81464
+ createVNode(_component_el_icon, null, {
81465
+ default: withCtx(() => [
81466
+ createVNode(_component_MagicStick)
81467
+ ]),
81468
+ _: 1
81469
+ }),
81470
+ _cache[29] || (_cache[29] = createTextVNode("AI生成 ", -1))
81471
+ ]),
81472
+ _: 1
81473
+ })) : createCommentVNode("", true),
81474
+ !_ctx.toolbar || _ctx.toolbar.includes("import") ? (openBlock(), createBlock(_component_els_data_modal, {
81475
+ key: 3,
80843
81476
  title: "导入配置",
80844
81477
  open: handleOpenImport,
80845
81478
  componentName: "el-link",
@@ -80852,16 +81485,16 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
80852
81485
  default: withCtx(() => [
80853
81486
  createVNode(_component_ElsJsonEditor, {
80854
81487
  modelValue: importJSON.value,
80855
- "onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => importJSON.value = $event),
81488
+ "onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => importJSON.value = $event),
80856
81489
  style: { "height": "500px" }
80857
81490
  }, null, 8, ["modelValue"])
80858
81491
  ]),
80859
81492
  _: 1
80860
81493
  })) : createCommentVNode("", true),
80861
81494
  !_ctx.toolbar || _ctx.toolbar.includes("preview") ? (openBlock(), createBlock(_component_el_link, {
80862
- key: 3,
81495
+ key: 4,
80863
81496
  type: "primary",
80864
- onClick: _cache[4] || (_cache[4] = ($event) => viewPriview.value = !viewPriview.value)
81497
+ onClick: _cache[5] || (_cache[5] = ($event) => viewPriview.value = !viewPriview.value)
80865
81498
  }, {
80866
81499
  default: withCtx(() => [
80867
81500
  createVNode(_component_el_icon, null, {
@@ -80870,12 +81503,12 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
80870
81503
  ]),
80871
81504
  _: 1
80872
81505
  }),
80873
- _cache[25] || (_cache[25] = createTextVNode("预览 ", -1))
81506
+ _cache[30] || (_cache[30] = createTextVNode("预览 ", -1))
80874
81507
  ]),
80875
81508
  _: 1
80876
81509
  })) : createCommentVNode("", true),
80877
81510
  _ctx.onSave && (!_ctx.toolbar || _ctx.toolbar.includes("save")) ? (openBlock(), createBlock(_component_el_link, {
80878
- key: 4,
81511
+ key: 5,
80879
81512
  type: "primary",
80880
81513
  onClick: handleSave
80881
81514
  }, {
@@ -80886,7 +81519,7 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
80886
81519
  ]),
80887
81520
  _: 1
80888
81521
  }),
80889
- _cache[26] || (_cache[26] = createTextVNode("保存 ", -1))
81522
+ _cache[31] || (_cache[31] = createTextVNode("保存 ", -1))
80890
81523
  ]),
80891
81524
  _: 1
80892
81525
  })) : createCommentVNode("", true)
@@ -80915,15 +81548,15 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
80915
81548
  })
80916
81549
  ]),
80917
81550
  createElementVNode("div", _hoisted_15$2, [
80918
- _cache[28] || (_cache[28] = createElementVNode("div", null, "页面已有Form表单", -1)),
81551
+ _cache[33] || (_cache[33] = createElementVNode("div", null, "页面已有Form表单", -1)),
80919
81552
  createElementVNode("div", null, [
80920
81553
  createVNode(_component_el_button, {
80921
81554
  type: "info",
80922
- onClick: _cache[5] || (_cache[5] = ($event) => {
81555
+ onClick: _cache[6] || (_cache[6] = ($event) => {
80923
81556
  startCreate.value = true;
80924
81557
  })
80925
81558
  }, {
80926
- default: withCtx(() => [..._cache[27] || (_cache[27] = [
81559
+ default: withCtx(() => [..._cache[32] || (_cache[32] = [
80927
81560
  createTextVNode("直接进入", -1)
80928
81561
  ])]),
80929
81562
  _: 1
@@ -80944,13 +81577,13 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
80944
81577
  })
80945
81578
  ]),
80946
81579
  createElementVNode("div", _hoisted_17$1, [
80947
- _cache[30] || (_cache[30] = createElementVNode("div", null, " 没有Form表单创建一个 ", -1)),
81580
+ _cache[35] || (_cache[35] = createElementVNode("div", null, " 没有Form表单创建一个 ", -1)),
80948
81581
  createElementVNode("div", null, [
80949
81582
  createVNode(_component_el_button, {
80950
81583
  type: "primary",
80951
81584
  onClick: createRootForm
80952
81585
  }, {
80953
- default: withCtx(() => [..._cache[29] || (_cache[29] = [
81586
+ default: withCtx(() => [..._cache[34] || (_cache[34] = [
80954
81587
  createTextVNode("创建表单", -1)
80955
81588
  ])]),
80956
81589
  _: 1
@@ -80963,17 +81596,17 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
80963
81596
  ])
80964
81597
  ])
80965
81598
  ])) : (openBlock(), createElementBlock("div", _hoisted_18$1, [
80966
- deviceType.value == "H5" ? (openBlock(), createBlock(_sfc_main$u, {
81599
+ deviceType.value == "H5" ? (openBlock(), createBlock(DynamicDesignerViewBody, {
80967
81600
  key: 0,
80968
81601
  isMobile: true,
80969
81602
  renderData: renderData.value
80970
- }, null, 8, ["renderData"])) : (openBlock(), createBlock(_sfc_main$u, {
81603
+ }, null, 8, ["renderData"])) : (openBlock(), createBlock(DynamicDesignerViewBody, {
80971
81604
  key: 1,
80972
81605
  type: deviceType.value,
80973
81606
  renderData: renderData.value
80974
81607
  }, null, 8, ["type", "renderData"])),
80975
81608
  !renderData.value.length || renderData.value.length && renderData.value[0].componentType === "Form" && !renderData.value[0].children.length ? (openBlock(), createBlock(_component_el_empty, { key: 2 }, {
80976
- description: withCtx(() => [..._cache[31] || (_cache[31] = [
81609
+ description: withCtx(() => [..._cache[36] || (_cache[36] = [
80977
81610
  createTextVNode("请点击拖动", -1),
80978
81611
  createElementVNode("span", { class: "txt-red" }, "左侧", -1),
80979
81612
  createTextVNode("组件到此处", -1)
@@ -80989,7 +81622,7 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
80989
81622
  key: 0,
80990
81623
  stretch: "",
80991
81624
  modelValue: selectProperty.value,
80992
- "onUpdate:modelValue": _cache[11] || (_cache[11] = ($event) => selectProperty.value = $event)
81625
+ "onUpdate:modelValue": _cache[12] || (_cache[12] = ($event) => selectProperty.value = $event)
80993
81626
  }, {
80994
81627
  default: withCtx(() => [
80995
81628
  !_ctx.rightToolbar || _ctx.rightToolbar.includes("base") ? (openBlock(), createBlock(_component_el_tab_pane, {
@@ -81024,7 +81657,7 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
81024
81657
  default: withCtx(() => [
81025
81658
  createVNode(DynamicRenderAsync, {
81026
81659
  modelValue: currSelectItem.value.config.baseConfig,
81027
- "onUpdate:modelValue": _cache[6] || (_cache[6] = ($event) => currSelectItem.value.config.baseConfig = $event),
81660
+ "onUpdate:modelValue": _cache[7] || (_cache[7] = ($event) => currSelectItem.value.config.baseConfig = $event),
81028
81661
  globalData: currSelectItem.value,
81029
81662
  defaultValueConfig: { "Number": void 0, "Bool": void 0 },
81030
81663
  isMobile: false,
@@ -81051,7 +81684,7 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
81051
81684
  default: withCtx(() => [
81052
81685
  createVNode(DynamicRenderAsync, {
81053
81686
  modelValue: currSelectItem.value.config.arrayConfig,
81054
- "onUpdate:modelValue": _cache[7] || (_cache[7] = ($event) => currSelectItem.value.config.arrayConfig = $event),
81687
+ "onUpdate:modelValue": _cache[8] || (_cache[8] = ($event) => currSelectItem.value.config.arrayConfig = $event),
81055
81688
  defaultValueConfig: { "Number": void 0, "Bool": void 0 },
81056
81689
  isMobile: false,
81057
81690
  config: unref(property_array),
@@ -81076,7 +81709,7 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
81076
81709
  default: withCtx(() => [
81077
81710
  createVNode(DynamicRenderAsync, {
81078
81711
  modelValue: currSelectItem.value.config.formConfig,
81079
- "onUpdate:modelValue": _cache[8] || (_cache[8] = ($event) => currSelectItem.value.config.formConfig = $event),
81712
+ "onUpdate:modelValue": _cache[9] || (_cache[9] = ($event) => currSelectItem.value.config.formConfig = $event),
81080
81713
  defaultValueConfig: { "Number": void 0, "Bool": void 0 },
81081
81714
  isMobile: false,
81082
81715
  config: unref(property_formItem),
@@ -81102,12 +81735,12 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
81102
81735
  default: withCtx(() => [
81103
81736
  createVNode(SpacingEditor, {
81104
81737
  modelValue: currSelectItem.value.config.advancedConfig,
81105
- "onUpdate:modelValue": _cache[9] || (_cache[9] = ($event) => currSelectItem.value.config.advancedConfig = $event)
81738
+ "onUpdate:modelValue": _cache[10] || (_cache[10] = ($event) => currSelectItem.value.config.advancedConfig = $event)
81106
81739
  }, null, 8, ["modelValue"]),
81107
81740
  createVNode(_component_el_divider, { style: { "margin": "4px 0 8px" } }),
81108
81741
  createVNode(DynamicRenderAsync, {
81109
81742
  modelValue: currSelectItem.value.config.advancedConfig,
81110
- "onUpdate:modelValue": _cache[10] || (_cache[10] = (v) => Object.assign(currSelectItem.value.config.advancedConfig, v)),
81743
+ "onUpdate:modelValue": _cache[11] || (_cache[11] = (v) => Object.assign(currSelectItem.value.config.advancedConfig, v)),
81111
81744
  isMobile: false,
81112
81745
  config: unref(property_advanced),
81113
81746
  appendComponentTypes: conditionBuilderTypes,
@@ -81133,10 +81766,10 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
81133
81766
  ], 16),
81134
81767
  createVNode(_component_els_dialog, {
81135
81768
  modelValue: viewPriview.value,
81136
- "onUpdate:modelValue": _cache[18] || (_cache[18] = ($event) => viewPriview.value = $event),
81769
+ "onUpdate:modelValue": _cache[19] || (_cache[19] = ($event) => viewPriview.value = $event),
81137
81770
  class: "preview-dialog",
81138
81771
  "destroy-on-close": "",
81139
- onClose: _cache[19] || (_cache[19] = ($event) => {
81772
+ onClose: _cache[20] || (_cache[20] = ($event) => {
81140
81773
  formValue.value = {};
81141
81774
  }),
81142
81775
  width: deviceType.value == "PC" ? "1300" : "500px",
@@ -81146,11 +81779,11 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
81146
81779
  }, {
81147
81780
  header: withCtx(() => [
81148
81781
  createElementVNode("div", _hoisted_20$1, [
81149
- _cache[34] || (_cache[34] = createElementVNode("div", null, null, -1)),
81782
+ _cache[39] || (_cache[39] = createElementVNode("div", null, null, -1)),
81150
81783
  createElementVNode("div", _hoisted_21$1, [
81151
81784
  createElementVNode("div", {
81152
81785
  class: normalizeClass(["tab-item", { active: previewTab.value === "preview" }]),
81153
- onClick: _cache[12] || (_cache[12] = ($event) => previewTab.value = "preview")
81786
+ onClick: _cache[13] || (_cache[13] = ($event) => previewTab.value = "preview")
81154
81787
  }, [
81155
81788
  createVNode(_component_el_icon, null, {
81156
81789
  default: withCtx(() => [
@@ -81158,11 +81791,11 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
81158
81791
  ]),
81159
81792
  _: 1
81160
81793
  }),
81161
- _cache[32] || (_cache[32] = createTextVNode(" 效果预览 ", -1))
81794
+ _cache[37] || (_cache[37] = createTextVNode(" 效果预览 ", -1))
81162
81795
  ], 2),
81163
81796
  createElementVNode("div", {
81164
81797
  class: normalizeClass(["tab-item", { active: previewTab.value === "properties" }]),
81165
- onClick: _cache[13] || (_cache[13] = ($event) => previewTab.value = "properties")
81798
+ onClick: _cache[14] || (_cache[14] = ($event) => previewTab.value = "properties")
81166
81799
  }, [
81167
81800
  createVNode(_component_el_icon, null, {
81168
81801
  default: withCtx(() => [
@@ -81170,10 +81803,10 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
81170
81803
  ]),
81171
81804
  _: 1
81172
81805
  }),
81173
- _cache[33] || (_cache[33] = createTextVNode(" 数据模型 ", -1))
81806
+ _cache[38] || (_cache[38] = createTextVNode(" 数据模型 ", -1))
81174
81807
  ], 2)
81175
81808
  ]),
81176
- _cache[35] || (_cache[35] = createElementVNode("div", { class: "header-actions" }, null, -1))
81809
+ _cache[40] || (_cache[40] = createElementVNode("div", { class: "header-actions" }, null, -1))
81177
81810
  ])
81178
81811
  ]),
81179
81812
  default: withCtx(() => [
@@ -81184,8 +81817,8 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
81184
81817
  withDirectives(createElementVNode("div", _hoisted_23, [
81185
81818
  deviceType.value === "H5" ? (openBlock(), createElementBlock("div", _hoisted_24, [
81186
81819
  createElementVNode("div", _hoisted_25, [
81187
- _cache[36] || (_cache[36] = createElementVNode("span", { class: "time" }, "10:40", -1)),
81188
- _cache[37] || (_cache[37] = createElementVNode("div", { class: "camera" }, null, -1)),
81820
+ _cache[41] || (_cache[41] = createElementVNode("span", { class: "time" }, "10:40", -1)),
81821
+ _cache[42] || (_cache[42] = createElementVNode("div", { class: "camera" }, null, -1)),
81189
81822
  createElementVNode("div", _hoisted_26, [
81190
81823
  createVNode(_component_el_icon, null, {
81191
81824
  default: withCtx(() => [
@@ -81206,9 +81839,9 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
81206
81839
  default: withCtx(() => [
81207
81840
  createVNode(DynamicRender, {
81208
81841
  modelValue: formValue.value,
81209
- "onUpdate:modelValue": _cache[14] || (_cache[14] = ($event) => formValue.value = $event),
81842
+ "onUpdate:modelValue": _cache[15] || (_cache[15] = ($event) => formValue.value = $event),
81210
81843
  "label-value": labelValue.value,
81211
- "onUpdate:labelValue": _cache[15] || (_cache[15] = ($event) => labelValue.value = $event),
81844
+ "onUpdate:labelValue": _cache[16] || (_cache[16] = ($event) => labelValue.value = $event),
81212
81845
  defaultValueConfig: { "Number": void 0, "Bool": void 0 },
81213
81846
  config: renderData.value,
81214
81847
  isMobile: true
@@ -81217,7 +81850,7 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
81217
81850
  _: 1
81218
81851
  })
81219
81852
  ]),
81220
- _cache[38] || (_cache[38] = createElementVNode("div", { class: "mobile-home-bar" }, null, -1))
81853
+ _cache[43] || (_cache[43] = createElementVNode("div", { class: "mobile-home-bar" }, null, -1))
81221
81854
  ])) : (openBlock(), createElementBlock("div", _hoisted_28, [
81222
81855
  createElementVNode("div", _hoisted_29, [
81223
81856
  createVNode(_component_el_scrollbar, null, {
@@ -81225,9 +81858,9 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
81225
81858
  createElementVNode("div", _hoisted_30, [
81226
81859
  createVNode(DynamicRender, {
81227
81860
  modelValue: formValue.value,
81228
- "onUpdate:modelValue": _cache[16] || (_cache[16] = ($event) => formValue.value = $event),
81861
+ "onUpdate:modelValue": _cache[17] || (_cache[17] = ($event) => formValue.value = $event),
81229
81862
  "label-value": labelValue.value,
81230
- "onUpdate:labelValue": _cache[17] || (_cache[17] = ($event) => labelValue.value = $event),
81863
+ "onUpdate:labelValue": _cache[18] || (_cache[18] = ($event) => labelValue.value = $event),
81231
81864
  defaultValueConfig: { "Number": void 0, "Bool": void 0 },
81232
81865
  config: renderData.value,
81233
81866
  isMobile: false
@@ -81263,16 +81896,55 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
81263
81896
  ref: "contentMenu",
81264
81897
  data: unref(contextMenus),
81265
81898
  modelValue: unref(contextMenuVisible),
81266
- "onUpdate:modelValue": _cache[20] || (_cache[20] = ($event) => isRef(contextMenuVisible) ? contextMenuVisible.value = $event : contextMenuVisible = $event),
81899
+ "onUpdate:modelValue": _cache[21] || (_cache[21] = ($event) => isRef(contextMenuVisible) ? contextMenuVisible.value = $event : contextMenuVisible = $event),
81267
81900
  positionLeft: unref(contextMenuPositionLeft),
81268
81901
  positionTop: unref(contextMenuPositionTop),
81269
81902
  onClick: handleMenuCommand
81270
- }, null, 8, ["data", "modelValue", "positionLeft", "positionTop"])
81903
+ }, null, 8, ["data", "modelValue", "positionLeft", "positionTop"]),
81904
+ createVNode(_component_el_dialog, {
81905
+ modelValue: showAiDialog.value,
81906
+ "onUpdate:modelValue": _cache[24] || (_cache[24] = ($event) => showAiDialog.value = $event),
81907
+ title: "AI 生成表单",
81908
+ width: "500px",
81909
+ "close-on-click-modal": false,
81910
+ "append-to-body": ""
81911
+ }, {
81912
+ footer: withCtx(() => [
81913
+ createVNode(_component_el_button, {
81914
+ onClick: _cache[23] || (_cache[23] = ($event) => showAiDialog.value = false)
81915
+ }, {
81916
+ default: withCtx(() => [..._cache[44] || (_cache[44] = [
81917
+ createTextVNode("取消", -1)
81918
+ ])]),
81919
+ _: 1
81920
+ }),
81921
+ createVNode(_component_el_button, {
81922
+ type: "primary",
81923
+ loading: aiGenerating.value,
81924
+ onClick: confirmAiGenerate
81925
+ }, {
81926
+ default: withCtx(() => [..._cache[45] || (_cache[45] = [
81927
+ createTextVNode("生成", -1)
81928
+ ])]),
81929
+ _: 1
81930
+ }, 8, ["loading"])
81931
+ ]),
81932
+ default: withCtx(() => [
81933
+ createVNode(_component_el_input, {
81934
+ modelValue: aiPrompt.value,
81935
+ "onUpdate:modelValue": _cache[22] || (_cache[22] = ($event) => aiPrompt.value = $event),
81936
+ type: "textarea",
81937
+ rows: 5,
81938
+ placeholder: "描述要生成的表单,例如:用户注册表单,包含姓名、手机号、邮箱、密码字段,其中手机号和邮箱必填"
81939
+ }, null, 8, ["modelValue"])
81940
+ ]),
81941
+ _: 1
81942
+ }, 8, ["modelValue"])
81271
81943
  ], 64);
81272
81944
  };
81273
81945
  }
81274
81946
  });
81275
- const DesignerView = /* @__PURE__ */ _export_sfc$1(_sfc_main$t, [["__scopeId", "data-v-5db89a7f"]]);
81947
+ const DesignerView = /* @__PURE__ */ _export_sfc$1(_sfc_main$t, [["__scopeId", "data-v-4d6c4873"]]);
81276
81948
  const ElsDesignerView = withInstall$1(DesignerView);
81277
81949
  (function(Prism2) {
81278
81950
  var string = /(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;
@@ -82011,31 +82683,31 @@ let AceEditor$1 = class AceEditor extends TBaseFormItem {
82011
82683
  __publicField(this, "editor", ref());
82012
82684
  onMounted(() => {
82013
82685
  if (props2.language === "json") {
82014
- const currModule = import("./mode-json-CIyvEhnr.js").then((n) => n.m);
82686
+ const currModule = import("./mode-json-B_6Rc56R.js").then((n) => n.m);
82015
82687
  currModule.then((res) => {
82016
82688
  ace.config.setModuleUrl("ace/mode/json", res);
82017
82689
  this.init();
82018
82690
  });
82019
82691
  } else if (props2.language === "javascript") {
82020
- const currModule = import("./mode-javascript-DE9c49cw.js").then((n) => n.m);
82692
+ const currModule = import("./mode-javascript-B4nfmHwI.js").then((n) => n.m);
82021
82693
  currModule.then((res) => {
82022
82694
  ace.config.setModuleUrl("ace/mode/javascript", res);
82023
82695
  this.init();
82024
82696
  });
82025
82697
  } else if (props2.language === "csharp") {
82026
- const currModule = import("./mode-csharp-CWbGgzjG.js").then((n) => n.m);
82698
+ const currModule = import("./mode-csharp-DpcfdC7v.js").then((n) => n.m);
82027
82699
  currModule.then((res) => {
82028
82700
  ace.config.setModuleUrl("ace/mode/csharp", res);
82029
82701
  this.init();
82030
82702
  });
82031
82703
  } else if (props2.language === "mysql") {
82032
- const currModule = import("./mode-mysql-BwT2SuQq.js").then((n) => n.m);
82704
+ const currModule = import("./mode-mysql-D25NsOyA.js").then((n) => n.m);
82033
82705
  currModule.then((res) => {
82034
82706
  ace.config.setModuleUrl("ace/mode/mysql", res);
82035
82707
  this.init();
82036
82708
  });
82037
82709
  } else if (props2.language === "css") {
82038
- const currModule = import("./mode-css-CorxJdP-.js").then((n) => n.m);
82710
+ const currModule = import("./mode-css-Bw3HxevP.js").then((n) => n.m);
82039
82711
  currModule.then((res) => {
82040
82712
  ace.config.setModuleUrl("ace/mode/css", res);
82041
82713
  this.init();