@form-create/element-ui 2.5.37 → 2.6.0-alpha.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.
@@ -0,0 +1,4170 @@
1
+ /*!
2
+ * FormCreate 低代码表单渲染器
3
+ * @form-create/element-ui v2.6.0
4
+ * (c) 2018-2024 xaboy
5
+ * Github https://github.com/xaboy/form-create
6
+ * Site https://form-create.com/
7
+ * Released under the MIT License.
8
+ */
9
+ (function(){"use strict";try{if(typeof document!="undefined"){var o=document.createElement("style");o.appendChild(document.createTextNode('._fc-frame .fc-files img{width:100%;height:100%;display:inline-block;vertical-align:top}._fc-frame .fc-upload-btn{border:1px dashed #c0ccda;cursor:pointer}._fc-frame .fc-upload-cover{opacity:0;position:absolute;inset:0;background:#0009;-webkit-transition:opacity .3s;-o-transition:opacity .3s;transition:opacity .3s}._fc-frame .fc-upload-cover i{color:#fff;font-size:20px;cursor:pointer;margin:0 2px}._fc-frame .fc-files:hover .fc-upload-cover{opacity:1}._fc-frame .el-upload{display:block}._fc-frame .fc-upload-btn,.fc-files{display:inline-block;width:58px;height:58px;text-align:center;line-height:58px;border:1px solid #c0ccda;border-radius:4px;overflow:hidden;background:#fff;position:relative;-webkit-box-shadow:2px 2px 5px rgba(0,0,0,.1);box-shadow:2px 2px 5px #0000001a;margin-right:4px;-webkit-box-sizing:border-box;box-sizing:border-box}._fc-upload .fc-files img{width:100%;height:100%;display:inline-block;vertical-align:top}._fc-upload .fc-upload-btn{border:1px dashed #c0ccda;cursor:pointer}._fc-upload .fc-upload-cover{opacity:0;position:absolute;inset:0;background:#0009;-webkit-transition:opacity .3s;-o-transition:opacity .3s;transition:opacity .3s}._fc-upload .fc-upload-cover i{color:#fff;font-size:20px;cursor:pointer;margin:0 2px}._fc-upload .fc-files:hover .fc-upload-cover{opacity:1}._fc-upload .el-upload{display:block}._fc-upload .fc-upload-btn,._fc-upload .fc-files{display:inline-block;width:58px;height:58px;text-align:center;line-height:58px;border:1px solid #c0ccda;border-radius:4px;overflow:hidden;background:#fff;position:relative;-webkit-box-shadow:2px 2px 5px rgba(0,0,0,.1);box-shadow:2px 2px 5px #0000001a;margin-right:4px;-webkit-box-sizing:border-box;box-sizing:border-box}._fc-group{display:flex;min-height:42px;justify-content:center;flex-direction:column}._fc-group-disabled ._fc-group-btn,._fc-group-disabled ._fc-group-add{cursor:not-allowed}._fc-group-handle{display:flex;flex-direction:row;position:absolute;bottom:-15px;right:30px;border-radius:15px;border:1px dashed #d9d9d9;padding:3px 8px;background-color:#fff}._fc-group-btn{cursor:pointer}._fc-group-idx{position:absolute;bottom:-15px;left:10px;width:30px;height:30px;display:flex;align-items:center;justify-content:center;background:#eee;border-radius:15px;font-weight:700}._fc-group-handle ._fc-group-btn+._fc-group-btn{margin-left:7px}._fc-group-container{position:relative;display:flex;flex-direction:column;border:1px dashed #d9d9d9;padding:20px 20px 25px;margin:5px 5px 25px;border-radius:5px}._fc-group-arrow{position:relative;width:20px;height:20px}._fc-group-arrow:before{content:"";position:absolute;top:8px;left:5px;width:9px;height:9px;border-left:2px solid #999;border-top:2px solid #999}._fc-group-arrow:before{transform:rotate(45deg)}._fc-group-arrow._fc-group-down{transform:rotate(180deg)}._fc-group-plus-minus{width:20px;height:20px;position:relative;cursor:pointer}._fc-group-plus-minus:before,._fc-group-plus-minus:after{content:"";position:absolute;top:50%;left:50%;width:60%;height:2px;background-color:#409eff;transform:translate(-50%,-50%)}._fc-group-plus-minus:before{transform:translate(-50%,-50%) rotate(90deg)}._fc-group-plus-minus._fc-group-minus:before{display:none}._fc-group-plus-minus._fc-group-minus:after{background-color:#f56c6c}._fc-group-add{cursor:pointer;width:25px;height:25px;border:1px solid rgb(64 158 255 / 50%);border-radius:15px}._fc-group-add._fc-group-plus-minus:before,._fc-group-add._fc-group-plus-minus:after{width:50%}.form-create .form-create .el-form-item{margin-bottom:22px}.form-create .form-create .el-form-item .el-form-item{margin-bottom:0}')),document.head.appendChild(o)}}catch(r){console.error("vite-plugin-css-injected-by-js",r)}})();
10
+ var gt = Object.defineProperty, $t = Object.defineProperties;
11
+ var vt = Object.getOwnPropertyDescriptors;
12
+ var Fe = Object.getOwnPropertySymbols;
13
+ var bt = Object.prototype.hasOwnProperty, Ct = Object.prototype.propertyIsEnumerable;
14
+ var Se = (t, e, r) => e in t ? gt(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, y = (t, e) => {
15
+ for (var r in e || (e = {}))
16
+ bt.call(e, r) && Se(t, r, e[r]);
17
+ if (Fe)
18
+ for (var r of Fe(e))
19
+ Ct.call(e, r) && Se(t, r, e[r]);
20
+ return t;
21
+ }, q = (t, e) => $t(t, vt(e));
22
+ import Y, { h as p } from "vue";
23
+ function _t(t) {
24
+ return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
25
+ }
26
+ function le() {
27
+ return le = Object.assign ? Object.assign.bind() : function(t) {
28
+ for (var e, r = 1; r < arguments.length; r++) for (var i in e = arguments[r], e) Object.prototype.hasOwnProperty.call(e, i) && (t[i] = e[i]);
29
+ return t;
30
+ }, le.apply(this, arguments);
31
+ }
32
+ var kt = ["attrs", "props", "domProps"], Ot = ["class", "style", "directives"], wt = ["on", "nativeOn"], Ft = function(t) {
33
+ return t.reduce(function(e, r) {
34
+ for (var i in r) if (!e[i]) e[i] = r[i];
35
+ else if (kt.indexOf(i) !== -1) e[i] = le({}, e[i], r[i]);
36
+ else if (Ot.indexOf(i) !== -1) {
37
+ var s = e[i] instanceof Array ? e[i] : [e[i]], n = r[i] instanceof Array ? r[i] : [r[i]];
38
+ e[i] = [].concat(s, n);
39
+ } else if (wt.indexOf(i) !== -1)
40
+ for (var o in r[i]) if (e[i][o]) {
41
+ var a = e[i][o] instanceof Array ? e[i][o] : [e[i][o]], u = r[i][o] instanceof Array ? r[i][o] : [r[i][o]];
42
+ e[i][o] = [].concat(a, u);
43
+ } else e[i][o] = r[i][o];
44
+ else if (i === "hook") for (var l in r[i]) e[i][l] = e[i][l] ? St(e[i][l], r[i][l]) : r[i][l];
45
+ else e[i] = r[i];
46
+ return e;
47
+ }, {});
48
+ }, St = function(t, e) {
49
+ return function() {
50
+ t && t.apply(this, arguments), e && e.apply(this, arguments);
51
+ };
52
+ }, Rt = Ft;
53
+ const S = /* @__PURE__ */ _t(Rt);
54
+ function ee(t, e) {
55
+ return Object.keys(t).reduce((r, i) => ((!e || e.indexOf(i) === -1) && r.push(t[i]), r), []);
56
+ }
57
+ const Et = "fcCheckbox", jt = {
58
+ name: Et,
59
+ props: {
60
+ formCreateInject: {
61
+ type: Object,
62
+ required: !0
63
+ },
64
+ value: {
65
+ type: Array,
66
+ default: () => []
67
+ },
68
+ type: String
69
+ },
70
+ watch: {
71
+ "formCreateInject.options": {
72
+ handler() {
73
+ this.update();
74
+ },
75
+ deep: !0
76
+ },
77
+ value() {
78
+ this.update();
79
+ }
80
+ },
81
+ data() {
82
+ return {
83
+ trueValue: []
84
+ };
85
+ },
86
+ methods: {
87
+ options() {
88
+ const t = this.formCreateInject.options;
89
+ return Array.isArray(t) ? t : [];
90
+ },
91
+ onInput(t) {
92
+ this.$emit("input", this.options().filter((e) => t.indexOf(e.label) !== -1).map((e) => e.value).filter((e) => e !== void 0));
93
+ },
94
+ update() {
95
+ const t = Array.isArray(this.value) ? this.value : [this.value];
96
+ this.trueValue = this.options().filter((e) => t.indexOf(e.value) !== -1).map((e) => e.label);
97
+ }
98
+ },
99
+ created() {
100
+ this.update();
101
+ },
102
+ render() {
103
+ return p("ElCheckboxGroup", S([{}, this.formCreateInject.prop, {}, {
104
+ props: {
105
+ value: this.trueValue
106
+ }
107
+ }, {
108
+ ref: "el",
109
+ on: {
110
+ input: this.onInput
111
+ }
112
+ }]), [this.options().map((t, e) => {
113
+ const r = y({}, t), i = this.type === "button" ? "ElCheckboxButton" : "ElCheckbox";
114
+ return delete r.value, p(i, S([{}, {
115
+ props: r
116
+ }, {
117
+ key: i + e + "-" + t.value
118
+ }]));
119
+ }), ee(this.$slots)]);
120
+ },
121
+ mounted() {
122
+ this.$emit("fc.el", this.$refs.el);
123
+ }
124
+ };
125
+ function I(t) {
126
+ return Array.isArray(t) ? t : [null, void 0, ""].indexOf(t) > -1 ? [] : [t];
127
+ }
128
+ const It = "fcFrame", At = {
129
+ name: It,
130
+ props: {
131
+ formCreateInject: {
132
+ type: Object,
133
+ required: !0
134
+ },
135
+ type: {
136
+ type: String,
137
+ default: "input"
138
+ },
139
+ field: String,
140
+ helper: {
141
+ type: Boolean,
142
+ default: !0
143
+ },
144
+ disabled: {
145
+ type: Boolean,
146
+ default: !1
147
+ },
148
+ src: {
149
+ type: String,
150
+ required: !0
151
+ },
152
+ icon: {
153
+ type: String,
154
+ default: "el-icon-upload2"
155
+ },
156
+ width: {
157
+ type: String,
158
+ default: "500px"
159
+ },
160
+ height: {
161
+ type: String,
162
+ default: "370px"
163
+ },
164
+ maxLength: {
165
+ type: Number,
166
+ default: 0
167
+ },
168
+ okBtnText: {
169
+ type: String,
170
+ default: "确定"
171
+ },
172
+ closeBtnText: {
173
+ type: String,
174
+ default: "关闭"
175
+ },
176
+ modalTitle: String,
177
+ handleIcon: {
178
+ type: [String, Boolean],
179
+ default: void 0
180
+ },
181
+ title: String,
182
+ allowRemove: {
183
+ type: Boolean,
184
+ default: !0
185
+ },
186
+ onOpen: {
187
+ type: Function,
188
+ default: () => {
189
+ }
190
+ },
191
+ onOk: {
192
+ type: Function,
193
+ default: () => {
194
+ }
195
+ },
196
+ onCancel: {
197
+ type: Function,
198
+ default: () => {
199
+ }
200
+ },
201
+ onLoad: {
202
+ type: Function,
203
+ default: () => {
204
+ }
205
+ },
206
+ onBeforeRemove: {
207
+ type: Function,
208
+ default: () => {
209
+ }
210
+ },
211
+ onRemove: {
212
+ type: Function,
213
+ default: () => {
214
+ }
215
+ },
216
+ onHandle: {
217
+ type: Function,
218
+ default(t) {
219
+ this.previewImage = this.getSrc(t), this.previewVisible = !0;
220
+ }
221
+ },
222
+ modal: {
223
+ type: Object,
224
+ default: () => ({})
225
+ },
226
+ srcKey: {
227
+ type: [String, Number]
228
+ },
229
+ value: [Array, String, Number, Object],
230
+ previewMask: void 0,
231
+ footer: {
232
+ type: Boolean,
233
+ default: !0
234
+ },
235
+ reload: {
236
+ type: Boolean,
237
+ default: !0
238
+ },
239
+ closeBtn: {
240
+ type: Boolean,
241
+ default: !0
242
+ },
243
+ okBtn: {
244
+ type: Boolean,
245
+ default: !0
246
+ }
247
+ },
248
+ data() {
249
+ return {
250
+ fileList: I(this.value),
251
+ previewVisible: !1,
252
+ frameVisible: !1,
253
+ previewImage: ""
254
+ };
255
+ },
256
+ watch: {
257
+ value(t) {
258
+ this.fileList = I(t);
259
+ },
260
+ fileList(t) {
261
+ const e = this.maxLength === 1 ? t[0] || "" : t;
262
+ this.$emit("input", e), this.$emit("change", e);
263
+ },
264
+ src(t) {
265
+ this.modalVm && (this.modalVm.src = t);
266
+ }
267
+ },
268
+ methods: {
269
+ key(t) {
270
+ return t;
271
+ },
272
+ closeModel(t) {
273
+ this.$emit(t ? "$close" : "$ok"), this.reload && (this.$off("$ok"), this.$off("$close")), this.frameVisible = !1;
274
+ },
275
+ handleCancel() {
276
+ this.previewVisible = !1;
277
+ },
278
+ showModel() {
279
+ this.disabled || this.onOpen() === !1 || (this.frameVisible = !0);
280
+ },
281
+ makeInput() {
282
+ const t = {
283
+ type: "text",
284
+ value: this.fileList.map((e) => this.getSrc(e)).toString(),
285
+ readonly: !0
286
+ };
287
+ return p("ElInput", S([{}, {
288
+ props: t
289
+ }, {
290
+ key: this.key("input")
291
+ }]), [this.fileList.length ? p("i", {
292
+ slot: "suffix",
293
+ class: "el-input__icon el-icon-circle-close",
294
+ on: {
295
+ click: () => this.fileList = []
296
+ }
297
+ }) : null, p("ElButton", S([{
298
+ attrs: {
299
+ icon: this.icon
300
+ }
301
+ }, {
302
+ on: {
303
+ click: () => this.showModel()
304
+ }
305
+ }, {
306
+ slot: "append"
307
+ }]))]);
308
+ },
309
+ makeGroup(t) {
310
+ return (!this.maxLength || this.fileList.length < this.maxLength) && t.push(this.makeBtn()), p("div", {
311
+ key: this.key("group")
312
+ }, [...t]);
313
+ },
314
+ makeItem(t, e) {
315
+ return p("div", {
316
+ class: "fc-files",
317
+ key: this.key("file" + t)
318
+ }, [...e]);
319
+ },
320
+ valid(t) {
321
+ const e = this.formCreateInject.field || this.field;
322
+ if (e && t !== e)
323
+ throw new Error("[frame]无效的字段值");
324
+ },
325
+ makeIcons(t, e) {
326
+ if (this.handleIcon !== !1 || this.allowRemove === !0) {
327
+ const r = [];
328
+ return (this.type !== "file" && this.handleIcon !== !1 || this.type === "file" && this.handleIcon) && r.push(this.makeHandleIcon(t, e)), this.allowRemove && r.push(this.makeRemoveIcon(t, e)), p("div", {
329
+ class: "fc-upload-cover",
330
+ key: this.key("uc")
331
+ }, [r]);
332
+ }
333
+ },
334
+ makeHandleIcon(t, e) {
335
+ return p("i", {
336
+ class: this.handleIcon === !0 || this.handleIcon === void 0 ? "el-icon-view" : this.handleIcon,
337
+ on: {
338
+ click: () => this.handleClick(t)
339
+ },
340
+ key: this.key("hi" + e)
341
+ });
342
+ },
343
+ makeRemoveIcon(t, e) {
344
+ return p("i", {
345
+ class: "el-icon-delete",
346
+ on: {
347
+ click: () => this.handleRemove(t)
348
+ },
349
+ key: this.key("ri" + e)
350
+ });
351
+ },
352
+ makeFiles() {
353
+ return this.makeGroup(this.fileList.map((t, e) => this.makeItem(e, [p("i", {
354
+ class: "el-icon-tickets",
355
+ on: {
356
+ click: () => this.handleClick(t)
357
+ }
358
+ }), this.makeIcons(t, e)])));
359
+ },
360
+ makeImages() {
361
+ return this.makeGroup(this.fileList.map((t, e) => this.makeItem(e, [p("img", {
362
+ attrs: {
363
+ src: this.getSrc(t)
364
+ }
365
+ }), this.makeIcons(t, e)])));
366
+ },
367
+ makeBtn() {
368
+ return p("div", {
369
+ class: "fc-upload-btn",
370
+ on: {
371
+ click: () => this.showModel()
372
+ },
373
+ key: this.key("btn")
374
+ }, [p("i", {
375
+ class: this.icon
376
+ })]);
377
+ },
378
+ handleClick(t) {
379
+ return this.onHandle(t);
380
+ },
381
+ handleRemove(t) {
382
+ this.disabled || this.onBeforeRemove(t) !== !1 && (this.fileList.splice(this.fileList.indexOf(t), 1), this.onRemove(t));
383
+ },
384
+ getSrc(t) {
385
+ return this.srcKey ? t[this.srcKey] : t;
386
+ },
387
+ frameLoad(t) {
388
+ this.onLoad(t);
389
+ try {
390
+ this.helper === !0 && (t.form_create_helper = {
391
+ api: this.formCreateInject.api,
392
+ close: (e) => {
393
+ this.valid(e), this.closeModel();
394
+ },
395
+ set: (e, r) => {
396
+ this.valid(e), this.disabled || this.$emit("input", r);
397
+ },
398
+ get: (e) => (this.valid(e), this.value),
399
+ onOk: (e) => this.$on("$ok", e),
400
+ onClose: (e) => this.$on("$close", e)
401
+ });
402
+ } catch (e) {
403
+ console.log(e);
404
+ }
405
+ },
406
+ makeFooter() {
407
+ const {
408
+ okBtnText: t,
409
+ closeBtnText: e,
410
+ closeBtn: r,
411
+ okBtn: i,
412
+ footer: s
413
+ } = this.$props;
414
+ if (s)
415
+ return p("div", {
416
+ slot: "footer"
417
+ }, [r ? p("ElButton", {
418
+ on: {
419
+ click: () => this.onCancel() !== !1 && (this.frameVisible = !1)
420
+ }
421
+ }, [e]) : null, i ? p("ElButton", {
422
+ attrs: {
423
+ type: "primary"
424
+ },
425
+ on: {
426
+ click: () => this.onOk() !== !1 && this.closeModel()
427
+ }
428
+ }, [t]) : null]);
429
+ }
430
+ },
431
+ render() {
432
+ const t = this.type;
433
+ let e;
434
+ t === "input" ? e = this.makeInput() : t === "image" ? e = this.makeImages() : e = this.makeFiles();
435
+ const {
436
+ width: r = "30%",
437
+ height: i,
438
+ src: s,
439
+ title: n,
440
+ modalTitle: o
441
+ } = this.$props;
442
+ return this.$nextTick(() => {
443
+ this.$refs.frame && this.frameLoad(this.$refs.frame.contentWindow || {});
444
+ }), p("div", {
445
+ class: "_fc-frame"
446
+ }, [e, p("el-dialog", S([{}, {
447
+ props: {
448
+ appendToBody: !0,
449
+ modal: this.previewMask,
450
+ title: o,
451
+ visible: this.previewVisible
452
+ }
453
+ }, {
454
+ on: {
455
+ close: this.handleCancel
456
+ }
457
+ }]), [p("img", {
458
+ style: "width: 100%",
459
+ attrs: {
460
+ src: this.previewImage
461
+ }
462
+ })]), p("el-dialog", S([{}, {
463
+ props: q(y({
464
+ width: r,
465
+ title: n,
466
+ appendToBody: !0
467
+ }, this.modal), {
468
+ visible: this.frameVisible
469
+ })
470
+ }, {
471
+ on: {
472
+ close: () => this.closeModel(!0)
473
+ }
474
+ }]), [this.frameVisible || !this.reload ? p("iframe", {
475
+ ref: "frame",
476
+ attrs: {
477
+ src: s,
478
+ frameBorder: "0"
479
+ },
480
+ style: {
481
+ height: i,
482
+ border: "0 none",
483
+ width: "100%"
484
+ }
485
+ }) : null, this.makeFooter()])]);
486
+ },
487
+ mounted() {
488
+ this.$on("fc.closeModal", this.closeModal);
489
+ }
490
+ }, Vt = "fcRadio", Pt = {
491
+ name: Vt,
492
+ props: {
493
+ formCreateInject: {
494
+ type: Object,
495
+ required: !0
496
+ },
497
+ value: {},
498
+ type: String
499
+ },
500
+ watch: {
501
+ "formCreateInject.options": {
502
+ handler() {
503
+ this.update();
504
+ },
505
+ deep: !0
506
+ },
507
+ value() {
508
+ this.update();
509
+ }
510
+ },
511
+ data() {
512
+ return {
513
+ trueValue: []
514
+ };
515
+ },
516
+ methods: {
517
+ options() {
518
+ const t = this.formCreateInject.options;
519
+ return Array.isArray(t) ? t : [];
520
+ },
521
+ onInput(t) {
522
+ this.$emit("input", this.options().filter((e) => e.label === t).reduce((e, r) => r.value, ""));
523
+ },
524
+ update() {
525
+ this.trueValue = this.options().filter((t) => t.value === this.value).reduce((t, e) => e.label, "");
526
+ }
527
+ },
528
+ created() {
529
+ this.update();
530
+ },
531
+ render() {
532
+ return p("ElRadioGroup", S([{}, this.formCreateInject.prop, {
533
+ ref: "el"
534
+ }, {
535
+ props: {
536
+ value: this.trueValue
537
+ }
538
+ }, {
539
+ on: {
540
+ input: this.onInput
541
+ }
542
+ }]), [this.options().map((t, e) => {
543
+ const r = y({}, t), i = this.type === "button" ? "ElRadioButton" : "ElRadio";
544
+ return delete r.value, p(i, S([{}, {
545
+ props: r
546
+ }, {
547
+ key: i + e + "-" + t.value
548
+ }]));
549
+ }), ee(this.$slots)]);
550
+ },
551
+ mounted() {
552
+ this.$emit("fc.el", this.$refs.el);
553
+ }
554
+ }, c = {
555
+ type(t, e) {
556
+ return Object.prototype.toString.call(t) === "[object " + e + "]";
557
+ },
558
+ Undef(t) {
559
+ return t == null;
560
+ },
561
+ Element(t) {
562
+ return typeof t == "object" && t !== null && t.nodeType === 1 && !c.Object(t);
563
+ },
564
+ trueArray(t) {
565
+ return Array.isArray(t) && t.length > 0;
566
+ },
567
+ Function(t) {
568
+ const e = this.getType(t);
569
+ return e === "Function" || e === "AsyncFunction";
570
+ },
571
+ getType(t) {
572
+ const e = Object.prototype.toString.call(t);
573
+ return /^\[object (.*)\]$/.exec(e)[1];
574
+ },
575
+ empty(t) {
576
+ return t == null || Array.isArray(t) && Array.isArray(t) && !t.length ? !0 : typeof t == "string" && !t;
577
+ }
578
+ };
579
+ ["Date", "Object", "String", "Boolean", "Array", "Number"].forEach((t) => {
580
+ c[t] = function(e) {
581
+ return c.type(e, t);
582
+ };
583
+ });
584
+ function w(t, e) {
585
+ return {}.hasOwnProperty.call(t, e);
586
+ }
587
+ const Tt = "fcSelect", Dt = {
588
+ name: Tt,
589
+ functional: !0,
590
+ props: {
591
+ formCreateInject: {
592
+ type: Object,
593
+ required: !0
594
+ }
595
+ },
596
+ render(t, e) {
597
+ const r = (n, o) => {
598
+ const a = n.slot;
599
+ return t("ElOption", S([{}, {
600
+ props: n
601
+ }, {
602
+ key: "" + o + "-" + n.value
603
+ }]), [a ? t("template", {
604
+ slot: n.slotName || "default"
605
+ }, [c.Function(a) ? n.slot(t) : a]) : null]);
606
+ }, i = (n, o) => t("ElOptionGroup", {
607
+ attrs: {
608
+ label: n.label
609
+ },
610
+ key: "" + o + "-" + n.label
611
+ }, [c.trueArray(n.options) && n.options.map((a, u) => r(a, u))]), s = e.props.formCreateInject.options;
612
+ return t("ElSelect", S([{}, e.data, {
613
+ ref: "el"
614
+ }]), [(Array.isArray(s) ? s : []).map((n, o) => w(n || "", "options") ? i(n, o) : r(n, o)), e.children]);
615
+ },
616
+ mounted() {
617
+ this.$emit("fc.el", this.$refs.el);
618
+ }
619
+ }, Bt = "fcTree", Lt = {
620
+ name: Bt,
621
+ formCreateParser: {
622
+ mergeProp(t) {
623
+ const e = t.prop.props;
624
+ e.nodeKey || (e.nodeKey = "id"), e.props || (e.props = {
625
+ label: "title"
626
+ });
627
+ }
628
+ },
629
+ props: {
630
+ formCreateInject: {
631
+ type: Object,
632
+ required: !0
633
+ },
634
+ type: {
635
+ type: String,
636
+ default: "checked"
637
+ },
638
+ value: {
639
+ type: [Array, String, Number],
640
+ default: () => []
641
+ }
642
+ },
643
+ watch: {
644
+ value() {
645
+ this.setValue();
646
+ }
647
+ },
648
+ methods: {
649
+ onChange() {
650
+ this.updateValue();
651
+ },
652
+ updateValue() {
653
+ if (!this.$refs.tree) return;
654
+ const t = this.type.toLocaleLowerCase();
655
+ let e;
656
+ t === "selected" ? e = this.$refs.tree.getCurrentKey() : e = this.$refs.tree.getCheckedKeys(), this.$emit("input", e);
657
+ },
658
+ setValue() {
659
+ this.type.toLocaleLowerCase() === "selected" ? this.$refs.tree.setCurrentKey(this.value) : this.$refs.tree.setCheckedKeys(I(this.value));
660
+ }
661
+ },
662
+ render() {
663
+ return p("ElTree", S([{}, this.formCreateInject.prop, {
664
+ ref: "tree",
665
+ on: {
666
+ check: () => this.updateValue(),
667
+ "node-click": () => this.updateValue()
668
+ }
669
+ }]), [ee(this.$slots)]);
670
+ },
671
+ mounted() {
672
+ this.setValue(), this.$emit("fc.el", this.$refs.tree);
673
+ }
674
+ };
675
+ function Re(t, e) {
676
+ return {
677
+ url: t,
678
+ name: Nt(t),
679
+ uid: e
680
+ };
681
+ }
682
+ function Nt(t) {
683
+ return ("" + t).split("/").pop();
684
+ }
685
+ const Mt = "fcUpload", qt = {
686
+ name: Mt,
687
+ props: {
688
+ formCreateInject: {
689
+ type: Object,
690
+ required: !0
691
+ },
692
+ onHandle: {
693
+ type: Function,
694
+ default(t) {
695
+ this.previewImage = t.url, this.previewVisible = !0;
696
+ }
697
+ },
698
+ uploadType: {
699
+ type: String,
700
+ default: "file"
701
+ },
702
+ limit: {
703
+ type: Number,
704
+ default: 0
705
+ },
706
+ allowRemove: {
707
+ type: Boolean,
708
+ default: !0
709
+ },
710
+ previewMask: void 0,
711
+ modalTitle: String,
712
+ handleIcon: {
713
+ type: [String, Boolean],
714
+ default: () => {
715
+ }
716
+ },
717
+ value: [Array, String]
718
+ },
719
+ data() {
720
+ return {
721
+ uploadList: [],
722
+ previewVisible: !1,
723
+ previewImage: "",
724
+ cacheFiles: []
725
+ };
726
+ },
727
+ created() {
728
+ this.formCreateInject.prop.props.showFileList === void 0 && (this.formCreateInject.prop.props.showFileList = !1), this.formCreateInject.prop.props.fileList = I(this.value).map(Re);
729
+ },
730
+ watch: {
731
+ value(t) {
732
+ this.$refs.upload.uploadFiles.every((e) => !e.status || e.status === "success") && (this.$refs.upload.uploadFiles = I(t).map(Re), this.uploadList = this.$refs.upload.uploadFiles);
733
+ },
734
+ limit(t, e) {
735
+ (e === 1 || t === 1) && this.update();
736
+ }
737
+ },
738
+ methods: {
739
+ key(t) {
740
+ return t;
741
+ },
742
+ isDisabled() {
743
+ return this.formCreateInject.prop.props.disabled === !0;
744
+ },
745
+ onRemove(t) {
746
+ this.isDisabled() || this.$refs.upload.handleRemove(t);
747
+ },
748
+ handleClick(t) {
749
+ this.onHandle(t);
750
+ },
751
+ makeItem(t, e) {
752
+ return this.uploadType === "image" ? p("img", {
753
+ attrs: {
754
+ src: t.url
755
+ },
756
+ key: this.key("img" + e)
757
+ }) : p("i", {
758
+ class: "el-icon-tickets",
759
+ key: this.key("i" + e)
760
+ });
761
+ },
762
+ makeRemoveIcon(t, e) {
763
+ return p("i", {
764
+ class: "el-icon-delete",
765
+ on: {
766
+ click: () => this.onRemove(t)
767
+ },
768
+ key: this.key("ri" + e)
769
+ });
770
+ },
771
+ makeHandleIcon(t, e) {
772
+ return p("i", {
773
+ class: this.handleIcon === !0 || this.handleIcon === void 0 ? "el-icon-view" : this.handleIcon,
774
+ on: {
775
+ click: () => this.handleClick(t)
776
+ },
777
+ key: this.key("hi" + e)
778
+ });
779
+ },
780
+ makeProgress(t, e) {
781
+ return p("ElProgress", S([{}, {
782
+ props: {
783
+ percentage: t.percentage,
784
+ type: "circle",
785
+ width: 52
786
+ }
787
+ }, {
788
+ style: "margin-top:2px;",
789
+ key: this.key("pg" + e)
790
+ }]));
791
+ },
792
+ makeIcons(t, e) {
793
+ const r = [];
794
+ if (this.allowRemove || this.handleIcon !== !1)
795
+ return (this.uploadType !== "file" && this.handleIcon !== !1 || this.uploadType === "file" && this.handleIcon) && r.push(this.makeHandleIcon(t, e)), this.allowRemove && r.push(this.makeRemoveIcon(t, e)), p("div", {
796
+ class: "fc-upload-cover"
797
+ }, [r]);
798
+ },
799
+ makeFiles() {
800
+ return this.uploadList.map((t, e) => this.$scopedSlots.fileList ? this.$scopedSlots.fileList({
801
+ file: t,
802
+ index: e,
803
+ vm: this
804
+ }) : p("div", {
805
+ key: this.key(e),
806
+ class: "fc-files"
807
+ }, [t.percentage !== void 0 && t.status !== "success" ? this.makeProgress(t, e) : [this.makeItem(t, e), this.makeIcons(t, e)]]));
808
+ },
809
+ makeUpload() {
810
+ const t = !this.limit || this.limit > this.uploadList.length;
811
+ return p("ElUpload", S([{}, this.formCreateInject.prop, {}, {
812
+ style: {
813
+ display: "inline-block"
814
+ },
815
+ key: this.key("upload"),
816
+ ref: "upload"
817
+ }]), [t ? p("template", {
818
+ slot: "default"
819
+ }, [this.$slots.default || p("div", {
820
+ class: "fc-upload-btn"
821
+ }, [p("i", {
822
+ class: "el-icon-upload2"
823
+ })])]) : null, ee(this.$slots, ["default"])]);
824
+ },
825
+ update() {
826
+ let t = this.$refs.upload.uploadFiles.map((e) => e.url).filter((e) => e !== void 0);
827
+ (this.cacheFiles.length !== t.length || !t.length) && (this.cacheFiles = [...t], this.$emit("input", this.limit === 1 ? t[0] || "" : t));
828
+ },
829
+ handleCancel() {
830
+ this.previewVisible = !1;
831
+ }
832
+ },
833
+ render() {
834
+ return this.$refs.upload && (this.formCreateInject.prop.props.showFileList === void 0 && (this.formCreateInject.prop.props.showFileList = this.$refs.upload.showFileList), this.formCreateInject.prop.props.fileList = this.$refs.upload.fileList), p("div", {
835
+ class: "_fc-upload"
836
+ }, [[this.formCreateInject.prop.props.showFileList ? [] : this.makeFiles(), this.makeUpload()], p("el-dialog", S([{}, {
837
+ props: {
838
+ appendToBody: !0,
839
+ modal: this.previewMask,
840
+ title: this.modalTitle,
841
+ visible: this.previewVisible
842
+ }
843
+ }, {
844
+ on: {
845
+ close: this.handleCancel
846
+ }
847
+ }]), [p("img", {
848
+ attrs: {
849
+ alt: "example",
850
+ src: this.previewImage
851
+ },
852
+ style: "width: 100%"
853
+ })])]);
854
+ },
855
+ mounted() {
856
+ this.uploadList = this.$refs.upload.uploadFiles, this.$watch(() => this.$refs.upload.uploadFiles, () => {
857
+ this.update();
858
+ }, {
859
+ deep: !0
860
+ }), this.$emit("fc.el", this.$refs.upload);
861
+ }
862
+ };
863
+ function F(t, e, r) {
864
+ Y.set(t, e, r);
865
+ }
866
+ function N(t, e) {
867
+ Y.delete(t, e);
868
+ }
869
+ function G(t, e = {}, r) {
870
+ let i = !1;
871
+ for (let s in e)
872
+ if (Object.prototype.hasOwnProperty.call(e, s)) {
873
+ let n = e[s];
874
+ if ((i = Array.isArray(n)) || c.Object(n)) {
875
+ let o = t[s] === void 0;
876
+ if (i)
877
+ i = !1, o && F(t, s, []);
878
+ else if (n._clone && r !== void 0)
879
+ if (r)
880
+ n = n.getRule(), o && F(t, s, {});
881
+ else {
882
+ F(t, s, n._clone());
883
+ continue;
884
+ }
885
+ else
886
+ o && F(t, s, {});
887
+ t[s] = G(t[s], n, r);
888
+ } else
889
+ F(t, s, n), c.Undef(n) || (c.Undef(n.__json) || (t[s].__json = n.__json), c.Undef(n.__origin) || (t[s].__origin = n.__origin));
890
+ }
891
+ return r !== void 0 && Array.isArray(t) ? t.filter((s) => !s || !s.__ctrl) : t;
892
+ }
893
+ function M(t) {
894
+ return G({}, { value: t }).value;
895
+ }
896
+ const Ut = Object.assign || function(t) {
897
+ for (let e, r = 1; r < arguments.length; r++)
898
+ for (let i in e = arguments[r], e)
899
+ Object.prototype.hasOwnProperty.call(e, i) && F(t, i, e[i]);
900
+ return t;
901
+ };
902
+ function m() {
903
+ return Ut.apply(this, arguments);
904
+ }
905
+ const Ht = "fcGroup", xt = {
906
+ name: Ht,
907
+ props: {
908
+ field: String,
909
+ rule: [Array, Object],
910
+ rules: Array,
911
+ expand: Number,
912
+ options: Object,
913
+ formCreateInject: {
914
+ type: Object,
915
+ required: !0
916
+ },
917
+ button: {
918
+ type: Boolean,
919
+ default: !0
920
+ },
921
+ max: {
922
+ type: Number,
923
+ default: 0
924
+ },
925
+ min: {
926
+ type: Number,
927
+ default: 0
928
+ },
929
+ value: {
930
+ type: Array,
931
+ default: () => []
932
+ },
933
+ sortBtn: {
934
+ type: Boolean,
935
+ default: !0
936
+ },
937
+ defaultValue: Object,
938
+ disabled: {
939
+ type: Boolean,
940
+ default: !1
941
+ },
942
+ syncDisabled: {
943
+ type: Boolean,
944
+ default: !0
945
+ },
946
+ onBeforeRemove: {
947
+ type: Function,
948
+ default: () => {
949
+ }
950
+ },
951
+ onBeforeAdd: {
952
+ type: Function,
953
+ default: () => {
954
+ }
955
+ },
956
+ parse: Function
957
+ },
958
+ data() {
959
+ return {
960
+ len: 0,
961
+ cacheRule: {},
962
+ cacheValue: {},
963
+ sort: [],
964
+ type: void 0
965
+ };
966
+ },
967
+ computed: {
968
+ formRule() {
969
+ return this.rules ? this.rules : this.rule ? Array.isArray(this.rule) ? this.rule : [this.rule] : [];
970
+ }
971
+ },
972
+ watch: {
973
+ cacheRule: {
974
+ handler(t) {
975
+ this.sort = Object.keys(t);
976
+ },
977
+ immediate: !0
978
+ },
979
+ formRule: {
980
+ handler(t, e) {
981
+ Object.keys(this.cacheRule).forEach((r) => {
982
+ const i = this.cacheRule[r];
983
+ if (i.$f) {
984
+ const s = i.$f.formData();
985
+ if (t === e)
986
+ i.$f.deferSyncValue(() => {
987
+ G(i.rule, t), i.$f.setValue(s);
988
+ }, !0);
989
+ else {
990
+ const n = i.$f.formData();
991
+ i.$f.once("reloading", () => {
992
+ i.$f.setValue(n);
993
+ }), i.rule = M(t);
994
+ }
995
+ }
996
+ });
997
+ },
998
+ deep: !0
999
+ },
1000
+ expand(t) {
1001
+ let e = t - this.value.length;
1002
+ e > 0 && this.expandRule(e);
1003
+ },
1004
+ value(t, e) {
1005
+ t = t || [];
1006
+ let r = this.sort, i = r.length, s = i - t.length;
1007
+ if (s < 0) {
1008
+ for (let n = s; n < 0; n++)
1009
+ this.addRule(t.length + n);
1010
+ this.sort = Object.keys(this.cacheRule);
1011
+ for (let n = 0; n < i; n++)
1012
+ this.setValue(r[n], t[n]);
1013
+ } else {
1014
+ if (s > 0) {
1015
+ for (let n = 0; n < s; n++)
1016
+ this.removeRule(r[i - n - 1]);
1017
+ this.sort = Object.keys(this.cacheRule);
1018
+ }
1019
+ t.forEach((n, o) => {
1020
+ this.setValue(r[o], t[o]);
1021
+ });
1022
+ }
1023
+ }
1024
+ },
1025
+ methods: {
1026
+ _value(t) {
1027
+ return t && w(t, this.field) ? t[this.field] : t;
1028
+ },
1029
+ cache(t, e) {
1030
+ this.cacheValue[t] = JSON.stringify(e);
1031
+ },
1032
+ input(t) {
1033
+ this.$emit("input", t), this.$emit("change", t);
1034
+ },
1035
+ formData(t, e) {
1036
+ const r = this.cacheRule, i = this.sort;
1037
+ if (i.filter((n) => r[n].$f).length !== i.length)
1038
+ return;
1039
+ const s = i.map((n) => {
1040
+ const o = t === n ? e : y({}, this.cacheRule[n].$f.form), a = this.field ? o[this.field] || null : o;
1041
+ return this.cache(n, a), a;
1042
+ });
1043
+ this.input(s);
1044
+ },
1045
+ setValue(t, e) {
1046
+ const r = this.field, i = this.cacheRule[t].$f;
1047
+ r && (e = {
1048
+ [r]: this._value(e)
1049
+ }), this.cacheValue[t] !== JSON.stringify(r ? e[r] : e) && (this.cache(t, e), i && i.coverValue(e || {}));
1050
+ },
1051
+ addRule(t, e) {
1052
+ const r = this.formCreateInject.form.copyRules(this.formRule), i = this.options ? y({}, this.options) : {
1053
+ submitBtn: !1,
1054
+ resetBtn: !1
1055
+ };
1056
+ if (this.defaultValue) {
1057
+ i.formData || (i.formData = {});
1058
+ const s = M(this.defaultValue);
1059
+ m(i.formData, this.field ? {
1060
+ [this.field]: s
1061
+ } : s);
1062
+ }
1063
+ this.parse && this.parse({
1064
+ rule: r,
1065
+ options: i,
1066
+ index: this.sort.length
1067
+ }), this.$set(this.cacheRule, ++this.len, {
1068
+ rule: r,
1069
+ options: i
1070
+ }), e && this.$nextTick(() => this.$emit("add", r, Object.keys(this.cacheRule).length - 1));
1071
+ },
1072
+ add$f(t, e, r) {
1073
+ this.cacheRule[e].$f = r, this.$nextTick(() => {
1074
+ this.$emit("itemMounted", r, Object.keys(this.cacheRule).indexOf(e));
1075
+ });
1076
+ },
1077
+ removeRule(t, e) {
1078
+ const r = Object.keys(this.cacheRule).indexOf(t);
1079
+ this.$delete(this.cacheRule, t), this.$delete(this.cacheValue, t), e && this.$nextTick(() => this.$emit("remove", r));
1080
+ },
1081
+ add(t) {
1082
+ this.disabled || this.onBeforeAdd(this.value) === !1 || this.addRule(t, !0);
1083
+ },
1084
+ del(t, e) {
1085
+ if (this.disabled || this.onBeforeRemove(this.value, t) === !1)
1086
+ return;
1087
+ this.removeRule(e, !0);
1088
+ const r = [...this.value];
1089
+ r.splice(t, 1), this.input(r);
1090
+ },
1091
+ addIcon(t) {
1092
+ return p("div", {
1093
+ class: "_fc-group-btn _fc-group-plus-minus",
1094
+ on: {
1095
+ click: this.add
1096
+ }
1097
+ });
1098
+ },
1099
+ delIcon(t, e) {
1100
+ return p("div", {
1101
+ class: "_fc-group-btn _fc-group-plus-minus _fc-group-minus",
1102
+ on: {
1103
+ click: () => this.del(t, e)
1104
+ }
1105
+ });
1106
+ },
1107
+ sortUpIcon(t) {
1108
+ return p("div", {
1109
+ class: "_fc-group-btn _fc-group-arrow _fc-group-up",
1110
+ on: {
1111
+ click: () => this.changeSort(t, -1)
1112
+ }
1113
+ });
1114
+ },
1115
+ sortDownIcon(t) {
1116
+ return p("div", {
1117
+ class: "_fc-group-btn _fc-group-arrow _fc-group-down",
1118
+ on: {
1119
+ click: () => this.changeSort(t, 1)
1120
+ }
1121
+ });
1122
+ },
1123
+ changeSort(t, e) {
1124
+ const r = this.sort[t];
1125
+ this.$set(this.sort, t, this.sort[t + e]), this.sort[t + e] = r, this.formData(0);
1126
+ },
1127
+ makeIcon(t, e, r) {
1128
+ if (this.$scopedSlots.button)
1129
+ return this.$scopedSlots.button({
1130
+ total: t,
1131
+ index: e,
1132
+ vm: this,
1133
+ key: r,
1134
+ del: () => this.del(e, r),
1135
+ add: this.add
1136
+ });
1137
+ const i = [];
1138
+ return (!this.max || t < this.max) && t === e + 1 && i.push(this.addIcon(r)), t > this.min && i.push(this.delIcon(e, r)), this.sortBtn && e && i.push(this.sortUpIcon(e)), this.sortBtn && e !== t - 1 && i.push(this.sortDownIcon(e)), i;
1139
+ },
1140
+ emitEvent(t, e, r, i) {
1141
+ this.$emit(t, ...e, this.cacheRule[i].$f, r);
1142
+ },
1143
+ expandRule(t) {
1144
+ for (let e = 0; e < t; e++)
1145
+ this.value.push(this.field ? null : {});
1146
+ }
1147
+ },
1148
+ created() {
1149
+ this.type = this.formCreateInject.form.$form();
1150
+ const t = (this.expand || 0) - this.value.length;
1151
+ t > 0 && this.expandRule(t);
1152
+ for (let e = 0; e < this.value.length; e++)
1153
+ this.addRule(e);
1154
+ },
1155
+ render() {
1156
+ const t = this.sort, e = this.button, r = this.type, i = this.disabled, s = t.length === 0 ? this.$scopedSlots.default ? this.$scopedSlots.default({
1157
+ vm: this,
1158
+ add: this.add
1159
+ }) : p("div", {
1160
+ key: "a_def",
1161
+ class: "_fc-group-plus-minus _fc-group-add",
1162
+ on: {
1163
+ click: this.add
1164
+ }
1165
+ }) : t.map((n, o) => {
1166
+ const {
1167
+ rule: a,
1168
+ options: u
1169
+ } = this.cacheRule[n], l = e && !i ? this.makeIcon(t.length, o, n) : [];
1170
+ return p("div", {
1171
+ class: "_fc-group-container",
1172
+ key: n
1173
+ }, [p(r, S([{
1174
+ key: n
1175
+ }, {
1176
+ on: {
1177
+ "update:value": (f) => this.formData(n, f),
1178
+ "emit-event": (f, ...g) => this.emitEvent(f, g, o, n),
1179
+ input: (f) => this.add$f(o, n, f)
1180
+ }
1181
+ }, {}, {
1182
+ props: {
1183
+ disabled: i,
1184
+ inFor: !0,
1185
+ value: this.field ? {
1186
+ [this.field]: this._value(this.value[o])
1187
+ } : this.value[o],
1188
+ rule: a,
1189
+ option: u,
1190
+ extendOption: !0
1191
+ }
1192
+ }])), p("div", {
1193
+ class: "_fc-group-idx"
1194
+ }, [o + 1]), l.length ? p("div", {
1195
+ class: "_fc-group-handle"
1196
+ }, [l]) : null]);
1197
+ });
1198
+ return p("div", {
1199
+ key: "con",
1200
+ class: "_fc-group " + (i ? "_fc-group-disabled" : "")
1201
+ }, [s]);
1202
+ }
1203
+ }, Jt = "fcSubForm", Kt = {
1204
+ name: Jt,
1205
+ props: {
1206
+ rule: Array,
1207
+ options: Object,
1208
+ formCreateInject: {
1209
+ type: Object,
1210
+ required: !0
1211
+ },
1212
+ value: {
1213
+ type: Object,
1214
+ default: () => ({})
1215
+ },
1216
+ disabled: {
1217
+ type: Boolean,
1218
+ default: !1
1219
+ },
1220
+ syncDisabled: {
1221
+ type: Boolean,
1222
+ default: !0
1223
+ }
1224
+ },
1225
+ data() {
1226
+ return {
1227
+ cacheRule: {},
1228
+ cacheValue: {},
1229
+ type: void 0
1230
+ };
1231
+ },
1232
+ watch: {
1233
+ value(t) {
1234
+ this.setValue(t);
1235
+ }
1236
+ },
1237
+ methods: {
1238
+ formData(t) {
1239
+ this.cacheValue = JSON.stringify(t), this.$emit("input", t), this.$emit("change", t);
1240
+ },
1241
+ setValue(t) {
1242
+ const e = JSON.stringify(t);
1243
+ this.cacheValue !== e && (this.cacheValue = e, this.cacheRule.$f.coverValue(t || {}));
1244
+ },
1245
+ addRule() {
1246
+ const t = this.options ? this.options : {
1247
+ submitBtn: !1,
1248
+ resetBtn: !1
1249
+ };
1250
+ t.formData = y({}, this.value || {}), this.cacheRule = {
1251
+ rule: this.rule,
1252
+ options: t
1253
+ };
1254
+ },
1255
+ add$f(t) {
1256
+ this.cacheRule.$f = t, this.$nextTick(() => {
1257
+ this.$emit("itemMounted", t);
1258
+ });
1259
+ },
1260
+ emitEvent(t, ...e) {
1261
+ this.$emit(t, ...e);
1262
+ }
1263
+ },
1264
+ created() {
1265
+ this.addRule(), this.type = this.formCreateInject.form.$form();
1266
+ },
1267
+ render() {
1268
+ const {
1269
+ rule: t,
1270
+ options: e
1271
+ } = this.cacheRule, r = this.type;
1272
+ return p(r, S([{}, {
1273
+ on: {
1274
+ "update:value": this.formData,
1275
+ "emit-event": this.emitEvent,
1276
+ input: this.add$f
1277
+ }
1278
+ }, {}, {
1279
+ props: {
1280
+ rule: t,
1281
+ option: e,
1282
+ disabled: this.disabled,
1283
+ extendOption: !0
1284
+ }
1285
+ }]));
1286
+ }
1287
+ }, Wt = [
1288
+ jt,
1289
+ At,
1290
+ Pt,
1291
+ Dt,
1292
+ Lt,
1293
+ qt,
1294
+ xt,
1295
+ Kt
1296
+ ], Ee = "FormCreate", ue = (t, e) => {
1297
+ if (!(!t || t === e)) {
1298
+ if (t.formCreateInject)
1299
+ return t.formCreateInject;
1300
+ if (t.$parent)
1301
+ return ue(t.$parent, e);
1302
+ }
1303
+ };
1304
+ function Gt(t) {
1305
+ return {
1306
+ name: Ee,
1307
+ componentName: Ee,
1308
+ model: {
1309
+ prop: "api"
1310
+ },
1311
+ provide() {
1312
+ return {
1313
+ $pfc: this
1314
+ };
1315
+ },
1316
+ inject: { $pfc: { default: null } },
1317
+ props: {
1318
+ rule: {
1319
+ type: Array,
1320
+ required: !0
1321
+ },
1322
+ option: {
1323
+ type: Object,
1324
+ default: () => ({})
1325
+ },
1326
+ extendOption: Boolean,
1327
+ disabled: {
1328
+ type: Boolean,
1329
+ default: void 0
1330
+ },
1331
+ value: Object,
1332
+ api: Object,
1333
+ name: String,
1334
+ subForm: {
1335
+ type: Boolean,
1336
+ default: !0
1337
+ },
1338
+ inFor: Boolean
1339
+ },
1340
+ data() {
1341
+ return {
1342
+ formData: void 0,
1343
+ destroyed: !1,
1344
+ validate: {},
1345
+ $f: void 0,
1346
+ isShow: !0,
1347
+ unique: 1,
1348
+ renderRule: [...this.rule || []],
1349
+ ctxInject: {},
1350
+ updateValue: JSON.stringify(this.value || {}),
1351
+ isMore: !!this.inFor
1352
+ };
1353
+ },
1354
+ render() {
1355
+ return this.formCreate.render();
1356
+ },
1357
+ methods: {
1358
+ _refresh() {
1359
+ ++this.unique;
1360
+ },
1361
+ _renderRule() {
1362
+ this.renderRule = [...this.rule || []];
1363
+ },
1364
+ _updateValue(e) {
1365
+ this.destroyed || (this.updateValue = JSON.stringify(e), this.$emit("update:value", e));
1366
+ }
1367
+ },
1368
+ watch: {
1369
+ value: {
1370
+ handler(e) {
1371
+ JSON.stringify(e || {}) !== this.updateValue && (this.$f.config.forceCoverValue ? this.$f.coverValue(e || {}) : this.$f.setValue(e || {}));
1372
+ },
1373
+ deep: !0
1374
+ },
1375
+ option: {
1376
+ handler() {
1377
+ this.formCreate.initOptions(), this.$f.refresh();
1378
+ },
1379
+ deep: !0
1380
+ },
1381
+ rule(e) {
1382
+ e.length === this.renderRule.length && e.every((r) => this.renderRule.indexOf(r) > -1) || (this.formCreate.$handle.reloadRule(e), this._renderRule());
1383
+ },
1384
+ disabled() {
1385
+ this.$f.refresh();
1386
+ }
1387
+ },
1388
+ beforeCreate() {
1389
+ this.formCreate = new t(this), Object.keys(this.formCreate.prop).forEach((e) => {
1390
+ m(this.$options[e], this.formCreate.prop[e]);
1391
+ }), this.$emit("beforeCreate", this.formCreate.api());
1392
+ },
1393
+ created() {
1394
+ const e = this, r = this.formCreate.api(), i = () => {
1395
+ if (e.$pfc) {
1396
+ const n = ue(e, e.$pfc);
1397
+ if (n) {
1398
+ let o;
1399
+ e.isMore ? (o = I(n.getSubForm()), o.push(r)) : o = r, n.subForm(o);
1400
+ }
1401
+ }
1402
+ }, s = () => {
1403
+ const n = ue(e, e.$pfc);
1404
+ if (n)
1405
+ if (e.isMore) {
1406
+ const o = I(n.getSubForm()), a = o.indexOf(r);
1407
+ a > -1 && o.splice(a, 1);
1408
+ } else
1409
+ n.subForm();
1410
+ };
1411
+ e.$on("hook:beforeDestroy", () => {
1412
+ s();
1413
+ }), this.$watch(() => this.subForm, (n) => {
1414
+ n ? i() : s();
1415
+ }, { immediate: !0 });
1416
+ }
1417
+ };
1418
+ }
1419
+ const Ge = ["attrs", "props", "domProps", "scopedSlots"], Xe = ["class", "style", "directives"], ze = ["on", "nativeOn"], B = (t, e = {}, r = {}) => {
1420
+ const i = [...Ge, ...r.normal || []], s = [...Xe, ...r.array || []], n = [...ze, ...r.functional || []], o = r.props || [];
1421
+ return t.reduce((a, u) => {
1422
+ for (const l in u)
1423
+ if (a[l])
1424
+ if (o.indexOf(l) > -1)
1425
+ a[l] = B([u[l]], a[l]);
1426
+ else if (i.indexOf(l) > -1)
1427
+ a[l] = y(y({}, a[l]), u[l]);
1428
+ else if (s.indexOf(l) > -1) {
1429
+ const f = a[l] instanceof Array ? a[l] : [a[l]], g = u[l] instanceof Array ? u[l] : [u[l]];
1430
+ a[l] = [...f, ...g];
1431
+ } else if (n.indexOf(l) > -1)
1432
+ for (const f in u[l])
1433
+ if (a[l][f]) {
1434
+ const g = a[l][f] instanceof Array ? a[l][f] : [a[l][f]], b = u[l][f] instanceof Array ? u[l][f] : [u[l][f]];
1435
+ a[l][f] = [...g, ...b];
1436
+ } else
1437
+ a[l][f] = u[l][f];
1438
+ else if (l === "hook")
1439
+ for (let f in u[l])
1440
+ a[l][f] ? a[l][f] = Xt(a[l][f], u[l][f]) : a[l][f] = u[l][f];
1441
+ else
1442
+ a[l] = u[l];
1443
+ else
1444
+ i.indexOf(l) > -1 || n.indexOf(l) > -1 || o.indexOf(l) > -1 ? a[l] = y({}, u[l]) : s.indexOf(l) > -1 ? a[l] = u[l] instanceof Array ? [...u[l]] : typeof u[l] == "object" ? y({}, u[l]) : u[l] : a[l] = u[l];
1445
+ return a;
1446
+ }, e);
1447
+ }, Xt = (t, e) => function() {
1448
+ t && t.apply(this, arguments), e && e.apply(this, arguments);
1449
+ }, Qe = ["type", "slot", "emitPrefix", "value", "name", "native", "hidden", "display", "inject", "options", "emit", "nativeEmit", "link", "prefix", "suffix", "update", "sync", "optionsTo", "key", "preview", "component", "cache"], pe = ["validate", "children", "control"], me = ["effect", "deep"];
1450
+ function zt() {
1451
+ return [...Qe, ...Ge, ...Xe, ...ze, ...pe, ...me];
1452
+ }
1453
+ function ye(t, e, r) {
1454
+ return `[form-create ${t}]: ${e}`;
1455
+ }
1456
+ function Qt(t, e) {
1457
+ console.warn(ye("tip", t));
1458
+ }
1459
+ function ge(t, e) {
1460
+ console.error(ye("err", t));
1461
+ }
1462
+ function Zt(t) {
1463
+ ge(t.toString()), console.error(t);
1464
+ }
1465
+ const fe = "[[FORM-CREATE-PREFIX-", he = "-FORM-CREATE-SUFFIX]]", je = "$FN:", Ie = "$FNX:", K = "function";
1466
+ function Ze(t, e) {
1467
+ return JSON.stringify(G(Array.isArray(t) ? [] : {}, t, !0), function(r, i) {
1468
+ if (!(i && i._isVue === !0)) {
1469
+ if (typeof i !== K)
1470
+ return i;
1471
+ if (i.__json)
1472
+ return i.__json;
1473
+ if (i.__origin && (i = i.__origin), !i.__emit)
1474
+ return fe + i + he;
1475
+ }
1476
+ }, e);
1477
+ }
1478
+ function Ae(t) {
1479
+ return new Function("return " + t)();
1480
+ }
1481
+ function U(t, e) {
1482
+ if (t && c.String(t) && t.length > 4) {
1483
+ let r = t.trim(), i = !1;
1484
+ try {
1485
+ if (r.indexOf(he) > 0 && r.indexOf(fe) === 0)
1486
+ r = r.replace(he, "").replace(fe, ""), i = !0;
1487
+ else if (r.indexOf(je) === 0)
1488
+ r = r.replace(je, ""), i = !0;
1489
+ else {
1490
+ if (r.indexOf(Ie) === 0)
1491
+ return r = Ae("function($inject){" + r.replace(Ie, "") + "}"), r.__json = t, r.__inject = !0, r;
1492
+ !e && r.indexOf(K) === 0 && r !== K && (i = !0);
1493
+ }
1494
+ if (!i) return t;
1495
+ const s = Ae(r.indexOf(K) === -1 && r.indexOf("(") !== 0 ? K + " " + r : r);
1496
+ return s.__json = t, s;
1497
+ } catch (s) {
1498
+ ge(`解析失败:${r}
1499
+
1500
+ err: ${s}`);
1501
+ return;
1502
+ }
1503
+ }
1504
+ return t;
1505
+ }
1506
+ function Yt(t, e) {
1507
+ return JSON.parse(t, function(r, i) {
1508
+ return c.Undef(i) || !i.indexOf ? i : U(i, e);
1509
+ });
1510
+ }
1511
+ function Ye(t, e) {
1512
+ return {
1513
+ value: t,
1514
+ enumerable: !1,
1515
+ configurable: !1,
1516
+ writable: !!e
1517
+ };
1518
+ }
1519
+ function $e(t) {
1520
+ return et([t])[0];
1521
+ }
1522
+ function et(t, e) {
1523
+ return G([], [...t], e || !1);
1524
+ }
1525
+ function H(t, e) {
1526
+ return B(Array.isArray(e) ? e : [e], t, { array: pe, normal: me }), t;
1527
+ }
1528
+ function Ve(t) {
1529
+ const e = c.Function(t.getRule) ? t.getRule() : t;
1530
+ return e.type || (e.type = "input"), e;
1531
+ }
1532
+ function er(t, e) {
1533
+ return t ? (Object.keys(e || {}).forEach((r) => {
1534
+ e[r] && (t[r] = H(t[r] || {}, e[r]));
1535
+ }), t) : e;
1536
+ }
1537
+ function tt(t, e) {
1538
+ Object.defineProperties(t, Object.keys(e).reduce((r, i) => (r[i] = {
1539
+ get() {
1540
+ return e[i]();
1541
+ }
1542
+ }, r), {}));
1543
+ }
1544
+ function z(t) {
1545
+ return t.__fc__ || (t.__origin__ ? t.__origin__.__fc__ : null);
1546
+ }
1547
+ function j(t, e) {
1548
+ try {
1549
+ e = t();
1550
+ } catch (r) {
1551
+ Zt(r);
1552
+ }
1553
+ return e;
1554
+ }
1555
+ const Pe = (t, e) => typeof t == "string" ? String(e) : typeof t == "number" ? Number(e) : e, W = {
1556
+ "==": (t, e) => JSON.stringify(t) === JSON.stringify(Pe(t, e)),
1557
+ "!=": (t, e) => !W["=="](t, e),
1558
+ ">": (t, e) => t > e,
1559
+ ">=": (t, e) => t >= e,
1560
+ "<": (t, e) => t < e,
1561
+ "<=": (t, e) => t <= e,
1562
+ on(t, e) {
1563
+ return t && t.indexOf && t.indexOf(Pe(t[0], e)) > -1;
1564
+ },
1565
+ notOn(t, e) {
1566
+ return !W.on(t, e);
1567
+ },
1568
+ in(t, e) {
1569
+ return e && e.indexOf && e.indexOf(t) > -1;
1570
+ },
1571
+ notIn(t, e) {
1572
+ return !W.in(t, e);
1573
+ },
1574
+ between(t, e) {
1575
+ return t > e[0] && t < e[1];
1576
+ },
1577
+ notBetween(t, e) {
1578
+ return t < e[0] || t > e[1];
1579
+ },
1580
+ empty(t) {
1581
+ return c.empty(t);
1582
+ },
1583
+ notEmpty(t) {
1584
+ return !c.empty(t);
1585
+ },
1586
+ pattern(t, e) {
1587
+ return new RegExp(e, "g").test(t);
1588
+ }
1589
+ };
1590
+ function rt() {
1591
+ return {
1592
+ props: {},
1593
+ on: {},
1594
+ options: [],
1595
+ children: [],
1596
+ effect: {},
1597
+ hidden: !1,
1598
+ display: !0,
1599
+ value: void 0
1600
+ };
1601
+ }
1602
+ function R(t, e) {
1603
+ return (r, i, s, n = {}) => {
1604
+ const o = new ve(t, r, i, s, n);
1605
+ return e && (c.Function(e) ? e(o) : o.props(e)), o;
1606
+ };
1607
+ }
1608
+ function ve(t, e, r, i, s) {
1609
+ this._data = m(rt(), { type: t, title: e, field: r, value: i, props: s || {} }), this.event = this.on;
1610
+ }
1611
+ m(ve.prototype, {
1612
+ getRule() {
1613
+ return this._data;
1614
+ },
1615
+ setProp(t, e) {
1616
+ return F(this._data, t, e), this;
1617
+ },
1618
+ _clone() {
1619
+ const t = new this.constructor();
1620
+ return t._data = $e(this._data), t;
1621
+ }
1622
+ });
1623
+ function it(t) {
1624
+ t.forEach((e) => {
1625
+ ve.prototype[e] = function(r) {
1626
+ return H(this._data, { [e]: arguments.length < 2 ? r : { [r]: arguments[1] } }), this;
1627
+ };
1628
+ });
1629
+ }
1630
+ it(zt());
1631
+ const nt = R("");
1632
+ function tr(t, e, r) {
1633
+ let i = nt("", e);
1634
+ return i._data.type = t, i._data.title = r, i;
1635
+ }
1636
+ function Te(t, e, r, i) {
1637
+ let s = nt("", r);
1638
+ return s._data.type = "template", s._data.template = t, s._data.title = i, s._data.vm = e, s;
1639
+ }
1640
+ function rr() {
1641
+ return {
1642
+ create: tr,
1643
+ createTmp: Te,
1644
+ template: Te,
1645
+ factory: R
1646
+ };
1647
+ }
1648
+ function ir(t, e, r) {
1649
+ const i = `fail to ${t} ${r.status}'`, s = new Error(i);
1650
+ return s.status = r.status, s.url = t, s;
1651
+ }
1652
+ function De(t) {
1653
+ const e = t.responseText || t.response;
1654
+ if (!e)
1655
+ return e;
1656
+ try {
1657
+ return JSON.parse(e);
1658
+ } catch (r) {
1659
+ return e;
1660
+ }
1661
+ }
1662
+ function st(t) {
1663
+ if (typeof XMLHttpRequest == "undefined")
1664
+ return;
1665
+ const e = new XMLHttpRequest(), r = t.action;
1666
+ e.onerror = function(o) {
1667
+ t.onError(o);
1668
+ }, e.onload = function() {
1669
+ if (e.status < 200 || e.status >= 300)
1670
+ return t.onError(ir(r, t, e), De(e));
1671
+ t.onSuccess(De(e));
1672
+ }, e.open(t.method || "get", r, !0);
1673
+ let i;
1674
+ t.data && ((t.dataType || "").toLowerCase() !== "json" ? (i = new FormData(), Object.keys(t.data).map((n) => {
1675
+ i.append(n, t.data[n]);
1676
+ })) : (i = JSON.stringify(t.data), e.setRequestHeader("content-type", "application/json"))), t.withCredentials && "withCredentials" in e && (e.withCredentials = !0);
1677
+ const s = t.headers || {};
1678
+ Object.keys(s).forEach((n) => {
1679
+ s[n] !== null && e.setRequestHeader(n, s[n]);
1680
+ }), e.send(i);
1681
+ }
1682
+ function nr(t) {
1683
+ return new Promise((e, r) => {
1684
+ st(q(y({}, t), {
1685
+ onSuccess(i) {
1686
+ let s = (o) => o;
1687
+ const n = U(t.parse);
1688
+ c.Function(n) ? s = n : n && c.String(n) && (s = (o) => (n.split(".").forEach((a) => {
1689
+ o && (o = o[a]);
1690
+ }), o)), e(s(i));
1691
+ },
1692
+ onError(i) {
1693
+ r(i);
1694
+ }
1695
+ }));
1696
+ });
1697
+ }
1698
+ function X(t) {
1699
+ return M(t);
1700
+ }
1701
+ function sr(t) {
1702
+ function e(n) {
1703
+ return c.Undef(n) ? n = t.fields() : Array.isArray(n) || (n = [n]), n;
1704
+ }
1705
+ function r(n, o, a) {
1706
+ e(n).forEach((u) => {
1707
+ t.getCtxs(u).forEach((l) => {
1708
+ F(l.rule, o, a), t.$render.clearCache(l);
1709
+ });
1710
+ });
1711
+ }
1712
+ function i() {
1713
+ const n = t.subForm;
1714
+ return Object.keys(n).reduce((o, a) => {
1715
+ const u = n[a];
1716
+ return u && (Array.isArray(u) ? o.push(...u) : o.push(u)), o;
1717
+ }, []);
1718
+ }
1719
+ const s = {
1720
+ get config() {
1721
+ return t.options;
1722
+ },
1723
+ get options() {
1724
+ return t.options;
1725
+ },
1726
+ get form() {
1727
+ return t.form;
1728
+ },
1729
+ get rule() {
1730
+ return t.rules;
1731
+ },
1732
+ get parent() {
1733
+ return t.vm.$pfc && t.vm.$pfc.$f;
1734
+ },
1735
+ get top() {
1736
+ return s.parent ? s.parent.top : s;
1737
+ },
1738
+ get children() {
1739
+ return i();
1740
+ },
1741
+ formData(n) {
1742
+ return e(n).reduce((o, a) => {
1743
+ const u = t.getFieldCtx(a);
1744
+ return u && (o[u.field] = X(u.rule.value)), o;
1745
+ }, t.options.appendValue !== !1 ? X(t.appendData) : {});
1746
+ },
1747
+ getValue(n) {
1748
+ const o = t.getFieldCtx(n);
1749
+ if (o)
1750
+ return X(o.rule.value);
1751
+ },
1752
+ coverValue(n) {
1753
+ const o = y({}, n || {});
1754
+ t.deferSyncValue(() => {
1755
+ s.fields().forEach((a) => {
1756
+ const u = t.fieldCtx[a];
1757
+ if (u) {
1758
+ const l = w(o, a);
1759
+ u.forEach((f) => {
1760
+ f.rule.value = l ? o[a] : void 0;
1761
+ }), delete o[a];
1762
+ }
1763
+ }), m(t.appendData, o);
1764
+ });
1765
+ },
1766
+ setValue(n) {
1767
+ let o = n;
1768
+ arguments.length >= 2 && (o = { [n]: arguments[1] }), t.deferSyncValue(() => {
1769
+ Object.keys(o).forEach((a) => {
1770
+ const u = t.fieldCtx[a];
1771
+ if (!u) return t.appendData[a] = o[a];
1772
+ u.forEach((l) => {
1773
+ l.rule.value = o[a];
1774
+ });
1775
+ });
1776
+ });
1777
+ },
1778
+ removeField(n) {
1779
+ const o = t.getCtx(n);
1780
+ return t.deferSyncValue(() => {
1781
+ t.getCtxs(n).forEach((a) => {
1782
+ a.rm();
1783
+ });
1784
+ }, !0), o ? o.origin : void 0;
1785
+ },
1786
+ removeRule(n) {
1787
+ const o = n && z(n);
1788
+ if (o)
1789
+ return o.rm(), o.origin;
1790
+ },
1791
+ destroy: () => {
1792
+ t.vm.$el.parentNode && t.vm.$el.parentNode.removeChild(t.vm.$el), t.vm.$destroy();
1793
+ },
1794
+ fields: () => t.fields(),
1795
+ append: (n, o, a) => {
1796
+ let u = t.sort.length - 1, l;
1797
+ const f = t.getCtx(o);
1798
+ f ? a ? (l = f.rule.children, u = f.rule.children.length - 1) : (u = f.root.indexOf(f.origin), l = f.root) : l = t.rules, l.splice(u + 1, 0, n);
1799
+ },
1800
+ prepend: (n, o, a) => {
1801
+ let u = 0, l;
1802
+ const f = t.getCtx(o);
1803
+ f ? a ? l = f.rule.children : (u = f.root.indexOf(f.origin), l = f.root) : l = t.rules, l.splice(u, 0, n);
1804
+ },
1805
+ hidden(n, o) {
1806
+ r(o, "hidden", !!n), t.refresh();
1807
+ },
1808
+ hiddenStatus(n) {
1809
+ const o = t.getCtx(n);
1810
+ if (o)
1811
+ return !!o.rule.hidden;
1812
+ },
1813
+ display(n, o) {
1814
+ r(o, "display", !!n), t.refresh();
1815
+ },
1816
+ displayStatus(n) {
1817
+ const o = t.getCtx(n);
1818
+ if (o)
1819
+ return !!o.rule.display;
1820
+ },
1821
+ disabled(n, o) {
1822
+ e(o).forEach((a) => {
1823
+ t.getCtxs(a).forEach((u) => {
1824
+ u.rule.props && F(u.rule.props, "disabled", !!n);
1825
+ });
1826
+ }), t.refresh();
1827
+ },
1828
+ all(n) {
1829
+ return Object.keys(t.ctxs).map((o) => {
1830
+ const a = t.ctxs[o];
1831
+ return n ? a.origin : a.rule;
1832
+ });
1833
+ },
1834
+ model(n) {
1835
+ return t.fields().reduce((o, a) => {
1836
+ const u = t.fieldCtx[a][0];
1837
+ return o[a] = n ? u.origin : u.rule, o;
1838
+ }, {});
1839
+ },
1840
+ component(n) {
1841
+ return Object.keys(t.nameCtx).reduce((o, a) => {
1842
+ const u = t.nameCtx[a].map((l) => n ? l.origin : l.rule);
1843
+ return o[a] = u.length === 1 ? u[0] : u, o;
1844
+ }, {});
1845
+ },
1846
+ bind() {
1847
+ return s.form;
1848
+ },
1849
+ reload: (n) => {
1850
+ t.reloadRule(n);
1851
+ },
1852
+ updateOptions(n) {
1853
+ t.fc.updateOptions(n), s.refresh();
1854
+ },
1855
+ onSubmit(n) {
1856
+ s.updateOptions({ onSubmit: n });
1857
+ },
1858
+ sync: (n) => {
1859
+ if (Array.isArray(n)) {
1860
+ n.forEach((a) => s.sync(a));
1861
+ return;
1862
+ }
1863
+ let o = c.Object(n) ? z(n) : t.getCtxs(n);
1864
+ o && (o = Array.isArray(o) ? o : [o], o.forEach((a) => {
1865
+ if (!a.deleted) {
1866
+ const u = t.subForm[a.id];
1867
+ u && (Array.isArray(u) ? u.forEach((l) => {
1868
+ l.refresh();
1869
+ }) : u && u.refresh()), t.$render.clearCache(a);
1870
+ }
1871
+ }), t.refresh());
1872
+ },
1873
+ refresh: () => {
1874
+ i().forEach((n) => {
1875
+ n.refresh();
1876
+ }), t.$render.clearCacheAll(), t.refresh();
1877
+ },
1878
+ refreshOptions() {
1879
+ t.$manager.updateOptions(t.options), s.refresh();
1880
+ },
1881
+ hideForm: (n) => {
1882
+ F(t.vm, "isShow", !n);
1883
+ },
1884
+ changeStatus: () => t.changeStatus,
1885
+ clearChangeStatus: () => {
1886
+ t.changeStatus = !1;
1887
+ },
1888
+ updateRule(n, o) {
1889
+ t.getCtxs(n).forEach((a) => {
1890
+ m(a.rule, o);
1891
+ });
1892
+ },
1893
+ updateRules(n) {
1894
+ Object.keys(n).forEach((o) => {
1895
+ s.updateRule(o, n[o]);
1896
+ });
1897
+ },
1898
+ mergeRule: (n, o) => {
1899
+ t.getCtxs(n).forEach((a) => {
1900
+ H(a.rule, o);
1901
+ });
1902
+ },
1903
+ mergeRules(n) {
1904
+ Object.keys(n).forEach((o) => {
1905
+ s.mergeRule(o, n[o]);
1906
+ });
1907
+ },
1908
+ getRule: (n, o) => {
1909
+ const a = t.getCtx(n);
1910
+ if (a)
1911
+ return o ? a.origin : a.rule;
1912
+ },
1913
+ getRenderRule: (n) => {
1914
+ const o = t.getCtx(n);
1915
+ if (o)
1916
+ return o.prop;
1917
+ },
1918
+ getRefRule: (n) => {
1919
+ const o = t.getCtxs(n);
1920
+ if (o && o.length) {
1921
+ const a = o.map((u) => u.rule);
1922
+ return a.length === 1 ? a[0] : a;
1923
+ }
1924
+ },
1925
+ setEffect(n, o, a) {
1926
+ const u = t.getCtx(n);
1927
+ u && o && (o[0] === "$" && (o = o.substr(1)), w(u.rule, "$" + o) && F(u.rule, "$" + o, a), w(u.rule, "effect") || F(u.rule, "effect", {}), F(u.rule.effect, o, a));
1928
+ },
1929
+ clearEffectData(n, o) {
1930
+ const a = t.getCtx(n);
1931
+ a && (o && o[0] === "$" && (o = o.substr(1)), a.clearEffectData(o), s.sync(n));
1932
+ },
1933
+ updateValidate(n, o, a) {
1934
+ a ? s.mergeRule(n, { validate: o }) : r(n, "validate", o);
1935
+ },
1936
+ updateValidates(n, o) {
1937
+ Object.keys(n).forEach((a) => {
1938
+ s.updateValidate(a, n[a], o);
1939
+ });
1940
+ },
1941
+ refreshValidate() {
1942
+ t.vm.validate = {}, s.refresh();
1943
+ },
1944
+ resetFields(n) {
1945
+ e(n).forEach((o) => {
1946
+ t.getCtxs(o).forEach((a) => {
1947
+ t.$render.clearCache(a), a.rule.value = X(a.defaultValue);
1948
+ });
1949
+ });
1950
+ },
1951
+ method(n, o) {
1952
+ const a = s.el(n);
1953
+ if (!a || !a[o])
1954
+ throw new Error(ye("err", `${o}方法不存在`));
1955
+ return (...u) => a[o](...u);
1956
+ },
1957
+ exec(n, o, ...a) {
1958
+ return j(() => s.method(n, o)(...a));
1959
+ },
1960
+ toJson(n) {
1961
+ return Ze(s.rule, n);
1962
+ },
1963
+ trigger(n, o, ...a) {
1964
+ const u = s.el(n);
1965
+ u && u.$emit(o, ...a);
1966
+ },
1967
+ el(n) {
1968
+ const o = t.getCtx(n);
1969
+ if (o) return o.exportEl || o.el || t.vm.$refs[o.ref];
1970
+ },
1971
+ closeModal: (n) => {
1972
+ const o = s.el(n);
1973
+ o && o.$emit && o.$emit("close-modal");
1974
+ },
1975
+ getSubForm(n) {
1976
+ const o = t.getCtx(n);
1977
+ return o ? t.subForm[o.id] : void 0;
1978
+ },
1979
+ nextTick(n) {
1980
+ t.bus.$once("next-tick", n), t.refresh();
1981
+ },
1982
+ nextRefresh(n) {
1983
+ t.nextRefresh(), n && j(n);
1984
+ },
1985
+ emit(n, ...o) {
1986
+ t.vm.$emit(n, ...o);
1987
+ },
1988
+ deferSyncValue(n, o) {
1989
+ t.deferSyncValue(n, o);
1990
+ },
1991
+ fetch(n) {
1992
+ return new Promise((o, a) => {
1993
+ t.beforeFetch(n).then(() => nr(n).then(o).catch(a));
1994
+ });
1995
+ },
1996
+ getData(n, o) {
1997
+ return t.fc.getData(n, o);
1998
+ },
1999
+ setData(n, o) {
2000
+ return t.fc.setData(n, o);
2001
+ },
2002
+ helper: {
2003
+ tidyFields: e,
2004
+ props: r
2005
+ }
2006
+ };
2007
+ return ["on", "once", "off", "set", "emit"].forEach((n) => {
2008
+ s[n] = function(...o) {
2009
+ t.vm[`$${n}`](...o);
2010
+ };
2011
+ }), s.changeValue = s.changeField = s.setValue, s;
2012
+ }
2013
+ function or(t) {
2014
+ m(t.prototype, {
2015
+ initCache() {
2016
+ this.clearCacheAll();
2017
+ },
2018
+ clearCache(e) {
2019
+ if (e.rule.cache)
2020
+ return;
2021
+ if (!this.cache[e.id]) {
2022
+ e.parent && this.clearCache(e.parent);
2023
+ return;
2024
+ }
2025
+ (this.cache[e.id].use === !0 || this.cache[e.id].parent) && this.$handle.refresh();
2026
+ const r = this.cache[e.id].parent;
2027
+ this.cache[e.id] = null, r && this.clearCache(r);
2028
+ },
2029
+ clearCacheAll() {
2030
+ this.cache = {};
2031
+ },
2032
+ setCache(e, r, i) {
2033
+ this.cache[e.id] = {
2034
+ vnode: r,
2035
+ use: !1,
2036
+ parent: i,
2037
+ slot: e.rule.slot
2038
+ };
2039
+ },
2040
+ getCache(e) {
2041
+ const r = this.cache[e.id];
2042
+ if (r)
2043
+ return r.use = !0, r.vnode;
2044
+ }
2045
+ });
2046
+ }
2047
+ function A(t) {
2048
+ const e = t.replace(/(-[a-z])/g, function(r) {
2049
+ return r.replace("-", "").toLocaleUpperCase();
2050
+ });
2051
+ return ot(e);
2052
+ }
2053
+ function ot(t) {
2054
+ return t.replace(t[0], t[0].toLowerCase());
2055
+ }
2056
+ function at(t) {
2057
+ return t == null ? "" : typeof t == "object" ? JSON.stringify(t, null, 2) : String(t);
2058
+ }
2059
+ function Q(t) {
2060
+ let e = t.replace(/([A-Z])/g, "-$1").toLocaleLowerCase();
2061
+ return e.indexOf("-") === 0 && (e = e.substr(1)), e;
2062
+ }
2063
+ let ar = 0;
2064
+ function te() {
2065
+ const t = 370 + ++ar;
2066
+ return "F" + Math.random().toString(36).substr(3, 3) + (+`${Date.now()}`).toString(36) + t.toString(36) + "c";
2067
+ }
2068
+ function Z(t, e, r) {
2069
+ let i = t, s;
2070
+ return (e || "").split(".").forEach((n) => {
2071
+ s && ((!i[s] || typeof i[s] != "object") && (i[s] = {}), i = i[s]), s = n;
2072
+ }), i[s] = r, i;
2073
+ }
2074
+ function lr(t) {
2075
+ m(t.prototype, {
2076
+ initRender() {
2077
+ this.tempList = {}, this.clearOrgChildren();
2078
+ },
2079
+ initOrgChildren() {
2080
+ const e = this.$handle.ctxs;
2081
+ this.orgChildren = Object.keys(e).reduce((r, i) => {
2082
+ if (e[i].parser.loadChildren !== !1) {
2083
+ const s = e[i].rule.children;
2084
+ r[i] = c.trueArray(s) ? [...s] : [];
2085
+ }
2086
+ return r;
2087
+ }, {});
2088
+ },
2089
+ clearOrgChildren() {
2090
+ this.orgChildren = {};
2091
+ },
2092
+ getTypeSlot(e) {
2093
+ const r = (i) => {
2094
+ if (i) {
2095
+ let s;
2096
+ return e.rule.field && (s = i.$scopedSlots["field-" + Q(e.rule.field)] || i.$scopedSlots["field-" + e.rule.field]), s || (s = i.$scopedSlots["type-" + Q(e.type)] || i.$scopedSlots["type-" + e.type]), s || r(i.$pfc);
2097
+ }
2098
+ };
2099
+ return r(this.vm);
2100
+ },
2101
+ render() {
2102
+ if (!this.vm.isShow)
2103
+ return;
2104
+ this.$h = this.vm.$createElement, this.$manager.beforeRender();
2105
+ let e;
2106
+ const r = () => this.renderList();
2107
+ return r.renderSlot = (i) => this.renderList(i), r.renderName = (i) => this.renderId(i), r.renderField = (i) => this.renderId(i, "field"), this.vm.$scopedSlots.container ? e = [this.vm.$scopedSlots.container(r)] : e = r(), this.$manager.render(e);
2108
+ },
2109
+ renderList(e) {
2110
+ return this.sort.map((r) => e ? this.renderSlot(this.$handle.ctxs[r], e) : this.renderCtx(this.$handle.ctxs[r])).filter((r) => r !== void 0);
2111
+ },
2112
+ makeVm(e) {
2113
+ const r = e.vm;
2114
+ if (r) {
2115
+ if (c.Function(r))
2116
+ return j(() => e.vm(this.$handle.getInjectData(e)));
2117
+ if (!r._isVue)
2118
+ return new L(r);
2119
+ } else return new L();
2120
+ return r;
2121
+ },
2122
+ mergeGlobal(e) {
2123
+ const r = this.$handle.options.global;
2124
+ r && (e.cacheConfig || (e.cacheConfig = r[e.originType] || r[e.type] || r[e.trueType] || {}), e.prop = H({}, [r["*"], e.cacheConfig, e.prop]));
2125
+ },
2126
+ setOptions(e) {
2127
+ e.prop.optionsTo && e.prop.options && Z(e.prop, e.prop.optionsTo, e.prop.options);
2128
+ },
2129
+ deepSet(e) {
2130
+ const r = e.rule.deep;
2131
+ r && Object.keys(r).sort((i, s) => i.length < s.length ? -1 : 1).forEach((i) => {
2132
+ Z(e.prop, i, r[i]);
2133
+ });
2134
+ },
2135
+ setTempProps(e, r) {
2136
+ if (!e.$props) return;
2137
+ const { prop: i } = r, s = Object.keys(e.$props), n = this.injectProp(r), o = Object.keys(n);
2138
+ s.forEach((u) => {
2139
+ w(i.props, u) ? e.$props[u] = i.props[u] : o.indexOf(u) > -1 && (e.$props[u] = n[u]);
2140
+ });
2141
+ const a = e.$options.model && e.$options.model.prop || "value";
2142
+ s.indexOf(a) > -1 && (e.$props[a] = i.value);
2143
+ },
2144
+ renderTemp(e) {
2145
+ if (!L.compile)
2146
+ return Qt("当前使用的Vue构建版本不支持compile,无法使用template功能"), [];
2147
+ const r = e.prop, { id: i, key: s } = e;
2148
+ if (!this.tempList[i]) {
2149
+ e.el || (e.el = this.makeVm(r), this.vm.$nextTick(() => e.parser.mounted(e)));
2150
+ let u = e.el;
2151
+ e.input && u.$on(u.$options.model && u.$options.model.event || "input", (l) => {
2152
+ this.onInput(e, l);
2153
+ }), this.tempList[i] = {
2154
+ vm: u,
2155
+ template: L.compile(r.template)
2156
+ };
2157
+ }
2158
+ const { vm: n, template: o } = this.tempList[i];
2159
+ this.setTempProps(n, e);
2160
+ const a = o.render.call(n);
2161
+ return c.Undef(a.data) && (a.data = {}), a.key = s, a.data.ref = e.ref, a.data.key = s, a;
2162
+ },
2163
+ parseSide(e, r) {
2164
+ return c.Object(e) ? H({ props: { formCreateInject: r.prop.props.formCreateInject } }, e) : e;
2165
+ },
2166
+ renderSides(e, r, i) {
2167
+ const s = r[i ? "rule" : "prop"];
2168
+ return [this.renderRule(this.parseSide(s.prefix, r)), e, this.renderRule(this.parseSide(s.suffix, r))];
2169
+ },
2170
+ renderSlot(e, r) {
2171
+ return e.rule.slot === r ? this.renderCtx(e) : void 0;
2172
+ },
2173
+ renderId(e, r) {
2174
+ const i = this.$handle[r === "field" ? "fieldCtx" : "nameCtx"][e];
2175
+ return i ? i.map((s) => this.renderCtx(s, s.parent)) : void 0;
2176
+ },
2177
+ renderCtx(e, r) {
2178
+ if (e.type === "hidden") return;
2179
+ const i = e.rule;
2180
+ if (!this.cache[e.id] || this.cache[e.id].slot !== i.slot) {
2181
+ let s, n = i.cache !== !1;
2182
+ const o = e.trueType, a = !(c.Undef(i.display) || i.display);
2183
+ if (o === "template" && !i.template)
2184
+ s = this.renderSides(this.renderChildren(e), e, !0), a && this.display(s), s = this.item(e, s);
2185
+ else if (o === "fcFragment")
2186
+ s = this.renderChildren(e);
2187
+ else {
2188
+ e.initProp(), this.mergeGlobal(e), this.$manager.tidyRule(e), this.deepSet(e), this.setOptions(e), this.ctxProp(e);
2189
+ let u = e.prop;
2190
+ u.preview = !!(w(u, "preview") ? u.preview : this.options.preview), u.props.formCreateInject = this.injectProp(e);
2191
+ const l = u.preview;
2192
+ if (u.hidden) {
2193
+ this.setCache(e, void 0, r);
2194
+ return;
2195
+ }
2196
+ if (o === "template" && u.template)
2197
+ s = this.renderTemp(e), n = !1;
2198
+ else {
2199
+ let f = [];
2200
+ e.parser.renderChildren ? f = e.parser.renderChildren(e) : e.parser.loadChildren !== !1 && (f = this.renderChildren(e));
2201
+ const g = this.getTypeSlot(e);
2202
+ g ? s = g({
2203
+ rule: i,
2204
+ prop: u,
2205
+ preview: l,
2206
+ children: f,
2207
+ api: this.$handle.api,
2208
+ model: u.model || {}
2209
+ }) : s = l ? e.parser.preview(f, e) : e.parser.render(f, e);
2210
+ }
2211
+ s = this.renderSides(s, e), !(!e.input && c.Undef(u.native)) && u.native !== !0 && (s = this.$manager.makeWrap(e, s)), a && (s = this.display(s)), s = this.item(e, s);
2212
+ }
2213
+ return n && this.setCache(e, s, r), s;
2214
+ }
2215
+ return this.getCache(e);
2216
+ },
2217
+ display(e) {
2218
+ if (Array.isArray(e)) {
2219
+ const r = [];
2220
+ return e.forEach((i) => {
2221
+ if (Array.isArray(i)) return this.display(i);
2222
+ this.none(i) && r.push(i);
2223
+ }), r;
2224
+ } else
2225
+ return this.none(e);
2226
+ },
2227
+ none(e) {
2228
+ if (e && e.data)
2229
+ return Array.isArray(e.data.style) ? e.data.style.push({ display: "none" }) : c.String(e.data.style) ? e.data.style += ";display:none;" : e.data.style = [e.data.style, { display: "none" }], e;
2230
+ },
2231
+ item(e, r) {
2232
+ return this.$h("fcFragment", {
2233
+ slot: e.rule.slot,
2234
+ key: e.key
2235
+ }, [r]);
2236
+ },
2237
+ injectProp(e) {
2238
+ this.vm.ctxInject[e.id] || F(this.vm.ctxInject, e.id, {
2239
+ api: this.$handle.api,
2240
+ form: this.fc.create,
2241
+ subForm: (i) => {
2242
+ this.$handle.addSubForm(e, i);
2243
+ },
2244
+ getSubForm: () => this.$handle.subForm[e.id],
2245
+ options: [],
2246
+ children: [],
2247
+ prop: {},
2248
+ preview: !1,
2249
+ id: e.id,
2250
+ field: e.field,
2251
+ rule: e.rule,
2252
+ input: e.input
2253
+ });
2254
+ const r = this.vm.ctxInject[e.id];
2255
+ return m(r, {
2256
+ preview: e.prop.preview,
2257
+ options: e.prop.options,
2258
+ children: e.rule.children,
2259
+ prop: function() {
2260
+ const i = y({}, e.prop);
2261
+ return i.on = i.on ? y({}, i.on) : {}, delete i.model, i;
2262
+ }()
2263
+ }), r;
2264
+ },
2265
+ ctxProp(e) {
2266
+ const { ref: r, key: i, rule: s } = e;
2267
+ this.$manager.mergeProp(e), e.parser.mergeProp(e);
2268
+ const n = [
2269
+ {
2270
+ ref: r,
2271
+ key: s.key || `${i}fc`,
2272
+ slot: void 0,
2273
+ on: {
2274
+ "hook:mounted": () => {
2275
+ this.onMounted(e);
2276
+ },
2277
+ "fc.sub-form": (o) => {
2278
+ this.$handle.addSubForm(e, o);
2279
+ },
2280
+ "fc.el": (o) => {
2281
+ e.exportEl = o, o && ((o.$el || o).__rule__ = e.rule);
2282
+ }
2283
+ }
2284
+ }
2285
+ ];
2286
+ return e.input && (this.vm.$props.disabled === !0 && (e.prop.props.disabled = !0), e.prop.model = {
2287
+ value: this.$handle.getFormData(e),
2288
+ callback: (o) => {
2289
+ this.onInput(e, o);
2290
+ },
2291
+ expression: `formData.${e.id}`
2292
+ }), B(n, e.prop), e.prop;
2293
+ },
2294
+ onMounted(e) {
2295
+ e.el = this.vm.$refs[e.ref], e.el && ((e.el.$el || e.el).__rule__ = e.rule), e.parser.mounted(e), this.$handle.effect(e, "mounted");
2296
+ },
2297
+ onInput(e, r) {
2298
+ this.$handle.onInput(e, r);
2299
+ },
2300
+ renderChildren(e) {
2301
+ const { children: r } = e.rule, i = this.orgChildren[e.id], s = (n) => !c.String(n) && n.__fc__ && !this.$handle.ctxs[n.__fc__.id];
2302
+ return !c.trueArray(r) && i ? (this.$handle.deferSyncValue(() => {
2303
+ i.forEach((n) => {
2304
+ n && s(n) && this.$handle.rmCtx(n.__fc__);
2305
+ });
2306
+ }), this.orgChildren[e.id] = [], []) : (i && this.$handle.deferSyncValue(() => {
2307
+ i.forEach((n) => {
2308
+ n && r.indexOf(n) === -1 && s(n) && this.$handle.rmCtx(n.__fc__);
2309
+ });
2310
+ }), r.map((n) => {
2311
+ if (n) {
2312
+ if (c.String(n)) return n;
2313
+ if (n.__fc__)
2314
+ return this.renderCtx(n.__fc__, e);
2315
+ n.type && this.vm.$nextTick(() => {
2316
+ this.$handle.loadChildren(r, e), this.$handle.refresh();
2317
+ });
2318
+ }
2319
+ }));
2320
+ },
2321
+ defaultRender(e, r) {
2322
+ const i = e.prop;
2323
+ return i.component ? this.vNode.makeComponent(i.component, i, r) : this.vNode[e.type] ? this.vNode[e.type](i, r) : this.vNode[e.originType] ? this.vNode[e.originType](i, r) : this.vNode.make(ot(e.originType), i, r);
2324
+ },
2325
+ renderRule(e, r, i) {
2326
+ if (!e) return;
2327
+ if (c.String(e)) return e;
2328
+ let s;
2329
+ if (i)
2330
+ s = e.type;
2331
+ else if (s = e.is, e.type) {
2332
+ s = A(e.type);
2333
+ const o = this.vNode.aliasMap[s];
2334
+ o && (s = A(o));
2335
+ }
2336
+ if (!s) return;
2337
+ let n = [[r]];
2338
+ return c.trueArray(e.children) && n.push(e.children.map((o) => this.renderRule(o))), this.$h(s, y({}, e), n);
2339
+ }
2340
+ });
2341
+ }
2342
+ function be(t) {
2343
+ m(this, {
2344
+ $handle: t,
2345
+ fc: t.fc,
2346
+ vm: t.vm,
2347
+ $manager: t.$manager,
2348
+ vNode: new t.fc.CreateNode(t.vm)
2349
+ }), tt(this, {
2350
+ options() {
2351
+ return t.options;
2352
+ },
2353
+ sort() {
2354
+ return t.sort;
2355
+ }
2356
+ }), this.initCache(), this.initRender();
2357
+ }
2358
+ or(be);
2359
+ lr(be);
2360
+ function ur(t) {
2361
+ m(t.prototype, {
2362
+ parseInjectEvent(e, r) {
2363
+ const i = e.inject || this.options.injectEvent;
2364
+ return this.parseEventLst(e, r, i);
2365
+ },
2366
+ parseEventLst(e, r, i, s) {
2367
+ return Object.keys(r).forEach((n) => {
2368
+ const o = this.parseEvent(e, r[n], i, s);
2369
+ o && (r[n] = o);
2370
+ }), r;
2371
+ },
2372
+ parseEvent(e, r, i, s) {
2373
+ if (c.Function(r) && (i !== !1 && !c.Undef(i) || r.__inject))
2374
+ return this.inject(e, r, i);
2375
+ if (!s && Array.isArray(r) && r[0] && (c.String(r[0]) || c.Function(r[0])))
2376
+ return this.parseEventLst(e, r, i, !0);
2377
+ if (c.String(r)) {
2378
+ const n = U(r);
2379
+ if (n && r !== n)
2380
+ return n.__inject ? this.parseEvent(e, n, i, !0) : n;
2381
+ }
2382
+ },
2383
+ parseEmit(e, r) {
2384
+ let i = {}, s = e.rule, { emitPrefix: n, field: o, name: a, inject: u } = s, l = s[r ? "emit" : "nativeEmit"] || [];
2385
+ return c.trueArray(l) && l.forEach((f) => {
2386
+ if (!f) return;
2387
+ let g, b = n || o || a;
2388
+ if (c.Object(f) && (g = f.inject, f = f.name, b = f.prefix || b), b) {
2389
+ r || (b = `native-${b}`);
2390
+ const _ = Q(`${b}-${f}`), v = (...k) => {
2391
+ this.vm.$emit(_, ...k), this.vm.$emit("emit-event", _, ...k);
2392
+ };
2393
+ if (v.__emit = !0, !g && u === !1)
2394
+ i[f] = v;
2395
+ else {
2396
+ let k = g || u || this.options.injectEvent;
2397
+ i[f] = c.Undef(k) ? v : this.inject(s, v, k);
2398
+ }
2399
+ }
2400
+ }), e.computed[r ? "on" : "nativeOn"] = i, i;
2401
+ },
2402
+ getInjectData(e, r) {
2403
+ const { option: i, rule: s } = this.vm.$options.propsData;
2404
+ return {
2405
+ api: this.api,
2406
+ $f: this.api,
2407
+ rule: s,
2408
+ self: e.__origin__,
2409
+ option: i,
2410
+ inject: r
2411
+ };
2412
+ },
2413
+ inject(e, r, i) {
2414
+ if (r.__origin) {
2415
+ if (this.watching && !this.loading)
2416
+ return r;
2417
+ r = r.__origin;
2418
+ }
2419
+ const s = this, n = function(...o) {
2420
+ const a = s.getInjectData(e, i);
2421
+ return a.args = [...o], o.unshift(a), r.apply(this, o);
2422
+ };
2423
+ return n.__origin = r, n.__json = r.__json, n;
2424
+ }
2425
+ });
2426
+ }
2427
+ const Be = ["hook:updated", "hook:mounted"];
2428
+ function fr(t) {
2429
+ m(t.prototype, {
2430
+ usePage() {
2431
+ const e = this.options.page;
2432
+ if (!e) return;
2433
+ let r = 25, i = hr(this.rules);
2434
+ c.Object(e) && (e.first && (r = parseInt(e.first, 10) || r), e.limit && (i = parseInt(e.limit, 10) || i)), m(this, {
2435
+ first: r,
2436
+ limit: i,
2437
+ pageEnd: this.rules.length <= r
2438
+ }), this.bus.$on("page-end", () => this.vm.$emit("page-end", this.api)), this.pageLoad();
2439
+ },
2440
+ pageLoad() {
2441
+ const e = () => {
2442
+ this.pageEnd ? (this.vm.$off(Be, e), this.bus.$emit("page-end")) : (this.first += this.limit, this.pageEnd = this.rules.length <= this.first, this.loadRule(), this.refresh());
2443
+ };
2444
+ this.vm.$on(Be, e);
2445
+ }
2446
+ });
2447
+ }
2448
+ function hr(t) {
2449
+ return t.length < 31 ? 31 : Math.ceil(t.length / 3);
2450
+ }
2451
+ function cr(t) {
2452
+ m(t.prototype, {
2453
+ clearNextTick() {
2454
+ this.nextTick && clearTimeout(this.nextTick), this.nextTick = null;
2455
+ },
2456
+ bindNextTick(e) {
2457
+ this.clearNextTick(), this.nextTick = setTimeout(() => {
2458
+ e(), this.nextTick = null;
2459
+ }, 10);
2460
+ },
2461
+ render() {
2462
+ return ++this.loadedId, this.vm.unique > 0 ? this.$render.render() : (this.vm.unique = 1, []);
2463
+ }
2464
+ });
2465
+ }
2466
+ function dr(t) {
2467
+ Object.defineProperties(t.origin, {
2468
+ __fc__: Ye(t, !0)
2469
+ });
2470
+ }
2471
+ function lt(t, e, r) {
2472
+ const i = te();
2473
+ m(this, {
2474
+ id: i,
2475
+ ref: i,
2476
+ wrapRef: i + "fi",
2477
+ rule: e,
2478
+ origin: e.__origin__ || e,
2479
+ name: e.name,
2480
+ watch: [],
2481
+ linkOn: [],
2482
+ root: [],
2483
+ ctrlRule: [],
2484
+ parent: null,
2485
+ cacheConfig: null,
2486
+ prop: y({}, e),
2487
+ computed: {},
2488
+ payload: {},
2489
+ input: !!e.field,
2490
+ el: void 0,
2491
+ exportEl: void 0,
2492
+ defaultValue: e.field ? M(r) : void 0,
2493
+ field: e.field || void 0
2494
+ }), this.updateType(), this.updateKey(), dr(this), this.update(t, !0);
2495
+ }
2496
+ m(lt.prototype, {
2497
+ effectData(t) {
2498
+ return this.payload[t] || (this.payload[t] = {}), this.payload[t];
2499
+ },
2500
+ clearEffectData(t) {
2501
+ t === void 0 ? this.payload = {} : delete this.payload[t];
2502
+ },
2503
+ updateKey(t) {
2504
+ this.key = te(), t && this.parent && this.parent.updateKey(t);
2505
+ },
2506
+ updateType() {
2507
+ this.originType = this.rule.type, this.type = A(this.rule.type);
2508
+ },
2509
+ setParser(t) {
2510
+ this.parser = t, t.init(this);
2511
+ },
2512
+ initProp() {
2513
+ const t = y({}, this.rule);
2514
+ delete t.children, this.prop = H({}, [t, ...Object.keys(this.payload).map((e) => this.payload[e]), this.computed]);
2515
+ },
2516
+ injectValidate() {
2517
+ return I(this.prop.validate).map((t) => {
2518
+ if (c.Function(t.validator)) {
2519
+ const e = y({}, t), r = this;
2520
+ return e.validator = function(...i) {
2521
+ return t.validator.call({
2522
+ that: this,
2523
+ id: r.id,
2524
+ field: r.field,
2525
+ rule: r.rule,
2526
+ api: r.$handle.api
2527
+ }, ...i);
2528
+ }, e;
2529
+ }
2530
+ return t;
2531
+ });
2532
+ },
2533
+ check(t) {
2534
+ return this.vm === t.vm;
2535
+ },
2536
+ unwatch() {
2537
+ this.watch.forEach((t) => t()), this.watch = [];
2538
+ },
2539
+ unlink() {
2540
+ this.linkOn.forEach((t) => t()), this.linkOn = [];
2541
+ },
2542
+ link() {
2543
+ this.unlink(), this.$handle.appendLink(this);
2544
+ },
2545
+ watchTo() {
2546
+ this.$handle.watchCtx(this);
2547
+ },
2548
+ delete() {
2549
+ this.unwatch(), this.unlink(), this.rmCtrl(), m(this, {
2550
+ deleted: !0,
2551
+ prop: y({}, this.rule),
2552
+ computed: {},
2553
+ el: void 0,
2554
+ $handle: void 0,
2555
+ $render: void 0,
2556
+ $api: void 0,
2557
+ vm: void 0,
2558
+ vNode: void 0,
2559
+ parent: null,
2560
+ cacheConfig: null
2561
+ });
2562
+ },
2563
+ rmCtrl() {
2564
+ this.ctrlRule.forEach((t) => t.__fc__ && t.__fc__.rm()), this.ctrlRule = [];
2565
+ },
2566
+ rm() {
2567
+ const t = () => {
2568
+ let e = this.root.indexOf(this.origin);
2569
+ e > -1 && (this.root.splice(e, 1), this.$handle && this.$handle.refresh());
2570
+ };
2571
+ if (this.deleted) {
2572
+ t();
2573
+ return;
2574
+ }
2575
+ this.$handle.noWatch(() => {
2576
+ this.$handle.deferSyncValue(() => {
2577
+ this.rmCtrl(), t(), this.$handle.rmCtx(this), m(this, {
2578
+ root: []
2579
+ });
2580
+ }, this.input);
2581
+ });
2582
+ },
2583
+ update(t, e) {
2584
+ m(this, {
2585
+ deleted: !1,
2586
+ $handle: t,
2587
+ $render: t.$render,
2588
+ $api: t.api,
2589
+ vm: t.vm,
2590
+ trueType: t.getType(this.originType),
2591
+ vNode: t.$render.vNode,
2592
+ updated: !1,
2593
+ cacheValue: this.rule.value
2594
+ }), !e && this.unwatch(), this.watchTo(), this.link();
2595
+ }
2596
+ });
2597
+ function pr(t) {
2598
+ m(t.prototype, {
2599
+ nextRefresh(e) {
2600
+ const r = this.loadedId;
2601
+ this.vm.$nextTick(() => {
2602
+ r === this.loadedId && (e ? e() : this.refresh());
2603
+ });
2604
+ },
2605
+ parseRule(e) {
2606
+ const r = Ve(e);
2607
+ return Object.defineProperties(r, {
2608
+ __origin__: Ye(e, !0)
2609
+ }), mr(r), this.appendValue(r), r.options = Array.isArray(r.options) ? r.options : [], [r, r.prefix, r.suffix].forEach((i) => {
2610
+ i && this.loadFn(i, r);
2611
+ }), this.loadCtrl(r), r.update && (r.update = U(r.update)), r;
2612
+ },
2613
+ loadFn(e, r) {
2614
+ ["on", "props", "nativeOn", "deep"].forEach((i) => {
2615
+ e[i] && this.parseInjectEvent(r, e[i]);
2616
+ });
2617
+ },
2618
+ loadCtrl(e) {
2619
+ e.control && e.control.forEach((r) => {
2620
+ r.handle && (r.handle = U(r.handle));
2621
+ });
2622
+ },
2623
+ syncProp(e) {
2624
+ const r = e.rule;
2625
+ c.trueArray(r.sync) && B([{
2626
+ on: r.sync.reduce((i, s) => (i[`update:${s}`] = (n) => {
2627
+ r.props[s] = n, this.vm.$emit("sync", s, n, r, this.fapi);
2628
+ }, i), {})
2629
+ }], e.computed);
2630
+ },
2631
+ loadRule() {
2632
+ this.cycleLoad = !1, this.loading = !0, this.pageEnd && this.bus.$emit("load-start"), this.deferSyncValue(() => {
2633
+ if (this._loadRule(this.rules), this.loading = !1, this.cycleLoad && this.pageEnd)
2634
+ return this.loadRule();
2635
+ this.pageEnd && this.bus.$emit("load-end"), this.vm._renderRule(), this.$render.initOrgChildren(), this.syncForm();
2636
+ });
2637
+ },
2638
+ loadChildren(e, r) {
2639
+ if (this.cycleLoad = !1, this.loading = !0, this.bus.$emit("load-start"), this._loadRule(e, r), this.loading = !1, this.cycleLoad)
2640
+ return this.loadRule();
2641
+ this.bus.$emit("load-end"), this.syncForm(), this.$render.clearCache(r);
2642
+ },
2643
+ _loadRule(e, r) {
2644
+ const i = (n) => {
2645
+ let o = e[n - 1];
2646
+ if (!o || !o.__fc__)
2647
+ return n > 0 ? i(n - 1) : -1;
2648
+ let a = this.sort.indexOf(o.__fc__.id);
2649
+ return a > -1 ? a : i(n - 1);
2650
+ }, s = (n, o) => {
2651
+ c.trueArray(n) && this._loadRule(n, o);
2652
+ };
2653
+ e.map((n, o) => {
2654
+ if (r && !c.Object(n) || !this.pageEnd && !r && o >= this.first) return;
2655
+ if (n.__fc__ && n.__fc__.root === e && this.ctxs[n.__fc__.id])
2656
+ return s(n.__fc__.rule.children, n.__fc__), n.__fc__;
2657
+ let a = Ve(n);
2658
+ const u = () => !!(a.field && this.fieldCtx[a.field] && this.fieldCtx[a.field][0] !== n.__fc__);
2659
+ this.ruleEffect(a, "init", { repeat: u() }), u() && this.vm.$emit("repeat-field", n, this.api);
2660
+ let l, f = !1, g = !!n.__fc__, b = a.value;
2661
+ if (g) {
2662
+ l = n.__fc__, b = l.defaultValue;
2663
+ const v = !l.check(this);
2664
+ if (l.deleted) {
2665
+ if (v) {
2666
+ if (Le(l))
2667
+ return;
2668
+ l.update(this);
2669
+ }
2670
+ } else if (v) {
2671
+ if (Le(l))
2672
+ return;
2673
+ e[o] = n = n._clone ? n._clone() : $e(n), l = null, f = !0;
2674
+ }
2675
+ }
2676
+ if (l)
2677
+ l.originType !== l.rule.type && (l.updateType(), this.bindParser(l)), this.appendValue(l.rule);
2678
+ else {
2679
+ const v = this.parseRule(n);
2680
+ l = new lt(this, v, b), this.bindParser(l);
2681
+ }
2682
+ if ([!1, !0].forEach((v) => this.parseEmit(l, v)), this.syncProp(l), l.parent = r || null, l.root = e, this.setCtx(l), !f && !g && this.effect(l, "load"), this.effect(l, "created"), l.parser.loadChildren === !1 || s(l.rule.children, l), !r) {
2683
+ const v = i(o);
2684
+ v > -1 || !o ? this.sort.splice(v + 1, 0, l.id) : this.sort.push(l.id);
2685
+ }
2686
+ const _ = l.rule;
2687
+ return l.updated || (l.updated = !0, c.Function(_.update) && this.bus.$once("load-end", () => {
2688
+ this.refreshUpdate(l, _.value, "init");
2689
+ }), this.effect(l, "loaded")), l.input && Object.defineProperty(_, "value", this.valueHandle(l)), this.refreshControl(l) && (this.cycleLoad = !0), l;
2690
+ });
2691
+ },
2692
+ refreshControl(e) {
2693
+ return e.input && e.rule.control && this.useCtrl(e);
2694
+ },
2695
+ useCtrl(e) {
2696
+ const r = yr(e), i = [], s = this.api;
2697
+ if (!r.length) return !1;
2698
+ for (let a = 0; a < r.length; a++) {
2699
+ const u = r[a], l = u.handle || function(g) {
2700
+ return (W[u.condition || "=="] || W["=="])(g, u.value);
2701
+ };
2702
+ if (!c.trueArray(u.rule)) continue;
2703
+ const f = q(y({}, u), {
2704
+ valid: j(() => l(e.rule.value, s)),
2705
+ ctrl: gr(e, u.rule),
2706
+ isHidden: c.String(u.rule[0])
2707
+ });
2708
+ f.valid && f.ctrl || !f.valid && !f.ctrl && !f.isHidden || i.push(f);
2709
+ }
2710
+ if (!i.length) return !1;
2711
+ const n = [];
2712
+ let o = !1;
2713
+ return this.deferSyncValue(() => {
2714
+ i.reverse().forEach(({ isHidden: a, valid: u, rule: l, prepend: f, append: g, child: b, ctrl: _, method: v }) => {
2715
+ if (a) {
2716
+ u ? e.ctrlRule.push({
2717
+ __ctrl: !0,
2718
+ children: l,
2719
+ valid: u
2720
+ }) : e.ctrlRule.splice(e.ctrlRule.indexOf(_), 1), n[u ? "push" : "unshift"](() => {
2721
+ v === "disabled" ? this.api.disabled(!u, l) : v === "display" ? this.api.display(u, l) : v === "required" ? (l.forEach((k) => {
2722
+ this.api.setEffect(k, "required", u);
2723
+ }), u || this.api.clearValidateState(l)) : this.api.hidden(!u, l);
2724
+ });
2725
+ return;
2726
+ }
2727
+ if (u) {
2728
+ o = !0;
2729
+ const k = {
2730
+ type: "fcFragment",
2731
+ native: !0,
2732
+ __ctrl: !0,
2733
+ children: l
2734
+ };
2735
+ e.ctrlRule.push(k), this.bus.$once("load-start", () => {
2736
+ f ? s.prepend(k, f, b) : g || b ? s.append(k, g || e.id, b) : e.root.splice(e.root.indexOf(e.origin) + 1, 0, k);
2737
+ });
2738
+ } else {
2739
+ e.ctrlRule.splice(e.ctrlRule.indexOf(_), 1);
2740
+ const k = z(_);
2741
+ k && k.rm();
2742
+ }
2743
+ });
2744
+ }), n.length && this.vm.$nextTick(() => {
2745
+ n.forEach((a) => a());
2746
+ }), this.vm.$emit("control", e.origin, this.api), this.effect(e, "control"), o;
2747
+ },
2748
+ reloadRule(e) {
2749
+ return this._reloadRule(e);
2750
+ },
2751
+ _reloadRule(e) {
2752
+ e || (e = this.rules);
2753
+ const r = y({}, this.ctxs);
2754
+ this.clearNextTick(), this.$render.clearOrgChildren(), this.initData(e), this.fc.rules = e, this.deferSyncValue(() => {
2755
+ this.bus.$once("load-end", () => {
2756
+ Object.keys(r).filter((i) => this.ctxs[i] === void 0).forEach((i) => this.rmCtx(r[i])), this.$render.clearCacheAll();
2757
+ }), this.reloading = !0, this.loadRule(), this.reloading = !1, this.refresh(), this.vm.$emit("reloading", this.api);
2758
+ }), this.bus.$off("next-tick", this.nextReload), this.bus.$once("next-tick", this.nextReload), this.vm.$emit("update", this.api);
2759
+ },
2760
+ //todo 组件生成全部通过 alias
2761
+ refresh() {
2762
+ this.vm._refresh();
2763
+ }
2764
+ });
2765
+ }
2766
+ function mr(t) {
2767
+ const e = rt();
2768
+ return Object.keys(e).forEach((r) => {
2769
+ w(t, r) || F(t, r, e[r]);
2770
+ }), t;
2771
+ }
2772
+ function yr(t) {
2773
+ const e = t.rule.control || [];
2774
+ return c.Object(e) ? [e] : e;
2775
+ }
2776
+ function gr(t, e) {
2777
+ for (let r = 0; r < t.ctrlRule.length; r++) {
2778
+ const i = t.ctrlRule[r];
2779
+ if (i.children === e)
2780
+ return i;
2781
+ }
2782
+ }
2783
+ function Le(t) {
2784
+ return !!t.rule.__ctrl;
2785
+ }
2786
+ function $r(t) {
2787
+ m(t.prototype, {
2788
+ getValue(e) {
2789
+ return c.Undef(e.cacheValue) && (e.cacheValue = e.parser.toValue(this.getFormData(e), e)), e.cacheValue;
2790
+ },
2791
+ setValue(e, r, i, s) {
2792
+ e.deleted || (e.cacheValue = r, this.changeStatus = !0, this.nextRefresh(), this.$render.clearCache(e), this.setFormData(e, i), this.syncValue(), this.valueChange(e, r), this.vm.$emit("change", e.field, r, e.origin, this.api, s || !1), this.effect(e, "value"), this.emitEvent("change", e.field, r, {
2793
+ rule: e.origin,
2794
+ api: this.api,
2795
+ setFlag: s || !1
2796
+ }));
2797
+ },
2798
+ onInput(e, r) {
2799
+ let i;
2800
+ e.input && (this.isQuote(e, i = e.parser.toValue(r, e)) || this.isChange(e, i)) && this.setValue(e, i, r);
2801
+ },
2802
+ setFormData(e, r) {
2803
+ F(this.formData, e.id, r === null ? void 0 : r);
2804
+ },
2805
+ getFormData(e) {
2806
+ return this.formData[e.id];
2807
+ },
2808
+ validate() {
2809
+ return Me(this.vm.validate), this.fields().forEach((e) => {
2810
+ this.fieldCtx[e].forEach((r) => {
2811
+ this.vm.validate[r.id] = I(r.rule.validate);
2812
+ });
2813
+ }), this.vm.validate;
2814
+ },
2815
+ syncForm() {
2816
+ Me(this.form), Object.defineProperties(this.form, this.fields().reduce((e, r) => {
2817
+ const i = this.getFieldCtx(r), s = this.valueHandle(i);
2818
+ return s.configurable = !0, e[r] = s, e;
2819
+ }, this.options.appendValue !== !1 ? Object.keys(this.appendData).reduce((e, r) => (e[r] = {
2820
+ enumerable: !0,
2821
+ configurable: !0,
2822
+ get: () => this.appendData[r],
2823
+ set: (i) => {
2824
+ this.appendData[r] = i;
2825
+ }
2826
+ }, e), {}) : {})), this.syncValue();
2827
+ },
2828
+ valueHandle(e) {
2829
+ return {
2830
+ enumerable: !0,
2831
+ get: () => this.getValue(e),
2832
+ set: (r) => {
2833
+ this.isChange(e, r) && this.setValue(e, r, e.parser.toFormValue(r, e), !0);
2834
+ }
2835
+ };
2836
+ },
2837
+ appendValue(e) {
2838
+ !e.field || !w(this.appendData, e.field) || (e.value = this.appendData[e.field], delete this.appendData[e.field]);
2839
+ },
2840
+ addSubForm(e, r) {
2841
+ this.subForm[e.id] = r;
2842
+ },
2843
+ deferSyncValue(e, r) {
2844
+ this.deferSyncFn || (this.deferSyncFn = e), this.deferSyncFn.sync || (this.deferSyncFn.sync = r), j(e), this.deferSyncFn === e && (this.deferSyncFn = null, e.sync && this.syncValue());
2845
+ },
2846
+ syncValue() {
2847
+ if (this.deferSyncFn)
2848
+ return this.deferSyncFn.sync = !0;
2849
+ this.vm._updateValue(y(y({}, this.options.appendValue !== !1 ? this.appendData : {}), this.form));
2850
+ },
2851
+ isChange(e, r) {
2852
+ return JSON.stringify(e.rule.value, Ne) !== JSON.stringify(r === null ? void 0 : r, Ne);
2853
+ },
2854
+ isQuote(e, r) {
2855
+ return (c.Object(r) || Array.isArray(r)) && r === e.rule.value;
2856
+ },
2857
+ refreshUpdate(e, r, i, s) {
2858
+ if (c.Function(e.rule.update)) {
2859
+ const n = j(() => e.rule.update(r, e.origin, this.api, {
2860
+ origin: i || "change",
2861
+ linkField: s
2862
+ }));
2863
+ if (n === void 0) return;
2864
+ e.rule.hidden = n === !0;
2865
+ }
2866
+ },
2867
+ valueChange(e, r) {
2868
+ this.refreshRule(e, r), this.bus.$emit("change-" + e.field, r);
2869
+ },
2870
+ refreshRule(e, r, i, s) {
2871
+ this.refreshControl(e) && (this.$render.clearCacheAll(), this.loadRule(), this.vm.$emit("update", this.api), this.refresh()), this.refreshUpdate(e, r, i, s);
2872
+ },
2873
+ appendLink(e) {
2874
+ const r = e.rule.link;
2875
+ c.trueArray(r) && r.forEach((i) => {
2876
+ const s = () => this.refreshRule(e, e.rule.value, "link", i);
2877
+ this.bus.$on("change-" + i, s), e.linkOn.push(() => this.bus.$off("change-" + i, s));
2878
+ });
2879
+ },
2880
+ fields() {
2881
+ return Object.keys(this.fieldCtx);
2882
+ }
2883
+ });
2884
+ }
2885
+ function Ne(t, e) {
2886
+ return typeof e == "function" ? "" + e : e;
2887
+ }
2888
+ function Me(t) {
2889
+ Object.keys(t).forEach((e) => delete t[e]);
2890
+ }
2891
+ const ce = {
2892
+ init(t) {
2893
+ },
2894
+ toFormValue(t, e) {
2895
+ return t;
2896
+ },
2897
+ toValue(t, e) {
2898
+ return t;
2899
+ },
2900
+ mounted(t) {
2901
+ },
2902
+ render(t, e) {
2903
+ return e.$render.defaultRender(e, t);
2904
+ },
2905
+ preview(t, e) {
2906
+ return this.render(t, e);
2907
+ },
2908
+ mergeProp(t) {
2909
+ }
2910
+ }, vr = ["field", "value", "vm", "template", "name", "config", "control", "inject", "sync", "payload", "optionsTo", "update", "component", "cache"];
2911
+ function br(t) {
2912
+ m(t.prototype, {
2913
+ getCtx(e) {
2914
+ return this.getFieldCtx(e) || this.getNameCtx(e)[0] || this.ctxs[e];
2915
+ },
2916
+ getCtxs(e) {
2917
+ return this.fieldCtx[e] || this.nameCtx[e] || (this.ctxs[e] ? [this.ctxs[e]] : []);
2918
+ },
2919
+ setIdCtx(e, r, i) {
2920
+ const s = `${i}Ctx`;
2921
+ this[s][r] ? this[s][r].push(e) : this[s][r] = [e];
2922
+ },
2923
+ rmIdCtx(e, r, i) {
2924
+ const s = `${i}Ctx`, n = this[s][r];
2925
+ if (!n) return !1;
2926
+ const o = n.splice(n.indexOf(e) >>> 0, 1).length > 0;
2927
+ return n.length || delete this[s][r], o;
2928
+ },
2929
+ getFieldCtx(e) {
2930
+ return (this.fieldCtx[e] || [])[0];
2931
+ },
2932
+ getNameCtx(e) {
2933
+ return this.nameCtx[e] || [];
2934
+ },
2935
+ setCtx(e) {
2936
+ let { id: r, field: i, name: s, rule: n } = e;
2937
+ this.ctxs[r] = e, s && this.setIdCtx(e, s, "name"), e.input && (this.setIdCtx(e, i, "field"), this.setFormData(e, e.parser.toFormValue(n.value, e)), this.isMounted && !this.reloading && this.vm.$emit("change", e.field, n.value, e.origin, this.api));
2938
+ },
2939
+ getParser(e) {
2940
+ const r = this.fc.parsers;
2941
+ return r[e.originType] || r[A(e.type)] || r[e.trueType] || ce;
2942
+ },
2943
+ bindParser(e) {
2944
+ e.setParser(this.getParser(e));
2945
+ },
2946
+ getType(e) {
2947
+ const r = this.fc.CreateNode.aliasMap, i = r[e] || r[A(e)] || e;
2948
+ return A(i);
2949
+ },
2950
+ noWatch(e) {
2951
+ this.noWatchFn || (this.noWatchFn = e), j(e), this.noWatchFn === e && (this.noWatchFn = null);
2952
+ },
2953
+ watchCtx(e) {
2954
+ const r = this.vm;
2955
+ Object.keys(e.rule).filter((i) => i[0] !== "_" && i[0] !== "$" && vr.indexOf(i) === -1).forEach((i) => {
2956
+ const s = i === "children";
2957
+ e.watch.push(r.$watch(() => e.rule[i], (n, o) => {
2958
+ if (!(this.loading || this.noWatchFn || this.reloading)) {
2959
+ if (s && e.parser.loadChildren === !1) {
2960
+ this.$render.clearCache(e), this.nextRefresh();
2961
+ return;
2962
+ }
2963
+ if (this.watching = !0, i === "link") {
2964
+ e.link();
2965
+ return;
2966
+ } else if (["props", "on", "nativeOn", "deep"].indexOf(i) > -1)
2967
+ this.parseInjectEvent(e.rule, n || {}), i === "props" && e.input && this.setFormData(e, e.parser.toFormValue(e.rule.value, e));
2968
+ else if (["emit", "nativeEmit"].indexOf(i) > -1)
2969
+ this.parseEmit(e, i === "emit");
2970
+ else if (["prefix", "suffix"].indexOf(i) > -1)
2971
+ n && this.loadFn(n, e.rule);
2972
+ else if (i === "type")
2973
+ e.updateType(), this.bindParser(e);
2974
+ else if (i === "children") {
2975
+ const a = c.trueArray(n);
2976
+ this.deferSyncValue(() => {
2977
+ n !== o && (this.rmSub(o, e), this.$render.initOrgChildren()), a && this.loadChildren(n, e), this.vm.$emit("update", this.api);
2978
+ });
2979
+ }
2980
+ this.$render.clearCache(e), this.refresh(), this.watching = !1;
2981
+ }
2982
+ }, { deep: !s, sync: s }));
2983
+ }), this.watchEffect(e);
2984
+ },
2985
+ rmSub(e, r) {
2986
+ c.trueArray(e) && e.forEach((i) => {
2987
+ i && i.__fc__ && i.__fc__.parent === r && this.rmCtx(i.__fc__);
2988
+ });
2989
+ },
2990
+ rmCtx(e) {
2991
+ if (e.deleted) return;
2992
+ const { id: r, field: i, input: s, name: n } = e;
2993
+ e.input && Object.defineProperty(e.rule, "value", {
2994
+ value: e.rule.value,
2995
+ writable: !0
2996
+ }), N(this.ctxs, r), N(this.$render.tempList, r), N(this.$render.orgChildren, r), N(this.vm.ctxInject, r), N(this.formData, r), N(this.subForm, r), N(e, "cacheValue"), s && this.rmIdCtx(e, i, "field"), n && this.rmIdCtx(e, n, "name"), s && !w(this.fieldCtx, i) && N(this.form, i), this.deferSyncValue(() => {
2997
+ this.reloading || (e.parser.loadChildren !== !1 && c.trueArray(e.rule.children) && e.rule.children.forEach((a) => a.__fc__ && this.rmCtx(a.__fc__)), e.root === this.rules && this.vm._renderRule());
2998
+ }, s);
2999
+ const o = this.sort.indexOf(r);
3000
+ return o > -1 && this.sort.splice(o, 1), this.$render.clearCache(e), e.delete(), this.effect(e, "deleted"), s && !this.fieldCtx[i] && this.vm.$emit("removeField", i, e.rule, this.api), e.rule.__ctrl || this.vm.$emit("removeRule", e.rule, this.api), e;
3001
+ }
3002
+ });
3003
+ }
3004
+ function Cr(t) {
3005
+ m(t.prototype, {
3006
+ mounted() {
3007
+ const e = () => {
3008
+ this.isMounted = !0, this.lifecycle("mounted");
3009
+ };
3010
+ this.pageEnd ? e() : this.bus.$once("page-end", e);
3011
+ },
3012
+ lifecycle(e) {
3013
+ this.vm.$emit(e, this.api), this.emitEvent(e, this.api);
3014
+ },
3015
+ emitEvent(e, ...r) {
3016
+ const i = this.options[e] || this.options[A("on-" + e)];
3017
+ if (i) {
3018
+ const s = U(i);
3019
+ c.Function(s) && j(() => s(...r));
3020
+ }
3021
+ this.bus.$emit(e, ...r);
3022
+ }
3023
+ });
3024
+ }
3025
+ function _r(t) {
3026
+ m(t.prototype, {
3027
+ useProvider() {
3028
+ const e = this.fc.providers;
3029
+ Object.keys(e).forEach((r) => {
3030
+ let i = e[r];
3031
+ c.Function(i) && (i = i(this.fc)), i._c = Or(i), this.onEffect(i), this.providers[r] = i;
3032
+ });
3033
+ },
3034
+ onEffect(e) {
3035
+ const r = [];
3036
+ (e._c || ["*"]).forEach((i) => {
3037
+ const s = i === "*" ? "*" : this.getType(i);
3038
+ r.indexOf(s) > -1 || (r.push(s), this.bus.$on(`p:${e.name}:${s}:${e.input ? 1 : 0}`, (n, o) => {
3039
+ e[n] && e[n](...o);
3040
+ }));
3041
+ }), e._used = r;
3042
+ },
3043
+ watchEffect(e) {
3044
+ const r = this.vm;
3045
+ let i = {
3046
+ required: () => {
3047
+ var s, n;
3048
+ return (w(e.rule, "$required") ? e.rule.$required : (n = (s = e.rule) == null ? void 0 : s.effect) == null ? void 0 : n.required) || !1;
3049
+ }
3050
+ };
3051
+ Object.keys(e.rule.effect || {}).forEach((s) => {
3052
+ i[s] = () => e.rule.effect[s];
3053
+ }), Object.keys(e.rule).forEach((s) => {
3054
+ s[0] === "$" && (i[s.substr(1)] = () => e.rule[s]);
3055
+ }), Object.keys(i || {}).forEach((s) => {
3056
+ e.watch.push(r.$watch(i[s], (n) => {
3057
+ this.effect(e, "watch", { [s]: n });
3058
+ }, { deep: !0 }));
3059
+ });
3060
+ },
3061
+ ruleEffect(e, r, i) {
3062
+ this.emitEffect({
3063
+ rule: e,
3064
+ input: !!e.field,
3065
+ type: this.getType(e.type)
3066
+ }, r, i);
3067
+ },
3068
+ effect(e, r, i) {
3069
+ this.emitEffect({
3070
+ rule: e.rule,
3071
+ input: e.input,
3072
+ type: e.trueType,
3073
+ ctx: e,
3074
+ custom: i
3075
+ }, r);
3076
+ },
3077
+ getEffect(e, r) {
3078
+ if (w(e, "$" + r))
3079
+ return e["$" + r];
3080
+ if (w(e, "effect") && w(e.effect, r))
3081
+ return e.effect[r];
3082
+ },
3083
+ emitEffect({ ctx: e, rule: r, input: i, type: s, custom: n }, o, a) {
3084
+ if (!s || s === "fcFragment") return;
3085
+ const u = n || Object.keys(r).reduce((l, f) => (f[0] === "$" && (l[f.substr(1)] = r[f]), l), y({}, r.effect || {}));
3086
+ Object.keys(u).forEach((l) => {
3087
+ const f = this.providers[l];
3088
+ if (!f || f.input && !i) return;
3089
+ let g;
3090
+ if (!f._c)
3091
+ g = "*";
3092
+ else if (f._used.indexOf(s) > -1)
3093
+ g = s;
3094
+ else
3095
+ return;
3096
+ const b = y({ value: u[l], getValue: () => this.getEffect(r, l) }, a || {});
3097
+ e && (b.getProp = () => e.effectData(l), b.clearProp = () => e.clearEffectData(l), b.mergeProp = (_) => H(b.getProp(), [_]), b.id = e.id), this.bus.$emit(`p:${l}:${g}:${f.input ? 1 : 0}`, o, [b, r, this.api]);
3098
+ });
3099
+ }
3100
+ });
3101
+ }
3102
+ function kr(t) {
3103
+ return t.filter(function(e, r, i) {
3104
+ return i.indexOf(e, 0) === r;
3105
+ });
3106
+ }
3107
+ function Or(t) {
3108
+ const e = t.components;
3109
+ if (Array.isArray(e)) {
3110
+ const r = kr(e.filter((i) => i !== "*"));
3111
+ return r.length ? r : !1;
3112
+ } else return c.String(e) ? [e] : !1;
3113
+ }
3114
+ function P(t) {
3115
+ m(this, {
3116
+ fc: t,
3117
+ vm: t.vm,
3118
+ watching: !1,
3119
+ loading: !1,
3120
+ reloading: !1,
3121
+ noWatchFn: null,
3122
+ deferSyncFn: null,
3123
+ isMounted: !1,
3124
+ formData: {},
3125
+ subForm: {},
3126
+ form: {},
3127
+ appendData: {},
3128
+ providers: {},
3129
+ cycleLoad: null,
3130
+ loadedId: 1,
3131
+ nextTick: null,
3132
+ changeStatus: !1,
3133
+ pageEnd: !0,
3134
+ nextReload: () => {
3135
+ this.lifecycle("reload");
3136
+ }
3137
+ }), tt(this, {
3138
+ options() {
3139
+ return t.options;
3140
+ },
3141
+ bus() {
3142
+ return t.bus;
3143
+ }
3144
+ }), this.initData(t.rules), this.$manager = new t.manager(this), this.$render = new be(this), this.api = t.extendApi(sr(this), this);
3145
+ }
3146
+ m(P.prototype, {
3147
+ initData(t) {
3148
+ m(this, {
3149
+ ctxs: {},
3150
+ fieldCtx: {},
3151
+ nameCtx: {},
3152
+ sort: [],
3153
+ rules: t
3154
+ });
3155
+ },
3156
+ init() {
3157
+ this.appendData = y(y(y({}, this.fc.options.formData || {}), this.vm.value || {}), this.appendData), this.useProvider(), this.usePage(), this.loadRule(), this.$manager.__init(), this.lifecycle("created"), this.vm.$set(this.vm, "formData", this.formData);
3158
+ },
3159
+ beforeFetch(t) {
3160
+ return new Promise((e) => {
3161
+ const r = this.options.beforeFetch && j(() => this.options.beforeFetch(t, { api: this.api }));
3162
+ r && c.Function(r.then) ? r.then(e) : e();
3163
+ });
3164
+ }
3165
+ });
3166
+ ur(P);
3167
+ fr(P);
3168
+ cr(P);
3169
+ pr(P);
3170
+ $r(P);
3171
+ br(P);
3172
+ Cr(P);
3173
+ _r(P);
3174
+ const wr = "fcFragment", ie = {
3175
+ name: wr,
3176
+ functional: !0,
3177
+ props: ["vnode"],
3178
+ render(t, e) {
3179
+ return e.props.vnode ? e.props.vnode : e.children;
3180
+ }
3181
+ };
3182
+ function Fr(t) {
3183
+ return c.String(t) ? { domProps: { innerHTML: t } } : t;
3184
+ }
3185
+ function Sr() {
3186
+ const t = {};
3187
+ function e(r) {
3188
+ r && this.setVm(r);
3189
+ }
3190
+ return m(e.prototype, {
3191
+ setVm(r) {
3192
+ this.vm = r, this.$h = r.$createElement;
3193
+ },
3194
+ make(r, i, s) {
3195
+ return Y.config.isReservedTag(r) && i.nativeOn && delete i.nativeOn, this.makeComponent(r, i, s);
3196
+ },
3197
+ makeComponent(r, i, s) {
3198
+ let n = this.$h(r, Fr(i), s || []);
3199
+ return n.context = this.vm, n;
3200
+ },
3201
+ aliasMap: t
3202
+ }), m(e, {
3203
+ aliasMap: t,
3204
+ alias(r, i) {
3205
+ t[r] = i;
3206
+ },
3207
+ use(r) {
3208
+ Object.keys(r).forEach((i) => {
3209
+ const s = Q(i), n = at(i).toLocaleLowerCase(), o = r[i];
3210
+ [i, s, n].forEach((a) => {
3211
+ e.alias(i, o), e.prototype[a] = function(u, l) {
3212
+ return this.make(o, u, l);
3213
+ };
3214
+ });
3215
+ });
3216
+ }
3217
+ }), e;
3218
+ }
3219
+ function Rr(t) {
3220
+ class e extends ut {
3221
+ }
3222
+ return Object.assign(e.prototype, t), e;
3223
+ }
3224
+ function ut(t) {
3225
+ m(this, {
3226
+ $handle: t,
3227
+ vm: t.vm,
3228
+ options: {},
3229
+ ref: "fcForm",
3230
+ mergeOptionsRule: {
3231
+ normal: ["form", "row", "info", "submitBtn", "resetBtn"]
3232
+ }
3233
+ }), this.updateKey(), this.init();
3234
+ }
3235
+ m(ut.prototype, {
3236
+ __init() {
3237
+ this.$render = this.$handle.$render, this.$r = (...t) => this.$render.renderRule(...t);
3238
+ },
3239
+ updateKey() {
3240
+ this.key = te();
3241
+ },
3242
+ //TODO interface
3243
+ init() {
3244
+ },
3245
+ update() {
3246
+ },
3247
+ beforeRender() {
3248
+ },
3249
+ form() {
3250
+ return this.vm.$refs[this.ref];
3251
+ },
3252
+ getSlot(t) {
3253
+ const e = (r) => {
3254
+ if (r) {
3255
+ let i = r.$scopedSlots[t];
3256
+ return i || e(r.$pfc);
3257
+ }
3258
+ };
3259
+ return e(this.vm);
3260
+ },
3261
+ mergeOptions(t, e) {
3262
+ return B(t.map((r) => this.tidyOptions(r)), e, this.mergeOptionsRule);
3263
+ },
3264
+ updateOptions(t) {
3265
+ this.options = this.mergeOptions([t], this.getDefaultOptions()), this.update();
3266
+ },
3267
+ tidyOptions(t) {
3268
+ return t;
3269
+ },
3270
+ tidyRule(t) {
3271
+ },
3272
+ mergeProp(t) {
3273
+ },
3274
+ getDefaultOptions() {
3275
+ return {};
3276
+ },
3277
+ render(t) {
3278
+ }
3279
+ });
3280
+ const Er = function(t) {
3281
+ const e = {
3282
+ name: "loadData",
3283
+ _fn: [],
3284
+ created(r, i, s) {
3285
+ this.deleted(r);
3286
+ let n = I(r.getValue());
3287
+ const o = [];
3288
+ n.forEach((a) => {
3289
+ if (a) {
3290
+ const u = () => {
3291
+ a.watch !== !1 && (t.bus.$off("p.loadData." + a.attr, u), t.bus.$once("p.loadData." + a.attr, u));
3292
+ let l;
3293
+ a.attr && (l = t.loadData[a.attr] || a.default, a.copy !== !1 && (l = M(l))), Z(r.getProp(), a.to || "options", l), s.sync(i);
3294
+ };
3295
+ o.push(() => t.bus.$off("p.loadData." + a.attr, u)), u();
3296
+ }
3297
+ }), this._fn[r.id] = o;
3298
+ },
3299
+ deleted(r) {
3300
+ this._fn[r.id] && (this._fn[r.id].forEach((i) => {
3301
+ i();
3302
+ }), delete this._fn[r.id]), r.clearProp();
3303
+ }
3304
+ };
3305
+ return e.watch = e.created, e;
3306
+ }, ft = {
3307
+ name: "componentValidate",
3308
+ load(t, e, r) {
3309
+ const i = t.getValue();
3310
+ i ? t.getProp().validate = [{
3311
+ validator(...s) {
3312
+ const n = z(e);
3313
+ if (n)
3314
+ return r.exec(n.id, i === !0 ? "formCreateValidate" : i, ...s, {
3315
+ attr: t,
3316
+ rule: e,
3317
+ api: r
3318
+ });
3319
+ }
3320
+ }] : (t.clearProp(), r.clearValidateState([e.field]));
3321
+ },
3322
+ watch(...t) {
3323
+ ft.load(...t);
3324
+ }
3325
+ }, jr = function(t) {
3326
+ function e(i) {
3327
+ return c.String(i) && (i = {
3328
+ action: i,
3329
+ to: "options"
3330
+ }), i;
3331
+ }
3332
+ function r(i, s, n) {
3333
+ let o = i.value;
3334
+ const a = (g) => {
3335
+ g === void 0 ? (i.clearProp(), n.sync(s)) : Z(i.getProp(), o.to || "options", g);
3336
+ };
3337
+ if (c.Function(o) && (o = o(s, n)), o = e(o), !o || !o.action) {
3338
+ a(void 0);
3339
+ return;
3340
+ }
3341
+ o = M(o), o.to || (o.to = "options");
3342
+ const u = o.onError, l = () => {
3343
+ if (!i.getValue())
3344
+ return i.clearProp(), n.sync(s), !0;
3345
+ }, f = q(y({
3346
+ headers: {}
3347
+ }, o), {
3348
+ onSuccess(g, b) {
3349
+ if (l()) return;
3350
+ let _ = (v) => b ? v : w(v, "data") ? v.data : v;
3351
+ c.Function(o.parse) ? _ = o.parse : o.parse && c.String(o.parse) && (_ = (v) => (o.parse.split(".").forEach((k) => {
3352
+ v && (v = v[k]);
3353
+ }), v)), a(_(g, s, n)), n.sync(s);
3354
+ },
3355
+ onError(g) {
3356
+ a(void 0), !l() && (u || ((b) => ge(b.message || "fetch fail " + o.action)))(g, s, n);
3357
+ }
3358
+ });
3359
+ t.$handle.beforeFetch(f, { rule: s, api: n }).then(() => {
3360
+ if (c.Function(o.action)) {
3361
+ o.action(s, n).then((g) => {
3362
+ f.onSuccess(g, !0);
3363
+ }).catch((g) => {
3364
+ f.onError(g);
3365
+ });
3366
+ return;
3367
+ }
3368
+ j(() => t.create.fetch(f, { inject: i, rule: s, api: n }));
3369
+ });
3370
+ }
3371
+ return {
3372
+ name: "fetch",
3373
+ loaded(...i) {
3374
+ r(...i);
3375
+ },
3376
+ watch(...i) {
3377
+ r(...i);
3378
+ }
3379
+ };
3380
+ }, ht = {
3381
+ name: "required",
3382
+ load(t, e, r) {
3383
+ const i = Ir(t.getValue());
3384
+ if (i.required === !1)
3385
+ t.clearProp(), r.clearValidateState([e.field]);
3386
+ else {
3387
+ const s = y({
3388
+ required: !0,
3389
+ validator(n, o, a) {
3390
+ c.empty(o) ? a(s.message) : a();
3391
+ }
3392
+ }, i);
3393
+ if (!s.message) {
3394
+ let n = e.title || "";
3395
+ s.message = ((typeof n == "object" ? n.title : n) || "") + "不能为空";
3396
+ }
3397
+ t.getProp().validate = [s];
3398
+ }
3399
+ r.sync(e);
3400
+ },
3401
+ watch(...t) {
3402
+ ht.load(...t);
3403
+ }
3404
+ };
3405
+ function Ir(t) {
3406
+ return c.Boolean(t) ? { required: t } : c.String(t) ? { message: t } : c.Undef(t) ? { required: !1 } : c.Function(t) ? { validator: t } : c.Object(t) ? t : {};
3407
+ }
3408
+ const Ar = {
3409
+ fetch: jr,
3410
+ loadData: Er,
3411
+ required: ht,
3412
+ componentValidate: ft
3413
+ }, Vr = "html", Pr = {
3414
+ name: Vr,
3415
+ loadChildren: !1,
3416
+ render(t, e) {
3417
+ return e.prop.domProps || (e.prop.domProps = {}), e.prop.domProps.innerHTML = t, e.vNode.make(e.prop.props.tag || "div", e.prop);
3418
+ },
3419
+ renderChildren(t) {
3420
+ return Array.isArray(t.rule.children) ? t.rule.children.filter((e) => c.String(e)).join("") : "";
3421
+ }
3422
+ };
3423
+ let L = typeof window != "undefined" && window.Vue ? window.Vue : Y;
3424
+ function Tr(t, e) {
3425
+ let r;
3426
+ return arguments.length === 2 ? (r = arguments[1], e = r[t]) : r = arguments[2], { id: e, prop: r };
3427
+ }
3428
+ function ne() {
3429
+ return Tr("name", ...arguments);
3430
+ }
3431
+ function qe(t) {
3432
+ return !t || !t.el ? window.document.body : c.Element(t.el) ? t.el : document.querySelector(t.el);
3433
+ }
3434
+ function Ue(t, e) {
3435
+ const r = new L({
3436
+ data() {
3437
+ return { rule: t, option: e || {} };
3438
+ },
3439
+ render(i) {
3440
+ return i("FormCreate", { ref: "fc", props: this.$data });
3441
+ }
3442
+ });
3443
+ return r.$mount(), r;
3444
+ }
3445
+ function Dr(t) {
3446
+ const e = t.key || [], r = t.array || [], i = t.normal || [];
3447
+ Qe.push(...e), pe.push(...r), me.push(...i), it([...e, ...r, ...i]);
3448
+ }
3449
+ let Br = 1;
3450
+ const E = {};
3451
+ function ct(t) {
3452
+ const e = {
3453
+ [ie.name]: ie
3454
+ }, r = {}, i = {}, s = y({}, Ar), n = rr();
3455
+ let o = { global: {} };
3456
+ const a = {}, u = Sr();
3457
+ Dr(t.attrs || {});
3458
+ function l(h) {
3459
+ const d = E[h];
3460
+ if (Array.isArray(d))
3461
+ return d.map(($) => $.api());
3462
+ if (d)
3463
+ return d.api();
3464
+ }
3465
+ function f() {
3466
+ const h = ne(...arguments);
3467
+ h.id && h.prop && (i[h.id] = h.prop);
3468
+ }
3469
+ function g() {
3470
+ const h = ne(...arguments);
3471
+ h.id && h.prop && (s[h.id] = q(y({}, h.prop), { name: h.id }));
3472
+ }
3473
+ function b(h) {
3474
+ u.use(h);
3475
+ }
3476
+ function _() {
3477
+ const h = ne(...arguments);
3478
+ if (!h.id || !h.prop) return ce;
3479
+ const d = A(h.id), $ = h.prop, C = $.merge === !0 ? r[d] : void 0;
3480
+ r[d] = $, Object.setPrototypeOf($, C || ce), n[d] = R(d), $.maker && m(n, $.maker);
3481
+ }
3482
+ function v(h, d) {
3483
+ let $;
3484
+ if (c.String(h)) {
3485
+ if ($ = A(h), ["form-create", "formcreate"].indexOf($) > -1)
3486
+ return re();
3487
+ if (d === void 0)
3488
+ return e[$];
3489
+ } else
3490
+ $ = A(h.name), d = h;
3491
+ if (!$ || !d) return;
3492
+ const C = A($);
3493
+ e[$] = d, e[C] = d, delete u.aliasMap[$], delete u.aliasMap[C], delete r[$], delete r[C], d.formCreateParser && _($, d.formCreateParser);
3494
+ }
3495
+ function k(h) {
3496
+ Object.keys(E).forEach((d) => {
3497
+ (Array.isArray(E[d]) ? E[d] : [E[d]]).forEach((C) => {
3498
+ C.bus.$emit("p.loadData." + h);
3499
+ });
3500
+ });
3501
+ }
3502
+ function Ce(h, d) {
3503
+ a[h] = d, k(h);
3504
+ }
3505
+ function _e(h, d) {
3506
+ return w(a, h) ? a[h] : d;
3507
+ }
3508
+ function dt(h) {
3509
+ delete a[h], k(h);
3510
+ }
3511
+ function re() {
3512
+ return L.extend(Gt(Oe));
3513
+ }
3514
+ function ke() {
3515
+ return L.extend(ie);
3516
+ }
3517
+ function pt(h, d) {
3518
+ return c.Function(h.install) ? h.install(T, d) : c.Function(h) && h(T, d), this;
3519
+ }
3520
+ function T(h, d, $) {
3521
+ let C = Ue(h, d || {});
3522
+ const V = C.$refs.fc.formCreate;
3523
+ return V.$parent = $, qe(V.options).appendChild(C.$el), V.api();
3524
+ }
3525
+ function mt(h) {
3526
+ let d = y({}, t);
3527
+ return h ? d.inherit = {
3528
+ components: e,
3529
+ parsers: r,
3530
+ directives: i,
3531
+ providers: s,
3532
+ maker: n,
3533
+ loadData: a
3534
+ } : delete d.inherit, ct(d);
3535
+ }
3536
+ function Oe(h) {
3537
+ const d = h.$options.propsData.rule;
3538
+ m(this, {
3539
+ id: Br++,
3540
+ vm: h,
3541
+ create: T,
3542
+ manager: Rr(t.manager),
3543
+ parsers: r,
3544
+ providers: s,
3545
+ rules: Array.isArray(d) ? d : [],
3546
+ name: h.$options.propsData.name || te(),
3547
+ inFor: h.$options.propsData.inFor,
3548
+ prop: {
3549
+ components: e,
3550
+ directives: i
3551
+ },
3552
+ setData: Ce,
3553
+ getData: _e,
3554
+ loadData: a,
3555
+ CreateNode: u,
3556
+ bus: new L(),
3557
+ unwatch: null,
3558
+ options: {},
3559
+ extendApi: t.extendApi || (($) => $)
3560
+ }), this.init(), this.initOptions(), this.name && (this.inFor ? (E[this.name] || (E[this.name] = []), E[this.name].push(this)) : E[this.name] = this);
3561
+ }
3562
+ m(Oe.prototype, {
3563
+ init() {
3564
+ const h = this.vm, d = new P(this);
3565
+ this.$handle = d, h.$f = d.api, h.$emit("input", d.api), h.$on("hook:created", () => {
3566
+ this.isSub() && (this.unwatch = h.$watch(() => h.$pfc.option, () => {
3567
+ this.initOptions(), h.$f.refresh();
3568
+ }, { deep: !0 }), this.initOptions()), this.created();
3569
+ }), h.$on("hook:mounted", () => {
3570
+ this.mounted();
3571
+ }), h.$on("hook:beforeDestroy", () => {
3572
+ if (h.destroyed = !0, this.unwatch && this.unwatch(), d.reloadRule([]), this.name)
3573
+ if (this.inFor) {
3574
+ const $ = E[this.name].indexOf(this);
3575
+ E[this.name].splice($, 1), E[this.name].length || delete E[this.name];
3576
+ } else
3577
+ delete E[this.name];
3578
+ }), h.$on("hook:updated", () => {
3579
+ d.bindNextTick(() => this.bus.$emit("next-tick", d.api));
3580
+ });
3581
+ },
3582
+ isSub() {
3583
+ return this.vm.$pfc && this.vm.extendOption;
3584
+ },
3585
+ initOptions() {
3586
+ this.options = {};
3587
+ let h = y({ formData: {}, submitBtn: {}, resetBtn: {} }, M(o));
3588
+ this.isSub() && this.mergeOptions(this.options, this.vm.$pfc.$f.config || {}, !0), h = this.mergeOptions(h, this.vm.$options.propsData.option), this.updateOptions(h);
3589
+ },
3590
+ mergeOptions(h, d, $) {
3591
+ return d = M(d), $ && ["page", "onSubmit", "mounted", "reload", "formData", "el"].forEach((C) => {
3592
+ delete d[C];
3593
+ }), d.global && (h.global = er(h.global, d.global), delete d.global), this.$handle.$manager.mergeOptions([d], h), h;
3594
+ },
3595
+ updateOptions(h) {
3596
+ this.mergeOptions(this.options, h), this.$handle.$manager.updateOptions(this.options);
3597
+ },
3598
+ created() {
3599
+ this.$handle.init(), this.vm.$emit("created", this.api());
3600
+ },
3601
+ api() {
3602
+ return this.$handle.api;
3603
+ },
3604
+ render() {
3605
+ return this.$handle.render();
3606
+ },
3607
+ mounted() {
3608
+ this.$handle.mounted();
3609
+ }
3610
+ });
3611
+ function we(h) {
3612
+ m(h, {
3613
+ version: t.version,
3614
+ ui: t.ui,
3615
+ setData: Ce,
3616
+ getData: _e,
3617
+ removeData: dt,
3618
+ maker: n,
3619
+ component: v,
3620
+ directive: f,
3621
+ register: g,
3622
+ $vnode: ke,
3623
+ parser: _,
3624
+ use: pt,
3625
+ factory: mt,
3626
+ componentAlias: b,
3627
+ copyRule: $e,
3628
+ copyRules: et,
3629
+ fetch: st,
3630
+ $form: re,
3631
+ parseFn: U,
3632
+ parseJson: Yt,
3633
+ toJson: Ze,
3634
+ getApi: l,
3635
+ init(d, $ = {}) {
3636
+ let C = Ue(d, $), V = C.$refs.fc.formCreate;
3637
+ return {
3638
+ mount(J) {
3639
+ return J && c.Element(J) && (V.options.el = J), qe(V.options).appendChild(C.$el), V.api();
3640
+ },
3641
+ remove() {
3642
+ C.$el.parentNode && C.$el.parentNode.removeChild(C.$el);
3643
+ },
3644
+ destroy() {
3645
+ this.remove(), C.$destroy();
3646
+ },
3647
+ $f: V.api()
3648
+ };
3649
+ }
3650
+ });
3651
+ }
3652
+ function yt(h) {
3653
+ m(h, {
3654
+ create: T,
3655
+ install(d, $) {
3656
+ if (o = y(y({}, o), $ || {}), d._installedFormCreate === !0) return;
3657
+ d._installedFormCreate = !0, L = d;
3658
+ const C = function(V, J = {}) {
3659
+ return T(V, J, this);
3660
+ };
3661
+ we(C), d.prototype.$formCreate = C, d.component("FormCreate", re()), d.component("FcFragment", ke());
3662
+ }
3663
+ });
3664
+ }
3665
+ if (we(T), yt(T), u.use({ fragment: "fcFragment" }), _(Pr), t.install && T.use(t), t.inherit) {
3666
+ const h = t.inherit;
3667
+ h.components && m(e, h.components), h.parsers && m(r, h.parsers), h.directives && m(i, h.directives), h.providers && m(s, h.providers), h.maker && m(n, h.maker), h.loadData && m(a, h.loadData);
3668
+ }
3669
+ return T;
3670
+ }
3671
+ const He = {
3672
+ date: "yyyy-MM-dd",
3673
+ month: "yyyy-MM",
3674
+ datetime: "yyyy-MM-dd HH:mm:ss",
3675
+ timerange: "HH:mm:ss",
3676
+ daterange: "yyyy-MM-dd",
3677
+ monthrange: "yyyy-MM",
3678
+ datetimerange: "yyyy-MM-dd HH:mm:ss",
3679
+ year: "yyyy"
3680
+ }, xe = "datePicker", Lr = {
3681
+ name: xe,
3682
+ maker: function() {
3683
+ return ["year", "month", "date", "dates", "week", "datetime", "datetimeRange", "dateRange", "monthRange"].reduce((t, e) => (t[e] = R(xe, { type: e.toLowerCase() }), t), {});
3684
+ }(),
3685
+ mergeProp(t) {
3686
+ const e = t.prop.props;
3687
+ e.valueFormat || (e.valueFormat = He[e.type] || He.date);
3688
+ }
3689
+ }, se = "hidden", Nr = {
3690
+ name: se,
3691
+ maker: {
3692
+ [se]: (t, e) => R(se)("", t, e)
3693
+ },
3694
+ render() {
3695
+ return [];
3696
+ }
3697
+ }, oe = "input", Mr = {
3698
+ name: oe,
3699
+ maker: function() {
3700
+ const t = ["password", "url", "email", "text", "textarea"].reduce((e, r) => (e[r] = R(oe, { type: r }), e), {});
3701
+ return t.idate = R(oe, { type: "date" }), t;
3702
+ }(),
3703
+ mergeProp(t) {
3704
+ let { props: e } = t.prop;
3705
+ e && e.autosize && e.autosize.minRows && (e.rows = e.autosize.minRows || 2);
3706
+ }
3707
+ }, Je = "slider", qr = {
3708
+ name: Je,
3709
+ maker: {
3710
+ sliderRange: R(Je, { range: !0 })
3711
+ },
3712
+ toFormValue(t, e) {
3713
+ let r = Array.isArray(t), i = e.prop.props, s = i.min || 0, n;
3714
+ return i.range === !0 ? n = r ? t : [s, parseFloat(t) || s] : n = r ? parseFloat(t[0]) || s : parseFloat(t), n;
3715
+ }
3716
+ }, ae = "timePicker", Ur = {
3717
+ name: ae,
3718
+ maker: {
3719
+ time: R(ae, (t) => t.props.isRange = !1),
3720
+ timeRange: R(ae, (t) => t.props.isRange = !0)
3721
+ },
3722
+ mergeProp(t) {
3723
+ const e = t.prop.props;
3724
+ e.valueFormat || (e.valueFormat = "HH:mm:ss");
3725
+ }
3726
+ }, Hr = {
3727
+ name: "FcRow",
3728
+ render(t, e) {
3729
+ return e.vNode.col({ props: { span: 24 } }, [
3730
+ e.vNode.row(e.prop, t)
3731
+ ]);
3732
+ }
3733
+ }, xr = "select", Jr = {
3734
+ name: xr,
3735
+ toFormValue(t, e) {
3736
+ return e.prop.props.multiple && !Array.isArray(t) ? I(t) : t;
3737
+ }
3738
+ }, Kr = [
3739
+ Lr,
3740
+ Nr,
3741
+ Mr,
3742
+ qr,
3743
+ Ur,
3744
+ Hr,
3745
+ Jr
3746
+ ], O = "el", Wr = {
3747
+ button: O + "Button",
3748
+ icon: "i",
3749
+ slider: O + "Slider",
3750
+ rate: O + "Rate",
3751
+ upload: "fcUpload",
3752
+ cascader: O + "Cascader",
3753
+ popover: O + "Popover",
3754
+ tooltip: O + "Tooltip",
3755
+ colorPicker: O + "ColorPicker",
3756
+ timePicker: O + "TimePicker",
3757
+ timeSelect: O + "TimeSelect",
3758
+ datePicker: O + "DatePicker",
3759
+ switch: O + "Switch",
3760
+ select: "fcSelect",
3761
+ checkbox: "fcCheckbox",
3762
+ radio: "fcRadio",
3763
+ inputNumber: O + "InputNumber",
3764
+ number: O + "InputNumber",
3765
+ input: O + "Input",
3766
+ formItem: O + "FormItem",
3767
+ form: O + "Form",
3768
+ frame: "fcFrame",
3769
+ col: O + "Col",
3770
+ row: O + "Row",
3771
+ tree: "fcTree",
3772
+ autoComplete: O + "Autocomplete",
3773
+ auto: O + "Autocomplete",
3774
+ group: "fcGroup",
3775
+ object: "fcSubForm",
3776
+ subForm: "fcSubForm"
3777
+ };
3778
+ function Gr() {
3779
+ return {
3780
+ form: {
3781
+ inline: !1,
3782
+ labelPosition: "right",
3783
+ labelWidth: "125px",
3784
+ disabled: !1,
3785
+ size: void 0
3786
+ },
3787
+ row: {
3788
+ show: !0,
3789
+ gutter: 0
3790
+ },
3791
+ submitBtn: {
3792
+ type: "primary",
3793
+ loading: !1,
3794
+ disabled: !1,
3795
+ innerText: "提交",
3796
+ show: !0,
3797
+ col: void 0,
3798
+ click: void 0
3799
+ },
3800
+ resetBtn: {
3801
+ type: "default",
3802
+ loading: !1,
3803
+ disabled: !1,
3804
+ icon: "el-icon-refresh",
3805
+ innerText: "重置",
3806
+ show: !1,
3807
+ col: void 0,
3808
+ click: void 0
3809
+ }
3810
+ };
3811
+ }
3812
+ function Xr(t) {
3813
+ return t.type === "tooltip";
3814
+ }
3815
+ const zr = /[A-Z]/;
3816
+ function Qr(t, e) {
3817
+ return !zr.test(t) && (c.String(e) || c.Number(e));
3818
+ }
3819
+ function Ke(t, e) {
3820
+ w(t, e) && c.String(t[e]) && (t[e] = { [e]: t[e], show: !0 });
3821
+ }
3822
+ function D(t) {
3823
+ return t === !1;
3824
+ }
3825
+ function Zr(t, e) {
3826
+ w(t, e) && !c.Object(t[e]) && (t[e] = { show: !!t[e] });
3827
+ }
3828
+ const Yr = {
3829
+ validate() {
3830
+ const t = this.form();
3831
+ return t ? t.validate() : new Promise((e) => e());
3832
+ },
3833
+ validateField(t) {
3834
+ const e = this.form();
3835
+ return e ? new Promise((r, i) => {
3836
+ e.validateField(t, (s) => {
3837
+ s ? i(s) : r(null);
3838
+ });
3839
+ }) : new Promise((r) => r());
3840
+ },
3841
+ clearValidateState(t) {
3842
+ const e = this.vm.$refs[t.wrapRef];
3843
+ e && (e.validateMessage = "", e.validateState = "");
3844
+ },
3845
+ tidyOptions(t) {
3846
+ return ["submitBtn", "resetBtn", "row", "info", "wrap", "col", "title"].forEach((e) => {
3847
+ Zr(t, e);
3848
+ }), t;
3849
+ },
3850
+ tidyRule({ prop: t }) {
3851
+ return Ke(t, "title"), Ke(t, "info"), t;
3852
+ },
3853
+ mergeProp(t) {
3854
+ let e = t.prop.props;
3855
+ t.prop = B([{
3856
+ attrs: Object.keys(e).reduce((r, i) => (Qr(i, e[i]) && (r[i] = e[i]), r), {}),
3857
+ info: this.options.info || {},
3858
+ wrap: this.options.wrap || {},
3859
+ col: this.options.col || {},
3860
+ title: this.options.title || {}
3861
+ }, t.prop], {
3862
+ info: {
3863
+ trigger: "hover",
3864
+ placement: "top-start",
3865
+ icon: "el-icon-warning"
3866
+ },
3867
+ title: {},
3868
+ col: { span: 24 },
3869
+ wrap: {}
3870
+ }, { normal: ["title", "info", "col", "wrap"] });
3871
+ },
3872
+ getDefaultOptions() {
3873
+ return Gr();
3874
+ },
3875
+ update() {
3876
+ const t = this.options.form;
3877
+ this.rule = {
3878
+ props: y({}, t),
3879
+ nativeOn: {
3880
+ submit: (e) => {
3881
+ e.preventDefault();
3882
+ }
3883
+ },
3884
+ class: [t.className, t.class, "form-create"],
3885
+ style: t.style,
3886
+ type: "form"
3887
+ };
3888
+ },
3889
+ beforeRender() {
3890
+ const { key: t, ref: e, $handle: r } = this;
3891
+ m(this.rule, { key: t, ref: e }), m(this.rule.props, {
3892
+ model: r.formData
3893
+ // rules: $handle.validate(),
3894
+ });
3895
+ },
3896
+ render(t) {
3897
+ return t.length && t.push(this.makeFormBtn()), this.$r(this.rule, D(this.options.row.show) ? t : [this.makeRow(t)]);
3898
+ },
3899
+ makeWrap(t, e) {
3900
+ const r = t.prop, i = `${this.key}${t.key}`, s = r.col, n = this.isTitle(r), o = !s.labelWidth && !n ? 0 : s.labelWidth, { inline: a, col: u } = this.rule.props, l = D(r.wrap.show) ? e : this.$r(B([r.wrap, {
3901
+ props: q(y({
3902
+ labelWidth: o === void 0 ? o : at(o),
3903
+ label: n ? r.title.title : void 0
3904
+ }, r.wrap || {}), {
3905
+ prop: t.id,
3906
+ rules: t.injectValidate()
3907
+ }),
3908
+ class: r.className,
3909
+ key: `${i}fi`,
3910
+ ref: t.wrapRef,
3911
+ type: "formItem"
3912
+ }]), [e, n ? this.makeInfo(r, i, t) : null]);
3913
+ return a === !0 || D(u) || D(s.show) ? l : this.makeCol(r, i, [l]);
3914
+ },
3915
+ isTitle(t) {
3916
+ if (this.options.form.title === !1) return !1;
3917
+ const e = t.title;
3918
+ return !(!e.title && !e.native || D(e.show));
3919
+ },
3920
+ makeInfo(t, e, r) {
3921
+ const i = t.title, s = t.info, n = Xr(s), o = this.options.form, a = this.getSlot("title"), u = [a ? a({ title: i.title || "", rule: r.rule, options: this.options }) : (i.title || "") + (o.labelSuffix || o["label-suffix"] || "")];
3922
+ if (!D(s.show) && (s.info || s.native) && !D(s.icon)) {
3923
+ const l = {
3924
+ type: s.type || "popover",
3925
+ props: y({}, s),
3926
+ key: `${e}pop`,
3927
+ slot: "label"
3928
+ }, f = "content";
3929
+ s.info && !w(l.props, f) && (l.props[f] = s.info), u[s.align !== "left" ? "unshift" : "push"](this.$r(B([s, l]), [
3930
+ this.$r({
3931
+ type: "i",
3932
+ slot: n ? "default" : "reference",
3933
+ class: s.icon === !0 ? "el-icon-warning" : s.icon,
3934
+ key: `${e}i`
3935
+ })
3936
+ ]));
3937
+ }
3938
+ return this.$r(B([i, {
3939
+ props: i,
3940
+ slot: i.slot || "label",
3941
+ key: `${e}tit`,
3942
+ type: i.type || "span"
3943
+ }]), u);
3944
+ },
3945
+ makeCol(t, e, r) {
3946
+ const i = t.col;
3947
+ return this.$r({
3948
+ class: i.class,
3949
+ type: "col",
3950
+ props: i || { span: 24 },
3951
+ key: `${e}col`
3952
+ }, r);
3953
+ },
3954
+ makeRow(t) {
3955
+ const e = this.options.row || {};
3956
+ return this.$r({
3957
+ type: "row",
3958
+ props: e,
3959
+ class: e.class,
3960
+ key: `${this.key}row`
3961
+ }, t);
3962
+ },
3963
+ makeFormBtn() {
3964
+ let t = [];
3965
+ if (D(this.options.submitBtn.show) || t.push(this.makeSubmitBtn()), D(this.options.resetBtn.show) || t.push(this.makeResetBtn()), !t.length)
3966
+ return;
3967
+ const e = this.$r({
3968
+ type: "formItem",
3969
+ key: `${this.key}fb`
3970
+ }, t);
3971
+ return this.rule.props.inline === !0 ? e : this.$r({
3972
+ type: "col",
3973
+ props: { span: 24 },
3974
+ key: `${this.key}fc`
3975
+ }, [e]);
3976
+ },
3977
+ makeResetBtn() {
3978
+ const t = this.options.resetBtn;
3979
+ return this.$r({
3980
+ type: "button",
3981
+ props: t,
3982
+ style: { width: t.width },
3983
+ on: {
3984
+ click: () => {
3985
+ const e = this.$handle.api;
3986
+ t.click ? t.click(e) : e.resetFields();
3987
+ }
3988
+ },
3989
+ key: `${this.key}b2`
3990
+ }, [t.innerText]);
3991
+ },
3992
+ makeSubmitBtn() {
3993
+ const t = this.options.submitBtn;
3994
+ return this.$r({
3995
+ type: "button",
3996
+ props: t,
3997
+ style: { width: t.width },
3998
+ on: {
3999
+ click: () => {
4000
+ const e = this.$handle.api;
4001
+ t.click ? t.click(e) : e.submit();
4002
+ }
4003
+ },
4004
+ key: `${this.key}b1`
4005
+ }, [t.innerText]);
4006
+ }
4007
+ }, x = {};
4008
+ ei(x);
4009
+ ti(x);
4010
+ ri(x);
4011
+ ii(x);
4012
+ ni(x);
4013
+ function ei(t) {
4014
+ ["group", "tree", "switch", "upload", "autoComplete", "checkbox", "cascader", "colorPicker", "datePicker", "frame", "inputNumber", "radio", "rate"].forEach((e) => {
4015
+ t[e] = R(e);
4016
+ }), t.auto = t.autoComplete, t.number = t.inputNumber, t.color = t.colorPicker;
4017
+ }
4018
+ function ti(t) {
4019
+ const e = "select", r = "multiple";
4020
+ t.selectMultiple = R(e, { [r]: !0 }), t.selectOne = R(e, { [r]: !1 });
4021
+ }
4022
+ function ri(t) {
4023
+ const e = "tree", r = { treeSelected: "selected", treeChecked: "checked" };
4024
+ Object.keys(r).reduce((i, s) => (i[s] = R(e, { type: r[s] }), i), t);
4025
+ }
4026
+ function ii(t) {
4027
+ const e = "upload", r = {
4028
+ image: ["image", 0],
4029
+ file: ["file", 0],
4030
+ uploadFileOne: ["file", 1],
4031
+ uploadImageOne: ["image", 1]
4032
+ };
4033
+ Object.keys(r).reduce((i, s) => (i[s] = R(e, (n) => n.props({ uploadType: r[s][0], maxLength: r[s][1] })), i), t), t.uploadImage = t.image, t.uploadFile = t.file;
4034
+ }
4035
+ function ni(t) {
4036
+ const e = {
4037
+ frameInputs: ["input", 0],
4038
+ frameFiles: ["file", 0],
4039
+ frameImages: ["image", 0],
4040
+ frameInputOne: ["input", 1],
4041
+ frameFileOne: ["file", 1],
4042
+ frameImageOne: ["image", 1]
4043
+ };
4044
+ return Object.keys(e).reduce((r, i) => (r[i] = R("frame", (s) => s.props({ type: e[i][0], maxLength: e[i][1] })), r), t), t.frameInput = t.frameInputs, t.frameFile = t.frameFiles, t.frameImage = t.frameImages, t;
4045
+ }
4046
+ function We(t, e) {
4047
+ return c.Boolean(t) ? t = { show: t } : !c.Undef(t) && !c.Object(t) && (t = { show: e }), t;
4048
+ }
4049
+ function si(t, e) {
4050
+ return m(t, {
4051
+ formEl() {
4052
+ return e.$manager.form();
4053
+ },
4054
+ wrapEl(r) {
4055
+ const i = e.getFieldCtx(r);
4056
+ if (i)
4057
+ return e.vm.$refs[i.wrapRef];
4058
+ },
4059
+ validate(r) {
4060
+ return new Promise((i, s) => {
4061
+ const n = t.children, o = [e.$manager.validate()];
4062
+ n.forEach((a) => {
4063
+ o.push(a.validate());
4064
+ }), Promise.all(o).then(() => {
4065
+ i(!0), r && r(!0);
4066
+ }).catch((a) => {
4067
+ s(a), r && r(!1, a), e.vm.$emit("validate-fail", a, { api: t });
4068
+ });
4069
+ });
4070
+ },
4071
+ validateField: (r, i) => new Promise((s, n) => {
4072
+ const o = e.getFieldCtx(r);
4073
+ if (!o) return;
4074
+ const a = e.subForm[o.id], u = [e.$manager.validateField(o.id)];
4075
+ I(a).forEach((l) => {
4076
+ u.push(l.validate().catch(() => Promise.reject("子表单验证未通过")));
4077
+ }), Promise.all(u).then(() => {
4078
+ s(null), i && i(null);
4079
+ }).catch((l) => {
4080
+ n(l), i && i(l), e.vm.$emit("validate-field-fail", l, { field: r, api: t });
4081
+ });
4082
+ }),
4083
+ clearValidateState(r, i = !0) {
4084
+ t.helper.tidyFields(r).forEach((s) => {
4085
+ i && this.clearSubValidateState(s), e.getCtxs(s).forEach((n) => {
4086
+ e.$manager.clearValidateState(n);
4087
+ });
4088
+ });
4089
+ },
4090
+ clearSubValidateState(r) {
4091
+ t.helper.tidyFields(r).forEach((i) => {
4092
+ e.getCtxs(i).forEach((s) => {
4093
+ const n = e.subForm[s.id];
4094
+ n && (Array.isArray(n) ? n.forEach((o) => {
4095
+ o.clearValidateState();
4096
+ }) : n && n.clearValidateState());
4097
+ });
4098
+ });
4099
+ },
4100
+ btn: {
4101
+ loading: (r = !0) => {
4102
+ t.submitBtnProps({ loading: !!r });
4103
+ },
4104
+ disabled: (r = !0) => {
4105
+ t.submitBtnProps({ disabled: !!r });
4106
+ },
4107
+ show: (r = !0) => {
4108
+ t.submitBtnProps({ show: !!r });
4109
+ }
4110
+ },
4111
+ resetBtn: {
4112
+ loading: (r = !0) => {
4113
+ t.resetBtnProps({ loading: !!r });
4114
+ },
4115
+ disabled: (r = !0) => {
4116
+ t.resetBtnProps({ disabled: !!r });
4117
+ },
4118
+ show: (r = !0) => {
4119
+ t.resetBtnProps({ show: !!r });
4120
+ }
4121
+ },
4122
+ submitBtnProps: (r = {}) => {
4123
+ let i = We(e.options.submitBtn, !0);
4124
+ m(i, r), e.options.submitBtn = i, t.refreshOptions();
4125
+ },
4126
+ resetBtnProps: (r = {}) => {
4127
+ let i = We(e.options.resetBtn, !1);
4128
+ m(i, r), e.options.resetBtn = i, t.refreshOptions();
4129
+ },
4130
+ submit(r, i) {
4131
+ t.validate((s) => {
4132
+ if (s) {
4133
+ let n = t.formData();
4134
+ c.Function(r) ? j(() => r(n, this)) : (c.Function(e.options.onSubmit) && j(() => e.options.onSubmit(n, this)), e.vm.$emit("submit", n, this));
4135
+ } else
4136
+ c.Function(i) && j(() => i(this, ...arguments));
4137
+ });
4138
+ }
4139
+ }), t;
4140
+ }
4141
+ function oi(t) {
4142
+ t.componentAlias(Wr), Wt.forEach((e) => {
4143
+ t.component(e.name, e);
4144
+ }), Kr.forEach((e) => {
4145
+ t.parser(e);
4146
+ }), Object.keys(x).forEach((e) => {
4147
+ t.maker[e] = x[e];
4148
+ });
4149
+ }
4150
+ function ai() {
4151
+ return ct({
4152
+ ui: "element-ui",
4153
+ version: "2.6.0",
4154
+ manager: Yr,
4155
+ extendApi: si,
4156
+ install: oi,
4157
+ attrs: {
4158
+ normal: ["col", "wrap"],
4159
+ array: ["className"],
4160
+ key: ["title", "info"]
4161
+ }
4162
+ });
4163
+ }
4164
+ const de = ai();
4165
+ typeof window != "undefined" && (window.formCreate = de, window.Vue && de.install(window.Vue));
4166
+ const fi = de.maker;
4167
+ export {
4168
+ de as default,
4169
+ fi as maker
4170
+ };