@form-create/element-ui 2.5.37 → 2.6.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,4185 @@
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 $t = Object.defineProperty, vt = Object.defineProperties;
11
+ var bt = Object.getOwnPropertyDescriptors;
12
+ var Se = Object.getOwnPropertySymbols;
13
+ var Ct = Object.prototype.hasOwnProperty, _t = Object.prototype.propertyIsEnumerable;
14
+ var Re = (t, e, r) => e in t ? $t(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, y = (t, e) => {
15
+ for (var r in e || (e = {}))
16
+ Ct.call(e, r) && Re(t, r, e[r]);
17
+ if (Se)
18
+ for (var r of Se(e))
19
+ _t.call(e, r) && Re(t, r, e[r]);
20
+ return t;
21
+ }, q = (t, e) => vt(t, bt(e));
22
+ import D, { h as p } from "vue";
23
+ function kt(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 Ot = ["attrs", "props", "domProps"], wt = ["class", "style", "directives"], Ft = ["on", "nativeOn"], St = 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 (Ot.indexOf(i) !== -1) e[i] = le({}, e[i], r[i]);
36
+ else if (wt.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 (Ft.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] ? Rt(e[i][l], r[i][l]) : r[i][l];
45
+ else e[i] = r[i];
46
+ return e;
47
+ }, {});
48
+ }, Rt = function(t, e) {
49
+ return function() {
50
+ t && t.apply(this, arguments), e && e.apply(this, arguments);
51
+ };
52
+ }, Et = St;
53
+ const S = /* @__PURE__ */ kt(Et);
54
+ function te(t, e) {
55
+ return Object.keys(t).reduce((r, i) => ((!e || e.indexOf(i) === -1) && r.push(t[i]), r), []);
56
+ }
57
+ const jt = "fcCheckbox", It = {
58
+ name: jt,
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
+ }), te(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 At = "fcFrame", Vt = {
129
+ name: At,
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
+ }, Pt = "fcRadio", Tt = {
491
+ name: Pt,
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
+ }), te(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 Dt = "fcSelect", Bt = {
588
+ name: Dt,
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
+ }, Lt = "fcTree", Nt = {
620
+ name: Lt,
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
+ }]), [te(this.$slots)]);
670
+ },
671
+ mounted() {
672
+ this.setValue(), this.$emit("fc.el", this.$refs.tree);
673
+ }
674
+ };
675
+ function Ee(t, e) {
676
+ return {
677
+ url: t,
678
+ name: Mt(t),
679
+ uid: e
680
+ };
681
+ }
682
+ function Mt(t) {
683
+ return ("" + t).split("/").pop();
684
+ }
685
+ const qt = "fcUpload", Ut = {
686
+ name: qt,
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(Ee);
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(Ee), 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, te(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
+ D.set(t, e, r);
865
+ }
866
+ function L(t, e) {
867
+ D.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 N(t) {
894
+ return G({}, { value: t }).value;
895
+ }
896
+ const Ht = 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 Ht.apply(this, arguments);
904
+ }
905
+ const xt = "fcGroup", Jt = {
906
+ name: xt,
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 = N(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 = N(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": (h) => this.formData(n, h),
1178
+ "emit-event": (h, ...g) => this.emitEvent(h, g, o, n),
1179
+ input: (h) => this.add$f(o, n, h)
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
+ }, Kt = "fcSubForm", Wt = {
1204
+ name: Kt,
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
+ }, Gt = [
1288
+ It,
1289
+ Vt,
1290
+ Tt,
1291
+ Bt,
1292
+ Nt,
1293
+ Ut,
1294
+ Jt,
1295
+ Wt
1296
+ ], je = "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 Xt(t, e, r) {
1305
+ return {
1306
+ name: je,
1307
+ componentName: je,
1308
+ model: {
1309
+ prop: "api"
1310
+ },
1311
+ components: e,
1312
+ directives: r,
1313
+ provide() {
1314
+ return {
1315
+ $pfc: this
1316
+ };
1317
+ },
1318
+ inject: { $pfc: { default: null } },
1319
+ props: {
1320
+ rule: {
1321
+ type: Array,
1322
+ required: !0
1323
+ },
1324
+ option: {
1325
+ type: Object,
1326
+ default: () => ({})
1327
+ },
1328
+ extendOption: Boolean,
1329
+ disabled: {
1330
+ type: Boolean,
1331
+ default: void 0
1332
+ },
1333
+ value: Object,
1334
+ api: Object,
1335
+ name: String,
1336
+ subForm: {
1337
+ type: Boolean,
1338
+ default: !0
1339
+ },
1340
+ inFor: Boolean
1341
+ },
1342
+ data() {
1343
+ return {
1344
+ formData: void 0,
1345
+ destroyed: !1,
1346
+ validate: {},
1347
+ $f: void 0,
1348
+ isShow: !0,
1349
+ unique: 1,
1350
+ renderRule: [...this.rule || []],
1351
+ ctxInject: {},
1352
+ updateValue: JSON.stringify(this.value || {}),
1353
+ isMore: !!this.inFor
1354
+ };
1355
+ },
1356
+ render() {
1357
+ return this.formCreate.render();
1358
+ },
1359
+ methods: {
1360
+ _refresh() {
1361
+ ++this.unique;
1362
+ },
1363
+ _renderRule() {
1364
+ this.renderRule = [...this.rule || []];
1365
+ },
1366
+ _updateValue(i) {
1367
+ this.destroyed || (this.updateValue = JSON.stringify(i), this.$emit("update:value", i));
1368
+ }
1369
+ },
1370
+ watch: {
1371
+ value: {
1372
+ handler(i) {
1373
+ JSON.stringify(i || {}) !== this.updateValue && (this.$f.config.forceCoverValue ? this.$f.coverValue(i || {}) : this.$f.setValue(i || {}));
1374
+ },
1375
+ deep: !0
1376
+ },
1377
+ option: {
1378
+ handler() {
1379
+ this.formCreate.initOptions(), this.$f.refresh();
1380
+ },
1381
+ deep: !0
1382
+ },
1383
+ rule(i) {
1384
+ i.length === this.renderRule.length && i.every((s) => this.renderRule.indexOf(s) > -1) || (this.formCreate.$handle.reloadRule(i), this._renderRule());
1385
+ },
1386
+ disabled() {
1387
+ this.$f.refresh();
1388
+ }
1389
+ },
1390
+ beforeCreate() {
1391
+ this.formCreate = new t(this), Object.keys(this.formCreate.prop).forEach((i) => {
1392
+ m(this.$options[i], this.formCreate.prop[i]);
1393
+ }), this.$emit("beforeCreate", this.formCreate.api());
1394
+ },
1395
+ created() {
1396
+ const i = this, s = this.formCreate.api(), n = () => {
1397
+ if (i.$pfc) {
1398
+ const a = ue(i, i.$pfc);
1399
+ if (a) {
1400
+ let u;
1401
+ i.isMore ? (u = I(a.getSubForm()), u.push(s)) : u = s, a.subForm(u);
1402
+ }
1403
+ }
1404
+ }, o = () => {
1405
+ const a = ue(i, i.$pfc);
1406
+ if (a)
1407
+ if (i.isMore) {
1408
+ const u = I(a.getSubForm()), l = u.indexOf(s);
1409
+ l > -1 && u.splice(l, 1);
1410
+ } else
1411
+ a.subForm();
1412
+ };
1413
+ i.$on("hook:beforeDestroy", () => {
1414
+ o();
1415
+ }), this.$watch(() => this.subForm, (a) => {
1416
+ a ? n() : o();
1417
+ }, { immediate: !0 });
1418
+ }
1419
+ };
1420
+ }
1421
+ const Xe = ["attrs", "props", "domProps", "scopedSlots"], ze = ["class", "style", "directives"], Qe = ["on", "nativeOn"], B = (t, e = {}, r = {}) => {
1422
+ const i = [...Xe, ...r.normal || []], s = [...ze, ...r.array || []], n = [...Qe, ...r.functional || []], o = r.props || [];
1423
+ return t.reduce((a, u) => {
1424
+ for (const l in u)
1425
+ if (a[l])
1426
+ if (o.indexOf(l) > -1)
1427
+ a[l] = B([u[l]], a[l]);
1428
+ else if (i.indexOf(l) > -1)
1429
+ a[l] = y(y({}, a[l]), u[l]);
1430
+ else if (s.indexOf(l) > -1) {
1431
+ const h = a[l] instanceof Array ? a[l] : [a[l]], g = u[l] instanceof Array ? u[l] : [u[l]];
1432
+ a[l] = [...h, ...g];
1433
+ } else if (n.indexOf(l) > -1)
1434
+ for (const h in u[l])
1435
+ if (a[l][h]) {
1436
+ const g = a[l][h] instanceof Array ? a[l][h] : [a[l][h]], b = u[l][h] instanceof Array ? u[l][h] : [u[l][h]];
1437
+ a[l][h] = [...g, ...b];
1438
+ } else
1439
+ a[l][h] = u[l][h];
1440
+ else if (l === "hook")
1441
+ for (let h in u[l])
1442
+ a[l][h] ? a[l][h] = zt(a[l][h], u[l][h]) : a[l][h] = u[l][h];
1443
+ else
1444
+ a[l] = u[l];
1445
+ else
1446
+ 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];
1447
+ return a;
1448
+ }, e);
1449
+ }, zt = (t, e) => function() {
1450
+ t && t.apply(this, arguments), e && e.apply(this, arguments);
1451
+ }, Ze = ["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"];
1452
+ function Qt() {
1453
+ return [...Ze, ...Xe, ...ze, ...Qe, ...pe, ...me];
1454
+ }
1455
+ function ye(t, e, r) {
1456
+ return `[form-create ${t}]: ${e}`;
1457
+ }
1458
+ function Zt(t, e) {
1459
+ console.warn(ye("tip", t));
1460
+ }
1461
+ function ge(t, e) {
1462
+ console.error(ye("err", t));
1463
+ }
1464
+ function Yt(t) {
1465
+ ge(t.toString()), console.error(t);
1466
+ }
1467
+ const fe = "[[FORM-CREATE-PREFIX-", he = "-FORM-CREATE-SUFFIX]]", Ie = "$FN:", Ae = "$FNX:", K = "function";
1468
+ function Ye(t, e) {
1469
+ return JSON.stringify(G(Array.isArray(t) ? [] : {}, t, !0), function(r, i) {
1470
+ if (!(i && i._isVue === !0)) {
1471
+ if (typeof i !== K)
1472
+ return i;
1473
+ if (i.__json)
1474
+ return i.__json;
1475
+ if (i.__origin && (i = i.__origin), !i.__emit)
1476
+ return fe + i + he;
1477
+ }
1478
+ }, e);
1479
+ }
1480
+ function Ve(t) {
1481
+ return new Function("return " + t)();
1482
+ }
1483
+ function U(t, e) {
1484
+ if (t && c.String(t) && t.length > 4) {
1485
+ let r = t.trim(), i = !1;
1486
+ try {
1487
+ if (r.indexOf(he) > 0 && r.indexOf(fe) === 0)
1488
+ r = r.replace(he, "").replace(fe, ""), i = !0;
1489
+ else if (r.indexOf(Ie) === 0)
1490
+ r = r.replace(Ie, ""), i = !0;
1491
+ else {
1492
+ if (r.indexOf(Ae) === 0)
1493
+ return r = Ve("function($inject){" + r.replace(Ae, "") + "}"), r.__json = t, r.__inject = !0, r;
1494
+ !e && r.indexOf(K) === 0 && r !== K && (i = !0);
1495
+ }
1496
+ if (!i) return t;
1497
+ const s = Ve(r.indexOf(K) === -1 && r.indexOf("(") !== 0 ? K + " " + r : r);
1498
+ return s.__json = t, s;
1499
+ } catch (s) {
1500
+ ge(`解析失败:${r}
1501
+
1502
+ err: ${s}`);
1503
+ return;
1504
+ }
1505
+ }
1506
+ return t;
1507
+ }
1508
+ function er(t, e) {
1509
+ return JSON.parse(t, function(r, i) {
1510
+ return c.Undef(i) || !i.indexOf ? i : U(i, e);
1511
+ });
1512
+ }
1513
+ function et(t, e) {
1514
+ return {
1515
+ value: t,
1516
+ enumerable: !1,
1517
+ configurable: !1,
1518
+ writable: !!e
1519
+ };
1520
+ }
1521
+ function $e(t) {
1522
+ return tt([t])[0];
1523
+ }
1524
+ function tt(t, e) {
1525
+ return G([], [...t], e || !1);
1526
+ }
1527
+ function H(t, e) {
1528
+ return B(Array.isArray(e) ? e : [e], t, { array: pe, normal: me }), t;
1529
+ }
1530
+ function Pe(t) {
1531
+ const e = c.Function(t.getRule) ? t.getRule() : t;
1532
+ return e.type || (e.type = "input"), e;
1533
+ }
1534
+ function tr(t, e) {
1535
+ return t ? (Object.keys(e || {}).forEach((r) => {
1536
+ e[r] && (t[r] = H(t[r] || {}, e[r]));
1537
+ }), t) : e;
1538
+ }
1539
+ function rt(t, e) {
1540
+ Object.defineProperties(t, Object.keys(e).reduce((r, i) => (r[i] = {
1541
+ get() {
1542
+ return e[i]();
1543
+ }
1544
+ }, r), {}));
1545
+ }
1546
+ function Z(t) {
1547
+ return t.__fc__ || (t.__origin__ ? t.__origin__.__fc__ : null);
1548
+ }
1549
+ function j(t, e) {
1550
+ try {
1551
+ e = t();
1552
+ } catch (r) {
1553
+ Yt(r);
1554
+ }
1555
+ return e;
1556
+ }
1557
+ const Te = (t, e) => typeof t == "string" ? String(e) : typeof t == "number" ? Number(e) : e, W = {
1558
+ "==": (t, e) => JSON.stringify(t) === JSON.stringify(Te(t, e)),
1559
+ "!=": (t, e) => !W["=="](t, e),
1560
+ ">": (t, e) => t > e,
1561
+ ">=": (t, e) => t >= e,
1562
+ "<": (t, e) => t < e,
1563
+ "<=": (t, e) => t <= e,
1564
+ on(t, e) {
1565
+ return t && t.indexOf && t.indexOf(Te(t[0], e)) > -1;
1566
+ },
1567
+ notOn(t, e) {
1568
+ return !W.on(t, e);
1569
+ },
1570
+ in(t, e) {
1571
+ return e && e.indexOf && e.indexOf(t) > -1;
1572
+ },
1573
+ notIn(t, e) {
1574
+ return !W.in(t, e);
1575
+ },
1576
+ between(t, e) {
1577
+ return t > e[0] && t < e[1];
1578
+ },
1579
+ notBetween(t, e) {
1580
+ return t < e[0] || t > e[1];
1581
+ },
1582
+ empty(t) {
1583
+ return c.empty(t);
1584
+ },
1585
+ notEmpty(t) {
1586
+ return !c.empty(t);
1587
+ },
1588
+ pattern(t, e) {
1589
+ return new RegExp(e, "g").test(t);
1590
+ }
1591
+ };
1592
+ function it() {
1593
+ return {
1594
+ props: {},
1595
+ on: {},
1596
+ options: [],
1597
+ children: [],
1598
+ effect: {},
1599
+ hidden: !1,
1600
+ display: !0,
1601
+ value: void 0
1602
+ };
1603
+ }
1604
+ function R(t, e) {
1605
+ return (r, i, s, n = {}) => {
1606
+ const o = new ve(t, r, i, s, n);
1607
+ return e && (c.Function(e) ? e(o) : o.props(e)), o;
1608
+ };
1609
+ }
1610
+ function ve(t, e, r, i, s) {
1611
+ this._data = m(it(), { type: t, title: e, field: r, value: i, props: s || {} }), this.event = this.on;
1612
+ }
1613
+ m(ve.prototype, {
1614
+ getRule() {
1615
+ return this._data;
1616
+ },
1617
+ setProp(t, e) {
1618
+ return F(this._data, t, e), this;
1619
+ },
1620
+ _clone() {
1621
+ const t = new this.constructor();
1622
+ return t._data = $e(this._data), t;
1623
+ }
1624
+ });
1625
+ function nt(t) {
1626
+ t.forEach((e) => {
1627
+ ve.prototype[e] = function(r) {
1628
+ return H(this._data, { [e]: arguments.length < 2 ? r : { [r]: arguments[1] } }), this;
1629
+ };
1630
+ });
1631
+ }
1632
+ nt(Qt());
1633
+ const st = R("");
1634
+ function rr(t, e, r) {
1635
+ let i = st("", e);
1636
+ return i._data.type = t, i._data.title = r, i;
1637
+ }
1638
+ function De(t, e, r, i) {
1639
+ let s = st("", r);
1640
+ return s._data.type = "template", s._data.template = t, s._data.title = i, s._data.vm = e, s;
1641
+ }
1642
+ function ir() {
1643
+ return {
1644
+ create: rr,
1645
+ createTmp: De,
1646
+ template: De,
1647
+ factory: R
1648
+ };
1649
+ }
1650
+ function nr(t, e, r) {
1651
+ const i = `fail to ${t} ${r.status}'`, s = new Error(i);
1652
+ return s.status = r.status, s.url = t, s;
1653
+ }
1654
+ function Be(t) {
1655
+ const e = t.responseText || t.response;
1656
+ if (!e)
1657
+ return e;
1658
+ try {
1659
+ return JSON.parse(e);
1660
+ } catch (r) {
1661
+ return e;
1662
+ }
1663
+ }
1664
+ function ot(t) {
1665
+ if (typeof XMLHttpRequest == "undefined")
1666
+ return;
1667
+ const e = new XMLHttpRequest(), r = t.action;
1668
+ e.onerror = function(o) {
1669
+ t.onError(o);
1670
+ }, e.onload = function() {
1671
+ if (e.status < 200 || e.status >= 300)
1672
+ return t.onError(nr(r, t, e), Be(e));
1673
+ t.onSuccess(Be(e));
1674
+ }, e.open(t.method || "get", r, !0);
1675
+ let i;
1676
+ t.data && ((t.dataType || "").toLowerCase() !== "json" ? (i = new FormData(), Object.keys(t.data).map((n) => {
1677
+ i.append(n, t.data[n]);
1678
+ })) : (i = JSON.stringify(t.data), e.setRequestHeader("content-type", "application/json"))), t.withCredentials && "withCredentials" in e && (e.withCredentials = !0);
1679
+ const s = t.headers || {};
1680
+ Object.keys(s).forEach((n) => {
1681
+ s[n] !== null && e.setRequestHeader(n, s[n]);
1682
+ }), e.send(i);
1683
+ }
1684
+ function sr(t) {
1685
+ return new Promise((e, r) => {
1686
+ ot(q(y({}, t), {
1687
+ onSuccess(i) {
1688
+ let s = (o) => o;
1689
+ const n = U(t.parse);
1690
+ c.Function(n) ? s = n : n && c.String(n) && (s = (o) => (n.split(".").forEach((a) => {
1691
+ o && (o = o[a]);
1692
+ }), o)), e(s(i));
1693
+ },
1694
+ onError(i) {
1695
+ r(i);
1696
+ }
1697
+ }));
1698
+ });
1699
+ }
1700
+ function Q(t) {
1701
+ return N(t);
1702
+ }
1703
+ function or(t) {
1704
+ function e(n) {
1705
+ return c.Undef(n) ? n = t.fields() : Array.isArray(n) || (n = [n]), n;
1706
+ }
1707
+ function r(n, o, a) {
1708
+ e(n).forEach((u) => {
1709
+ t.getCtxs(u).forEach((l) => {
1710
+ F(l.rule, o, a), t.$render.clearCache(l);
1711
+ });
1712
+ });
1713
+ }
1714
+ function i() {
1715
+ const n = t.subForm;
1716
+ return Object.keys(n).reduce((o, a) => {
1717
+ const u = n[a];
1718
+ return u && (Array.isArray(u) ? o.push(...u) : o.push(u)), o;
1719
+ }, []);
1720
+ }
1721
+ const s = {
1722
+ get config() {
1723
+ return t.options;
1724
+ },
1725
+ get options() {
1726
+ return t.options;
1727
+ },
1728
+ get form() {
1729
+ return t.form;
1730
+ },
1731
+ get rule() {
1732
+ return t.rules;
1733
+ },
1734
+ get parent() {
1735
+ return t.vm.$pfc && t.vm.$pfc.$f;
1736
+ },
1737
+ get top() {
1738
+ return s.parent ? s.parent.top : s;
1739
+ },
1740
+ get children() {
1741
+ return i();
1742
+ },
1743
+ formData(n) {
1744
+ return e(n).reduce((o, a) => {
1745
+ const u = t.getFieldCtx(a);
1746
+ return u && (o[u.field] = Q(u.rule.value)), o;
1747
+ }, t.options.appendValue !== !1 ? Q(t.appendData) : {});
1748
+ },
1749
+ getValue(n) {
1750
+ const o = t.getFieldCtx(n);
1751
+ if (o)
1752
+ return Q(o.rule.value);
1753
+ },
1754
+ coverValue(n) {
1755
+ const o = y({}, n || {});
1756
+ t.deferSyncValue(() => {
1757
+ s.fields().forEach((a) => {
1758
+ const u = t.fieldCtx[a];
1759
+ if (u) {
1760
+ const l = w(o, a);
1761
+ u.forEach((h) => {
1762
+ h.rule.value = l ? o[a] : void 0;
1763
+ }), delete o[a];
1764
+ }
1765
+ }), m(t.appendData, o);
1766
+ });
1767
+ },
1768
+ setValue(n) {
1769
+ let o = n;
1770
+ arguments.length >= 2 && (o = { [n]: arguments[1] }), t.deferSyncValue(() => {
1771
+ Object.keys(o).forEach((a) => {
1772
+ const u = t.fieldCtx[a];
1773
+ if (!u) return t.appendData[a] = o[a];
1774
+ u.forEach((l) => {
1775
+ l.rule.value = o[a];
1776
+ });
1777
+ });
1778
+ });
1779
+ },
1780
+ removeField(n) {
1781
+ const o = t.getCtx(n);
1782
+ return t.deferSyncValue(() => {
1783
+ t.getCtxs(n).forEach((a) => {
1784
+ a.rm();
1785
+ });
1786
+ }, !0), o ? o.origin : void 0;
1787
+ },
1788
+ removeRule(n) {
1789
+ const o = n && Z(n);
1790
+ if (o)
1791
+ return o.rm(), o.origin;
1792
+ },
1793
+ destroy: () => {
1794
+ t.vm.$el.parentNode && t.vm.$el.parentNode.removeChild(t.vm.$el), t.vm.$destroy();
1795
+ },
1796
+ fields: () => t.fields(),
1797
+ append: (n, o, a) => {
1798
+ let u = t.sort.length - 1, l;
1799
+ const h = t.getCtx(o);
1800
+ h ? a ? (l = h.rule.children, u = h.rule.children.length - 1) : (u = h.root.indexOf(h.origin), l = h.root) : l = t.rules, l.splice(u + 1, 0, n);
1801
+ },
1802
+ prepend: (n, o, a) => {
1803
+ let u = 0, l;
1804
+ const h = t.getCtx(o);
1805
+ h ? a ? l = h.rule.children : (u = h.root.indexOf(h.origin), l = h.root) : l = t.rules, l.splice(u, 0, n);
1806
+ },
1807
+ hidden(n, o) {
1808
+ r(o, "hidden", !!n), t.refresh();
1809
+ },
1810
+ hiddenStatus(n) {
1811
+ const o = t.getCtx(n);
1812
+ if (o)
1813
+ return !!o.rule.hidden;
1814
+ },
1815
+ display(n, o) {
1816
+ r(o, "display", !!n), t.refresh();
1817
+ },
1818
+ displayStatus(n) {
1819
+ const o = t.getCtx(n);
1820
+ if (o)
1821
+ return !!o.rule.display;
1822
+ },
1823
+ disabled(n, o) {
1824
+ e(o).forEach((a) => {
1825
+ t.getCtxs(a).forEach((u) => {
1826
+ u.rule.props && F(u.rule.props, "disabled", !!n);
1827
+ });
1828
+ }), t.refresh();
1829
+ },
1830
+ all(n) {
1831
+ return Object.keys(t.ctxs).map((o) => {
1832
+ const a = t.ctxs[o];
1833
+ return n ? a.origin : a.rule;
1834
+ });
1835
+ },
1836
+ model(n) {
1837
+ return t.fields().reduce((o, a) => {
1838
+ const u = t.fieldCtx[a][0];
1839
+ return o[a] = n ? u.origin : u.rule, o;
1840
+ }, {});
1841
+ },
1842
+ component(n) {
1843
+ return Object.keys(t.nameCtx).reduce((o, a) => {
1844
+ const u = t.nameCtx[a].map((l) => n ? l.origin : l.rule);
1845
+ return o[a] = u.length === 1 ? u[0] : u, o;
1846
+ }, {});
1847
+ },
1848
+ bind() {
1849
+ return s.form;
1850
+ },
1851
+ reload: (n) => {
1852
+ t.reloadRule(n);
1853
+ },
1854
+ updateOptions(n) {
1855
+ t.fc.updateOptions(n), s.refresh();
1856
+ },
1857
+ onSubmit(n) {
1858
+ s.updateOptions({ onSubmit: n });
1859
+ },
1860
+ sync: (n) => {
1861
+ if (Array.isArray(n)) {
1862
+ n.forEach((a) => s.sync(a));
1863
+ return;
1864
+ }
1865
+ let o = c.Object(n) ? Z(n) : t.getCtxs(n);
1866
+ o && (o = Array.isArray(o) ? o : [o], o.forEach((a) => {
1867
+ if (!a.deleted) {
1868
+ const u = t.subForm[a.id];
1869
+ u && (Array.isArray(u) ? u.forEach((l) => {
1870
+ l.refresh();
1871
+ }) : u && u.refresh()), t.$render.clearCache(a);
1872
+ }
1873
+ }), t.refresh());
1874
+ },
1875
+ refresh: () => {
1876
+ i().forEach((n) => {
1877
+ n.refresh();
1878
+ }), t.$render.clearCacheAll(), t.refresh();
1879
+ },
1880
+ refreshOptions() {
1881
+ t.$manager.updateOptions(t.options), s.refresh();
1882
+ },
1883
+ hideForm: (n) => {
1884
+ F(t.vm, "isShow", !n);
1885
+ },
1886
+ changeStatus: () => t.changeStatus,
1887
+ clearChangeStatus: () => {
1888
+ t.changeStatus = !1;
1889
+ },
1890
+ updateRule(n, o) {
1891
+ t.getCtxs(n).forEach((a) => {
1892
+ m(a.rule, o);
1893
+ });
1894
+ },
1895
+ updateRules(n) {
1896
+ Object.keys(n).forEach((o) => {
1897
+ s.updateRule(o, n[o]);
1898
+ });
1899
+ },
1900
+ mergeRule: (n, o) => {
1901
+ t.getCtxs(n).forEach((a) => {
1902
+ H(a.rule, o);
1903
+ });
1904
+ },
1905
+ mergeRules(n) {
1906
+ Object.keys(n).forEach((o) => {
1907
+ s.mergeRule(o, n[o]);
1908
+ });
1909
+ },
1910
+ getRule: (n, o) => {
1911
+ const a = t.getCtx(n);
1912
+ if (a)
1913
+ return o ? a.origin : a.rule;
1914
+ },
1915
+ getRenderRule: (n) => {
1916
+ const o = t.getCtx(n);
1917
+ if (o)
1918
+ return o.prop;
1919
+ },
1920
+ getRefRule: (n) => {
1921
+ const o = t.getCtxs(n);
1922
+ if (o && o.length) {
1923
+ const a = o.map((u) => u.rule);
1924
+ return a.length === 1 ? a[0] : a;
1925
+ }
1926
+ },
1927
+ setEffect(n, o, a) {
1928
+ const u = t.getCtx(n);
1929
+ 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));
1930
+ },
1931
+ clearEffectData(n, o) {
1932
+ const a = t.getCtx(n);
1933
+ a && (o && o[0] === "$" && (o = o.substr(1)), a.clearEffectData(o), s.sync(n));
1934
+ },
1935
+ updateValidate(n, o, a) {
1936
+ a ? s.mergeRule(n, { validate: o }) : r(n, "validate", o);
1937
+ },
1938
+ updateValidates(n, o) {
1939
+ Object.keys(n).forEach((a) => {
1940
+ s.updateValidate(a, n[a], o);
1941
+ });
1942
+ },
1943
+ refreshValidate() {
1944
+ t.vm.validate = {}, s.refresh();
1945
+ },
1946
+ resetFields(n) {
1947
+ e(n).forEach((o) => {
1948
+ t.getCtxs(o).forEach((a) => {
1949
+ t.$render.clearCache(a), a.rule.value = Q(a.defaultValue);
1950
+ });
1951
+ }), t.vm.$nextTick(() => {
1952
+ s.clearValidateState();
1953
+ }), n == null && (c.Function(t.options.onReset) && j(() => t.options.onReset(s)), t.vm.$emit("reset", s));
1954
+ },
1955
+ method(n, o) {
1956
+ const a = s.el(n);
1957
+ if (!a || !a[o])
1958
+ throw new Error(ye("err", `${o}方法不存在`));
1959
+ return (...u) => a[o](...u);
1960
+ },
1961
+ exec(n, o, ...a) {
1962
+ return j(() => s.method(n, o)(...a));
1963
+ },
1964
+ toJson(n) {
1965
+ return Ye(s.rule, n);
1966
+ },
1967
+ trigger(n, o, ...a) {
1968
+ const u = s.el(n);
1969
+ u && u.$emit(o, ...a);
1970
+ },
1971
+ el(n) {
1972
+ const o = t.getCtx(n);
1973
+ if (o) return o.exportEl || o.el || t.vm.$refs[o.ref];
1974
+ },
1975
+ closeModal: (n) => {
1976
+ const o = s.el(n);
1977
+ o && o.$emit && o.$emit("close-modal");
1978
+ },
1979
+ getSubForm(n) {
1980
+ const o = t.getCtx(n);
1981
+ return o ? t.subForm[o.id] : void 0;
1982
+ },
1983
+ nextTick(n) {
1984
+ t.bus.$once("next-tick", n), t.refresh();
1985
+ },
1986
+ nextRefresh(n) {
1987
+ t.nextRefresh(), n && j(n);
1988
+ },
1989
+ emit(n, ...o) {
1990
+ t.vm.$emit(n, ...o);
1991
+ },
1992
+ deferSyncValue(n, o) {
1993
+ t.deferSyncValue(n, o);
1994
+ },
1995
+ fetch(n) {
1996
+ return new Promise((o, a) => {
1997
+ t.beforeFetch(n).then(() => sr(n).then(o).catch(a));
1998
+ });
1999
+ },
2000
+ getData(n, o) {
2001
+ return t.fc.getData(n, o);
2002
+ },
2003
+ setData(n, o) {
2004
+ return t.fc.setData(n, o);
2005
+ },
2006
+ helper: {
2007
+ tidyFields: e,
2008
+ props: r
2009
+ }
2010
+ };
2011
+ return ["on", "once", "off", "set", "emit"].forEach((n) => {
2012
+ s[n] = function(...o) {
2013
+ t.vm[`$${n}`](...o);
2014
+ };
2015
+ }), s.changeValue = s.changeField = s.setValue, s;
2016
+ }
2017
+ function ar(t) {
2018
+ m(t.prototype, {
2019
+ initCache() {
2020
+ this.clearCacheAll();
2021
+ },
2022
+ clearCache(e) {
2023
+ if (e.rule.cache)
2024
+ return;
2025
+ if (!this.cache[e.id]) {
2026
+ e.parent && this.clearCache(e.parent);
2027
+ return;
2028
+ }
2029
+ (this.cache[e.id].use === !0 || this.cache[e.id].parent) && this.$handle.refresh();
2030
+ const r = this.cache[e.id].parent;
2031
+ this.cache[e.id] = null, r && this.clearCache(r);
2032
+ },
2033
+ clearCacheAll() {
2034
+ this.cache = {};
2035
+ },
2036
+ setCache(e, r, i) {
2037
+ this.cache[e.id] = {
2038
+ vnode: r,
2039
+ use: !1,
2040
+ parent: i,
2041
+ slot: e.rule.slot
2042
+ };
2043
+ },
2044
+ getCache(e) {
2045
+ const r = this.cache[e.id];
2046
+ if (r)
2047
+ return r.use = !0, r.vnode;
2048
+ }
2049
+ });
2050
+ }
2051
+ function A(t) {
2052
+ const e = t.replace(/(-[a-z])/g, function(r) {
2053
+ return r.replace("-", "").toLocaleUpperCase();
2054
+ });
2055
+ return at(e);
2056
+ }
2057
+ function at(t) {
2058
+ return t.replace(t[0], t[0].toLowerCase());
2059
+ }
2060
+ function lt(t) {
2061
+ return t == null ? "" : typeof t == "object" ? JSON.stringify(t, null, 2) : String(t);
2062
+ }
2063
+ function Y(t) {
2064
+ let e = t.replace(/([A-Z])/g, "-$1").toLocaleLowerCase();
2065
+ return e.indexOf("-") === 0 && (e = e.substr(1)), e;
2066
+ }
2067
+ let lr = 0;
2068
+ function re() {
2069
+ const t = 370 + ++lr;
2070
+ return "F" + Math.random().toString(36).substr(3, 3) + (+`${Date.now()}`).toString(36) + t.toString(36) + "c";
2071
+ }
2072
+ function ee(t, e, r) {
2073
+ let i = t, s;
2074
+ return (e || "").split(".").forEach((n) => {
2075
+ s && ((!i[s] || typeof i[s] != "object") && (i[s] = {}), i = i[s]), s = n;
2076
+ }), i[s] = r, i;
2077
+ }
2078
+ function ur(t) {
2079
+ m(t.prototype, {
2080
+ initRender() {
2081
+ this.tempList = {}, this.clearOrgChildren();
2082
+ },
2083
+ initOrgChildren() {
2084
+ const e = this.$handle.ctxs;
2085
+ this.orgChildren = Object.keys(e).reduce((r, i) => {
2086
+ if (e[i].parser.loadChildren !== !1) {
2087
+ const s = e[i].rule.children;
2088
+ r[i] = c.trueArray(s) ? [...s] : [];
2089
+ }
2090
+ return r;
2091
+ }, {});
2092
+ },
2093
+ clearOrgChildren() {
2094
+ this.orgChildren = {};
2095
+ },
2096
+ getTypeSlot(e) {
2097
+ const r = (i) => {
2098
+ if (i) {
2099
+ let s;
2100
+ return e.rule.field && (s = i.$scopedSlots["field-" + Y(e.rule.field)] || i.$scopedSlots["field-" + e.rule.field]), s || (s = i.$scopedSlots["type-" + Y(e.type)] || i.$scopedSlots["type-" + e.type]), s || r(i.$pfc);
2101
+ }
2102
+ };
2103
+ return r(this.vm);
2104
+ },
2105
+ render() {
2106
+ if (!this.vm.isShow)
2107
+ return;
2108
+ this.$h = this.vm.$createElement, this.$manager.beforeRender();
2109
+ let e;
2110
+ const r = () => this.renderList();
2111
+ 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);
2112
+ },
2113
+ renderList(e) {
2114
+ return this.sort.map((r) => e ? this.renderSlot(this.$handle.ctxs[r], e) : this.renderCtx(this.$handle.ctxs[r])).filter((r) => r !== void 0);
2115
+ },
2116
+ makeVm(e) {
2117
+ const r = e.vm;
2118
+ if (r) {
2119
+ if (c.Function(r))
2120
+ return j(() => e.vm(this.$handle.getInjectData(e)));
2121
+ if (!r._isVue)
2122
+ return new D(r);
2123
+ } else return new D();
2124
+ return r;
2125
+ },
2126
+ mergeGlobal(e) {
2127
+ const r = this.$handle.options.global;
2128
+ r && (e.cacheConfig || (e.cacheConfig = r[e.originType] || r[e.type] || r[e.trueType] || {}), e.prop = H({}, [r["*"], e.cacheConfig, e.prop]));
2129
+ },
2130
+ setOptions(e) {
2131
+ e.prop.optionsTo && e.prop.options && ee(e.prop, e.prop.optionsTo, e.prop.options);
2132
+ },
2133
+ deepSet(e) {
2134
+ const r = e.rule.deep;
2135
+ r && Object.keys(r).sort((i, s) => i.length < s.length ? -1 : 1).forEach((i) => {
2136
+ ee(e.prop, i, r[i]);
2137
+ });
2138
+ },
2139
+ setTempProps(e, r) {
2140
+ if (!e.$props) return;
2141
+ const { prop: i } = r, s = Object.keys(e.$props), n = this.injectProp(r), o = Object.keys(n);
2142
+ s.forEach((u) => {
2143
+ w(i.props, u) ? e.$props[u] = i.props[u] : o.indexOf(u) > -1 && (e.$props[u] = n[u]);
2144
+ });
2145
+ const a = e.$options.model && e.$options.model.prop || "value";
2146
+ s.indexOf(a) > -1 && (e.$props[a] = i.value);
2147
+ },
2148
+ renderTemp(e) {
2149
+ if (!D.compile)
2150
+ return Zt("当前使用的Vue构建版本不支持compile,无法使用template功能"), [];
2151
+ const r = e.prop, { id: i, key: s } = e;
2152
+ if (!this.tempList[i]) {
2153
+ e.el || (e.el = this.makeVm(r), this.vm.$nextTick(() => e.parser.mounted(e)));
2154
+ let u = e.el;
2155
+ e.input && u.$on(u.$options.model && u.$options.model.event || "input", (l) => {
2156
+ this.onInput(e, l);
2157
+ }), this.tempList[i] = {
2158
+ vm: u,
2159
+ template: D.compile(r.template)
2160
+ };
2161
+ }
2162
+ const { vm: n, template: o } = this.tempList[i];
2163
+ this.setTempProps(n, e);
2164
+ const a = o.render.call(n);
2165
+ return c.Undef(a.data) && (a.data = {}), a.key = s, a.data.ref = e.ref, a.data.key = s, a;
2166
+ },
2167
+ parseSide(e, r) {
2168
+ return c.Object(e) ? H({ props: { formCreateInject: r.prop.props.formCreateInject } }, e) : e;
2169
+ },
2170
+ renderSides(e, r, i) {
2171
+ const s = r[i ? "rule" : "prop"];
2172
+ return [this.renderRule(this.parseSide(s.prefix, r)), e, this.renderRule(this.parseSide(s.suffix, r))];
2173
+ },
2174
+ renderSlot(e, r) {
2175
+ return e.rule.slot === r ? this.renderCtx(e) : void 0;
2176
+ },
2177
+ renderId(e, r) {
2178
+ const i = this.$handle[r === "field" ? "fieldCtx" : "nameCtx"][e];
2179
+ return i ? i.map((s) => this.renderCtx(s, s.parent)) : void 0;
2180
+ },
2181
+ renderCtx(e, r) {
2182
+ if (e.type === "hidden") return;
2183
+ const i = e.rule;
2184
+ if (!this.cache[e.id] || this.cache[e.id].slot !== i.slot) {
2185
+ let s, n = i.cache !== !1;
2186
+ const o = e.trueType, a = !(c.Undef(i.display) || i.display);
2187
+ if (o === "template" && !i.template)
2188
+ s = this.renderSides(this.renderChildren(e), e, !0), a && this.display(s), s = this.item(e, s);
2189
+ else if (o === "fcFragment")
2190
+ s = this.renderChildren(e);
2191
+ else {
2192
+ e.initProp(), this.mergeGlobal(e), this.$manager.tidyRule(e), this.deepSet(e), this.setOptions(e), this.ctxProp(e);
2193
+ let u = e.prop;
2194
+ u.preview = !!(w(u, "preview") ? u.preview : this.options.preview), u.props.formCreateInject = this.injectProp(e);
2195
+ const l = u.preview;
2196
+ if (u.hidden) {
2197
+ this.setCache(e, void 0, r);
2198
+ return;
2199
+ }
2200
+ if (o === "template" && u.template)
2201
+ s = this.renderTemp(e), n = !1;
2202
+ else {
2203
+ let h = [];
2204
+ e.parser.renderChildren ? h = e.parser.renderChildren(e) : e.parser.loadChildren !== !1 && (h = this.renderChildren(e));
2205
+ const g = this.getTypeSlot(e);
2206
+ g ? s = g({
2207
+ rule: i,
2208
+ prop: u,
2209
+ preview: l,
2210
+ children: h,
2211
+ api: this.$handle.api,
2212
+ model: u.model || {}
2213
+ }) : s = l ? e.parser.preview(h, e) : e.parser.render(h, e);
2214
+ }
2215
+ 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);
2216
+ }
2217
+ return n && this.setCache(e, s, r), s;
2218
+ }
2219
+ return this.getCache(e);
2220
+ },
2221
+ display(e) {
2222
+ if (Array.isArray(e)) {
2223
+ const r = [];
2224
+ return e.forEach((i) => {
2225
+ if (Array.isArray(i)) return this.display(i);
2226
+ this.none(i) && r.push(i);
2227
+ }), r;
2228
+ } else
2229
+ return this.none(e);
2230
+ },
2231
+ none(e) {
2232
+ if (e && e.data)
2233
+ 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;
2234
+ },
2235
+ item(e, r) {
2236
+ return this.$h("fcFragment", {
2237
+ slot: e.rule.slot,
2238
+ key: e.key
2239
+ }, [r]);
2240
+ },
2241
+ injectProp(e) {
2242
+ this.vm.ctxInject[e.id] || F(this.vm.ctxInject, e.id, {
2243
+ api: this.$handle.api,
2244
+ form: this.fc.create,
2245
+ subForm: (i) => {
2246
+ this.$handle.addSubForm(e, i);
2247
+ },
2248
+ getSubForm: () => this.$handle.subForm[e.id],
2249
+ options: [],
2250
+ children: [],
2251
+ prop: {},
2252
+ preview: !1,
2253
+ id: e.id,
2254
+ field: e.field,
2255
+ rule: e.rule,
2256
+ input: e.input
2257
+ });
2258
+ const r = this.vm.ctxInject[e.id];
2259
+ return m(r, {
2260
+ preview: e.prop.preview,
2261
+ options: e.prop.options,
2262
+ children: e.rule.children,
2263
+ prop: function() {
2264
+ const i = y({}, e.prop);
2265
+ return i.on = i.on ? y({}, i.on) : {}, delete i.model, i;
2266
+ }()
2267
+ }), r;
2268
+ },
2269
+ ctxProp(e) {
2270
+ const { ref: r, key: i, rule: s } = e;
2271
+ this.$manager.mergeProp(e), e.parser.mergeProp(e);
2272
+ const n = [
2273
+ {
2274
+ ref: r,
2275
+ key: s.key || `${i}fc`,
2276
+ slot: void 0,
2277
+ on: {
2278
+ "hook:mounted": () => {
2279
+ this.onMounted(e);
2280
+ },
2281
+ "fc.sub-form": (o) => {
2282
+ this.$handle.addSubForm(e, o);
2283
+ },
2284
+ "fc.el": (o) => {
2285
+ e.exportEl = o, o && ((o.$el || o).__rule__ = e.rule);
2286
+ }
2287
+ }
2288
+ }
2289
+ ];
2290
+ return e.input && (this.vm.$props.disabled === !0 && (e.prop.props.disabled = !0), e.prop.model = {
2291
+ value: this.$handle.getFormData(e),
2292
+ callback: (o) => {
2293
+ this.onInput(e, o);
2294
+ },
2295
+ expression: `formData.${e.id}`
2296
+ }), B(n, e.prop), e.prop;
2297
+ },
2298
+ onMounted(e) {
2299
+ 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");
2300
+ },
2301
+ onInput(e, r) {
2302
+ this.$handle.onInput(e, r);
2303
+ },
2304
+ renderChildren(e) {
2305
+ const { children: r } = e.rule, i = this.orgChildren[e.id], s = (n) => !c.String(n) && n.__fc__ && !this.$handle.ctxs[n.__fc__.id];
2306
+ return !c.trueArray(r) && i ? (this.$handle.deferSyncValue(() => {
2307
+ i.forEach((n) => {
2308
+ n && s(n) && this.$handle.rmCtx(n.__fc__);
2309
+ });
2310
+ }), this.orgChildren[e.id] = [], []) : (i && this.$handle.deferSyncValue(() => {
2311
+ i.forEach((n) => {
2312
+ n && r.indexOf(n) === -1 && s(n) && this.$handle.rmCtx(n.__fc__);
2313
+ });
2314
+ }), r.map((n) => {
2315
+ if (n) {
2316
+ if (c.String(n)) return n;
2317
+ if (n.__fc__)
2318
+ return this.renderCtx(n.__fc__, e);
2319
+ n.type && this.vm.$nextTick(() => {
2320
+ this.$handle.loadChildren(r, e), this.$handle.refresh();
2321
+ });
2322
+ }
2323
+ }));
2324
+ },
2325
+ defaultRender(e, r) {
2326
+ const i = e.prop;
2327
+ 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(at(e.originType), i, r);
2328
+ },
2329
+ renderRule(e, r, i) {
2330
+ if (!e) return;
2331
+ if (c.String(e)) return e;
2332
+ let s;
2333
+ if (i)
2334
+ s = e.type;
2335
+ else if (s = e.is, e.type) {
2336
+ s = A(e.type);
2337
+ const o = this.vNode.aliasMap[s];
2338
+ o && (s = A(o));
2339
+ }
2340
+ if (!s) return;
2341
+ let n = [[r]];
2342
+ return c.trueArray(e.children) && n.push(e.children.map((o) => this.renderRule(o))), this.$h(s, y({}, e), n);
2343
+ }
2344
+ });
2345
+ }
2346
+ function be(t) {
2347
+ m(this, {
2348
+ $handle: t,
2349
+ fc: t.fc,
2350
+ vm: t.vm,
2351
+ $manager: t.$manager,
2352
+ vNode: new t.fc.CreateNode(t.vm)
2353
+ }), rt(this, {
2354
+ options() {
2355
+ return t.options;
2356
+ },
2357
+ sort() {
2358
+ return t.sort;
2359
+ }
2360
+ }), this.initCache(), this.initRender();
2361
+ }
2362
+ ar(be);
2363
+ ur(be);
2364
+ function fr(t) {
2365
+ m(t.prototype, {
2366
+ parseInjectEvent(e, r) {
2367
+ const i = e.inject || this.options.injectEvent;
2368
+ return this.parseEventLst(e, r, i);
2369
+ },
2370
+ parseEventLst(e, r, i, s) {
2371
+ return Object.keys(r).forEach((n) => {
2372
+ const o = this.parseEvent(e, r[n], i, s);
2373
+ o && (r[n] = o);
2374
+ }), r;
2375
+ },
2376
+ parseEvent(e, r, i, s) {
2377
+ if (c.Function(r) && (i !== !1 && !c.Undef(i) || r.__inject))
2378
+ return this.inject(e, r, i);
2379
+ if (!s && Array.isArray(r) && r[0] && (c.String(r[0]) || c.Function(r[0])))
2380
+ return this.parseEventLst(e, r, i, !0);
2381
+ if (c.String(r)) {
2382
+ const n = U(r);
2383
+ if (n && r !== n)
2384
+ return n.__inject ? this.parseEvent(e, n, i, !0) : n;
2385
+ }
2386
+ },
2387
+ parseEmit(e, r) {
2388
+ let i = {}, s = e.rule, { emitPrefix: n, field: o, name: a, inject: u } = s, l = s[r ? "emit" : "nativeEmit"] || [];
2389
+ return c.trueArray(l) && l.forEach((h) => {
2390
+ if (!h) return;
2391
+ let g, b = n || o || a;
2392
+ if (c.Object(h) && (g = h.inject, h = h.name, b = h.prefix || b), b) {
2393
+ r || (b = `native-${b}`);
2394
+ const k = Y(`${b}-${h}`), $ = (...O) => {
2395
+ this.vm.$emit(k, ...O), this.vm.$emit("emit-event", k, ...O);
2396
+ };
2397
+ if ($.__emit = !0, !g && u === !1)
2398
+ i[h] = $;
2399
+ else {
2400
+ let O = g || u || this.options.injectEvent;
2401
+ i[h] = c.Undef(O) ? $ : this.inject(s, $, O);
2402
+ }
2403
+ }
2404
+ }), e.computed[r ? "on" : "nativeOn"] = i, i;
2405
+ },
2406
+ getInjectData(e, r) {
2407
+ const { option: i, rule: s } = this.vm.$options.propsData;
2408
+ return {
2409
+ api: this.api,
2410
+ $f: this.api,
2411
+ rule: s,
2412
+ self: e.__origin__,
2413
+ option: i,
2414
+ inject: r
2415
+ };
2416
+ },
2417
+ inject(e, r, i) {
2418
+ if (r.__origin) {
2419
+ if (this.watching && !this.loading)
2420
+ return r;
2421
+ r = r.__origin;
2422
+ }
2423
+ const s = this, n = function(...o) {
2424
+ const a = s.getInjectData(e, i);
2425
+ return a.args = [...o], o.unshift(a), r.apply(this, o);
2426
+ };
2427
+ return n.__origin = r, n.__json = r.__json, n;
2428
+ }
2429
+ });
2430
+ }
2431
+ const Le = ["hook:updated", "hook:mounted"];
2432
+ function hr(t) {
2433
+ m(t.prototype, {
2434
+ usePage() {
2435
+ const e = this.options.page;
2436
+ if (!e) return;
2437
+ let r = 25, i = cr(this.rules);
2438
+ c.Object(e) && (e.first && (r = parseInt(e.first, 10) || r), e.limit && (i = parseInt(e.limit, 10) || i)), m(this, {
2439
+ first: r,
2440
+ limit: i,
2441
+ pageEnd: this.rules.length <= r
2442
+ }), this.bus.$on("page-end", () => this.vm.$emit("page-end", this.api)), this.pageLoad();
2443
+ },
2444
+ pageLoad() {
2445
+ const e = () => {
2446
+ this.pageEnd ? (this.vm.$off(Le, e), this.bus.$emit("page-end")) : (this.first += this.limit, this.pageEnd = this.rules.length <= this.first, this.loadRule(), this.refresh());
2447
+ };
2448
+ this.vm.$on(Le, e);
2449
+ }
2450
+ });
2451
+ }
2452
+ function cr(t) {
2453
+ return t.length < 31 ? 31 : Math.ceil(t.length / 3);
2454
+ }
2455
+ function dr(t) {
2456
+ m(t.prototype, {
2457
+ clearNextTick() {
2458
+ this.nextTick && clearTimeout(this.nextTick), this.nextTick = null;
2459
+ },
2460
+ bindNextTick(e) {
2461
+ this.clearNextTick(), this.nextTick = setTimeout(() => {
2462
+ e(), this.nextTick = null;
2463
+ }, 10);
2464
+ },
2465
+ render() {
2466
+ return ++this.loadedId, this.vm.unique > 0 ? this.$render.render() : (this.vm.unique = 1, []);
2467
+ }
2468
+ });
2469
+ }
2470
+ function pr(t) {
2471
+ Object.defineProperties(t.origin, {
2472
+ __fc__: et(t, !0)
2473
+ });
2474
+ }
2475
+ function ut(t, e, r) {
2476
+ const i = re();
2477
+ m(this, {
2478
+ id: i,
2479
+ ref: i,
2480
+ wrapRef: i + "fi",
2481
+ rule: e,
2482
+ origin: e.__origin__ || e,
2483
+ name: e.name,
2484
+ watch: [],
2485
+ linkOn: [],
2486
+ root: [],
2487
+ ctrlRule: [],
2488
+ parent: null,
2489
+ cacheConfig: null,
2490
+ prop: y({}, e),
2491
+ computed: {},
2492
+ payload: {},
2493
+ input: !!e.field,
2494
+ el: void 0,
2495
+ exportEl: void 0,
2496
+ defaultValue: e.field ? N(r) : void 0,
2497
+ field: e.field || void 0
2498
+ }), this.updateType(), this.updateKey(), pr(this), this.update(t, !0);
2499
+ }
2500
+ m(ut.prototype, {
2501
+ effectData(t) {
2502
+ return this.payload[t] || (this.payload[t] = {}), this.payload[t];
2503
+ },
2504
+ clearEffectData(t) {
2505
+ t === void 0 ? this.payload = {} : delete this.payload[t];
2506
+ },
2507
+ updateKey(t) {
2508
+ this.key = re(), t && this.parent && this.parent.updateKey(t);
2509
+ },
2510
+ updateType() {
2511
+ this.originType = this.rule.type, this.type = A(this.rule.type);
2512
+ },
2513
+ setParser(t) {
2514
+ this.parser = t, t.init(this);
2515
+ },
2516
+ initProp() {
2517
+ const t = y({}, this.rule);
2518
+ delete t.children, this.prop = H({}, [t, ...Object.keys(this.payload).map((e) => this.payload[e]), this.computed]);
2519
+ },
2520
+ injectValidate() {
2521
+ return I(this.prop.validate).map((t) => {
2522
+ if (c.Function(t.validator)) {
2523
+ const e = y({}, t), r = this;
2524
+ return e.validator = function(...i) {
2525
+ return t.validator.call({
2526
+ that: this,
2527
+ id: r.id,
2528
+ field: r.field,
2529
+ rule: r.rule,
2530
+ api: r.$handle.api
2531
+ }, ...i);
2532
+ }, e;
2533
+ }
2534
+ return t;
2535
+ });
2536
+ },
2537
+ check(t) {
2538
+ return this.vm === t.vm;
2539
+ },
2540
+ unwatch() {
2541
+ this.watch.forEach((t) => t()), this.watch = [];
2542
+ },
2543
+ unlink() {
2544
+ this.linkOn.forEach((t) => t()), this.linkOn = [];
2545
+ },
2546
+ link() {
2547
+ this.unlink(), this.$handle.appendLink(this);
2548
+ },
2549
+ watchTo() {
2550
+ this.$handle.watchCtx(this);
2551
+ },
2552
+ delete() {
2553
+ this.unwatch(), this.unlink(), this.rmCtrl(), m(this, {
2554
+ deleted: !0,
2555
+ prop: y({}, this.rule),
2556
+ computed: {},
2557
+ el: void 0,
2558
+ $handle: void 0,
2559
+ $render: void 0,
2560
+ $api: void 0,
2561
+ vm: void 0,
2562
+ vNode: void 0,
2563
+ parent: null,
2564
+ cacheConfig: null
2565
+ });
2566
+ },
2567
+ rmCtrl() {
2568
+ this.ctrlRule.forEach((t) => t.__fc__ && t.__fc__.rm()), this.ctrlRule = [];
2569
+ },
2570
+ rm() {
2571
+ const t = () => {
2572
+ let e = this.root.indexOf(this.origin);
2573
+ e > -1 && (this.root.splice(e, 1), this.$handle && this.$handle.refresh());
2574
+ };
2575
+ if (this.deleted) {
2576
+ t();
2577
+ return;
2578
+ }
2579
+ this.$handle.noWatch(() => {
2580
+ this.$handle.deferSyncValue(() => {
2581
+ this.rmCtrl(), t(), this.$handle.rmCtx(this), m(this, {
2582
+ root: []
2583
+ });
2584
+ }, this.input);
2585
+ });
2586
+ },
2587
+ update(t, e) {
2588
+ m(this, {
2589
+ deleted: !1,
2590
+ $handle: t,
2591
+ $render: t.$render,
2592
+ $api: t.api,
2593
+ vm: t.vm,
2594
+ trueType: t.getType(this.originType),
2595
+ vNode: t.$render.vNode,
2596
+ updated: !1,
2597
+ cacheValue: this.rule.value
2598
+ }), !e && this.unwatch(), this.watchTo(), this.link();
2599
+ }
2600
+ });
2601
+ function mr(t) {
2602
+ m(t.prototype, {
2603
+ nextRefresh(e) {
2604
+ const r = this.loadedId;
2605
+ this.vm.$nextTick(() => {
2606
+ r === this.loadedId && (e ? e() : this.refresh());
2607
+ });
2608
+ },
2609
+ parseRule(e) {
2610
+ const r = Pe(e);
2611
+ return Object.defineProperties(r, {
2612
+ __origin__: et(e, !0)
2613
+ }), yr(r), this.appendValue(r), r.options = Array.isArray(r.options) ? r.options : [], [r, r.prefix, r.suffix].forEach((i) => {
2614
+ i && this.loadFn(i, r);
2615
+ }), this.loadCtrl(r), r.update && (r.update = U(r.update)), r;
2616
+ },
2617
+ loadFn(e, r) {
2618
+ ["on", "props", "nativeOn", "deep"].forEach((i) => {
2619
+ e[i] && this.parseInjectEvent(r, e[i]);
2620
+ });
2621
+ },
2622
+ loadCtrl(e) {
2623
+ e.control && e.control.forEach((r) => {
2624
+ r.handle && (r.handle = U(r.handle));
2625
+ });
2626
+ },
2627
+ syncProp(e) {
2628
+ const r = e.rule;
2629
+ c.trueArray(r.sync) && B([{
2630
+ on: r.sync.reduce((i, s) => (i[`update:${s}`] = (n) => {
2631
+ r.props[s] = n, this.vm.$emit("sync", s, n, r, this.fapi);
2632
+ }, i), {})
2633
+ }], e.computed);
2634
+ },
2635
+ loadRule() {
2636
+ this.cycleLoad = !1, this.loading = !0, this.pageEnd && this.bus.$emit("load-start"), this.deferSyncValue(() => {
2637
+ if (this._loadRule(this.rules), this.loading = !1, this.cycleLoad && this.pageEnd)
2638
+ return this.loadRule();
2639
+ this.pageEnd && this.bus.$emit("load-end"), this.vm._renderRule(), this.$render.initOrgChildren(), this.syncForm();
2640
+ });
2641
+ },
2642
+ loadChildren(e, r) {
2643
+ if (this.cycleLoad = !1, this.loading = !0, this.bus.$emit("load-start"), this._loadRule(e, r), this.loading = !1, this.cycleLoad)
2644
+ return this.loadRule();
2645
+ this.bus.$emit("load-end"), this.syncForm(), this.$render.clearCache(r);
2646
+ },
2647
+ _loadRule(e, r) {
2648
+ const i = (n) => {
2649
+ let o = e[n - 1];
2650
+ if (!o || !o.__fc__)
2651
+ return n > 0 ? i(n - 1) : -1;
2652
+ let a = this.sort.indexOf(o.__fc__.id);
2653
+ return a > -1 ? a : i(n - 1);
2654
+ }, s = (n, o) => {
2655
+ c.trueArray(n) && this._loadRule(n, o);
2656
+ };
2657
+ e.map((n, o) => {
2658
+ if (r && !c.Object(n) || !this.pageEnd && !r && o >= this.first) return;
2659
+ if (n.__fc__ && n.__fc__.root === e && this.ctxs[n.__fc__.id])
2660
+ return s(n.__fc__.rule.children, n.__fc__), n.__fc__;
2661
+ let a = Pe(n);
2662
+ const u = () => !!(a.field && this.fieldCtx[a.field] && this.fieldCtx[a.field][0] !== n.__fc__);
2663
+ this.ruleEffect(a, "init", { repeat: u() }), u() && this.vm.$emit("repeat-field", n, this.api);
2664
+ let l, h = !1, g = !!n.__fc__, b = a.value;
2665
+ if (g) {
2666
+ l = n.__fc__, b = l.defaultValue;
2667
+ const $ = !l.check(this);
2668
+ if (l.deleted) {
2669
+ if ($) {
2670
+ if (Ne(l))
2671
+ return;
2672
+ l.update(this);
2673
+ }
2674
+ } else if ($) {
2675
+ if (Ne(l))
2676
+ return;
2677
+ e[o] = n = n._clone ? n._clone() : $e(n), l = null, h = !0;
2678
+ }
2679
+ }
2680
+ if (l)
2681
+ l.originType !== l.rule.type && l.updateType(), this.bindParser(l), this.appendValue(l.rule);
2682
+ else {
2683
+ const $ = this.parseRule(n);
2684
+ l = new ut(this, $, b), this.bindParser(l);
2685
+ }
2686
+ if ([!1, !0].forEach(($) => this.parseEmit(l, $)), this.syncProp(l), l.parent = r || null, l.root = e, this.setCtx(l), !h && !g && this.effect(l, "load"), this.effect(l, "created"), l.parser.loadChildren === !1 || s(l.rule.children, l), !r) {
2687
+ const $ = i(o);
2688
+ $ > -1 || !o ? this.sort.splice($ + 1, 0, l.id) : this.sort.push(l.id);
2689
+ }
2690
+ const k = l.rule;
2691
+ return l.updated || (l.updated = !0, c.Function(k.update) && this.bus.$once("load-end", () => {
2692
+ this.refreshUpdate(l, k.value, "init");
2693
+ }), this.effect(l, "loaded")), l.input && Object.defineProperty(k, "value", this.valueHandle(l)), this.refreshControl(l) && (this.cycleLoad = !0), l;
2694
+ });
2695
+ },
2696
+ refreshControl(e) {
2697
+ return e.input && e.rule.control && this.useCtrl(e);
2698
+ },
2699
+ useCtrl(e) {
2700
+ const r = gr(e), i = [], s = this.api;
2701
+ if (!r.length) return !1;
2702
+ for (let a = 0; a < r.length; a++) {
2703
+ const u = r[a], l = u.handle || function(g) {
2704
+ return (W[u.condition || "=="] || W["=="])(g, u.value);
2705
+ };
2706
+ if (!c.trueArray(u.rule)) continue;
2707
+ const h = q(y({}, u), {
2708
+ valid: j(() => l(e.rule.value, s)),
2709
+ ctrl: $r(e, u.rule),
2710
+ isHidden: c.String(u.rule[0])
2711
+ });
2712
+ h.valid && h.ctrl || !h.valid && !h.ctrl && !h.isHidden || i.push(h);
2713
+ }
2714
+ if (!i.length) return !1;
2715
+ const n = [];
2716
+ let o = !1;
2717
+ return this.deferSyncValue(() => {
2718
+ i.reverse().forEach(({ isHidden: a, valid: u, rule: l, prepend: h, append: g, child: b, ctrl: k, method: $ }) => {
2719
+ if (a) {
2720
+ u ? e.ctrlRule.push({
2721
+ __ctrl: !0,
2722
+ children: l,
2723
+ valid: u
2724
+ }) : k && e.ctrlRule.splice(e.ctrlRule.indexOf(k) >>> 0, 1), n[u ? "push" : "unshift"](() => {
2725
+ $ === "disabled" || $ === "enabled" ? this.api.disabled(!u, l) : $ === "display" ? this.api.display(u, l) : $ === "required" ? (l.forEach((O) => {
2726
+ this.api.setEffect(O, "required", u);
2727
+ }), u || this.api.clearValidateState(l)) : this.api.hidden(!u, l);
2728
+ });
2729
+ return;
2730
+ }
2731
+ if (u) {
2732
+ o = !0;
2733
+ const O = {
2734
+ type: "fcFragment",
2735
+ native: !0,
2736
+ __ctrl: !0,
2737
+ children: l
2738
+ };
2739
+ e.ctrlRule.push(O), this.bus.$once("load-start", () => {
2740
+ h ? s.prepend(O, h, b) : g || b ? s.append(O, g || e.id, b) : e.root.splice(e.root.indexOf(e.origin) + 1, 0, O);
2741
+ });
2742
+ } else {
2743
+ e.ctrlRule.splice(e.ctrlRule.indexOf(k), 1);
2744
+ const O = Z(k);
2745
+ O && O.rm();
2746
+ }
2747
+ });
2748
+ }), n.length && this.vm.$nextTick(() => {
2749
+ n.forEach((a) => a());
2750
+ }), this.vm.$emit("control", e.origin, this.api), this.effect(e, "control"), o;
2751
+ },
2752
+ reloadRule(e) {
2753
+ return this._reloadRule(e);
2754
+ },
2755
+ _reloadRule(e) {
2756
+ e || (e = this.rules);
2757
+ const r = y({}, this.ctxs);
2758
+ this.clearNextTick(), this.$render.clearOrgChildren(), this.initData(e), this.fc.rules = e, this.deferSyncValue(() => {
2759
+ this.bus.$once("load-end", () => {
2760
+ Object.keys(r).filter((i) => this.ctxs[i] === void 0).forEach((i) => this.rmCtx(r[i])), this.$render.clearCacheAll();
2761
+ }), this.reloading = !0, this.loadRule(), this.reloading = !1, this.refresh(), this.vm.$emit("reloading", this.api);
2762
+ }), this.bus.$off("next-tick", this.nextReload), this.bus.$once("next-tick", this.nextReload), this.vm.$emit("update", this.api);
2763
+ },
2764
+ //todo 组件生成全部通过 alias
2765
+ refresh() {
2766
+ this.vm._refresh();
2767
+ }
2768
+ });
2769
+ }
2770
+ function yr(t) {
2771
+ const e = it();
2772
+ return Object.keys(e).forEach((r) => {
2773
+ w(t, r) || F(t, r, e[r]);
2774
+ }), t;
2775
+ }
2776
+ function gr(t) {
2777
+ const e = t.rule.control || [];
2778
+ return c.Object(e) ? [e] : e;
2779
+ }
2780
+ function $r(t, e) {
2781
+ for (let r = 0; r < t.ctrlRule.length; r++) {
2782
+ const i = t.ctrlRule[r];
2783
+ if (i.children === e)
2784
+ return i;
2785
+ }
2786
+ }
2787
+ function Ne(t) {
2788
+ return !!t.rule.__ctrl;
2789
+ }
2790
+ function vr(t) {
2791
+ m(t.prototype, {
2792
+ getValue(e) {
2793
+ return c.Undef(e.cacheValue) && (e.cacheValue = e.parser.toValue(this.getFormData(e), e)), e.cacheValue;
2794
+ },
2795
+ setValue(e, r, i, s) {
2796
+ 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, {
2797
+ rule: e.origin,
2798
+ api: this.api,
2799
+ setFlag: s || !1
2800
+ }));
2801
+ },
2802
+ onInput(e, r) {
2803
+ let i;
2804
+ e.input && (this.isQuote(e, i = e.parser.toValue(r, e)) || this.isChange(e, i)) && this.setValue(e, i, r);
2805
+ },
2806
+ setFormData(e, r) {
2807
+ F(this.formData, e.id, r === null ? void 0 : r);
2808
+ },
2809
+ getFormData(e) {
2810
+ return this.formData[e.id];
2811
+ },
2812
+ validate() {
2813
+ return qe(this.vm.validate), this.fields().forEach((e) => {
2814
+ this.fieldCtx[e].forEach((r) => {
2815
+ this.vm.validate[r.id] = I(r.rule.validate);
2816
+ });
2817
+ }), this.vm.validate;
2818
+ },
2819
+ syncForm() {
2820
+ qe(this.form), Object.defineProperties(this.form, this.fields().reduce((e, r) => {
2821
+ const i = this.getFieldCtx(r), s = this.valueHandle(i);
2822
+ return s.configurable = !0, e[r] = s, e;
2823
+ }, this.options.appendValue !== !1 ? Object.keys(this.appendData).reduce((e, r) => (e[r] = {
2824
+ enumerable: !0,
2825
+ configurable: !0,
2826
+ get: () => this.appendData[r],
2827
+ set: (i) => {
2828
+ this.appendData[r] = i;
2829
+ }
2830
+ }, e), {}) : {})), this.syncValue();
2831
+ },
2832
+ valueHandle(e) {
2833
+ return {
2834
+ enumerable: !0,
2835
+ get: () => this.getValue(e),
2836
+ set: (r) => {
2837
+ this.isChange(e, r) && this.setValue(e, r, e.parser.toFormValue(r, e), !0);
2838
+ }
2839
+ };
2840
+ },
2841
+ appendValue(e) {
2842
+ !e.field || !w(this.appendData, e.field) || (e.value = this.appendData[e.field], delete this.appendData[e.field]);
2843
+ },
2844
+ addSubForm(e, r) {
2845
+ this.subForm[e.id] = r;
2846
+ },
2847
+ deferSyncValue(e, r) {
2848
+ this.deferSyncFn || (this.deferSyncFn = e), this.deferSyncFn.sync || (this.deferSyncFn.sync = r), j(e), this.deferSyncFn === e && (this.deferSyncFn = null, e.sync && this.syncValue());
2849
+ },
2850
+ syncValue() {
2851
+ if (this.deferSyncFn)
2852
+ return this.deferSyncFn.sync = !0;
2853
+ this.vm._updateValue(y(y({}, this.options.appendValue !== !1 ? this.appendData : {}), this.form));
2854
+ },
2855
+ isChange(e, r) {
2856
+ return JSON.stringify(e.rule.value, Me) !== JSON.stringify(r === null ? void 0 : r, Me);
2857
+ },
2858
+ isQuote(e, r) {
2859
+ return (c.Object(r) || Array.isArray(r)) && r === e.rule.value;
2860
+ },
2861
+ refreshUpdate(e, r, i, s) {
2862
+ if (c.Function(e.rule.update)) {
2863
+ const n = j(() => e.rule.update(r, e.origin, this.api, {
2864
+ origin: i || "change",
2865
+ linkField: s
2866
+ }));
2867
+ if (n === void 0) return;
2868
+ e.rule.hidden = n === !0;
2869
+ }
2870
+ },
2871
+ valueChange(e, r) {
2872
+ this.refreshRule(e, r), this.bus.$emit("change-" + e.field, r);
2873
+ },
2874
+ refreshRule(e, r, i, s) {
2875
+ this.refreshControl(e) && (this.$render.clearCacheAll(), this.loadRule(), this.vm.$emit("update", this.api), this.refresh()), this.refreshUpdate(e, r, i, s);
2876
+ },
2877
+ appendLink(e) {
2878
+ const r = e.rule.link;
2879
+ c.trueArray(r) && r.forEach((i) => {
2880
+ const s = () => this.refreshRule(e, e.rule.value, "link", i);
2881
+ this.bus.$on("change-" + i, s), e.linkOn.push(() => this.bus.$off("change-" + i, s));
2882
+ });
2883
+ },
2884
+ fields() {
2885
+ return Object.keys(this.fieldCtx);
2886
+ }
2887
+ });
2888
+ }
2889
+ function Me(t, e) {
2890
+ return typeof e == "function" ? "" + e : e;
2891
+ }
2892
+ function qe(t) {
2893
+ Object.keys(t).forEach((e) => delete t[e]);
2894
+ }
2895
+ const ce = {
2896
+ init(t) {
2897
+ },
2898
+ toFormValue(t, e) {
2899
+ return t;
2900
+ },
2901
+ toValue(t, e) {
2902
+ return t;
2903
+ },
2904
+ mounted(t) {
2905
+ },
2906
+ render(t, e) {
2907
+ return e.$render.defaultRender(e, t);
2908
+ },
2909
+ preview(t, e) {
2910
+ return this.render(t, e);
2911
+ },
2912
+ mergeProp(t) {
2913
+ }
2914
+ }, br = ["field", "value", "vm", "template", "name", "config", "control", "inject", "sync", "payload", "optionsTo", "update", "component", "cache"];
2915
+ function Cr(t) {
2916
+ m(t.prototype, {
2917
+ getCtx(e) {
2918
+ return this.getFieldCtx(e) || this.getNameCtx(e)[0] || this.ctxs[e];
2919
+ },
2920
+ getCtxs(e) {
2921
+ return this.fieldCtx[e] || this.nameCtx[e] || (this.ctxs[e] ? [this.ctxs[e]] : []);
2922
+ },
2923
+ setIdCtx(e, r, i) {
2924
+ const s = `${i}Ctx`;
2925
+ this[s][r] ? this[s][r].push(e) : this[s][r] = [e];
2926
+ },
2927
+ rmIdCtx(e, r, i) {
2928
+ const s = `${i}Ctx`, n = this[s][r];
2929
+ if (!n) return !1;
2930
+ const o = n.splice(n.indexOf(e) >>> 0, 1).length > 0;
2931
+ return n.length || delete this[s][r], o;
2932
+ },
2933
+ getFieldCtx(e) {
2934
+ return (this.fieldCtx[e] || [])[0];
2935
+ },
2936
+ getNameCtx(e) {
2937
+ return this.nameCtx[e] || [];
2938
+ },
2939
+ setCtx(e) {
2940
+ let { id: r, field: i, name: s, rule: n } = e;
2941
+ 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));
2942
+ },
2943
+ getParser(e) {
2944
+ const r = this.fc.parsers;
2945
+ return r[e.originType] || r[A(e.type)] || r[e.trueType] || ce;
2946
+ },
2947
+ bindParser(e) {
2948
+ e.setParser(this.getParser(e));
2949
+ },
2950
+ getType(e) {
2951
+ const r = this.fc.CreateNode.aliasMap, i = r[e] || r[A(e)] || e;
2952
+ return A(i);
2953
+ },
2954
+ noWatch(e) {
2955
+ this.noWatchFn || (this.noWatchFn = e), j(e), this.noWatchFn === e && (this.noWatchFn = null);
2956
+ },
2957
+ watchCtx(e) {
2958
+ const r = this.vm;
2959
+ Object.keys(e.rule).filter((i) => i[0] !== "_" && i[0] !== "$" && br.indexOf(i) === -1).forEach((i) => {
2960
+ const s = i === "children";
2961
+ e.watch.push(r.$watch(() => e.rule[i], (n, o) => {
2962
+ if (!(this.loading || this.noWatchFn || this.reloading)) {
2963
+ if (s && e.parser.loadChildren === !1) {
2964
+ this.$render.clearCache(e), this.nextRefresh();
2965
+ return;
2966
+ }
2967
+ if (this.watching = !0, i === "link") {
2968
+ e.link();
2969
+ return;
2970
+ } else if (["props", "on", "nativeOn", "deep"].indexOf(i) > -1)
2971
+ this.parseInjectEvent(e.rule, n || {}), i === "props" && e.input && this.setFormData(e, e.parser.toFormValue(e.rule.value, e));
2972
+ else if (["emit", "nativeEmit"].indexOf(i) > -1)
2973
+ this.parseEmit(e, i === "emit");
2974
+ else if (["prefix", "suffix"].indexOf(i) > -1)
2975
+ n && this.loadFn(n, e.rule);
2976
+ else if (i === "type")
2977
+ e.updateType(), this.bindParser(e);
2978
+ else if (i === "children") {
2979
+ const a = c.trueArray(n);
2980
+ this.deferSyncValue(() => {
2981
+ n !== o && (this.rmSub(o, e), this.$render.initOrgChildren()), a && this.loadChildren(n, e), this.vm.$emit("update", this.api);
2982
+ });
2983
+ }
2984
+ this.$render.clearCache(e), this.refresh(), this.watching = !1;
2985
+ }
2986
+ }, { deep: !s, sync: s }));
2987
+ }), this.watchEffect(e);
2988
+ },
2989
+ rmSub(e, r) {
2990
+ c.trueArray(e) && e.forEach((i) => {
2991
+ i && i.__fc__ && i.__fc__.parent === r && this.rmCtx(i.__fc__);
2992
+ });
2993
+ },
2994
+ rmCtx(e) {
2995
+ if (e.deleted) return;
2996
+ const { id: r, field: i, input: s, name: n } = e;
2997
+ e.input && Object.defineProperty(e.rule, "value", {
2998
+ value: e.rule.value,
2999
+ writable: !0
3000
+ }), L(this.ctxs, r), L(this.$render.tempList, r), L(this.$render.orgChildren, r), L(this.vm.ctxInject, r), L(this.formData, r), L(this.subForm, r), L(e, "cacheValue"), s && this.rmIdCtx(e, i, "field"), n && this.rmIdCtx(e, n, "name"), s && !w(this.fieldCtx, i) && L(this.form, i), this.deferSyncValue(() => {
3001
+ 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());
3002
+ }, s);
3003
+ const o = this.sort.indexOf(r);
3004
+ 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;
3005
+ }
3006
+ });
3007
+ }
3008
+ function _r(t) {
3009
+ m(t.prototype, {
3010
+ mounted() {
3011
+ const e = () => {
3012
+ this.isMounted = !0, this.lifecycle("mounted");
3013
+ };
3014
+ this.pageEnd ? e() : this.bus.$once("page-end", e);
3015
+ },
3016
+ lifecycle(e) {
3017
+ this.vm.$emit(e, this.api), this.emitEvent(e, this.api);
3018
+ },
3019
+ emitEvent(e, ...r) {
3020
+ const i = this.options[e] || this.options[A("on-" + e)];
3021
+ if (i) {
3022
+ const s = U(i);
3023
+ c.Function(s) && j(() => s(...r));
3024
+ }
3025
+ this.bus.$emit(e, ...r);
3026
+ }
3027
+ });
3028
+ }
3029
+ function kr(t) {
3030
+ m(t.prototype, {
3031
+ useProvider() {
3032
+ const e = this.fc.providers;
3033
+ Object.keys(e).forEach((r) => {
3034
+ let i = e[r];
3035
+ c.Function(i) && (i = i(this.fc)), i._c = wr(i), this.onEffect(i), this.providers[r] = i;
3036
+ });
3037
+ },
3038
+ onEffect(e) {
3039
+ const r = [];
3040
+ (e._c || ["*"]).forEach((i) => {
3041
+ const s = i === "*" ? "*" : this.getType(i);
3042
+ r.indexOf(s) > -1 || (r.push(s), this.bus.$on(`p:${e.name}:${s}:${e.input ? 1 : 0}`, (n, o) => {
3043
+ e[n] && e[n](...o);
3044
+ }));
3045
+ }), e._used = r;
3046
+ },
3047
+ watchEffect(e) {
3048
+ const r = this.vm;
3049
+ let i = {
3050
+ required: () => {
3051
+ var s, n;
3052
+ return (w(e.rule, "$required") ? e.rule.$required : (n = (s = e.rule) == null ? void 0 : s.effect) == null ? void 0 : n.required) || !1;
3053
+ }
3054
+ };
3055
+ Object.keys(e.rule.effect || {}).forEach((s) => {
3056
+ i[s] = () => e.rule.effect[s];
3057
+ }), Object.keys(e.rule).forEach((s) => {
3058
+ s[0] === "$" && (i[s.substr(1)] = () => e.rule[s]);
3059
+ }), Object.keys(i || {}).forEach((s) => {
3060
+ e.watch.push(r.$watch(i[s], (n) => {
3061
+ this.effect(e, "watch", { [s]: n });
3062
+ }, { deep: !0 }));
3063
+ });
3064
+ },
3065
+ ruleEffect(e, r, i) {
3066
+ this.emitEffect({
3067
+ rule: e,
3068
+ input: !!e.field,
3069
+ type: this.getType(e.type)
3070
+ }, r, i);
3071
+ },
3072
+ effect(e, r, i) {
3073
+ this.emitEffect({
3074
+ rule: e.rule,
3075
+ input: e.input,
3076
+ type: e.trueType,
3077
+ ctx: e,
3078
+ custom: i
3079
+ }, r);
3080
+ },
3081
+ getEffect(e, r) {
3082
+ if (w(e, "$" + r))
3083
+ return e["$" + r];
3084
+ if (w(e, "effect") && w(e.effect, r))
3085
+ return e.effect[r];
3086
+ },
3087
+ emitEffect({ ctx: e, rule: r, input: i, type: s, custom: n }, o, a) {
3088
+ if (!s || s === "fcFragment") return;
3089
+ const u = n || Object.keys(r).reduce((l, h) => (h[0] === "$" && (l[h.substr(1)] = r[h]), l), y({}, r.effect || {}));
3090
+ Object.keys(u).forEach((l) => {
3091
+ const h = this.providers[l];
3092
+ if (!h || h.input && !i) return;
3093
+ let g;
3094
+ if (!h._c)
3095
+ g = "*";
3096
+ else if (h._used.indexOf(s) > -1)
3097
+ g = s;
3098
+ else
3099
+ return;
3100
+ const b = y({ value: u[l], getValue: () => this.getEffect(r, l) }, a || {});
3101
+ e && (b.getProp = () => e.effectData(l), b.clearProp = () => e.clearEffectData(l), b.mergeProp = (k) => H(b.getProp(), [k]), b.id = e.id), this.bus.$emit(`p:${l}:${g}:${h.input ? 1 : 0}`, o, [b, r, this.api]);
3102
+ });
3103
+ }
3104
+ });
3105
+ }
3106
+ function Or(t) {
3107
+ return t.filter(function(e, r, i) {
3108
+ return i.indexOf(e, 0) === r;
3109
+ });
3110
+ }
3111
+ function wr(t) {
3112
+ const e = t.components;
3113
+ if (Array.isArray(e)) {
3114
+ const r = Or(e.filter((i) => i !== "*"));
3115
+ return r.length ? r : !1;
3116
+ } else return c.String(e) ? [e] : !1;
3117
+ }
3118
+ function P(t) {
3119
+ m(this, {
3120
+ fc: t,
3121
+ vm: t.vm,
3122
+ watching: !1,
3123
+ loading: !1,
3124
+ reloading: !1,
3125
+ noWatchFn: null,
3126
+ deferSyncFn: null,
3127
+ isMounted: !1,
3128
+ formData: {},
3129
+ subForm: {},
3130
+ form: {},
3131
+ appendData: {},
3132
+ providers: {},
3133
+ cycleLoad: null,
3134
+ loadedId: 1,
3135
+ nextTick: null,
3136
+ changeStatus: !1,
3137
+ pageEnd: !0,
3138
+ nextReload: () => {
3139
+ this.lifecycle("reload");
3140
+ }
3141
+ }), rt(this, {
3142
+ options() {
3143
+ return t.options;
3144
+ },
3145
+ bus() {
3146
+ return t.bus;
3147
+ }
3148
+ }), this.initData(t.rules), this.$manager = new t.manager(this), this.$render = new be(this), this.api = t.extendApi(or(this), this);
3149
+ }
3150
+ m(P.prototype, {
3151
+ initData(t) {
3152
+ m(this, {
3153
+ ctxs: {},
3154
+ fieldCtx: {},
3155
+ nameCtx: {},
3156
+ sort: [],
3157
+ rules: t
3158
+ });
3159
+ },
3160
+ init() {
3161
+ 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);
3162
+ },
3163
+ beforeFetch(t) {
3164
+ return new Promise((e) => {
3165
+ const r = this.options.beforeFetch && j(() => this.options.beforeFetch(t, { api: this.api }));
3166
+ r && c.Function(r.then) ? r.then(e) : e();
3167
+ });
3168
+ }
3169
+ });
3170
+ fr(P);
3171
+ hr(P);
3172
+ dr(P);
3173
+ mr(P);
3174
+ vr(P);
3175
+ Cr(P);
3176
+ _r(P);
3177
+ kr(P);
3178
+ const Fr = "fcFragment", ie = {
3179
+ name: Fr,
3180
+ functional: !0,
3181
+ props: ["vnode"],
3182
+ render(t, e) {
3183
+ return e.props.vnode ? e.props.vnode : e.children;
3184
+ }
3185
+ };
3186
+ function Sr(t) {
3187
+ return c.String(t) ? { domProps: { innerHTML: t } } : t;
3188
+ }
3189
+ function Rr() {
3190
+ const t = {};
3191
+ function e(r) {
3192
+ r && this.setVm(r);
3193
+ }
3194
+ return m(e.prototype, {
3195
+ setVm(r) {
3196
+ this.vm = r, this.$h = r.$createElement;
3197
+ },
3198
+ make(r, i, s) {
3199
+ return D.config.isReservedTag(r) && i.nativeOn && delete i.nativeOn, this.makeComponent(r, i, s);
3200
+ },
3201
+ makeComponent(r, i, s) {
3202
+ let n = this.$h(r, Sr(i), s || []);
3203
+ return n.context = this.vm, n;
3204
+ },
3205
+ aliasMap: t
3206
+ }), m(e, {
3207
+ aliasMap: t,
3208
+ alias(r, i) {
3209
+ t[r] = i;
3210
+ },
3211
+ use(r) {
3212
+ Object.keys(r).forEach((i) => {
3213
+ const s = Y(i), n = lt(i).toLocaleLowerCase(), o = r[i];
3214
+ [i, s, n].forEach((a) => {
3215
+ e.alias(i, o), e.prototype[a] = function(u, l) {
3216
+ return this.make(o, u, l);
3217
+ };
3218
+ });
3219
+ });
3220
+ }
3221
+ }), e;
3222
+ }
3223
+ function Er(t) {
3224
+ class e extends ft {
3225
+ }
3226
+ return Object.assign(e.prototype, t), e;
3227
+ }
3228
+ function ft(t) {
3229
+ m(this, {
3230
+ $handle: t,
3231
+ vm: t.vm,
3232
+ options: {},
3233
+ ref: "fcForm",
3234
+ mergeOptionsRule: {
3235
+ normal: ["form", "row", "info", "submitBtn", "resetBtn"]
3236
+ }
3237
+ }), this.updateKey(), this.init();
3238
+ }
3239
+ m(ft.prototype, {
3240
+ __init() {
3241
+ this.$render = this.$handle.$render, this.$r = (...t) => this.$render.renderRule(...t);
3242
+ },
3243
+ updateKey() {
3244
+ this.key = re();
3245
+ },
3246
+ //TODO interface
3247
+ init() {
3248
+ },
3249
+ update() {
3250
+ },
3251
+ beforeRender() {
3252
+ },
3253
+ form() {
3254
+ return this.vm.$refs[this.ref];
3255
+ },
3256
+ getSlot(t) {
3257
+ const e = (r) => {
3258
+ if (r) {
3259
+ let i = r.$scopedSlots[t];
3260
+ return i || e(r.$pfc);
3261
+ }
3262
+ };
3263
+ return e(this.vm);
3264
+ },
3265
+ mergeOptions(t, e) {
3266
+ return B(t.map((r) => this.tidyOptions(r)), e, this.mergeOptionsRule);
3267
+ },
3268
+ updateOptions(t) {
3269
+ this.options = this.mergeOptions([t], this.getDefaultOptions()), this.update();
3270
+ },
3271
+ tidyOptions(t) {
3272
+ return t;
3273
+ },
3274
+ tidyRule(t) {
3275
+ },
3276
+ mergeProp(t) {
3277
+ },
3278
+ getDefaultOptions() {
3279
+ return {};
3280
+ },
3281
+ render(t) {
3282
+ }
3283
+ });
3284
+ const jr = function(t) {
3285
+ const e = {
3286
+ name: "loadData",
3287
+ _fn: [],
3288
+ created(r, i, s) {
3289
+ this.deleted(r);
3290
+ let n = I(r.getValue());
3291
+ const o = [];
3292
+ n.forEach((a) => {
3293
+ if (a) {
3294
+ const u = () => {
3295
+ a.watch !== !1 && (t.bus.$off("p.loadData." + a.attr, u), t.bus.$once("p.loadData." + a.attr, u));
3296
+ let l;
3297
+ a.attr && (l = t.loadData[a.attr] || a.default, a.copy !== !1 && (l = N(l))), ee(r.getProp(), a.to || "options", l), s.sync(i);
3298
+ };
3299
+ o.push(() => t.bus.$off("p.loadData." + a.attr, u)), u();
3300
+ }
3301
+ }), this._fn[r.id] = o;
3302
+ },
3303
+ deleted(r) {
3304
+ this._fn[r.id] && (this._fn[r.id].forEach((i) => {
3305
+ i();
3306
+ }), delete this._fn[r.id]), r.clearProp();
3307
+ }
3308
+ };
3309
+ return e.watch = e.created, e;
3310
+ }, ht = {
3311
+ name: "componentValidate",
3312
+ load(t, e, r) {
3313
+ const i = t.getValue();
3314
+ i ? t.getProp().validate = [{
3315
+ validator(...s) {
3316
+ const n = Z(e);
3317
+ if (n)
3318
+ return r.exec(n.id, i === !0 ? "formCreateValidate" : i, ...s, {
3319
+ attr: t,
3320
+ rule: e,
3321
+ api: r
3322
+ });
3323
+ }
3324
+ }] : (t.clearProp(), r.clearValidateState([e.field]));
3325
+ },
3326
+ watch(...t) {
3327
+ ht.load(...t);
3328
+ }
3329
+ }, Ir = function(t) {
3330
+ function e(i) {
3331
+ return c.String(i) && (i = {
3332
+ action: i,
3333
+ to: "options"
3334
+ }), i;
3335
+ }
3336
+ function r(i, s, n) {
3337
+ let o = i.value;
3338
+ const a = (g) => {
3339
+ g === void 0 ? (i.clearProp(), n.sync(s)) : ee(i.getProp(), o.to || "options", g);
3340
+ };
3341
+ if (c.Function(o) && (o = o(s, n)), o = e(o), !o || !o.action) {
3342
+ a(void 0);
3343
+ return;
3344
+ }
3345
+ o = N(o), o.to || (o.to = "options");
3346
+ const u = o.onError, l = () => {
3347
+ if (!i.getValue())
3348
+ return i.clearProp(), n.sync(s), !0;
3349
+ }, h = q(y({
3350
+ headers: {}
3351
+ }, o), {
3352
+ onSuccess(g, b) {
3353
+ if (l()) return;
3354
+ let k = ($) => b ? $ : w($, "data") ? $.data : $;
3355
+ c.Function(o.parse) ? k = o.parse : o.parse && c.String(o.parse) && (k = ($) => (o.parse.split(".").forEach((O) => {
3356
+ $ && ($ = $[O]);
3357
+ }), $)), a(k(g, s, n)), n.sync(s);
3358
+ },
3359
+ onError(g) {
3360
+ a(void 0), !l() && (u || ((b) => ge(b.message || "fetch fail " + o.action)))(g, s, n);
3361
+ }
3362
+ });
3363
+ t.$handle.beforeFetch(h, { rule: s, api: n }).then(() => {
3364
+ if (c.Function(o.action)) {
3365
+ o.action(s, n).then((g) => {
3366
+ h.onSuccess(g, !0);
3367
+ }).catch((g) => {
3368
+ h.onError(g);
3369
+ });
3370
+ return;
3371
+ }
3372
+ j(() => t.create.fetch(h, { inject: i, rule: s, api: n }));
3373
+ });
3374
+ }
3375
+ return {
3376
+ name: "fetch",
3377
+ loaded(...i) {
3378
+ r(...i);
3379
+ },
3380
+ watch(...i) {
3381
+ r(...i);
3382
+ }
3383
+ };
3384
+ }, ct = {
3385
+ name: "required",
3386
+ load(t, e, r) {
3387
+ const i = Ar(t.getValue());
3388
+ if (i.required === !1)
3389
+ t.clearProp(), r.clearValidateState([e.field]);
3390
+ else {
3391
+ const s = y({
3392
+ required: !0,
3393
+ validator(n, o, a) {
3394
+ c.empty(o) ? a(s.message) : a();
3395
+ }
3396
+ }, i);
3397
+ if (!s.message) {
3398
+ let n = e.title || "";
3399
+ s.message = ((typeof n == "object" ? n.title : n) || "") + "不能为空";
3400
+ }
3401
+ t.getProp().validate = [s];
3402
+ }
3403
+ r.sync(e);
3404
+ },
3405
+ watch(...t) {
3406
+ ct.load(...t);
3407
+ }
3408
+ };
3409
+ function Ar(t) {
3410
+ 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 : {};
3411
+ }
3412
+ const Vr = {
3413
+ fetch: Ir,
3414
+ loadData: jr,
3415
+ required: ct,
3416
+ componentValidate: ht
3417
+ }, Pr = "html", Tr = {
3418
+ name: Pr,
3419
+ loadChildren: !1,
3420
+ render(t, e) {
3421
+ return e.prop.domProps || (e.prop.domProps = {}), e.prop.domProps.innerHTML = t, e.vNode.make(e.prop.props.tag || "div", e.prop);
3422
+ },
3423
+ renderChildren(t) {
3424
+ return Array.isArray(t.rule.children) ? t.rule.children.filter((e) => c.String(e)).join("") : "";
3425
+ }
3426
+ };
3427
+ function Dr(t, e) {
3428
+ let r;
3429
+ return arguments.length === 2 ? (r = arguments[1], e = r[t]) : r = arguments[2], { id: e, prop: r };
3430
+ }
3431
+ function ne() {
3432
+ return Dr("name", ...arguments);
3433
+ }
3434
+ function Ue(t) {
3435
+ return !t || !t.el ? window.document.body : c.Element(t.el) ? t.el : document.querySelector(t.el);
3436
+ }
3437
+ function He(t, e) {
3438
+ const r = new D({
3439
+ data() {
3440
+ return { rule: t, option: e || {} };
3441
+ },
3442
+ render(i) {
3443
+ return i("FormCreate", { ref: "fc", props: this.$data });
3444
+ }
3445
+ });
3446
+ return r.$mount(), r;
3447
+ }
3448
+ function Br(t) {
3449
+ const e = t.key || [], r = t.array || [], i = t.normal || [];
3450
+ Ze.push(...e), pe.push(...r), me.push(...i), nt([...e, ...r, ...i]);
3451
+ }
3452
+ let Lr = 1;
3453
+ const E = {};
3454
+ function dt(t) {
3455
+ const e = {
3456
+ [ie.name]: ie
3457
+ }, r = {}, i = {}, s = y({}, Vr), n = ir();
3458
+ let o = { global: {} };
3459
+ const a = {}, u = Rr(), l = {};
3460
+ Br(t.attrs || {});
3461
+ function h(f) {
3462
+ const d = E[f];
3463
+ if (Array.isArray(d))
3464
+ return d.map((v) => v.api());
3465
+ if (d)
3466
+ return d.api();
3467
+ }
3468
+ function g() {
3469
+ const f = ne(...arguments);
3470
+ f.id && f.prop && (i[f.id] = f.prop);
3471
+ }
3472
+ function b() {
3473
+ const f = ne(...arguments);
3474
+ f.id && f.prop && (s[f.id] = q(y({}, f.prop), { name: f.id }));
3475
+ }
3476
+ function k(f) {
3477
+ u.use(f);
3478
+ }
3479
+ function $() {
3480
+ const f = ne(...arguments);
3481
+ if (!f.id || !f.prop) return ce;
3482
+ const d = A(f.id), v = f.prop, C = v.merge === !0 ? r[d] : void 0;
3483
+ r[d] = v, Object.setPrototypeOf(v, C || ce), n[d] = R(d), v.maker && m(n, v.maker);
3484
+ }
3485
+ function O(f, d) {
3486
+ let v;
3487
+ if (c.String(f)) {
3488
+ if (v = A(f), ["form-create", "formcreate"].indexOf(v) > -1)
3489
+ return X();
3490
+ if (d === void 0)
3491
+ return e[v];
3492
+ } else
3493
+ v = A(f.name), d = f;
3494
+ if (!v || !d) return;
3495
+ const C = A(v);
3496
+ e[v] = d, e[C] = d, delete u.aliasMap[v], delete u.aliasMap[C], delete r[v], delete r[C], d.formCreateParser && $(v, d.formCreateParser);
3497
+ }
3498
+ function Ce(f) {
3499
+ Object.keys(E).forEach((d) => {
3500
+ (Array.isArray(E[d]) ? E[d] : [E[d]]).forEach((C) => {
3501
+ C.bus.$emit("p.loadData." + f);
3502
+ });
3503
+ });
3504
+ }
3505
+ function _e(f, d) {
3506
+ a[f] = d, Ce(f);
3507
+ }
3508
+ function ke(f, d) {
3509
+ return w(a, f) ? a[f] : d;
3510
+ }
3511
+ function pt(f) {
3512
+ delete a[f], Ce(f);
3513
+ }
3514
+ function X() {
3515
+ return Xt(we, e, i);
3516
+ }
3517
+ function Oe() {
3518
+ return ie;
3519
+ }
3520
+ function mt(f, d) {
3521
+ return c.Function(f.install) ? f.install(M, d) : c.Function(f) && f(M, d), this;
3522
+ }
3523
+ function M(f, d, v) {
3524
+ let C = He(f, d || {});
3525
+ const V = C.$refs.fc.formCreate;
3526
+ return V.$parent = v, Ue(V.options).appendChild(C.$el), V.api();
3527
+ }
3528
+ Object.setPrototypeOf(M, l);
3529
+ function yt(f) {
3530
+ let d = y({}, t);
3531
+ return f ? d.inherit = {
3532
+ components: e,
3533
+ parsers: r,
3534
+ directives: i,
3535
+ providers: s,
3536
+ maker: n,
3537
+ loadData: a
3538
+ } : delete d.inherit, dt(d);
3539
+ }
3540
+ function we(f) {
3541
+ const d = f.$options.propsData.rule;
3542
+ m(this, {
3543
+ id: Lr++,
3544
+ vm: f,
3545
+ create: M,
3546
+ manager: Er(t.manager),
3547
+ parsers: r,
3548
+ providers: s,
3549
+ rules: Array.isArray(d) ? d : [],
3550
+ name: f.$options.propsData.name || re(),
3551
+ inFor: f.$options.propsData.inFor,
3552
+ prop: {
3553
+ components: e,
3554
+ directives: i
3555
+ },
3556
+ setData: _e,
3557
+ getData: ke,
3558
+ loadData: a,
3559
+ CreateNode: u,
3560
+ bus: new D(),
3561
+ unwatch: null,
3562
+ options: {},
3563
+ extendApi: t.extendApi || ((v) => v)
3564
+ }), this.init(), this.initOptions(), this.name && (this.inFor ? (E[this.name] || (E[this.name] = []), E[this.name].push(this)) : E[this.name] = this);
3565
+ }
3566
+ m(we.prototype, {
3567
+ init() {
3568
+ const f = this.vm, d = new P(this);
3569
+ this.$handle = d, f.$f = d.api, f.$emit("input", d.api), f.$on("hook:created", () => {
3570
+ this.isSub() && (this.unwatch = f.$watch(() => f.$pfc.option, () => {
3571
+ this.initOptions(), f.$f.refresh();
3572
+ }, { deep: !0 }), this.initOptions()), this.created();
3573
+ }), f.$on("hook:mounted", () => {
3574
+ this.mounted();
3575
+ }), f.$on("hook:beforeDestroy", () => {
3576
+ if (f.destroyed = !0, this.unwatch && this.unwatch(), d.reloadRule([]), this.name)
3577
+ if (this.inFor) {
3578
+ const v = E[this.name].indexOf(this);
3579
+ E[this.name].splice(v, 1), E[this.name].length || delete E[this.name];
3580
+ } else
3581
+ delete E[this.name];
3582
+ }), f.$on("hook:updated", () => {
3583
+ d.bindNextTick(() => this.bus.$emit("next-tick", d.api));
3584
+ });
3585
+ },
3586
+ isSub() {
3587
+ return this.vm.$pfc && this.vm.extendOption;
3588
+ },
3589
+ initOptions() {
3590
+ this.options = {};
3591
+ let f = y({ formData: {}, submitBtn: {}, resetBtn: {} }, N(o));
3592
+ this.isSub() && this.mergeOptions(this.options, this.vm.$pfc.$f.config || {}, !0), f = this.mergeOptions(f, this.vm.$options.propsData.option), this.updateOptions(f);
3593
+ },
3594
+ mergeOptions(f, d, v) {
3595
+ return d = N(d), v && ["page", "onSubmit", "mounted", "reload", "formData", "el"].forEach((C) => {
3596
+ delete d[C];
3597
+ }), d.global && (f.global = tr(f.global, d.global), delete d.global), this.$handle.$manager.mergeOptions([d], f), f;
3598
+ },
3599
+ updateOptions(f) {
3600
+ this.mergeOptions(this.options, f), this.$handle.$manager.updateOptions(this.options);
3601
+ },
3602
+ created() {
3603
+ this.$handle.init(), this.vm.$emit("created", this.api());
3604
+ },
3605
+ api() {
3606
+ return this.$handle.api;
3607
+ },
3608
+ render() {
3609
+ return this.$handle.render();
3610
+ },
3611
+ mounted() {
3612
+ this.$handle.mounted();
3613
+ }
3614
+ });
3615
+ function Fe(f) {
3616
+ m(f, {
3617
+ version: t.version,
3618
+ ui: t.ui,
3619
+ setData: _e,
3620
+ getData: ke,
3621
+ removeData: pt,
3622
+ maker: n,
3623
+ component: O,
3624
+ directive: g,
3625
+ register: b,
3626
+ $vnode: Oe,
3627
+ parser: $,
3628
+ use: mt,
3629
+ factory: yt,
3630
+ componentAlias: k,
3631
+ copyRule: $e,
3632
+ copyRules: tt,
3633
+ fetch: ot,
3634
+ $form: X,
3635
+ parseFn: U,
3636
+ parseJson: er,
3637
+ toJson: Ye,
3638
+ getApi: h,
3639
+ init(d, v = {}) {
3640
+ let C = He(d, v), V = C.$refs.fc.formCreate;
3641
+ return {
3642
+ mount(J) {
3643
+ return J && c.Element(J) && (V.options.el = J), Ue(V.options).appendChild(C.$el), V.api();
3644
+ },
3645
+ remove() {
3646
+ C.$el.parentNode && C.$el.parentNode.removeChild(C.$el);
3647
+ },
3648
+ destroy() {
3649
+ this.remove(), C.$destroy();
3650
+ },
3651
+ $f: V.api()
3652
+ };
3653
+ }
3654
+ });
3655
+ }
3656
+ function gt(f) {
3657
+ m(f, {
3658
+ create: M,
3659
+ install(d, v) {
3660
+ if (o = y(y({}, o), v || {}), d._installedFormCreate === !0) return;
3661
+ d._installedFormCreate = !0;
3662
+ const C = function(V, J = {}) {
3663
+ return M(V, J, this);
3664
+ };
3665
+ Fe(C), d.prototype.$formCreate = C, d.component("FormCreate", X()), d.component("FcFragment", Oe());
3666
+ }
3667
+ });
3668
+ }
3669
+ if (Fe(l), gt(l), u.use({ fragment: "fcFragment" }), $(Tr), t.install && M.use(t), t.inherit) {
3670
+ const f = t.inherit;
3671
+ f.components && m(e, f.components), f.parsers && m(r, f.parsers), f.directives && m(i, f.directives), f.providers && m(s, f.providers), f.maker && m(n, f.maker), f.loadData && m(a, f.loadData);
3672
+ }
3673
+ const z = X();
3674
+ return Object.setPrototypeOf(z, l), Object.defineProperties(z, {
3675
+ fetch: {
3676
+ get() {
3677
+ return l.fetch;
3678
+ },
3679
+ set(f) {
3680
+ l.fetch = f;
3681
+ }
3682
+ }
3683
+ }), z.util = l, z;
3684
+ }
3685
+ const xe = {
3686
+ date: "yyyy-MM-dd",
3687
+ month: "yyyy-MM",
3688
+ datetime: "yyyy-MM-dd HH:mm:ss",
3689
+ timerange: "HH:mm:ss",
3690
+ daterange: "yyyy-MM-dd",
3691
+ monthrange: "yyyy-MM",
3692
+ datetimerange: "yyyy-MM-dd HH:mm:ss",
3693
+ year: "yyyy"
3694
+ }, Je = "datePicker", Nr = {
3695
+ name: Je,
3696
+ maker: function() {
3697
+ return ["year", "month", "date", "dates", "week", "datetime", "datetimeRange", "dateRange", "monthRange"].reduce((t, e) => (t[e] = R(Je, { type: e.toLowerCase() }), t), {});
3698
+ }(),
3699
+ mergeProp(t) {
3700
+ const e = t.prop.props;
3701
+ e.valueFormat || (e.valueFormat = xe[e.type] || xe.date);
3702
+ }
3703
+ }, se = "hidden", Mr = {
3704
+ name: se,
3705
+ maker: {
3706
+ [se]: (t, e) => R(se)("", t, e)
3707
+ },
3708
+ render() {
3709
+ return [];
3710
+ }
3711
+ }, oe = "input", qr = {
3712
+ name: oe,
3713
+ maker: function() {
3714
+ const t = ["password", "url", "email", "text", "textarea"].reduce((e, r) => (e[r] = R(oe, { type: r }), e), {});
3715
+ return t.idate = R(oe, { type: "date" }), t;
3716
+ }(),
3717
+ mergeProp(t) {
3718
+ let { props: e } = t.prop;
3719
+ e && e.autosize && e.autosize.minRows && (e.rows = e.autosize.minRows || 2);
3720
+ }
3721
+ }, Ke = "slider", Ur = {
3722
+ name: Ke,
3723
+ maker: {
3724
+ sliderRange: R(Ke, { range: !0 })
3725
+ },
3726
+ toFormValue(t, e) {
3727
+ let r = Array.isArray(t), i = e.prop.props, s = i.min || 0, n;
3728
+ return i.range === !0 ? n = r ? t : [s, parseFloat(t) || s] : n = r ? parseFloat(t[0]) || s : parseFloat(t), n;
3729
+ }
3730
+ }, ae = "timePicker", Hr = {
3731
+ name: ae,
3732
+ maker: {
3733
+ time: R(ae, (t) => t.props.isRange = !1),
3734
+ timeRange: R(ae, (t) => t.props.isRange = !0)
3735
+ },
3736
+ mergeProp(t) {
3737
+ const e = t.prop.props;
3738
+ e.valueFormat || (e.valueFormat = "HH:mm:ss");
3739
+ }
3740
+ }, xr = {
3741
+ name: "FcRow",
3742
+ render(t, e) {
3743
+ return e.vNode.col({ props: { span: 24 } }, [
3744
+ e.vNode.row(e.prop, t)
3745
+ ]);
3746
+ }
3747
+ }, Jr = "select", Kr = {
3748
+ name: Jr,
3749
+ toFormValue(t, e) {
3750
+ return e.prop.props.multiple && !Array.isArray(t) ? I(t) : t;
3751
+ }
3752
+ }, Wr = [
3753
+ Nr,
3754
+ Mr,
3755
+ qr,
3756
+ Ur,
3757
+ Hr,
3758
+ xr,
3759
+ Kr
3760
+ ], _ = "el", Gr = {
3761
+ button: _ + "Button",
3762
+ icon: "i",
3763
+ slider: _ + "Slider",
3764
+ rate: _ + "Rate",
3765
+ upload: "fcUpload",
3766
+ cascader: _ + "Cascader",
3767
+ popover: _ + "Popover",
3768
+ tooltip: _ + "Tooltip",
3769
+ colorPicker: _ + "ColorPicker",
3770
+ timePicker: _ + "TimePicker",
3771
+ timeSelect: _ + "TimeSelect",
3772
+ datePicker: _ + "DatePicker",
3773
+ switch: _ + "Switch",
3774
+ select: "fcSelect",
3775
+ checkbox: "fcCheckbox",
3776
+ radio: "fcRadio",
3777
+ inputNumber: _ + "InputNumber",
3778
+ number: _ + "InputNumber",
3779
+ input: _ + "Input",
3780
+ formItem: _ + "FormItem",
3781
+ form: _ + "Form",
3782
+ frame: "fcFrame",
3783
+ col: _ + "Col",
3784
+ row: _ + "Row",
3785
+ tree: "fcTree",
3786
+ autoComplete: _ + "Autocomplete",
3787
+ auto: _ + "Autocomplete",
3788
+ group: "fcGroup",
3789
+ object: "fcSubForm",
3790
+ subForm: "fcSubForm"
3791
+ };
3792
+ function Xr() {
3793
+ return {
3794
+ form: {
3795
+ inline: !1,
3796
+ labelPosition: "right",
3797
+ labelWidth: "125px",
3798
+ disabled: !1,
3799
+ size: void 0
3800
+ },
3801
+ row: {
3802
+ show: !0,
3803
+ gutter: 0
3804
+ },
3805
+ submitBtn: {
3806
+ type: "primary",
3807
+ loading: !1,
3808
+ disabled: !1,
3809
+ innerText: "提交",
3810
+ show: !0,
3811
+ col: void 0,
3812
+ click: void 0
3813
+ },
3814
+ resetBtn: {
3815
+ type: "default",
3816
+ loading: !1,
3817
+ disabled: !1,
3818
+ icon: "el-icon-refresh",
3819
+ innerText: "重置",
3820
+ show: !1,
3821
+ col: void 0,
3822
+ click: void 0
3823
+ }
3824
+ };
3825
+ }
3826
+ function zr(t) {
3827
+ return t.type === "tooltip";
3828
+ }
3829
+ const Qr = /[A-Z]/;
3830
+ function Zr(t, e) {
3831
+ return !Qr.test(t) && (c.String(e) || c.Number(e));
3832
+ }
3833
+ function We(t, e) {
3834
+ w(t, e) && c.String(t[e]) && (t[e] = { [e]: t[e], show: !0 });
3835
+ }
3836
+ function T(t) {
3837
+ return t === !1;
3838
+ }
3839
+ function Yr(t, e) {
3840
+ w(t, e) && !c.Object(t[e]) && (t[e] = { show: !!t[e] });
3841
+ }
3842
+ const ei = {
3843
+ validate() {
3844
+ const t = this.form();
3845
+ return t ? t.validate() : new Promise((e) => e());
3846
+ },
3847
+ validateField(t) {
3848
+ const e = this.form();
3849
+ return e ? new Promise((r, i) => {
3850
+ e.validateField(t, (s) => {
3851
+ s ? i(s) : r(null);
3852
+ });
3853
+ }) : new Promise((r) => r());
3854
+ },
3855
+ clearValidateState(t) {
3856
+ const e = this.vm.$refs[t.wrapRef];
3857
+ e && (e.validateMessage = "", e.validateState = "");
3858
+ },
3859
+ tidyOptions(t) {
3860
+ return ["submitBtn", "resetBtn", "row", "info", "wrap", "col", "title"].forEach((e) => {
3861
+ Yr(t, e);
3862
+ }), t;
3863
+ },
3864
+ tidyRule({ prop: t }) {
3865
+ return We(t, "title"), We(t, "info"), t;
3866
+ },
3867
+ mergeProp(t) {
3868
+ let e = t.prop.props;
3869
+ t.prop = B([{
3870
+ attrs: Object.keys(e).reduce((r, i) => (Zr(i, e[i]) && (r[i] = e[i]), r), {}),
3871
+ info: this.options.info || {},
3872
+ wrap: this.options.wrap || {},
3873
+ col: this.options.col || {},
3874
+ title: this.options.title || {}
3875
+ }, t.prop], {
3876
+ info: {
3877
+ trigger: "hover",
3878
+ placement: "top-start",
3879
+ icon: "el-icon-warning"
3880
+ },
3881
+ title: {},
3882
+ col: { span: 24 },
3883
+ wrap: {}
3884
+ }, { normal: ["title", "info", "col", "wrap"] });
3885
+ },
3886
+ getDefaultOptions() {
3887
+ return Xr();
3888
+ },
3889
+ update() {
3890
+ const t = this.options.form;
3891
+ this.rule = {
3892
+ props: y({}, t),
3893
+ nativeOn: {
3894
+ submit: (e) => {
3895
+ e.preventDefault();
3896
+ }
3897
+ },
3898
+ class: [t.className, t.class, "form-create"],
3899
+ style: t.style,
3900
+ type: "form"
3901
+ };
3902
+ },
3903
+ beforeRender() {
3904
+ const { key: t, ref: e, $handle: r } = this;
3905
+ m(this.rule, { key: t, ref: e }), m(this.rule.props, {
3906
+ model: r.formData
3907
+ // rules: $handle.validate(),
3908
+ });
3909
+ },
3910
+ render(t) {
3911
+ return t.length && t.push(this.makeFormBtn()), this.$r(this.rule, T(this.options.row.show) ? t : [this.makeRow(t)]);
3912
+ },
3913
+ makeWrap(t, e) {
3914
+ 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 = T(r.wrap.show) ? e : this.$r(B([r.wrap, {
3915
+ props: q(y({
3916
+ labelWidth: o === void 0 ? o : lt(o),
3917
+ label: n ? r.title.title : void 0
3918
+ }, r.wrap || {}), {
3919
+ prop: t.id,
3920
+ rules: t.injectValidate()
3921
+ }),
3922
+ class: r.className,
3923
+ key: `${i}fi`,
3924
+ ref: t.wrapRef,
3925
+ type: "formItem"
3926
+ }]), [e, n ? this.makeInfo(r, i, t) : null]);
3927
+ return a === !0 || T(u) || T(s.show) ? l : this.makeCol(r, i, [l]);
3928
+ },
3929
+ isTitle(t) {
3930
+ if (this.options.form.title === !1) return !1;
3931
+ const e = t.title;
3932
+ return !(!e.title && !e.native || T(e.show));
3933
+ },
3934
+ makeInfo(t, e, r) {
3935
+ const i = t.title, s = t.info, n = zr(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"] || "")];
3936
+ if (!T(s.show) && (s.info || s.native) && !T(s.icon)) {
3937
+ const l = {
3938
+ type: s.type || "popover",
3939
+ props: y({}, s),
3940
+ key: `${e}pop`,
3941
+ slot: "label"
3942
+ }, h = "content";
3943
+ s.info && !w(l.props, h) && (l.props[h] = s.info), u[s.align !== "left" ? "unshift" : "push"](this.$r(B([s, l]), [
3944
+ this.$r({
3945
+ type: "i",
3946
+ slot: n ? "default" : "reference",
3947
+ class: s.icon === !0 ? "el-icon-warning" : s.icon,
3948
+ key: `${e}i`
3949
+ })
3950
+ ]));
3951
+ }
3952
+ return this.$r(B([i, {
3953
+ props: i,
3954
+ slot: i.slot || "label",
3955
+ key: `${e}tit`,
3956
+ type: i.type || "span"
3957
+ }]), u);
3958
+ },
3959
+ makeCol(t, e, r) {
3960
+ const i = t.col;
3961
+ return this.$r({
3962
+ class: i.class,
3963
+ type: "col",
3964
+ props: i || { span: 24 },
3965
+ key: `${e}col`
3966
+ }, r);
3967
+ },
3968
+ makeRow(t) {
3969
+ const e = this.options.row || {};
3970
+ return this.$r({
3971
+ type: "row",
3972
+ props: e,
3973
+ class: e.class,
3974
+ key: `${this.key}row`
3975
+ }, t);
3976
+ },
3977
+ makeFormBtn() {
3978
+ let t = [];
3979
+ if (T(this.options.submitBtn.show) || t.push(this.makeSubmitBtn()), T(this.options.resetBtn.show) || t.push(this.makeResetBtn()), !t.length)
3980
+ return;
3981
+ const e = this.$r({
3982
+ type: "formItem",
3983
+ key: `${this.key}fb`
3984
+ }, t);
3985
+ return this.rule.props.inline === !0 ? e : this.$r({
3986
+ type: "col",
3987
+ props: { span: 24 },
3988
+ key: `${this.key}fc`
3989
+ }, [e]);
3990
+ },
3991
+ makeResetBtn() {
3992
+ const t = this.options.resetBtn;
3993
+ return this.$r({
3994
+ type: "button",
3995
+ props: t,
3996
+ style: { width: t.width },
3997
+ on: {
3998
+ click: () => {
3999
+ const e = this.$handle.api;
4000
+ t.click ? t.click(e) : e.resetFields();
4001
+ }
4002
+ },
4003
+ key: `${this.key}b2`
4004
+ }, [t.innerText]);
4005
+ },
4006
+ makeSubmitBtn() {
4007
+ const t = this.options.submitBtn;
4008
+ return this.$r({
4009
+ type: "button",
4010
+ props: t,
4011
+ style: { width: t.width },
4012
+ on: {
4013
+ click: () => {
4014
+ const e = this.$handle.api;
4015
+ t.click ? t.click(e) : e.submit();
4016
+ }
4017
+ },
4018
+ key: `${this.key}b1`
4019
+ }, [t.innerText]);
4020
+ }
4021
+ }, x = {};
4022
+ ti(x);
4023
+ ri(x);
4024
+ ii(x);
4025
+ ni(x);
4026
+ si(x);
4027
+ function ti(t) {
4028
+ ["group", "tree", "switch", "upload", "autoComplete", "checkbox", "cascader", "colorPicker", "datePicker", "frame", "inputNumber", "radio", "rate"].forEach((e) => {
4029
+ t[e] = R(e);
4030
+ }), t.auto = t.autoComplete, t.number = t.inputNumber, t.color = t.colorPicker;
4031
+ }
4032
+ function ri(t) {
4033
+ const e = "select", r = "multiple";
4034
+ t.selectMultiple = R(e, { [r]: !0 }), t.selectOne = R(e, { [r]: !1 });
4035
+ }
4036
+ function ii(t) {
4037
+ const e = "tree", r = { treeSelected: "selected", treeChecked: "checked" };
4038
+ Object.keys(r).reduce((i, s) => (i[s] = R(e, { type: r[s] }), i), t);
4039
+ }
4040
+ function ni(t) {
4041
+ const e = "upload", r = {
4042
+ image: ["image", 0],
4043
+ file: ["file", 0],
4044
+ uploadFileOne: ["file", 1],
4045
+ uploadImageOne: ["image", 1]
4046
+ };
4047
+ 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;
4048
+ }
4049
+ function si(t) {
4050
+ const e = {
4051
+ frameInputs: ["input", 0],
4052
+ frameFiles: ["file", 0],
4053
+ frameImages: ["image", 0],
4054
+ frameInputOne: ["input", 1],
4055
+ frameFileOne: ["file", 1],
4056
+ frameImageOne: ["image", 1]
4057
+ };
4058
+ 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;
4059
+ }
4060
+ function Ge(t, e) {
4061
+ return c.Boolean(t) ? t = { show: t } : !c.Undef(t) && !c.Object(t) && (t = { show: e }), t;
4062
+ }
4063
+ function oi(t, e) {
4064
+ return m(t, {
4065
+ formEl() {
4066
+ return e.$manager.form();
4067
+ },
4068
+ wrapEl(r) {
4069
+ const i = e.getFieldCtx(r);
4070
+ if (i)
4071
+ return e.vm.$refs[i.wrapRef];
4072
+ },
4073
+ validate(r) {
4074
+ return new Promise((i, s) => {
4075
+ const n = t.children, o = [e.$manager.validate()];
4076
+ n.forEach((a) => {
4077
+ o.push(a.validate());
4078
+ }), Promise.all(o).then(() => {
4079
+ i(!0), r && r(!0);
4080
+ }).catch((a) => {
4081
+ s(a), r && r(!1, a), e.vm.$emit("validate-fail", a, { api: t });
4082
+ });
4083
+ });
4084
+ },
4085
+ validateField: (r, i) => new Promise((s, n) => {
4086
+ const o = e.getFieldCtx(r);
4087
+ if (!o) return;
4088
+ const a = e.subForm[o.id], u = [e.$manager.validateField(o.id)];
4089
+ I(a).forEach((l) => {
4090
+ u.push(l.validate().catch(() => Promise.reject("子表单验证未通过")));
4091
+ }), Promise.all(u).then(() => {
4092
+ s(null), i && i(null);
4093
+ }).catch((l) => {
4094
+ n(l), i && i(l), e.vm.$emit("validate-field-fail", l, { field: r, api: t });
4095
+ });
4096
+ }),
4097
+ clearValidateState(r, i = !0) {
4098
+ t.helper.tidyFields(r).forEach((s) => {
4099
+ i && this.clearSubValidateState(s), e.getCtxs(s).forEach((n) => {
4100
+ e.$manager.clearValidateState(n);
4101
+ });
4102
+ });
4103
+ },
4104
+ clearSubValidateState(r) {
4105
+ t.helper.tidyFields(r).forEach((i) => {
4106
+ e.getCtxs(i).forEach((s) => {
4107
+ const n = e.subForm[s.id];
4108
+ n && (Array.isArray(n) ? n.forEach((o) => {
4109
+ o.clearValidateState();
4110
+ }) : n && n.clearValidateState());
4111
+ });
4112
+ });
4113
+ },
4114
+ btn: {
4115
+ loading: (r = !0) => {
4116
+ t.submitBtnProps({ loading: !!r });
4117
+ },
4118
+ disabled: (r = !0) => {
4119
+ t.submitBtnProps({ disabled: !!r });
4120
+ },
4121
+ show: (r = !0) => {
4122
+ t.submitBtnProps({ show: !!r });
4123
+ }
4124
+ },
4125
+ resetBtn: {
4126
+ loading: (r = !0) => {
4127
+ t.resetBtnProps({ loading: !!r });
4128
+ },
4129
+ disabled: (r = !0) => {
4130
+ t.resetBtnProps({ disabled: !!r });
4131
+ },
4132
+ show: (r = !0) => {
4133
+ t.resetBtnProps({ show: !!r });
4134
+ }
4135
+ },
4136
+ submitBtnProps: (r = {}) => {
4137
+ let i = Ge(e.options.submitBtn, !0);
4138
+ m(i, r), e.options.submitBtn = i, t.refreshOptions();
4139
+ },
4140
+ resetBtnProps: (r = {}) => {
4141
+ let i = Ge(e.options.resetBtn, !1);
4142
+ m(i, r), e.options.resetBtn = i, t.refreshOptions();
4143
+ },
4144
+ submit(r, i) {
4145
+ t.validate((s) => {
4146
+ if (s) {
4147
+ let n = t.formData();
4148
+ c.Function(r) ? j(() => r(n, this)) : (c.Function(e.options.onSubmit) && j(() => e.options.onSubmit(n, this)), e.vm.$emit("submit", n, this));
4149
+ } else
4150
+ c.Function(i) && j(() => i(this, ...arguments));
4151
+ }).catch((s) => {
4152
+ });
4153
+ }
4154
+ }), t;
4155
+ }
4156
+ function ai(t) {
4157
+ t.componentAlias(Gr), Gt.forEach((e) => {
4158
+ t.component(e.name, e);
4159
+ }), Wr.forEach((e) => {
4160
+ t.parser(e);
4161
+ }), Object.keys(x).forEach((e) => {
4162
+ t.maker[e] = x[e];
4163
+ });
4164
+ }
4165
+ function li() {
4166
+ return dt({
4167
+ ui: "element-ui",
4168
+ version: "2.6.0",
4169
+ manager: ei,
4170
+ extendApi: oi,
4171
+ install: ai,
4172
+ attrs: {
4173
+ normal: ["col", "wrap"],
4174
+ array: ["className"],
4175
+ key: ["title", "info"]
4176
+ }
4177
+ });
4178
+ }
4179
+ const de = li();
4180
+ typeof window != "undefined" && (window.formCreate = de, window.Vue && de.install(window.Vue));
4181
+ const hi = de.maker;
4182
+ export {
4183
+ de as default,
4184
+ hi as maker
4185
+ };