@form-create/element-ui 3.2.13 → 3.2.15
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.
- package/README.md +8 -7
- package/dist/form-create.esm.js +479 -127
- package/dist/form-create.esm.min.js +2 -2
- package/dist/form-create.js +478 -126
- package/dist/form-create.min.js +2 -2
- package/package.json +12 -12
- package/src/core/alias.js +1 -0
- package/src/core/manager.js +21 -15
- package/src/core/provider.js +6 -2
- package/src/style/index.css +12 -6
package/dist/form-create.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @form-create/element-ui v3.2.
|
|
2
|
+
* @form-create/element-ui v3.2.15
|
|
3
3
|
* (c) 2018-2024 xaboy
|
|
4
4
|
* Github https://github.com/xaboy/form-create
|
|
5
5
|
* Released under the MIT License.
|
|
@@ -226,12 +226,14 @@
|
|
|
226
226
|
}
|
|
227
227
|
},
|
|
228
228
|
type: String,
|
|
229
|
+
options: Array,
|
|
229
230
|
input: Boolean,
|
|
230
231
|
inputValue: String
|
|
231
232
|
},
|
|
232
233
|
emits: ['update:modelValue', 'fc.el'],
|
|
233
234
|
setup: function setup(props, _) {
|
|
234
235
|
var options = vue.toRef(props.formCreateInject, 'options', []);
|
|
236
|
+
var opt = vue.toRef(props, 'options');
|
|
235
237
|
var value = vue.toRef(props, 'modelValue');
|
|
236
238
|
var inputValue = vue.toRef(props, 'inputValue', '');
|
|
237
239
|
var customValue = vue.ref(inputValue.value);
|
|
@@ -262,9 +264,37 @@
|
|
|
262
264
|
updateCustomValue(n);
|
|
263
265
|
});
|
|
264
266
|
|
|
265
|
-
var _options = function
|
|
266
|
-
|
|
267
|
-
|
|
267
|
+
var _options = vue.computed(function () {
|
|
268
|
+
var arr = options.value || [];
|
|
269
|
+
|
|
270
|
+
if (opt.value) {
|
|
271
|
+
arr = opt.value || [];
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
return Array.isArray(arr) ? arr : [];
|
|
275
|
+
});
|
|
276
|
+
|
|
277
|
+
vue.watch(value, function (n) {
|
|
278
|
+
var value = null;
|
|
279
|
+
|
|
280
|
+
if (!inputValue.value && n != null && Array.isArray(n) && n.length > 0 && input.value) {
|
|
281
|
+
var values = _options.value.map(function (item) {
|
|
282
|
+
return item.value;
|
|
283
|
+
});
|
|
284
|
+
|
|
285
|
+
n.forEach(function (val) {
|
|
286
|
+
if (values.indexOf(val) === -1) {
|
|
287
|
+
value = val;
|
|
288
|
+
}
|
|
289
|
+
});
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
if (value != null) {
|
|
293
|
+
customValue.value = value;
|
|
294
|
+
}
|
|
295
|
+
}, {
|
|
296
|
+
immediate: true
|
|
297
|
+
});
|
|
268
298
|
|
|
269
299
|
var onInput = function onInput(n) {
|
|
270
300
|
_.emit('update:modelValue', n);
|
|
@@ -308,7 +338,7 @@
|
|
|
308
338
|
"ref": "el"
|
|
309
339
|
}), _objectSpread2({
|
|
310
340
|
"default": function _default() {
|
|
311
|
-
return [_this.options
|
|
341
|
+
return [_this.options.map(function (opt, index) {
|
|
312
342
|
var props = _objectSpread2({}, opt);
|
|
313
343
|
|
|
314
344
|
var value = props.value;
|
|
@@ -1019,6 +1049,7 @@
|
|
|
1019
1049
|
type: [String, Number, Boolean],
|
|
1020
1050
|
"default": ''
|
|
1021
1051
|
},
|
|
1052
|
+
options: Array,
|
|
1022
1053
|
type: String,
|
|
1023
1054
|
input: Boolean,
|
|
1024
1055
|
inputValue: String
|
|
@@ -1026,15 +1057,11 @@
|
|
|
1026
1057
|
emits: ['update:modelValue', 'fc.el'],
|
|
1027
1058
|
setup: function setup(props, _) {
|
|
1028
1059
|
var options = vue.toRef(props.formCreateInject, 'options', []);
|
|
1060
|
+
var opt = vue.toRef(props, 'options');
|
|
1029
1061
|
var value = vue.toRef(props, 'modelValue');
|
|
1030
1062
|
var inputValue = vue.toRef(props, 'inputValue', '');
|
|
1031
1063
|
var customValue = vue.ref(inputValue.value);
|
|
1032
1064
|
var input = vue.toRef(props, 'input', false);
|
|
1033
|
-
|
|
1034
|
-
var _options = function _options() {
|
|
1035
|
-
return Array.isArray(options.value) ? options.value : [];
|
|
1036
|
-
};
|
|
1037
|
-
|
|
1038
1065
|
vue.watch(inputValue, function (n) {
|
|
1039
1066
|
if (!input.value) {
|
|
1040
1067
|
customValue.value = n;
|
|
@@ -1044,6 +1071,32 @@
|
|
|
1044
1071
|
updateCustomValue(n);
|
|
1045
1072
|
});
|
|
1046
1073
|
|
|
1074
|
+
var _options = vue.computed(function () {
|
|
1075
|
+
var arr = options.value || [];
|
|
1076
|
+
|
|
1077
|
+
if (opt.value) {
|
|
1078
|
+
arr = opt.value || [];
|
|
1079
|
+
}
|
|
1080
|
+
|
|
1081
|
+
return Array.isArray(arr) ? arr : [];
|
|
1082
|
+
});
|
|
1083
|
+
|
|
1084
|
+
vue.watch(value, function (n) {
|
|
1085
|
+
var flag = false;
|
|
1086
|
+
|
|
1087
|
+
if (!inputValue.value && n != null && input.value) {
|
|
1088
|
+
flag = _options.value.map(function (item) {
|
|
1089
|
+
return item.value;
|
|
1090
|
+
}).indexOf(n) === -1;
|
|
1091
|
+
}
|
|
1092
|
+
|
|
1093
|
+
if (flag) {
|
|
1094
|
+
customValue.value = n;
|
|
1095
|
+
}
|
|
1096
|
+
}, {
|
|
1097
|
+
immediate: true
|
|
1098
|
+
});
|
|
1099
|
+
|
|
1047
1100
|
var onInput = function onInput(n) {
|
|
1048
1101
|
_.emit('update:modelValue', n);
|
|
1049
1102
|
};
|
|
@@ -1097,7 +1150,7 @@
|
|
|
1097
1150
|
"ref": "el"
|
|
1098
1151
|
}), _objectSpread2({
|
|
1099
1152
|
"default": function _default() {
|
|
1100
|
-
return [_this.options
|
|
1153
|
+
return [_this.options.map(function (opt, index) {
|
|
1101
1154
|
var props = _objectSpread2({}, opt);
|
|
1102
1155
|
|
|
1103
1156
|
var value = props.value;
|
|
@@ -1365,7 +1418,7 @@
|
|
|
1365
1418
|
onPreview: Function,
|
|
1366
1419
|
modalTitle: String,
|
|
1367
1420
|
listType: String,
|
|
1368
|
-
modelValue: [Array, String]
|
|
1421
|
+
modelValue: [Array, String, Object]
|
|
1369
1422
|
},
|
|
1370
1423
|
emits: ['update:modelValue', 'change', 'remove', 'fc.el'],
|
|
1371
1424
|
data: function data() {
|
|
@@ -1441,7 +1494,7 @@
|
|
|
1441
1494
|
"ref": "upload"
|
|
1442
1495
|
}), _objectSpread2({
|
|
1443
1496
|
"default": function _default() {
|
|
1444
|
-
return [(_this$$slots$default = (_this$$slots = _this.$slots)["default"])
|
|
1497
|
+
return [((_this$$slots$default = (_this$$slots = _this.$slots)["default"]) === null || _this$$slots$default === void 0 ? void 0 : _this$$slots$default.call(_this$$slots)) || (['text', 'picture'].indexOf(_this.listType) === -1 ? vue.createVNode(vue.resolveComponent("ElIcon"), null, {
|
|
1445
1498
|
"default": function _default() {
|
|
1446
1499
|
return [vue.createVNode(script$1, null, null)];
|
|
1447
1500
|
}
|
|
@@ -1451,7 +1504,7 @@
|
|
|
1451
1504
|
"default": function _default() {
|
|
1452
1505
|
return [vue.createTextVNode("\u70B9\u51FB\u4E0A\u4F20")];
|
|
1453
1506
|
}
|
|
1454
|
-
})];
|
|
1507
|
+
}))];
|
|
1455
1508
|
}
|
|
1456
1509
|
}, getSlot(this.$slots, ['default']))), vue.createVNode(vue.resolveComponent("ElDialog"), {
|
|
1457
1510
|
"appendToBody": true,
|
|
@@ -2150,6 +2203,7 @@
|
|
|
2150
2203
|
},
|
|
2151
2204
|
index: [String, Number],
|
|
2152
2205
|
api: Object,
|
|
2206
|
+
locale: [String, Object],
|
|
2153
2207
|
name: String,
|
|
2154
2208
|
subForm: {
|
|
2155
2209
|
type: Boolean,
|
|
@@ -2393,7 +2447,7 @@
|
|
|
2393
2447
|
|
|
2394
2448
|
var normalMerge = ['props'];
|
|
2395
2449
|
var toArrayMerge = ['class', 'style', 'directives'];
|
|
2396
|
-
var functionalMerge = ['on'];
|
|
2450
|
+
var functionalMerge = ['on', 'hook'];
|
|
2397
2451
|
|
|
2398
2452
|
var mergeProps = function mergeProps(objects) {
|
|
2399
2453
|
var initial = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
@@ -2490,15 +2544,11 @@
|
|
|
2490
2544
|
|
|
2491
2545
|
var PREFIX = '[[FORM-CREATE-PREFIX-';
|
|
2492
2546
|
var SUFFIX = '-FORM-CREATE-SUFFIX]]';
|
|
2493
|
-
var $T = '$FN:';
|
|
2494
|
-
var $TX = '$FNX:';
|
|
2495
|
-
var $ON = '$GLOBAL:';
|
|
2496
|
-
var FUNCTION = 'function';
|
|
2497
2547
|
function toJson(obj, space) {
|
|
2498
2548
|
return JSON.stringify(deepExtend(Array.isArray(obj) ? [] : {}, obj, true), function (key, val) {
|
|
2499
2549
|
if (val && val._isVue === true) return undefined;
|
|
2500
2550
|
|
|
2501
|
-
if (
|
|
2551
|
+
if (typeof val !== 'function') {
|
|
2502
2552
|
return val;
|
|
2503
2553
|
}
|
|
2504
2554
|
|
|
@@ -2525,11 +2575,14 @@
|
|
|
2525
2575
|
if (v.indexOf(SUFFIX) > 0 && v.indexOf(PREFIX) === 0) {
|
|
2526
2576
|
v = v.replace(SUFFIX, '').replace(PREFIX, '');
|
|
2527
2577
|
flag = true;
|
|
2528
|
-
} else if (v.indexOf($
|
|
2529
|
-
v = v.
|
|
2578
|
+
} else if (v.indexOf('$FN:') === 0) {
|
|
2579
|
+
v = v.substring(4);
|
|
2530
2580
|
flag = true;
|
|
2531
|
-
} else if (v.indexOf($
|
|
2532
|
-
|
|
2581
|
+
} else if (v.indexOf('$EXEC:') === 0) {
|
|
2582
|
+
v = v.substring(6);
|
|
2583
|
+
flag = true;
|
|
2584
|
+
} else if (v.indexOf('$GLOBAL:') === 0) {
|
|
2585
|
+
var name = v.substring(8);
|
|
2533
2586
|
|
|
2534
2587
|
v = function v() {
|
|
2535
2588
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
@@ -2548,17 +2601,26 @@
|
|
|
2548
2601
|
v.__json = fn;
|
|
2549
2602
|
v.__inject = true;
|
|
2550
2603
|
return v;
|
|
2551
|
-
} else if (v.indexOf($
|
|
2552
|
-
v = makeFn('function($inject){' + v.
|
|
2604
|
+
} else if (v.indexOf('$FNX:') === 0) {
|
|
2605
|
+
v = makeFn('function($inject){' + v.substring(5) + '}');
|
|
2553
2606
|
v.__json = fn;
|
|
2554
2607
|
v.__inject = true;
|
|
2555
2608
|
return v;
|
|
2556
|
-
} else if (!mode && v.indexOf(
|
|
2609
|
+
} else if (!mode && v.indexOf('function ') === 0 && v !== 'function ') {
|
|
2610
|
+
flag = true;
|
|
2611
|
+
} else if (!mode && v.indexOf('function(') === 0 && v !== 'function(') {
|
|
2557
2612
|
flag = true;
|
|
2558
2613
|
}
|
|
2559
2614
|
|
|
2560
2615
|
if (!flag) return fn;
|
|
2561
|
-
var val
|
|
2616
|
+
var val;
|
|
2617
|
+
|
|
2618
|
+
try {
|
|
2619
|
+
val = makeFn(v);
|
|
2620
|
+
} catch (e) {
|
|
2621
|
+
val = makeFn('function ' + v);
|
|
2622
|
+
}
|
|
2623
|
+
|
|
2562
2624
|
val.__json = fn;
|
|
2563
2625
|
return val;
|
|
2564
2626
|
} catch (e) {
|
|
@@ -2924,7 +2986,17 @@
|
|
|
2924
2986
|
}
|
|
2925
2987
|
|
|
2926
2988
|
var xhr = new XMLHttpRequest();
|
|
2927
|
-
var action = option.action;
|
|
2989
|
+
var action = option.action || '';
|
|
2990
|
+
|
|
2991
|
+
if (option.query) {
|
|
2992
|
+
var queryString = new URLSearchParams(option.query).toString();
|
|
2993
|
+
|
|
2994
|
+
if (action.includes('?')) {
|
|
2995
|
+
action += "&".concat(queryString);
|
|
2996
|
+
} else {
|
|
2997
|
+
action += "?".concat(queryString);
|
|
2998
|
+
}
|
|
2999
|
+
}
|
|
2928
3000
|
|
|
2929
3001
|
xhr.onerror = function error(e) {
|
|
2930
3002
|
option.onError(e);
|
|
@@ -2965,7 +3037,7 @@
|
|
|
2965
3037
|
});
|
|
2966
3038
|
xhr.send(formData);
|
|
2967
3039
|
}
|
|
2968
|
-
function asyncFetch(config, _fetch) {
|
|
3040
|
+
function asyncFetch(config, _fetch, api) {
|
|
2969
3041
|
return new Promise(function (resolve, reject) {
|
|
2970
3042
|
(_fetch || fetch$1)(_objectSpread2(_objectSpread2({}, config), {}, {
|
|
2971
3043
|
onSuccess: function onSuccess(res) {
|
|
@@ -2983,7 +3055,7 @@
|
|
|
2983
3055
|
};
|
|
2984
3056
|
}
|
|
2985
3057
|
|
|
2986
|
-
resolve(fn(res));
|
|
3058
|
+
resolve(fn(res, undefined, api));
|
|
2987
3059
|
},
|
|
2988
3060
|
onError: function onError(err) {
|
|
2989
3061
|
reject(err);
|
|
@@ -3588,7 +3660,7 @@
|
|
|
3588
3660
|
opt = deepCopy(opt);
|
|
3589
3661
|
opt = h.loadFetchVar(opt);
|
|
3590
3662
|
h.beforeFetch(opt).then(function () {
|
|
3591
|
-
return asyncFetch(opt, h.fc.create.fetch).then(function (res) {
|
|
3663
|
+
return asyncFetch(opt, h.fc.create.fetch, api).then(function (res) {
|
|
3592
3664
|
invoke(function () {
|
|
3593
3665
|
return opt.onSuccess && opt.onSuccess(res);
|
|
3594
3666
|
});
|
|
@@ -3608,7 +3680,7 @@
|
|
|
3608
3680
|
|
|
3609
3681
|
_opt = h.loadFetchVar(_opt, get);
|
|
3610
3682
|
h.beforeFetch(_opt).then(function () {
|
|
3611
|
-
return asyncFetch(_opt, h.fc.create.fetch).then(function (res) {
|
|
3683
|
+
return asyncFetch(_opt, h.fc.create.fetch, api).then(function (res) {
|
|
3612
3684
|
invoke(function () {
|
|
3613
3685
|
return _opt.onSuccess && _opt.onSuccess(res);
|
|
3614
3686
|
});
|
|
@@ -3625,12 +3697,25 @@
|
|
|
3625
3697
|
getData: function getData(id, def) {
|
|
3626
3698
|
return h.fc.getLoadData(id, def);
|
|
3627
3699
|
},
|
|
3700
|
+
watchData: function watchData(fn) {
|
|
3701
|
+
return h.fc.watchLoadData(function (get, change) {
|
|
3702
|
+
invoke(function () {
|
|
3703
|
+
return fn(get, change);
|
|
3704
|
+
});
|
|
3705
|
+
});
|
|
3706
|
+
},
|
|
3628
3707
|
setData: function setData(id, data, isGlobal) {
|
|
3629
3708
|
return h.fc.setData(id, data, isGlobal);
|
|
3630
3709
|
},
|
|
3631
3710
|
refreshData: function refreshData(id) {
|
|
3632
3711
|
return h.fc.refreshData(id);
|
|
3633
3712
|
},
|
|
3713
|
+
t: function t(id, params) {
|
|
3714
|
+
return h.fc.t(id, params);
|
|
3715
|
+
},
|
|
3716
|
+
getLocale: function getLocale() {
|
|
3717
|
+
return h.fc.getLocale();
|
|
3718
|
+
},
|
|
3634
3719
|
helper: {
|
|
3635
3720
|
tidyFields: tidyFields,
|
|
3636
3721
|
props: props
|
|
@@ -3961,15 +4046,19 @@
|
|
|
3961
4046
|
},
|
|
3962
4047
|
none: function none(vn) {
|
|
3963
4048
|
if (vn) {
|
|
3964
|
-
|
|
3965
|
-
vn.props["class"].push('fc-none');
|
|
3966
|
-
} else {
|
|
3967
|
-
vn.props["class"] = vn.props["class"] ? [vn.props["class"], 'fc-none'] : 'fc-none';
|
|
3968
|
-
}
|
|
3969
|
-
|
|
4049
|
+
vn.props["class"] = this.mergeClass(vn.props["class"], 'fc-none');
|
|
3970
4050
|
return vn;
|
|
3971
4051
|
}
|
|
3972
4052
|
},
|
|
4053
|
+
mergeClass: function mergeClass(target, value) {
|
|
4054
|
+
if (Array.isArray(target)) {
|
|
4055
|
+
target.push(value);
|
|
4056
|
+
} else {
|
|
4057
|
+
return target ? [target, value] : value;
|
|
4058
|
+
}
|
|
4059
|
+
|
|
4060
|
+
return target;
|
|
4061
|
+
},
|
|
3973
4062
|
stable: function stable(vn) {
|
|
3974
4063
|
var _this5 = this;
|
|
3975
4064
|
|
|
@@ -4069,6 +4158,7 @@
|
|
|
4069
4158
|
callback: function callback(value) {
|
|
4070
4159
|
_this7.onInput(ctx, value);
|
|
4071
4160
|
},
|
|
4161
|
+
modelField: field,
|
|
4072
4162
|
value: this.$handle.getFormData(ctx)
|
|
4073
4163
|
};
|
|
4074
4164
|
props.push({
|
|
@@ -4087,6 +4177,7 @@
|
|
|
4087
4177
|
ctx.el = this.vm.refs[ctx.ref] || el;
|
|
4088
4178
|
ctx.parser.mounted(ctx);
|
|
4089
4179
|
this.$handle.effect(ctx, 'mounted');
|
|
4180
|
+
this.$handle.targetHook(ctx, 'mounted');
|
|
4090
4181
|
},
|
|
4091
4182
|
onInput: function onInput(ctx, value) {
|
|
4092
4183
|
if (ctx.prop.modelEmit) {
|
|
@@ -4293,7 +4384,7 @@
|
|
|
4293
4384
|
},
|
|
4294
4385
|
getInjectData: function getInjectData(self, inject) {
|
|
4295
4386
|
var $api = self.__fc__ && self.__fc__.$api;
|
|
4296
|
-
var vm = self.__fc__ && self.__fc__.$handle.vm || this.vm
|
|
4387
|
+
var vm = self.__fc__ && self.__fc__.$handle.vm || this.vm;
|
|
4297
4388
|
var _vm$props = vm.props,
|
|
4298
4389
|
option = _vm$props.option,
|
|
4299
4390
|
rule = _vm$props.rule;
|
|
@@ -4469,6 +4560,12 @@
|
|
|
4469
4560
|
Object.defineProperties(ctx.origin, {
|
|
4470
4561
|
__fc__: enumerable(vue.markRaw(ctx), true)
|
|
4471
4562
|
});
|
|
4563
|
+
|
|
4564
|
+
if (ctx.rule !== ctx.origin) {
|
|
4565
|
+
Object.defineProperties(ctx.rule, {
|
|
4566
|
+
__fc__: enumerable(vue.markRaw(ctx), true)
|
|
4567
|
+
});
|
|
4568
|
+
}
|
|
4472
4569
|
}
|
|
4473
4570
|
|
|
4474
4571
|
function RuleContext(handle, rule, defaultValue) {
|
|
@@ -4648,43 +4745,17 @@
|
|
|
4648
4745
|
var rule = _objectSpread2({}, this.rule);
|
|
4649
4746
|
|
|
4650
4747
|
delete rule.children;
|
|
4748
|
+
delete rule.validate;
|
|
4651
4749
|
this.prop = mergeRule({}, [rule].concat(_toConsumableArray(Object.keys(this.payload).map(function (k) {
|
|
4652
4750
|
return _this3.payload[k];
|
|
4653
4751
|
})), [this.computed]));
|
|
4752
|
+
this.prop.validate = [].concat(_toConsumableArray(this.refRule.__$validate.value || []), _toConsumableArray(this.prop.validate || []));
|
|
4654
4753
|
},
|
|
4655
4754
|
initNone: function initNone() {
|
|
4656
4755
|
this.none = !(is.Undef(this.prop.display) || !!this.prop.display);
|
|
4657
4756
|
},
|
|
4658
4757
|
injectValidate: function injectValidate() {
|
|
4659
|
-
|
|
4660
|
-
|
|
4661
|
-
return toArray(this.prop.validate).map(function (item) {
|
|
4662
|
-
if (is.Function(item.validator)) {
|
|
4663
|
-
var temp = _objectSpread2({}, item);
|
|
4664
|
-
|
|
4665
|
-
var that = _this4;
|
|
4666
|
-
|
|
4667
|
-
temp.validator = function () {
|
|
4668
|
-
var _item$validator;
|
|
4669
|
-
|
|
4670
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
4671
|
-
args[_key] = arguments[_key];
|
|
4672
|
-
}
|
|
4673
|
-
|
|
4674
|
-
return (_item$validator = item.validator).call.apply(_item$validator, [{
|
|
4675
|
-
that: this,
|
|
4676
|
-
id: that.id,
|
|
4677
|
-
field: that.field,
|
|
4678
|
-
rule: that.rule,
|
|
4679
|
-
api: that.$handle.api
|
|
4680
|
-
}].concat(args));
|
|
4681
|
-
};
|
|
4682
|
-
|
|
4683
|
-
return temp;
|
|
4684
|
-
}
|
|
4685
|
-
|
|
4686
|
-
return item;
|
|
4687
|
-
});
|
|
4758
|
+
return this.prop.validate;
|
|
4688
4759
|
},
|
|
4689
4760
|
check: function check(handle) {
|
|
4690
4761
|
return this.vm === handle.vm;
|
|
@@ -4734,15 +4805,15 @@
|
|
|
4734
4805
|
this.ctrlRule = [];
|
|
4735
4806
|
},
|
|
4736
4807
|
rm: function rm() {
|
|
4737
|
-
var
|
|
4808
|
+
var _this4 = this;
|
|
4738
4809
|
|
|
4739
4810
|
var _rm = function _rm() {
|
|
4740
|
-
var index =
|
|
4811
|
+
var index = _this4.root.indexOf(_this4.origin);
|
|
4741
4812
|
|
|
4742
4813
|
if (index > -1) {
|
|
4743
|
-
|
|
4814
|
+
_this4.root.splice(index, 1);
|
|
4744
4815
|
|
|
4745
|
-
|
|
4816
|
+
_this4.$handle && _this4.$handle.refresh();
|
|
4746
4817
|
}
|
|
4747
4818
|
};
|
|
4748
4819
|
|
|
@@ -4753,17 +4824,17 @@
|
|
|
4753
4824
|
}
|
|
4754
4825
|
|
|
4755
4826
|
this.$handle.noWatch(function () {
|
|
4756
|
-
|
|
4757
|
-
|
|
4827
|
+
_this4.$handle.deferSyncValue(function () {
|
|
4828
|
+
_this4.rmCtrl();
|
|
4758
4829
|
|
|
4759
4830
|
_rm();
|
|
4760
4831
|
|
|
4761
|
-
|
|
4832
|
+
_this4.$handle.rmCtx(_this4);
|
|
4762
4833
|
|
|
4763
|
-
extend(
|
|
4834
|
+
extend(_this4, {
|
|
4764
4835
|
root: []
|
|
4765
4836
|
});
|
|
4766
|
-
},
|
|
4837
|
+
}, _this4.input);
|
|
4767
4838
|
});
|
|
4768
4839
|
},
|
|
4769
4840
|
update: function update(handle, init) {
|
|
@@ -5001,7 +5072,11 @@
|
|
|
5001
5072
|
|
|
5002
5073
|
_this6.setCtx(ctx);
|
|
5003
5074
|
|
|
5004
|
-
!isCopy && !isInit
|
|
5075
|
+
if (!isCopy && !isInit) {
|
|
5076
|
+
_this6.effect(ctx, 'load');
|
|
5077
|
+
|
|
5078
|
+
_this6.targetHook(ctx, 'load');
|
|
5079
|
+
}
|
|
5005
5080
|
|
|
5006
5081
|
_this6.effect(ctx, 'created');
|
|
5007
5082
|
|
|
@@ -5253,6 +5328,9 @@
|
|
|
5253
5328
|
this.valueChange(ctx, value);
|
|
5254
5329
|
this.vm.emit('change', ctx.field, value, ctx.origin, this.api, setFlag || false);
|
|
5255
5330
|
this.effect(ctx, 'value');
|
|
5331
|
+
this.targetHook(ctx, 'value', {
|
|
5332
|
+
value: value
|
|
5333
|
+
});
|
|
5256
5334
|
this.emitEvent('change', ctx.field, value, {
|
|
5257
5335
|
rule: ctx.origin,
|
|
5258
5336
|
api: this.api,
|
|
@@ -5598,9 +5676,22 @@
|
|
|
5598
5676
|
}
|
|
5599
5677
|
|
|
5600
5678
|
_this.watching = true;
|
|
5679
|
+
vue.nextTick(function () {
|
|
5680
|
+
_this.targetHook(ctx, 'watch', {
|
|
5681
|
+
key: key,
|
|
5682
|
+
oldValue: o,
|
|
5683
|
+
newValue: n
|
|
5684
|
+
});
|
|
5685
|
+
});
|
|
5601
5686
|
|
|
5602
5687
|
if (key === 'hidden' && Boolean(n) !== Boolean(o)) {
|
|
5603
5688
|
_this.$render.clearCacheAll();
|
|
5689
|
+
|
|
5690
|
+
vue.nextTick(function () {
|
|
5691
|
+
_this.targetHook(ctx, 'hidden', {
|
|
5692
|
+
value: n
|
|
5693
|
+
});
|
|
5694
|
+
});
|
|
5604
5695
|
}
|
|
5605
5696
|
|
|
5606
5697
|
if (key === 'ignore' && ctx.input || key === 'hidden' && ctx.input && (ctx.rule.ignore === 'hidden' || _this.options.ignoreHiddenFields)) {
|
|
@@ -5642,6 +5733,71 @@
|
|
|
5642
5733
|
sync: flag
|
|
5643
5734
|
}));
|
|
5644
5735
|
});
|
|
5736
|
+
ctx.refRule['__$title'] = vue.computed(function () {
|
|
5737
|
+
var title = (_typeof(ctx.rule.title) === 'object' ? ctx.rule.title.title : ctx.rule.title) || '';
|
|
5738
|
+
|
|
5739
|
+
if (title) {
|
|
5740
|
+
var match = title.match(/^\{\{\s*\$t\.(.+)\s*\}\}$/);
|
|
5741
|
+
|
|
5742
|
+
if (match) {
|
|
5743
|
+
title = _this.api.t(match[1]);
|
|
5744
|
+
}
|
|
5745
|
+
}
|
|
5746
|
+
|
|
5747
|
+
return title;
|
|
5748
|
+
});
|
|
5749
|
+
ctx.refRule['__$info'] = vue.computed(function () {
|
|
5750
|
+
var info = (_typeof(ctx.rule.info) === 'object' ? ctx.rule.info.info : ctx.rule.info) || '';
|
|
5751
|
+
|
|
5752
|
+
if (info) {
|
|
5753
|
+
var match = info.match(/^\{\{\s*\$t\.(.+)\s*\}\}$/);
|
|
5754
|
+
|
|
5755
|
+
if (match) {
|
|
5756
|
+
info = _this.api.t(match[1]);
|
|
5757
|
+
}
|
|
5758
|
+
}
|
|
5759
|
+
|
|
5760
|
+
return info;
|
|
5761
|
+
});
|
|
5762
|
+
ctx.refRule['__$validate'] = vue.computed(function () {
|
|
5763
|
+
return toArray(ctx.rule.validate).map(function (item) {
|
|
5764
|
+
var temp = _objectSpread2({}, item);
|
|
5765
|
+
|
|
5766
|
+
if (temp.message) {
|
|
5767
|
+
var match = temp.message.match(/^\{\{\s*\$t\.(.+)\s*\}\}$/);
|
|
5768
|
+
|
|
5769
|
+
if (match) {
|
|
5770
|
+
temp.message = _this.api.t(match[1], {
|
|
5771
|
+
title: ctx.refRule.__$title.value
|
|
5772
|
+
});
|
|
5773
|
+
}
|
|
5774
|
+
}
|
|
5775
|
+
|
|
5776
|
+
if (is.Function(temp.validator)) {
|
|
5777
|
+
var that = ctx;
|
|
5778
|
+
|
|
5779
|
+
temp.validator = function () {
|
|
5780
|
+
var _item$validator;
|
|
5781
|
+
|
|
5782
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
5783
|
+
args[_key] = arguments[_key];
|
|
5784
|
+
}
|
|
5785
|
+
|
|
5786
|
+
return (_item$validator = item.validator).call.apply(_item$validator, [{
|
|
5787
|
+
that: this,
|
|
5788
|
+
id: that.id,
|
|
5789
|
+
field: that.field,
|
|
5790
|
+
rule: that.rule,
|
|
5791
|
+
api: that.$handle.api
|
|
5792
|
+
}].concat(args));
|
|
5793
|
+
};
|
|
5794
|
+
|
|
5795
|
+
return temp;
|
|
5796
|
+
}
|
|
5797
|
+
|
|
5798
|
+
return temp;
|
|
5799
|
+
});
|
|
5800
|
+
});
|
|
5645
5801
|
|
|
5646
5802
|
if (ctx.input) {
|
|
5647
5803
|
var val = vue.toRef(ctx.rule, 'value');
|
|
@@ -5729,25 +5885,42 @@
|
|
|
5729
5885
|
var or = item.mode === 'OR';
|
|
5730
5886
|
var valid = true;
|
|
5731
5887
|
|
|
5732
|
-
|
|
5888
|
+
var _loop = function _loop(i) {
|
|
5733
5889
|
var one = item.group[i];
|
|
5734
5890
|
var flag = void 0;
|
|
5891
|
+
var field = one.field;
|
|
5892
|
+
|
|
5893
|
+
if (one.variable) {
|
|
5894
|
+
field = JSON.stringify(_this2.fc.getLoadData(one.variable) || '');
|
|
5895
|
+
}
|
|
5735
5896
|
|
|
5736
5897
|
if (one.mode) {
|
|
5737
5898
|
flag = checkCondition(one);
|
|
5738
5899
|
} else if (!condition[one.condition]) {
|
|
5739
5900
|
flag = false;
|
|
5901
|
+
} else if (is.Function(one.handler)) {
|
|
5902
|
+
flag = invoke(function () {
|
|
5903
|
+
return one.handler(_this2.api, ctx.rule);
|
|
5904
|
+
});
|
|
5740
5905
|
} else {
|
|
5741
|
-
flag = new Function('$condition', '$val', '$form', '$group', "with($form){with(this){with($group){ return $condition['".concat(one.condition, "'](").concat(
|
|
5906
|
+
flag = new Function('$condition', '$val', '$form', '$group', '$rule', "with($form){with(this){with($group){ return $condition['".concat(one.condition, "'](").concat(field, ", ").concat(one.compare ? one.compare : '$val', "); }}}")).call(_this2.api.form, condition, one.value, _this2.api.top.form, group ? _this2.subRuleData[group.id] || {} : {}, ctx.rule);
|
|
5742
5907
|
}
|
|
5743
5908
|
|
|
5744
5909
|
if (or && flag) {
|
|
5745
|
-
return
|
|
5910
|
+
return {
|
|
5911
|
+
v: true
|
|
5912
|
+
};
|
|
5746
5913
|
}
|
|
5747
5914
|
|
|
5748
5915
|
if (!or) {
|
|
5749
5916
|
valid = valid && flag;
|
|
5750
5917
|
}
|
|
5918
|
+
};
|
|
5919
|
+
|
|
5920
|
+
for (var i = 0; i < item.group.length; i++) {
|
|
5921
|
+
var _ret = _loop(i);
|
|
5922
|
+
|
|
5923
|
+
if (_typeof(_ret) === "object") return _ret.v;
|
|
5751
5924
|
}
|
|
5752
5925
|
|
|
5753
5926
|
return or ? false : valid;
|
|
@@ -5783,8 +5956,8 @@
|
|
|
5783
5956
|
obj[k] = function () {
|
|
5784
5957
|
var _that$fc$formulas$k;
|
|
5785
5958
|
|
|
5786
|
-
for (var
|
|
5787
|
-
args[
|
|
5959
|
+
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
5960
|
+
args[_key2] = arguments[_key2];
|
|
5788
5961
|
}
|
|
5789
5962
|
|
|
5790
5963
|
return (_that$fc$formulas$k = that.fc.formulas[k]).call.apply(_that$fc$formulas$k, [{
|
|
@@ -5878,6 +6051,7 @@
|
|
|
5878
6051
|
this.$render.clearCache(ctx);
|
|
5879
6052
|
ctx["delete"]();
|
|
5880
6053
|
this.effect(ctx, 'deleted');
|
|
6054
|
+
this.targetHook(ctx, 'deleted');
|
|
5881
6055
|
input && !this.fieldCtx[field] && this.vm.emit('remove-field', field, ctx.rule, this.api);
|
|
5882
6056
|
ctx.rule.__ctrl || this.vm.emit('remove-rule', ctx.rule, this.api);
|
|
5883
6057
|
return ctx;
|
|
@@ -5924,6 +6098,25 @@
|
|
|
5924
6098
|
}
|
|
5925
6099
|
|
|
5926
6100
|
(_this$bus = this.bus).$emit.apply(_this$bus, [name].concat(args));
|
|
6101
|
+
},
|
|
6102
|
+
targetHook: function targetHook(ctx, name, args) {
|
|
6103
|
+
var _ctx$prop,
|
|
6104
|
+
_ctx$prop$hook,
|
|
6105
|
+
_this2 = this;
|
|
6106
|
+
|
|
6107
|
+
var hook = (_ctx$prop = ctx.prop) === null || _ctx$prop === void 0 ? void 0 : (_ctx$prop$hook = _ctx$prop.hook) === null || _ctx$prop$hook === void 0 ? void 0 : _ctx$prop$hook[name];
|
|
6108
|
+
|
|
6109
|
+
if (hook) {
|
|
6110
|
+
hook = Array.isArray(hook) ? hook : [hook];
|
|
6111
|
+
hook.forEach(function (fn) {
|
|
6112
|
+
invoke(function () {
|
|
6113
|
+
return fn(_objectSpread2(_objectSpread2({}, args || {}), {}, {
|
|
6114
|
+
rule: ctx.rule,
|
|
6115
|
+
api: _this2.api
|
|
6116
|
+
}));
|
|
6117
|
+
});
|
|
6118
|
+
});
|
|
6119
|
+
}
|
|
5927
6120
|
}
|
|
5928
6121
|
});
|
|
5929
6122
|
}
|
|
@@ -6391,7 +6584,7 @@
|
|
|
6391
6584
|
var unwatchs = [];
|
|
6392
6585
|
attrs.forEach(function (attr) {
|
|
6393
6586
|
if (attr && (attr.attr || attr.template)) {
|
|
6394
|
-
var
|
|
6587
|
+
var fn = function fn(get) {
|
|
6395
6588
|
var value;
|
|
6396
6589
|
|
|
6397
6590
|
if (attr.template) {
|
|
@@ -6417,7 +6610,14 @@
|
|
|
6417
6610
|
}
|
|
6418
6611
|
|
|
6419
6612
|
api.sync(rule);
|
|
6420
|
-
}
|
|
6613
|
+
};
|
|
6614
|
+
|
|
6615
|
+
var callback = function callback(get) {
|
|
6616
|
+
return fn(get);
|
|
6617
|
+
};
|
|
6618
|
+
|
|
6619
|
+
var unwatch = fc.watchLoadData(callback);
|
|
6620
|
+
fn = debounce(fn, attr.wait || 300);
|
|
6421
6621
|
|
|
6422
6622
|
if (attr.watch !== false) {
|
|
6423
6623
|
unwatchs.push(unwatch);
|
|
@@ -6433,15 +6633,81 @@
|
|
|
6433
6633
|
this._fn[inject.id].forEach(function (un) {
|
|
6434
6634
|
un();
|
|
6435
6635
|
});
|
|
6636
|
+
|
|
6637
|
+
delete this._fn[inject.id];
|
|
6436
6638
|
}
|
|
6437
6639
|
|
|
6438
6640
|
inject.clearProp();
|
|
6439
6641
|
}
|
|
6440
6642
|
};
|
|
6441
|
-
loadData.watch = loadData.
|
|
6643
|
+
loadData.watch = loadData.mounted;
|
|
6442
6644
|
return loadData;
|
|
6443
6645
|
};
|
|
6444
6646
|
|
|
6647
|
+
var t = function t(fc) {
|
|
6648
|
+
var t = {
|
|
6649
|
+
name: 't',
|
|
6650
|
+
_fn: [],
|
|
6651
|
+
loaded: function loaded(inject, rule, api) {
|
|
6652
|
+
this.deleted(inject);
|
|
6653
|
+
var attrs = inject.getValue() || {};
|
|
6654
|
+
var unwatchs = [];
|
|
6655
|
+
Object.keys(attrs).forEach(function (key) {
|
|
6656
|
+
var attr = attrs[key];
|
|
6657
|
+
|
|
6658
|
+
if (attr) {
|
|
6659
|
+
var isObj = _typeof(attr) === 'object';
|
|
6660
|
+
|
|
6661
|
+
var fn = function fn(get) {
|
|
6662
|
+
var value = fc.t(isObj ? attr.attr : attr, isObj ? attr.params : null, get);
|
|
6663
|
+
|
|
6664
|
+
var _rule = isObj && attr.modify ? rule : inject.getProp();
|
|
6665
|
+
|
|
6666
|
+
if (key === 'child') {
|
|
6667
|
+
if (_rule.children) {
|
|
6668
|
+
_rule.children[0] = value;
|
|
6669
|
+
} else {
|
|
6670
|
+
_rule.children = [value];
|
|
6671
|
+
}
|
|
6672
|
+
} else {
|
|
6673
|
+
deepSet(_rule, key, value);
|
|
6674
|
+
}
|
|
6675
|
+
|
|
6676
|
+
api.sync(rule);
|
|
6677
|
+
};
|
|
6678
|
+
|
|
6679
|
+
var callback = function callback(get) {
|
|
6680
|
+
return fn(get);
|
|
6681
|
+
};
|
|
6682
|
+
|
|
6683
|
+
var unwatch = fc.watchLoadData(callback);
|
|
6684
|
+
fn = debounce(fn, attr.wait || 300);
|
|
6685
|
+
|
|
6686
|
+
if (attr.watch !== false) {
|
|
6687
|
+
unwatchs.push(unwatch);
|
|
6688
|
+
} else {
|
|
6689
|
+
unwatch();
|
|
6690
|
+
}
|
|
6691
|
+
}
|
|
6692
|
+
});
|
|
6693
|
+
this._fn[inject.id] = unwatchs;
|
|
6694
|
+
},
|
|
6695
|
+
deleted: function deleted(inject) {
|
|
6696
|
+
if (this._fn[inject.id]) {
|
|
6697
|
+
this._fn[inject.id].forEach(function (un) {
|
|
6698
|
+
un();
|
|
6699
|
+
});
|
|
6700
|
+
|
|
6701
|
+
delete this._fn[inject.id];
|
|
6702
|
+
}
|
|
6703
|
+
|
|
6704
|
+
inject.clearProp();
|
|
6705
|
+
}
|
|
6706
|
+
};
|
|
6707
|
+
t.watch = t.loaded;
|
|
6708
|
+
return t;
|
|
6709
|
+
};
|
|
6710
|
+
|
|
6445
6711
|
var componentValidate = {
|
|
6446
6712
|
name: 'componentValidate',
|
|
6447
6713
|
load: function load(attr, rule, api) {
|
|
@@ -6512,6 +6778,13 @@
|
|
|
6512
6778
|
deepSet(inject.getProp(), option.to || 'options', val);
|
|
6513
6779
|
}
|
|
6514
6780
|
|
|
6781
|
+
if (val != null && option && option.key && fc.$handle.options.globalData[option.key]) {
|
|
6782
|
+
fc.fetchCache.set(fc.$handle.options.globalData[option.key], {
|
|
6783
|
+
status: true,
|
|
6784
|
+
data: val
|
|
6785
|
+
});
|
|
6786
|
+
}
|
|
6787
|
+
|
|
6515
6788
|
api.sync(rule);
|
|
6516
6789
|
};
|
|
6517
6790
|
|
|
@@ -6629,6 +6902,8 @@
|
|
|
6629
6902
|
deleted: function deleted(inject) {
|
|
6630
6903
|
if (this._fn[inject.id]) {
|
|
6631
6904
|
this._fn[inject.id]();
|
|
6905
|
+
|
|
6906
|
+
delete this._fn[inject.id];
|
|
6632
6907
|
}
|
|
6633
6908
|
|
|
6634
6909
|
inject.clearProp();
|
|
@@ -6640,6 +6915,7 @@
|
|
|
6640
6915
|
var $provider = {
|
|
6641
6916
|
fetch: fetch,
|
|
6642
6917
|
loadData: loadData,
|
|
6918
|
+
t: t,
|
|
6643
6919
|
componentValidate: componentValidate
|
|
6644
6920
|
};
|
|
6645
6921
|
|
|
@@ -7042,7 +7318,7 @@
|
|
|
7042
7318
|
options: vue.ref({}),
|
|
7043
7319
|
extendApiFn: extendApiFn,
|
|
7044
7320
|
fetchCache: new WeakMap(),
|
|
7045
|
-
tmpData: {}
|
|
7321
|
+
tmpData: vue.reactive({})
|
|
7046
7322
|
});
|
|
7047
7323
|
listener.forEach(function (item) {
|
|
7048
7324
|
_this.bus.$on(item.name, item.callback);
|
|
@@ -7117,6 +7393,26 @@
|
|
|
7117
7393
|
});
|
|
7118
7394
|
}
|
|
7119
7395
|
},
|
|
7396
|
+
t: function t(id, params, get) {
|
|
7397
|
+
var value = get ? get('$t.' + id) : this.globalLanguageDriver(id);
|
|
7398
|
+
|
|
7399
|
+
if (value == null && this.vm.appContext.config.globalProperties.$i18n) {
|
|
7400
|
+
return this.vm.appContext.config.globalProperties.$i18n.t(id, params);
|
|
7401
|
+
}
|
|
7402
|
+
|
|
7403
|
+
if (value == null) {
|
|
7404
|
+
value = '';
|
|
7405
|
+
}
|
|
7406
|
+
|
|
7407
|
+
if (value && params) {
|
|
7408
|
+
Object.keys(params).forEach(function (param) {
|
|
7409
|
+
var regex = new RegExp("{".concat(param, "}"), 'g');
|
|
7410
|
+
value = value.replace(regex, params[param]);
|
|
7411
|
+
});
|
|
7412
|
+
}
|
|
7413
|
+
|
|
7414
|
+
return value;
|
|
7415
|
+
},
|
|
7120
7416
|
globalDataDriver: function globalDataDriver(id) {
|
|
7121
7417
|
var _this4 = this;
|
|
7122
7418
|
|
|
@@ -7200,6 +7496,41 @@
|
|
|
7200
7496
|
}
|
|
7201
7497
|
}
|
|
7202
7498
|
},
|
|
7499
|
+
getLocale: function getLocale() {
|
|
7500
|
+
var locale = this.vm.setupState.top.props.locale;
|
|
7501
|
+
|
|
7502
|
+
if (locale && _typeof(locale) === 'object') {
|
|
7503
|
+
return locale.name;
|
|
7504
|
+
}
|
|
7505
|
+
|
|
7506
|
+
if (typeof locale === 'string') {
|
|
7507
|
+
return locale;
|
|
7508
|
+
}
|
|
7509
|
+
|
|
7510
|
+
if (this.vm.appContext.config.globalProperties.$i18n && this.vm.appContext.config.globalProperties.$i18n.locale) {
|
|
7511
|
+
return this.vm.appContext.config.globalProperties.$i18n.locale;
|
|
7512
|
+
}
|
|
7513
|
+
|
|
7514
|
+
return 'zh-cn';
|
|
7515
|
+
},
|
|
7516
|
+
globalLanguageDriver: function globalLanguageDriver(id) {
|
|
7517
|
+
var locale = this.vm.setupState.top.props.locale;
|
|
7518
|
+
var value = undefined;
|
|
7519
|
+
|
|
7520
|
+
if (locale && _typeof(locale) === 'object') {
|
|
7521
|
+
value = deepGet(locale, id);
|
|
7522
|
+
}
|
|
7523
|
+
|
|
7524
|
+
if (value == null) {
|
|
7525
|
+
var language = this.options.value.language || {};
|
|
7526
|
+
|
|
7527
|
+
var _locale = this.getLocale();
|
|
7528
|
+
|
|
7529
|
+
value = deepGet(language[_locale], id);
|
|
7530
|
+
}
|
|
7531
|
+
|
|
7532
|
+
return value;
|
|
7533
|
+
},
|
|
7203
7534
|
globalVarDriver: function globalVarDriver(id) {
|
|
7204
7535
|
var _this5 = this;
|
|
7205
7536
|
|
|
@@ -7257,6 +7588,12 @@
|
|
|
7257
7588
|
} else if (key === '$var') {
|
|
7258
7589
|
val = this.globalVarDriver(split.join('.'));
|
|
7259
7590
|
split = [];
|
|
7591
|
+
} else if (key === '$locale') {
|
|
7592
|
+
val = this.getLocale();
|
|
7593
|
+
split = [];
|
|
7594
|
+
} else if (key === '$t') {
|
|
7595
|
+
val = this.globalLanguageDriver(split.join('.'));
|
|
7596
|
+
split = [];
|
|
7260
7597
|
} else {
|
|
7261
7598
|
var tmpData = this.vm.setupState.top.setupState.fc.tmpData;
|
|
7262
7599
|
val = hasProperty(tmpData, key) ? deepGet(tmpData, id) : getData(id);
|
|
@@ -7286,8 +7623,9 @@
|
|
|
7286
7623
|
return unwatch[id].val;
|
|
7287
7624
|
}
|
|
7288
7625
|
|
|
7289
|
-
var
|
|
7290
|
-
|
|
7626
|
+
var data = vue.computed(function () {
|
|
7627
|
+
return _this6.getLoadData(id, def);
|
|
7628
|
+
});
|
|
7291
7629
|
var split = id.split('.');
|
|
7292
7630
|
var key = split.shift();
|
|
7293
7631
|
var key2 = split.shift() || '';
|
|
@@ -7301,6 +7639,9 @@
|
|
|
7301
7639
|
run(true);
|
|
7302
7640
|
}
|
|
7303
7641
|
}, 0);
|
|
7642
|
+
var un = vue.watch(data, function (n) {
|
|
7643
|
+
callback();
|
|
7644
|
+
});
|
|
7304
7645
|
|
|
7305
7646
|
_this6.bus.$on('$loadData.' + key, callback);
|
|
7306
7647
|
|
|
@@ -7315,10 +7656,12 @@
|
|
|
7315
7656
|
if (key2) {
|
|
7316
7657
|
_this6.bus.$off('$loadData.' + key + '.' + key2, callback);
|
|
7317
7658
|
}
|
|
7659
|
+
|
|
7660
|
+
un();
|
|
7318
7661
|
},
|
|
7319
|
-
val:
|
|
7662
|
+
val: data.value
|
|
7320
7663
|
};
|
|
7321
|
-
return
|
|
7664
|
+
return data.value;
|
|
7322
7665
|
};
|
|
7323
7666
|
|
|
7324
7667
|
run(false);
|
|
@@ -7356,7 +7699,7 @@
|
|
|
7356
7699
|
},
|
|
7357
7700
|
mergeOptions: function mergeOptions(target, opt, parent) {
|
|
7358
7701
|
opt = deepCopy(opt);
|
|
7359
|
-
parent && ['page', 'onSubmit', 'mounted', 'reload', 'formData', 'el', 'globalClass', 'style'].forEach(function (n) {
|
|
7702
|
+
parent && ['page', 'onSubmit', 'onReset', 'onCreated', 'onChange', 'onMounted', 'mounted', 'onReload', 'reload', 'formData', 'el', 'globalClass', 'style'].forEach(function (n) {
|
|
7360
7703
|
delete opt[n];
|
|
7361
7704
|
});
|
|
7362
7705
|
|
|
@@ -7690,6 +8033,7 @@
|
|
|
7690
8033
|
autoComplete: PRE + '-autocomplete',
|
|
7691
8034
|
auto: PRE + '-autocomplete',
|
|
7692
8035
|
group: 'fc-group',
|
|
8036
|
+
array: 'fc-group',
|
|
7693
8037
|
object: 'fc-sub-form',
|
|
7694
8038
|
subForm: 'fc-sub-form'
|
|
7695
8039
|
};
|
|
@@ -7808,12 +8152,9 @@
|
|
|
7808
8152
|
return prop;
|
|
7809
8153
|
},
|
|
7810
8154
|
mergeProp: function mergeProp(ctx) {
|
|
7811
|
-
|
|
7812
|
-
|
|
7813
|
-
|
|
7814
|
-
col: this.options.col || {},
|
|
7815
|
-
title: this.options.title || {}
|
|
7816
|
-
}, ctx.prop], {
|
|
8155
|
+
var _this2 = this;
|
|
8156
|
+
|
|
8157
|
+
var def = {
|
|
7817
8158
|
info: {
|
|
7818
8159
|
trigger: 'hover',
|
|
7819
8160
|
placement: 'top-start',
|
|
@@ -7824,8 +8165,9 @@
|
|
|
7824
8165
|
span: 24
|
|
7825
8166
|
},
|
|
7826
8167
|
wrap: {}
|
|
7827
|
-
}
|
|
7828
|
-
|
|
8168
|
+
};
|
|
8169
|
+
['info', 'wrap', 'col', 'title'].forEach(function (name) {
|
|
8170
|
+
ctx.prop[name] = mergeProps([_this2.options[name] || {}, ctx.prop[name] || {}], def[name]);
|
|
7829
8171
|
});
|
|
7830
8172
|
},
|
|
7831
8173
|
getDefaultOptions: function getDefaultOptions() {
|
|
@@ -7858,18 +8200,18 @@
|
|
|
7858
8200
|
});
|
|
7859
8201
|
},
|
|
7860
8202
|
render: function render(children) {
|
|
7861
|
-
var
|
|
8203
|
+
var _this3 = this;
|
|
7862
8204
|
|
|
7863
8205
|
if (children.slotLen() && !this.$handle.preview) {
|
|
7864
8206
|
children.setSlot(undefined, function () {
|
|
7865
|
-
return
|
|
8207
|
+
return _this3.makeFormBtn();
|
|
7866
8208
|
});
|
|
7867
8209
|
}
|
|
7868
8210
|
|
|
7869
8211
|
return this.$r(this.rule, isFalse(this.options.row.show) ? children.getSlots() : [this.makeRow(children)]);
|
|
7870
8212
|
},
|
|
7871
8213
|
makeWrap: function makeWrap(ctx, children) {
|
|
7872
|
-
var
|
|
8214
|
+
var _this4 = this;
|
|
7873
8215
|
|
|
7874
8216
|
var rule = ctx.prop;
|
|
7875
8217
|
var uni = "".concat(this.key).concat(ctx.key);
|
|
@@ -7888,7 +8230,7 @@
|
|
|
7888
8230
|
prop: ctx.id,
|
|
7889
8231
|
rules: ctx.injectValidate()
|
|
7890
8232
|
}),
|
|
7891
|
-
"class": rule.className,
|
|
8233
|
+
"class": this.$render.mergeClass(rule.className, 'fc-form-item'),
|
|
7892
8234
|
key: "".concat(uni, "fi"),
|
|
7893
8235
|
ref: ctx.wrapRef,
|
|
7894
8236
|
type: 'formItem'
|
|
@@ -7898,7 +8240,7 @@
|
|
|
7898
8240
|
}
|
|
7899
8241
|
}, isTitle ? {
|
|
7900
8242
|
label: function label() {
|
|
7901
|
-
return
|
|
8243
|
+
return _this4.makeInfo(rule, uni, ctx);
|
|
7902
8244
|
}
|
|
7903
8245
|
} : {}));
|
|
7904
8246
|
return inline === true || isFalse(_col) || isFalse(col.show) ? item : this.makeCol(rule, uni, [item]);
|
|
@@ -7909,7 +8251,7 @@
|
|
|
7909
8251
|
return !(!title.title && !title["native"] || isFalse(title.show));
|
|
7910
8252
|
},
|
|
7911
8253
|
makeInfo: function makeInfo(rule, uni, ctx) {
|
|
7912
|
-
var
|
|
8254
|
+
var _this5 = this;
|
|
7913
8255
|
|
|
7914
8256
|
var titleProp = _objectSpread2({}, rule.title);
|
|
7915
8257
|
|
|
@@ -7919,10 +8261,10 @@
|
|
|
7919
8261
|
var form = this.options.form;
|
|
7920
8262
|
var titleSlot = this.getSlot('title');
|
|
7921
8263
|
var children = [titleSlot ? titleSlot({
|
|
7922
|
-
title:
|
|
8264
|
+
title: ctx.refRule.__$title.value,
|
|
7923
8265
|
rule: ctx.rule,
|
|
7924
8266
|
options: this.options
|
|
7925
|
-
}) :
|
|
8267
|
+
}) : ctx.refRule.__$title.value + (form.labelSuffix || form['label-suffix'] || '')];
|
|
7926
8268
|
|
|
7927
8269
|
if (!isFalse(infoProp.show) && (infoProp.info || infoProp["native"]) && !isFalse(infoProp.icon)) {
|
|
7928
8270
|
var prop = {
|
|
@@ -7938,17 +8280,17 @@
|
|
|
7938
8280
|
var field = 'content';
|
|
7939
8281
|
|
|
7940
8282
|
if (infoProp.info && !hasProperty(prop.props, field)) {
|
|
7941
|
-
prop.props[field] =
|
|
8283
|
+
prop.props[field] = ctx.refRule.__$info.value;
|
|
7942
8284
|
}
|
|
7943
8285
|
|
|
7944
8286
|
children[infoProp.align !== 'left' ? 'unshift' : 'push'](this.$r(mergeProps([infoProp, prop]), _defineProperty({}, titleProp.slot || (isTip ? 'default' : 'reference'), function () {
|
|
7945
|
-
return
|
|
8287
|
+
return _this5.$r({
|
|
7946
8288
|
type: 'ElIcon',
|
|
7947
8289
|
style: 'top:2px',
|
|
7948
8290
|
key: "".concat(uni, "i")
|
|
7949
8291
|
}, {
|
|
7950
8292
|
"default": function _default() {
|
|
7951
|
-
return
|
|
8293
|
+
return _this5.$r({
|
|
7952
8294
|
type: infoProp.icon === true ? 'icon-warning' : infoProp.icon
|
|
7953
8295
|
});
|
|
7954
8296
|
}
|
|
@@ -7959,6 +8301,7 @@
|
|
|
7959
8301
|
var _prop = mergeProps([titleProp, {
|
|
7960
8302
|
props: tidyRule(titleProp),
|
|
7961
8303
|
key: "".concat(uni, "tit"),
|
|
8304
|
+
"class": 'fc-form-title',
|
|
7962
8305
|
type: titleProp.type || 'span'
|
|
7963
8306
|
}]);
|
|
7964
8307
|
|
|
@@ -7970,7 +8313,7 @@
|
|
|
7970
8313
|
makeCol: function makeCol(rule, uni, children) {
|
|
7971
8314
|
var col = rule.col;
|
|
7972
8315
|
return this.$r({
|
|
7973
|
-
"class": col["class"],
|
|
8316
|
+
"class": this.$render.mergeClass(col["class"], 'fc-form-col'),
|
|
7974
8317
|
type: 'col',
|
|
7975
8318
|
props: col || {
|
|
7976
8319
|
span: 24
|
|
@@ -7983,7 +8326,7 @@
|
|
|
7983
8326
|
return this.$r({
|
|
7984
8327
|
type: 'row',
|
|
7985
8328
|
props: row,
|
|
7986
|
-
"class": row["class"],
|
|
8329
|
+
"class": this.$render.mergeClass(row["class"], 'fc-form-row'),
|
|
7987
8330
|
key: "".concat(this.key, "row")
|
|
7988
8331
|
}, children);
|
|
7989
8332
|
},
|
|
@@ -8004,10 +8347,12 @@
|
|
|
8004
8347
|
|
|
8005
8348
|
var item = this.$r({
|
|
8006
8349
|
type: 'formItem',
|
|
8350
|
+
"class": 'fc-form-item',
|
|
8007
8351
|
key: "".concat(this.key, "fb")
|
|
8008
8352
|
}, vn);
|
|
8009
8353
|
return this.rule.props.inline === true ? item : this.$r({
|
|
8010
8354
|
type: 'col',
|
|
8355
|
+
"class": 'fc-form-col fc-form-footer',
|
|
8011
8356
|
props: {
|
|
8012
8357
|
span: 24
|
|
8013
8358
|
},
|
|
@@ -8015,7 +8360,7 @@
|
|
|
8015
8360
|
}, [item]);
|
|
8016
8361
|
},
|
|
8017
8362
|
makeResetBtn: function makeResetBtn() {
|
|
8018
|
-
var
|
|
8363
|
+
var _this6 = this;
|
|
8019
8364
|
|
|
8020
8365
|
var resetBtn = _objectSpread2({}, this.options.resetBtn);
|
|
8021
8366
|
|
|
@@ -8027,21 +8372,21 @@
|
|
|
8027
8372
|
return this.$r({
|
|
8028
8373
|
type: 'button',
|
|
8029
8374
|
props: resetBtn,
|
|
8030
|
-
"class": '
|
|
8375
|
+
"class": 'fc-reset-btn',
|
|
8031
8376
|
style: {
|
|
8032
8377
|
width: resetBtn.width
|
|
8033
8378
|
},
|
|
8034
8379
|
on: {
|
|
8035
8380
|
click: function click() {
|
|
8036
|
-
var fApi =
|
|
8037
|
-
|
|
8381
|
+
var fApi = _this6.$handle.api;
|
|
8382
|
+
_this6.options.resetBtn.click ? _this6.options.resetBtn.click(fApi) : fApi.resetFields();
|
|
8038
8383
|
}
|
|
8039
8384
|
},
|
|
8040
8385
|
key: "".concat(this.key, "b2")
|
|
8041
8386
|
}, [innerText]);
|
|
8042
8387
|
},
|
|
8043
8388
|
makeSubmitBtn: function makeSubmitBtn() {
|
|
8044
|
-
var
|
|
8389
|
+
var _this7 = this;
|
|
8045
8390
|
|
|
8046
8391
|
var submitBtn = _objectSpread2({}, this.options.submitBtn);
|
|
8047
8392
|
|
|
@@ -8053,14 +8398,14 @@
|
|
|
8053
8398
|
return this.$r({
|
|
8054
8399
|
type: 'button',
|
|
8055
8400
|
props: submitBtn,
|
|
8056
|
-
"class": '
|
|
8401
|
+
"class": 'fc-submit-btn',
|
|
8057
8402
|
style: {
|
|
8058
8403
|
width: submitBtn.width
|
|
8059
8404
|
},
|
|
8060
8405
|
on: {
|
|
8061
8406
|
click: function click() {
|
|
8062
|
-
var fApi =
|
|
8063
|
-
|
|
8407
|
+
var fApi = _this7.$handle.api;
|
|
8408
|
+
_this7.options.submitBtn.click ? _this7.options.submitBtn.click(fApi) : fApi.submit()["catch"](function () {});
|
|
8064
8409
|
}
|
|
8065
8410
|
},
|
|
8066
8411
|
key: "".concat(this.key, "b1")
|
|
@@ -8150,7 +8495,7 @@
|
|
|
8150
8495
|
return maker;
|
|
8151
8496
|
}
|
|
8152
8497
|
|
|
8153
|
-
var css_248z = ".form-create .form-create .el-form-item{margin-bottom:22px}.form-create{width:100%}.form-create .fc-none,.form-create.is-preview .el-form-item.is-required>.el-form-item__label-wrap>.el-form-item__label:before,.form-create.is-preview .el-form-item.is-required>.el-form-item__label:before,.form-create.is-preview .fc-clock{display:none!important}.fc-wrap-right
|
|
8498
|
+
var css_248z = ".form-create .form-create .el-form-item{margin-bottom:22px}.form-create{width:100%}.form-create .fc-none,.form-create.is-preview .el-form-item.is-required>.el-form-item__label-wrap>.el-form-item__label:before,.form-create.is-preview .el-form-item.is-required>.el-form-item__label:before,.form-create.is-preview .fc-clock{display:none!important}.fc-wrap-right>.el-form-item__label{display:flex;justify-content:flex-end}.fc-wrap-left>.el-form-item__label{display:flex;justify-content:flex-start}.fc-wrap-top.el-form-item{display:block}.fc-wrap-top.el-form-item>.el-form-item__label{display:block;height:auto;line-height:22px;margin-bottom:8px;text-align:left}.el-form--large .fc-wrap-top.el-form-item>.el-form-item__label{line-height:22px;margin-bottom:12px}.el-form--default .fc-wrap-top.el-form-item>.el-form-item__label{line-height:22px;margin-bottom:8px}.el-form--small .fc-wrap-top.el-form-item>.el-form-item__label{line-height:20px;margin-bottom:4px}.fc-form-footer{margin-top:12px}";
|
|
8154
8499
|
styleInject(css_248z);
|
|
8155
8500
|
|
|
8156
8501
|
function tidyBtnProp(btn, def) {
|
|
@@ -8342,8 +8687,15 @@
|
|
|
8342
8687
|
}, val);
|
|
8343
8688
|
|
|
8344
8689
|
if (!validate.message) {
|
|
8345
|
-
|
|
8346
|
-
|
|
8690
|
+
validate.message = rule.__fc__.refRule.__$title.value + (api.getLocale() === 'en' ? ' is required' : '不能为空');
|
|
8691
|
+
} else {
|
|
8692
|
+
var match = validate.message.match(/^\{\{\s*\$t\.(.+)\s*\}\}$/);
|
|
8693
|
+
|
|
8694
|
+
if (match) {
|
|
8695
|
+
validate.message = api.t(match[1], {
|
|
8696
|
+
title: rule.__fc__.refRule.__$title.value
|
|
8697
|
+
});
|
|
8698
|
+
}
|
|
8347
8699
|
}
|
|
8348
8700
|
|
|
8349
8701
|
inject.getProp().validate = [validate];
|
|
@@ -8403,7 +8755,7 @@
|
|
|
8403
8755
|
function elmFormCreate() {
|
|
8404
8756
|
return FormCreateFactory({
|
|
8405
8757
|
ui: 'element-ui',
|
|
8406
|
-
version: '3.2.
|
|
8758
|
+
version: '3.2.15',
|
|
8407
8759
|
manager: manager,
|
|
8408
8760
|
extendApi: extendApi,
|
|
8409
8761
|
install: install,
|