slw 0.9.23 → 0.9.30

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,1098 @@
1
+ import { pushScopeId as P, popScopeId as V, createElementVNode as h, resolveComponent as g, openBlock as o, createElementBlock as p, createBlock as f, normalizeClass as T, normalizeStyle as A, withModifiers as R, withCtx as r, renderSlot as q, createCommentVNode as _, Fragment as B, createVNode as s, mergeProps as k, renderList as j, toDisplayString as E, normalizeProps as K, guardReactiveProps as Q, resolveDynamicComponent as Z, defineAsyncComponent as $, computed as F, unref as D, withDirectives as ee, vShow as te } from "vue";
2
+ import { _ as x, d as S, a as L, u as N } from "./index-f96faa83.js";
3
+ const I = {
4
+ computed: {},
5
+ methods: {
6
+ // 选中组件
7
+ selectField(e) {
8
+ e.itemRender && e.itemRender.children || e.buttonRender && e.buttonRender.name == "toolBarTitle" || this.designer.setSelected(e);
9
+ },
10
+ // 选中容器
11
+ selectWidget(e) {
12
+ this.designer.setSelected(e);
13
+ },
14
+ // 选中父组件
15
+ selectParentWidget() {
16
+ this.designer.setSelected(this.designer.selectedWidgetParent);
17
+ },
18
+ // 删除
19
+ removeFieldWidget() {
20
+ const e = this.designer.selectedWidget.id;
21
+ this.$nextTick(() => {
22
+ let t = this.parentWidget.findIndex((i) => i.id === e);
23
+ t >= 0 && (this.parentWidget.splice(t, 1), this.designer.selectedConfigType ? delete this.designer.designerConfig[this.rootWidgetId][this.designer.selectedConfigType][e] : (delete this.designer.designerConfig[e], delete this.designer.designerConfig[e + "LAYOUT"]), this.designer.clearSelected());
24
+ });
25
+ },
26
+ // 匹配新加组件类型,生成对应类型配置
27
+ switchFieldType(e, t) {
28
+ switch (e.type) {
29
+ case "ElSelect":
30
+ t.itemRender.attrs.style = "min-width: 120px;max-width:100%", t.itemRender.props.filterable = !0, e.options.multiple && (t.itemRender.props.multiple = !0, t.itemRender.props["collapse-tags"] = !0, t.itemRender.props["collapse-tags-tooltip"] = !0), e.options && e.options.optionItems && (t.itemRender.options = e.options.optionItems.map((i) => Object.assign(
31
+ {
32
+ value: i.value,
33
+ label: i.label
34
+ },
35
+ i
36
+ )));
37
+ break;
38
+ case "ElSwitch":
39
+ break;
40
+ case "ElInputNumber":
41
+ t.itemRender.props.type = "number";
42
+ break;
43
+ case "ElDatePicker":
44
+ t.itemRender.attrs.style = "width: 100%;", e.options.type == "date" ? t.itemRender.props = {
45
+ ...t.itemRender.props,
46
+ type: "date",
47
+ valueFormat: "YYYY-MM-DD"
48
+ } : t.itemRender.props = {
49
+ ...t.itemRender.props,
50
+ type: "daterange",
51
+ valueFormat: "YYYY-MM-DD",
52
+ isRange: !0
53
+ };
54
+ break;
55
+ case "ElTimePicker":
56
+ t.itemRender.attrs.style = "width: 100%;", e.options.type == "time" ? t.itemRender.props = {
57
+ ...t.itemRender.props,
58
+ type: "datetime",
59
+ valueFormat: "YYYY-MM-DD HH:mm:ss"
60
+ } : t.itemRender.props = {
61
+ ...t.itemRender.props,
62
+ type: "datetimerange",
63
+ valueFormat: "YYYY-MM-DD HH:mm:ss",
64
+ isRange: !0
65
+ };
66
+ break;
67
+ case "ElInput":
68
+ t.itemRender.props.type = e.options.type;
69
+ break;
70
+ }
71
+ return t;
72
+ },
73
+ // 表格工具栏新增组件事件
74
+ onDragToolbarAdd(e) {
75
+ let t = e.item._underlying_vm_;
76
+ if (t.type != "ElButton" || t.code) {
77
+ for (let n in this.designer.designerConfig)
78
+ this.designer.designerConfig[n].btnConfig && this.designer.designerConfig[n].btnConfig[t.id] && n != this.widget.id && (this.designer.designerConfig[this.widget.id].btnConfig[t.id] = deepClone(
79
+ this.designer.designerConfig[n].btnConfig[t.id]
80
+ ), delete this.designer.designerConfig[n].btnConfig[t.id]);
81
+ this.designer.emitHistoryChange();
82
+ return;
83
+ }
84
+ let i;
85
+ this.toolbarConfig.forEach((n, d) => {
86
+ n.id == t.id && (i = d);
87
+ });
88
+ let l = {
89
+ type: "NEW",
90
+ code: "NEW",
91
+ name: "新增",
92
+ iconComponent: "Add",
93
+ viewType: "primary",
94
+ visible: !0,
95
+ icon: null,
96
+ id: t.id,
97
+ _button_id: null,
98
+ _region_id: null,
99
+ clickFunction: null,
100
+ displayLogic: null,
101
+ showInGrid: null,
102
+ requestPath: null,
103
+ windowId: null,
104
+ css: "",
105
+ openWidth: null,
106
+ openHeight: null,
107
+ loading: !1,
108
+ btnLoad: {},
109
+ // 在表格中的按钮是否显示加载状态的双向绑定对象
110
+ btnShowInGrid: {},
111
+ // 在表格中的按钮是否显示的双向绑定对象
112
+ btnShow: {},
113
+ // 按钮在工具栏的显示状态
114
+ isNew: !0
115
+ // 所有新加组件都新增一个isNew字段,用来与原有组件作区分,判断是否为新增组件
116
+ };
117
+ this.toolbarConfig.splice(i, 1, l), this.designer.newWidgetInitConfig(this.widget.gridData.id, "btnConfig", l), this.designer.emitHistoryChange();
118
+ },
119
+ // 新增表单项配置
120
+ addFormItemConfig(e) {
121
+ return {
122
+ field: e.field,
123
+ // 新增组件时如果未进行配置选择引用字段
124
+ folding: !1,
125
+ // 默认收起
126
+ id: e.id,
127
+ itemRender: {
128
+ name: e.type,
129
+ props: {
130
+ placeholder: "请输入",
131
+ size: "default",
132
+ clearable: !0,
133
+ filterable: !0
134
+ },
135
+ defaultValue: "",
136
+ events: {
137
+ "on-change": function() {
138
+ },
139
+ change: function() {
140
+ }
141
+ },
142
+ attrs: {}
143
+ },
144
+ name: e.name,
145
+ title: e.name,
146
+ visible: !0,
147
+ displayForm: !0,
148
+ // 新增到表单的基础组件都添加 displayForm 属性 用来与表格里的表单组件作区分
149
+ isNew: !0
150
+ // 所有新加组件都新增一个isNew字段,用来与原有组件作区分,判断是否为新增组件
151
+ };
152
+ }
153
+ }
154
+ };
155
+ const ie = {
156
+ name: "container-wrapper",
157
+ mixins: [I],
158
+ components: {},
159
+ props: {
160
+ widget: Object,
161
+ designer: Object,
162
+ parentWidget: Array,
163
+ // 删除函数调用
164
+ height: [String, Number]
165
+ },
166
+ computed: {
167
+ // 点击选中组件
168
+ selected() {
169
+ return (e) => e.mode != null && e.gridData ? e.id + "LAYOUT" === this.designer.selectedId : e.id === this.designer.selectedId;
170
+ },
171
+ // 如果是表格或表单,则隐藏删除与拖拽按钮 只允许通过其外层的布局组件删除和拖拽
172
+ isHide() {
173
+ return (e, t) => {
174
+ if (t == "back" && e.mode == null)
175
+ return !0;
176
+ if (t == "delete" || t == "drag")
177
+ return e.mode != null;
178
+ };
179
+ }
180
+ }
181
+ }, M = (e) => (P("data-v-a5ec9eee"), e = e(), V(), e), ne = { class: "container-wrapper" }, de = {
182
+ key: 0,
183
+ class: "container-action"
184
+ }, re = /* @__PURE__ */ M(() => /* @__PURE__ */ h("i", { class: "iconfont icon-back" }, null, -1)), oe = [
185
+ re
186
+ ], se = /* @__PURE__ */ M(() => /* @__PURE__ */ h("i", { class: "iconfont icon-delete" }, null, -1)), ae = [
187
+ se
188
+ ], le = {
189
+ key: 1,
190
+ class: "drag-handler"
191
+ }, ge = /* @__PURE__ */ M(() => /* @__PURE__ */ h("i", { title: "拖拽手柄" }, [
192
+ /* @__PURE__ */ h("i", { class: "iconfont icon-drag" })
193
+ ], -1)), ce = [
194
+ ge
195
+ ];
196
+ function ue(e, t, i, l, n, d) {
197
+ const c = g("el-row");
198
+ return o(), p("div", ne, [
199
+ (o(), f(c, {
200
+ key: i.widget.id,
201
+ class: T(["vxe-grid-container", [d.selected(i.widget) ? "selected" : ""]]),
202
+ style: A({ height: i.height + "px", overflow: "auto" }),
203
+ onClick: t[0] || (t[0] = R((v) => e.selectWidget(i.widget), ["stop"]))
204
+ }, {
205
+ default: r(() => [
206
+ q(e.$slots, "default", {}, void 0, !0)
207
+ ]),
208
+ _: 3
209
+ }, 8, ["class", "style"])),
210
+ d.selected(i.widget) ? (o(), p("div", de, [
211
+ d.isHide(i.widget, "back") ? (o(), p("i", {
212
+ key: 0,
213
+ title: "选中布局",
214
+ onClick: t[1] || (t[1] = R((v) => e.selectParentWidget(i.widget), ["stop"]))
215
+ }, oe)) : _("", !0),
216
+ d.isHide(i.widget, "delete") ? (o(), p("i", {
217
+ key: 1,
218
+ title: "移除组件",
219
+ onClick: t[2] || (t[2] = R((...v) => e.removeFieldWidget && e.removeFieldWidget(...v), ["stop"]))
220
+ }, ae)) : _("", !0)
221
+ ])) : _("", !0),
222
+ d.selected(i.widget) && d.isHide(i.widget, "drag") ? (o(), p("div", le, ce)) : _("", !0)
223
+ ]);
224
+ }
225
+ const O = /* @__PURE__ */ x(ie, [["render", ue], ["__scopeId", "data-v-a5ec9eee"]]);
226
+ const pe = {
227
+ name: "static-content-wrapper",
228
+ mixins: [I],
229
+ components: {},
230
+ props: {
231
+ field: Object,
232
+ designer: Object,
233
+ parentWidget: Array,
234
+ // 删除函数调用
235
+ rootWidgetId: String,
236
+ // 删除函数调用
237
+ width: {
238
+ type: String
239
+ }
240
+ },
241
+ computed: {
242
+ selected() {
243
+ return !!this.designer && this.field.id === this.designer.selectedId;
244
+ },
245
+ isHide() {
246
+ return () => this.field.displayForm == null ? !this.field.visible : !this.field.displayForm;
247
+ }
248
+ },
249
+ watch: {
250
+ field: {
251
+ deep: !0,
252
+ immediate: !0,
253
+ handler(e) {
254
+ }
255
+ }
256
+ },
257
+ methods: {}
258
+ }, H = (e) => (P("data-v-6617c757"), e = e(), V(), e), me = {
259
+ key: 0,
260
+ class: "field-action"
261
+ }, fe = /* @__PURE__ */ H(() => /* @__PURE__ */ h("i", { class: "iconfont icon-delete" }, null, -1)), he = [
262
+ fe
263
+ ], _e = {
264
+ key: 1,
265
+ class: "drag-handler background-opacity"
266
+ }, we = /* @__PURE__ */ H(() => /* @__PURE__ */ h("i", { title: "拖拽手柄" }, [
267
+ /* @__PURE__ */ h("i", { class: "iconfont icon-drag" })
268
+ ], -1)), ve = {
269
+ key: 0,
270
+ title: "隐藏"
271
+ }, ye = /* @__PURE__ */ H(() => /* @__PURE__ */ h("i", { class: "iconfont icon-hide" }, null, -1)), Ce = [
272
+ ye
273
+ ];
274
+ function be(e, t, i, l, n, d) {
275
+ return o(), p("div", {
276
+ class: "field-wrapper",
277
+ style: A({ "flex-basis": i.width })
278
+ }, [
279
+ h("div", {
280
+ class: T(["static-content-item", [d.selected ? "selected" : ""]]),
281
+ onClick: t[0] || (t[0] = R((c) => e.selectField(i.field), ["stop"]))
282
+ }, [
283
+ q(e.$slots, "default", {}, void 0, !0)
284
+ ], 2),
285
+ this.designer ? (o(), p(B, { key: 0 }, [
286
+ i.designer.selectedId === i.field.id ? (o(), p("div", me, [
287
+ h("i", {
288
+ title: "移除组件",
289
+ onClick: t[1] || (t[1] = R((...c) => e.removeFieldWidget && e.removeFieldWidget(...c), ["stop"]))
290
+ }, he)
291
+ ])) : _("", !0),
292
+ i.designer.selectedId === i.field.id ? (o(), p("div", _e, [
293
+ we,
294
+ d.isHide() ? (o(), p("i", ve, Ce)) : _("", !0)
295
+ ])) : _("", !0)
296
+ ], 64)) : _("", !0)
297
+ ], 4);
298
+ }
299
+ const U = /* @__PURE__ */ x(pe, [["render", be], ["__scopeId", "data-v-6617c757"]]);
300
+ const We = {
301
+ name: "grid-widget",
302
+ componentName: "ContainerWidget",
303
+ mixins: [I],
304
+ inject: [],
305
+ components: {
306
+ ContainerWrapper: O,
307
+ StaticContentWrapper: U,
308
+ draggable: S
309
+ },
310
+ props: {
311
+ widget: Object,
312
+ designer: Object,
313
+ parentWidget: Array
314
+ // 删除组件时调用
315
+ },
316
+ data() {
317
+ return {
318
+ formBtnConfig: [],
319
+ toolbarConfig: [],
320
+ showButtons: []
321
+ };
322
+ },
323
+ computed: {
324
+ // toolbar buttons按钮配置
325
+ btnRender() {
326
+ return (e) => ({
327
+ name: "ElButton",
328
+ props: {
329
+ autoInsertSpace: !0,
330
+ // 自动在两个中文字符之间插入空格
331
+ content: e.name,
332
+ icon: e.iconComponent,
333
+ nativeType: "submit",
334
+ size: "default",
335
+ type: e.viewType
336
+ }
337
+ });
338
+ },
339
+ // 按钮绑定属性
340
+ operationButton(e) {
341
+ return (t) => ({
342
+ size: "small",
343
+ type: t.viewType,
344
+ // style: { ...btnItem.css, marginLeft: "0px" }, // 如果btnItem.css有数据,则会报错,原因未知
345
+ icon: null,
346
+ // 使用自定义iconComponent,该属性就必须为null
347
+ text: !0,
348
+ iconComponent: t.iconComponent,
349
+ round: t.shape === "round",
350
+ circle: t.shape === "circle",
351
+ loading: t.loading,
352
+ shape: t.shape
353
+ });
354
+ },
355
+ computeGridHeight() {
356
+ let e = window.innerHeight - 40 - 50 - 42 - 20 - 64;
357
+ return e < this.widget.height ? e : this.widget.height;
358
+ }
359
+ },
360
+ watch: {
361
+ "widget.gridData.toolbarConfig": {
362
+ handler(e) {
363
+ if (e.buttons.forEach((t) => {
364
+ t.hasOwnProperty("buttonRender") || (t.buttonRender = {
365
+ name: "ElButton",
366
+ props: {
367
+ size: "default",
368
+ type: t.viewType,
369
+ style: t.css,
370
+ icon: t.icon,
371
+ iconComponent: t.iconComponent,
372
+ round: t.shape === "round",
373
+ circle: t.shape === "circle",
374
+ shape: t.shape
375
+ },
376
+ events: {}
377
+ // click: toolBarButtonClick
378
+ });
379
+ }), this.showButtons = e.buttons.filter((t) => t.showInGrid == "Y" || t.showInGrid === !0), this.showButtons.length > 0) {
380
+ this.widget.gridData.data = [];
381
+ let t = {};
382
+ this.widget.gridData.columns.forEach((i) => {
383
+ i.type !== "seq" && i.type !== "checkbox" && i.fixed !== "left" && (t[i.field] = void 0);
384
+ }), this.widget.gridData.data.push(t);
385
+ }
386
+ this.toolbarConfig = e.buttons;
387
+ },
388
+ deep: !0,
389
+ immediate: !0
390
+ },
391
+ "widget.gridData.formConfig.items": {
392
+ handler(e) {
393
+ this.formBtnConfig = e;
394
+ },
395
+ deep: !0
396
+ },
397
+ "widget.gridData.columns": {
398
+ handler(e) {
399
+ this.$refs.curRegion && this.$refs.curRegion.loadColumn(e);
400
+ },
401
+ deep: !0
402
+ },
403
+ // 监听表格表单的数组长度,来 删除 / 新增 默认的查询与重置按钮
404
+ formBtnConfig: {
405
+ handler(e) {
406
+ let t = this.widget.gridData.formConfig.items.findIndex((i) => i.align == "right");
407
+ t < 0 && e.length > 0 ? this.widget.gridData.formConfig.items.push({
408
+ align: "right",
409
+ collapseNode: !1,
410
+ itemRender: {
411
+ name: "ElButtons",
412
+ children: [
413
+ {
414
+ props: {
415
+ "native-type": "submit",
416
+ type: "primary",
417
+ content: "查询",
418
+ iconComponent: "Search",
419
+ size: "default",
420
+ autoInsertSpace: !0
421
+ }
422
+ },
423
+ {
424
+ props: {
425
+ "native-type": "reset",
426
+ content: "重置",
427
+ iconComponent: "Refresh",
428
+ size: "default",
429
+ autoInsertSpace: !0
430
+ }
431
+ }
432
+ ]
433
+ },
434
+ visible: !0
435
+ }) : t >= 0 && e.length == 1 && this.widget.gridData.formConfig.items.splice(t, 1);
436
+ },
437
+ deep: !0
438
+ }
439
+ },
440
+ created() {
441
+ this.formBtnConfig = this.widget.gridData.formConfig.items, this.toolbarConfig = this.widget.gridData.toolbarConfig.buttons;
442
+ },
443
+ mounted() {
444
+ },
445
+ methods: {
446
+ // 自定义控制那些元素可以拖拽或不允许拖拽
447
+ checkFieldMove(e) {
448
+ return this.designer.checkFieldMove(e);
449
+ },
450
+ // 表单新增组件事件
451
+ onDragFormAdd(e) {
452
+ let t = e.item._underlying_vm_;
453
+ if (t.itemRender) {
454
+ for (let n in this.designer.designerConfig)
455
+ this.designer.designerConfig[n].queryConfig && this.designer.designerConfig[n].queryConfig[t.id] && n != this.widget.id && (this.designer.designerConfig[this.widget.id].queryConfig[t.id] = L(this.designer.designerConfig[n].queryConfig[t.id]), delete this.designer.designerConfig[n].queryConfig[t.id]);
456
+ this.designer.emitHistoryChange();
457
+ return;
458
+ }
459
+ let i;
460
+ this.formBtnConfig.forEach((n, d) => {
461
+ n.id == t.id && (i = d);
462
+ });
463
+ let l = this.addFormItemConfig(t);
464
+ l = this.switchFieldType(t, l), this.formBtnConfig.splice(i, 1, l), this.designer.newWidgetInitConfig(this.widget.gridData.id, "queryConfig", l), this.designer.emitHistoryChange();
465
+ }
466
+ }
467
+ };
468
+ const De = {
469
+ key: 0,
470
+ class: "toolBar-title"
471
+ }, ke = {
472
+ key: 0,
473
+ style: { verticalAlign: "middle" }
474
+ };
475
+ function Re(e, t, i, l, n, d) {
476
+ const c = g("vxe-form-item"), v = g("vxe-form"), C = g("StaticContentWrapper"), b = g("draggable"), y = g("el-icon"), u = g("el-tooltip"), a = g("el-button"), m = g("vxe-grid"), G = g("el-col"), z = g("container-wrapper");
477
+ return o(), f(z, {
478
+ designer: i.designer,
479
+ widget: i.widget,
480
+ parentWidget: i.parentWidget
481
+ }, {
482
+ default: r(() => [
483
+ s(G, { class: "grid-cell" }, {
484
+ default: r(() => [
485
+ s(z, {
486
+ designer: i.designer,
487
+ widget: i.widget.gridData
488
+ }, {
489
+ default: r(() => [
490
+ s(G, { class: "grid-cell" }, {
491
+ default: r(() => [
492
+ s(m, k({
493
+ ref: "curRegion",
494
+ "keep-source": ""
495
+ }, i.widget.gridData, { height: d.computeGridHeight }), {
496
+ form: r(() => [
497
+ s(b, k({
498
+ list: n.formBtnConfig,
499
+ "item-key": "id"
500
+ }, {
501
+ group: "dragGroup",
502
+ ghostClass: "ghost",
503
+ animation: 300
504
+ }, {
505
+ "component-data": {
506
+ name: "fade",
507
+ class: "transition-group field formBtnConfig"
508
+ },
509
+ handle: ".drag-handler",
510
+ tag: "div",
511
+ onAdd: d.onDragFormAdd,
512
+ move: d.checkFieldMove
513
+ }), {
514
+ item: r(({ element: w }) => [
515
+ s(C, {
516
+ designer: i.designer,
517
+ field: w,
518
+ parentWidget: n.formBtnConfig,
519
+ rootWidgetId: i.widget.id
520
+ }, {
521
+ default: r(() => [
522
+ s(v, null, {
523
+ default: r(() => [
524
+ w.itemRender && w.itemRender.name == "ElButtons" ? (o(!0), p(B, { key: 0 }, j(w.itemRender.children, (Y) => (o(), f(c, {
525
+ "item-render": {
526
+ name: "ElButton",
527
+ props: Y.props
528
+ },
529
+ visible: w.visible
530
+ }, null, 8, ["item-render", "visible"]))), 256)) : (o(), f(c, {
531
+ key: 1,
532
+ field: w.field,
533
+ title: w.title,
534
+ "title-overflow": "tooltip",
535
+ "item-render": w.itemRender
536
+ }, null, 8, ["field", "title", "item-render"]))
537
+ ]),
538
+ _: 2
539
+ }, 1024)
540
+ ]),
541
+ _: 2
542
+ }, 1032, ["designer", "field", "parentWidget", "rootWidgetId"])
543
+ ]),
544
+ _: 1
545
+ }, 16, ["list", "onAdd", "move"])
546
+ ]),
547
+ toolbar_buttons: r(() => [
548
+ s(b, k({
549
+ list: n.toolbarConfig,
550
+ "item-key": "id"
551
+ }, {
552
+ group: "dragGroup",
553
+ ghostClass: "ghost",
554
+ animation: 300
555
+ }, {
556
+ "component-data": {
557
+ name: "fade",
558
+ class: "transition-group field toolbar"
559
+ },
560
+ handle: ".drag-handler",
561
+ tag: "div",
562
+ onAdd: e.onDragToolbarAdd,
563
+ move: d.checkFieldMove
564
+ }), {
565
+ item: r(({ element: w }) => [
566
+ s(C, {
567
+ designer: i.designer,
568
+ field: w,
569
+ parentWidget: n.toolbarConfig,
570
+ rootWidgetId: i.widget.id
571
+ }, {
572
+ default: r(() => [
573
+ w.buttonRender && w.buttonRender.name == "toolBarTitle" ? (o(), p("span", De, E(w.name), 1)) : (o(), f(v, { key: 1 }, {
574
+ default: r(() => [
575
+ s(c, {
576
+ "item-render": d.btnRender(w)
577
+ }, null, 8, ["item-render"])
578
+ ]),
579
+ _: 2
580
+ }, 1024))
581
+ ]),
582
+ _: 2
583
+ }, 1032, ["designer", "field", "parentWidget", "rootWidgetId"])
584
+ ]),
585
+ _: 1
586
+ }, 16, ["list", "onAdd", "move"])
587
+ ]),
588
+ operation: r(({ row: w, rowIndex: Y }) => [
589
+ (o(!0), p(B, null, j(n.showButtons, (W) => (o(), f(a, k({
590
+ key: W._button_id
591
+ }, d.operationButton(W)), {
592
+ icon: r(() => [
593
+ s(u, {
594
+ title: W.name,
595
+ content: W.name,
596
+ placement: "top"
597
+ }, {
598
+ default: r(() => [
599
+ s(y, K(Q({ size: 15, style: { verticalAlign: "middle" } })), {
600
+ default: r(() => [
601
+ (o(), f(Z(W.iconComponent)))
602
+ ]),
603
+ _: 2
604
+ }, 1040)
605
+ ]),
606
+ _: 2
607
+ }, 1032, ["title", "content"])
608
+ ]),
609
+ default: r(() => [
610
+ !W.iconComponent || typeof W.iconComponent > "u" ? (o(), p("span", ke, E(W.name), 1)) : _("", !0)
611
+ ]),
612
+ _: 2
613
+ }, 1040))), 128))
614
+ ]),
615
+ _: 1
616
+ }, 16, ["height"])
617
+ ]),
618
+ _: 1
619
+ })
620
+ ]),
621
+ _: 1
622
+ }, 8, ["designer", "widget"])
623
+ ]),
624
+ _: 1
625
+ })
626
+ ]),
627
+ _: 1
628
+ }, 8, ["designer", "widget", "parentWidget"]);
629
+ }
630
+ const X = /* @__PURE__ */ x(We, [["render", Re], ["__scopeId", "data-v-ee994d8d"]]);
631
+ const xe = {
632
+ name: "form-widget",
633
+ componentName: "FromWidget",
634
+ mixins: [I],
635
+ inject: [],
636
+ components: {
637
+ ContainerWrapper: O,
638
+ StaticContentWrapper: U,
639
+ draggable: S
640
+ },
641
+ props: {
642
+ widget: Object,
643
+ designer: Object,
644
+ parentWidget: Array
645
+ // 删除组件时调用
646
+ },
647
+ data() {
648
+ return {
649
+ formColumns: [],
650
+ editRules: []
651
+ };
652
+ },
653
+ computed: {
654
+ // toolbar buttons按钮配置
655
+ btnRender() {
656
+ return (e) => ({
657
+ name: "ElButton",
658
+ props: {
659
+ autoInsertSpace: !0,
660
+ // 自动在两个中文字符之间插入空格
661
+ content: e.name,
662
+ icon: e.iconComponent,
663
+ nativeType: "submit",
664
+ size: "default",
665
+ type: e.viewType
666
+ }
667
+ });
668
+ },
669
+ computeSpan() {
670
+ return (e) => e.dataType === "EDITOR" || e.dataType === "TEXT" ? 24 : e.fwidth ? Number(e.fwidth) > 24 ? 24 : Number(e.fwidth) : 12;
671
+ },
672
+ toolbarConfig() {
673
+ return this.widget.gridData.type == "FORM" ? this.widget.gridData.toolbarConfig.buttons.filter(
674
+ (e) => e.type != "DELETE" && e.type != "EDIT"
675
+ ) : this.widget.gridData.toolbarConfig.buttons;
676
+ }
677
+ },
678
+ watch: {
679
+ "widget.gridData.columns": {
680
+ handler(e) {
681
+ this.formColumns = e;
682
+ },
683
+ deep: !0
684
+ },
685
+ "widget.gridData.toolbarConfig": {
686
+ handler(e) {
687
+ e.buttons.forEach((t) => {
688
+ t.hasOwnProperty("buttonRender") || (t.buttonRender = {
689
+ name: "ElButton",
690
+ props: {
691
+ size: "default",
692
+ type: t.viewType,
693
+ style: t.css,
694
+ icon: t.icon,
695
+ iconComponent: t.iconComponent,
696
+ round: t.shape === "round",
697
+ circle: t.shape === "circle",
698
+ shape: t.shape
699
+ },
700
+ events: {}
701
+ // click: toolBarButtonClick
702
+ });
703
+ });
704
+ },
705
+ deep: !0,
706
+ immediate: !0
707
+ }
708
+ },
709
+ created() {
710
+ this.formColumns = this.widget.gridData.columns, this.editRules = this.widget.gridData.editRules, this.widget.gridData.toolbarConfig.buttons.forEach((e) => {
711
+ e.hasOwnProperty("buttonRender") || (e.buttonRender = {
712
+ name: "ElButton",
713
+ props: {
714
+ size: "default",
715
+ type: e.viewType,
716
+ style: e.css,
717
+ icon: e.icon,
718
+ iconComponent: e.iconComponent,
719
+ round: e.shape === "round",
720
+ circle: e.shape === "circle",
721
+ shape: e.shape
722
+ },
723
+ events: {}
724
+ // click: toolBarButtonClick
725
+ });
726
+ });
727
+ },
728
+ mounted() {
729
+ },
730
+ methods: {
731
+ // 自定义控制那些元素可以拖拽或不允许拖拽
732
+ checkFieldMove(e) {
733
+ return this.designer.checkFieldMove(e);
734
+ },
735
+ // 表单新增组件事件
736
+ onDragFormAdd(e) {
737
+ let t = e.item._underlying_vm_;
738
+ if (t.itemRender) {
739
+ for (let n in this.designer.designerConfig)
740
+ this.designer.designerConfig[n].fieldConfig && this.designer.designerConfig[n].fieldConfig[t.id] && n != this.widget.id && (this.designer.designerConfig[this.widget.id].fieldConfig[t.id] = L(
741
+ this.designer.designerConfig[n].fieldConfig[t.id]
742
+ ), delete this.designer.designerConfig[n].fieldConfig[t.id]);
743
+ this.designer.emitHistoryChange();
744
+ return;
745
+ }
746
+ let i;
747
+ this.formColumns.forEach((n, d) => {
748
+ n.id == t.id && (i = d);
749
+ });
750
+ let l = this.addFormItemConfig(t);
751
+ l = this.switchFieldType(t, l), this.formColumns.splice(i, 1, l), this.designer.newWidgetInitConfig(
752
+ this.widget.gridData.id,
753
+ "fieldConfig",
754
+ l
755
+ ), this.designer.emitHistoryChange();
756
+ }
757
+ }
758
+ };
759
+ const Ie = { class: "toolBar-title" }, Te = {
760
+ key: 1,
761
+ class: "no-widget-hint"
762
+ };
763
+ function Ee(e, t, i, l, n, d) {
764
+ const c = g("el-col"), v = g("vxe-form-item"), C = g("vxe-form"), b = g("StaticContentWrapper"), y = g("draggable"), u = g("container-wrapper");
765
+ return o(), f(u, {
766
+ designer: i.designer,
767
+ widget: i.widget,
768
+ parentWidget: i.parentWidget
769
+ }, {
770
+ default: r(() => [
771
+ s(c, { class: "grid-cell" }, {
772
+ default: r(() => [
773
+ s(u, {
774
+ designer: i.designer,
775
+ widget: i.widget.gridData,
776
+ height: i.widget.height
777
+ }, {
778
+ default: r(() => [
779
+ d.toolbarConfig.length > 0 && d.toolbarConfig[0].buttonRender && d.toolbarConfig[0].buttonRender.name == "toolBarTitle" ? (o(), f(c, {
780
+ key: 0,
781
+ class: "grid-cell"
782
+ }, {
783
+ default: r(() => [
784
+ h("span", Ie, E(d.toolbarConfig[0].name), 1)
785
+ ]),
786
+ _: 1
787
+ })) : _("", !0),
788
+ s(c, { class: "grid-cell" }, {
789
+ default: r(() => [
790
+ s(y, k({
791
+ list: n.formColumns,
792
+ "item-key": "id"
793
+ }, { group: "dragGroup", ghostClass: "ghost", animation: 300 }, {
794
+ "component-data": {
795
+ name: "fade",
796
+ class: "transition-group field formBtnConfig el-row"
797
+ },
798
+ handle: ".drag-handler",
799
+ tag: "div",
800
+ onAdd: d.onDragFormAdd,
801
+ move: d.checkFieldMove
802
+ }), {
803
+ item: r(({ element: a }) => [
804
+ a.type !== "seq" && a.type !== "checkbox" && a.fixed !== "left" && a.dataType !== "ID" && a.displayForm ? (o(), f(c, {
805
+ key: 0,
806
+ class: "grid-cell",
807
+ span: d.computeSpan(a)
808
+ }, {
809
+ default: r(() => [
810
+ s(b, {
811
+ designer: i.designer,
812
+ field: a,
813
+ parentWidget: n.formColumns,
814
+ rootWidgetId: i.widget.id
815
+ }, {
816
+ default: r(() => [
817
+ s(C, {
818
+ rules: n.editRules,
819
+ "title-align": "right",
820
+ "title-width": "120"
821
+ }, {
822
+ default: r(() => [
823
+ s(v, {
824
+ field: a.field,
825
+ title: a.title,
826
+ "title-overflow": "tooltip",
827
+ "item-render": a.itemRender,
828
+ "title-prefix": a.titlePrefix,
829
+ style: A(a.style)
830
+ }, null, 8, ["field", "title", "item-render", "title-prefix", "style"])
831
+ ]),
832
+ _: 2
833
+ }, 1032, ["rules"])
834
+ ]),
835
+ _: 2
836
+ }, 1032, ["designer", "field", "parentWidget", "rootWidgetId"])
837
+ ]),
838
+ _: 2
839
+ }, 1032, ["span"])) : _("", !0)
840
+ ]),
841
+ _: 1
842
+ }, 16, ["list", "onAdd", "move"])
843
+ ]),
844
+ _: 1
845
+ }),
846
+ s(c, { class: "grid-cell" }, {
847
+ default: r(() => [
848
+ s(y, k({
849
+ list: d.toolbarConfig,
850
+ "item-key": "id"
851
+ }, { group: "dragGroup", ghostClass: "ghost", animation: 300 }, {
852
+ "component-data": {
853
+ name: "fade",
854
+ class: "transition-group field toolbar"
855
+ },
856
+ handle: ".drag-handler",
857
+ tag: "div",
858
+ onAdd: e.onDragToolbarAdd,
859
+ move: d.checkFieldMove
860
+ }), {
861
+ item: r(({ element: a }) => [
862
+ !a.buttonRender || a.buttonRender && a.buttonRender.name != "toolBarTitle" ? (o(), f(b, {
863
+ key: 0,
864
+ designer: i.designer,
865
+ field: a,
866
+ parentWidget: d.toolbarConfig,
867
+ rootWidgetId: i.widget.id
868
+ }, {
869
+ default: r(() => [
870
+ s(C, null, {
871
+ default: r(() => [
872
+ s(v, {
873
+ "item-render": d.btnRender(a),
874
+ visible: a.code != null
875
+ }, null, 8, ["item-render", "visible"])
876
+ ]),
877
+ _: 2
878
+ }, 1024)
879
+ ]),
880
+ _: 2
881
+ }, 1032, ["designer", "field", "parentWidget", "rootWidgetId"])) : _("", !0)
882
+ ]),
883
+ _: 1
884
+ }, 16, ["list", "onAdd", "move"])
885
+ ]),
886
+ _: 1
887
+ }),
888
+ n.formColumns.length === 0 ? (o(), p("div", Te, " 请从左侧列表中选择基础字段, 然后用鼠标拖动组件放置于此处 ")) : _("", !0)
889
+ ]),
890
+ _: 1
891
+ }, 8, ["designer", "widget", "height"])
892
+ ]),
893
+ _: 1
894
+ })
895
+ ]),
896
+ _: 1
897
+ }, 8, ["designer", "widget", "parentWidget"]);
898
+ }
899
+ const J = /* @__PURE__ */ x(xe, [["render", Ee], ["__scopeId", "data-v-02ba7b3e"]]);
900
+ const Ae = {
901
+ name: "grid-layout-wrapper",
902
+ componentName: "GridLayouWrapper",
903
+ mixins: [I],
904
+ inject: {},
905
+ components: {
906
+ ContainerWrapper: O,
907
+ VxeGridWidget: X,
908
+ VxeFormWidget: J,
909
+ draggable: S,
910
+ WindowGrid: $(() => Promise.resolve().then(() => Pe))
911
+ },
912
+ props: {
913
+ widget: Object,
914
+ designer: Object
915
+ },
916
+ data() {
917
+ return {};
918
+ },
919
+ computed: {},
920
+ watch: {
921
+ widget: {
922
+ handler(e) {
923
+ e.child.length > 0 && e.child.findIndex((i) => i.isActive) < 0 && (e.child[0].isActive = !0);
924
+ },
925
+ immediate: !0,
926
+ deep: !0
927
+ }
928
+ },
929
+ created() {
930
+ },
931
+ mounted() {
932
+ },
933
+ methods: {
934
+ selectTabpane(e) {
935
+ this.widget.child.forEach((t) => {
936
+ delete t.isActive, t.id == e && (t.isActive = !0);
937
+ });
938
+ },
939
+ // 在tabs中添加tabpane时触发
940
+ onDragAdd(e) {
941
+ let t = e.item._underlying_vm_;
942
+ this.designer.newWidgetInitConfig(this.widget.id, "layout", t);
943
+ },
944
+ // 拖拽变换位置时触发的事件
945
+ onDragUpdate() {
946
+ },
947
+ // 自定义控制那些元素可以拖拽或不允许拖拽并控制是否允许停靠
948
+ onMove(e) {
949
+ return this.designer.checkWidgetMove(e);
950
+ }
951
+ }
952
+ };
953
+ const Se = {
954
+ key: 0,
955
+ class: "no-widget-hint"
956
+ }, Be = {
957
+ key: 2,
958
+ class: "el-tabs el-tabs--tops"
959
+ }, Me = { class: "el-tabs__header" }, Oe = { class: "transition-group-el" }, He = ["onClick"], Ge = {
960
+ key: 0,
961
+ class: "el-tabs__content"
962
+ };
963
+ function ze(e, t, i, l, n, d) {
964
+ const c = g("WindowGrid"), v = g("draggable"), C = g("el-col"), b = g("container-wrapper");
965
+ return o(), f(b, {
966
+ designer: i.designer,
967
+ widget: i.widget
968
+ }, {
969
+ default: r(() => [
970
+ s(C, { class: "grid-cell" }, {
971
+ default: r(() => [
972
+ i.widget.child.length === 0 && i.widget.gridData == null ? (o(), p("div", Se, "请从左侧列表中选择一个高级组件, 然后用鼠标拖动组件放置于此处")) : _("", !0),
973
+ i.widget.mode == "horizontal" || i.widget.mode === "vertical" ? (o(), f(c, {
974
+ key: 1,
975
+ preViewData: i.widget,
976
+ designer: i.designer
977
+ }, null, 8, ["preViewData", "designer"])) : (o(), p("div", Be, [
978
+ h("div", Me, [
979
+ h("div", {
980
+ class: T(["el-tabs__nav-wrap", { hideAfter: i.widget.child.length == 0 }])
981
+ }, [
982
+ s(v, {
983
+ list: i.widget.child,
984
+ "item-key": "id",
985
+ "ghost-class": "ghost",
986
+ group: "dragGroup",
987
+ animation: "300",
988
+ tag: "div",
989
+ "component-data": {
990
+ name: "fade",
991
+ class: "transition-group container tabpane-label"
992
+ },
993
+ handle: ".drag-handler",
994
+ onAdd: d.onDragAdd,
995
+ move: d.onMove
996
+ }, {
997
+ item: r(({ element: y }) => [
998
+ h("div", Oe, [
999
+ h("div", {
1000
+ class: T(["el-tabs__item", { "is-active": y.isActive }]),
1001
+ onClick: R((u) => d.selectTabpane(y.id), ["stop"])
1002
+ }, E(y.name), 11, He)
1003
+ ])
1004
+ ]),
1005
+ _: 1
1006
+ }, 8, ["list", "onAdd", "move"])
1007
+ ], 2)
1008
+ ]),
1009
+ i.widget.child.length > 0 ? (o(), p("div", Ge, [
1010
+ s(c, {
1011
+ preViewData: i.widget,
1012
+ designer: i.designer
1013
+ }, null, 8, ["preViewData", "designer"])
1014
+ ])) : _("", !0)
1015
+ ]))
1016
+ ]),
1017
+ _: 1
1018
+ })
1019
+ ]),
1020
+ _: 1
1021
+ }, 8, ["designer", "widget"]);
1022
+ }
1023
+ const Ye = /* @__PURE__ */ x(Ae, [["render", ze], ["__scopeId", "data-v-02273c28"]]);
1024
+ const je = { class: "form-widget-list" }, Fe = {
1025
+ __name: "index",
1026
+ props: {
1027
+ designer: Object,
1028
+ preViewData: Object
1029
+ },
1030
+ emits: ["update:designer", "update:preViewData"],
1031
+ setup(e, { emit: t }) {
1032
+ const i = e;
1033
+ let l = N(i, "designer", t), n = N(i, "preViewData", t);
1034
+ const d = F(() => {
1035
+ let u = "transition-group grid";
1036
+ return n.value.mode === "horizontal" && n.value.child.length > 0 && (u += " horizontal"), {
1037
+ name: "fade",
1038
+ class: u
1039
+ };
1040
+ }), c = F(() => {
1041
+ let u = {};
1042
+ return n.value.mode === "horizontal" && n.value.child.length > 0 && (u = { width: parseInt(100 / n.value.child.length) - 0.5 + "%" }), u;
1043
+ }), v = (u) => {
1044
+ let a = u.item._underlying_vm_;
1045
+ l.value.newWidgetInitConfig(n.value.id, "layout", a);
1046
+ }, C = (u) => {
1047
+ l.value.emitHistoryChange();
1048
+ }, b = (u) => l.value.checkWidgetMove(u), y = (u) => n.value.mode == "tab" ? !!u.isActive : !0;
1049
+ return (u, a) => (o(), p("div", je, [
1050
+ s(D(S), {
1051
+ list: D(n).child,
1052
+ "item-key": "id",
1053
+ "ghost-class": "ghost",
1054
+ group: "dragGroup",
1055
+ animation: "300",
1056
+ tag: "div",
1057
+ "component-data": d.value,
1058
+ handle: ".drag-handler",
1059
+ onAdd: v,
1060
+ onUpdate: C,
1061
+ move: b
1062
+ }, {
1063
+ item: r(({ element: m }) => [
1064
+ ee(h("div", {
1065
+ class: "transition-group-el",
1066
+ style: A(c.value)
1067
+ }, [
1068
+ m.gridData && (m.gridData.type === "GRID" || m.gridData.type === "TREE" || m.gridData.type === "TREE_STRUCTURE" || m.gridData.type === "EDIT_GRID") ? (o(), f(X, {
1069
+ key: 0,
1070
+ designer: D(l),
1071
+ widget: m,
1072
+ parentWidget: D(n).child
1073
+ }, null, 8, ["designer", "widget", "parentWidget"])) : m.gridData && m.gridData.type === "FORM" ? (o(), f(J, {
1074
+ key: 1,
1075
+ designer: D(l),
1076
+ widget: m,
1077
+ parentWidget: D(n).child
1078
+ }, null, 8, ["designer", "widget", "parentWidget"])) : m.mode == "horizontal" || m.mode === "vertical" || m.mode == "tab" ? (o(), f(Ye, {
1079
+ key: 2,
1080
+ designer: D(l),
1081
+ widget: m,
1082
+ parentWidget: D(n).child
1083
+ }, null, 8, ["designer", "widget", "parentWidget"])) : _("", !0)
1084
+ ], 4), [
1085
+ [te, y(m)]
1086
+ ])
1087
+ ]),
1088
+ _: 1
1089
+ }, 8, ["list", "component-data"])
1090
+ ]));
1091
+ }
1092
+ }, Ne = /* @__PURE__ */ x(Fe, [["__scopeId", "data-v-5cc15e60"]]), Pe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1093
+ __proto__: null,
1094
+ default: Ne
1095
+ }, Symbol.toStringTag, { value: "Module" }));
1096
+ export {
1097
+ Ne as default
1098
+ };