@form-create/element-ui 3.2.12 → 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 +464 -132
- package/dist/form-create.esm.min.js +2 -2
- package/dist/form-create.js +463 -131
- 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 +22 -16
- package/src/core/provider.js +6 -2
- package/src/parsers/datePicker.js +1 -0
- package/src/style/index.css +7 -3
- package/types/config.d.ts +18 -18
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.14
|
|
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;
|
|
@@ -1325,13 +1378,25 @@
|
|
|
1325
1378
|
script$1.render = render$1;
|
|
1326
1379
|
|
|
1327
1380
|
function parseFile(file, i) {
|
|
1381
|
+
if (_typeof(file) === 'object') {
|
|
1382
|
+
return file;
|
|
1383
|
+
}
|
|
1384
|
+
|
|
1328
1385
|
return {
|
|
1329
1386
|
url: file,
|
|
1387
|
+
is_string: true,
|
|
1330
1388
|
name: getFileName(file),
|
|
1331
1389
|
uid: i
|
|
1332
1390
|
};
|
|
1333
1391
|
}
|
|
1334
1392
|
|
|
1393
|
+
function parseUpload(file) {
|
|
1394
|
+
return _objectSpread2(_objectSpread2({}, file), {}, {
|
|
1395
|
+
file: file,
|
|
1396
|
+
value: file
|
|
1397
|
+
});
|
|
1398
|
+
}
|
|
1399
|
+
|
|
1335
1400
|
function getFileName(file) {
|
|
1336
1401
|
return ('' + file).split('/').pop();
|
|
1337
1402
|
}
|
|
@@ -1364,11 +1429,11 @@
|
|
|
1364
1429
|
};
|
|
1365
1430
|
},
|
|
1366
1431
|
created: function created() {
|
|
1367
|
-
this.fileList = toArray(this.modelValue).map(parseFile);
|
|
1432
|
+
this.fileList = toArray(this.modelValue).map(parseFile).map(parseUpload);
|
|
1368
1433
|
},
|
|
1369
1434
|
watch: {
|
|
1370
1435
|
modelValue: function modelValue(n) {
|
|
1371
|
-
this.fileList = toArray(n).map(parseFile);
|
|
1436
|
+
this.fileList = toArray(n).map(parseFile).map(parseUpload);
|
|
1372
1437
|
}
|
|
1373
1438
|
},
|
|
1374
1439
|
methods: {
|
|
@@ -1385,10 +1450,10 @@
|
|
|
1385
1450
|
}
|
|
1386
1451
|
},
|
|
1387
1452
|
update: function update(fileList) {
|
|
1388
|
-
var files = fileList.map(function (
|
|
1389
|
-
return
|
|
1453
|
+
var files = fileList.map(function (v) {
|
|
1454
|
+
return v.is_string ? v.url : v.value || v.url;
|
|
1390
1455
|
}).filter(function (url) {
|
|
1391
|
-
return url !== undefined;
|
|
1456
|
+
return url !== undefined && url.indexOf('blob:') !== 0;
|
|
1392
1457
|
});
|
|
1393
1458
|
this.$emit('update:modelValue', files);
|
|
1394
1459
|
},
|
|
@@ -1429,7 +1494,7 @@
|
|
|
1429
1494
|
"ref": "upload"
|
|
1430
1495
|
}), _objectSpread2({
|
|
1431
1496
|
"default": function _default() {
|
|
1432
|
-
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, {
|
|
1433
1498
|
"default": function _default() {
|
|
1434
1499
|
return [vue.createVNode(script$1, null, null)];
|
|
1435
1500
|
}
|
|
@@ -1439,7 +1504,7 @@
|
|
|
1439
1504
|
"default": function _default() {
|
|
1440
1505
|
return [vue.createTextVNode("\u70B9\u51FB\u4E0A\u4F20")];
|
|
1441
1506
|
}
|
|
1442
|
-
})];
|
|
1507
|
+
}))];
|
|
1443
1508
|
}
|
|
1444
1509
|
}, getSlot(this.$slots, ['default']))), vue.createVNode(vue.resolveComponent("ElDialog"), {
|
|
1445
1510
|
"appendToBody": true,
|
|
@@ -2138,6 +2203,7 @@
|
|
|
2138
2203
|
},
|
|
2139
2204
|
index: [String, Number],
|
|
2140
2205
|
api: Object,
|
|
2206
|
+
locale: [String, Object],
|
|
2141
2207
|
name: String,
|
|
2142
2208
|
subForm: {
|
|
2143
2209
|
type: Boolean,
|
|
@@ -2381,7 +2447,7 @@
|
|
|
2381
2447
|
|
|
2382
2448
|
var normalMerge = ['props'];
|
|
2383
2449
|
var toArrayMerge = ['class', 'style', 'directives'];
|
|
2384
|
-
var functionalMerge = ['on'];
|
|
2450
|
+
var functionalMerge = ['on', 'hook'];
|
|
2385
2451
|
|
|
2386
2452
|
var mergeProps = function mergeProps(objects) {
|
|
2387
2453
|
var initial = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
@@ -2478,15 +2544,11 @@
|
|
|
2478
2544
|
|
|
2479
2545
|
var PREFIX = '[[FORM-CREATE-PREFIX-';
|
|
2480
2546
|
var SUFFIX = '-FORM-CREATE-SUFFIX]]';
|
|
2481
|
-
var $T = '$FN:';
|
|
2482
|
-
var $TX = '$FNX:';
|
|
2483
|
-
var $ON = '$GLOBAL:';
|
|
2484
|
-
var FUNCTION = 'function';
|
|
2485
2547
|
function toJson(obj, space) {
|
|
2486
2548
|
return JSON.stringify(deepExtend(Array.isArray(obj) ? [] : {}, obj, true), function (key, val) {
|
|
2487
2549
|
if (val && val._isVue === true) return undefined;
|
|
2488
2550
|
|
|
2489
|
-
if (
|
|
2551
|
+
if (typeof val !== 'function') {
|
|
2490
2552
|
return val;
|
|
2491
2553
|
}
|
|
2492
2554
|
|
|
@@ -2513,11 +2575,14 @@
|
|
|
2513
2575
|
if (v.indexOf(SUFFIX) > 0 && v.indexOf(PREFIX) === 0) {
|
|
2514
2576
|
v = v.replace(SUFFIX, '').replace(PREFIX, '');
|
|
2515
2577
|
flag = true;
|
|
2516
|
-
} else if (v.indexOf($
|
|
2517
|
-
v = v.
|
|
2578
|
+
} else if (v.indexOf('$FN:') === 0) {
|
|
2579
|
+
v = v.substring(4);
|
|
2518
2580
|
flag = true;
|
|
2519
|
-
} else if (v.indexOf($
|
|
2520
|
-
|
|
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);
|
|
2521
2586
|
|
|
2522
2587
|
v = function v() {
|
|
2523
2588
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
@@ -2536,17 +2601,19 @@
|
|
|
2536
2601
|
v.__json = fn;
|
|
2537
2602
|
v.__inject = true;
|
|
2538
2603
|
return v;
|
|
2539
|
-
} else if (v.indexOf($
|
|
2540
|
-
v = makeFn('function($inject){' + v.
|
|
2604
|
+
} else if (v.indexOf('$FNX:') === 0) {
|
|
2605
|
+
v = makeFn('function($inject){' + v.substring(5) + '}');
|
|
2541
2606
|
v.__json = fn;
|
|
2542
2607
|
v.__inject = true;
|
|
2543
2608
|
return v;
|
|
2544
|
-
} 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(') {
|
|
2545
2612
|
flag = true;
|
|
2546
2613
|
}
|
|
2547
2614
|
|
|
2548
2615
|
if (!flag) return fn;
|
|
2549
|
-
var val = makeFn(v
|
|
2616
|
+
var val = makeFn(v);
|
|
2550
2617
|
val.__json = fn;
|
|
2551
2618
|
return val;
|
|
2552
2619
|
} catch (e) {
|
|
@@ -2912,7 +2979,17 @@
|
|
|
2912
2979
|
}
|
|
2913
2980
|
|
|
2914
2981
|
var xhr = new XMLHttpRequest();
|
|
2915
|
-
var action = option.action;
|
|
2982
|
+
var action = option.action || '';
|
|
2983
|
+
|
|
2984
|
+
if (option.query) {
|
|
2985
|
+
var queryString = new URLSearchParams(option.query).toString();
|
|
2986
|
+
|
|
2987
|
+
if (action.includes('?')) {
|
|
2988
|
+
action += "&".concat(queryString);
|
|
2989
|
+
} else {
|
|
2990
|
+
action += "?".concat(queryString);
|
|
2991
|
+
}
|
|
2992
|
+
}
|
|
2916
2993
|
|
|
2917
2994
|
xhr.onerror = function error(e) {
|
|
2918
2995
|
option.onError(e);
|
|
@@ -2953,7 +3030,7 @@
|
|
|
2953
3030
|
});
|
|
2954
3031
|
xhr.send(formData);
|
|
2955
3032
|
}
|
|
2956
|
-
function asyncFetch(config, _fetch) {
|
|
3033
|
+
function asyncFetch(config, _fetch, api) {
|
|
2957
3034
|
return new Promise(function (resolve, reject) {
|
|
2958
3035
|
(_fetch || fetch$1)(_objectSpread2(_objectSpread2({}, config), {}, {
|
|
2959
3036
|
onSuccess: function onSuccess(res) {
|
|
@@ -2971,7 +3048,7 @@
|
|
|
2971
3048
|
};
|
|
2972
3049
|
}
|
|
2973
3050
|
|
|
2974
|
-
resolve(fn(res));
|
|
3051
|
+
resolve(fn(res, undefined, api));
|
|
2975
3052
|
},
|
|
2976
3053
|
onError: function onError(err) {
|
|
2977
3054
|
reject(err);
|
|
@@ -3576,7 +3653,7 @@
|
|
|
3576
3653
|
opt = deepCopy(opt);
|
|
3577
3654
|
opt = h.loadFetchVar(opt);
|
|
3578
3655
|
h.beforeFetch(opt).then(function () {
|
|
3579
|
-
return asyncFetch(opt, h.fc.create.fetch).then(function (res) {
|
|
3656
|
+
return asyncFetch(opt, h.fc.create.fetch, api).then(function (res) {
|
|
3580
3657
|
invoke(function () {
|
|
3581
3658
|
return opt.onSuccess && opt.onSuccess(res);
|
|
3582
3659
|
});
|
|
@@ -3596,7 +3673,7 @@
|
|
|
3596
3673
|
|
|
3597
3674
|
_opt = h.loadFetchVar(_opt, get);
|
|
3598
3675
|
h.beforeFetch(_opt).then(function () {
|
|
3599
|
-
return asyncFetch(_opt, h.fc.create.fetch).then(function (res) {
|
|
3676
|
+
return asyncFetch(_opt, h.fc.create.fetch, api).then(function (res) {
|
|
3600
3677
|
invoke(function () {
|
|
3601
3678
|
return _opt.onSuccess && _opt.onSuccess(res);
|
|
3602
3679
|
});
|
|
@@ -3619,6 +3696,12 @@
|
|
|
3619
3696
|
refreshData: function refreshData(id) {
|
|
3620
3697
|
return h.fc.refreshData(id);
|
|
3621
3698
|
},
|
|
3699
|
+
t: function t(id, params) {
|
|
3700
|
+
return h.fc.t(id, params);
|
|
3701
|
+
},
|
|
3702
|
+
getLocale: function getLocale() {
|
|
3703
|
+
return h.fc.getLocale();
|
|
3704
|
+
},
|
|
3622
3705
|
helper: {
|
|
3623
3706
|
tidyFields: tidyFields,
|
|
3624
3707
|
props: props
|
|
@@ -3949,15 +4032,19 @@
|
|
|
3949
4032
|
},
|
|
3950
4033
|
none: function none(vn) {
|
|
3951
4034
|
if (vn) {
|
|
3952
|
-
|
|
3953
|
-
vn.props["class"].push('fc-none');
|
|
3954
|
-
} else {
|
|
3955
|
-
vn.props["class"] = vn.props["class"] ? [vn.props["class"], 'fc-none'] : 'fc-none';
|
|
3956
|
-
}
|
|
3957
|
-
|
|
4035
|
+
vn.props["class"] = this.mergeClass(vn.props["class"], 'fc-none');
|
|
3958
4036
|
return vn;
|
|
3959
4037
|
}
|
|
3960
4038
|
},
|
|
4039
|
+
mergeClass: function mergeClass(target, value) {
|
|
4040
|
+
if (Array.isArray(target)) {
|
|
4041
|
+
target.push(value);
|
|
4042
|
+
} else {
|
|
4043
|
+
return target ? [target, value] : value;
|
|
4044
|
+
}
|
|
4045
|
+
|
|
4046
|
+
return target;
|
|
4047
|
+
},
|
|
3961
4048
|
stable: function stable(vn) {
|
|
3962
4049
|
var _this5 = this;
|
|
3963
4050
|
|
|
@@ -4057,6 +4144,7 @@
|
|
|
4057
4144
|
callback: function callback(value) {
|
|
4058
4145
|
_this7.onInput(ctx, value);
|
|
4059
4146
|
},
|
|
4147
|
+
modelField: field,
|
|
4060
4148
|
value: this.$handle.getFormData(ctx)
|
|
4061
4149
|
};
|
|
4062
4150
|
props.push({
|
|
@@ -4075,6 +4163,7 @@
|
|
|
4075
4163
|
ctx.el = this.vm.refs[ctx.ref] || el;
|
|
4076
4164
|
ctx.parser.mounted(ctx);
|
|
4077
4165
|
this.$handle.effect(ctx, 'mounted');
|
|
4166
|
+
this.$handle.targetHook(ctx, 'mounted');
|
|
4078
4167
|
},
|
|
4079
4168
|
onInput: function onInput(ctx, value) {
|
|
4080
4169
|
if (ctx.prop.modelEmit) {
|
|
@@ -4636,43 +4725,17 @@
|
|
|
4636
4725
|
var rule = _objectSpread2({}, this.rule);
|
|
4637
4726
|
|
|
4638
4727
|
delete rule.children;
|
|
4728
|
+
delete rule.validate;
|
|
4639
4729
|
this.prop = mergeRule({}, [rule].concat(_toConsumableArray(Object.keys(this.payload).map(function (k) {
|
|
4640
4730
|
return _this3.payload[k];
|
|
4641
4731
|
})), [this.computed]));
|
|
4732
|
+
this.prop.validate = [].concat(_toConsumableArray(this.refRule.__$validate.value || []), _toConsumableArray(this.prop.validate || []));
|
|
4642
4733
|
},
|
|
4643
4734
|
initNone: function initNone() {
|
|
4644
4735
|
this.none = !(is.Undef(this.prop.display) || !!this.prop.display);
|
|
4645
4736
|
},
|
|
4646
4737
|
injectValidate: function injectValidate() {
|
|
4647
|
-
|
|
4648
|
-
|
|
4649
|
-
return toArray(this.prop.validate).map(function (item) {
|
|
4650
|
-
if (is.Function(item.validator)) {
|
|
4651
|
-
var temp = _objectSpread2({}, item);
|
|
4652
|
-
|
|
4653
|
-
var that = _this4;
|
|
4654
|
-
|
|
4655
|
-
temp.validator = function () {
|
|
4656
|
-
var _item$validator;
|
|
4657
|
-
|
|
4658
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
4659
|
-
args[_key] = arguments[_key];
|
|
4660
|
-
}
|
|
4661
|
-
|
|
4662
|
-
return (_item$validator = item.validator).call.apply(_item$validator, [{
|
|
4663
|
-
that: this,
|
|
4664
|
-
id: that.id,
|
|
4665
|
-
field: that.field,
|
|
4666
|
-
rule: that.rule,
|
|
4667
|
-
api: that.$handle.api
|
|
4668
|
-
}].concat(args));
|
|
4669
|
-
};
|
|
4670
|
-
|
|
4671
|
-
return temp;
|
|
4672
|
-
}
|
|
4673
|
-
|
|
4674
|
-
return item;
|
|
4675
|
-
});
|
|
4738
|
+
return this.prop.validate;
|
|
4676
4739
|
},
|
|
4677
4740
|
check: function check(handle) {
|
|
4678
4741
|
return this.vm === handle.vm;
|
|
@@ -4722,15 +4785,15 @@
|
|
|
4722
4785
|
this.ctrlRule = [];
|
|
4723
4786
|
},
|
|
4724
4787
|
rm: function rm() {
|
|
4725
|
-
var
|
|
4788
|
+
var _this4 = this;
|
|
4726
4789
|
|
|
4727
4790
|
var _rm = function _rm() {
|
|
4728
|
-
var index =
|
|
4791
|
+
var index = _this4.root.indexOf(_this4.origin);
|
|
4729
4792
|
|
|
4730
4793
|
if (index > -1) {
|
|
4731
|
-
|
|
4794
|
+
_this4.root.splice(index, 1);
|
|
4732
4795
|
|
|
4733
|
-
|
|
4796
|
+
_this4.$handle && _this4.$handle.refresh();
|
|
4734
4797
|
}
|
|
4735
4798
|
};
|
|
4736
4799
|
|
|
@@ -4741,17 +4804,17 @@
|
|
|
4741
4804
|
}
|
|
4742
4805
|
|
|
4743
4806
|
this.$handle.noWatch(function () {
|
|
4744
|
-
|
|
4745
|
-
|
|
4807
|
+
_this4.$handle.deferSyncValue(function () {
|
|
4808
|
+
_this4.rmCtrl();
|
|
4746
4809
|
|
|
4747
4810
|
_rm();
|
|
4748
4811
|
|
|
4749
|
-
|
|
4812
|
+
_this4.$handle.rmCtx(_this4);
|
|
4750
4813
|
|
|
4751
|
-
extend(
|
|
4814
|
+
extend(_this4, {
|
|
4752
4815
|
root: []
|
|
4753
4816
|
});
|
|
4754
|
-
},
|
|
4817
|
+
}, _this4.input);
|
|
4755
4818
|
});
|
|
4756
4819
|
},
|
|
4757
4820
|
update: function update(handle, init) {
|
|
@@ -4989,7 +5052,11 @@
|
|
|
4989
5052
|
|
|
4990
5053
|
_this6.setCtx(ctx);
|
|
4991
5054
|
|
|
4992
|
-
!isCopy && !isInit
|
|
5055
|
+
if (!isCopy && !isInit) {
|
|
5056
|
+
_this6.effect(ctx, 'load');
|
|
5057
|
+
|
|
5058
|
+
_this6.targetHook(ctx, 'load');
|
|
5059
|
+
}
|
|
4993
5060
|
|
|
4994
5061
|
_this6.effect(ctx, 'created');
|
|
4995
5062
|
|
|
@@ -5241,6 +5308,9 @@
|
|
|
5241
5308
|
this.valueChange(ctx, value);
|
|
5242
5309
|
this.vm.emit('change', ctx.field, value, ctx.origin, this.api, setFlag || false);
|
|
5243
5310
|
this.effect(ctx, 'value');
|
|
5311
|
+
this.targetHook(ctx, 'value', {
|
|
5312
|
+
value: value
|
|
5313
|
+
});
|
|
5244
5314
|
this.emitEvent('change', ctx.field, value, {
|
|
5245
5315
|
rule: ctx.origin,
|
|
5246
5316
|
api: this.api,
|
|
@@ -5340,7 +5410,7 @@
|
|
|
5340
5410
|
this.syncValue();
|
|
5341
5411
|
},
|
|
5342
5412
|
isIgnore: function isIgnore(rule) {
|
|
5343
|
-
return rule.ignore || this.options.ignoreHiddenFields && rule.hidden;
|
|
5413
|
+
return rule.ignore === true || rule.ignore === 'hidden' && rule.hidden || this.options.ignoreHiddenFields && rule.hidden;
|
|
5344
5414
|
},
|
|
5345
5415
|
appendValue: function appendValue(rule) {
|
|
5346
5416
|
if ((!rule.field || !hasProperty(this.appendData, rule.field)) && !this.options.forceCoverValue) {
|
|
@@ -5586,12 +5656,25 @@
|
|
|
5586
5656
|
}
|
|
5587
5657
|
|
|
5588
5658
|
_this.watching = true;
|
|
5659
|
+
vue.nextTick(function () {
|
|
5660
|
+
_this.targetHook(ctx, 'watch', {
|
|
5661
|
+
key: key,
|
|
5662
|
+
oldValue: o,
|
|
5663
|
+
newValue: n
|
|
5664
|
+
});
|
|
5665
|
+
});
|
|
5589
5666
|
|
|
5590
5667
|
if (key === 'hidden' && Boolean(n) !== Boolean(o)) {
|
|
5591
5668
|
_this.$render.clearCacheAll();
|
|
5669
|
+
|
|
5670
|
+
vue.nextTick(function () {
|
|
5671
|
+
_this.targetHook(ctx, 'hidden', {
|
|
5672
|
+
value: n
|
|
5673
|
+
});
|
|
5674
|
+
});
|
|
5592
5675
|
}
|
|
5593
5676
|
|
|
5594
|
-
if (key === 'ignore' && ctx.input || key === 'hidden' && ctx.input && _this.options.ignoreHiddenFields) {
|
|
5677
|
+
if (key === 'ignore' && ctx.input || key === 'hidden' && ctx.input && (ctx.rule.ignore === 'hidden' || _this.options.ignoreHiddenFields)) {
|
|
5595
5678
|
_this.syncForm();
|
|
5596
5679
|
} else if (key === 'link') {
|
|
5597
5680
|
ctx.link();
|
|
@@ -5630,6 +5713,71 @@
|
|
|
5630
5713
|
sync: flag
|
|
5631
5714
|
}));
|
|
5632
5715
|
});
|
|
5716
|
+
ctx.refRule['__$title'] = vue.computed(function () {
|
|
5717
|
+
var title = (_typeof(ctx.rule.title) === 'object' ? ctx.rule.title.title : ctx.rule.title) || '';
|
|
5718
|
+
|
|
5719
|
+
if (title) {
|
|
5720
|
+
var match = title.match(/^\{\{\s*\$t\.(.+)\s*\}\}$/);
|
|
5721
|
+
|
|
5722
|
+
if (match) {
|
|
5723
|
+
title = _this.api.t(match[1]);
|
|
5724
|
+
}
|
|
5725
|
+
}
|
|
5726
|
+
|
|
5727
|
+
return title;
|
|
5728
|
+
});
|
|
5729
|
+
ctx.refRule['__$info'] = vue.computed(function () {
|
|
5730
|
+
var info = (_typeof(ctx.rule.info) === 'object' ? ctx.rule.info.info : ctx.rule.info) || '';
|
|
5731
|
+
|
|
5732
|
+
if (info) {
|
|
5733
|
+
var match = info.match(/^\{\{\s*\$t\.(.+)\s*\}\}$/);
|
|
5734
|
+
|
|
5735
|
+
if (match) {
|
|
5736
|
+
info = _this.api.t(match[1]);
|
|
5737
|
+
}
|
|
5738
|
+
}
|
|
5739
|
+
|
|
5740
|
+
return info;
|
|
5741
|
+
});
|
|
5742
|
+
ctx.refRule['__$validate'] = vue.computed(function () {
|
|
5743
|
+
return toArray(ctx.rule.validate).map(function (item) {
|
|
5744
|
+
var temp = _objectSpread2({}, item);
|
|
5745
|
+
|
|
5746
|
+
if (temp.message) {
|
|
5747
|
+
var match = temp.message.match(/^\{\{\s*\$t\.(.+)\s*\}\}$/);
|
|
5748
|
+
|
|
5749
|
+
if (match) {
|
|
5750
|
+
temp.message = _this.api.t(match[1], {
|
|
5751
|
+
title: ctx.refRule.__$title.value
|
|
5752
|
+
});
|
|
5753
|
+
}
|
|
5754
|
+
}
|
|
5755
|
+
|
|
5756
|
+
if (is.Function(temp.validator)) {
|
|
5757
|
+
var that = ctx;
|
|
5758
|
+
|
|
5759
|
+
temp.validator = function () {
|
|
5760
|
+
var _item$validator;
|
|
5761
|
+
|
|
5762
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
5763
|
+
args[_key] = arguments[_key];
|
|
5764
|
+
}
|
|
5765
|
+
|
|
5766
|
+
return (_item$validator = item.validator).call.apply(_item$validator, [{
|
|
5767
|
+
that: this,
|
|
5768
|
+
id: that.id,
|
|
5769
|
+
field: that.field,
|
|
5770
|
+
rule: that.rule,
|
|
5771
|
+
api: that.$handle.api
|
|
5772
|
+
}].concat(args));
|
|
5773
|
+
};
|
|
5774
|
+
|
|
5775
|
+
return temp;
|
|
5776
|
+
}
|
|
5777
|
+
|
|
5778
|
+
return temp;
|
|
5779
|
+
});
|
|
5780
|
+
});
|
|
5633
5781
|
|
|
5634
5782
|
if (ctx.input) {
|
|
5635
5783
|
var val = vue.toRef(ctx.rule, 'value');
|
|
@@ -5717,25 +5865,42 @@
|
|
|
5717
5865
|
var or = item.mode === 'OR';
|
|
5718
5866
|
var valid = true;
|
|
5719
5867
|
|
|
5720
|
-
|
|
5868
|
+
var _loop = function _loop(i) {
|
|
5721
5869
|
var one = item.group[i];
|
|
5722
5870
|
var flag = void 0;
|
|
5871
|
+
var field = one.field;
|
|
5872
|
+
|
|
5873
|
+
if (one.variable) {
|
|
5874
|
+
field = JSON.stringify(_this2.fc.getLoadData(one.variable) || '');
|
|
5875
|
+
}
|
|
5723
5876
|
|
|
5724
5877
|
if (one.mode) {
|
|
5725
5878
|
flag = checkCondition(one);
|
|
5726
5879
|
} else if (!condition[one.condition]) {
|
|
5727
5880
|
flag = false;
|
|
5881
|
+
} else if (is.Function(one.handler)) {
|
|
5882
|
+
flag = invoke(function () {
|
|
5883
|
+
return one.handler(_this2.api, ctx.rule);
|
|
5884
|
+
});
|
|
5728
5885
|
} else {
|
|
5729
|
-
flag = new Function('$condition', '$val', '$form', '$group', "with($form){with(this){with($group){ return $condition['".concat(one.condition, "'](").concat(
|
|
5886
|
+
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);
|
|
5730
5887
|
}
|
|
5731
5888
|
|
|
5732
5889
|
if (or && flag) {
|
|
5733
|
-
return
|
|
5890
|
+
return {
|
|
5891
|
+
v: true
|
|
5892
|
+
};
|
|
5734
5893
|
}
|
|
5735
5894
|
|
|
5736
5895
|
if (!or) {
|
|
5737
5896
|
valid = valid && flag;
|
|
5738
5897
|
}
|
|
5898
|
+
};
|
|
5899
|
+
|
|
5900
|
+
for (var i = 0; i < item.group.length; i++) {
|
|
5901
|
+
var _ret = _loop(i);
|
|
5902
|
+
|
|
5903
|
+
if (_typeof(_ret) === "object") return _ret.v;
|
|
5739
5904
|
}
|
|
5740
5905
|
|
|
5741
5906
|
return or ? false : valid;
|
|
@@ -5771,8 +5936,8 @@
|
|
|
5771
5936
|
obj[k] = function () {
|
|
5772
5937
|
var _that$fc$formulas$k;
|
|
5773
5938
|
|
|
5774
|
-
for (var
|
|
5775
|
-
args[
|
|
5939
|
+
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
5940
|
+
args[_key2] = arguments[_key2];
|
|
5776
5941
|
}
|
|
5777
5942
|
|
|
5778
5943
|
return (_that$fc$formulas$k = that.fc.formulas[k]).call.apply(_that$fc$formulas$k, [{
|
|
@@ -5866,6 +6031,7 @@
|
|
|
5866
6031
|
this.$render.clearCache(ctx);
|
|
5867
6032
|
ctx["delete"]();
|
|
5868
6033
|
this.effect(ctx, 'deleted');
|
|
6034
|
+
this.targetHook(ctx, 'deleted');
|
|
5869
6035
|
input && !this.fieldCtx[field] && this.vm.emit('remove-field', field, ctx.rule, this.api);
|
|
5870
6036
|
ctx.rule.__ctrl || this.vm.emit('remove-rule', ctx.rule, this.api);
|
|
5871
6037
|
return ctx;
|
|
@@ -5912,6 +6078,25 @@
|
|
|
5912
6078
|
}
|
|
5913
6079
|
|
|
5914
6080
|
(_this$bus = this.bus).$emit.apply(_this$bus, [name].concat(args));
|
|
6081
|
+
},
|
|
6082
|
+
targetHook: function targetHook(ctx, name, args) {
|
|
6083
|
+
var _ctx$prop,
|
|
6084
|
+
_ctx$prop$hook,
|
|
6085
|
+
_this2 = this;
|
|
6086
|
+
|
|
6087
|
+
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];
|
|
6088
|
+
|
|
6089
|
+
if (hook) {
|
|
6090
|
+
hook = Array.isArray(hook) ? hook : [hook];
|
|
6091
|
+
hook.forEach(function (fn) {
|
|
6092
|
+
invoke(function () {
|
|
6093
|
+
return fn(_objectSpread2(_objectSpread2({}, args || {}), {}, {
|
|
6094
|
+
rule: ctx.rule,
|
|
6095
|
+
api: _this2.api
|
|
6096
|
+
}));
|
|
6097
|
+
});
|
|
6098
|
+
});
|
|
6099
|
+
}
|
|
5915
6100
|
}
|
|
5916
6101
|
});
|
|
5917
6102
|
}
|
|
@@ -6379,7 +6564,7 @@
|
|
|
6379
6564
|
var unwatchs = [];
|
|
6380
6565
|
attrs.forEach(function (attr) {
|
|
6381
6566
|
if (attr && (attr.attr || attr.template)) {
|
|
6382
|
-
var
|
|
6567
|
+
var fn = function fn(get) {
|
|
6383
6568
|
var value;
|
|
6384
6569
|
|
|
6385
6570
|
if (attr.template) {
|
|
@@ -6405,7 +6590,14 @@
|
|
|
6405
6590
|
}
|
|
6406
6591
|
|
|
6407
6592
|
api.sync(rule);
|
|
6408
|
-
}
|
|
6593
|
+
};
|
|
6594
|
+
|
|
6595
|
+
var callback = function callback(get) {
|
|
6596
|
+
return fn(get);
|
|
6597
|
+
};
|
|
6598
|
+
|
|
6599
|
+
var unwatch = fc.watchLoadData(callback);
|
|
6600
|
+
fn = debounce(fn, attr.wait || 300);
|
|
6409
6601
|
|
|
6410
6602
|
if (attr.watch !== false) {
|
|
6411
6603
|
unwatchs.push(unwatch);
|
|
@@ -6426,10 +6618,72 @@
|
|
|
6426
6618
|
inject.clearProp();
|
|
6427
6619
|
}
|
|
6428
6620
|
};
|
|
6429
|
-
loadData.watch = loadData.
|
|
6621
|
+
loadData.watch = loadData.mounted;
|
|
6430
6622
|
return loadData;
|
|
6431
6623
|
};
|
|
6432
6624
|
|
|
6625
|
+
var t = function t(fc) {
|
|
6626
|
+
var t = {
|
|
6627
|
+
name: 't',
|
|
6628
|
+
_fn: [],
|
|
6629
|
+
loaded: function loaded(inject, rule, api) {
|
|
6630
|
+
this.deleted(inject);
|
|
6631
|
+
var attrs = inject.getValue() || {};
|
|
6632
|
+
var unwatchs = [];
|
|
6633
|
+
Object.keys(attrs).forEach(function (key) {
|
|
6634
|
+
var attr = attrs[key];
|
|
6635
|
+
|
|
6636
|
+
if (attr) {
|
|
6637
|
+
var isObj = _typeof(attr) === 'object';
|
|
6638
|
+
|
|
6639
|
+
var fn = function fn(get) {
|
|
6640
|
+
var value = fc.t(isObj ? attr.attr : attr, isObj ? attr.params : null, get);
|
|
6641
|
+
|
|
6642
|
+
var _rule = isObj && attr.modify ? rule : inject.getProp();
|
|
6643
|
+
|
|
6644
|
+
if (key === 'child') {
|
|
6645
|
+
if (_rule.children) {
|
|
6646
|
+
_rule.children[0] = value;
|
|
6647
|
+
} else {
|
|
6648
|
+
_rule.children = [value];
|
|
6649
|
+
}
|
|
6650
|
+
} else {
|
|
6651
|
+
deepSet(_rule, key, value);
|
|
6652
|
+
}
|
|
6653
|
+
|
|
6654
|
+
api.sync(rule);
|
|
6655
|
+
};
|
|
6656
|
+
|
|
6657
|
+
var callback = function callback(get) {
|
|
6658
|
+
return fn(get);
|
|
6659
|
+
};
|
|
6660
|
+
|
|
6661
|
+
var unwatch = fc.watchLoadData(callback);
|
|
6662
|
+
fn = debounce(fn, attr.wait || 300);
|
|
6663
|
+
|
|
6664
|
+
if (attr.watch !== false) {
|
|
6665
|
+
unwatchs.push(unwatch);
|
|
6666
|
+
} else {
|
|
6667
|
+
unwatch();
|
|
6668
|
+
}
|
|
6669
|
+
}
|
|
6670
|
+
});
|
|
6671
|
+
this._fn[inject.id] = unwatchs;
|
|
6672
|
+
},
|
|
6673
|
+
deleted: function deleted(inject) {
|
|
6674
|
+
if (this._fn[inject.id]) {
|
|
6675
|
+
this._fn[inject.id].forEach(function (un) {
|
|
6676
|
+
un();
|
|
6677
|
+
});
|
|
6678
|
+
}
|
|
6679
|
+
|
|
6680
|
+
inject.clearProp();
|
|
6681
|
+
}
|
|
6682
|
+
};
|
|
6683
|
+
t.watch = t.loaded;
|
|
6684
|
+
return t;
|
|
6685
|
+
};
|
|
6686
|
+
|
|
6433
6687
|
var componentValidate = {
|
|
6434
6688
|
name: 'componentValidate',
|
|
6435
6689
|
load: function load(attr, rule, api) {
|
|
@@ -6628,6 +6882,7 @@
|
|
|
6628
6882
|
var $provider = {
|
|
6629
6883
|
fetch: fetch,
|
|
6630
6884
|
loadData: loadData,
|
|
6885
|
+
t: t,
|
|
6631
6886
|
componentValidate: componentValidate
|
|
6632
6887
|
};
|
|
6633
6888
|
|
|
@@ -7030,7 +7285,7 @@
|
|
|
7030
7285
|
options: vue.ref({}),
|
|
7031
7286
|
extendApiFn: extendApiFn,
|
|
7032
7287
|
fetchCache: new WeakMap(),
|
|
7033
|
-
tmpData: {}
|
|
7288
|
+
tmpData: vue.reactive({})
|
|
7034
7289
|
});
|
|
7035
7290
|
listener.forEach(function (item) {
|
|
7036
7291
|
_this.bus.$on(item.name, item.callback);
|
|
@@ -7105,6 +7360,26 @@
|
|
|
7105
7360
|
});
|
|
7106
7361
|
}
|
|
7107
7362
|
},
|
|
7363
|
+
t: function t(id, params, get) {
|
|
7364
|
+
var value = get ? get('$t.' + id) : this.globalLanguageDriver(id);
|
|
7365
|
+
|
|
7366
|
+
if (value == null && this.vm.appContext.config.globalProperties.$i18n) {
|
|
7367
|
+
return this.vm.appContext.config.globalProperties.$i18n.t(id, params);
|
|
7368
|
+
}
|
|
7369
|
+
|
|
7370
|
+
if (value == null) {
|
|
7371
|
+
value = '';
|
|
7372
|
+
}
|
|
7373
|
+
|
|
7374
|
+
if (value && params) {
|
|
7375
|
+
Object.keys(params).forEach(function (param) {
|
|
7376
|
+
var regex = new RegExp("{".concat(param, "}"), 'g');
|
|
7377
|
+
value = value.replace(regex, params[param]);
|
|
7378
|
+
});
|
|
7379
|
+
}
|
|
7380
|
+
|
|
7381
|
+
return value;
|
|
7382
|
+
},
|
|
7108
7383
|
globalDataDriver: function globalDataDriver(id) {
|
|
7109
7384
|
var _this4 = this;
|
|
7110
7385
|
|
|
@@ -7188,6 +7463,41 @@
|
|
|
7188
7463
|
}
|
|
7189
7464
|
}
|
|
7190
7465
|
},
|
|
7466
|
+
getLocale: function getLocale() {
|
|
7467
|
+
var locale = this.vm.setupState.top.props.locale;
|
|
7468
|
+
|
|
7469
|
+
if (locale && _typeof(locale) === 'object') {
|
|
7470
|
+
return locale.name;
|
|
7471
|
+
}
|
|
7472
|
+
|
|
7473
|
+
if (typeof locale === 'string') {
|
|
7474
|
+
return locale;
|
|
7475
|
+
}
|
|
7476
|
+
|
|
7477
|
+
if (this.vm.appContext.config.globalProperties.$i18n && this.vm.appContext.config.globalProperties.$i18n.locale) {
|
|
7478
|
+
return this.vm.appContext.config.globalProperties.$i18n.locale;
|
|
7479
|
+
}
|
|
7480
|
+
|
|
7481
|
+
return 'zh-cn';
|
|
7482
|
+
},
|
|
7483
|
+
globalLanguageDriver: function globalLanguageDriver(id) {
|
|
7484
|
+
var locale = this.vm.setupState.top.props.locale;
|
|
7485
|
+
var value = undefined;
|
|
7486
|
+
|
|
7487
|
+
if (locale && _typeof(locale) === 'object') {
|
|
7488
|
+
value = deepGet(locale, id);
|
|
7489
|
+
}
|
|
7490
|
+
|
|
7491
|
+
if (value == null) {
|
|
7492
|
+
var language = this.options.value.language || {};
|
|
7493
|
+
|
|
7494
|
+
var _locale = this.getLocale();
|
|
7495
|
+
|
|
7496
|
+
value = deepGet(language[_locale], id);
|
|
7497
|
+
}
|
|
7498
|
+
|
|
7499
|
+
return value;
|
|
7500
|
+
},
|
|
7191
7501
|
globalVarDriver: function globalVarDriver(id) {
|
|
7192
7502
|
var _this5 = this;
|
|
7193
7503
|
|
|
@@ -7245,6 +7555,12 @@
|
|
|
7245
7555
|
} else if (key === '$var') {
|
|
7246
7556
|
val = this.globalVarDriver(split.join('.'));
|
|
7247
7557
|
split = [];
|
|
7558
|
+
} else if (key === '$locale') {
|
|
7559
|
+
val = this.getLocale();
|
|
7560
|
+
split = [];
|
|
7561
|
+
} else if (key === '$t') {
|
|
7562
|
+
val = this.globalLanguageDriver(split.join('.'));
|
|
7563
|
+
split = [];
|
|
7248
7564
|
} else {
|
|
7249
7565
|
var tmpData = this.vm.setupState.top.setupState.fc.tmpData;
|
|
7250
7566
|
val = hasProperty(tmpData, key) ? deepGet(tmpData, id) : getData(id);
|
|
@@ -7274,8 +7590,9 @@
|
|
|
7274
7590
|
return unwatch[id].val;
|
|
7275
7591
|
}
|
|
7276
7592
|
|
|
7277
|
-
var
|
|
7278
|
-
|
|
7593
|
+
var data = vue.computed(function () {
|
|
7594
|
+
return _this6.getLoadData(id, def);
|
|
7595
|
+
});
|
|
7279
7596
|
var split = id.split('.');
|
|
7280
7597
|
var key = split.shift();
|
|
7281
7598
|
var key2 = split.shift() || '';
|
|
@@ -7289,6 +7606,9 @@
|
|
|
7289
7606
|
run(true);
|
|
7290
7607
|
}
|
|
7291
7608
|
}, 0);
|
|
7609
|
+
var un = vue.watch(data, function (n) {
|
|
7610
|
+
callback();
|
|
7611
|
+
});
|
|
7292
7612
|
|
|
7293
7613
|
_this6.bus.$on('$loadData.' + key, callback);
|
|
7294
7614
|
|
|
@@ -7303,10 +7623,12 @@
|
|
|
7303
7623
|
if (key2) {
|
|
7304
7624
|
_this6.bus.$off('$loadData.' + key + '.' + key2, callback);
|
|
7305
7625
|
}
|
|
7626
|
+
|
|
7627
|
+
un();
|
|
7306
7628
|
},
|
|
7307
|
-
val:
|
|
7629
|
+
val: data.value
|
|
7308
7630
|
};
|
|
7309
|
-
return
|
|
7631
|
+
return data.value;
|
|
7310
7632
|
};
|
|
7311
7633
|
|
|
7312
7634
|
run(false);
|
|
@@ -7512,6 +7834,7 @@
|
|
|
7512
7834
|
var DEFAULT_FORMATS = {
|
|
7513
7835
|
date: 'YYYY-MM-DD',
|
|
7514
7836
|
month: 'YYYY-MM',
|
|
7837
|
+
week: 'YYYY-wo',
|
|
7515
7838
|
datetime: 'YYYY-MM-DD HH:mm:ss',
|
|
7516
7839
|
timerange: 'HH:mm:ss',
|
|
7517
7840
|
daterange: 'YYYY-MM-DD',
|
|
@@ -7677,6 +8000,7 @@
|
|
|
7677
8000
|
autoComplete: PRE + '-autocomplete',
|
|
7678
8001
|
auto: PRE + '-autocomplete',
|
|
7679
8002
|
group: 'fc-group',
|
|
8003
|
+
array: 'fc-group',
|
|
7680
8004
|
object: 'fc-sub-form',
|
|
7681
8005
|
subForm: 'fc-sub-form'
|
|
7682
8006
|
};
|
|
@@ -7795,12 +8119,9 @@
|
|
|
7795
8119
|
return prop;
|
|
7796
8120
|
},
|
|
7797
8121
|
mergeProp: function mergeProp(ctx) {
|
|
7798
|
-
|
|
7799
|
-
|
|
7800
|
-
|
|
7801
|
-
col: this.options.col || {},
|
|
7802
|
-
title: this.options.title || {}
|
|
7803
|
-
}, ctx.prop], {
|
|
8122
|
+
var _this2 = this;
|
|
8123
|
+
|
|
8124
|
+
var def = {
|
|
7804
8125
|
info: {
|
|
7805
8126
|
trigger: 'hover',
|
|
7806
8127
|
placement: 'top-start',
|
|
@@ -7811,8 +8132,9 @@
|
|
|
7811
8132
|
span: 24
|
|
7812
8133
|
},
|
|
7813
8134
|
wrap: {}
|
|
7814
|
-
}
|
|
7815
|
-
|
|
8135
|
+
};
|
|
8136
|
+
['info', 'wrap', 'col', 'title'].forEach(function (name) {
|
|
8137
|
+
ctx.prop[name] = mergeProps([_this2.options[name] || {}, ctx.prop[name] || {}], def[name]);
|
|
7816
8138
|
});
|
|
7817
8139
|
},
|
|
7818
8140
|
getDefaultOptions: function getDefaultOptions() {
|
|
@@ -7841,22 +8163,22 @@
|
|
|
7841
8163
|
ref: ref
|
|
7842
8164
|
});
|
|
7843
8165
|
extend(this.rule.props, {
|
|
7844
|
-
model:
|
|
8166
|
+
model: $handle.formData
|
|
7845
8167
|
});
|
|
7846
8168
|
},
|
|
7847
8169
|
render: function render(children) {
|
|
7848
|
-
var
|
|
8170
|
+
var _this3 = this;
|
|
7849
8171
|
|
|
7850
8172
|
if (children.slotLen() && !this.$handle.preview) {
|
|
7851
8173
|
children.setSlot(undefined, function () {
|
|
7852
|
-
return
|
|
8174
|
+
return _this3.makeFormBtn();
|
|
7853
8175
|
});
|
|
7854
8176
|
}
|
|
7855
8177
|
|
|
7856
8178
|
return this.$r(this.rule, isFalse(this.options.row.show) ? children.getSlots() : [this.makeRow(children)]);
|
|
7857
8179
|
},
|
|
7858
8180
|
makeWrap: function makeWrap(ctx, children) {
|
|
7859
|
-
var
|
|
8181
|
+
var _this4 = this;
|
|
7860
8182
|
|
|
7861
8183
|
var rule = ctx.prop;
|
|
7862
8184
|
var uni = "".concat(this.key).concat(ctx.key);
|
|
@@ -7875,7 +8197,7 @@
|
|
|
7875
8197
|
prop: ctx.id,
|
|
7876
8198
|
rules: ctx.injectValidate()
|
|
7877
8199
|
}),
|
|
7878
|
-
"class": rule.className,
|
|
8200
|
+
"class": this.$render.mergeClass(rule.className, 'fc-form-item'),
|
|
7879
8201
|
key: "".concat(uni, "fi"),
|
|
7880
8202
|
ref: ctx.wrapRef,
|
|
7881
8203
|
type: 'formItem'
|
|
@@ -7885,7 +8207,7 @@
|
|
|
7885
8207
|
}
|
|
7886
8208
|
}, isTitle ? {
|
|
7887
8209
|
label: function label() {
|
|
7888
|
-
return
|
|
8210
|
+
return _this4.makeInfo(rule, uni, ctx);
|
|
7889
8211
|
}
|
|
7890
8212
|
} : {}));
|
|
7891
8213
|
return inline === true || isFalse(_col) || isFalse(col.show) ? item : this.makeCol(rule, uni, [item]);
|
|
@@ -7896,7 +8218,7 @@
|
|
|
7896
8218
|
return !(!title.title && !title["native"] || isFalse(title.show));
|
|
7897
8219
|
},
|
|
7898
8220
|
makeInfo: function makeInfo(rule, uni, ctx) {
|
|
7899
|
-
var
|
|
8221
|
+
var _this5 = this;
|
|
7900
8222
|
|
|
7901
8223
|
var titleProp = _objectSpread2({}, rule.title);
|
|
7902
8224
|
|
|
@@ -7906,10 +8228,10 @@
|
|
|
7906
8228
|
var form = this.options.form;
|
|
7907
8229
|
var titleSlot = this.getSlot('title');
|
|
7908
8230
|
var children = [titleSlot ? titleSlot({
|
|
7909
|
-
title:
|
|
8231
|
+
title: ctx.refRule.__$title.value,
|
|
7910
8232
|
rule: ctx.rule,
|
|
7911
8233
|
options: this.options
|
|
7912
|
-
}) :
|
|
8234
|
+
}) : ctx.refRule.__$title.value + (form.labelSuffix || form['label-suffix'] || '')];
|
|
7913
8235
|
|
|
7914
8236
|
if (!isFalse(infoProp.show) && (infoProp.info || infoProp["native"]) && !isFalse(infoProp.icon)) {
|
|
7915
8237
|
var prop = {
|
|
@@ -7925,17 +8247,17 @@
|
|
|
7925
8247
|
var field = 'content';
|
|
7926
8248
|
|
|
7927
8249
|
if (infoProp.info && !hasProperty(prop.props, field)) {
|
|
7928
|
-
prop.props[field] =
|
|
8250
|
+
prop.props[field] = ctx.refRule.__$info.value;
|
|
7929
8251
|
}
|
|
7930
8252
|
|
|
7931
8253
|
children[infoProp.align !== 'left' ? 'unshift' : 'push'](this.$r(mergeProps([infoProp, prop]), _defineProperty({}, titleProp.slot || (isTip ? 'default' : 'reference'), function () {
|
|
7932
|
-
return
|
|
8254
|
+
return _this5.$r({
|
|
7933
8255
|
type: 'ElIcon',
|
|
7934
8256
|
style: 'top:2px',
|
|
7935
8257
|
key: "".concat(uni, "i")
|
|
7936
8258
|
}, {
|
|
7937
8259
|
"default": function _default() {
|
|
7938
|
-
return
|
|
8260
|
+
return _this5.$r({
|
|
7939
8261
|
type: infoProp.icon === true ? 'icon-warning' : infoProp.icon
|
|
7940
8262
|
});
|
|
7941
8263
|
}
|
|
@@ -7946,6 +8268,7 @@
|
|
|
7946
8268
|
var _prop = mergeProps([titleProp, {
|
|
7947
8269
|
props: tidyRule(titleProp),
|
|
7948
8270
|
key: "".concat(uni, "tit"),
|
|
8271
|
+
"class": 'fc-form-title',
|
|
7949
8272
|
type: titleProp.type || 'span'
|
|
7950
8273
|
}]);
|
|
7951
8274
|
|
|
@@ -7957,7 +8280,7 @@
|
|
|
7957
8280
|
makeCol: function makeCol(rule, uni, children) {
|
|
7958
8281
|
var col = rule.col;
|
|
7959
8282
|
return this.$r({
|
|
7960
|
-
"class": col["class"],
|
|
8283
|
+
"class": this.$render.mergeClass(col["class"], 'fc-form-col'),
|
|
7961
8284
|
type: 'col',
|
|
7962
8285
|
props: col || {
|
|
7963
8286
|
span: 24
|
|
@@ -7970,7 +8293,7 @@
|
|
|
7970
8293
|
return this.$r({
|
|
7971
8294
|
type: 'row',
|
|
7972
8295
|
props: row,
|
|
7973
|
-
"class": row["class"],
|
|
8296
|
+
"class": this.$render.mergeClass(row["class"], 'fc-form-row'),
|
|
7974
8297
|
key: "".concat(this.key, "row")
|
|
7975
8298
|
}, children);
|
|
7976
8299
|
},
|
|
@@ -7991,10 +8314,12 @@
|
|
|
7991
8314
|
|
|
7992
8315
|
var item = this.$r({
|
|
7993
8316
|
type: 'formItem',
|
|
8317
|
+
"class": 'fc-form-item',
|
|
7994
8318
|
key: "".concat(this.key, "fb")
|
|
7995
8319
|
}, vn);
|
|
7996
8320
|
return this.rule.props.inline === true ? item : this.$r({
|
|
7997
8321
|
type: 'col',
|
|
8322
|
+
"class": 'fc-form-col fc-form-footer',
|
|
7998
8323
|
props: {
|
|
7999
8324
|
span: 24
|
|
8000
8325
|
},
|
|
@@ -8002,7 +8327,7 @@
|
|
|
8002
8327
|
}, [item]);
|
|
8003
8328
|
},
|
|
8004
8329
|
makeResetBtn: function makeResetBtn() {
|
|
8005
|
-
var
|
|
8330
|
+
var _this6 = this;
|
|
8006
8331
|
|
|
8007
8332
|
var resetBtn = _objectSpread2({}, this.options.resetBtn);
|
|
8008
8333
|
|
|
@@ -8014,21 +8339,21 @@
|
|
|
8014
8339
|
return this.$r({
|
|
8015
8340
|
type: 'button',
|
|
8016
8341
|
props: resetBtn,
|
|
8017
|
-
"class": '
|
|
8342
|
+
"class": 'fc-reset-btn',
|
|
8018
8343
|
style: {
|
|
8019
8344
|
width: resetBtn.width
|
|
8020
8345
|
},
|
|
8021
8346
|
on: {
|
|
8022
8347
|
click: function click() {
|
|
8023
|
-
var fApi =
|
|
8024
|
-
|
|
8348
|
+
var fApi = _this6.$handle.api;
|
|
8349
|
+
_this6.options.resetBtn.click ? _this6.options.resetBtn.click(fApi) : fApi.resetFields();
|
|
8025
8350
|
}
|
|
8026
8351
|
},
|
|
8027
8352
|
key: "".concat(this.key, "b2")
|
|
8028
8353
|
}, [innerText]);
|
|
8029
8354
|
},
|
|
8030
8355
|
makeSubmitBtn: function makeSubmitBtn() {
|
|
8031
|
-
var
|
|
8356
|
+
var _this7 = this;
|
|
8032
8357
|
|
|
8033
8358
|
var submitBtn = _objectSpread2({}, this.options.submitBtn);
|
|
8034
8359
|
|
|
@@ -8040,14 +8365,14 @@
|
|
|
8040
8365
|
return this.$r({
|
|
8041
8366
|
type: 'button',
|
|
8042
8367
|
props: submitBtn,
|
|
8043
|
-
"class": '
|
|
8368
|
+
"class": 'fc-submit-btn',
|
|
8044
8369
|
style: {
|
|
8045
8370
|
width: submitBtn.width
|
|
8046
8371
|
},
|
|
8047
8372
|
on: {
|
|
8048
8373
|
click: function click() {
|
|
8049
|
-
var fApi =
|
|
8050
|
-
|
|
8374
|
+
var fApi = _this7.$handle.api;
|
|
8375
|
+
_this7.options.submitBtn.click ? _this7.options.submitBtn.click(fApi) : fApi.submit()["catch"](function () {});
|
|
8051
8376
|
}
|
|
8052
8377
|
},
|
|
8053
8378
|
key: "".concat(this.key, "b1")
|
|
@@ -8137,7 +8462,7 @@
|
|
|
8137
8462
|
return maker;
|
|
8138
8463
|
}
|
|
8139
8464
|
|
|
8140
|
-
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-
|
|
8465
|
+
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}";
|
|
8141
8466
|
styleInject(css_248z);
|
|
8142
8467
|
|
|
8143
8468
|
function tidyBtnProp(btn, def) {
|
|
@@ -8329,8 +8654,15 @@
|
|
|
8329
8654
|
}, val);
|
|
8330
8655
|
|
|
8331
8656
|
if (!validate.message) {
|
|
8332
|
-
|
|
8333
|
-
|
|
8657
|
+
validate.message = rule.__fc__.refRule.__$title.value + (api.getLocale() === 'en' ? ' is required' : '不能为空');
|
|
8658
|
+
} else {
|
|
8659
|
+
var match = validate.message.match(/^\{\{\s*\$t\.(.+)\s*\}\}$/);
|
|
8660
|
+
|
|
8661
|
+
if (match) {
|
|
8662
|
+
validate.message = api.t(match[1], {
|
|
8663
|
+
title: rule.__fc__.refRule.__$title.value
|
|
8664
|
+
});
|
|
8665
|
+
}
|
|
8334
8666
|
}
|
|
8335
8667
|
|
|
8336
8668
|
inject.getProp().validate = [validate];
|
|
@@ -8390,7 +8722,7 @@
|
|
|
8390
8722
|
function elmFormCreate() {
|
|
8391
8723
|
return FormCreateFactory({
|
|
8392
8724
|
ui: 'element-ui',
|
|
8393
|
-
version: '3.2.
|
|
8725
|
+
version: '3.2.14',
|
|
8394
8726
|
manager: manager,
|
|
8395
8727
|
extendApi: extendApi,
|
|
8396
8728
|
install: install,
|