@kp-ui/lowcode 1.0.99 → 1.0.101

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.
@@ -1,5 +1,5 @@
1
- import { defineComponent as Je, defineAsyncComponent as Te, getCurrentInstance as We, inject as Le, ref as u, computed as w, onMounted as xe, resolveComponent as F, createElementBlock as I, openBlock as y, createElementVNode as D, createVNode as n, withCtx as i, normalizeStyle as M, unref as r, createTextVNode as c, toDisplayString as p, createBlock as _, createCommentVNode as J, Fragment as Be, renderList as Ne, renderSlot as He, normalizeClass as Se, nextTick as U } from "vue";
2
- import { addWindowResizeHandler as Ee, copyToClipboard as Pe, getQueryParam as Re } from "../../../utils/util.js";
1
+ import { defineComponent as Je, defineAsyncComponent as Te, getCurrentInstance as We, inject as Le, ref as u, computed as F, onMounted as xe, resolveComponent as D, createElementBlock as I, openBlock as y, createElementVNode as C, createVNode as n, withCtx as i, normalizeStyle as M, unref as r, createTextVNode as c, toDisplayString as p, createBlock as _, createCommentVNode as J, Fragment as Be, renderList as Ne, renderSlot as He, normalizeClass as Se, nextTick as U } from "vue";
2
+ import { addWindowResizeHandler as Ee, copyToClipboard as Re, getQueryParam as Pe } from "../../../utils/util.js";
3
3
  import { useI18n as je } from "../../../utils/i18n.js";
4
4
  import { saveAs as Ve } from "file-saver";
5
5
  import h from "../../svg-icon/index.vue.js";
