slw 1.0.0-beta.6 → 1.0.0-beta.8

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,1090 @@
1
+ import { resolveComponent as l, openBlock as s, createElementBlock as u, createBlock as m, normalizeClass as E, normalizeStyle as B, withModifiers as R, withCtx as o, renderSlot as F, createElementVNode as p, createCommentVNode as h, 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 S, a as N, u as z } from "./index-CdZCmbPc.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
588
+ }, n.operationButton(b)), {
589
+ icon: o(() => [
590
+ a(W, {
591
+ title: b.name,
592
+ content: b.name,
593
+ placement: "top"
594
+ }, {
595
+ default: o(() => [
596
+ a(y, k({ ref_for: !0 }, { size: 15, style: { verticalAlign: "middle" } }), {
597
+ default: o(() => [
598
+ (s(), m(L(b.iconComponent)))
599
+ ]),
600
+ _: 2
601
+ }, 1040)
602
+ ]),
603
+ _: 2
604
+ }, 1032, ["title", "content"])
605
+ ]),
606
+ default: o(() => [
607
+ !b.iconComponent || typeof b.iconComponent > "u" ? (s(), u("span", ae, A(b.name), 1)) : h("", !0)
608
+ ]),
609
+ _: 2
610
+ }, 1040))), 128))
611
+ ]),
612
+ _: 1
613
+ }, 16, ["height"])
614
+ ]),
615
+ _: 1
616
+ })
617
+ ]),
618
+ _: 1
619
+ }, 8, ["designer", "widget"])
620
+ ]),
621
+ _: 1
622
+ })
623
+ ]),
624
+ _: 1
625
+ }, 8, ["designer", "widget", "parentWidget"]);
626
+ }
627
+ const P = /* @__PURE__ */ x(oe, [["render", le], ["__scopeId", "data-v-ee994d8d"]]), ge = {
628
+ name: "form-widget",
629
+ componentName: "FromWidget",
630
+ mixins: [I],
631
+ inject: [],
632
+ components: {
633
+ ContainerWrapper: O,
634
+ StaticContentWrapper: V,
635
+ draggable: S
636
+ },
637
+ props: {
638
+ widget: Object,
639
+ designer: Object,
640
+ parentWidget: Array
641
+ // 删除组件时调用
642
+ },
643
+ data() {
644
+ return {
645
+ formColumns: [],
646
+ editRules: []
647
+ };
648
+ },
649
+ computed: {
650
+ // toolbar buttons按钮配置
651
+ btnRender() {
652
+ return (t) => ({
653
+ name: "ElButton",
654
+ props: {
655
+ autoInsertSpace: !0,
656
+ // 自动在两个中文字符之间插入空格
657
+ content: t.name,
658
+ icon: t.iconComponent,
659
+ nativeType: "submit",
660
+ size: "default",
661
+ type: t.viewType
662
+ }
663
+ });
664
+ },
665
+ computeSpan() {
666
+ return (t) => t.dataType === "EDITOR" || t.dataType === "TEXT" ? 24 : t.fwidth ? Number(t.fwidth) > 24 ? 24 : Number(t.fwidth) : 12;
667
+ },
668
+ toolbarConfig() {
669
+ return this.widget.gridData.type == "FORM" ? this.widget.gridData.toolbarConfig.buttons.filter(
670
+ (t) => t.type != "DELETE" && t.type != "EDIT"
671
+ ) : this.widget.gridData.toolbarConfig.buttons;
672
+ }
673
+ },
674
+ watch: {
675
+ "widget.gridData.columns": {
676
+ handler(t) {
677
+ this.formColumns = t;
678
+ },
679
+ deep: !0
680
+ },
681
+ "widget.gridData.toolbarConfig": {
682
+ handler(t) {
683
+ t.buttons.forEach((e) => {
684
+ e.hasOwnProperty("buttonRender") || (e.buttonRender = {
685
+ name: "ElButton",
686
+ props: {
687
+ size: "default",
688
+ type: e.viewType,
689
+ style: e.css,
690
+ icon: e.icon,
691
+ iconComponent: e.iconComponent,
692
+ round: e.shape === "round",
693
+ circle: e.shape === "circle",
694
+ shape: e.shape
695
+ },
696
+ events: {}
697
+ // click: toolBarButtonClick
698
+ });
699
+ });
700
+ },
701
+ deep: !0,
702
+ immediate: !0
703
+ }
704
+ },
705
+ created() {
706
+ this.formColumns = this.widget.gridData.columns, this.editRules = this.widget.gridData.editRules, this.widget.gridData.toolbarConfig.buttons.forEach((t) => {
707
+ t.hasOwnProperty("buttonRender") || (t.buttonRender = {
708
+ name: "ElButton",
709
+ props: {
710
+ size: "default",
711
+ type: t.viewType,
712
+ style: t.css,
713
+ icon: t.icon,
714
+ iconComponent: t.iconComponent,
715
+ round: t.shape === "round",
716
+ circle: t.shape === "circle",
717
+ shape: t.shape
718
+ },
719
+ events: {}
720
+ // click: toolBarButtonClick
721
+ });
722
+ });
723
+ },
724
+ mounted() {
725
+ },
726
+ methods: {
727
+ // 自定义控制那些元素可以拖拽或不允许拖拽
728
+ checkFieldMove(t) {
729
+ return this.designer.checkFieldMove(t);
730
+ },
731
+ // 表单新增组件事件
732
+ onDragFormAdd(t) {
733
+ let e = t.item._underlying_vm_;
734
+ if (e.itemRender) {
735
+ for (let d in this.designer.designerConfig)
736
+ 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(
737
+ this.designer.designerConfig[d].fieldConfig[e.id]
738
+ ), delete this.designer.designerConfig[d].fieldConfig[e.id]);
739
+ this.designer.emitHistoryChange();
740
+ return;
741
+ }
742
+ let i;
743
+ this.formColumns.forEach((d, n) => {
744
+ d.id == e.id && (i = n);
745
+ });
746
+ let g = this.addFormItemConfig(e);
747
+ g = this.switchFieldType(e, g), this.formColumns.splice(i, 1, g), this.designer.newWidgetInitConfig(
748
+ this.widget.gridData.id,
749
+ "fieldConfig",
750
+ g
751
+ ), this.designer.emitHistoryChange();
752
+ }
753
+ }
754
+ }, ce = { class: "toolBar-title" }, ue = {
755
+ key: 1,
756
+ class: "no-widget-hint"
757
+ };
758
+ function fe(t, e, i, g, d, n) {
759
+ const c = l("el-col"), w = l("vxe-form-item"), C = l("vxe-form"), v = l("StaticContentWrapper"), y = l("draggable"), W = l("container-wrapper");
760
+ return s(), m(W, {
761
+ designer: i.designer,
762
+ widget: i.widget,
763
+ parentWidget: i.parentWidget
764
+ }, {
765
+ default: o(() => [
766
+ a(c, { class: "grid-cell" }, {
767
+ default: o(() => [
768
+ a(W, {
769
+ designer: i.designer,
770
+ widget: i.widget.gridData,
771
+ height: i.widget.height
772
+ }, {
773
+ default: o(() => [
774
+ n.toolbarConfig.length > 0 && n.toolbarConfig[0].buttonRender && n.toolbarConfig[0].buttonRender.name == "toolBarTitle" ? (s(), m(c, {
775
+ key: 0,
776
+ class: "grid-cell"
777
+ }, {
778
+ default: o(() => [
779
+ p("span", ce, A(n.toolbarConfig[0].name), 1)
780
+ ]),
781
+ _: 1
782
+ })) : h("", !0),
783
+ a(c, { class: "grid-cell" }, {
784
+ default: o(() => [
785
+ a(y, k({
786
+ list: d.formColumns,
787
+ "item-key": "id"
788
+ }, { group: "dragGroup", ghostClass: "ghost", animation: 300 }, {
789
+ "component-data": {
790
+ name: "fade",
791
+ class: "transition-group field formBtnConfig el-row"
792
+ },
793
+ handle: ".drag-handler",
794
+ tag: "div",
795
+ onAdd: n.onDragFormAdd,
796
+ move: n.checkFieldMove
797
+ }), {
798
+ item: o(({ element: r }) => [
799
+ r.type !== "seq" && r.type !== "checkbox" && r.fixed !== "left" && r.dataType !== "ID" && r.displayForm ? (s(), m(c, {
800
+ key: 0,
801
+ class: "grid-cell",
802
+ span: n.computeSpan(r)
803
+ }, {
804
+ default: o(() => [
805
+ a(v, {
806
+ designer: i.designer,
807
+ field: r,
808
+ parentWidget: d.formColumns,
809
+ rootWidgetId: i.widget.id
810
+ }, {
811
+ default: o(() => [
812
+ a(C, {
813
+ rules: d.editRules,
814
+ "title-align": "right",
815
+ "title-width": "120"
816
+ }, {
817
+ default: o(() => [
818
+ a(w, {
819
+ field: r.field,
820
+ title: r.title,
821
+ "title-overflow": "tooltip",
822
+ "item-render": r.itemRender,
823
+ "title-prefix": r.titlePrefix,
824
+ style: B(r.style)
825
+ }, null, 8, ["field", "title", "item-render", "title-prefix", "style"])
826
+ ]),
827
+ _: 2
828
+ }, 1032, ["rules"])
829
+ ]),
830
+ _: 2
831
+ }, 1032, ["designer", "field", "parentWidget", "rootWidgetId"])
832
+ ]),
833
+ _: 2
834
+ }, 1032, ["span"])) : h("", !0)
835
+ ]),
836
+ _: 1
837
+ }, 16, ["list", "onAdd", "move"])
838
+ ]),
839
+ _: 1
840
+ }),
841
+ a(c, { class: "grid-cell" }, {
842
+ default: o(() => [
843
+ a(y, k({
844
+ list: n.toolbarConfig,
845
+ "item-key": "id"
846
+ }, { group: "dragGroup", ghostClass: "ghost", animation: 300 }, {
847
+ "component-data": {
848
+ name: "fade",
849
+ class: "transition-group field toolbar"
850
+ },
851
+ handle: ".drag-handler",
852
+ tag: "div",
853
+ onAdd: t.onDragToolbarAdd,
854
+ move: n.checkFieldMove
855
+ }), {
856
+ item: o(({ element: r }) => [
857
+ !r.buttonRender || r.buttonRender && r.buttonRender.name != "toolBarTitle" ? (s(), m(v, {
858
+ key: 0,
859
+ designer: i.designer,
860
+ field: r,
861
+ parentWidget: n.toolbarConfig,
862
+ rootWidgetId: i.widget.id
863
+ }, {
864
+ default: o(() => [
865
+ a(C, null, {
866
+ default: o(() => [
867
+ a(w, {
868
+ "item-render": n.btnRender(r),
869
+ visible: r.code != null
870
+ }, null, 8, ["item-render", "visible"])
871
+ ]),
872
+ _: 2
873
+ }, 1024)
874
+ ]),
875
+ _: 2
876
+ }, 1032, ["designer", "field", "parentWidget", "rootWidgetId"])) : h("", !0)
877
+ ]),
878
+ _: 1
879
+ }, 16, ["list", "onAdd", "move"])
880
+ ]),
881
+ _: 1
882
+ }),
883
+ d.formColumns.length === 0 ? (s(), u("div", ue, " 请从左侧列表中选择基础字段, 然后用鼠标拖动组件放置于此处 ")) : h("", !0)
884
+ ]),
885
+ _: 1
886
+ }, 8, ["designer", "widget", "height"])
887
+ ]),
888
+ _: 1
889
+ })
890
+ ]),
891
+ _: 1
892
+ }, 8, ["designer", "widget", "parentWidget"]);
893
+ }
894
+ const q = /* @__PURE__ */ x(ge, [["render", fe], ["__scopeId", "data-v-02ba7b3e"]]), me = {
895
+ name: "grid-layout-wrapper",
896
+ componentName: "GridLayouWrapper",
897
+ mixins: [I],
898
+ inject: {},
899
+ components: {
900
+ ContainerWrapper: O,
901
+ VxeGridWidget: P,
902
+ VxeFormWidget: q,
903
+ draggable: S,
904
+ WindowGrid: U(() => Promise.resolve().then(() => Re))
905
+ },
906
+ props: {
907
+ widget: Object,
908
+ designer: Object
909
+ },
910
+ data() {
911
+ return {};
912
+ },
913
+ computed: {},
914
+ watch: {
915
+ widget: {
916
+ handler(t) {
917
+ t.child.length > 0 && t.child.findIndex((i) => i.isActive) < 0 && (t.child[0].isActive = !0);
918
+ },
919
+ immediate: !0,
920
+ deep: !0
921
+ }
922
+ },
923
+ created() {
924
+ },
925
+ mounted() {
926
+ },
927
+ methods: {
928
+ selectTabpane(t) {
929
+ this.widget.child.forEach((e) => {
930
+ delete e.isActive, e.id == t && (e.isActive = !0);
931
+ });
932
+ },
933
+ // 在tabs中添加tabpane时触发
934
+ onDragAdd(t) {
935
+ let e = t.item._underlying_vm_;
936
+ this.designer.newWidgetInitConfig(this.widget.id, "layout", e);
937
+ },
938
+ // 拖拽变换位置时触发的事件
939
+ onDragUpdate() {
940
+ },
941
+ // 自定义控制那些元素可以拖拽或不允许拖拽并控制是否允许停靠
942
+ onMove(t) {
943
+ return this.designer.checkWidgetMove(t);
944
+ }
945
+ }
946
+ }, pe = {
947
+ key: 0,
948
+ class: "no-widget-hint"
949
+ }, he = {
950
+ key: 2,
951
+ class: "el-tabs el-tabs--tops"
952
+ }, _e = { class: "el-tabs__header" }, we = { class: "transition-group-el" }, ye = ["onClick"], Ce = {
953
+ key: 0,
954
+ class: "el-tabs__content"
955
+ };
956
+ function ve(t, e, i, g, d, n) {
957
+ const c = l("WindowGrid"), w = l("draggable"), C = l("el-col"), v = l("container-wrapper");
958
+ return s(), m(v, {
959
+ designer: i.designer,
960
+ widget: i.widget
961
+ }, {
962
+ default: o(() => [
963
+ a(C, { class: "grid-cell" }, {
964
+ default: o(() => [
965
+ i.widget.child.length === 0 && i.widget.gridData == null ? (s(), u("div", pe, "请从左侧列表中选择一个高级组件, 然后用鼠标拖动组件放置于此处")) : h("", !0),
966
+ i.widget.mode == "horizontal" || i.widget.mode === "vertical" ? (s(), m(c, {
967
+ key: 1,
968
+ preViewData: i.widget,
969
+ designer: i.designer
970
+ }, null, 8, ["preViewData", "designer"])) : (s(), u("div", he, [
971
+ p("div", _e, [
972
+ p("div", {
973
+ class: E(["el-tabs__nav-wrap", { hideAfter: i.widget.child.length == 0 }])
974
+ }, [
975
+ a(w, {
976
+ list: i.widget.child,
977
+ "item-key": "id",
978
+ "ghost-class": "ghost",
979
+ group: "dragGroup",
980
+ animation: "300",
981
+ tag: "div",
982
+ "component-data": {
983
+ name: "fade",
984
+ class: "transition-group container tabpane-label"
985
+ },
986
+ handle: ".drag-handler",
987
+ onAdd: n.onDragAdd,
988
+ move: n.onMove
989
+ }, {
990
+ item: o(({ element: y }) => [
991
+ p("div", we, [
992
+ p("div", {
993
+ class: E(["el-tabs__item", { "is-active": y.isActive }]),
994
+ onClick: R((W) => n.selectTabpane(y.id), ["stop"])
995
+ }, A(y.name), 11, ye)
996
+ ])
997
+ ]),
998
+ _: 1
999
+ }, 8, ["list", "onAdd", "move"])
1000
+ ], 2)
1001
+ ]),
1002
+ i.widget.child.length > 0 ? (s(), u("div", Ce, [
1003
+ a(c, {
1004
+ preViewData: i.widget,
1005
+ designer: i.designer
1006
+ }, null, 8, ["preViewData", "designer"])
1007
+ ])) : h("", !0)
1008
+ ]))
1009
+ ]),
1010
+ _: 1
1011
+ })
1012
+ ]),
1013
+ _: 1
1014
+ }, 8, ["designer", "widget"]);
1015
+ }
1016
+ const be = /* @__PURE__ */ x(me, [["render", ve], ["__scopeId", "data-v-02273c28"]]), De = { class: "form-widget-list" }, We = {
1017
+ __name: "index",
1018
+ props: {
1019
+ designer: Object,
1020
+ preViewData: Object
1021
+ },
1022
+ emits: ["update:designer", "update:preViewData"],
1023
+ setup(t, { emit: e }) {
1024
+ const i = t, g = e;
1025
+ let d = z(i, "designer", g), n = z(i, "preViewData", g);
1026
+ const c = j(() => {
1027
+ let r = "transition-group grid";
1028
+ return n.value.mode === "horizontal" && n.value.child.length > 0 && (r += " horizontal"), {
1029
+ name: "fade",
1030
+ class: r
1031
+ };
1032
+ }), w = j(() => {
1033
+ let r = {};
1034
+ return n.value.mode === "horizontal" && n.value.child.length > 0 && (r = { width: parseInt(100 / n.value.child.length) - 0.5 + "%" }), r;
1035
+ }), C = (r) => {
1036
+ let T = r.item._underlying_vm_;
1037
+ d.value.newWidgetInitConfig(n.value.id, "layout", T);
1038
+ }, v = (r) => {
1039
+ d.value.emitHistoryChange();
1040
+ }, y = (r) => d.value.checkWidgetMove(r), W = (r) => n.value.mode == "tab" ? !!r.isActive : !0;
1041
+ return (r, T) => (s(), u("div", De, [
1042
+ a(D(S), {
1043
+ list: D(n).child,
1044
+ "item-key": "id",
1045
+ "ghost-class": "ghost",
1046
+ group: "dragGroup",
1047
+ animation: "300",
1048
+ tag: "div",
1049
+ "component-data": c.value,
1050
+ handle: ".drag-handler",
1051
+ onAdd: C,
1052
+ onUpdate: v,
1053
+ move: y
1054
+ }, {
1055
+ item: o(({ element: f }) => [
1056
+ X(p("div", {
1057
+ class: "transition-group-el",
1058
+ style: B(w.value)
1059
+ }, [
1060
+ f.gridData && (f.gridData.type === "GRID" || f.gridData.type === "TREE" || f.gridData.type === "TREE_STRUCTURE" || f.gridData.type === "EDIT_GRID") ? (s(), m(P, {
1061
+ key: 0,
1062
+ designer: D(d),
1063
+ widget: f,
1064
+ parentWidget: D(n).child
1065
+ }, null, 8, ["designer", "widget", "parentWidget"])) : f.gridData && f.gridData.type === "FORM" ? (s(), m(q, {
1066
+ key: 1,
1067
+ designer: D(d),
1068
+ widget: f,
1069
+ parentWidget: D(n).child
1070
+ }, null, 8, ["designer", "widget", "parentWidget"])) : f.mode == "horizontal" || f.mode === "vertical" || f.mode == "tab" ? (s(), m(be, {
1071
+ key: 2,
1072
+ designer: D(d),
1073
+ widget: f,
1074
+ parentWidget: D(n).child
1075
+ }, null, 8, ["designer", "widget", "parentWidget"])) : h("", !0)
1076
+ ], 4), [
1077
+ [J, W(f)]
1078
+ ])
1079
+ ]),
1080
+ _: 1
1081
+ }, 8, ["list", "component-data"])
1082
+ ]));
1083
+ }
1084
+ }, ke = /* @__PURE__ */ x(We, [["__scopeId", "data-v-48225462"]]), Re = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1085
+ __proto__: null,
1086
+ default: ke
1087
+ }, Symbol.toStringTag, { value: "Module" }));
1088
+ export {
1089
+ ke as default
1090
+ };