starfish-editor-custom 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (108) hide show
  1. package/auto-imports.d.ts +10 -0
  2. package/babel.config.js +8 -0
  3. package/components.d.ts +46 -0
  4. package/dist/ConditionModule.js +892 -0
  5. package/dist/ConditionSelect.js +483 -0
  6. package/dist/CustomDialog.js +105 -0
  7. package/dist/formStyle.js +245 -0
  8. package/dist/globalFormList.js +59 -0
  9. package/dist/jsonCode.js +74 -0
  10. package/dist/jsonEditor.js +71 -0
  11. package/dist/main.js +3319 -0
  12. package/dist/starfish-editor.es.js +30 -0
  13. package/dist/style.css +1 -0
  14. package/dist/types/editor/src/common/ConditionSelect/ConditionGroup.vue.d.ts +61 -0
  15. package/dist/types/editor/src/common/ConditionSelect/ConditionModule.vue.d.ts +43 -0
  16. package/dist/types/editor/src/common/ConditionSelect/ConditionTanc.vue.d.ts +48 -0
  17. package/dist/types/editor/src/common/ConditionSelect.vue.d.ts +72 -0
  18. package/dist/types/editor/src/common/CustomDialog.vue.d.ts +25 -0
  19. package/dist/types/editor/src/common/Loading.vue.d.ts +3 -0
  20. package/dist/types/editor/src/common/formJson.d.ts +80 -0
  21. package/dist/types/editor/src/common/jsonCode.vue.d.ts +110 -0
  22. package/dist/types/editor/src/components/ComponentList.vue.d.ts +32 -0
  23. package/dist/types/editor/src/components/FormPreview.vue.d.ts +25 -0
  24. package/dist/types/editor/src/components/Nav.vue.d.ts +9 -0
  25. package/dist/types/editor/src/components/PropsPanel.vue.d.ts +53 -0
  26. package/dist/types/editor/src/components/Shape.vue.d.ts +40 -0
  27. package/dist/types/editor/src/components/Workspace.vue.d.ts +22 -0
  28. package/dist/types/editor/src/components/globalFormList.vue.d.ts +6 -0
  29. package/dist/types/editor/src/components/jsonEditor.vue.d.ts +6 -0
  30. package/dist/types/editor/src/controller/action.d.ts +18 -0
  31. package/dist/types/editor/src/controller/form.d.ts +24 -0
  32. package/dist/types/editor/src/controller/history.d.ts +12 -0
  33. package/dist/types/editor/src/controller/shortcut.d.ts +20 -0
  34. package/dist/types/editor/src/controller/ui.d.ts +10 -0
  35. package/dist/types/editor/src/layouts/ControlEditSize.vue.d.ts +17 -0
  36. package/dist/types/editor/src/layouts/Framework.vue.d.ts +33 -0
  37. package/dist/types/editor/src/layouts/Resizer.vue.d.ts +13 -0
  38. package/dist/types/editor/src/layouts/ShortcutKey.vue.d.ts +8 -0
  39. package/dist/types/editor/src/main.d.ts +5 -0
  40. package/dist/types/editor/src/shims-vue.d.ts +23 -0
  41. package/dist/types/editor/src/starfish-editor.vue.d.ts +109 -0
  42. package/dist/types/editor/src/type.d.ts +224 -0
  43. package/dist/types/editor/src/utils/_.d.ts +33 -0
  44. package/dist/types/editor/src/utils/formKeycon.d.ts +18 -0
  45. package/dist/types/editor/src/utils/shortcutKey.d.ts +3 -0
  46. package/dist/types/editor/src/utils/vm.d.ts +3 -0
  47. package/dist/types/starfish-editor.d.ts +3 -0
  48. package/package.json +55 -0
  49. package/src/common/ConditionSelect/ConditionGroup.vue +167 -0
  50. package/src/common/ConditionSelect/ConditionModule.vue +118 -0
  51. package/src/common/ConditionSelect/ConditionTanc.vue +319 -0
  52. package/src/common/ConditionSelect.vue +268 -0
  53. package/src/common/CustomDialog.vue +77 -0
  54. package/src/common/Loading.vue +10 -0
  55. package/src/common/formJson.ts +143 -0
  56. package/src/common/formStyle.vue +170 -0
  57. package/src/common/jsonCode.vue +45 -0
  58. package/src/components/ComponentList.vue +156 -0
  59. package/src/components/FormPreview.vue +197 -0
  60. package/src/components/Nav.vue +128 -0
  61. package/src/components/NavList.vue +560 -0
  62. package/src/components/PropsPanel.vue +376 -0
  63. package/src/components/Shape.vue +178 -0
  64. package/src/components/Workspace.vue +258 -0
  65. package/src/components/globalFormList.vue +30 -0
  66. package/src/components/jsonEditor.vue +41 -0
  67. package/src/controller/action.ts +37 -0
  68. package/src/controller/form.ts +207 -0
  69. package/src/controller/history.ts +57 -0
  70. package/src/controller/shortcut.ts +81 -0
  71. package/src/controller/ui.ts +91 -0
  72. package/src/layouts/ControlEditSize.vue +52 -0
  73. package/src/layouts/Framework.vue +76 -0
  74. package/src/layouts/Resizer.vue +54 -0
  75. package/src/layouts/ShortcutKey.vue +61 -0
  76. package/src/main.ts +56 -0
  77. package/src/shims-vue.d.ts +23 -0
  78. package/src/starfish-editor.vue +176 -0
  79. package/src/styles/common/normalize.css +455 -0
  80. package/src/styles/component-list.scss +64 -0
  81. package/src/styles/condition-select.scss +176 -0
  82. package/src/styles/control_edit_size.scss +36 -0
  83. package/src/styles/custom-dialog.scss +110 -0
  84. package/src/styles/form-preview.scss +47 -0
  85. package/src/styles/framework.scss +150 -0
  86. package/src/styles/iconfont/iconfont.css +247 -0
  87. package/src/styles/iconfont/iconfont.js +1 -0
  88. package/src/styles/iconfont/iconfont.json +415 -0
  89. package/src/styles/iconfont/iconfont.ttf +0 -0
  90. package/src/styles/iconfont/iconfont.woff +0 -0
  91. package/src/styles/iconfont/iconfont.woff2 +0 -0
  92. package/src/styles/index.scss +18 -0
  93. package/src/styles/nav-list.scss +59 -0
  94. package/src/styles/nav.scss +46 -0
  95. package/src/styles/props-panel.scss +115 -0
  96. package/src/styles/resizer.scss +15 -0
  97. package/src/styles/shape.scss +101 -0
  98. package/src/styles/shortcutkey.scss +44 -0
  99. package/src/styles/variables.scss +36 -0
  100. package/src/styles/work-space.scss +126 -0
  101. package/src/type.ts +240 -0
  102. package/src/utils/_.ts +349 -0
  103. package/src/utils/formKeycon.ts +42 -0
  104. package/src/utils/shortcutKey.ts +46 -0
  105. package/src/utils/vm.ts +3 -0
  106. package/stats.html +4949 -0
  107. package/tsconfig.json +19 -0
  108. package/vite.config.ts +111 -0