@@ -22,14 +22,14 @@ const Ie = { class: "toolbar-container" }, Me = { class: "left-toolbar" }, Ue =
22
22
  setup(Q) {
23
23
  const q = Te(() => import("../../form-render/index.vue.js"));
24
24
  We();
25
- const a = Q, G = Le("getDesignerConfig"), j = u(null), f = u(null), V = u(null);
25
+ const a = Q, G = Le("getDesignerConfig"), j = u(null), g = u(null), V = u(null);
26
26
  u(null);
27
- const X = u({ type: "add", ...z() }), L = u(G()), $ = u(460), x = u(!1), O = u(!1), C = u(!1), H = u(!1), S = u([]), B = u(""), N = u(""), Y = u(""), Z = u(""), ee = u({
27
+ const X = u({ type: "add", ...z() }), L = u(G()), $ = u(460), x = u(!1), O = u(!1), k = u(!1), H = u(!1), S = u([]), B = u(""), N = u(""), Y = u(""), Z = u(""), ee = u({
28
28
  select62173: 2
29
- }), A = w(() => ({
29
+ }), A = F(() => ({
30
30
  widgetList: T(a.designer.widgetList),
31
31
  formConfig: T(a.designer.formConfig)
32
- })), te = w(() => !a.designer.undoEnabled()), oe = w(() => !a.designer.redoEnabled()), v = w(() => a.designer.getLayoutType()), ne = w(() => a.globalDsv);
32
+ })), te = F(() => !a.designer.undoEnabled()), oe = F(() => !a.designer.redoEnabled()), v = F(() => a.designer.getLayoutType()), ne = F(() => a.globalDsv);
33
33
  xe(() => {
34
34
  const e = L.value.toolbarMaxWidth || 460, t = L.value.toolbarMinWidth || 300, o = window.innerWidth - 260 - 300 - 320 - 80;
35
35
  $.value = o >= e ? e : o <= t ? t : o, Ee(() => {
@@ -41,7 +41,7 @@ const Ie = { class: "toolbar-container" }, Me = { class: "left-toolbar" }, Ue =
41
41
  });
42
42
  const { i18nt: s } = je(), re = () => {
43
43
  a.saveJsonApi && a.saveJsonApi(A.value);
44
- }, k = (e) => L.value[e] === void 0 ? !0 : !!L.value[e], b = (e, t) => {
44
+ }, w = (e) => L.value[e] === void 0 ? !0 : !!L.value[e], b = (e, t) => {
45
45
  const o = {
46
46
  id: e.id,
47
47
  label: e.options.label || e.type,
@@ -53,8 +53,8 @@ const Ie = { class: "toolbar-container" }, Me = { class: "left-toolbar" }, Ue =
53
53
  label: l.options.name || e.type,
54
54
  children: []
55
55
  };
56
- o.children.push(m), l.widgetList.map((g) => {
57
- b(g, m.children);
56
+ o.children.push(m), l.widgetList.map((f) => {
57
+ b(f, m.children);
58
58
  });
59
59
  }) : e.type === "table" ? e.rows.map((l) => {
60
60
  const m = {
@@ -63,16 +63,16 @@ const Ie = { class: "toolbar-container" }, Me = { class: "left-toolbar" }, Ue =
63
63
  selectable: !1,
64
64
  children: []
65
65
  };
66
- o.children.push(m), l.cols.map((g) => {
67
- if (g.merged)
66
+ o.children.push(m), l.cols.map((f) => {
67
+ if (f.merged)
68
68
  return;
69
- const P = m.children, d = {
70
- id: g.id,
69
+ const R = m.children, d = {
70
+ id: f.id,
71
71
  label: "table-cell",
72
72
  children: []
73
73
  };
74
- P.push(d), g.widgetList.map((R) => {
75
- b(R, d.children);
74
+ R.push(d), f.widgetList.map((P) => {
75
+ b(P, d.children);
76
76
  });
77
77
  });
78
78
  }) : e.type === "tab" ? e.tabs.map((l) => {
@@ -82,8 +82,8 @@ const Ie = { class: "toolbar-container" }, Me = { class: "left-toolbar" }, Ue =
82
82
  selectable: !1,
83
83
  children: []
84
84
  };
85
- o.children.push(m), l.widgetList.map((g) => {
86
- b(g, m.children);
85
+ o.children.push(m), l.widgetList.map((f) => {
86
+ b(f, m.children);
87
87
  });
88
88
  }) : e.type === "sub-form" ? e.widgetList.map((l) => {
89
89
  b(l, o.children);
@@ -110,7 +110,7 @@ const Ie = { class: "toolbar-container" }, Me = { class: "left-toolbar" }, Ue =
110
110
  x.value = !0;
111
111
  }, ce = (e, t) => {
112
112
  const o = "json.json";
113
- if (Re("vscode") == 1) {
113
+ if (Pe("vscode") == 1) {
114
114
  pe(o, e);
115
115
  return;
116
116
  }
@@ -127,7 +127,7 @@ const Ie = { class: "toolbar-container" }, Me = { class: "left-toolbar" }, Ue =
127
127
  window.parent.postMessage(o, "*");
128
128
  }, me = () => {
129
129
  B.value = JSON.stringify(a.designer.getImportTemplate(), null, " "), V.value.open(), O.value = !0;
130
- }, fe = () => {
130
+ }, ge = () => {
131
131
  try {
132
132
  const e = JSON.parse(B.value);
133
133
  if (!e || !e.formConfig)
@@ -136,22 +136,22 @@ const Ie = { class: "toolbar-container" }, Me = { class: "left-toolbar" }, Ue =
136
136
  } catch (e) {
137
137
  W.error(e + "");
138
138
  }
139
- }, ge = () => {
139
+ }, fe = () => {
140
140
  const e = T(a.designer.widgetList), t = T(a.designer.formConfig);
141
- N.value = JSON.stringify({ widgetList: e, formConfig: t }, null, " "), C.value = !0;
141
+ N.value = JSON.stringify({ widgetList: e, formConfig: t }, null, " "), k.value = !0;
142
142
  }, ve = async () => {
143
143
  const e = a.designer.formConfig, { id: t } = z(), o = await $e(e.serveList.vformDetail, { _id: t }), l = [{ date: "2024-10-28" }, { date: "2024-10-29" }, { date: "2024-10-20" }];
144
- f.value.getWidgetRef("leaveDates").setValue(l), f.value.setFormData({
144
+ g.value.getWidgetRef("leaveDates").setValue(l), g.value.setFormData({
145
145
  ...o
146
- }), f.value.setReadMode(!0);
146
+ }), g.value.setReadMode(!0);
147
147
  }, ye = () => {
148
- console.log(f.value), f.value.getFormData().then((e) => {
149
- Y.value = JSON.stringify(e, null, " "), C.value = !0;
148
+ console.log(g.value), g.value.getFormData().then((e) => {
149
+ Y.value = JSON.stringify(e, null, " "), k.value = !0;
150
150
  }).catch((e) => {
151
151
  W.error(e);
152
152
  });
153
153
  }, he = (e) => {
154
- Pe(
154
+ Re(
155
155
  N.value,
156
156
  e,
157
157
  W,
@@ -161,11 +161,11 @@ const Ie = { class: "toolbar-container" }, Me = { class: "left-toolbar" }, Ue =
161
161
  }, be = () => {
162
162
  ce(Z.value);
163
163
  }, Ce = () => {
164
- f.value.resetForm();
164
+ g.value.resetForm();
165
165
  }, ke = () => {
166
- f.value.disableForm();
166
+ g.value.disableForm();
167
167
  }, we = () => {
168
- f.value.enableForm();
168
+ g.value.enableForm();
169
169
  }, Fe = (e, t, o, l) => {
170
170
  console.log("formModel", l);
171
171
  }, De = (e) => {
@@ -174,9 +174,9 @@ const Ie = { class: "toolbar-container" }, Me = { class: "left-toolbar" }, Ue =
174
174
  console.log("test", e);
175
175
  };
176
176
  return (e, t) => {
177
- const o = F("a-button"), l = F("a-radio-button"), m = F("a-radio-group"), g = F("a-tree"), P = F("a-drawer");
177
+ const o = D("a-button"), l = D("a-radio-button"), m = D("a-radio-group"), f = D("a-tree"), R = D("a-drawer");
178
178
  return y(), I("div", Ie, [
179
- D("div", Me, [
179
+ C("div", Me, [
180
180
  n(o, {
181
181
  type: "link",
182
182
  onClick: t[0] || (t[0] = (d) => e.changeLeftWidth())
@@ -260,7 +260,7 @@ const Ie = { class: "toolbar-container" }, Me = { class: "left-toolbar" }, Ue =
260
260
  _: 1
261
261
  }, 8, ["title"])
262
262
  ]),
263
- n(P, {
263
+ n(R, {
264
264
  title: r(s)("designer.toolbar.nodeTreeTitle"),
265
265
  direction: "ltr",
266
266
  open: H.value,
@@ -270,7 +270,7 @@ const Ie = { class: "toolbar-container" }, Me = { class: "left-toolbar" }, Ue =
270
270
  class: "node-tree-drawer"
271
271
  }, {
272
272
  default: i(() => [
273
- n(g, {
273
+ n(f, {
274
274
  ref_key: "nodeTree",
275
275
  ref: j,
276
276
  treeData: S.value,
@@ -283,9 +283,9 @@ const Ie = { class: "toolbar-container" }, Me = { class: "left-toolbar" }, Ue =
283
283
  ]),
284
284
  _: 1
285
285
  }, 8, ["title", "open"]),
286
- D("div", Ue, [
287
- D("div", ze, [
288
- k("clearDesignerButton") ? (y(), _(o, {
286
+ C("div", Ue, [
287
+ C("div", ze, [
288
+ w("clearDesignerButton") ? (y(), _(o, {
289
289
  key: 0,
290
290
  type: "link",
291
291
  onClick: de
@@ -296,7 +296,7 @@ const Ie = { class: "toolbar-container" }, Me = { class: "left-toolbar" }, Ue =
296
296
  ]),
297
297
  _: 1
298
298
  })) : J("", !0),
299
- k("previewFormButton") ? (y(), _(o, {
299
+ w("previewFormButton") ? (y(), _(o, {
300
300
  key: 1,
301
301
  type: "link",
302
302
  onClick: ue
@@ -307,7 +307,7 @@ const Ie = { class: "toolbar-container" }, Me = { class: "left-toolbar" }, Ue =
307
307
  ]),
308
308
  _: 1
309
309
  })) : J("", !0),
310
- k("importJsonButton") ? (y(), _(o, {
310
+ w("importJsonButton") ? (y(), _(o, {
311
311
  key: 2,
312
312
  type: "link",
313
313
  onClick: me
@@ -317,17 +317,17 @@ const Ie = { class: "toolbar-container" }, Me = { class: "left-toolbar" }, Ue =
317
317
  ]),
318
318
  _: 1
319
319
  })) : J("", !0),
320
- k("exportJsonButton") ? (y(), _(o, {
320
+ w("exportJsonButton") ? (y(), _(o, {
321
321
  key: 3,
322
322
  type: "link",
323
- onClick: ge
323
+ onClick: fe
324
324
  }, {
325
325
  default: i(() => [
326
326
  c(p(r(s)("designer.toolbar.exportJson")), 1)
327
327
  ]),
328
328
  _: 1
329
329
  })) : J("", !0),
330
- k("exportCodeButton") ? (y(), _(o, {
330
+ w("exportCodeButton") ? (y(), _(o, {
331
331
  key: 4,
332
332
  type: "link",
333
333
  onClick: re
@@ -350,7 +350,7 @@ const Ie = { class: "toolbar-container" }, Me = { class: "left-toolbar" }, Ue =
350
350
  ]),
351
351
  _: 1
352
352
  }),
353
- (y(!0), I(Be, null, Ne(e.$slots, (d, R) => He(e.$slots, R, {}, void 0, !0)), 256))
353
+ (y(!0), I(Be, null, Ne(e.$slots, (d, P) => He(e.$slots, P, {}, void 0, !0)), 256))
354
354
  ])
355
355
  ]),
356
356
  n(r(K), {
@@ -366,6 +366,10 @@ const Ie = { class: "toolbar-container" }, Me = { class: "left-toolbar" }, Ue =
366
366
  fullscreen: !0
367
367
  }, {
368
368
  footerRight: i(() => [
369
+ t[14] || (t[14] = C("span", {
370
+ id: "footerRight",
371
+ style: { "margin-right": "8px" }
372
+ }, null, -1)),
369
373
  n(o, { onClick: ve }, {
370
374
  default: i(() => t[13] || (t[13] = [
371
375
  c("数据回显")
@@ -419,8 +423,8 @@ const Ie = { class: "toolbar-container" }, Me = { class: "left-toolbar" }, Ue =
419
423
  })
420
424
  ]),
421
425
  default: i(() => [
422
- D("div", null, [
423
- D("div", {
426
+ C("div", null, [
427
+ C("div", {
424
428
  class: Se(["form-render-wrapper", [
425
429
  v.value === "H5" ? "h5-layout" : v.value === "Pad" ? "pad-layout" : ""
426
430
  ]])
@@ -428,7 +432,7 @@ const Ie = { class: "toolbar-container" }, Me = { class: "left-toolbar" }, Ue =
428
432
  n(r(q), {
429
433
  vfCtx: X.value,
430
434
  ref_key: "preForm",
431
- ref: f,
435
+ ref: g,
432
436
  "form-json": r(T)(A.value),
433
437
  "form-data": ee.value,
434
438
  "preview-state": !0,
@@ -453,12 +457,12 @@ const Ie = { class: "toolbar-container" }, Me = { class: "left-toolbar" }, Ue =
453
457
  width: 1200,
454
458
  height: "70vh",
455
459
  title: r(s)("designer.toolbar.importJson"),
456
- onSetCode: fe
460
+ onSetCode: ge
457
461
  }, null, 8, ["event-header", "modelValue", "title"]),
458
462
  n(r(K), {
459
463
  title: r(s)("designer.hint.exportFormData"),
460
- visible: C.value,
461
- "onUpdate:visible": t[11] || (t[11] = (d) => C.value = d),
464
+ visible: k.value,
465
+ "onUpdate:visible": t[11] || (t[11] = (d) => k.value = d),
462
466
  width: "1200px"
463
467
  }, {
464
468
  footerRight: i(() => [
@@ -480,7 +484,7 @@ const Ie = { class: "toolbar-container" }, Me = { class: "left-toolbar" }, Ue =
480
484
  _: 1
481
485
  }),
482
486
  n(o, {
483
- onClick: t[10] || (t[10] = (d) => C.value = !1)
487
+ onClick: t[10] || (t[10] = (d) => k.value = !1)
484
488
  }, {
485
489
  default: i(() => [
486
490
  c(p(r(s)("designer.hint.closePreview")), 1)
@@ -1 +1 @@
1
- {"version":3,"file":"index.vue2.js","sources":["../../../../../src/components/form-designer/toolbar-panel/index.vue"],"sourcesContent":["<template>\n <div class=\"toolbar-container\">\n <div class=\"left-toolbar\">\n <a-button type=\"link\" @click=\"changeLeftWidth()\">\n <svg-icon\n :style=\"`transform:${leftWidth === 0 ? 'rotate(180deg)' : 'rotate(0deg)'}`\"\n icon-class=\"a-ipadarrow_back\"\n />\n </a-button>\n <a-button\n type=\"link\"\n :disabled=\"undoDisabled\"\n :title=\"i18nt('designer.toolbar.undoHint')\"\n @click=\"undoHistory\"\n >\n <svg-icon icon-class=\"undo\"\n /></a-button>\n <a-button\n type=\"link\"\n :disabled=\"redoDisabled\"\n :title=\"i18nt('designer.toolbar.redoHint')\"\n @click=\"redoHistory\"\n >\n <svg-icon icon-class=\"redo\"\n /></a-button>\n <a-radio-group v-model:value=\"layoutType\">\n <a-radio-button\n value=\"PC\"\n :type=\"layoutType === 'PC' ? 'primary' : ''\"\n @click=\"changeLayoutType('PC')\"\n >\n {{ i18nt('designer.toolbar.pcLayout') }}</a-radio-button\n >\n <a-radio-button\n value=\"Pad\"\n :type=\"layoutType === 'Pad' ? 'primary' : ''\"\n @click=\"changeLayoutType('Pad')\"\n >\n {{ i18nt('designer.toolbar.padLayout') }}</a-radio-button\n >\n <a-radio-button\n :type=\"layoutType === 'H5' ? 'primary' : ''\"\n @click=\"changeLayoutType('H5')\"\n value=\"H5\"\n >\n {{ i18nt('designer.toolbar.mobileLayout') }}</a-radio-button\n >\n </a-radio-group>\n <a-button\n style=\"margin-left: 20px\"\n :title=\"i18nt('designer.toolbar.nodeTreeHint')\"\n @click=\"showNodeTreeDrawer\"\n >\n <svg-icon icon-class=\"node-tree\"\n /></a-button>\n </div>\n\n <a-drawer\n :title=\"i18nt('designer.toolbar.nodeTreeTitle')\"\n direction=\"ltr\"\n v-model:open=\"showNodeTreeDrawerFlag\"\n :width=\"280\"\n :destroy-on-close=\"true\"\n class=\"node-tree-drawer\"\n >\n <a-tree\n ref=\"nodeTree\"\n :treeData=\"nodeTreeData\"\n default-expand-all\n highlight-current\n class=\"node-tree\"\n icon-class=\"el-icon-arrow-right\"\n :fieldNames=\"{ children: 'children', title: 'label', key: 'id' }\"\n />\n </a-drawer>\n\n <div class=\"right-toolbar\">\n <div class=\"right-toolbar-con\">\n <a-button\n v-if=\"showToolButton('clearDesignerButton')\"\n type=\"link\"\n @click=\"clearFormWidget\"\n >\n <svg-icon icon-class=\"el-delete\" />{{ i18nt('designer.toolbar.clear') }}\n </a-button>\n <a-button\n v-if=\"showToolButton('previewFormButton')\"\n type=\"link\"\n @click=\"previewForm\"\n >\n <svg-icon icon-class=\"el-view\" />{{ i18nt('designer.toolbar.preview') }}\n </a-button>\n <a-button v-if=\"showToolButton('importJsonButton')\" type=\"link\" @click=\"importJson\">\n {{ i18nt('designer.toolbar.importJson') }}\n </a-button>\n <a-button v-if=\"showToolButton('exportJsonButton')\" type=\"link\" @click=\"exportJson\">\n {{ i18nt('designer.toolbar.exportJson') }}\n </a-button>\n <a-button v-if=\"showToolButton('exportCodeButton')\" type=\"link\" @click=\"saveJson\">\n 保存\n </a-button>\n <a-button type=\"link\" @click=\"changeRightWidth()\">\n <svg-icon\n :style=\"`transform:${rightWidth === 0 ? 'rotate(0deg)' : 'rotate(180deg)'}`\"\n icon-class=\"a-ipadarrow_back\"\n />\n </a-button>\n <template v-for=\"(idx, slotName) in $slots\">\n <slot :name=\"slotName\"></slot>\n </template>\n </div>\n </div>\n\n <TpfModal\n :title=\"i18nt('designer.toolbar.preview')\"\n v-model:visible=\"showPreviewDialogFlag\"\n :show-close=\"true\"\n :close-on-click-modal=\"false\"\n :close-on-press-escape=\"false\"\n center\n class=\"drag-dialog\"\n width=\"75%\"\n :fullscreen=\"true\"\n >\n <div>\n <div\n class=\"form-render-wrapper\"\n :class=\"[\n layoutType === 'H5' ? 'h5-layout' : layoutType === 'Pad' ? 'pad-layout' : ''\n ]\"\n >\n <VFormRender\n :vfCtx=\"vfCtx\"\n ref=\"preForm\"\n :form-json=\"cloneDeep(formJson)\"\n :form-data=\"testFormData\"\n :preview-state=\"true\"\n :global-dsv=\"designerDsv\"\n @appendButtonClick=\"testOnAppendButtonClick\"\n @buttonClick=\"testOnButtonClick\"\n @formChange=\"handleFormChange\"\n />\n </div>\n </div>\n <template #footerRight>\n <!-- <a-button @click=\"insertData\">新增一个数据</a-button> -->\n <a-button @click=\"showData\">数据回显</a-button>\n <a-button type=\"primary\" @click=\"getFormData\">\n {{ i18nt('designer.hint.getFormData') }}\n </a-button>\n <a-button type=\"primary\" @click=\"resetForm\">\n {{ i18nt('designer.hint.resetForm') }}\n </a-button>\n <a-button type=\"primary\" @click=\"setFormDisabled\">\n {{ i18nt('designer.hint.disableForm') }}\n </a-button>\n <a-button type=\"primary\" @click=\"setFormEnabled\">\n {{ i18nt('designer.hint.enableForm') }}\n </a-button>\n <a-button @click=\"showPreviewDialogFlag = false\">\n {{ i18nt('designer.hint.closePreview') }}\n </a-button>\n </template>\n </TpfModal>\n\n <TpfCodeEditor\n ref=\"importJsonEditorRef\"\n :isShowEventFooter=\"false\"\n :event-header=\"i18nt('designer.hint.importJsonHint')\"\n v-model=\"importTemplate\"\n mode=\"json\"\n :width=\"1200\"\n height=\"70vh\"\n :title=\"i18nt('designer.toolbar.importJson')\"\n @set-code=\"doJsonImport\"\n />\n\n <TpfModal\n :title=\"i18nt('designer.hint.exportFormData')\"\n v-model:visible=\"showFormDataDialogFlag\"\n width=\"1200px\"\n >\n <CodeEditor :mode=\"'json'\" :readonly=\"true\" :value=\"exportTemplate\" />\n <template #footerRight>\n <a-button\n type=\"primary\"\n class=\"copy-form-data-json-btn\"\n :data-clipboard-text=\"exportTemplate\"\n @click=\"copyFormDataJson\"\n >\n {{ i18nt('designer.hint.copyFormData') }}\n </a-button>\n <a-button @click=\"saveFormData\">{{ i18nt('designer.hint.saveFormData') }}</a-button>\n <a-button @click=\"showFormDataDialogFlag = false\">\n {{ i18nt('designer.hint.closePreview') }}\n </a-button>\n </template>\n </TpfModal>\n </div>\n</template>\n\n<script lang=\"ts\" setup>\n import { ref, computed, nextTick, onMounted, defineAsyncComponent, inject } from 'vue';\n import {\n copyToClipboard,\n generateId,\n getQueryParam,\n traverseAllWidgets,\n addWindowResizeHandler\n } from '@/utils/util';\n import { useI18n } from '@/utils/i18n';\n import { saveAs } from 'file-saver';\n import SvgIcon from '@/components/svg-icon/index.vue';\n import { fmtHttpParams } from '@/utils/request/fmtHttpParams';\n import { getLocat } from '@kp-ui/tool';\n import { cloneDeep } from 'lodash-es';\n import { CodeEditor, TpfModal, TpfCodeEditor } from 'tmgc2-share';\n import { message } from 'ant-design-vue';\n import { getCurrentInstance } from 'vue';\n\n // 组件定义\n const VFormRender = defineAsyncComponent(() => import('@/components/form-render/index.vue'));\n\n const ctx = getCurrentInstance();\n // Props 定义\n interface Props {\n leftWidth: number;\n rightWidth: number;\n changeRightWidth: () => void;\n changeLeftWidth: () => void;\n designer: any; // 可以根据实际类型定义更具体的类型\n saveJsonApi?: (formJson: any) => void;\n globalDsv?: Record<string, any>;\n }\n\n const props = withDefaults(defineProps<Props>(), {\n globalDsv: () => ({})\n });\n\n // Inject\n const getDesignerConfig = inject('getDesignerConfig') as () => any;\n\n // Refs\n const nodeTree = ref<any>(null);\n const preForm = ref<any>(null);\n const importJsonEditorRef = ref<any>(null);\n const exportJsonEditorRef = ref<any>(null);\n\n // 响应式数据\n const vfCtx = ref({ type: 'add', ...getLocat() });\n const designerConfig = ref(getDesignerConfig());\n const toolbarWidth = ref(460);\n const showPreviewDialogFlag = ref(false);\n const showImportJsonDialogFlag = ref(false);\n const showFormDataDialogFlag = ref(false);\n const showNodeTreeDrawerFlag = ref(false);\n const nodeTreeData = ref<any[]>([]);\n const importTemplate = ref('');\n const exportTemplate = ref('');\n const formDataJson = ref('');\n const htmlCode = ref('');\n\n const testFormData = ref({\n select62173: 2\n });\n\n // 计算属性\n const formJson = computed(() => {\n return {\n widgetList: cloneDeep(props.designer.widgetList),\n formConfig: cloneDeep(props.designer.formConfig)\n };\n });\n\n const undoDisabled = computed(() => {\n return !props.designer.undoEnabled();\n });\n\n const redoDisabled = computed(() => {\n return !props.designer.redoEnabled();\n });\n\n const layoutType = computed(() => {\n return props.designer.getLayoutType();\n });\n\n const designerDsv = computed(() => {\n return props.globalDsv;\n });\n\n // 生命周期钩子\n onMounted(() => {\n const maxTBWidth = designerConfig.value.toolbarMaxWidth || 460;\n const minTBWidth = designerConfig.value.toolbarMinWidth || 300;\n const newTBWidth = window.innerWidth - 260 - 300 - 320 - 80;\n toolbarWidth.value =\n newTBWidth >= maxTBWidth\n ? maxTBWidth\n : newTBWidth <= minTBWidth\n ? minTBWidth\n : newTBWidth;\n addWindowResizeHandler(() => {\n nextTick(() => {\n const newTBWidth2 = window.innerWidth - 260 - 300 - 320 - 80;\n toolbarWidth.value =\n newTBWidth2 >= maxTBWidth\n ? maxTBWidth\n : newTBWidth2 <= minTBWidth\n ? minTBWidth\n : newTBWidth2;\n });\n });\n });\n\n // 方法\n const { i18nt } = useI18n();\n\n const saveJson = () => {\n if (props.saveJsonApi) {\n props.saveJsonApi(formJson.value);\n }\n };\n\n const showToolButton = (configName: string): boolean => {\n if (designerConfig.value[configName] === undefined) {\n return true;\n }\n\n return !!designerConfig.value[configName];\n };\n\n const buildTreeNodeOfWidget = (widget: any, treeNode: any[]) => {\n const curNode = {\n id: widget.id,\n label: widget.options.label || widget.type,\n children: [] as any[]\n };\n treeNode.push(curNode);\n\n if (widget.category === undefined) {\n return;\n }\n\n if (widget.type === 'grid') {\n widget.cols.map((col: any) => {\n const colNode = {\n id: col.id,\n label: col.options.name || widget.type,\n children: [] as any[]\n };\n curNode.children.push(colNode);\n col.widgetList.map((wChild: any) => {\n buildTreeNodeOfWidget(wChild, colNode.children);\n });\n });\n } else if (widget.type === 'table') {\n //TODO: 需要考虑合并单元格!!\n widget.rows.map((row: any) => {\n const rowNode = {\n id: row.id,\n label: 'table-row',\n selectable: false,\n children: [] as any[]\n };\n curNode.children.push(rowNode);\n\n row.cols.map((cell: any) => {\n if (!!cell.merged) {\n //跳过合并单元格!!\n return;\n }\n\n const rowChildren = rowNode.children;\n const cellNode = {\n id: cell.id,\n label: 'table-cell',\n children: [] as any[]\n };\n rowChildren.push(cellNode);\n\n cell.widgetList.map((wChild: any) => {\n buildTreeNodeOfWidget(wChild, cellNode.children);\n });\n });\n });\n } else if (widget.type === 'tab') {\n widget.tabs.map((tab: any) => {\n const tabNode = {\n id: tab.id,\n label: tab.options.name || widget.type,\n selectable: false,\n children: [] as any[]\n };\n curNode.children.push(tabNode);\n tab.widgetList.map((wChild: any) => {\n buildTreeNodeOfWidget(wChild, tabNode.children);\n });\n });\n } else if (widget.type === 'sub-form') {\n widget.widgetList.map((wChild: any) => {\n buildTreeNodeOfWidget(wChild, curNode.children);\n });\n } else if (widget.category === 'container') {\n //自定义容器\n widget.widgetList.map((wChild: any) => {\n buildTreeNodeOfWidget(wChild, curNode.children);\n });\n }\n };\n\n const refreshNodeTree = () => {\n nodeTreeData.value.length = 0;\n props.designer.widgetList.forEach((wItem: any) => {\n buildTreeNodeOfWidget(wItem, nodeTreeData.value);\n });\n };\n\n const showNodeTreeDrawer = () => {\n refreshNodeTree();\n showNodeTreeDrawerFlag.value = true;\n nextTick(() => {\n if (!!props.designer.selectedId) {\n //同步当前选中组件到节点树!!!\n nodeTree.value.setCurrentKey(props.designer.selectedId);\n }\n });\n };\n\n const saveImportTemplate = value => {\n saveAsFile(value, `vform${generateId()}.json`);\n };\n\n const undoHistory = () => {\n props.designer.undoHistoryStep();\n };\n\n const redoHistory = () => {\n props.designer.redoHistoryStep();\n };\n\n const changeLayoutType = (newType: string) => {\n props.designer.changeLayoutType(newType);\n };\n\n const clearFormWidget = () => {\n props.designer.clearDesigner();\n props.designer.formWidget.clearWidgetRefList();\n message.success('ok');\n };\n\n const previewForm = () => {\n showPreviewDialogFlag.value = true;\n // ctx!.proxy.$openCustomerModal({\n // ...vfCtx.value,\n // width: '90%'\n // });\n };\n\n const saveAsFile = (fileContent: string, defaultFileName: string) => {\n const value = 'json.json' || defaultFileName;\n\n if (getQueryParam('vscode') == 1) {\n vsSaveFile(value, fileContent);\n return;\n }\n\n const fileBlob = new Blob([fileContent], { type: 'text/plain;charset=utf-8' });\n saveAs(fileBlob, value);\n };\n\n const vsSaveFile = (fileName: string, fileContent: string) => {\n const msgObj = {\n cmd: 'writeFile',\n data: {\n fileName,\n code: fileContent\n }\n };\n window.parent.postMessage(msgObj, '*');\n };\n\n const importJson = () => {\n importTemplate.value = JSON.stringify(props.designer.getImportTemplate(), null, ' ');\n\n importJsonEditorRef.value.open();\n showImportJsonDialogFlag.value = true;\n };\n\n const doJsonImport = () => {\n try {\n const importObj = JSON.parse(importTemplate.value);\n if (!importObj || !importObj.formConfig) {\n throw new Error(i18nt('designer.hint.invalidJsonFormat'));\n }\n\n props.designer.loadFormJson(importObj);\n\n showImportJsonDialogFlag.value = false;\n message.success(i18nt('designer.hint.importJsonSuccess'));\n\n props.designer.emitHistoryChange();\n\n props.designer.emitEvent('form-json-imported', []);\n } catch (ex) {\n message.error(ex + '');\n }\n };\n\n const exportJson = () => {\n const widgetList = cloneDeep(props.designer.widgetList);\n const formConfig = cloneDeep(props.designer.formConfig);\n exportTemplate.value = JSON.stringify({ widgetList, formConfig }, null, ' ');\n // exportJsonEditorRef.value.open();\n showFormDataDialogFlag.value = true;\n };\n\n const showData = async () => {\n const formConfig = props.designer.formConfig;\n const { id: _id } = getLocat();\n const dsResult = await fmtHttpParams(formConfig.serveList.vformDetail, { _id });\n const leaveDates = [{ date: '2024-10-28' }, { date: '2024-10-29' }, { date: '2024-10-20' }];\n\n preForm.value.getWidgetRef('leaveDates').setValue(leaveDates);\n preForm.value.setFormData({\n ...dsResult\n });\n preForm.value.setReadMode(true);\n };\n\n const getFormData = () => {\n console.log(preForm.value);\n\n preForm.value\n .getFormData()\n .then((formData: any) => {\n formDataJson.value = JSON.stringify(formData, null, ' ');\n showFormDataDialogFlag.value = true;\n })\n .catch((error: any) => {\n message.error(error);\n });\n };\n\n const copyFormDataJson = (e: Event) => {\n copyToClipboard(\n exportTemplate.value,\n e,\n message,\n i18nt('designer.hint.copyJsonSuccess'),\n i18nt('designer.hint.copyJsonFail')\n );\n };\n\n const saveFormData = () => {\n saveAsFile(htmlCode.value, `formData${generateId()}.json`);\n };\n\n const resetForm = () => {\n preForm.value.resetForm();\n };\n\n const setFormDisabled = () => {\n preForm.value.disableForm();\n };\n\n const setFormEnabled = () => {\n preForm.value.enableForm();\n };\n\n const handleFormChange = (fieldName: string, newValue: any, oldValue: any, formModel: any) => {\n console.log('formModel', formModel);\n };\n\n const testOnAppendButtonClick = (clickedWidget: any) => {\n console.log('test', clickedWidget);\n };\n\n const testOnButtonClick = (button: any) => {\n console.log('test', button);\n };\n</script>\n\n<style lang=\"scss\" scoped>\n .toolbar-container {\n width: 100%;\n display: flex;\n height: 42px;\n align-items: center;\n justify-content: space-between;\n }\n\n .left-toolbar {\n display: flex;\n margin-top: 4px;\n font-size: 16px;\n }\n\n .right-toolbar {\n display: flex;\n line-height: 42px;\n overflow: hidden;\n\n .right-toolbar-con {\n text-align: left;\n }\n\n :deep(.svg-icon) {\n margin-left: 0;\n margin-right: 0.05em;\n }\n }\n\n .no-box-shadow {\n box-shadow: none;\n }\n\n .form-render-wrapper.h5-layout {\n margin: 0 auto;\n width: 420px;\n border-radius: 15px;\n //border-width: 10px;\n box-shadow: 0 0 1px 10px #495060;\n height: calc(100vh - 175px);\n overflow-y: auto;\n overflow-x: hidden;\n }\n\n .form-render-wrapper.pad-layout {\n margin: 0 auto;\n width: 960px;\n border-radius: 15px;\n //border-width: 10px;\n box-shadow: 0 0 1px 10px #495060;\n height: calc(100vh - 175px);\n overflow-y: auto;\n overflow-x: hidden;\n }\n\n .node-tree-drawer {\n }\n</style>\n"],"names":["VFormRender","defineAsyncComponent","getCurrentInstance","props","__props","getDesignerConfig","inject","nodeTree","ref","preForm","importJsonEditorRef","vfCtx","getLocat","designerConfig","toolbarWidth","showPreviewDialogFlag","showImportJsonDialogFlag","showFormDataDialogFlag","showNodeTreeDrawerFlag","nodeTreeData","importTemplate","exportTemplate","formDataJson","htmlCode","testFormData","formJson","computed","cloneDeep","undoDisabled","redoDisabled","layoutType","designerDsv","onMounted","maxTBWidth","minTBWidth","newTBWidth","addWindowResizeHandler","nextTick","newTBWidth2","i18nt","useI18n","saveJson","showToolButton","configName","buildTreeNodeOfWidget","widget","treeNode","curNode","col","colNode","wChild","row","rowNode","cell","rowChildren","cellNode","tab","tabNode","refreshNodeTree","wItem","showNodeTreeDrawer","undoHistory","redoHistory","changeLayoutType","newType","clearFormWidget","message","previewForm","saveAsFile","fileContent","defaultFileName","value","getQueryParam","vsSaveFile","fileBlob","saveAs","fileName","msgObj","importJson","doJsonImport","importObj","ex","exportJson","widgetList","formConfig","showData","_id","dsResult","fmtHttpParams","leaveDates","getFormData","formData","error","copyFormDataJson","copyToClipboard","saveFormData","resetForm","setFormDisabled","setFormEnabled","handleFormChange","fieldName","newValue","oldValue","formModel","testOnAppendButtonClick","clickedWidget","testOnButtonClick","button","_openBlock","_createElementBlock","_hoisted_1","_createElementVNode","_hoisted_2","_createVNode","_component_a_button","changeLeftWidth","SvgIcon","leftWidth","_unref","_component_a_radio_group","$event","_component_a_radio_button","_component_a_drawer","_component_a_tree","_hoisted_3","_hoisted_4","_createBlock","_cache","changeRightWidth","rightWidth","_Fragment","_renderList","$slots","idx","slotName","_renderSlot","_ctx","TpfModal","TpfCodeEditor","CodeEditor"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AA6NI,UAAMA,IAAcC,GAAqB,MAAM,OAAO,gCAAoC,CAAC;AAE/E,IAAAC,GAAA;AAYZ,UAAMC,IAAQC,GAKRC,IAAoBC,GAAO,mBAAmB,GAG9CC,IAAWC,EAAS,IAAI,GACxBC,IAAUD,EAAS,IAAI,GACvBE,IAAsBF,EAAS,IAAI;AACb,IAAAA,EAAS,IAAI;AAGzC,UAAMG,IAAQH,EAAI,EAAE,MAAM,OAAO,GAAGI,EAAA,GAAY,GAC1CC,IAAiBL,EAAIH,GAAmB,GACxCS,IAAeN,EAAI,GAAG,GACtBO,IAAwBP,EAAI,EAAK,GACjCQ,IAA2BR,EAAI,EAAK,GACpCS,IAAyBT,EAAI,EAAK,GAClCU,IAAyBV,EAAI,EAAK,GAClCW,IAAeX,EAAW,EAAE,GAC5BY,IAAiBZ,EAAI,EAAE,GACvBa,IAAiBb,EAAI,EAAE,GACvBc,IAAed,EAAI,EAAE,GACrBe,IAAWf,EAAI,EAAE,GAEjBgB,KAAehB,EAAI;AAAA,MACrB,aAAa;AAAA,IAAA,CAChB,GAGKiB,IAAWC,EAAS,OACf;AAAA,MACH,YAAYC,EAAUxB,EAAM,SAAS,UAAU;AAA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AAY;AAAA,yBAAE,MAAyC;AAAA,oBAAtCuB,EAAA/E,CAAA,EAAK,4BAAA,CAAA,GAAA,CAAA;AAAA,cAAA;;;YACxC0E,EAEWC,GAAA;AAAA,cAFA,kCAAOjG,EAAA,QAAsB;AAAA,YAAA;yBACpC,MAAyC;AAAA,oBAAtCqG,EAAA/E,CAAA,EAAK,4BAAA,CAAA,GAAA,CAAA;AAAA,cAAA;;;;qBAZhB,MAAsE;AAAA,YAAtE0E,EAAsEK,EAAAqB,EAAA,GAAA;AAAA,cAAzD,MAAM;AAAA,cAAS,UAAU;AAAA,cAAO,OAAOtH,EAAA;AAAA,YAAA;;;;;;;;"}
1
+ {"version":3,"file":"index.vue2.js","sources":["../../../../../src/components/form-designer/toolbar-panel/index.vue"],"sourcesContent":["<template>\n <div class=\"toolbar-container\">\n <div class=\"left-toolbar\">\n <a-button type=\"link\" @click=\"changeLeftWidth()\">\n <svg-icon\n :style=\"`transform:${leftWidth === 0 ? 'rotate(180deg)' : 'rotate(0deg)'}`\"\n icon-class=\"a-ipadarrow_back\"\n />\n </a-button>\n <a-button\n type=\"link\"\n :disabled=\"undoDisabled\"\n :title=\"i18nt('designer.toolbar.undoHint')\"\n @click=\"undoHistory\"\n >\n <svg-icon icon-class=\"undo\"\n /></a-button>\n <a-button\n type=\"link\"\n :disabled=\"redoDisabled\"\n :title=\"i18nt('designer.toolbar.redoHint')\"\n @click=\"redoHistory\"\n >\n <svg-icon icon-class=\"redo\"\n /></a-button>\n <a-radio-group v-model:value=\"layoutType\">\n <a-radio-button\n value=\"PC\"\n :type=\"layoutType === 'PC' ? 'primary' : ''\"\n @click=\"changeLayoutType('PC')\"\n >\n {{ i18nt('designer.toolbar.pcLayout') }}</a-radio-button\n >\n <a-radio-button\n value=\"Pad\"\n :type=\"layoutType === 'Pad' ? 'primary' : ''\"\n @click=\"changeLayoutType('Pad')\"\n >\n {{ i18nt('designer.toolbar.padLayout') }}</a-radio-button\n >\n <a-radio-button\n :type=\"layoutType === 'H5' ? 'primary' : ''\"\n @click=\"changeLayoutType('H5')\"\n value=\"H5\"\n >\n {{ i18nt('designer.toolbar.mobileLayout') }}</a-radio-button\n >\n </a-radio-group>\n <a-button\n style=\"margin-left: 20px\"\n :title=\"i18nt('designer.toolbar.nodeTreeHint')\"\n @click=\"showNodeTreeDrawer\"\n >\n <svg-icon icon-class=\"node-tree\"\n /></a-button>\n </div>\n\n <a-drawer\n :title=\"i18nt('designer.toolbar.nodeTreeTitle')\"\n direction=\"ltr\"\n v-model:open=\"showNodeTreeDrawerFlag\"\n :width=\"280\"\n :destroy-on-close=\"true\"\n class=\"node-tree-drawer\"\n >\n <a-tree\n ref=\"nodeTree\"\n :treeData=\"nodeTreeData\"\n default-expand-all\n highlight-current\n class=\"node-tree\"\n icon-class=\"el-icon-arrow-right\"\n :fieldNames=\"{ children: 'children', title: 'label', key: 'id' }\"\n />\n </a-drawer>\n\n <div class=\"right-toolbar\">\n <div class=\"right-toolbar-con\">\n <a-button\n v-if=\"showToolButton('clearDesignerButton')\"\n type=\"link\"\n @click=\"clearFormWidget\"\n >\n <svg-icon icon-class=\"el-delete\" />{{ i18nt('designer.toolbar.clear') }}\n </a-button>\n <a-button\n v-if=\"showToolButton('previewFormButton')\"\n type=\"link\"\n @click=\"previewForm\"\n >\n <svg-icon icon-class=\"el-view\" />{{ i18nt('designer.toolbar.preview') }}\n </a-button>\n <a-button v-if=\"showToolButton('importJsonButton')\" type=\"link\" @click=\"importJson\">\n {{ i18nt('designer.toolbar.importJson') }}\n </a-button>\n <a-button v-if=\"showToolButton('exportJsonButton')\" type=\"link\" @click=\"exportJson\">\n {{ i18nt('designer.toolbar.exportJson') }}\n </a-button>\n <a-button v-if=\"showToolButton('exportCodeButton')\" type=\"link\" @click=\"saveJson\">\n 保存\n </a-button>\n <a-button type=\"link\" @click=\"changeRightWidth()\">\n <svg-icon\n :style=\"`transform:${rightWidth === 0 ? 'rotate(0deg)' : 'rotate(180deg)'}`\"\n icon-class=\"a-ipadarrow_back\"\n />\n </a-button>\n <template v-for=\"(idx, slotName) in $slots\">\n <slot :name=\"slotName\"></slot>\n </template>\n </div>\n </div>\n\n <TpfModal\n :title=\"i18nt('designer.toolbar.preview')\"\n v-model:visible=\"showPreviewDialogFlag\"\n :show-close=\"true\"\n :close-on-click-modal=\"false\"\n :close-on-press-escape=\"false\"\n center\n class=\"drag-dialog\"\n width=\"75%\"\n :fullscreen=\"true\"\n >\n <div>\n <div\n class=\"form-render-wrapper\"\n :class=\"[\n layoutType === 'H5' ? 'h5-layout' : layoutType === 'Pad' ? 'pad-layout' : ''\n ]\"\n >\n <VFormRender\n :vfCtx=\"vfCtx\"\n ref=\"preForm\"\n :form-json=\"cloneDeep(formJson)\"\n :form-data=\"testFormData\"\n :preview-state=\"true\"\n :global-dsv=\"designerDsv\"\n @appendButtonClick=\"testOnAppendButtonClick\"\n @buttonClick=\"testOnButtonClick\"\n @formChange=\"handleFormChange\"\n />\n </div>\n </div>\n <template #footerRight>\n <span id=\"footerRight\" style=\"margin-right: 8px\"> </span>\n <a-button @click=\"showData\">数据回显</a-button>\n <a-button type=\"primary\" @click=\"getFormData\">\n {{ i18nt('designer.hint.getFormData') }}\n </a-button>\n <a-button type=\"primary\" @click=\"resetForm\">\n {{ i18nt('designer.hint.resetForm') }}\n </a-button>\n <a-button type=\"primary\" @click=\"setFormDisabled\">\n {{ i18nt('designer.hint.disableForm') }}\n </a-button>\n <a-button type=\"primary\" @click=\"setFormEnabled\">\n {{ i18nt('designer.hint.enableForm') }}\n </a-button>\n <a-button @click=\"showPreviewDialogFlag = false\">\n {{ i18nt('designer.hint.closePreview') }}\n </a-button>\n </template>\n </TpfModal>\n\n <TpfCodeEditor\n ref=\"importJsonEditorRef\"\n :isShowEventFooter=\"false\"\n :event-header=\"i18nt('designer.hint.importJsonHint')\"\n v-model=\"importTemplate\"\n mode=\"json\"\n :width=\"1200\"\n height=\"70vh\"\n :title=\"i18nt('designer.toolbar.importJson')\"\n @set-code=\"doJsonImport\"\n />\n\n <TpfModal\n :title=\"i18nt('designer.hint.exportFormData')\"\n v-model:visible=\"showFormDataDialogFlag\"\n width=\"1200px\"\n >\n <CodeEditor :mode=\"'json'\" :readonly=\"true\" :value=\"exportTemplate\" />\n <template #footerRight>\n <a-button\n type=\"primary\"\n class=\"copy-form-data-json-btn\"\n :data-clipboard-text=\"exportTemplate\"\n @click=\"copyFormDataJson\"\n >\n {{ i18nt('designer.hint.copyFormData') }}\n </a-button>\n <a-button @click=\"saveFormData\">{{ i18nt('designer.hint.saveFormData') }}</a-button>\n <a-button @click=\"showFormDataDialogFlag = false\">\n {{ i18nt('designer.hint.closePreview') }}\n </a-button>\n </template>\n </TpfModal>\n </div>\n</template>\n\n<script lang=\"ts\" setup>\n import { ref, computed, nextTick, onMounted, defineAsyncComponent, inject } from 'vue';\n import {\n copyToClipboard,\n generateId,\n getQueryParam,\n traverseAllWidgets,\n addWindowResizeHandler\n } from '@/utils/util';\n import { useI18n } from '@/utils/i18n';\n import { saveAs } from 'file-saver';\n import SvgIcon from '@/components/svg-icon/index.vue';\n import { fmtHttpParams } from '@/utils/request/fmtHttpParams';\n import { getLocat } from '@kp-ui/tool';\n import { cloneDeep } from 'lodash-es';\n import { CodeEditor, TpfModal, TpfCodeEditor } from 'tmgc2-share';\n import { message, Space } from 'ant-design-vue';\n import { getCurrentInstance } from 'vue';\n\n // 组件定义\n const VFormRender = defineAsyncComponent(() => import('@/components/form-render/index.vue'));\n\n const ctx = getCurrentInstance();\n // Props 定义\n interface Props {\n leftWidth: number;\n rightWidth: number;\n changeRightWidth: () => void;\n changeLeftWidth: () => void;\n designer: any; // 可以根据实际类型定义更具体的类型\n saveJsonApi?: (formJson: any) => void;\n globalDsv?: Record<string, any>;\n }\n\n const props = withDefaults(defineProps<Props>(), {\n globalDsv: () => ({})\n });\n\n // Inject\n const getDesignerConfig = inject('getDesignerConfig') as () => any;\n\n // Refs\n const nodeTree = ref<any>(null);\n const preForm = ref<any>(null);\n const importJsonEditorRef = ref<any>(null);\n const exportJsonEditorRef = ref<any>(null);\n\n // 响应式数据\n const vfCtx = ref({ type: 'add', ...getLocat() });\n const designerConfig = ref(getDesignerConfig());\n const toolbarWidth = ref(460);\n const showPreviewDialogFlag = ref(false);\n const showImportJsonDialogFlag = ref(false);\n const showFormDataDialogFlag = ref(false);\n const showNodeTreeDrawerFlag = ref(false);\n const nodeTreeData = ref<any[]>([]);\n const importTemplate = ref('');\n const exportTemplate = ref('');\n const formDataJson = ref('');\n const htmlCode = ref('');\n\n const testFormData = ref({\n select62173: 2\n });\n\n // 计算属性\n const formJson = computed(() => {\n return {\n widgetList: cloneDeep(props.designer.widgetList),\n formConfig: cloneDeep(props.designer.formConfig)\n };\n });\n\n const undoDisabled = computed(() => {\n return !props.designer.undoEnabled();\n });\n\n const redoDisabled = computed(() => {\n return !props.designer.redoEnabled();\n });\n\n const layoutType = computed(() => {\n return props.designer.getLayoutType();\n });\n\n const designerDsv = computed(() => {\n return props.globalDsv;\n });\n\n // 生命周期钩子\n onMounted(() => {\n const maxTBWidth = designerConfig.value.toolbarMaxWidth || 460;\n const minTBWidth = designerConfig.value.toolbarMinWidth || 300;\n const newTBWidth = window.innerWidth - 260 - 300 - 320 - 80;\n toolbarWidth.value =\n newTBWidth >= maxTBWidth\n ? maxTBWidth\n : newTBWidth <= minTBWidth\n ? minTBWidth\n : newTBWidth;\n addWindowResizeHandler(() => {\n nextTick(() => {\n const newTBWidth2 = window.innerWidth - 260 - 300 - 320 - 80;\n toolbarWidth.value =\n newTBWidth2 >= maxTBWidth\n ? maxTBWidth\n : newTBWidth2 <= minTBWidth\n ? minTBWidth\n : newTBWidth2;\n });\n });\n });\n\n // 方法\n const { i18nt } = useI18n();\n\n const saveJson = () => {\n if (props.saveJsonApi) {\n props.saveJsonApi(formJson.value);\n }\n };\n\n const showToolButton = (configName: string): boolean => {\n if (designerConfig.value[configName] === undefined) {\n return true;\n }\n\n return !!designerConfig.value[configName];\n };\n\n const buildTreeNodeOfWidget = (widget: any, treeNode: any[]) => {\n const curNode = {\n id: widget.id,\n label: widget.options.label || widget.type,\n children: [] as any[]\n };\n treeNode.push(curNode);\n\n if (widget.category === undefined) {\n return;\n }\n\n if (widget.type === 'grid') {\n widget.cols.map((col: any) => {\n const colNode = {\n id: col.id,\n label: col.options.name || widget.type,\n children: [] as any[]\n };\n curNode.children.push(colNode);\n col.widgetList.map((wChild: any) => {\n buildTreeNodeOfWidget(wChild, colNode.children);\n });\n });\n } else if (widget.type === 'table') {\n //TODO: 需要考虑合并单元格!!\n widget.rows.map((row: any) => {\n const rowNode = {\n id: row.id,\n label: 'table-row',\n selectable: false,\n children: [] as any[]\n };\n curNode.children.push(rowNode);\n\n row.cols.map((cell: any) => {\n if (!!cell.merged) {\n //跳过合并单元格!!\n return;\n }\n\n const rowChildren = rowNode.children;\n const cellNode = {\n id: cell.id,\n label: 'table-cell',\n children: [] as any[]\n };\n rowChildren.push(cellNode);\n\n cell.widgetList.map((wChild: any) => {\n buildTreeNodeOfWidget(wChild, cellNode.children);\n });\n });\n });\n } else if (widget.type === 'tab') {\n widget.tabs.map((tab: any) => {\n const tabNode = {\n id: tab.id,\n label: tab.options.name || widget.type,\n selectable: false,\n children: [] as any[]\n };\n curNode.children.push(tabNode);\n tab.widgetList.map((wChild: any) => {\n buildTreeNodeOfWidget(wChild, tabNode.children);\n });\n });\n } else if (widget.type === 'sub-form') {\n widget.widgetList.map((wChild: any) => {\n buildTreeNodeOfWidget(wChild, curNode.children);\n });\n } else if (widget.category === 'container') {\n //自定义容器\n widget.widgetList.map((wChild: any) => {\n buildTreeNodeOfWidget(wChild, curNode.children);\n });\n }\n };\n\n const refreshNodeTree = () => {\n nodeTreeData.value.length = 0;\n props.designer.widgetList.forEach((wItem: any) => {\n buildTreeNodeOfWidget(wItem, nodeTreeData.value);\n });\n };\n\n const showNodeTreeDrawer = () => {\n refreshNodeTree();\n showNodeTreeDrawerFlag.value = true;\n nextTick(() => {\n if (!!props.designer.selectedId) {\n //同步当前选中组件到节点树!!!\n nodeTree.value.setCurrentKey(props.designer.selectedId);\n }\n });\n };\n\n const saveImportTemplate = value => {\n saveAsFile(value, `vform${generateId()}.json`);\n };\n\n const undoHistory = () => {\n props.designer.undoHistoryStep();\n };\n\n const redoHistory = () => {\n props.designer.redoHistoryStep();\n };\n\n const changeLayoutType = (newType: string) => {\n props.designer.changeLayoutType(newType);\n };\n\n const clearFormWidget = () => {\n props.designer.clearDesigner();\n props.designer.formWidget.clearWidgetRefList();\n message.success('ok');\n };\n\n const previewForm = () => {\n showPreviewDialogFlag.value = true;\n // ctx!.proxy.$openCustomerModal({\n // ...vfCtx.value,\n // width: '90%'\n // });\n };\n\n const saveAsFile = (fileContent: string, defaultFileName: string) => {\n const value = 'json.json' || defaultFileName;\n\n if (getQueryParam('vscode') == 1) {\n vsSaveFile(value, fileContent);\n return;\n }\n\n const fileBlob = new Blob([fileContent], { type: 'text/plain;charset=utf-8' });\n saveAs(fileBlob, value);\n };\n\n const vsSaveFile = (fileName: string, fileContent: string) => {\n const msgObj = {\n cmd: 'writeFile',\n data: {\n fileName,\n code: fileContent\n }\n };\n window.parent.postMessage(msgObj, '*');\n };\n\n const importJson = () => {\n importTemplate.value = JSON.stringify(props.designer.getImportTemplate(), null, ' ');\n\n importJsonEditorRef.value.open();\n showImportJsonDialogFlag.value = true;\n };\n\n const doJsonImport = () => {\n try {\n const importObj = JSON.parse(importTemplate.value);\n if (!importObj || !importObj.formConfig) {\n throw new Error(i18nt('designer.hint.invalidJsonFormat'));\n }\n\n props.designer.loadFormJson(importObj);\n\n showImportJsonDialogFlag.value = false;\n message.success(i18nt('designer.hint.importJsonSuccess'));\n\n props.designer.emitHistoryChange();\n\n props.designer.emitEvent('form-json-imported', []);\n } catch (ex) {\n message.error(ex + '');\n }\n };\n\n const exportJson = () => {\n const widgetList = cloneDeep(props.designer.widgetList);\n const formConfig = cloneDeep(props.designer.formConfig);\n exportTemplate.value = JSON.stringify({ widgetList, formConfig }, null, ' ');\n // exportJsonEditorRef.value.open();\n showFormDataDialogFlag.value = true;\n };\n\n const showData = async () => {\n const formConfig = props.designer.formConfig;\n const { id: _id } = getLocat();\n const dsResult = await fmtHttpParams(formConfig.serveList.vformDetail, { _id });\n const leaveDates = [{ date: '2024-10-28' }, { date: '2024-10-29' }, { date: '2024-10-20' }];\n\n preForm.value.getWidgetRef('leaveDates').setValue(leaveDates);\n preForm.value.setFormData({\n ...dsResult\n });\n preForm.value.setReadMode(true);\n };\n\n const getFormData = () => {\n console.log(preForm.value);\n\n preForm.value\n .getFormData()\n .then((formData: any) => {\n formDataJson.value = JSON.stringify(formData, null, ' ');\n showFormDataDialogFlag.value = true;\n })\n .catch((error: any) => {\n message.error(error);\n });\n };\n\n const copyFormDataJson = (e: Event) => {\n copyToClipboard(\n exportTemplate.value,\n e,\n message,\n i18nt('designer.hint.copyJsonSuccess'),\n i18nt('designer.hint.copyJsonFail')\n );\n };\n\n const saveFormData = () => {\n saveAsFile(htmlCode.value, `formData${generateId()}.json`);\n };\n\n const resetForm = () => {\n preForm.value.resetForm();\n };\n\n const setFormDisabled = () => {\n preForm.value.disableForm();\n };\n\n const setFormEnabled = () => {\n preForm.value.enableForm();\n };\n\n const handleFormChange = (fieldName: string, newValue: any, oldValue: any, formModel: any) => {\n console.log('formModel', formModel);\n };\n\n const testOnAppendButtonClick = (clickedWidget: any) => {\n console.log('test', clickedWidget);\n };\n\n const testOnButtonClick = (button: any) => {\n console.log('test', button);\n };\n</script>\n\n<style lang=\"scss\" scoped>\n .toolbar-container {\n width: 100%;\n display: flex;\n height: 42px;\n align-items: center;\n justify-content: space-between;\n }\n\n .left-toolbar {\n display: flex;\n margin-top: 4px;\n font-size: 16px;\n }\n\n .right-toolbar {\n display: flex;\n line-height: 42px;\n overflow: hidden;\n\n .right-toolbar-con {\n text-align: left;\n }\n\n :deep(.svg-icon) {\n margin-left: 0;\n margin-right: 0.05em;\n }\n }\n\n .no-box-shadow {\n box-shadow: none;\n }\n\n .form-render-wrapper.h5-layout {\n margin: 0 auto;\n width: 420px;\n border-radius: 15px;\n //border-width: 10px;\n box-shadow: 0 0 1px 10px #495060;\n height: calc(100vh - 175px);\n overflow-y: auto;\n overflow-x: hidden;\n }\n\n .form-render-wrapper.pad-layout {\n margin: 0 auto;\n width: 960px;\n border-radius: 15px;\n //border-width: 10px;\n box-shadow: 0 0 1px 10px #495060;\n height: calc(100vh - 175px);\n overflow-y: auto;\n overflow-x: hidden;\n }\n\n .node-tree-drawer {\n }\n</style>\n"],"names":["VFormRender","defineAsyncComponent","getCurrentInstance","props","__props","getDesignerConfig","inject","nodeTree","ref","preForm","importJsonEditorRef","vfCtx","getLocat","designerConfig","toolbarWidth","showPreviewDialogFlag","showImportJsonDialogFlag","showFormDataDialogFlag","showNodeTreeDrawerFlag","nodeTreeData","importTemplate","exportTemplate","formDataJson","htmlCode","testFormData","formJson","computed","cloneDeep","undoDisabled","redoDisabled","layoutType","designerDsv","onMounted","maxTBWidth","minTBWidth","newTBWidth","addWindowResizeHandler","nextTick","newTBWidth2","i18nt","useI18n","saveJson","showToolButton","configName","buildTreeNodeOfWidget","widget","treeNode","curNode","col","colNode","wChild","row","rowNode","cell","rowChildren","cellNode","tab","tabNode","refreshNodeTree","wItem","showNodeTreeDrawer","undoHistory","redoHistory","changeLayoutType","newType","clearFormWidget","message","previewForm","saveAsFile","fileContent","defaultFileName","value","getQueryParam","vsSaveFile","fileBlob","saveAs","fileName","msgObj","importJson","doJsonImport","importObj","ex","exportJson","widgetList","formConfig","showData","_id","dsResult","fmtHttpParams","leaveDates","getFormData","formData","error","copyFormDataJson","copyToClipboard","saveFormData","resetForm","setFormDisabled","setFormEnabled","handleFormChange","fieldName","newValue","oldValue","formModel","testOnAppendButtonClick","clickedWidget","testOnButtonClick","button","_openBlock","_createElementBlock","_hoisted_1","_createElementVNode","_hoisted_2","_createVNode","_component_a_button","changeLeftWidth","SvgIcon","leftWidth","_unref","_component_a_radio_group","$event","_component_a_radio_button","_component_a_drawer","_component_a_tree","_hoisted_3","_hoisted_4","_createBlock","_cache","changeRightWidth","rightWidth","_Fragment","_renderList","$slots","idx","slotName","_renderSlot","_ctx","TpfModal","TpfCodeEditor","CodeEditor"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AA6NI,UAAMA,IAAcC,GAAqB,MAAM,OAAO,gCAAoC,CAAC;AAE/E,IAAAC,GAAA;AAYZ,UAAMC,IAAQC,GAKRC,IAAoBC,GAAO,mBAAmB,GAG9CC,IAAWC,EAAS,IAAI,GACxBC,IAAUD,EAAS,IAAI,GACvBE,IAAsBF,EAAS,IAAI;AACb,IAAAA,EAAS,IAAI;AAGzC,UAAMG,IAAQH,EAAI,EAAE,MAAM,OAAO,GAAGI,EAAA,GAAY,GAC1CC,IAAiBL,EAAIH,GAAmB,GACxCS,IAAeN,EAAI,GAAG,GACtBO,IAAwBP,EAAI,EAAK,GACjCQ,IAA2BR,EAAI,EAAK,GACpCS,IAAyBT,EAAI,EAAK,GAClCU,IAAyBV,EAAI,EAAK,GAClCW,IAAeX,EAAW,EAAE,GAC5BY,IAAiBZ,EAAI,EAAE,GACvBa,IAAiBb,EAAI,EAAE,GACvBc,IAAed,EAAI,EAAE,GACrBe,IAAWf,EAAI,EAAE,GAEjBgB,KAAehB,EAAI;AAAA,MACrB,aAAa;AAAA,IAAA,CAChB,GAGKiB,IAAWC,EAAS,OACf;AAAA,MACH,YAAYC,EAAUxB,EAAM,SAAS,UAAU;AAAA,MAC/C,YAAYwB,EAAUxB,EAAM,SAAS,UAAU;AAAA,IAAA,EAEtD,GAEKyB,KAAeF,EAAS,MACnB,CAACvB,EAAM,SAAS,YAAA,CAC1B,GAEK0B,KAAeH,EAAS,MACnB,CAACvB,EAAM,SAAS,YAAA,CAC1B,GAEK2B,IAAaJ,EAAS,MACjBvB,EAAM,SAAS,cAAA,CACzB,GAEK4B,KAAcL,EAAS,MAClBvB,EAAM,SAChB;AAGD,IAAA6B,GAAU,MAAM;AACZ,YAAMC,IAAapB,EAAe,MAAM,m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,cAAA;;;;qBAZhB,MAAsE;AAAA,YAAtE0E,EAAsEK,EAAAqB,EAAA,GAAA;AAAA,cAAzD,MAAM;AAAA,cAAS,UAAU;AAAA,cAAO,OAAOtH,EAAA;AAAA,YAAA;;;;;;;;"}
@@ -39,7 +39,7 @@ function v(o, B, S, $, h, z) {
39
39
  ], 8, ["disabled", "to"]))
40
40
  ], 6);
41
41
  }
42
- const L = /* @__PURE__ */ g(d, [["render", v], ["__scopeId", "data-v-53e6b5e0"]]);
42
+ const L = /* @__PURE__ */ g(d, [["render", v], ["__scopeId", "data-v-b1664204"]]);
43
43
  export {
44
44
  L as default
45
45
  };
@@ -1 +1 @@
1
- {"version":3,"file":"ActionButtonListRender.vue.js","sources":["../../../../src/components/public/ActionButtonListRender.vue"],"sourcesContent":["<template>\n <div\n ref=\"fieldEditor\"\n :class=\"['button-list-container', ...customClass]\"\n :style=\"containerStyle\"\n >\n <Teleport :disabled=\"isDisabled\" :to=\"getContainer\">\n <a-space :size=\"8\">\n <a-button\n v-for=\"item in visibleButtons\"\n :key=\"item.key\"\n :type=\"item.type\"\n :danger=\"item.danger\"\n class=\"tpf-button\"\n :disabled=\"handleDisabled(item)\"\n @click=\"handleClick(item)\"\n >\n <template v-if=\"item.icon\">\n <SvgIcon :icon-class=\"item.icon\" class=\"button-icon\" />\n </template>\n {{ item.label }}\n </a-button>\n </a-space>\n </Teleport>\n </div>\n</template>\n\n<script lang=\"ts\">\n import { defineComponent, computed, PropType } from 'vue';\n import { executeFunction } from '@/utils/executeFunction';\n import SvgIcon from '@/components/svg-icon/index.vue';\n import type { ActionButton } from '@/types/button';\n import { ButtonPositionEnum } from '@/constants';\n\n export default defineComponent({\n name: 'ActionButtonListRender',\n components: { SvgIcon },\n props: {\n options: {\n type: Object,\n default: () => {}\n },\n scope: {\n type: Object,\n default: () => {}\n },\n ctx: {\n type: Object\n },\n buttonList: {\n type: Array as PropType<ActionButton[]>,\n default: () => []\n },\n customClass: {\n type: Array as PropType<string[]>,\n default: () => []\n },\n flex: {\n type: String,\n default: 'center'\n },\n designState: {\n type: Boolean,\n default: false\n }\n },\n setup(props) {\n const containerStyle = computed(() => ({\n '--flex': props.flex\n }));\n\n const isDisabled = computed(\n () => props.options?.buttonPosition !== ButtonPositionEnum.DIY\n );\n\n const getContainer = computed(() =>\n isDisabled.value ? null : props.options?.getContainer\n );\n\n console.log({ isDisabled: isDisabled.value, getContainer: getContainer.value });\n\n const visibleButtons = computed(() =>\n props.buttonList.filter(item => !handleHidden(item))\n );\n\n const handleClick = async (item: ActionButton) => {\n if (props.designState) return; // 在设计状态下不处理点击事件\n if (!item.onClick) return;\n try {\n await executeFunction({\n functionBody: item.onClick,\n context: props.ctx,\n params: props.scope\n });\n } catch (error) {\n console.error('Button click handler error:', error);\n }\n };\n\n const handleDisabled = (item: ActionButton): boolean => {\n if (!item.onDisabled) return false;\n\n try {\n return executeFunction({\n functionBody: item.onDisabled,\n context: props.ctx,\n params: props.scope\n });\n } catch (error) {\n console.error('Button disabled handler error:', error);\n return false;\n }\n };\n\n const handleHidden = (item: ActionButton): boolean => {\n if (!item.onHidden) return false;\n\n try {\n return executeFunction({\n functionBody: item.onHidden,\n context: props.ctx,\n params: props.scope\n });\n } catch (error) {\n console.error('Button hidden handler error:', error);\n return false;\n }\n };\n\n return {\n getContainer,\n isDisabled,\n containerStyle,\n visibleButtons,\n handleClick,\n handleDisabled\n };\n }\n });\n</script>\n\n<style lang=\"scss\" scoped>\n .button-list-container {\n flex: 1;\n display: flex;\n justify-content: var(--flex);\n\n .button-icon {\n margin-right: 4px;\n }\n }\n</style>\n"],"names":["_createElementBlock","_normalizeClass","_ctx","_normalizeStyle","_createBlock","_Teleport","_createVNode","_component_a_space","_withCtx","_openBlock","_Fragment","_renderList","item","_component_a_button","$event","_component_SvgIcon","_createCommentVNode","_toDisplayString"],"mappings":";;;;;;cACIA,EAuBM,OAAA;AAAA,IAtBF,KAAI;AAAA,IACH,OAAKC,+BAA+BC,EAAA,WAAW,CAAA;AAAA,IAC/C,OAAKC,EAAED,EAAA,cAAc;AAAA,EAAA,GAAA;AAAA,UAEtBE,EAiBWC,GAAA;AAAA,MAjBA,UAAUH,EAAA;AAAA,MAAa,IAAIA,EAAA;AAAA,IAAA,GAAA;AAAA,MAClCI,EAeUC,GAAA,EAfA,MAAM,EAAA,GAAC;AAAA,QAAA,SAAAC,EAET,MAA8B;AAAA,WAAAC,EAAA,EAAA,GADlCT,EAaWU,GAAA,MAAAC,EAZQT,EAAA,gBAAc,CAAtBU,YADXR,EAaWS,GAAA;AAAA,YAXN,KAAKD,EAAK;AAAA,YACV,MAAMA,EAAK;AAAA,YACX,QAAQA,EAAK;AAAA,YACd,OAAM;AAAA,YACL,UAAUV,iBAAeU,CAAI;AAAA,YAC7B,SAAK,CAAAE,MAAEZ,EAAA,YAAYU,CAAI;AAAA,UAAA,GAAA;AAAA,uBAExB,MAEW;AAAA,cAFKA,EAAK,aACjBR,EAAuDW,GAAA;AAAA,gBAAA,KAAA;AAAA,gBAA7C,cAAYH,EAAK;AAAA,gBAAM,OAAM;AAAA,cAAA,GAAA,MAAA,GAAA,CAAA,YAAA,CAAA,KAAAI,EAAA,IAAA,EAAA;AAAA,gBAChC,MACXC,EAAGL,EAAK,KAAK,GAAA,CAAA;AAAA,YAAA,CAAA;AAAA;;;;;;;;;"}
1
+ {"version":3,"file":"ActionButtonListRender.vue.js","sources":["../../../../src/components/public/ActionButtonListRender.vue"],"sourcesContent":["<template>\n <div\n ref=\"fieldEditor\"\n :class=\"['button-list-container', ...customClass]\"\n :style=\"containerStyle\"\n >\n <Teleport :disabled=\"isDisabled\" :to=\"getContainer\">\n <a-space :size=\"8\">\n <a-button\n v-for=\"item in visibleButtons\"\n :key=\"item.key\"\n :type=\"item.type\"\n :danger=\"item.danger\"\n class=\"tpf-button\"\n :disabled=\"handleDisabled(item)\"\n @click=\"handleClick(item)\"\n >\n <template v-if=\"item.icon\">\n <SvgIcon :icon-class=\"item.icon\" class=\"button-icon\" />\n </template>\n {{ item.label }}\n </a-button>\n </a-space>\n </Teleport>\n </div>\n</template>\n\n<script lang=\"ts\">\n import { defineComponent, computed, PropType } from 'vue';\n import { executeFunction } from '@/utils/executeFunction';\n import SvgIcon from '@/components/svg-icon/index.vue';\n import type { ActionButton } from '@/types/button';\n import { ButtonPositionEnum } from '@/constants';\n\n export default defineComponent({\n name: 'ActionButtonListRender',\n components: { SvgIcon },\n props: {\n options: {\n type: Object,\n default: () => {}\n },\n scope: {\n type: Object,\n default: () => {}\n },\n ctx: {\n type: Object\n },\n buttonList: {\n type: Array as PropType<ActionButton[]>,\n default: () => []\n },\n customClass: {\n type: Array as PropType<string[]>,\n default: () => []\n },\n flex: {\n type: String,\n default: 'center'\n },\n designState: {\n type: Boolean,\n default: false\n }\n },\n setup(props) {\n const containerStyle = computed(() => ({\n '--flex': props.flex\n }));\n\n const isDisabled = computed(\n () => props.options?.buttonPosition !== ButtonPositionEnum.DIY || props.designState\n );\n\n const getContainer = computed(() =>\n isDisabled.value ? null : props.options?.getContainer\n );\n\n console.log({ isDisabled: isDisabled.value, getContainer: getContainer.value });\n\n const visibleButtons = computed(() =>\n props.buttonList.filter(item => !handleHidden(item))\n );\n\n const handleClick = async (item: ActionButton) => {\n if (props.designState) return; // 在设计状态下不处理点击事件\n if (!item.onClick) return;\n try {\n await executeFunction({\n functionBody: item.onClick,\n context: props.ctx,\n params: props.scope\n });\n } catch (error) {\n console.error('Button click handler error:', error);\n }\n };\n\n const handleDisabled = (item: ActionButton): boolean => {\n if (!item.onDisabled) return false;\n\n try {\n return executeFunction({\n functionBody: item.onDisabled,\n context: props.ctx,\n params: props.scope\n });\n } catch (error) {\n console.error('Button disabled handler error:', error);\n return false;\n }\n };\n\n const handleHidden = (item: ActionButton): boolean => {\n if (!item.onHidden) return false;\n\n try {\n return executeFunction({\n functionBody: item.onHidden,\n context: props.ctx,\n params: props.scope\n });\n } catch (error) {\n console.error('Button hidden handler error:', error);\n return false;\n }\n };\n\n return {\n getContainer,\n isDisabled,\n containerStyle,\n visibleButtons,\n handleClick,\n handleDisabled\n };\n }\n });\n</script>\n\n<style lang=\"scss\" scoped>\n .button-list-container {\n flex: 1;\n display: flex;\n justify-content: var(--flex);\n\n .button-icon {\n margin-right: 4px;\n }\n }\n</style>\n"],"names":["_createElementBlock","_normalizeClass","_ctx","_normalizeStyle","_createBlock","_Teleport","_createVNode","_component_a_space","_withCtx","_openBlock","_Fragment","_renderList","item","_component_a_button","$event","_component_SvgIcon","_createCommentVNode","_toDisplayString"],"mappings":";;;;;;cACIA,EAuBM,OAAA;AAAA,IAtBF,KAAI;AAAA,IACH,OAAKC,+BAA+BC,EAAA,WAAW,CAAA;AAAA,IAC/C,OAAKC,EAAED,EAAA,cAAc;AAAA,EAAA,GAAA;AAAA,UAEtBE,EAiBWC,GAAA;AAAA,MAjBA,UAAUH,EAAA;AAAA,MAAa,IAAIA,EAAA;AAAA,IAAA,GAAA;AAAA,MAClCI,EAeUC,GAAA,EAfA,MAAM,EAAA,GAAC;AAAA,QAAA,SAAAC,EAET,MAA8B;AAAA,WAAAC,EAAA,EAAA,GADlCT,EAaWU,GAAA,MAAAC,EAZQT,EAAA,gBAAc,CAAtBU,YADXR,EAaWS,GAAA;AAAA,YAXN,KAAKD,EAAK;AAAA,YACV,MAAMA,EAAK;AAAA,YACX,QAAQA,EAAK;AAAA,YACd,OAAM;AAAA,YACL,UAAUV,iBAAeU,CAAI;AAAA,YAC7B,SAAK,CAAAE,MAAEZ,EAAA,YAAYU,CAAI;AAAA,UAAA,GAAA;AAAA,uBAExB,MAEW;AAAA,cAFKA,EAAK,aACjBR,EAAuDW,GAAA;AAAA,gBAAA,KAAA;AAAA,gBAA7C,cAAYH,EAAK;AAAA,gBAAM,OAAM;AAAA,cAAA,GAAA,MAAA,GAAA,CAAA,YAAA,CAAA,KAAAI,EAAA,IAAA,EAAA;AAAA,gBAChC,MACXC,EAAGL,EAAK,KAAK,GAAA,CAAA;AAAA,YAAA,CAAA;AAAA;;;;;;;;;"}
@@ -42,7 +42,7 @@ const g = f({
42
42
  })), r = o(
43
43
  () => {
44
44
  var t;
45
- return ((t = e.options) == null ? void 0 : t.buttonPosition) !== m.DIY;
45
+ return ((t = e.options) == null ? void 0 : t.buttonPosition) !== m.DIY || e.designState;
46
46
  }
47
47
  ), c = o(
48
48
  () => {
@@ -1 +1 @@
1
- {"version":3,"file":"ActionButtonListRender.vue2.js","sources":["../../../../src/components/public/ActionButtonListRender.vue"],"sourcesContent":["<template>\n <div\n ref=\"fieldEditor\"\n :class=\"['button-list-container', ...customClass]\"\n :style=\"containerStyle\"\n >\n <Teleport :disabled=\"isDisabled\" :to=\"getContainer\">\n <a-space :size=\"8\">\n <a-button\n v-for=\"item in visibleButtons\"\n :key=\"item.key\"\n :type=\"item.type\"\n :danger=\"item.danger\"\n class=\"tpf-button\"\n :disabled=\"handleDisabled(item)\"\n @click=\"handleClick(item)\"\n >\n <template v-if=\"item.icon\">\n <SvgIcon :icon-class=\"item.icon\" class=\"button-icon\" />\n </template>\n {{ item.label }}\n </a-button>\n </a-space>\n </Teleport>\n </div>\n</template>\n\n<script lang=\"ts\">\n import { defineComponent, computed, PropType } from 'vue';\n import { executeFunction } from '@/utils/executeFunction';\n import SvgIcon from '@/components/svg-icon/index.vue';\n import type { ActionButton } from '@/types/button';\n import { ButtonPositionEnum } from '@/constants';\n\n export default defineComponent({\n name: 'ActionButtonListRender',\n components: { SvgIcon },\n props: {\n options: {\n type: Object,\n default: () => {}\n },\n scope: {\n type: Object,\n default: () => {}\n },\n ctx: {\n type: Object\n },\n buttonList: {\n type: Array as PropType<ActionButton[]>,\n default: () => []\n },\n customClass: {\n type: Array as PropType<string[]>,\n default: () => []\n },\n flex: {\n type: String,\n default: 'center'\n },\n designState: {\n type: Boolean,\n default: false\n }\n },\n setup(props) {\n const containerStyle = computed(() => ({\n '--flex': props.flex\n }));\n\n const isDisabled = computed(\n () => props.options?.buttonPosition !== ButtonPositionEnum.DIY\n );\n\n const getContainer = computed(() =>\n isDisabled.value ? null : props.options?.getContainer\n );\n\n console.log({ isDisabled: isDisabled.value, getContainer: getContainer.value });\n\n const visibleButtons = computed(() =>\n props.buttonList.filter(item => !handleHidden(item))\n );\n\n const handleClick = async (item: ActionButton) => {\n if (props.designState) return; // 在设计状态下不处理点击事件\n if (!item.onClick) return;\n try {\n await executeFunction({\n functionBody: item.onClick,\n context: props.ctx,\n params: props.scope\n });\n } catch (error) {\n console.error('Button click handler error:', error);\n }\n };\n\n const handleDisabled = (item: ActionButton): boolean => {\n if (!item.onDisabled) return false;\n\n try {\n return executeFunction({\n functionBody: item.onDisabled,\n context: props.ctx,\n params: props.scope\n });\n } catch (error) {\n console.error('Button disabled handler error:', error);\n return false;\n }\n };\n\n const handleHidden = (item: ActionButton): boolean => {\n if (!item.onHidden) return false;\n\n try {\n return executeFunction({\n functionBody: item.onHidden,\n context: props.ctx,\n params: props.scope\n });\n } catch (error) {\n console.error('Button hidden handler error:', error);\n return false;\n }\n };\n\n return {\n getContainer,\n isDisabled,\n containerStyle,\n visibleButtons,\n handleClick,\n handleDisabled\n };\n }\n });\n</script>\n\n<style lang=\"scss\" scoped>\n .button-list-container {\n flex: 1;\n display: flex;\n justify-content: var(--flex);\n\n .button-icon {\n margin-right: 4px;\n }\n }\n</style>\n"],"names":["_sfc_main","defineComponent","SvgIcon","props","containerStyle","computed","isDisabled","_a","ButtonPositionEnum","getContainer","visibleButtons","handleHidden","item","handleClick","executeFunction","error","handleDisabled"],"mappings":";;;;AAkCI,MAAAA,IAAeC,EAAgB;AAAA,EAC3B,MAAM;AAAA,EACN,YAAY,EAAE,SAAAC,EAAA;AAAA,EACd,OAAO;AAAA,IACH,SAAS;AAAA,MACL,MAAM;AAAA,MACN,SAAS,MAAM;AAAA,MAAC;AAAA,IAAA;AAAA,IAEpB,OAAO;AAAA,MACH,MAAM;AAAA,MACN,SAAS,MAAM;AAAA,MAAC;AAAA,IAAA;AAAA,IAEpB,KAAK;AAAA,MACD,MAAM;AAAA,IAA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A,UACf,QAAQA,EAAM;AAAA,QAAA,CACjB;AAAA,MACL,SAASY,GAAO;AACZ,uBAAQ,MAAM,kCAAkCA,CAAK,GAC9C;AAAA,MACX;AAAA,IACJ,GAEMJ,IAAe,CAACC,MAAgC;AAClD,UAAI,CAACA,EAAK,SAAU,QAAO;AAE3B,UAAI;AACA,eAAOE,EAAgB;AAAA,UACnB,cAAcF,EAAK;AAAA,UACnB,SAAST,EAAM;AAAA,UACf,QAAQA,EAAM;AAAA,QAAA,CACjB;AAAA,MACL,SAASY,GAAO;AACZ,uBAAQ,MAAM,gCAAgCA,CAAK,GAC5C;AAAA,MACX;AAAA,IACJ;AAEA,WAAO;AAAA,MACH,cAAAN;AAAA,MACA,YAAAH;AAAA,MACA,gBAAAF;AAAA,MACA,gBAAAM;AAAA,MACA,aAAAG;AAAA,MACA,gBAAAG;AAAA,IAAA;AAAA,EAER;AACJ,CAAC;"}
1
+ {"version":3,"file":"ActionButtonListRender.vue2.js","sources":["../../../../src/components/public/ActionButtonListRender.vue"],"sourcesContent":["<template>\n <div\n ref=\"fieldEditor\"\n :class=\"['button-list-container', ...customClass]\"\n :style=\"containerStyle\"\n >\n <Teleport :disabled=\"isDisabled\" :to=\"getContainer\">\n <a-space :size=\"8\">\n <a-button\n v-for=\"item in visibleButtons\"\n :key=\"item.key\"\n :type=\"item.type\"\n :danger=\"item.danger\"\n class=\"tpf-button\"\n :disabled=\"handleDisabled(item)\"\n @click=\"handleClick(item)\"\n >\n <template v-if=\"item.icon\">\n <SvgIcon :icon-class=\"item.icon\" class=\"button-icon\" />\n </template>\n {{ item.label }}\n </a-button>\n </a-space>\n </Teleport>\n </div>\n</template>\n\n<script lang=\"ts\">\n import { defineComponent, computed, PropType } from 'vue';\n import { executeFunction } from '@/utils/executeFunction';\n import SvgIcon from '@/components/svg-icon/index.vue';\n import type { ActionButton } from '@/types/button';\n import { ButtonPositionEnum } from '@/constants';\n\n export default defineComponent({\n name: 'ActionButtonListRender',\n components: { SvgIcon },\n props: {\n options: {\n type: Object,\n default: () => {}\n },\n scope: {\n type: Object,\n default: () => {}\n },\n ctx: {\n type: Object\n },\n buttonList: {\n type: Array as PropType<ActionButton[]>,\n default: () => []\n },\n customClass: {\n type: Array as PropType<string[]>,\n default: () => []\n },\n flex: {\n type: String,\n default: 'center'\n },\n designState: {\n type: Boolean,\n default: false\n }\n },\n setup(props) {\n const containerStyle = computed(() => ({\n '--flex': props.flex\n }));\n\n const isDisabled = computed(\n () => props.options?.buttonPosition !== ButtonPositionEnum.DIY || props.designState\n );\n\n const getContainer = computed(() =>\n isDisabled.value ? null : props.options?.getContainer\n );\n\n console.log({ isDisabled: isDisabled.value, getContainer: getContainer.value });\n\n const visibleButtons = computed(() =>\n props.buttonList.filter(item => !handleHidden(item))\n );\n\n const handleClick = async (item: ActionButton) => {\n if (props.designState) return; // 在设计状态下不处理点击事件\n if (!item.onClick) return;\n try {\n await executeFunction({\n functionBody: item.onClick,\n context: props.ctx,\n params: props.scope\n });\n } catch (error) {\n console.error('Button click handler error:', error);\n }\n };\n\n const handleDisabled = (item: ActionButton): boolean => {\n if (!item.onDisabled) return false;\n\n try {\n return executeFunction({\n functionBody: item.onDisabled,\n context: props.ctx,\n params: props.scope\n });\n } catch (error) {\n console.error('Button disabled handler error:', error);\n return false;\n }\n };\n\n const handleHidden = (item: ActionButton): boolean => {\n if (!item.onHidden) return false;\n\n try {\n return executeFunction({\n functionBody: item.onHidden,\n context: props.ctx,\n params: props.scope\n });\n } catch (error) {\n console.error('Button hidden handler error:', error);\n return false;\n }\n };\n\n return {\n getContainer,\n isDisabled,\n containerStyle,\n visibleButtons,\n handleClick,\n handleDisabled\n };\n }\n });\n</script>\n\n<style lang=\"scss\" scoped>\n .button-list-container {\n flex: 1;\n display: flex;\n justify-content: var(--flex);\n\n .button-icon {\n margin-right: 4px;\n }\n }\n</style>\n"],"names":["_sfc_main","defineComponent","SvgIcon","props","containerStyle","computed","isDisabled","_a","ButtonPositionEnum","getContainer","visibleButtons","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