slw 1.0.0-rc.1.8 → 1.0.0-rc.2

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