@form-create/element-ui 3.2.13 → 3.2.14
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/dist/form-create.esm.js +444 -125
- package/dist/form-create.esm.min.js +2 -2
- package/dist/form-create.js +443 -124
- 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 +4 -0
package/dist/form-create.esm.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @form-create/element-ui v3.2.
|
|
2
|
+
* @form-create/element-ui v3.2.14
|
|
3
3
|
* (c) 2018-2024 xaboy
|
|
4
4
|
* Github https://github.com/xaboy/form-create
|
|
5
5
|
* Released under the MIT License.
|
|
6
6
|
*/
|
|
7
|
-
import { defineComponent, toRef, ref, watch, createVNode, resolveComponent, mergeProps as mergeProps$1, openBlock, createElementBlock, createElementVNode, isVNode, nextTick, createTextVNode, markRaw, reactive, getCurrentInstance, provide, inject, toRefs, onBeforeMount, watchEffect, onMounted, onBeforeUnmount, onUpdated,
|
|
7
|
+
import { defineComponent, toRef, ref, watch, computed, createVNode, resolveComponent, mergeProps as mergeProps$1, openBlock, createElementBlock, createElementVNode, isVNode, nextTick, createTextVNode, markRaw, reactive, getCurrentInstance, provide, inject, toRefs, onBeforeMount, watchEffect, onMounted, onBeforeUnmount, onUpdated, withDirectives, resolveDirective, createApp, h } from 'vue';
|
|
8
8
|
|
|
9
9
|
function ownKeys(object, enumerableOnly) {
|
|
10
10
|
var keys = Object.keys(object);
|
|
@@ -222,12 +222,14 @@ var Checkbox = defineComponent({
|
|
|
222
222
|
}
|
|
223
223
|
},
|
|
224
224
|
type: String,
|
|
225
|
+
options: Array,
|
|
225
226
|
input: Boolean,
|
|
226
227
|
inputValue: String
|
|
227
228
|
},
|
|
228
229
|
emits: ['update:modelValue', 'fc.el'],
|
|
229
230
|
setup: function setup(props, _) {
|
|
230
231
|
var options = toRef(props.formCreateInject, 'options', []);
|
|
232
|
+
var opt = toRef(props, 'options');
|
|
231
233
|
var value = toRef(props, 'modelValue');
|
|
232
234
|
var inputValue = toRef(props, 'inputValue', '');
|
|
233
235
|
var customValue = ref(inputValue.value);
|
|
@@ -258,9 +260,37 @@ var Checkbox = defineComponent({
|
|
|
258
260
|
updateCustomValue(n);
|
|
259
261
|
});
|
|
260
262
|
|
|
261
|
-
var _options = function
|
|
262
|
-
|
|
263
|
-
|
|
263
|
+
var _options = computed(function () {
|
|
264
|
+
var arr = options.value || [];
|
|
265
|
+
|
|
266
|
+
if (opt.value) {
|
|
267
|
+
arr = opt.value || [];
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
return Array.isArray(arr) ? arr : [];
|
|
271
|
+
});
|
|
272
|
+
|
|
273
|
+
watch(value, function (n) {
|
|
274
|
+
var value = null;
|
|
275
|
+
|
|
276
|
+
if (!inputValue.value && n != null && Array.isArray(n) && n.length > 0 && input.value) {
|
|
277
|
+
var values = _options.value.map(function (item) {
|
|
278
|
+
return item.value;
|
|
279
|
+
});
|
|
280
|
+
|
|
281
|
+
n.forEach(function (val) {
|
|
282
|
+
if (values.indexOf(val) === -1) {
|
|
283
|
+
value = val;
|
|
284
|
+
}
|
|
285
|
+
});
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
if (value != null) {
|
|
289
|
+
customValue.value = value;
|
|
290
|
+
}
|
|
291
|
+
}, {
|
|
292
|
+
immediate: true
|
|
293
|
+
});
|
|
264
294
|
|
|
265
295
|
var onInput = function onInput(n) {
|
|
266
296
|
_.emit('update:modelValue', n);
|
|
@@ -304,7 +334,7 @@ var Checkbox = defineComponent({
|
|
|
304
334
|
"ref": "el"
|
|
305
335
|
}), _objectSpread2({
|
|
306
336
|
"default": function _default() {
|
|
307
|
-
return [_this.options
|
|
337
|
+
return [_this.options.map(function (opt, index) {
|
|
308
338
|
var props = _objectSpread2({}, opt);
|
|
309
339
|
|
|
310
340
|
var value = props.value;
|
|
@@ -1015,6 +1045,7 @@ var Radio = defineComponent({
|
|
|
1015
1045
|
type: [String, Number, Boolean],
|
|
1016
1046
|
"default": ''
|
|
1017
1047
|
},
|
|
1048
|
+
options: Array,
|
|
1018
1049
|
type: String,
|
|
1019
1050
|
input: Boolean,
|
|
1020
1051
|
inputValue: String
|
|
@@ -1022,15 +1053,11 @@ var Radio = defineComponent({
|
|
|
1022
1053
|
emits: ['update:modelValue', 'fc.el'],
|
|
1023
1054
|
setup: function setup(props, _) {
|
|
1024
1055
|
var options = toRef(props.formCreateInject, 'options', []);
|
|
1056
|
+
var opt = toRef(props, 'options');
|
|
1025
1057
|
var value = toRef(props, 'modelValue');
|
|
1026
1058
|
var inputValue = toRef(props, 'inputValue', '');
|
|
1027
1059
|
var customValue = ref(inputValue.value);
|
|
1028
1060
|
var input = toRef(props, 'input', false);
|
|
1029
|
-
|
|
1030
|
-
var _options = function _options() {
|
|
1031
|
-
return Array.isArray(options.value) ? options.value : [];
|
|
1032
|
-
};
|
|
1033
|
-
|
|
1034
1061
|
watch(inputValue, function (n) {
|
|
1035
1062
|
if (!input.value) {
|
|
1036
1063
|
customValue.value = n;
|
|
@@ -1040,6 +1067,32 @@ var Radio = defineComponent({
|
|
|
1040
1067
|
updateCustomValue(n);
|
|
1041
1068
|
});
|
|
1042
1069
|
|
|
1070
|
+
var _options = computed(function () {
|
|
1071
|
+
var arr = options.value || [];
|
|
1072
|
+
|
|
1073
|
+
if (opt.value) {
|
|
1074
|
+
arr = opt.value || [];
|
|
1075
|
+
}
|
|
1076
|
+
|
|
1077
|
+
return Array.isArray(arr) ? arr : [];
|
|
1078
|
+
});
|
|
1079
|
+
|
|
1080
|
+
watch(value, function (n) {
|
|
1081
|
+
var flag = false;
|
|
1082
|
+
|
|
1083
|
+
if (!inputValue.value && n != null && input.value) {
|
|
1084
|
+
flag = _options.value.map(function (item) {
|
|
1085
|
+
return item.value;
|
|
1086
|
+
}).indexOf(n) === -1;
|
|
1087
|
+
}
|
|
1088
|
+
|
|
1089
|
+
if (flag) {
|
|
1090
|
+
customValue.value = n;
|
|
1091
|
+
}
|
|
1092
|
+
}, {
|
|
1093
|
+
immediate: true
|
|
1094
|
+
});
|
|
1095
|
+
|
|
1043
1096
|
var onInput = function onInput(n) {
|
|
1044
1097
|
_.emit('update:modelValue', n);
|
|
1045
1098
|
};
|
|
@@ -1093,7 +1146,7 @@ var Radio = defineComponent({
|
|
|
1093
1146
|
"ref": "el"
|
|
1094
1147
|
}), _objectSpread2({
|
|
1095
1148
|
"default": function _default() {
|
|
1096
|
-
return [_this.options
|
|
1149
|
+
return [_this.options.map(function (opt, index) {
|
|
1097
1150
|
var props = _objectSpread2({}, opt);
|
|
1098
1151
|
|
|
1099
1152
|
var value = props.value;
|
|
@@ -1396,7 +1449,7 @@ var Upload = defineComponent({
|
|
|
1396
1449
|
var files = fileList.map(function (v) {
|
|
1397
1450
|
return v.is_string ? v.url : v.value || v.url;
|
|
1398
1451
|
}).filter(function (url) {
|
|
1399
|
-
return url !== undefined;
|
|
1452
|
+
return url !== undefined && url.indexOf('blob:') !== 0;
|
|
1400
1453
|
});
|
|
1401
1454
|
this.$emit('update:modelValue', files);
|
|
1402
1455
|
},
|
|
@@ -1437,7 +1490,7 @@ var Upload = defineComponent({
|
|
|
1437
1490
|
"ref": "upload"
|
|
1438
1491
|
}), _objectSpread2({
|
|
1439
1492
|
"default": function _default() {
|
|
1440
|
-
return [(_this$$slots$default = (_this$$slots = _this.$slots)["default"])
|
|
1493
|
+
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 ? createVNode(resolveComponent("ElIcon"), null, {
|
|
1441
1494
|
"default": function _default() {
|
|
1442
1495
|
return [createVNode(script$1, null, null)];
|
|
1443
1496
|
}
|
|
@@ -1447,7 +1500,7 @@ var Upload = defineComponent({
|
|
|
1447
1500
|
"default": function _default() {
|
|
1448
1501
|
return [createTextVNode("\u70B9\u51FB\u4E0A\u4F20")];
|
|
1449
1502
|
}
|
|
1450
|
-
})];
|
|
1503
|
+
}))];
|
|
1451
1504
|
}
|
|
1452
1505
|
}, getSlot(this.$slots, ['default']))), createVNode(resolveComponent("ElDialog"), {
|
|
1453
1506
|
"appendToBody": true,
|
|
@@ -2146,6 +2199,7 @@ function $FormCreate(FormCreate, components, directives) {
|
|
|
2146
2199
|
},
|
|
2147
2200
|
index: [String, Number],
|
|
2148
2201
|
api: Object,
|
|
2202
|
+
locale: [String, Object],
|
|
2149
2203
|
name: String,
|
|
2150
2204
|
subForm: {
|
|
2151
2205
|
type: Boolean,
|
|
@@ -2389,7 +2443,7 @@ function $FormCreate(FormCreate, components, directives) {
|
|
|
2389
2443
|
|
|
2390
2444
|
var normalMerge = ['props'];
|
|
2391
2445
|
var toArrayMerge = ['class', 'style', 'directives'];
|
|
2392
|
-
var functionalMerge = ['on'];
|
|
2446
|
+
var functionalMerge = ['on', 'hook'];
|
|
2393
2447
|
|
|
2394
2448
|
var mergeProps = function mergeProps(objects) {
|
|
2395
2449
|
var initial = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
@@ -2486,15 +2540,11 @@ function lower(str) {
|
|
|
2486
2540
|
|
|
2487
2541
|
var PREFIX = '[[FORM-CREATE-PREFIX-';
|
|
2488
2542
|
var SUFFIX = '-FORM-CREATE-SUFFIX]]';
|
|
2489
|
-
var $T = '$FN:';
|
|
2490
|
-
var $TX = '$FNX:';
|
|
2491
|
-
var $ON = '$GLOBAL:';
|
|
2492
|
-
var FUNCTION = 'function';
|
|
2493
2543
|
function toJson(obj, space) {
|
|
2494
2544
|
return JSON.stringify(deepExtend(Array.isArray(obj) ? [] : {}, obj, true), function (key, val) {
|
|
2495
2545
|
if (val && val._isVue === true) return undefined;
|
|
2496
2546
|
|
|
2497
|
-
if (
|
|
2547
|
+
if (typeof val !== 'function') {
|
|
2498
2548
|
return val;
|
|
2499
2549
|
}
|
|
2500
2550
|
|
|
@@ -2521,11 +2571,14 @@ function parseFn(fn, mode) {
|
|
|
2521
2571
|
if (v.indexOf(SUFFIX) > 0 && v.indexOf(PREFIX) === 0) {
|
|
2522
2572
|
v = v.replace(SUFFIX, '').replace(PREFIX, '');
|
|
2523
2573
|
flag = true;
|
|
2524
|
-
} else if (v.indexOf($
|
|
2525
|
-
v = v.
|
|
2574
|
+
} else if (v.indexOf('$FN:') === 0) {
|
|
2575
|
+
v = v.substring(4);
|
|
2576
|
+
flag = true;
|
|
2577
|
+
} else if (v.indexOf('$EXEC:') === 0) {
|
|
2578
|
+
v = v.substring(6);
|
|
2526
2579
|
flag = true;
|
|
2527
|
-
} else if (v.indexOf($
|
|
2528
|
-
var name = v.
|
|
2580
|
+
} else if (v.indexOf('$GLOBAL:') === 0) {
|
|
2581
|
+
var name = v.substring(8);
|
|
2529
2582
|
|
|
2530
2583
|
v = function v() {
|
|
2531
2584
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
@@ -2544,17 +2597,19 @@ function parseFn(fn, mode) {
|
|
|
2544
2597
|
v.__json = fn;
|
|
2545
2598
|
v.__inject = true;
|
|
2546
2599
|
return v;
|
|
2547
|
-
} else if (v.indexOf($
|
|
2548
|
-
v = makeFn('function($inject){' + v.
|
|
2600
|
+
} else if (v.indexOf('$FNX:') === 0) {
|
|
2601
|
+
v = makeFn('function($inject){' + v.substring(5) + '}');
|
|
2549
2602
|
v.__json = fn;
|
|
2550
2603
|
v.__inject = true;
|
|
2551
2604
|
return v;
|
|
2552
|
-
} else if (!mode && v.indexOf(
|
|
2605
|
+
} else if (!mode && v.indexOf('function ') === 0 && v !== 'function ') {
|
|
2606
|
+
flag = true;
|
|
2607
|
+
} else if (!mode && v.indexOf('function(') === 0 && v !== 'function(') {
|
|
2553
2608
|
flag = true;
|
|
2554
2609
|
}
|
|
2555
2610
|
|
|
2556
2611
|
if (!flag) return fn;
|
|
2557
|
-
var val = makeFn(v
|
|
2612
|
+
var val = makeFn(v);
|
|
2558
2613
|
val.__json = fn;
|
|
2559
2614
|
return val;
|
|
2560
2615
|
} catch (e) {
|
|
@@ -2920,7 +2975,17 @@ function fetch$1(option) {
|
|
|
2920
2975
|
}
|
|
2921
2976
|
|
|
2922
2977
|
var xhr = new XMLHttpRequest();
|
|
2923
|
-
var action = option.action;
|
|
2978
|
+
var action = option.action || '';
|
|
2979
|
+
|
|
2980
|
+
if (option.query) {
|
|
2981
|
+
var queryString = new URLSearchParams(option.query).toString();
|
|
2982
|
+
|
|
2983
|
+
if (action.includes('?')) {
|
|
2984
|
+
action += "&".concat(queryString);
|
|
2985
|
+
} else {
|
|
2986
|
+
action += "?".concat(queryString);
|
|
2987
|
+
}
|
|
2988
|
+
}
|
|
2924
2989
|
|
|
2925
2990
|
xhr.onerror = function error(e) {
|
|
2926
2991
|
option.onError(e);
|
|
@@ -2961,7 +3026,7 @@ function fetch$1(option) {
|
|
|
2961
3026
|
});
|
|
2962
3027
|
xhr.send(formData);
|
|
2963
3028
|
}
|
|
2964
|
-
function asyncFetch(config, _fetch) {
|
|
3029
|
+
function asyncFetch(config, _fetch, api) {
|
|
2965
3030
|
return new Promise(function (resolve, reject) {
|
|
2966
3031
|
(_fetch || fetch$1)(_objectSpread2(_objectSpread2({}, config), {}, {
|
|
2967
3032
|
onSuccess: function onSuccess(res) {
|
|
@@ -2979,7 +3044,7 @@ function asyncFetch(config, _fetch) {
|
|
|
2979
3044
|
};
|
|
2980
3045
|
}
|
|
2981
3046
|
|
|
2982
|
-
resolve(fn(res));
|
|
3047
|
+
resolve(fn(res, undefined, api));
|
|
2983
3048
|
},
|
|
2984
3049
|
onError: function onError(err) {
|
|
2985
3050
|
reject(err);
|
|
@@ -3584,7 +3649,7 @@ function Api(h) {
|
|
|
3584
3649
|
opt = deepCopy(opt);
|
|
3585
3650
|
opt = h.loadFetchVar(opt);
|
|
3586
3651
|
h.beforeFetch(opt).then(function () {
|
|
3587
|
-
return asyncFetch(opt, h.fc.create.fetch).then(function (res) {
|
|
3652
|
+
return asyncFetch(opt, h.fc.create.fetch, api).then(function (res) {
|
|
3588
3653
|
invoke(function () {
|
|
3589
3654
|
return opt.onSuccess && opt.onSuccess(res);
|
|
3590
3655
|
});
|
|
@@ -3604,7 +3669,7 @@ function Api(h) {
|
|
|
3604
3669
|
|
|
3605
3670
|
_opt = h.loadFetchVar(_opt, get);
|
|
3606
3671
|
h.beforeFetch(_opt).then(function () {
|
|
3607
|
-
return asyncFetch(_opt, h.fc.create.fetch).then(function (res) {
|
|
3672
|
+
return asyncFetch(_opt, h.fc.create.fetch, api).then(function (res) {
|
|
3608
3673
|
invoke(function () {
|
|
3609
3674
|
return _opt.onSuccess && _opt.onSuccess(res);
|
|
3610
3675
|
});
|
|
@@ -3627,6 +3692,12 @@ function Api(h) {
|
|
|
3627
3692
|
refreshData: function refreshData(id) {
|
|
3628
3693
|
return h.fc.refreshData(id);
|
|
3629
3694
|
},
|
|
3695
|
+
t: function t(id, params) {
|
|
3696
|
+
return h.fc.t(id, params);
|
|
3697
|
+
},
|
|
3698
|
+
getLocale: function getLocale() {
|
|
3699
|
+
return h.fc.getLocale();
|
|
3700
|
+
},
|
|
3630
3701
|
helper: {
|
|
3631
3702
|
tidyFields: tidyFields,
|
|
3632
3703
|
props: props
|
|
@@ -3957,15 +4028,19 @@ function useRender$1(Render) {
|
|
|
3957
4028
|
},
|
|
3958
4029
|
none: function none(vn) {
|
|
3959
4030
|
if (vn) {
|
|
3960
|
-
|
|
3961
|
-
vn.props["class"].push('fc-none');
|
|
3962
|
-
} else {
|
|
3963
|
-
vn.props["class"] = vn.props["class"] ? [vn.props["class"], 'fc-none'] : 'fc-none';
|
|
3964
|
-
}
|
|
3965
|
-
|
|
4031
|
+
vn.props["class"] = this.mergeClass(vn.props["class"], 'fc-none');
|
|
3966
4032
|
return vn;
|
|
3967
4033
|
}
|
|
3968
4034
|
},
|
|
4035
|
+
mergeClass: function mergeClass(target, value) {
|
|
4036
|
+
if (Array.isArray(target)) {
|
|
4037
|
+
target.push(value);
|
|
4038
|
+
} else {
|
|
4039
|
+
return target ? [target, value] : value;
|
|
4040
|
+
}
|
|
4041
|
+
|
|
4042
|
+
return target;
|
|
4043
|
+
},
|
|
3969
4044
|
stable: function stable(vn) {
|
|
3970
4045
|
var _this5 = this;
|
|
3971
4046
|
|
|
@@ -4065,6 +4140,7 @@ function useRender$1(Render) {
|
|
|
4065
4140
|
callback: function callback(value) {
|
|
4066
4141
|
_this7.onInput(ctx, value);
|
|
4067
4142
|
},
|
|
4143
|
+
modelField: field,
|
|
4068
4144
|
value: this.$handle.getFormData(ctx)
|
|
4069
4145
|
};
|
|
4070
4146
|
props.push({
|
|
@@ -4083,6 +4159,7 @@ function useRender$1(Render) {
|
|
|
4083
4159
|
ctx.el = this.vm.refs[ctx.ref] || el;
|
|
4084
4160
|
ctx.parser.mounted(ctx);
|
|
4085
4161
|
this.$handle.effect(ctx, 'mounted');
|
|
4162
|
+
this.$handle.targetHook(ctx, 'mounted');
|
|
4086
4163
|
},
|
|
4087
4164
|
onInput: function onInput(ctx, value) {
|
|
4088
4165
|
if (ctx.prop.modelEmit) {
|
|
@@ -4644,43 +4721,17 @@ extend(RuleContext.prototype, {
|
|
|
4644
4721
|
var rule = _objectSpread2({}, this.rule);
|
|
4645
4722
|
|
|
4646
4723
|
delete rule.children;
|
|
4724
|
+
delete rule.validate;
|
|
4647
4725
|
this.prop = mergeRule({}, [rule].concat(_toConsumableArray(Object.keys(this.payload).map(function (k) {
|
|
4648
4726
|
return _this3.payload[k];
|
|
4649
4727
|
})), [this.computed]));
|
|
4728
|
+
this.prop.validate = [].concat(_toConsumableArray(this.refRule.__$validate.value || []), _toConsumableArray(this.prop.validate || []));
|
|
4650
4729
|
},
|
|
4651
4730
|
initNone: function initNone() {
|
|
4652
4731
|
this.none = !(is.Undef(this.prop.display) || !!this.prop.display);
|
|
4653
4732
|
},
|
|
4654
4733
|
injectValidate: function injectValidate() {
|
|
4655
|
-
|
|
4656
|
-
|
|
4657
|
-
return toArray(this.prop.validate).map(function (item) {
|
|
4658
|
-
if (is.Function(item.validator)) {
|
|
4659
|
-
var temp = _objectSpread2({}, item);
|
|
4660
|
-
|
|
4661
|
-
var that = _this4;
|
|
4662
|
-
|
|
4663
|
-
temp.validator = function () {
|
|
4664
|
-
var _item$validator;
|
|
4665
|
-
|
|
4666
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
4667
|
-
args[_key] = arguments[_key];
|
|
4668
|
-
}
|
|
4669
|
-
|
|
4670
|
-
return (_item$validator = item.validator).call.apply(_item$validator, [{
|
|
4671
|
-
that: this,
|
|
4672
|
-
id: that.id,
|
|
4673
|
-
field: that.field,
|
|
4674
|
-
rule: that.rule,
|
|
4675
|
-
api: that.$handle.api
|
|
4676
|
-
}].concat(args));
|
|
4677
|
-
};
|
|
4678
|
-
|
|
4679
|
-
return temp;
|
|
4680
|
-
}
|
|
4681
|
-
|
|
4682
|
-
return item;
|
|
4683
|
-
});
|
|
4734
|
+
return this.prop.validate;
|
|
4684
4735
|
},
|
|
4685
4736
|
check: function check(handle) {
|
|
4686
4737
|
return this.vm === handle.vm;
|
|
@@ -4730,15 +4781,15 @@ extend(RuleContext.prototype, {
|
|
|
4730
4781
|
this.ctrlRule = [];
|
|
4731
4782
|
},
|
|
4732
4783
|
rm: function rm() {
|
|
4733
|
-
var
|
|
4784
|
+
var _this4 = this;
|
|
4734
4785
|
|
|
4735
4786
|
var _rm = function _rm() {
|
|
4736
|
-
var index =
|
|
4787
|
+
var index = _this4.root.indexOf(_this4.origin);
|
|
4737
4788
|
|
|
4738
4789
|
if (index > -1) {
|
|
4739
|
-
|
|
4790
|
+
_this4.root.splice(index, 1);
|
|
4740
4791
|
|
|
4741
|
-
|
|
4792
|
+
_this4.$handle && _this4.$handle.refresh();
|
|
4742
4793
|
}
|
|
4743
4794
|
};
|
|
4744
4795
|
|
|
@@ -4749,17 +4800,17 @@ extend(RuleContext.prototype, {
|
|
|
4749
4800
|
}
|
|
4750
4801
|
|
|
4751
4802
|
this.$handle.noWatch(function () {
|
|
4752
|
-
|
|
4753
|
-
|
|
4803
|
+
_this4.$handle.deferSyncValue(function () {
|
|
4804
|
+
_this4.rmCtrl();
|
|
4754
4805
|
|
|
4755
4806
|
_rm();
|
|
4756
4807
|
|
|
4757
|
-
|
|
4808
|
+
_this4.$handle.rmCtx(_this4);
|
|
4758
4809
|
|
|
4759
|
-
extend(
|
|
4810
|
+
extend(_this4, {
|
|
4760
4811
|
root: []
|
|
4761
4812
|
});
|
|
4762
|
-
},
|
|
4813
|
+
}, _this4.input);
|
|
4763
4814
|
});
|
|
4764
4815
|
},
|
|
4765
4816
|
update: function update(handle, init) {
|
|
@@ -4997,7 +5048,11 @@ function useLoader(Handler) {
|
|
|
4997
5048
|
|
|
4998
5049
|
_this6.setCtx(ctx);
|
|
4999
5050
|
|
|
5000
|
-
!isCopy && !isInit
|
|
5051
|
+
if (!isCopy && !isInit) {
|
|
5052
|
+
_this6.effect(ctx, 'load');
|
|
5053
|
+
|
|
5054
|
+
_this6.targetHook(ctx, 'load');
|
|
5055
|
+
}
|
|
5001
5056
|
|
|
5002
5057
|
_this6.effect(ctx, 'created');
|
|
5003
5058
|
|
|
@@ -5249,6 +5304,9 @@ function useInput(Handler) {
|
|
|
5249
5304
|
this.valueChange(ctx, value);
|
|
5250
5305
|
this.vm.emit('change', ctx.field, value, ctx.origin, this.api, setFlag || false);
|
|
5251
5306
|
this.effect(ctx, 'value');
|
|
5307
|
+
this.targetHook(ctx, 'value', {
|
|
5308
|
+
value: value
|
|
5309
|
+
});
|
|
5252
5310
|
this.emitEvent('change', ctx.field, value, {
|
|
5253
5311
|
rule: ctx.origin,
|
|
5254
5312
|
api: this.api,
|
|
@@ -5594,9 +5652,22 @@ function useContext(Handler) {
|
|
|
5594
5652
|
}
|
|
5595
5653
|
|
|
5596
5654
|
_this.watching = true;
|
|
5655
|
+
nextTick(function () {
|
|
5656
|
+
_this.targetHook(ctx, 'watch', {
|
|
5657
|
+
key: key,
|
|
5658
|
+
oldValue: o,
|
|
5659
|
+
newValue: n
|
|
5660
|
+
});
|
|
5661
|
+
});
|
|
5597
5662
|
|
|
5598
5663
|
if (key === 'hidden' && Boolean(n) !== Boolean(o)) {
|
|
5599
5664
|
_this.$render.clearCacheAll();
|
|
5665
|
+
|
|
5666
|
+
nextTick(function () {
|
|
5667
|
+
_this.targetHook(ctx, 'hidden', {
|
|
5668
|
+
value: n
|
|
5669
|
+
});
|
|
5670
|
+
});
|
|
5600
5671
|
}
|
|
5601
5672
|
|
|
5602
5673
|
if (key === 'ignore' && ctx.input || key === 'hidden' && ctx.input && (ctx.rule.ignore === 'hidden' || _this.options.ignoreHiddenFields)) {
|
|
@@ -5638,6 +5709,71 @@ function useContext(Handler) {
|
|
|
5638
5709
|
sync: flag
|
|
5639
5710
|
}));
|
|
5640
5711
|
});
|
|
5712
|
+
ctx.refRule['__$title'] = computed(function () {
|
|
5713
|
+
var title = (_typeof(ctx.rule.title) === 'object' ? ctx.rule.title.title : ctx.rule.title) || '';
|
|
5714
|
+
|
|
5715
|
+
if (title) {
|
|
5716
|
+
var match = title.match(/^\{\{\s*\$t\.(.+)\s*\}\}$/);
|
|
5717
|
+
|
|
5718
|
+
if (match) {
|
|
5719
|
+
title = _this.api.t(match[1]);
|
|
5720
|
+
}
|
|
5721
|
+
}
|
|
5722
|
+
|
|
5723
|
+
return title;
|
|
5724
|
+
});
|
|
5725
|
+
ctx.refRule['__$info'] = computed(function () {
|
|
5726
|
+
var info = (_typeof(ctx.rule.info) === 'object' ? ctx.rule.info.info : ctx.rule.info) || '';
|
|
5727
|
+
|
|
5728
|
+
if (info) {
|
|
5729
|
+
var match = info.match(/^\{\{\s*\$t\.(.+)\s*\}\}$/);
|
|
5730
|
+
|
|
5731
|
+
if (match) {
|
|
5732
|
+
info = _this.api.t(match[1]);
|
|
5733
|
+
}
|
|
5734
|
+
}
|
|
5735
|
+
|
|
5736
|
+
return info;
|
|
5737
|
+
});
|
|
5738
|
+
ctx.refRule['__$validate'] = computed(function () {
|
|
5739
|
+
return toArray(ctx.rule.validate).map(function (item) {
|
|
5740
|
+
var temp = _objectSpread2({}, item);
|
|
5741
|
+
|
|
5742
|
+
if (temp.message) {
|
|
5743
|
+
var match = temp.message.match(/^\{\{\s*\$t\.(.+)\s*\}\}$/);
|
|
5744
|
+
|
|
5745
|
+
if (match) {
|
|
5746
|
+
temp.message = _this.api.t(match[1], {
|
|
5747
|
+
title: ctx.refRule.__$title.value
|
|
5748
|
+
});
|
|
5749
|
+
}
|
|
5750
|
+
}
|
|
5751
|
+
|
|
5752
|
+
if (is.Function(temp.validator)) {
|
|
5753
|
+
var that = ctx;
|
|
5754
|
+
|
|
5755
|
+
temp.validator = function () {
|
|
5756
|
+
var _item$validator;
|
|
5757
|
+
|
|
5758
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
5759
|
+
args[_key] = arguments[_key];
|
|
5760
|
+
}
|
|
5761
|
+
|
|
5762
|
+
return (_item$validator = item.validator).call.apply(_item$validator, [{
|
|
5763
|
+
that: this,
|
|
5764
|
+
id: that.id,
|
|
5765
|
+
field: that.field,
|
|
5766
|
+
rule: that.rule,
|
|
5767
|
+
api: that.$handle.api
|
|
5768
|
+
}].concat(args));
|
|
5769
|
+
};
|
|
5770
|
+
|
|
5771
|
+
return temp;
|
|
5772
|
+
}
|
|
5773
|
+
|
|
5774
|
+
return temp;
|
|
5775
|
+
});
|
|
5776
|
+
});
|
|
5641
5777
|
|
|
5642
5778
|
if (ctx.input) {
|
|
5643
5779
|
var val = toRef(ctx.rule, 'value');
|
|
@@ -5725,25 +5861,42 @@ function useContext(Handler) {
|
|
|
5725
5861
|
var or = item.mode === 'OR';
|
|
5726
5862
|
var valid = true;
|
|
5727
5863
|
|
|
5728
|
-
|
|
5864
|
+
var _loop = function _loop(i) {
|
|
5729
5865
|
var one = item.group[i];
|
|
5730
5866
|
var flag = void 0;
|
|
5867
|
+
var field = one.field;
|
|
5868
|
+
|
|
5869
|
+
if (one.variable) {
|
|
5870
|
+
field = JSON.stringify(_this2.fc.getLoadData(one.variable) || '');
|
|
5871
|
+
}
|
|
5731
5872
|
|
|
5732
5873
|
if (one.mode) {
|
|
5733
5874
|
flag = checkCondition(one);
|
|
5734
5875
|
} else if (!condition[one.condition]) {
|
|
5735
5876
|
flag = false;
|
|
5877
|
+
} else if (is.Function(one.handler)) {
|
|
5878
|
+
flag = invoke(function () {
|
|
5879
|
+
return one.handler(_this2.api, ctx.rule);
|
|
5880
|
+
});
|
|
5736
5881
|
} else {
|
|
5737
|
-
flag = new Function('$condition', '$val', '$form', '$group', "with($form){with(this){with($group){ return $condition['".concat(one.condition, "'](").concat(
|
|
5882
|
+
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);
|
|
5738
5883
|
}
|
|
5739
5884
|
|
|
5740
5885
|
if (or && flag) {
|
|
5741
|
-
return
|
|
5886
|
+
return {
|
|
5887
|
+
v: true
|
|
5888
|
+
};
|
|
5742
5889
|
}
|
|
5743
5890
|
|
|
5744
5891
|
if (!or) {
|
|
5745
5892
|
valid = valid && flag;
|
|
5746
5893
|
}
|
|
5894
|
+
};
|
|
5895
|
+
|
|
5896
|
+
for (var i = 0; i < item.group.length; i++) {
|
|
5897
|
+
var _ret = _loop(i);
|
|
5898
|
+
|
|
5899
|
+
if (_typeof(_ret) === "object") return _ret.v;
|
|
5747
5900
|
}
|
|
5748
5901
|
|
|
5749
5902
|
return or ? false : valid;
|
|
@@ -5779,8 +5932,8 @@ function useContext(Handler) {
|
|
|
5779
5932
|
obj[k] = function () {
|
|
5780
5933
|
var _that$fc$formulas$k;
|
|
5781
5934
|
|
|
5782
|
-
for (var
|
|
5783
|
-
args[
|
|
5935
|
+
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
5936
|
+
args[_key2] = arguments[_key2];
|
|
5784
5937
|
}
|
|
5785
5938
|
|
|
5786
5939
|
return (_that$fc$formulas$k = that.fc.formulas[k]).call.apply(_that$fc$formulas$k, [{
|
|
@@ -5874,6 +6027,7 @@ function useContext(Handler) {
|
|
|
5874
6027
|
this.$render.clearCache(ctx);
|
|
5875
6028
|
ctx["delete"]();
|
|
5876
6029
|
this.effect(ctx, 'deleted');
|
|
6030
|
+
this.targetHook(ctx, 'deleted');
|
|
5877
6031
|
input && !this.fieldCtx[field] && this.vm.emit('remove-field', field, ctx.rule, this.api);
|
|
5878
6032
|
ctx.rule.__ctrl || this.vm.emit('remove-rule', ctx.rule, this.api);
|
|
5879
6033
|
return ctx;
|
|
@@ -5920,6 +6074,25 @@ function useLifecycle(Handler) {
|
|
|
5920
6074
|
}
|
|
5921
6075
|
|
|
5922
6076
|
(_this$bus = this.bus).$emit.apply(_this$bus, [name].concat(args));
|
|
6077
|
+
},
|
|
6078
|
+
targetHook: function targetHook(ctx, name, args) {
|
|
6079
|
+
var _ctx$prop,
|
|
6080
|
+
_ctx$prop$hook,
|
|
6081
|
+
_this2 = this;
|
|
6082
|
+
|
|
6083
|
+
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];
|
|
6084
|
+
|
|
6085
|
+
if (hook) {
|
|
6086
|
+
hook = Array.isArray(hook) ? hook : [hook];
|
|
6087
|
+
hook.forEach(function (fn) {
|
|
6088
|
+
invoke(function () {
|
|
6089
|
+
return fn(_objectSpread2(_objectSpread2({}, args || {}), {}, {
|
|
6090
|
+
rule: ctx.rule,
|
|
6091
|
+
api: _this2.api
|
|
6092
|
+
}));
|
|
6093
|
+
});
|
|
6094
|
+
});
|
|
6095
|
+
}
|
|
5923
6096
|
}
|
|
5924
6097
|
});
|
|
5925
6098
|
}
|
|
@@ -6387,7 +6560,7 @@ var loadData = function loadData(fc) {
|
|
|
6387
6560
|
var unwatchs = [];
|
|
6388
6561
|
attrs.forEach(function (attr) {
|
|
6389
6562
|
if (attr && (attr.attr || attr.template)) {
|
|
6390
|
-
var
|
|
6563
|
+
var fn = function fn(get) {
|
|
6391
6564
|
var value;
|
|
6392
6565
|
|
|
6393
6566
|
if (attr.template) {
|
|
@@ -6413,7 +6586,14 @@ var loadData = function loadData(fc) {
|
|
|
6413
6586
|
}
|
|
6414
6587
|
|
|
6415
6588
|
api.sync(rule);
|
|
6416
|
-
}
|
|
6589
|
+
};
|
|
6590
|
+
|
|
6591
|
+
var callback = function callback(get) {
|
|
6592
|
+
return fn(get);
|
|
6593
|
+
};
|
|
6594
|
+
|
|
6595
|
+
var unwatch = fc.watchLoadData(callback);
|
|
6596
|
+
fn = debounce(fn, attr.wait || 300);
|
|
6417
6597
|
|
|
6418
6598
|
if (attr.watch !== false) {
|
|
6419
6599
|
unwatchs.push(unwatch);
|
|
@@ -6434,10 +6614,72 @@ var loadData = function loadData(fc) {
|
|
|
6434
6614
|
inject.clearProp();
|
|
6435
6615
|
}
|
|
6436
6616
|
};
|
|
6437
|
-
loadData.watch = loadData.
|
|
6617
|
+
loadData.watch = loadData.mounted;
|
|
6438
6618
|
return loadData;
|
|
6439
6619
|
};
|
|
6440
6620
|
|
|
6621
|
+
var t = function t(fc) {
|
|
6622
|
+
var t = {
|
|
6623
|
+
name: 't',
|
|
6624
|
+
_fn: [],
|
|
6625
|
+
loaded: function loaded(inject, rule, api) {
|
|
6626
|
+
this.deleted(inject);
|
|
6627
|
+
var attrs = inject.getValue() || {};
|
|
6628
|
+
var unwatchs = [];
|
|
6629
|
+
Object.keys(attrs).forEach(function (key) {
|
|
6630
|
+
var attr = attrs[key];
|
|
6631
|
+
|
|
6632
|
+
if (attr) {
|
|
6633
|
+
var isObj = _typeof(attr) === 'object';
|
|
6634
|
+
|
|
6635
|
+
var fn = function fn(get) {
|
|
6636
|
+
var value = fc.t(isObj ? attr.attr : attr, isObj ? attr.params : null, get);
|
|
6637
|
+
|
|
6638
|
+
var _rule = isObj && attr.modify ? rule : inject.getProp();
|
|
6639
|
+
|
|
6640
|
+
if (key === 'child') {
|
|
6641
|
+
if (_rule.children) {
|
|
6642
|
+
_rule.children[0] = value;
|
|
6643
|
+
} else {
|
|
6644
|
+
_rule.children = [value];
|
|
6645
|
+
}
|
|
6646
|
+
} else {
|
|
6647
|
+
deepSet(_rule, key, value);
|
|
6648
|
+
}
|
|
6649
|
+
|
|
6650
|
+
api.sync(rule);
|
|
6651
|
+
};
|
|
6652
|
+
|
|
6653
|
+
var callback = function callback(get) {
|
|
6654
|
+
return fn(get);
|
|
6655
|
+
};
|
|
6656
|
+
|
|
6657
|
+
var unwatch = fc.watchLoadData(callback);
|
|
6658
|
+
fn = debounce(fn, attr.wait || 300);
|
|
6659
|
+
|
|
6660
|
+
if (attr.watch !== false) {
|
|
6661
|
+
unwatchs.push(unwatch);
|
|
6662
|
+
} else {
|
|
6663
|
+
unwatch();
|
|
6664
|
+
}
|
|
6665
|
+
}
|
|
6666
|
+
});
|
|
6667
|
+
this._fn[inject.id] = unwatchs;
|
|
6668
|
+
},
|
|
6669
|
+
deleted: function deleted(inject) {
|
|
6670
|
+
if (this._fn[inject.id]) {
|
|
6671
|
+
this._fn[inject.id].forEach(function (un) {
|
|
6672
|
+
un();
|
|
6673
|
+
});
|
|
6674
|
+
}
|
|
6675
|
+
|
|
6676
|
+
inject.clearProp();
|
|
6677
|
+
}
|
|
6678
|
+
};
|
|
6679
|
+
t.watch = t.loaded;
|
|
6680
|
+
return t;
|
|
6681
|
+
};
|
|
6682
|
+
|
|
6441
6683
|
var componentValidate = {
|
|
6442
6684
|
name: 'componentValidate',
|
|
6443
6685
|
load: function load(attr, rule, api) {
|
|
@@ -6636,6 +6878,7 @@ var fetch = function fetch(fc) {
|
|
|
6636
6878
|
var $provider = {
|
|
6637
6879
|
fetch: fetch,
|
|
6638
6880
|
loadData: loadData,
|
|
6881
|
+
t: t,
|
|
6639
6882
|
componentValidate: componentValidate
|
|
6640
6883
|
};
|
|
6641
6884
|
|
|
@@ -7038,7 +7281,7 @@ function FormCreateFactory(config) {
|
|
|
7038
7281
|
options: ref({}),
|
|
7039
7282
|
extendApiFn: extendApiFn,
|
|
7040
7283
|
fetchCache: new WeakMap(),
|
|
7041
|
-
tmpData: {}
|
|
7284
|
+
tmpData: reactive({})
|
|
7042
7285
|
});
|
|
7043
7286
|
listener.forEach(function (item) {
|
|
7044
7287
|
_this.bus.$on(item.name, item.callback);
|
|
@@ -7113,6 +7356,26 @@ function FormCreateFactory(config) {
|
|
|
7113
7356
|
});
|
|
7114
7357
|
}
|
|
7115
7358
|
},
|
|
7359
|
+
t: function t(id, params, get) {
|
|
7360
|
+
var value = get ? get('$t.' + id) : this.globalLanguageDriver(id);
|
|
7361
|
+
|
|
7362
|
+
if (value == null && this.vm.appContext.config.globalProperties.$i18n) {
|
|
7363
|
+
return this.vm.appContext.config.globalProperties.$i18n.t(id, params);
|
|
7364
|
+
}
|
|
7365
|
+
|
|
7366
|
+
if (value == null) {
|
|
7367
|
+
value = '';
|
|
7368
|
+
}
|
|
7369
|
+
|
|
7370
|
+
if (value && params) {
|
|
7371
|
+
Object.keys(params).forEach(function (param) {
|
|
7372
|
+
var regex = new RegExp("{".concat(param, "}"), 'g');
|
|
7373
|
+
value = value.replace(regex, params[param]);
|
|
7374
|
+
});
|
|
7375
|
+
}
|
|
7376
|
+
|
|
7377
|
+
return value;
|
|
7378
|
+
},
|
|
7116
7379
|
globalDataDriver: function globalDataDriver(id) {
|
|
7117
7380
|
var _this4 = this;
|
|
7118
7381
|
|
|
@@ -7196,6 +7459,41 @@ function FormCreateFactory(config) {
|
|
|
7196
7459
|
}
|
|
7197
7460
|
}
|
|
7198
7461
|
},
|
|
7462
|
+
getLocale: function getLocale() {
|
|
7463
|
+
var locale = this.vm.setupState.top.props.locale;
|
|
7464
|
+
|
|
7465
|
+
if (locale && _typeof(locale) === 'object') {
|
|
7466
|
+
return locale.name;
|
|
7467
|
+
}
|
|
7468
|
+
|
|
7469
|
+
if (typeof locale === 'string') {
|
|
7470
|
+
return locale;
|
|
7471
|
+
}
|
|
7472
|
+
|
|
7473
|
+
if (this.vm.appContext.config.globalProperties.$i18n && this.vm.appContext.config.globalProperties.$i18n.locale) {
|
|
7474
|
+
return this.vm.appContext.config.globalProperties.$i18n.locale;
|
|
7475
|
+
}
|
|
7476
|
+
|
|
7477
|
+
return 'zh-cn';
|
|
7478
|
+
},
|
|
7479
|
+
globalLanguageDriver: function globalLanguageDriver(id) {
|
|
7480
|
+
var locale = this.vm.setupState.top.props.locale;
|
|
7481
|
+
var value = undefined;
|
|
7482
|
+
|
|
7483
|
+
if (locale && _typeof(locale) === 'object') {
|
|
7484
|
+
value = deepGet(locale, id);
|
|
7485
|
+
}
|
|
7486
|
+
|
|
7487
|
+
if (value == null) {
|
|
7488
|
+
var language = this.options.value.language || {};
|
|
7489
|
+
|
|
7490
|
+
var _locale = this.getLocale();
|
|
7491
|
+
|
|
7492
|
+
value = deepGet(language[_locale], id);
|
|
7493
|
+
}
|
|
7494
|
+
|
|
7495
|
+
return value;
|
|
7496
|
+
},
|
|
7199
7497
|
globalVarDriver: function globalVarDriver(id) {
|
|
7200
7498
|
var _this5 = this;
|
|
7201
7499
|
|
|
@@ -7253,6 +7551,12 @@ function FormCreateFactory(config) {
|
|
|
7253
7551
|
} else if (key === '$var') {
|
|
7254
7552
|
val = this.globalVarDriver(split.join('.'));
|
|
7255
7553
|
split = [];
|
|
7554
|
+
} else if (key === '$locale') {
|
|
7555
|
+
val = this.getLocale();
|
|
7556
|
+
split = [];
|
|
7557
|
+
} else if (key === '$t') {
|
|
7558
|
+
val = this.globalLanguageDriver(split.join('.'));
|
|
7559
|
+
split = [];
|
|
7256
7560
|
} else {
|
|
7257
7561
|
var tmpData = this.vm.setupState.top.setupState.fc.tmpData;
|
|
7258
7562
|
val = hasProperty(tmpData, key) ? deepGet(tmpData, id) : getData(id);
|
|
@@ -7282,8 +7586,9 @@ function FormCreateFactory(config) {
|
|
|
7282
7586
|
return unwatch[id].val;
|
|
7283
7587
|
}
|
|
7284
7588
|
|
|
7285
|
-
var
|
|
7286
|
-
|
|
7589
|
+
var data = computed(function () {
|
|
7590
|
+
return _this6.getLoadData(id, def);
|
|
7591
|
+
});
|
|
7287
7592
|
var split = id.split('.');
|
|
7288
7593
|
var key = split.shift();
|
|
7289
7594
|
var key2 = split.shift() || '';
|
|
@@ -7297,6 +7602,9 @@ function FormCreateFactory(config) {
|
|
|
7297
7602
|
run(true);
|
|
7298
7603
|
}
|
|
7299
7604
|
}, 0);
|
|
7605
|
+
var un = watch(data, function (n) {
|
|
7606
|
+
callback();
|
|
7607
|
+
});
|
|
7300
7608
|
|
|
7301
7609
|
_this6.bus.$on('$loadData.' + key, callback);
|
|
7302
7610
|
|
|
@@ -7311,10 +7619,12 @@ function FormCreateFactory(config) {
|
|
|
7311
7619
|
if (key2) {
|
|
7312
7620
|
_this6.bus.$off('$loadData.' + key + '.' + key2, callback);
|
|
7313
7621
|
}
|
|
7622
|
+
|
|
7623
|
+
un();
|
|
7314
7624
|
},
|
|
7315
|
-
val:
|
|
7625
|
+
val: data.value
|
|
7316
7626
|
};
|
|
7317
|
-
return
|
|
7627
|
+
return data.value;
|
|
7318
7628
|
};
|
|
7319
7629
|
|
|
7320
7630
|
run(false);
|
|
@@ -7686,6 +7996,7 @@ var alias = {
|
|
|
7686
7996
|
autoComplete: PRE + '-autocomplete',
|
|
7687
7997
|
auto: PRE + '-autocomplete',
|
|
7688
7998
|
group: 'fc-group',
|
|
7999
|
+
array: 'fc-group',
|
|
7689
8000
|
object: 'fc-sub-form',
|
|
7690
8001
|
subForm: 'fc-sub-form'
|
|
7691
8002
|
};
|
|
@@ -7804,12 +8115,9 @@ var manager = {
|
|
|
7804
8115
|
return prop;
|
|
7805
8116
|
},
|
|
7806
8117
|
mergeProp: function mergeProp(ctx) {
|
|
7807
|
-
|
|
7808
|
-
|
|
7809
|
-
|
|
7810
|
-
col: this.options.col || {},
|
|
7811
|
-
title: this.options.title || {}
|
|
7812
|
-
}, ctx.prop], {
|
|
8118
|
+
var _this2 = this;
|
|
8119
|
+
|
|
8120
|
+
var def = {
|
|
7813
8121
|
info: {
|
|
7814
8122
|
trigger: 'hover',
|
|
7815
8123
|
placement: 'top-start',
|
|
@@ -7820,8 +8128,9 @@ var manager = {
|
|
|
7820
8128
|
span: 24
|
|
7821
8129
|
},
|
|
7822
8130
|
wrap: {}
|
|
7823
|
-
}
|
|
7824
|
-
|
|
8131
|
+
};
|
|
8132
|
+
['info', 'wrap', 'col', 'title'].forEach(function (name) {
|
|
8133
|
+
ctx.prop[name] = mergeProps([_this2.options[name] || {}, ctx.prop[name] || {}], def[name]);
|
|
7825
8134
|
});
|
|
7826
8135
|
},
|
|
7827
8136
|
getDefaultOptions: function getDefaultOptions() {
|
|
@@ -7854,18 +8163,18 @@ var manager = {
|
|
|
7854
8163
|
});
|
|
7855
8164
|
},
|
|
7856
8165
|
render: function render(children) {
|
|
7857
|
-
var
|
|
8166
|
+
var _this3 = this;
|
|
7858
8167
|
|
|
7859
8168
|
if (children.slotLen() && !this.$handle.preview) {
|
|
7860
8169
|
children.setSlot(undefined, function () {
|
|
7861
|
-
return
|
|
8170
|
+
return _this3.makeFormBtn();
|
|
7862
8171
|
});
|
|
7863
8172
|
}
|
|
7864
8173
|
|
|
7865
8174
|
return this.$r(this.rule, isFalse(this.options.row.show) ? children.getSlots() : [this.makeRow(children)]);
|
|
7866
8175
|
},
|
|
7867
8176
|
makeWrap: function makeWrap(ctx, children) {
|
|
7868
|
-
var
|
|
8177
|
+
var _this4 = this;
|
|
7869
8178
|
|
|
7870
8179
|
var rule = ctx.prop;
|
|
7871
8180
|
var uni = "".concat(this.key).concat(ctx.key);
|
|
@@ -7884,7 +8193,7 @@ var manager = {
|
|
|
7884
8193
|
prop: ctx.id,
|
|
7885
8194
|
rules: ctx.injectValidate()
|
|
7886
8195
|
}),
|
|
7887
|
-
"class": rule.className,
|
|
8196
|
+
"class": this.$render.mergeClass(rule.className, 'fc-form-item'),
|
|
7888
8197
|
key: "".concat(uni, "fi"),
|
|
7889
8198
|
ref: ctx.wrapRef,
|
|
7890
8199
|
type: 'formItem'
|
|
@@ -7894,7 +8203,7 @@ var manager = {
|
|
|
7894
8203
|
}
|
|
7895
8204
|
}, isTitle ? {
|
|
7896
8205
|
label: function label() {
|
|
7897
|
-
return
|
|
8206
|
+
return _this4.makeInfo(rule, uni, ctx);
|
|
7898
8207
|
}
|
|
7899
8208
|
} : {}));
|
|
7900
8209
|
return inline === true || isFalse(_col) || isFalse(col.show) ? item : this.makeCol(rule, uni, [item]);
|
|
@@ -7905,7 +8214,7 @@ var manager = {
|
|
|
7905
8214
|
return !(!title.title && !title["native"] || isFalse(title.show));
|
|
7906
8215
|
},
|
|
7907
8216
|
makeInfo: function makeInfo(rule, uni, ctx) {
|
|
7908
|
-
var
|
|
8217
|
+
var _this5 = this;
|
|
7909
8218
|
|
|
7910
8219
|
var titleProp = _objectSpread2({}, rule.title);
|
|
7911
8220
|
|
|
@@ -7915,10 +8224,10 @@ var manager = {
|
|
|
7915
8224
|
var form = this.options.form;
|
|
7916
8225
|
var titleSlot = this.getSlot('title');
|
|
7917
8226
|
var children = [titleSlot ? titleSlot({
|
|
7918
|
-
title:
|
|
8227
|
+
title: ctx.refRule.__$title.value,
|
|
7919
8228
|
rule: ctx.rule,
|
|
7920
8229
|
options: this.options
|
|
7921
|
-
}) :
|
|
8230
|
+
}) : ctx.refRule.__$title.value + (form.labelSuffix || form['label-suffix'] || '')];
|
|
7922
8231
|
|
|
7923
8232
|
if (!isFalse(infoProp.show) && (infoProp.info || infoProp["native"]) && !isFalse(infoProp.icon)) {
|
|
7924
8233
|
var prop = {
|
|
@@ -7934,17 +8243,17 @@ var manager = {
|
|
|
7934
8243
|
var field = 'content';
|
|
7935
8244
|
|
|
7936
8245
|
if (infoProp.info && !hasProperty(prop.props, field)) {
|
|
7937
|
-
prop.props[field] =
|
|
8246
|
+
prop.props[field] = ctx.refRule.__$info.value;
|
|
7938
8247
|
}
|
|
7939
8248
|
|
|
7940
8249
|
children[infoProp.align !== 'left' ? 'unshift' : 'push'](this.$r(mergeProps([infoProp, prop]), _defineProperty({}, titleProp.slot || (isTip ? 'default' : 'reference'), function () {
|
|
7941
|
-
return
|
|
8250
|
+
return _this5.$r({
|
|
7942
8251
|
type: 'ElIcon',
|
|
7943
8252
|
style: 'top:2px',
|
|
7944
8253
|
key: "".concat(uni, "i")
|
|
7945
8254
|
}, {
|
|
7946
8255
|
"default": function _default() {
|
|
7947
|
-
return
|
|
8256
|
+
return _this5.$r({
|
|
7948
8257
|
type: infoProp.icon === true ? 'icon-warning' : infoProp.icon
|
|
7949
8258
|
});
|
|
7950
8259
|
}
|
|
@@ -7955,6 +8264,7 @@ var manager = {
|
|
|
7955
8264
|
var _prop = mergeProps([titleProp, {
|
|
7956
8265
|
props: tidyRule(titleProp),
|
|
7957
8266
|
key: "".concat(uni, "tit"),
|
|
8267
|
+
"class": 'fc-form-title',
|
|
7958
8268
|
type: titleProp.type || 'span'
|
|
7959
8269
|
}]);
|
|
7960
8270
|
|
|
@@ -7966,7 +8276,7 @@ var manager = {
|
|
|
7966
8276
|
makeCol: function makeCol(rule, uni, children) {
|
|
7967
8277
|
var col = rule.col;
|
|
7968
8278
|
return this.$r({
|
|
7969
|
-
"class": col["class"],
|
|
8279
|
+
"class": this.$render.mergeClass(col["class"], 'fc-form-col'),
|
|
7970
8280
|
type: 'col',
|
|
7971
8281
|
props: col || {
|
|
7972
8282
|
span: 24
|
|
@@ -7979,7 +8289,7 @@ var manager = {
|
|
|
7979
8289
|
return this.$r({
|
|
7980
8290
|
type: 'row',
|
|
7981
8291
|
props: row,
|
|
7982
|
-
"class": row["class"],
|
|
8292
|
+
"class": this.$render.mergeClass(row["class"], 'fc-form-row'),
|
|
7983
8293
|
key: "".concat(this.key, "row")
|
|
7984
8294
|
}, children);
|
|
7985
8295
|
},
|
|
@@ -8000,10 +8310,12 @@ var manager = {
|
|
|
8000
8310
|
|
|
8001
8311
|
var item = this.$r({
|
|
8002
8312
|
type: 'formItem',
|
|
8313
|
+
"class": 'fc-form-item',
|
|
8003
8314
|
key: "".concat(this.key, "fb")
|
|
8004
8315
|
}, vn);
|
|
8005
8316
|
return this.rule.props.inline === true ? item : this.$r({
|
|
8006
8317
|
type: 'col',
|
|
8318
|
+
"class": 'fc-form-col fc-form-footer',
|
|
8007
8319
|
props: {
|
|
8008
8320
|
span: 24
|
|
8009
8321
|
},
|
|
@@ -8011,7 +8323,7 @@ var manager = {
|
|
|
8011
8323
|
}, [item]);
|
|
8012
8324
|
},
|
|
8013
8325
|
makeResetBtn: function makeResetBtn() {
|
|
8014
|
-
var
|
|
8326
|
+
var _this6 = this;
|
|
8015
8327
|
|
|
8016
8328
|
var resetBtn = _objectSpread2({}, this.options.resetBtn);
|
|
8017
8329
|
|
|
@@ -8023,21 +8335,21 @@ var manager = {
|
|
|
8023
8335
|
return this.$r({
|
|
8024
8336
|
type: 'button',
|
|
8025
8337
|
props: resetBtn,
|
|
8026
|
-
"class": '
|
|
8338
|
+
"class": 'fc-reset-btn',
|
|
8027
8339
|
style: {
|
|
8028
8340
|
width: resetBtn.width
|
|
8029
8341
|
},
|
|
8030
8342
|
on: {
|
|
8031
8343
|
click: function click() {
|
|
8032
|
-
var fApi =
|
|
8033
|
-
|
|
8344
|
+
var fApi = _this6.$handle.api;
|
|
8345
|
+
_this6.options.resetBtn.click ? _this6.options.resetBtn.click(fApi) : fApi.resetFields();
|
|
8034
8346
|
}
|
|
8035
8347
|
},
|
|
8036
8348
|
key: "".concat(this.key, "b2")
|
|
8037
8349
|
}, [innerText]);
|
|
8038
8350
|
},
|
|
8039
8351
|
makeSubmitBtn: function makeSubmitBtn() {
|
|
8040
|
-
var
|
|
8352
|
+
var _this7 = this;
|
|
8041
8353
|
|
|
8042
8354
|
var submitBtn = _objectSpread2({}, this.options.submitBtn);
|
|
8043
8355
|
|
|
@@ -8049,14 +8361,14 @@ var manager = {
|
|
|
8049
8361
|
return this.$r({
|
|
8050
8362
|
type: 'button',
|
|
8051
8363
|
props: submitBtn,
|
|
8052
|
-
"class": '
|
|
8364
|
+
"class": 'fc-submit-btn',
|
|
8053
8365
|
style: {
|
|
8054
8366
|
width: submitBtn.width
|
|
8055
8367
|
},
|
|
8056
8368
|
on: {
|
|
8057
8369
|
click: function click() {
|
|
8058
|
-
var fApi =
|
|
8059
|
-
|
|
8370
|
+
var fApi = _this7.$handle.api;
|
|
8371
|
+
_this7.options.submitBtn.click ? _this7.options.submitBtn.click(fApi) : fApi.submit()["catch"](function () {});
|
|
8060
8372
|
}
|
|
8061
8373
|
},
|
|
8062
8374
|
key: "".concat(this.key, "b1")
|
|
@@ -8146,7 +8458,7 @@ function useFrame(maker) {
|
|
|
8146
8458
|
return maker;
|
|
8147
8459
|
}
|
|
8148
8460
|
|
|
8149
|
-
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{justify-content:flex-end}.fc-wrap-left .el-form-item__label{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}";
|
|
8461
|
+
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{justify-content:flex-end}.fc-wrap-left .el-form-item__label{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}";
|
|
8150
8462
|
styleInject(css_248z);
|
|
8151
8463
|
|
|
8152
8464
|
function tidyBtnProp(btn, def) {
|
|
@@ -8338,8 +8650,15 @@ var required = {
|
|
|
8338
8650
|
}, val);
|
|
8339
8651
|
|
|
8340
8652
|
if (!validate.message) {
|
|
8341
|
-
|
|
8342
|
-
|
|
8653
|
+
validate.message = rule.__fc__.refRule.__$title.value + (api.getLocale() === 'en' ? ' is required' : '不能为空');
|
|
8654
|
+
} else {
|
|
8655
|
+
var match = validate.message.match(/^\{\{\s*\$t\.(.+)\s*\}\}$/);
|
|
8656
|
+
|
|
8657
|
+
if (match) {
|
|
8658
|
+
validate.message = api.t(match[1], {
|
|
8659
|
+
title: rule.__fc__.refRule.__$title.value
|
|
8660
|
+
});
|
|
8661
|
+
}
|
|
8343
8662
|
}
|
|
8344
8663
|
|
|
8345
8664
|
inject.getProp().validate = [validate];
|
|
@@ -8399,7 +8718,7 @@ function install(FormCreate) {
|
|
|
8399
8718
|
function elmFormCreate() {
|
|
8400
8719
|
return FormCreateFactory({
|
|
8401
8720
|
ui: 'element-ui',
|
|
8402
|
-
version: '3.2.
|
|
8721
|
+
version: '3.2.14',
|
|
8403
8722
|
manager: manager,
|
|
8404
8723
|
extendApi: extendApi,
|
|
8405
8724
|
install: install,
|