@@ -0,0 +1,892 @@
1
+ import { ElMessage, ElOption, ElSelect, ElTableColumn, ElInput, ElFormItem, ElForm, ElSwitch, ElButton, ElTable, ElMain, ElFooter, ElContainer } from "element-plus/es";
2
+ import "element-plus/es/components/base/style/css";
3
+ import "element-plus/es/components/container/style/css";
4
+ import "element-plus/es/components/footer/style/css";
5
+ import "element-plus/es/components/button/style/css";
6
+ import "element-plus/es/components/main/style/css";
7
+ import "element-plus/es/components/select/style/css";
8
+ import "element-plus/es/components/option/style/css";
9
+ import "element-plus/es/components/table/style/css";
10
+ import "element-plus/es/components/switch/style/css";
11
+ import "element-plus/es/components/form/style/css";
12
+ import "element-plus/es/components/form-item/style/css";
13
+ import "element-plus/es/components/input/style/css";
14
+ import "element-plus/es/components/table-column/style/css";
15
+ import "element-plus/es/components/message/style/css";
16
+ import { resolveComponent, openBlock, createBlock, Teleport, createVNode, withCtx, createElementBlock, Fragment, renderList, createCommentVNode, withModifiers, createTextVNode, normalizeClass, withDirectives, createElementVNode, vShow, Transition, toRaw } from "vue";
17
+ import { _ as _export_sfc, f as formStore } from "./main.js";
18
+ import "element-plus/dist/index.css";
19
+ import "jsoneditor/dist/jsoneditor.min.css";
20
+ import "starfish-form";
21
+ import "mitt";
22
+ import "element-plus";
23
+ import "nanoid";
24
+ import "starfish-form/dist/style.css";
25
+ import "clipboard";
26
+ import "element-plus/es/components/tabs/style/css";
27
+ import "element-plus/es/components/tab-pane/style/css";
28
+ import "element-plus/es/components/scrollbar/style/css";
29
+ import "element-plus/es/components/empty/style/css";
30
+ import "element-plus/es/components/loading/style/css";
31
+ import "element-plus/es/components/notification/style/css";
32
+ import "element-plus/es/components/upload/style/css";
33
+ import "element-plus/es/components/drawer/style/css";
34
+ import "element-plus/es/components/tree/style/css";
35
+ import "element-plus/es/components/tooltip/style/css";
36
+ import "gesto";
37
+ import "keycon";
38
+ const _sfc_main$2 = {
39
+ props: {
40
+ fieldList: {
41
+ type: Object,
42
+ default() {
43
+ return {};
44
+ }
45
+ },
46
+ data: {
47
+ type: Object,
48
+ default() {
49
+ return {};
50
+ }
51
+ }
52
+ },
53
+ data() {
54
+ return {
55
+ table: [],
56
+ groupSelect: [
57
+ {
58
+ value: "andgroup",
59
+ label: "+\u5E76\u7EC4"
60
+ },
61
+ {
62
+ value: "orgroup",
63
+ label: "+\u6216\u7EC4"
64
+ },
65
+ {
66
+ value: "data",
67
+ label: "\u6761\u4EF6"
68
+ }
69
+ ],
70
+ logicList: [
71
+ { value: "=", label: "\u7B49\u4E8E" },
72
+ { value: "!=", label: "\u4E0D\u7B49\u4E8E" }
73
+ ],
74
+ typeList: [
75
+ {
76
+ rule: [],
77
+ value: "\u5E38\u91CF",
78
+ label: "\u5E38\u91CF"
79
+ }
80
+ ]
81
+ };
82
+ },
83
+ computed: {
84
+ newtypeList() {
85
+ const item = this.fieldList.find((item2) => {
86
+ if (this.table && this.table.length > 0) {
87
+ if (item2.value == this.table[0].field) {
88
+ return item2;
89
+ }
90
+ }
91
+ });
92
+ if (item && item.options) {
93
+ return [
94
+ {
95
+ rule: [],
96
+ value: "\u9009\u9879",
97
+ label: "\u9009\u9879"
98
+ }
99
+ ];
100
+ }
101
+ if (item && item.switch) {
102
+ return [
103
+ {
104
+ value: "\u5E03\u5C14",
105
+ label: "\u5E03\u5C14"
106
+ }
107
+ ];
108
+ }
109
+ return this.typeList;
110
+ }
111
+ },
112
+ methods: {
113
+ handleType(type) {
114
+ if (type == "\u5E03\u5C14") {
115
+ this.table[0].value = true;
116
+ }
117
+ },
118
+ getFiled() {
119
+ if (!this.table[0] || !this.table[0].field)
120
+ return [];
121
+ const item = this.fieldList.find((item2) => {
122
+ if (this.table && this.table.length > 0) {
123
+ if (item2.value == this.table[0].field) {
124
+ return item2;
125
+ }
126
+ }
127
+ });
128
+ return item.options || [];
129
+ },
130
+ getMultiple() {
131
+ const item = this.fieldList.find((item2) => {
132
+ if (this.table && this.table.length > 0) {
133
+ if (item2.value == this.table[0].field) {
134
+ return item2;
135
+ }
136
+ }
137
+ });
138
+ return !!item.multiple;
139
+ },
140
+ getLogic() {
141
+ const item = this.fieldList.find((item2) => {
142
+ if (this.table && this.table.length > 0) {
143
+ if (item2.value == this.table[0].field) {
144
+ return item2;
145
+ }
146
+ }
147
+ });
148
+ if (item && item.options && item.multiple) {
149
+ return [
150
+ { value: "in", label: "\u5305\u542B" },
151
+ { value: "not in", label: "\u4E0D\u5305\u542B" }
152
+ ];
153
+ }
154
+ if (item && item.switch) {
155
+ return [
156
+ {
157
+ value: "=",
158
+ label: "\u7B49\u4E8E"
159
+ }
160
+ ];
161
+ }
162
+ return this.logicList;
163
+ },
164
+ show(data) {
165
+ this.$refs.maxJsonDialog.init("\u53EF\u7528\u6761\u4EF6", "icon-icon-bianji");
166
+ this.$refs.maxJsonDialog.show();
167
+ if (Object.keys(data).length > 0) {
168
+ this.table = [data];
169
+ }
170
+ },
171
+ onAddItem() {
172
+ this.table.push({
173
+ field: "",
174
+ logic: "",
175
+ type: "",
176
+ value: ""
177
+ });
178
+ },
179
+ getTypeIsChange(index) {
180
+ const nowRow = this.table[index];
181
+ return !!nowRow.type && nowRow.type == "\u5E38\u91CF";
182
+ },
183
+ getRules(value) {
184
+ var _a;
185
+ return {
186
+ value: (_a = this.typeList.find((item) => {
187
+ return item.value == value;
188
+ })) == null ? void 0 : _a.rule
189
+ };
190
+ },
191
+ closeDialog() {
192
+ this.$refs.maxJsonDialog.close();
193
+ },
194
+ deleteRow() {
195
+ this.table = [];
196
+ },
197
+ async saveJson() {
198
+ if (this.table.length > 0) {
199
+ const data = this.table[0];
200
+ if (!data.field) {
201
+ ElMessage({
202
+ type: "error",
203
+ message: "\u5B57\u6BB5\u4E0D\u80FD\u4E3A\u7A7A!"
204
+ });
205
+ return;
206
+ }
207
+ if (!data.type) {
208
+ ElMessage({
209
+ type: "error",
210
+ message: "\u8BF7\u9009\u62E9\u503C\u7C7B\u578B!!"
211
+ });
212
+ return;
213
+ }
214
+ if (data.type && data.type == "\u9009\u9879" && !data.value) {
215
+ ElMessage({
216
+ type: "error",
217
+ message: "\u503C\u7C7B\u578B\u4E3A\u5B57\u6BB5\u65F6\u503C\u4E0D\u80FD\u4E3A\u7A7A!"
218
+ });
219
+ return;
220
+ }
221
+ for (const key in this.table[0]) {
222
+ this.data[key] = this.table[0][key];
223
+ }
224
+ } else {
225
+ for (const key in this.data) {
226
+ delete this.data[key];
227
+ }
228
+ }
229
+ ElMessage({
230
+ message: "\u4FDD\u5B58\u6210\u529F",
231
+ type: "success"
232
+ });
233
+ this.closeDialog();
234
+ this.$emit("end");
235
+ }
236
+ }
237
+ };
238
+ function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
239
+ const _component_el_option = ElOption;
240
+ const _component_el_select = ElSelect;
241
+ const _component_el_table_column = ElTableColumn;
242
+ const _component_el_input = ElInput;
243
+ const _component_el_form_item = ElFormItem;
244
+ const _component_el_form = ElForm;
245
+ const _component_el_switch = ElSwitch;
246
+ const _component_el_button = ElButton;
247
+ const _component_el_table = ElTable;
248
+ const _component_el_main = ElMain;
249
+ const _component_el_footer = ElFooter;
250
+ const _component_el_container = ElContainer;
251
+ const _component_CustomDialog = resolveComponent("CustomDialog");
252
+ return openBlock(), createBlock(Teleport, { to: "body" }, [
253
+ createVNode(_component_CustomDialog, {
254
+ ref: "maxJsonDialog",
255
+ dialogclass: "maxJsonDialog"
256
+ }, {
257
+ default: withCtx(() => [
258
+ createVNode(_component_el_main, { style: { "padding": "0" } }, {
259
+ default: withCtx(() => [
260
+ createVNode(_component_el_container, { style: { "height": "100%" } }, {
261
+ default: withCtx(() => [
262
+ createVNode(_component_el_main, { class: "my-pageMain" }, {
263
+ default: withCtx(() => [
264
+ createVNode(_component_el_table, {
265
+ data: $data.table,
266
+ style: { "width": "100%" },
267
+ border: ""
268
+ }, {
269
+ default: withCtx(() => [
270
+ createVNode(_component_el_table_column, {
271
+ prop: "field",
272
+ label: "\u5B57\u6BB5"
273
+ }, {
274
+ default: withCtx((scope) => [
275
+ createVNode(_component_el_select, {
276
+ modelValue: scope.row.field,
277
+ "onUpdate:modelValue": ($event) => scope.row.field = $event,
278
+ placeholder: "\u8BF7\u9009\u62E9"
279
+ }, {
280
+ default: withCtx(() => [
281
+ createVNode(_component_el_option, {
282
+ label: "\u672A\u9009\u62E9",
283
+ value: ""
284
+ }),
285
+ (openBlock(true), createElementBlock(Fragment, null, renderList($props.fieldList, (item, index) => {
286
+ return openBlock(), createBlock(_component_el_option, {
287
+ key: index,
288
+ label: item.label,
289
+ value: item.value
290
+ }, null, 8, ["label", "value"]);
291
+ }), 128))
292
+ ]),
293
+ _: 2
294
+ }, 1032, ["modelValue", "onUpdate:modelValue"])
295
+ ]),
296
+ _: 1
297
+ }),
298
+ createVNode(_component_el_table_column, {
299
+ prop: "logic",
300
+ label: "\u903B\u8F91"
301
+ }, {
302
+ default: withCtx((scope) => [
303
+ createVNode(_component_el_select, {
304
+ modelValue: scope.row.logic,
305
+ "onUpdate:modelValue": ($event) => scope.row.logic = $event,
306
+ placeholder: "\u8BF7\u9009\u62E9"
307
+ }, {
308
+ default: withCtx(() => [
309
+ (openBlock(true), createElementBlock(Fragment, null, renderList($options.getLogic(), (item) => {
310
+ return openBlock(), createBlock(_component_el_option, {
311
+ key: item.value,
312
+ label: item.label,
313
+ value: item.value
314
+ }, null, 8, ["label", "value"]);
315
+ }), 128))
316
+ ]),
317
+ _: 2
318
+ }, 1032, ["modelValue", "onUpdate:modelValue"])
319
+ ]),
320
+ _: 1
321
+ }),
322
+ createVNode(_component_el_table_column, {
323
+ prop: "type",
324
+ label: "\u503C\u7C7B\u578B"
325
+ }, {
326
+ default: withCtx((scope) => [
327
+ createVNode(_component_el_select, {
328
+ modelValue: scope.row.type,
329
+ "onUpdate:modelValue": ($event) => scope.row.type = $event,
330
+ placeholder: "\u8BF7\u9009\u62E9",
331
+ onChange: $options.handleType
332
+ }, {
333
+ default: withCtx(() => [
334
+ (openBlock(true), createElementBlock(Fragment, null, renderList($options.newtypeList, (item) => {
335
+ return openBlock(), createBlock(_component_el_option, {
336
+ key: item.value,
337
+ label: item.label,
338
+ value: item.value
339
+ }, null, 8, ["label", "value"]);
340
+ }), 128))
341
+ ]),
342
+ _: 2
343
+ }, 1032, ["modelValue", "onUpdate:modelValue", "onChange"])
344
+ ]),
345
+ _: 1
346
+ }),
347
+ createVNode(_component_el_table_column, {
348
+ prop: "value",
349
+ label: "\u503C"
350
+ }, {
351
+ default: withCtx((scope) => [
352
+ $options.getTypeIsChange(scope.$index, _ctx.index) ? (openBlock(), createBlock(_component_el_form, {
353
+ key: 0,
354
+ model: scope.row,
355
+ rules: $options.getRules(scope.row.type),
356
+ ref: "formList"
357
+ }, {
358
+ default: withCtx(() => [
359
+ createVNode(_component_el_form_item, { prop: "value" }, {
360
+ default: withCtx(() => [
361
+ createVNode(_component_el_input, {
362
+ text: "",
363
+ modelValue: scope.row.value,
364
+ "onUpdate:modelValue": ($event) => scope.row.value = $event
365
+ }, null, 8, ["modelValue", "onUpdate:modelValue"])
366
+ ]),
367
+ _: 2
368
+ }, 1024)
369
+ ]),
370
+ _: 2
371
+ }, 1032, ["model", "rules"])) : createCommentVNode("", true),
372
+ scope.row.type == "\u9009\u9879" ? (openBlock(), createBlock(_component_el_select, {
373
+ key: 1,
374
+ modelValue: scope.row.value,
375
+ "onUpdate:modelValue": ($event) => scope.row.value = $event,
376
+ filterable: "",
377
+ placeholder: "\u8BF7\u9009\u62E9",
378
+ multiple: $options.getMultiple()
379
+ }, {
380
+ default: withCtx(() => [
381
+ createVNode(_component_el_option, {
382
+ label: "\u672A\u9009\u62E9",
383
+ value: ""
384
+ }),
385
+ (openBlock(true), createElementBlock(Fragment, null, renderList($options.getFiled(), (item, index) => {
386
+ return openBlock(), createBlock(_component_el_option, {
387
+ key: index,
388
+ label: item.label,
389
+ value: item.value
390
+ }, null, 8, ["label", "value"]);
391
+ }), 128))
392
+ ]),
393
+ _: 2
394
+ }, 1032, ["modelValue", "onUpdate:modelValue", "multiple"])) : createCommentVNode("", true),
395
+ scope.row.type == "\u5E03\u5C14" ? (openBlock(), createBlock(_component_el_switch, {
396
+ key: 2,
397
+ modelValue: scope.row.value,
398
+ "onUpdate:modelValue": ($event) => scope.row.value = $event,
399
+ "active-icon": _ctx.Check,
400
+ "inactive-icon": _ctx.Close
401
+ }, null, 8, ["modelValue", "onUpdate:modelValue", "active-icon", "inactive-icon"])) : createCommentVNode("", true)
402
+ ]),
403
+ _: 1
404
+ }),
405
+ createVNode(_component_el_table_column, {
406
+ fixed: "right",
407
+ label: "\u64CD\u4F5C",
408
+ width: "200"
409
+ }, {
410
+ default: withCtx((scope) => [
411
+ createVNode(_component_el_button, {
412
+ size: "small",
413
+ type: "danger",
414
+ onClick: withModifiers(($event) => $options.deleteRow(scope.$index, _ctx.index), ["prevent"])
415
+ }, {
416
+ default: withCtx(() => _cache[0] || (_cache[0] = [
417
+ createTextVNode(" \u5220\u9664 ", -1)
418
+ ])),
419
+ _: 2,
420
+ __: [0]
421
+ }, 1032, ["onClick"])
422
+ ]),
423
+ _: 1
424
+ })
425
+ ]),
426
+ _: 1
427
+ }, 8, ["data"]),
428
+ $data.table.length == 0 ? (openBlock(), createBlock(_component_el_button, {
429
+ key: 0,
430
+ class: "mt-4",
431
+ text: "",
432
+ onClick: $options.onAddItem,
433
+ style: { "width": "100%" }
434
+ }, {
435
+ default: withCtx(() => _cache[1] || (_cache[1] = [
436
+ createTextVNode("+\u6761\u4EF6", -1)
437
+ ])),
438
+ _: 1,
439
+ __: [1]
440
+ }, 8, ["onClick"])) : createCommentVNode("", true)
441
+ ]),
442
+ _: 1
443
+ }),
444
+ createVNode(_component_el_footer, {
445
+ class: "my-Footer",
446
+ style: { "height": "60px", "padding-top": "10px" }
447
+ }, {
448
+ default: withCtx(() => [
449
+ createVNode(_component_el_button, {
450
+ type: "primary",
451
+ onClick: $options.saveJson
452
+ }, {
453
+ default: withCtx(() => _cache[2] || (_cache[2] = [
454
+ createTextVNode("\u4FDD\u5B58", -1)
455
+ ])),
456
+ _: 1,
457
+ __: [2]
458
+ }, 8, ["onClick"]),
459
+ createVNode(_component_el_button, { onClick: $options.closeDialog }, {
460
+ default: withCtx(() => _cache[3] || (_cache[3] = [
461
+ createTextVNode("\u5173\u95ED", -1)
462
+ ])),
463
+ _: 1,
464
+ __: [3]
465
+ }, 8, ["onClick"])
466
+ ]),
467
+ _: 1
468
+ })
469
+ ]),
470
+ _: 1
471
+ })
472
+ ]),
473
+ _: 1
474
+ })
475
+ ]),
476
+ _: 1
477
+ }, 512)
478
+ ]);
479
+ }
480
+ var ConditionTanc = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["render", _sfc_render$2]]);
481
+ const _sfc_main$1 = {
482
+ name: "ConditionGroup",
483
+ components: {
484
+ ConditionTanc
485
+ },
486
+ props: {
487
+ result: {
488
+ type: Object,
489
+ default() {
490
+ return {};
491
+ }
492
+ },
493
+ index: {
494
+ type: Number,
495
+ default: 0
496
+ },
497
+ fieldList: {
498
+ type: Array,
499
+ default() {
500
+ return [];
501
+ }
502
+ },
503
+ rightField: {
504
+ type: Array,
505
+ default() {
506
+ return [];
507
+ }
508
+ },
509
+ request: {
510
+ type: Array,
511
+ default() {
512
+ return [];
513
+ }
514
+ }
515
+ },
516
+ data() {
517
+ return {
518
+ groupSelect: [
519
+ {
520
+ value: "andgroup",
521
+ label: "+\u5E76\u7EC4"
522
+ },
523
+ {
524
+ value: "orgroup",
525
+ label: "+\u6216\u7EC4"
526
+ },
527
+ {
528
+ value: "data",
529
+ label: "\u6761\u4EF6"
530
+ }
531
+ ]
532
+ };
533
+ },
534
+ watch: {
535
+ result: {
536
+ handler() {
537
+ this.$forceUpdate();
538
+ },
539
+ deep: true
540
+ }
541
+ },
542
+ methods: {
543
+ onAddItem() {
544
+ if (!this.result.type)
545
+ return;
546
+ if (!this.result.result && this.result.type != "data") {
547
+ this.result.result = [];
548
+ }
549
+ if (this.result.type == "data" && !this.result.data) {
550
+ this.result.data = {};
551
+ }
552
+ this.result.control = true;
553
+ switch (this.result.type) {
554
+ case "orgroup":
555
+ this.result.result.push({ type: "orgroup", result: [] });
556
+ break;
557
+ case "andgroup":
558
+ this.result.result.push({ type: "andgroup", result: [] });
559
+ break;
560
+ case "data":
561
+ this.result.result.push({ type: "data", data: {} });
562
+ break;
563
+ }
564
+ this.handleUpdateForce();
565
+ },
566
+ handleControl(bool) {
567
+ this.result.control = bool;
568
+ this.handleUpdateForce();
569
+ },
570
+ onDeleteItem() {
571
+ if (this.index == 0) {
572
+ delete this.result.data;
573
+ delete this.result.result;
574
+ delete this.result.type;
575
+ this.handleUpdateForce();
576
+ } else {
577
+ this.$emit("delete", this.index);
578
+ }
579
+ },
580
+ handleDelete(index) {
581
+ this.result.result.splice(index, 1);
582
+ this.handleUpdateForce();
583
+ },
584
+ onChange(a) {
585
+ this.result.type = a;
586
+ if (a == "andgroup") {
587
+ this.result.result = [];
588
+ if (this.result.data) {
589
+ delete this.result.data;
590
+ }
591
+ } else if (a == "orgroup") {
592
+ this.result.result = [];
593
+ if (this.result.data) {
594
+ delete this.result.data;
595
+ }
596
+ } else {
597
+ this.result.data = {};
598
+ if (this.result.result) {
599
+ delete this.result.result;
600
+ }
601
+ }
602
+ this.handleUpdateForce();
603
+ },
604
+ handleUpdateForce() {
605
+ this.$forceUpdate();
606
+ this.$emit("update");
607
+ },
608
+ onEditData() {
609
+ this.$refs.ConditionTanc.show(this.result.data);
610
+ }
611
+ }
612
+ };
613
+ const _hoisted_1$1 = { class: "control" };
614
+ const _hoisted_2$1 = { class: "moreCondition" };
615
+ function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
616
+ const _component_el_option = ElOption;
617
+ const _component_el_select = ElSelect;
618
+ const _component_el_button = ElButton;
619
+ const _component_ConditionGroup = resolveComponent("ConditionGroup", true);
620
+ const _component_ConditionTanc = resolveComponent("ConditionTanc");
621
+ return openBlock(), createElementBlock("div", {
622
+ class: normalizeClass(["conditionSelect", $props.result.type])
623
+ }, [
624
+ withDirectives(createElementVNode("div", _hoisted_1$1, [
625
+ !$props.result.control ? (openBlock(), createElementBlock("span", {
626
+ key: 0,
627
+ class: "iconfontui icon-jiahao",
628
+ onClick: _cache[0] || (_cache[0] = ($event) => $options.handleControl(true))
629
+ })) : (openBlock(), createElementBlock("span", {
630
+ key: 1,
631
+ class: "iconfontui icon-jianhao",
632
+ onClick: _cache[1] || (_cache[1] = ($event) => $options.handleControl(false))
633
+ }))
634
+ ], 512), [
635
+ [vShow, $props.result.result && $props.result.result.length > 0 && $props.result.type !== "data"]
636
+ ]),
637
+ createVNode(_component_el_select, {
638
+ modelValue: $props.result.type,
639
+ "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => $props.result.type = $event),
640
+ placeholder: "\u8BF7\u9009\u62E9",
641
+ onChange: $options.onChange
642
+ }, {
643
+ default: withCtx(() => [
644
+ (openBlock(true), createElementBlock(Fragment, null, renderList($data.groupSelect, (item) => {
645
+ return openBlock(), createBlock(_component_el_option, {
646
+ key: item.value,
647
+ label: item.label,
648
+ value: item.value
649
+ }, null, 8, ["label", "value"]);
650
+ }), 128))
651
+ ]),
652
+ _: 1
653
+ }, 8, ["modelValue", "onChange"]),
654
+ createVNode(_component_el_button, {
655
+ type: "primary",
656
+ onClick: $options.onAddItem,
657
+ size: "small",
658
+ disabled: !$props.result.type || $props.result.type == "data"
659
+ }, {
660
+ default: withCtx(() => _cache[3] || (_cache[3] = [
661
+ createTextVNode("\u589E\u52A0\u6761\u4EF6", -1)
662
+ ])),
663
+ _: 1,
664
+ __: [3]
665
+ }, 8, ["onClick", "disabled"]),
666
+ createVNode(_component_el_button, {
667
+ type: "danger",
668
+ onClick: $options.onDeleteItem,
669
+ size: "small"
670
+ }, {
671
+ default: withCtx(() => _cache[4] || (_cache[4] = [
672
+ createTextVNode("\u5220\u9664", -1)
673
+ ])),
674
+ _: 1,
675
+ __: [4]
676
+ }, 8, ["onClick"]),
677
+ $props.result.type == "data" ? (openBlock(), createBlock(_component_el_button, {
678
+ key: 0,
679
+ type: "primary",
680
+ onClick: $options.onEditData,
681
+ size: "small"
682
+ }, {
683
+ default: withCtx(() => _cache[5] || (_cache[5] = [
684
+ createTextVNode("\u7F16\u8F91", -1)
685
+ ])),
686
+ _: 1,
687
+ __: [5]
688
+ }, 8, ["onClick"])) : createCommentVNode("", true),
689
+ createVNode(Transition, null, {
690
+ default: withCtx(() => [
691
+ withDirectives(createElementVNode("div", _hoisted_2$1, [
692
+ (openBlock(true), createElementBlock(Fragment, null, renderList($props.result.result, (item, index) => {
693
+ return openBlock(), createElementBlock("div", {
694
+ key: index,
695
+ class: "selectList"
696
+ }, [
697
+ createVNode(_component_ConditionGroup, {
698
+ result: item,
699
+ onUpdate: $options.handleUpdateForce,
700
+ onDelete: $options.handleDelete,
701
+ index,
702
+ fieldList: $props.fieldList
703
+ }, null, 8, ["result", "onUpdate", "onDelete", "index", "fieldList"])
704
+ ]);
705
+ }), 128)),
706
+ $props.result.result && $props.result.result.length >= 2 ? (openBlock(), createElementBlock("div", {
707
+ key: 0,
708
+ class: normalizeClass(["line", $props.result.type])
709
+ }, null, 2)) : createCommentVNode("", true)
710
+ ], 512), [
711
+ [vShow, $props.result.type && $props.result.type !== "data" && $props.result.control]
712
+ ])
713
+ ]),
714
+ _: 1
715
+ }),
716
+ withDirectives(createElementVNode("div", null, [
717
+ createVNode(_component_ConditionTanc, {
718
+ ref: "ConditionTanc",
719
+ data: $props.result.data,
720
+ fieldList: $props.fieldList,
721
+ onEnd: $options.handleUpdateForce
722
+ }, null, 8, ["data", "fieldList", "onEnd"])
723
+ ], 512), [
724
+ [vShow, $props.result.type && $props.result.type == "data"]
725
+ ])
726
+ ], 2);
727
+ }
728
+ var ConditionGroup = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["render", _sfc_render$1]]);
729
+ const _sfc_main = {
730
+ components: {
731
+ ConditionGroup
732
+ },
733
+ props: {
734
+ data: {
735
+ type: Object,
736
+ default() {
737
+ return {};
738
+ }
739
+ },
740
+ item: {
741
+ type: Object,
742
+ default() {
743
+ return {};
744
+ }
745
+ }
746
+ },
747
+ data() {
748
+ return {
749
+ result: {},
750
+ stringLink: "",
751
+ leftField: [],
752
+ rightField: [],
753
+ condition: [],
754
+ request: []
755
+ };
756
+ },
757
+ watch: {
758
+ result: {
759
+ handler() {
760
+ console.log(this.result);
761
+ this.$forceUpdate();
762
+ },
763
+ deep: true
764
+ }
765
+ },
766
+ emits: ["change"],
767
+ methods: {
768
+ async show() {
769
+ var _a, _b;
770
+ this.$refs.maxJsonDialog.init("\u53EF\u7528\u6761\u4EF6", "icon-icon-bianji");
771
+ this.$refs.maxJsonDialog.show();
772
+ await this.$nextTick();
773
+ const allFormList = (_a = formStore) == null ? void 0 : _a.get("allFormList");
774
+ const fieldResult = [];
775
+ (_b = toRaw(allFormList)) == null ? void 0 : _b.forEach((item) => {
776
+ window.VueContext.$Flex.getFormDataList(item, fieldResult, this.data.fieldName);
777
+ });
778
+ this.result = typeof this.data[this.item.data.fieldName] == "string" ? JSON.parse(this.data[this.item.data.fieldName]) : this.data[this.item.data.fieldName];
779
+ console.log(fieldResult);
780
+ this.leftField = fieldResult;
781
+ },
782
+ handleUpdateForce() {
783
+ this.$forceUpdate();
784
+ this.stringLink = this.filterCondition(this.result);
785
+ },
786
+ filterCondition(result) {
787
+ if (result.type == "andgroup" || result.type == "orgroup") {
788
+ const b = result.result.map((item) => this.filterCondition(item)).join(result.type == "andgroup" ? '<span class="and">and</span>' : '<span class="or">or</span>');
789
+ const a = `<span class='kh ${result.type}'>(${b})</span>`;
790
+ return a;
791
+ } else if (result.type == "data") {
792
+ return `<span class='data kh'>${this.getDataConditionRelate(result)}</span>`;
793
+ } else {
794
+ return "";
795
+ }
796
+ },
797
+ getDataConditionRelate(data) {
798
+ if (Object.keys(data.data).length == 0)
799
+ return "\u7A7A";
800
+ const fieldData = data.data;
801
+ const field = fieldData.field;
802
+ let value;
803
+ if (fieldData.type == "\u9009\u9879") {
804
+ const rightField = fieldData.value;
805
+ value = `${JSON.stringify(rightField)}`;
806
+ } else if (fieldData.type == "\u5E38\u91CF" || fieldData.type == "\u5E03\u5C14") {
807
+ value = fieldData.value;
808
+ }
809
+ return `${field} ${fieldData.logic} ${value}`;
810
+ },
811
+ closeDialog() {
812
+ this.$refs.maxJsonDialog.close();
813
+ },
814
+ saveJson() {
815
+ this.$emit("change", this.result);
816
+ this.closeDialog();
817
+ }
818
+ }
819
+ };
820
+ const _hoisted_1 = { class: "conditionContainer" };
821
+ const _hoisted_2 = { class: "stringlist" };
822
+ const _hoisted_3 = ["innerHTML"];
823
+ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
824
+ const _component_ConditionGroup = resolveComponent("ConditionGroup");
825
+ const _component_el_main = ElMain;
826
+ const _component_el_button = ElButton;
827
+ const _component_el_footer = ElFooter;
828
+ const _component_el_container = ElContainer;
829
+ const _component_CustomDialog = resolveComponent("CustomDialog");
830
+ return openBlock(), createBlock(_component_CustomDialog, {
831
+ ref: "maxJsonDialog",
832
+ dialogclass: "conditionModule"
833
+ }, {
834
+ default: withCtx(() => [
835
+ createVNode(_component_el_main, { style: { "padding": "0" } }, {
836
+ default: withCtx(() => [
837
+ createVNode(_component_el_container, { style: { "height": "100%" } }, {
838
+ default: withCtx(() => [
839
+ createVNode(_component_el_main, { class: "my-pageMain" }, {
840
+ default: withCtx(() => [
841
+ _cache[0] || (_cache[0] = createElementVNode("div", { class: "tipContent" }, "\u6EE1\u8DB3\u4EE5\u4E0B\u6240\u6709\u6761\u4EF6\u65F6,\u6B64\u7EC4\u4EF6\u53EF\u7528", -1)),
842
+ createElementVNode("div", _hoisted_1, [
843
+ createVNode(_component_ConditionGroup, {
844
+ result: $data.result,
845
+ onUpdate: $options.handleUpdateForce,
846
+ fieldList: $data.leftField
847
+ }, null, 8, ["result", "onUpdate", "fieldList"]),
848
+ createElementVNode("div", _hoisted_2, [
849
+ createElementVNode("pre", { innerHTML: $data.stringLink }, null, 8, _hoisted_3)
850
+ ])
851
+ ])
852
+ ]),
853
+ _: 1,
854
+ __: [0]
855
+ }),
856
+ createVNode(_component_el_footer, {
857
+ class: "my-Footer",
858
+ style: { "height": "60px", "padding-top": "10px" }
859
+ }, {
860
+ default: withCtx(() => [
861
+ createVNode(_component_el_button, {
862
+ type: "primary",
863
+ onClick: $options.saveJson
864
+ }, {
865
+ default: withCtx(() => _cache[1] || (_cache[1] = [
866
+ createTextVNode("\u4FDD\u5B58", -1)
867
+ ])),
868
+ _: 1,
869
+ __: [1]
870
+ }, 8, ["onClick"]),
871
+ createVNode(_component_el_button, { onClick: $options.closeDialog }, {
872
+ default: withCtx(() => _cache[2] || (_cache[2] = [
873
+ createTextVNode("\u5173\u95ED", -1)
874
+ ])),
875
+ _: 1,
876
+ __: [2]
877
+ }, 8, ["onClick"])
878
+ ]),
879
+ _: 1
880
+ })
881
+ ]),
882
+ _: 1
883
+ })
884
+ ]),
885
+ _: 1
886
+ })
887
+ ]),
888
+ _: 1
889
+ }, 512);
890
+ }
891
+ var ConditionModule = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
892
+ export { ConditionModule as default };