@form-create/element-ui 3.2.17 → 3.2.19
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 +253 -88
- package/dist/form-create.esm.min.js +2 -2
- package/dist/form-create.js +252 -87
- package/dist/form-create.min.js +2 -2
- package/package.json +11 -11
- package/src/core/config.js +2 -2
- package/src/core/manager.js +5 -5
- package/src/core/provider.js +3 -2
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.19
|
|
3
3
|
* (c) 2018-2025 xaboy
|
|
4
4
|
* Github https://github.com/xaboy/form-create
|
|
5
5
|
* Released under the MIT License.
|
|
@@ -202,11 +202,11 @@
|
|
|
202
202
|
function getSlot(slots, exclude) {
|
|
203
203
|
return Object.keys(slots).reduce(function (lst, name) {
|
|
204
204
|
if (!exclude || exclude.indexOf(name) === -1) {
|
|
205
|
-
lst
|
|
205
|
+
lst[name] = slots[name];
|
|
206
206
|
}
|
|
207
207
|
|
|
208
208
|
return lst;
|
|
209
|
-
},
|
|
209
|
+
}, {});
|
|
210
210
|
}
|
|
211
211
|
|
|
212
212
|
function toArray(value) {
|
|
@@ -552,10 +552,6 @@
|
|
|
552
552
|
|
|
553
553
|
script$2.render = render$2;
|
|
554
554
|
|
|
555
|
-
function _isSlot(s) {
|
|
556
|
-
return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !vue.isVNode(s);
|
|
557
|
-
}
|
|
558
|
-
|
|
559
555
|
var NAME$7 = 'fcFrame';
|
|
560
556
|
var Frame = vue.defineComponent({
|
|
561
557
|
name: NAME$7,
|
|
@@ -595,11 +591,11 @@
|
|
|
595
591
|
},
|
|
596
592
|
okBtnText: {
|
|
597
593
|
type: String,
|
|
598
|
-
"default": '
|
|
594
|
+
"default": ''
|
|
599
595
|
},
|
|
600
596
|
closeBtnText: {
|
|
601
597
|
type: String,
|
|
602
|
-
"default": '
|
|
598
|
+
"default": ''
|
|
603
599
|
},
|
|
604
600
|
modalTitle: String,
|
|
605
601
|
handleIcon: {
|
|
@@ -933,18 +929,18 @@
|
|
|
933
929
|
"onClick": function onClick() {
|
|
934
930
|
return _this8.onCancel() !== false && (_this8.frameVisible = false);
|
|
935
931
|
}
|
|
936
|
-
},
|
|
932
|
+
}, {
|
|
937
933
|
"default": function _default() {
|
|
938
|
-
return [closeBtnText];
|
|
934
|
+
return [closeBtnText || _this8.formCreateInject.t('close') || '关闭'];
|
|
939
935
|
}
|
|
940
936
|
}) : null, okBtn ? vue.createVNode(vue.resolveComponent("ElButton"), {
|
|
941
937
|
"type": "primary",
|
|
942
938
|
"onClick": function onClick() {
|
|
943
939
|
return _this8.onOk() !== false && _this8.closeModel();
|
|
944
940
|
}
|
|
945
|
-
},
|
|
941
|
+
}, {
|
|
946
942
|
"default": function _default() {
|
|
947
|
-
return [okBtnText];
|
|
943
|
+
return [okBtnText || _this8.formCreateInject.t('ok') || '确定'];
|
|
948
944
|
}
|
|
949
945
|
}) : null]);
|
|
950
946
|
}
|
|
@@ -1416,8 +1412,10 @@
|
|
|
1416
1412
|
props: {
|
|
1417
1413
|
previewMask: undefined,
|
|
1418
1414
|
onPreview: Function,
|
|
1415
|
+
httpRequest: Function,
|
|
1419
1416
|
modalTitle: String,
|
|
1420
1417
|
listType: String,
|
|
1418
|
+
formCreateInject: Object,
|
|
1421
1419
|
modelValue: [Array, String, Object]
|
|
1422
1420
|
},
|
|
1423
1421
|
emits: ['update:modelValue', 'change', 'remove', 'fc.el'],
|
|
@@ -1470,6 +1468,14 @@
|
|
|
1470
1468
|
handleRemove: function handleRemove(file, fileList) {
|
|
1471
1469
|
this.$emit.apply(this, ['remove'].concat(Array.prototype.slice.call(arguments)));
|
|
1472
1470
|
this.update(fileList);
|
|
1471
|
+
},
|
|
1472
|
+
doHttpRequest: function doHttpRequest(option) {
|
|
1473
|
+
if (this.httpRequest) {
|
|
1474
|
+
return this.httpRequest(option);
|
|
1475
|
+
} else {
|
|
1476
|
+
option.source = 'upload';
|
|
1477
|
+
this.formCreateInject.api.fetch(option);
|
|
1478
|
+
}
|
|
1473
1479
|
}
|
|
1474
1480
|
},
|
|
1475
1481
|
render: function render() {
|
|
@@ -1490,6 +1496,7 @@
|
|
|
1490
1496
|
"onPreview": this.handlePreview,
|
|
1491
1497
|
"onChange": this.handleChange,
|
|
1492
1498
|
"onRemove": this.handleRemove,
|
|
1499
|
+
"httpRequest": this.doHttpRequest,
|
|
1493
1500
|
"fileList": this.fileList,
|
|
1494
1501
|
"ref": "upload"
|
|
1495
1502
|
}), _objectSpread2({
|
|
@@ -1502,7 +1509,7 @@
|
|
|
1502
1509
|
"type": "primary"
|
|
1503
1510
|
}, {
|
|
1504
1511
|
"default": function _default() {
|
|
1505
|
-
return [
|
|
1512
|
+
return [_this.formCreateInject.t('clickToUpload') || '点击上传'];
|
|
1506
1513
|
}
|
|
1507
1514
|
}))];
|
|
1508
1515
|
}
|
|
@@ -1780,6 +1787,7 @@
|
|
|
1780
1787
|
return;
|
|
1781
1788
|
}
|
|
1782
1789
|
|
|
1790
|
+
this.cacheRule[key].$f && this.cacheRule[key].$f.coverValue(value);
|
|
1783
1791
|
this.cache(key, value);
|
|
1784
1792
|
},
|
|
1785
1793
|
addRule: function addRule(i, emit) {
|
|
@@ -2516,7 +2524,7 @@
|
|
|
2516
2524
|
|
|
2517
2525
|
var keyAttrs = ['type', 'slot', 'ignore', 'emitPrefix', 'value', 'name', 'native', 'hidden', 'display', 'inject', 'options', 'emit', 'link', 'prefix', 'suffix', 'update', 'sync', 'optionsTo', 'key', 'slotUpdate', 'computed', 'preview', 'component', 'cache', 'modelEmit'];
|
|
2518
2526
|
var arrayAttrs = ['validate', 'children', 'control'];
|
|
2519
|
-
var normalAttrs = ['effect', 'deep'];
|
|
2527
|
+
var normalAttrs = ['effect', 'deep', 'renderSlots'];
|
|
2520
2528
|
function attrs() {
|
|
2521
2529
|
return [].concat(keyAttrs, _toConsumableArray(normalMerge), _toConsumableArray(toArrayMerge), _toConsumableArray(functionalMerge), arrayAttrs, normalAttrs);
|
|
2522
2530
|
}
|
|
@@ -3003,13 +3011,22 @@
|
|
|
3003
3011
|
var xhr = new XMLHttpRequest();
|
|
3004
3012
|
var action = option.action || '';
|
|
3005
3013
|
|
|
3014
|
+
if (xhr.upload && option.onProgress) {
|
|
3015
|
+
xhr.upload.addEventListener('progress', function (evt) {
|
|
3016
|
+
evt.percent = evt.total > 0 ? evt.loaded / evt.total * 100 : 0;
|
|
3017
|
+
option.onProgress(evt);
|
|
3018
|
+
});
|
|
3019
|
+
}
|
|
3020
|
+
|
|
3006
3021
|
if (option.query) {
|
|
3007
3022
|
var queryString = new URLSearchParams(option.query).toString();
|
|
3008
3023
|
|
|
3009
|
-
if (
|
|
3010
|
-
action
|
|
3011
|
-
|
|
3012
|
-
|
|
3024
|
+
if (queryString) {
|
|
3025
|
+
if (action.includes('?')) {
|
|
3026
|
+
action += "&".concat(queryString);
|
|
3027
|
+
} else {
|
|
3028
|
+
action += "?".concat(queryString);
|
|
3029
|
+
}
|
|
3013
3030
|
}
|
|
3014
3031
|
}
|
|
3015
3032
|
|
|
@@ -3028,18 +3045,22 @@
|
|
|
3028
3045
|
xhr.open(option.method || 'get', action, true);
|
|
3029
3046
|
var formData;
|
|
3030
3047
|
|
|
3031
|
-
if (option.data) {
|
|
3032
|
-
if ((option.dataType || '').toLowerCase() !== 'json') {
|
|
3048
|
+
if (option.data || option.file) {
|
|
3049
|
+
if (option.file || (option.dataType || '').toLowerCase() !== 'json') {
|
|
3033
3050
|
formData = new FormData();
|
|
3034
|
-
Object.keys(option.data).map(function (key) {
|
|
3051
|
+
Object.keys(option.data || {}).map(function (key) {
|
|
3035
3052
|
formData.append(key, option.data[key]);
|
|
3036
3053
|
});
|
|
3037
3054
|
} else {
|
|
3038
|
-
formData = JSON.stringify(option.data);
|
|
3055
|
+
formData = JSON.stringify(option.data || {});
|
|
3039
3056
|
xhr.setRequestHeader('content-type', 'application/json');
|
|
3040
3057
|
}
|
|
3041
3058
|
}
|
|
3042
3059
|
|
|
3060
|
+
if (option.file) {
|
|
3061
|
+
formData.append(option.filename, option.file, option.file.name);
|
|
3062
|
+
}
|
|
3063
|
+
|
|
3043
3064
|
if (option.withCredentials && 'withCredentials' in xhr) {
|
|
3044
3065
|
xhr.withCredentials = true;
|
|
3045
3066
|
}
|
|
@@ -3506,7 +3527,11 @@
|
|
|
3506
3527
|
});
|
|
3507
3528
|
});
|
|
3508
3529
|
vue.nextTick(function () {
|
|
3509
|
-
|
|
3530
|
+
vue.nextTick(function () {
|
|
3531
|
+
vue.nextTick(function () {
|
|
3532
|
+
api.clearValidateState(fields);
|
|
3533
|
+
});
|
|
3534
|
+
});
|
|
3510
3535
|
});
|
|
3511
3536
|
|
|
3512
3537
|
if (fields == null) {
|
|
@@ -3649,6 +3674,16 @@
|
|
|
3649
3674
|
}
|
|
3650
3675
|
});
|
|
3651
3676
|
},
|
|
3677
|
+
renderRule: function renderRule(id, onInput, force) {
|
|
3678
|
+
var flag = _typeof(id) === 'object';
|
|
3679
|
+
var ctx = flag ? byCtx(id) : h.getCtx(id);
|
|
3680
|
+
return ctx ? h.$render.createRuleVnode(ctx, onInput, force) : undefined;
|
|
3681
|
+
},
|
|
3682
|
+
renderChildren: function renderChildren(id, onInput, force) {
|
|
3683
|
+
var flag = _typeof(id) === 'object';
|
|
3684
|
+
var ctx = flag ? byCtx(id) : h.getCtx(id);
|
|
3685
|
+
return ctx ? h.$render.createChildrenVnodes(ctx, onInput, force) : undefined;
|
|
3686
|
+
},
|
|
3652
3687
|
nextTick: function nextTick(fn) {
|
|
3653
3688
|
h.bus.$once('next-tick', fn);
|
|
3654
3689
|
h.refresh();
|
|
@@ -3900,7 +3935,7 @@
|
|
|
3900
3935
|
if (!this.cacheConfig[ctx.trueType]) {
|
|
3901
3936
|
this.cacheConfig[ctx.trueType] = vue.computed(function () {
|
|
3902
3937
|
var g = _this2.$handle.options.global;
|
|
3903
|
-
return mergeRule({}, [g['*'], g[ctx.originType] || g[ctx.type] || g[ctx.type] || {}]);
|
|
3938
|
+
return mergeRule({}, [g['*'] || g["default"] || {}, g[ctx.originType] || g[ctx.type] || g[ctx.type] || {}]);
|
|
3904
3939
|
});
|
|
3905
3940
|
}
|
|
3906
3941
|
|
|
@@ -3952,7 +3987,7 @@
|
|
|
3952
3987
|
if (ctx.type === 'hidden') return;
|
|
3953
3988
|
var rule = ctx.rule;
|
|
3954
3989
|
|
|
3955
|
-
if (!this.cache[ctx.id] || this.cache[ctx.id].slot !== rule.slot) {
|
|
3990
|
+
if (this.force || !this.cache[ctx.id] || this.cache[ctx.id].slot !== rule.slot) {
|
|
3956
3991
|
var vn;
|
|
3957
3992
|
ctx.initProp();
|
|
3958
3993
|
this.mergeGlobal(ctx);
|
|
@@ -4002,6 +4037,26 @@
|
|
|
4002
4037
|
children = _this4.renderChildren(_load, ctx);
|
|
4003
4038
|
}
|
|
4004
4039
|
|
|
4040
|
+
Object.keys(prop.renderSlots || {}).forEach(function (key) {
|
|
4041
|
+
children[key] = function () {
|
|
4042
|
+
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
4043
|
+
args[_key2] = arguments[_key2];
|
|
4044
|
+
}
|
|
4045
|
+
|
|
4046
|
+
if (is.Function(prop.renderSlots[key])) {
|
|
4047
|
+
return invoke(function () {
|
|
4048
|
+
var _prop$renderSlots;
|
|
4049
|
+
|
|
4050
|
+
return (_prop$renderSlots = prop.renderSlots)[key].apply(_prop$renderSlots, args);
|
|
4051
|
+
});
|
|
4052
|
+
}
|
|
4053
|
+
|
|
4054
|
+
var rule = _this4.parseSide(prop.renderSlots[key], ctx);
|
|
4055
|
+
|
|
4056
|
+
return _this4.renderRule(rule);
|
|
4057
|
+
};
|
|
4058
|
+
});
|
|
4059
|
+
|
|
4005
4060
|
var slot = _this4.getTypeSlot(ctx);
|
|
4006
4061
|
|
|
4007
4062
|
var _vn;
|
|
@@ -4123,6 +4178,11 @@
|
|
|
4123
4178
|
field: ctx.field,
|
|
4124
4179
|
rule: ctx.rule,
|
|
4125
4180
|
input: ctx.input,
|
|
4181
|
+
t: function t() {
|
|
4182
|
+
var _this6$$handle$api;
|
|
4183
|
+
|
|
4184
|
+
return (_this6$$handle$api = _this6.$handle.api).t.apply(_this6$$handle$api, arguments);
|
|
4185
|
+
},
|
|
4126
4186
|
updateValue: function updateValue(data) {
|
|
4127
4187
|
_this6.$handle.onUpdateValue(ctx, data);
|
|
4128
4188
|
}
|
|
@@ -4169,6 +4229,8 @@
|
|
|
4169
4229
|
}];
|
|
4170
4230
|
|
|
4171
4231
|
if (ctx.input) {
|
|
4232
|
+
var tmpInput = this.tmpInput;
|
|
4233
|
+
|
|
4172
4234
|
if (this.vm.props.disabled === true) {
|
|
4173
4235
|
ctx.prop.props.disabled = true;
|
|
4174
4236
|
}
|
|
@@ -4176,6 +4238,8 @@
|
|
|
4176
4238
|
var field = this.getModelField(ctx);
|
|
4177
4239
|
var model = {
|
|
4178
4240
|
callback: function callback(value) {
|
|
4241
|
+
tmpInput && tmpInput(ctx.field, value, ctx.rule);
|
|
4242
|
+
|
|
4179
4243
|
_this7.onInput(ctx, value);
|
|
4180
4244
|
},
|
|
4181
4245
|
modelField: field,
|
|
@@ -4248,6 +4312,23 @@
|
|
|
4248
4312
|
if (this.vNode[ctx.originType]) return this.vNode[ctx.originType](prop, children);
|
|
4249
4313
|
return this.vNode.make(lower(prop.type), prop, children);
|
|
4250
4314
|
},
|
|
4315
|
+
createChildrenVnodes: function createChildrenVnodes(ctx, onInput, force) {
|
|
4316
|
+
this.force = force !== false;
|
|
4317
|
+
this.tmpInput = onInput;
|
|
4318
|
+
var res = this.renderChildren(ctx.rule.children, ctx);
|
|
4319
|
+
this.force = false;
|
|
4320
|
+
this.tmpInput = null;
|
|
4321
|
+
return res;
|
|
4322
|
+
},
|
|
4323
|
+
createRuleVnode: function createRuleVnode(ctx, onInput, force) {
|
|
4324
|
+
this.force = force !== false;
|
|
4325
|
+
this.tmpInput = onInput;
|
|
4326
|
+
var slotBag = makeSlotBag();
|
|
4327
|
+
this.renderSlot(slotBag, ctx, ctx.parent);
|
|
4328
|
+
this.force = false;
|
|
4329
|
+
this.tmpInput = null;
|
|
4330
|
+
return slotBag.getSlots();
|
|
4331
|
+
},
|
|
4251
4332
|
renderRule: function renderRule(rule, children, origin) {
|
|
4252
4333
|
var _this9 = this;
|
|
4253
4334
|
|
|
@@ -4295,6 +4376,8 @@
|
|
|
4295
4376
|
vm: handle.vm,
|
|
4296
4377
|
$manager: handle.$manager,
|
|
4297
4378
|
vNode: new handle.fc.CreateNode(handle.vm),
|
|
4379
|
+
force: false,
|
|
4380
|
+
tmpInput: null,
|
|
4298
4381
|
id: id$1++
|
|
4299
4382
|
});
|
|
4300
4383
|
funcProxy(this, {
|
|
@@ -4441,7 +4524,7 @@
|
|
|
4441
4524
|
fn.__json = _fn.__json;
|
|
4442
4525
|
return fn;
|
|
4443
4526
|
},
|
|
4444
|
-
loadStrVar: function loadStrVar(str, get) {
|
|
4527
|
+
loadStrVar: function loadStrVar(str, get, group) {
|
|
4445
4528
|
var _this3 = this;
|
|
4446
4529
|
|
|
4447
4530
|
if (str && typeof str === 'string' && str.indexOf('{{') > -1 && str.indexOf('}}') > -1) {
|
|
@@ -4454,7 +4537,29 @@
|
|
|
4454
4537
|
|
|
4455
4538
|
if (field) {
|
|
4456
4539
|
var def = (split[1] || '').trim();
|
|
4457
|
-
var val
|
|
4540
|
+
var val;
|
|
4541
|
+
var flag = false;
|
|
4542
|
+
|
|
4543
|
+
if (group && field.indexOf('$form.') === 0) {
|
|
4544
|
+
var _split = field.split('.');
|
|
4545
|
+
|
|
4546
|
+
_split.shift();
|
|
4547
|
+
|
|
4548
|
+
if (hasProperty(group.value, _split[0])) {
|
|
4549
|
+
flag = true;
|
|
4550
|
+
val = get ? get({
|
|
4551
|
+
id: '$form.' + _split[0] + '_' + group.rule.__fc__.id,
|
|
4552
|
+
getValue: function getValue() {
|
|
4553
|
+
return deepGet(group.value, _split);
|
|
4554
|
+
}
|
|
4555
|
+
}) : deepGet(group.value, _split);
|
|
4556
|
+
}
|
|
4557
|
+
}
|
|
4558
|
+
|
|
4559
|
+
if (!flag) {
|
|
4560
|
+
val = get ? get(field, def) : _this3.fc.getLoadData(field, def);
|
|
4561
|
+
}
|
|
4562
|
+
|
|
4458
4563
|
lastVal = val;
|
|
4459
4564
|
str = str.replaceAll("{{".concat(v, "}}"), val == null ? '' : val);
|
|
4460
4565
|
}
|
|
@@ -4467,11 +4572,20 @@
|
|
|
4467
4572
|
|
|
4468
4573
|
return str;
|
|
4469
4574
|
},
|
|
4470
|
-
loadFetchVar: function loadFetchVar(options, get) {
|
|
4575
|
+
loadFetchVar: function loadFetchVar(options, get, rule) {
|
|
4471
4576
|
var _this4 = this;
|
|
4472
4577
|
|
|
4578
|
+
var group;
|
|
4579
|
+
|
|
4580
|
+
if (rule && rule.__fc__) {
|
|
4581
|
+
group = rule.__fc__.getParentGroup();
|
|
4582
|
+
}
|
|
4583
|
+
|
|
4473
4584
|
var loadVal = function loadVal(str) {
|
|
4474
|
-
return _this4.loadStrVar(str, get
|
|
4585
|
+
return _this4.loadStrVar(str, get, group ? {
|
|
4586
|
+
rule: rule,
|
|
4587
|
+
value: _this4.subRuleData[group.id] || {}
|
|
4588
|
+
} : null);
|
|
4475
4589
|
};
|
|
4476
4590
|
|
|
4477
4591
|
options.action = loadVal(options.action || '');
|
|
@@ -4752,7 +4866,9 @@
|
|
|
4752
4866
|
parser.init(this);
|
|
4753
4867
|
},
|
|
4754
4868
|
initProp: function initProp() {
|
|
4755
|
-
var _this3 = this
|
|
4869
|
+
var _this3 = this,
|
|
4870
|
+
_this$refRule,
|
|
4871
|
+
_this$refRule$__$vali;
|
|
4756
4872
|
|
|
4757
4873
|
var rule = _objectSpread2({}, this.rule);
|
|
4758
4874
|
|
|
@@ -4761,7 +4877,7 @@
|
|
|
4761
4877
|
this.prop = mergeRule({}, [rule].concat(_toConsumableArray(Object.keys(this.payload).map(function (k) {
|
|
4762
4878
|
return _this3.payload[k];
|
|
4763
4879
|
})), [this.computed]));
|
|
4764
|
-
this.prop.validate = [].concat(_toConsumableArray(this.refRule.__$validate.value || []), _toConsumableArray(this.prop.validate || []));
|
|
4880
|
+
this.prop.validate = [].concat(_toConsumableArray(((_this$refRule = this.refRule) === null || _this$refRule === void 0 ? void 0 : (_this$refRule$__$vali = _this$refRule.__$validate) === null || _this$refRule$__$vali === void 0 ? void 0 : _this$refRule$__$vali.value) || []), _toConsumableArray(this.prop.validate || []));
|
|
4765
4881
|
},
|
|
4766
4882
|
initNone: function initNone() {
|
|
4767
4883
|
this.none = !(is.Undef(this.prop.display) || !!this.prop.display);
|
|
@@ -5330,6 +5446,8 @@
|
|
|
5330
5446
|
function useInput(Handler) {
|
|
5331
5447
|
extend(Handler.prototype, {
|
|
5332
5448
|
setValue: function setValue(ctx, value, formValue, setFlag) {
|
|
5449
|
+
var _this = this;
|
|
5450
|
+
|
|
5333
5451
|
if (ctx.deleted) return;
|
|
5334
5452
|
ctx.rule.value = value;
|
|
5335
5453
|
this.changeStatus = true;
|
|
@@ -5348,6 +5466,16 @@
|
|
|
5348
5466
|
api: this.api,
|
|
5349
5467
|
setFlag: setFlag || false
|
|
5350
5468
|
});
|
|
5469
|
+
|
|
5470
|
+
if (setFlag) {
|
|
5471
|
+
vue.nextTick(function () {
|
|
5472
|
+
vue.nextTick(function () {
|
|
5473
|
+
vue.nextTick(function () {
|
|
5474
|
+
_this.api.clearValidateState(ctx.id);
|
|
5475
|
+
});
|
|
5476
|
+
});
|
|
5477
|
+
});
|
|
5478
|
+
}
|
|
5351
5479
|
},
|
|
5352
5480
|
onInput: function onInput(ctx, value) {
|
|
5353
5481
|
var val;
|
|
@@ -5357,24 +5485,24 @@
|
|
|
5357
5485
|
}
|
|
5358
5486
|
},
|
|
5359
5487
|
onUpdateValue: function onUpdateValue(ctx, data) {
|
|
5360
|
-
var
|
|
5488
|
+
var _this2 = this;
|
|
5361
5489
|
|
|
5362
5490
|
this.deferSyncValue(function () {
|
|
5363
5491
|
var group = ctx.getParentGroup();
|
|
5364
|
-
var subForm = group ?
|
|
5492
|
+
var subForm = group ? _this2.subRuleData[group.id] : null;
|
|
5365
5493
|
var subData = {};
|
|
5366
5494
|
Object.keys(data || {}).forEach(function (k) {
|
|
5367
5495
|
if (subForm && hasProperty(subForm, k)) {
|
|
5368
5496
|
subData[k] = data[k];
|
|
5369
|
-
} else if (hasProperty(
|
|
5370
|
-
|
|
5371
|
-
} else if (
|
|
5372
|
-
|
|
5497
|
+
} else if (hasProperty(_this2.api.form, k)) {
|
|
5498
|
+
_this2.api.form[k] = data[k];
|
|
5499
|
+
} else if (_this2.api.top !== _this2.api && hasProperty(_this2.api.top.form, k)) {
|
|
5500
|
+
_this2.api.top.form[k] = data[k];
|
|
5373
5501
|
}
|
|
5374
5502
|
});
|
|
5375
5503
|
|
|
5376
5504
|
if (Object.keys(subData).length) {
|
|
5377
|
-
|
|
5505
|
+
_this2.api.setChildrenFormData(group.rule, subData);
|
|
5378
5506
|
}
|
|
5379
5507
|
});
|
|
5380
5508
|
},
|
|
@@ -5409,7 +5537,7 @@
|
|
|
5409
5537
|
return this.formData[ctx.id];
|
|
5410
5538
|
},
|
|
5411
5539
|
syncForm: function syncForm() {
|
|
5412
|
-
var
|
|
5540
|
+
var _this3 = this;
|
|
5413
5541
|
|
|
5414
5542
|
var data = vue.reactive({});
|
|
5415
5543
|
var fields = this.fields();
|
|
@@ -5418,7 +5546,7 @@
|
|
|
5418
5546
|
if (this.options.appendValue !== false) {
|
|
5419
5547
|
Object.keys(this.appendData).reduce(function (initial, field) {
|
|
5420
5548
|
if (fields.indexOf(field) === -1) {
|
|
5421
|
-
initial[field] = vue.toRef(
|
|
5549
|
+
initial[field] = vue.toRef(_this3.appendData, field);
|
|
5422
5550
|
}
|
|
5423
5551
|
|
|
5424
5552
|
return initial;
|
|
@@ -5426,11 +5554,11 @@
|
|
|
5426
5554
|
}
|
|
5427
5555
|
|
|
5428
5556
|
fields.reduce(function (initial, field) {
|
|
5429
|
-
var ctx = (
|
|
5430
|
-
return !
|
|
5431
|
-
})[0] ||
|
|
5557
|
+
var ctx = (_this3.fieldCtx[field] || []).filter(function (ctx) {
|
|
5558
|
+
return !_this3.isIgnore(ctx.rule);
|
|
5559
|
+
})[0] || _this3.fieldCtx[field][0];
|
|
5432
5560
|
|
|
5433
|
-
if (
|
|
5561
|
+
if (_this3.isIgnore(ctx.rule)) {
|
|
5434
5562
|
ignoreFields.push(field);
|
|
5435
5563
|
}
|
|
5436
5564
|
|
|
@@ -5475,7 +5603,7 @@
|
|
|
5475
5603
|
}
|
|
5476
5604
|
},
|
|
5477
5605
|
syncValue: function syncValue() {
|
|
5478
|
-
var
|
|
5606
|
+
var _this4 = this;
|
|
5479
5607
|
|
|
5480
5608
|
if (this.deferSyncFn) {
|
|
5481
5609
|
return this.deferSyncFn.sync = true;
|
|
@@ -5483,8 +5611,8 @@
|
|
|
5483
5611
|
|
|
5484
5612
|
var data = {};
|
|
5485
5613
|
Object.keys(this.form).forEach(function (k) {
|
|
5486
|
-
if (
|
|
5487
|
-
data[k] =
|
|
5614
|
+
if (_this4.ignoreFields.indexOf(k) === -1) {
|
|
5615
|
+
data[k] = _this4.form[k];
|
|
5488
5616
|
}
|
|
5489
5617
|
});
|
|
5490
5618
|
this.vm.setupState.updateValue(data);
|
|
@@ -5496,11 +5624,11 @@
|
|
|
5496
5624
|
return (is.Object(value) || Array.isArray(value)) && value === ctx.rule.value;
|
|
5497
5625
|
},
|
|
5498
5626
|
refreshUpdate: function refreshUpdate(ctx, val, origin, field) {
|
|
5499
|
-
var
|
|
5627
|
+
var _this5 = this;
|
|
5500
5628
|
|
|
5501
5629
|
if (is.Function(ctx.rule.update)) {
|
|
5502
5630
|
var state = invoke(function () {
|
|
5503
|
-
return ctx.rule.update(val, ctx.origin,
|
|
5631
|
+
return ctx.rule.update(val, ctx.origin, _this5.api, {
|
|
5504
5632
|
origin: origin || 'change',
|
|
5505
5633
|
linkField: field
|
|
5506
5634
|
});
|
|
@@ -5524,18 +5652,18 @@
|
|
|
5524
5652
|
this.refreshUpdate(ctx, val, origin, field);
|
|
5525
5653
|
},
|
|
5526
5654
|
appendLink: function appendLink(ctx) {
|
|
5527
|
-
var
|
|
5655
|
+
var _this6 = this;
|
|
5528
5656
|
|
|
5529
5657
|
var link = ctx.rule.link;
|
|
5530
5658
|
is.trueArray(link) && link.forEach(function (field) {
|
|
5531
5659
|
var fn = function fn() {
|
|
5532
|
-
return
|
|
5660
|
+
return _this6.refreshRule(ctx, ctx.rule.value, 'link', field);
|
|
5533
5661
|
};
|
|
5534
5662
|
|
|
5535
|
-
|
|
5663
|
+
_this6.bus.$on('change-' + field, fn);
|
|
5536
5664
|
|
|
5537
5665
|
ctx.linkOn.push(function () {
|
|
5538
|
-
return
|
|
5666
|
+
return _this6.bus.$off('change-' + field, fn);
|
|
5539
5667
|
});
|
|
5540
5668
|
});
|
|
5541
5669
|
},
|
|
@@ -5928,7 +6056,9 @@
|
|
|
5928
6056
|
return one.handler(_this2.api, ctx.rule);
|
|
5929
6057
|
});
|
|
5930
6058
|
} else {
|
|
5931
|
-
flag =
|
|
6059
|
+
flag = invoke(function () {
|
|
6060
|
+
return new Function('$condition', '$val', '$form', '$group', '$rule', "with($form){with(this){with($group){ return $condition['".concat(one.condition, "'](").concat(field, ", ").concat(compare ? compare : '$val', "); }}}")).call(_this2.api.form, condition, one.value, _this2.api.top.form, group ? _this2.subRuleData[group.id] || {} : {}, ctx.rule);
|
|
6061
|
+
});
|
|
5932
6062
|
}
|
|
5933
6063
|
|
|
5934
6064
|
if (or && flag) {
|
|
@@ -6608,7 +6738,7 @@
|
|
|
6608
6738
|
var loadData = {
|
|
6609
6739
|
name: 'loadData',
|
|
6610
6740
|
_fn: [],
|
|
6611
|
-
|
|
6741
|
+
loaded: function loaded(inject, rule, api) {
|
|
6612
6742
|
this.deleted(inject);
|
|
6613
6743
|
var attrs = toArray(inject.getValue());
|
|
6614
6744
|
var unwatchs = [];
|
|
@@ -6862,7 +6992,7 @@
|
|
|
6862
6992
|
return fetchAttr._fn[inject.id]();
|
|
6863
6993
|
}
|
|
6864
6994
|
|
|
6865
|
-
var _option = fc.$handle.loadFetchVar(deepCopy(option), get);
|
|
6995
|
+
var _option = fc.$handle.loadFetchVar(deepCopy(option), get, rule);
|
|
6866
6996
|
|
|
6867
6997
|
var config = _objectSpread2(_objectSpread2({
|
|
6868
6998
|
headers: {}
|
|
@@ -6925,7 +7055,7 @@
|
|
|
6925
7055
|
var fetchAttr = {
|
|
6926
7056
|
name: 'fetch',
|
|
6927
7057
|
_fn: [],
|
|
6928
|
-
|
|
7058
|
+
loaded: function loaded() {
|
|
6929
7059
|
run.apply(void 0, arguments);
|
|
6930
7060
|
},
|
|
6931
7061
|
watch: function watch() {
|
|
@@ -7010,6 +7140,20 @@
|
|
|
7010
7140
|
return null;
|
|
7011
7141
|
}
|
|
7012
7142
|
|
|
7143
|
+
function getSessionStorage(name) {
|
|
7144
|
+
var value = sessionStorage.getItem(name);
|
|
7145
|
+
|
|
7146
|
+
if (value) {
|
|
7147
|
+
try {
|
|
7148
|
+
return JSON.parse(value);
|
|
7149
|
+
} catch (e) {
|
|
7150
|
+
return value;
|
|
7151
|
+
}
|
|
7152
|
+
}
|
|
7153
|
+
|
|
7154
|
+
return null;
|
|
7155
|
+
}
|
|
7156
|
+
|
|
7013
7157
|
function baseDriver(driver, name) {
|
|
7014
7158
|
if (!name) {
|
|
7015
7159
|
return null;
|
|
@@ -7034,6 +7178,9 @@
|
|
|
7034
7178
|
function localStorageDriver(name) {
|
|
7035
7179
|
return baseDriver(getLocalStorage, name);
|
|
7036
7180
|
}
|
|
7181
|
+
function sessionStorageDriver(name) {
|
|
7182
|
+
return baseDriver(getSessionStorage, name);
|
|
7183
|
+
}
|
|
7037
7184
|
|
|
7038
7185
|
function parseProp(name, id) {
|
|
7039
7186
|
var prop;
|
|
@@ -7086,10 +7233,12 @@
|
|
|
7086
7233
|
var globalConfig = {
|
|
7087
7234
|
global: {}
|
|
7088
7235
|
};
|
|
7089
|
-
var
|
|
7236
|
+
var isMobile = config.isMobile === true;
|
|
7237
|
+
var loadData = vue.reactive({
|
|
7238
|
+
$mobile: isMobile
|
|
7239
|
+
});
|
|
7090
7240
|
var CreateNode = CreateNodeFactory();
|
|
7091
7241
|
var formulas = {};
|
|
7092
|
-
var isMobile = config.isMobile === true;
|
|
7093
7242
|
var prototype = {};
|
|
7094
7243
|
exportAttrs(config.attrs || {});
|
|
7095
7244
|
|
|
@@ -7347,7 +7496,6 @@
|
|
|
7347
7496
|
},
|
|
7348
7497
|
drivers: drivers,
|
|
7349
7498
|
renderDriver: null,
|
|
7350
|
-
get: null,
|
|
7351
7499
|
refreshData: refreshData,
|
|
7352
7500
|
loadData: loadData,
|
|
7353
7501
|
CreateNode: CreateNode,
|
|
@@ -7572,11 +7720,18 @@
|
|
|
7572
7720
|
var handle = is.Function(option) ? option : parseFn(option.handle);
|
|
7573
7721
|
|
|
7574
7722
|
if (handle) {
|
|
7575
|
-
|
|
7576
|
-
|
|
7577
|
-
|
|
7578
|
-
|
|
7579
|
-
|
|
7723
|
+
var val;
|
|
7724
|
+
var unwatch = this.watchLoadData(function (get, flag) {
|
|
7725
|
+
if (flag) {
|
|
7726
|
+
_this5.bus.$emit('$loadData.$var.' + key);
|
|
7727
|
+
|
|
7728
|
+
unwatch();
|
|
7729
|
+
} else {
|
|
7730
|
+
val = handle(get, _this5.$handle.api);
|
|
7731
|
+
}
|
|
7732
|
+
});
|
|
7733
|
+
this.unwatch.push(unwatch);
|
|
7734
|
+
return val;
|
|
7580
7735
|
}
|
|
7581
7736
|
}
|
|
7582
7737
|
},
|
|
@@ -7613,6 +7768,8 @@
|
|
|
7613
7768
|
} else if (key === '$t') {
|
|
7614
7769
|
val = this.globalLanguageDriver(split.join('.'));
|
|
7615
7770
|
split = [];
|
|
7771
|
+
} else if (key === '$preview') {
|
|
7772
|
+
return this.$handle.preview;
|
|
7616
7773
|
} else {
|
|
7617
7774
|
var tmpData = this.vm.setupState.top.setupState.fc.tmpData;
|
|
7618
7775
|
|
|
@@ -7637,32 +7794,31 @@
|
|
|
7637
7794
|
var unwatch = {};
|
|
7638
7795
|
|
|
7639
7796
|
var run = function run(flag) {
|
|
7640
|
-
if (!_this6.get) {
|
|
7641
|
-
_this6.get = get;
|
|
7642
|
-
}
|
|
7643
|
-
|
|
7644
7797
|
invoke(function () {
|
|
7645
7798
|
fn(get, flag);
|
|
7646
7799
|
});
|
|
7647
|
-
|
|
7648
|
-
if (_this6.get === get) {
|
|
7649
|
-
_this6.get = undefined;
|
|
7650
|
-
}
|
|
7651
7800
|
};
|
|
7652
7801
|
|
|
7653
7802
|
var get = function get(id, def) {
|
|
7803
|
+
var getValue;
|
|
7804
|
+
|
|
7805
|
+
if (_typeof(id) === 'object') {
|
|
7806
|
+
getValue = id.getValue;
|
|
7807
|
+
id = id.id;
|
|
7808
|
+
}
|
|
7809
|
+
|
|
7654
7810
|
if (unwatch[id]) {
|
|
7655
7811
|
return unwatch[id].val;
|
|
7656
7812
|
}
|
|
7657
7813
|
|
|
7658
7814
|
var data = vue.computed(function () {
|
|
7659
|
-
return _this6.getLoadData(id, def);
|
|
7815
|
+
return getValue ? getValue() : _this6.getLoadData(id, def);
|
|
7660
7816
|
});
|
|
7661
7817
|
var split = id.split('.');
|
|
7662
7818
|
var key = split.shift();
|
|
7663
7819
|
var key2 = split.shift() || '';
|
|
7664
7820
|
var callback = debounce(function () {
|
|
7665
|
-
var temp = _this6.getLoadData(id, def);
|
|
7821
|
+
var temp = getValue ? getValue() : _this6.getLoadData(id, def);
|
|
7666
7822
|
|
|
7667
7823
|
if (!unwatch[id]) {
|
|
7668
7824
|
return;
|
|
@@ -7856,6 +8012,7 @@
|
|
|
7856
8012
|
useStatic(prototype);
|
|
7857
8013
|
setDataDriver('$cookie', cookieDriver);
|
|
7858
8014
|
setDataDriver('$localStorage', localStorageDriver);
|
|
8015
|
+
setDataDriver('$sessionStorage', sessionStorageDriver);
|
|
7859
8016
|
CreateNode.use({
|
|
7860
8017
|
fragment: 'fcFragment'
|
|
7861
8018
|
});
|
|
@@ -8087,7 +8244,7 @@
|
|
|
8087
8244
|
type: 'primary',
|
|
8088
8245
|
loading: false,
|
|
8089
8246
|
disabled: false,
|
|
8090
|
-
innerText: '
|
|
8247
|
+
innerText: '',
|
|
8091
8248
|
show: true,
|
|
8092
8249
|
col: undefined,
|
|
8093
8250
|
click: undefined
|
|
@@ -8096,7 +8253,7 @@
|
|
|
8096
8253
|
type: 'default',
|
|
8097
8254
|
loading: false,
|
|
8098
8255
|
disabled: false,
|
|
8099
|
-
innerText: '
|
|
8256
|
+
innerText: '',
|
|
8100
8257
|
show: false,
|
|
8101
8258
|
col: undefined,
|
|
8102
8259
|
click: undefined
|
|
@@ -8283,7 +8440,9 @@
|
|
|
8283
8440
|
return !(!title.title && !title["native"] || isFalse(title.show));
|
|
8284
8441
|
},
|
|
8285
8442
|
makeInfo: function makeInfo(rule, uni, ctx) {
|
|
8286
|
-
var
|
|
8443
|
+
var _ctx$refRule,
|
|
8444
|
+
_ctx$refRule2,
|
|
8445
|
+
_this5 = this;
|
|
8287
8446
|
|
|
8288
8447
|
var titleProp = _objectSpread2({}, rule.title);
|
|
8289
8448
|
|
|
@@ -8293,10 +8452,10 @@
|
|
|
8293
8452
|
var form = this.options.form;
|
|
8294
8453
|
var titleSlot = this.getSlot('title');
|
|
8295
8454
|
var children = [titleSlot ? titleSlot({
|
|
8296
|
-
title: ctx.refRule.__$title.value,
|
|
8455
|
+
title: (_ctx$refRule = ctx.refRule) === null || _ctx$refRule === void 0 ? void 0 : _ctx$refRule.__$title.value,
|
|
8297
8456
|
rule: ctx.rule,
|
|
8298
8457
|
options: this.options
|
|
8299
|
-
}) : ctx.refRule.__$title.value + (form.labelSuffix || form['label-suffix'] || '')];
|
|
8458
|
+
}) : ((_ctx$refRule2 = ctx.refRule) === null || _ctx$refRule2 === void 0 ? void 0 : _ctx$refRule2.__$title.value) + (form.labelSuffix || form['label-suffix'] || '')];
|
|
8300
8459
|
|
|
8301
8460
|
if (!isFalse(infoProp.show) && (infoProp.info || infoProp["native"]) && !isFalse(infoProp.icon)) {
|
|
8302
8461
|
var prop = {
|
|
@@ -8312,7 +8471,9 @@
|
|
|
8312
8471
|
var field = 'content';
|
|
8313
8472
|
|
|
8314
8473
|
if (infoProp.info && !hasProperty(prop.props, field)) {
|
|
8315
|
-
|
|
8474
|
+
var _ctx$refRule3;
|
|
8475
|
+
|
|
8476
|
+
prop.props[field] = (_ctx$refRule3 = ctx.refRule) === null || _ctx$refRule3 === void 0 ? void 0 : _ctx$refRule3.__$info.value;
|
|
8316
8477
|
}
|
|
8317
8478
|
|
|
8318
8479
|
children[infoProp.align !== 'left' ? 'unshift' : 'push'](this.$r(mergeProps([infoProp, prop]), _defineProperty({}, titleProp.slot || (isTip ? 'default' : 'reference'), function () {
|
|
@@ -8396,7 +8557,7 @@
|
|
|
8396
8557
|
|
|
8397
8558
|
var resetBtn = _objectSpread2({}, this.options.resetBtn);
|
|
8398
8559
|
|
|
8399
|
-
var innerText = resetBtn.innerText;
|
|
8560
|
+
var innerText = resetBtn.innerText || this.$handle.api.t('reset') || '重置';
|
|
8400
8561
|
delete resetBtn.innerText;
|
|
8401
8562
|
delete resetBtn.click;
|
|
8402
8563
|
delete resetBtn.col;
|
|
@@ -8422,7 +8583,7 @@
|
|
|
8422
8583
|
|
|
8423
8584
|
var submitBtn = _objectSpread2({}, this.options.submitBtn);
|
|
8424
8585
|
|
|
8425
|
-
var innerText = submitBtn.innerText;
|
|
8586
|
+
var innerText = submitBtn.innerText || this.$handle.api.t('submit') || '提交';
|
|
8426
8587
|
delete submitBtn.innerText;
|
|
8427
8588
|
delete submitBtn.click;
|
|
8428
8589
|
delete submitBtn.col;
|
|
@@ -8718,14 +8879,18 @@
|
|
|
8718
8879
|
}
|
|
8719
8880
|
}, val);
|
|
8720
8881
|
|
|
8882
|
+
var title = rule.__fc__.refRule.__$title.value;
|
|
8883
|
+
|
|
8721
8884
|
if (!validate.message) {
|
|
8722
|
-
validate.message =
|
|
8885
|
+
validate.message = api.t('required', {
|
|
8886
|
+
title: title
|
|
8887
|
+
}) || title + (api.getLocale() === 'en' ? ' is required' : '不能为空');
|
|
8723
8888
|
} else {
|
|
8724
8889
|
var match = validate.message.match(/^\{\{\s*\$t\.(.+)\s*\}\}$/);
|
|
8725
8890
|
|
|
8726
8891
|
if (match) {
|
|
8727
8892
|
validate.message = api.t(match[1], {
|
|
8728
|
-
title:
|
|
8893
|
+
title: title
|
|
8729
8894
|
});
|
|
8730
8895
|
}
|
|
8731
8896
|
}
|
|
@@ -8787,7 +8952,7 @@
|
|
|
8787
8952
|
function elmFormCreate() {
|
|
8788
8953
|
return FormCreateFactory({
|
|
8789
8954
|
ui: 'element-ui',
|
|
8790
|
-
version: '3.2.
|
|
8955
|
+
version: '3.2.19',
|
|
8791
8956
|
manager: manager,
|
|
8792
8957
|
extendApi: extendApi,
|
|
8793
8958
|
install: install,
|