@form-create/element-ui 3.2.16 → 3.2.18
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 +149 -87
- package/dist/form-create.esm.min.js +3 -3
- package/dist/form-create.js +148 -86
- package/dist/form-create.min.js +3 -3
- 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.esm.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @form-create/element-ui v3.2.
|
|
3
|
-
* (c) 2018-
|
|
2
|
+
* @form-create/element-ui v3.2.18
|
|
3
|
+
* (c) 2018-2025 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, computed, createVNode, resolveComponent, mergeProps as mergeProps$1, openBlock, createElementBlock, createElementVNode,
|
|
7
|
+
import { defineComponent, toRef, ref, watch, computed, createVNode, resolveComponent, mergeProps as mergeProps$1, openBlock, createElementBlock, createElementVNode, nextTick, markRaw, reactive, getCurrentInstance, provide, inject, toRefs, onBeforeMount, watchEffect, onMounted, onBeforeUnmount, onUpdated, isVNode, withDirectives, resolveDirective, createApp, h } from 'vue';
|
|
8
8
|
|
|
9
9
|
function ownKeys(object, enumerableOnly) {
|
|
10
10
|
var keys = Object.keys(object);
|
|
@@ -198,11 +198,11 @@ function _nonIterableSpread() {
|
|
|
198
198
|
function getSlot(slots, exclude) {
|
|
199
199
|
return Object.keys(slots).reduce(function (lst, name) {
|
|
200
200
|
if (!exclude || exclude.indexOf(name) === -1) {
|
|
201
|
-
lst
|
|
201
|
+
lst[name] = slots[name];
|
|
202
202
|
}
|
|
203
203
|
|
|
204
204
|
return lst;
|
|
205
|
-
},
|
|
205
|
+
}, {});
|
|
206
206
|
}
|
|
207
207
|
|
|
208
208
|
function toArray(value) {
|
|
@@ -548,10 +548,6 @@ function render$2(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
548
548
|
|
|
549
549
|
script$2.render = render$2;
|
|
550
550
|
|
|
551
|
-
function _isSlot(s) {
|
|
552
|
-
return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !isVNode(s);
|
|
553
|
-
}
|
|
554
|
-
|
|
555
551
|
var NAME$7 = 'fcFrame';
|
|
556
552
|
var Frame = defineComponent({
|
|
557
553
|
name: NAME$7,
|
|
@@ -591,11 +587,11 @@ var Frame = defineComponent({
|
|
|
591
587
|
},
|
|
592
588
|
okBtnText: {
|
|
593
589
|
type: String,
|
|
594
|
-
"default": '
|
|
590
|
+
"default": ''
|
|
595
591
|
},
|
|
596
592
|
closeBtnText: {
|
|
597
593
|
type: String,
|
|
598
|
-
"default": '
|
|
594
|
+
"default": ''
|
|
599
595
|
},
|
|
600
596
|
modalTitle: String,
|
|
601
597
|
handleIcon: {
|
|
@@ -929,18 +925,18 @@ var Frame = defineComponent({
|
|
|
929
925
|
"onClick": function onClick() {
|
|
930
926
|
return _this8.onCancel() !== false && (_this8.frameVisible = false);
|
|
931
927
|
}
|
|
932
|
-
},
|
|
928
|
+
}, {
|
|
933
929
|
"default": function _default() {
|
|
934
|
-
return [closeBtnText];
|
|
930
|
+
return [closeBtnText || _this8.formCreateInject.t('close') || '关闭'];
|
|
935
931
|
}
|
|
936
932
|
}) : null, okBtn ? createVNode(resolveComponent("ElButton"), {
|
|
937
933
|
"type": "primary",
|
|
938
934
|
"onClick": function onClick() {
|
|
939
935
|
return _this8.onOk() !== false && _this8.closeModel();
|
|
940
936
|
}
|
|
941
|
-
},
|
|
937
|
+
}, {
|
|
942
938
|
"default": function _default() {
|
|
943
|
-
return [okBtnText];
|
|
939
|
+
return [okBtnText || _this8.formCreateInject.t('ok') || '确定'];
|
|
944
940
|
}
|
|
945
941
|
}) : null]);
|
|
946
942
|
}
|
|
@@ -1412,8 +1408,10 @@ var Upload = defineComponent({
|
|
|
1412
1408
|
props: {
|
|
1413
1409
|
previewMask: undefined,
|
|
1414
1410
|
onPreview: Function,
|
|
1411
|
+
httpRequest: Function,
|
|
1415
1412
|
modalTitle: String,
|
|
1416
1413
|
listType: String,
|
|
1414
|
+
formCreateInject: Object,
|
|
1417
1415
|
modelValue: [Array, String, Object]
|
|
1418
1416
|
},
|
|
1419
1417
|
emits: ['update:modelValue', 'change', 'remove', 'fc.el'],
|
|
@@ -1466,6 +1464,14 @@ var Upload = defineComponent({
|
|
|
1466
1464
|
handleRemove: function handleRemove(file, fileList) {
|
|
1467
1465
|
this.$emit.apply(this, ['remove'].concat(Array.prototype.slice.call(arguments)));
|
|
1468
1466
|
this.update(fileList);
|
|
1467
|
+
},
|
|
1468
|
+
doHttpRequest: function doHttpRequest(option) {
|
|
1469
|
+
if (this.httpRequest) {
|
|
1470
|
+
return this.httpRequest(option);
|
|
1471
|
+
} else {
|
|
1472
|
+
option.source = 'upload';
|
|
1473
|
+
this.formCreateInject.api.fetch(option);
|
|
1474
|
+
}
|
|
1469
1475
|
}
|
|
1470
1476
|
},
|
|
1471
1477
|
render: function render() {
|
|
@@ -1486,6 +1492,7 @@ var Upload = defineComponent({
|
|
|
1486
1492
|
"onPreview": this.handlePreview,
|
|
1487
1493
|
"onChange": this.handleChange,
|
|
1488
1494
|
"onRemove": this.handleRemove,
|
|
1495
|
+
"httpRequest": this.doHttpRequest,
|
|
1489
1496
|
"fileList": this.fileList,
|
|
1490
1497
|
"ref": "upload"
|
|
1491
1498
|
}), _objectSpread2({
|
|
@@ -1498,7 +1505,7 @@ var Upload = defineComponent({
|
|
|
1498
1505
|
"type": "primary"
|
|
1499
1506
|
}, {
|
|
1500
1507
|
"default": function _default() {
|
|
1501
|
-
return [
|
|
1508
|
+
return [_this.formCreateInject.t('clickToUpload') || '点击上传'];
|
|
1502
1509
|
}
|
|
1503
1510
|
}))];
|
|
1504
1511
|
}
|
|
@@ -1776,6 +1783,7 @@ var Group = defineComponent({
|
|
|
1776
1783
|
return;
|
|
1777
1784
|
}
|
|
1778
1785
|
|
|
1786
|
+
this.cacheRule[key].$f && this.cacheRule[key].$f.setValue(value);
|
|
1779
1787
|
this.cache(key, value);
|
|
1780
1788
|
},
|
|
1781
1789
|
addRule: function addRule(i, emit) {
|
|
@@ -2512,7 +2520,7 @@ var mergeFn = function mergeFn(fn1, fn2) {
|
|
|
2512
2520
|
|
|
2513
2521
|
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'];
|
|
2514
2522
|
var arrayAttrs = ['validate', 'children', 'control'];
|
|
2515
|
-
var normalAttrs = ['effect', 'deep'];
|
|
2523
|
+
var normalAttrs = ['effect', 'deep', 'renderSlots'];
|
|
2516
2524
|
function attrs() {
|
|
2517
2525
|
return [].concat(keyAttrs, _toConsumableArray(normalMerge), _toConsumableArray(toArrayMerge), _toConsumableArray(functionalMerge), arrayAttrs, normalAttrs);
|
|
2518
2526
|
}
|
|
@@ -2999,6 +3007,13 @@ function fetch$1(option) {
|
|
|
2999
3007
|
var xhr = new XMLHttpRequest();
|
|
3000
3008
|
var action = option.action || '';
|
|
3001
3009
|
|
|
3010
|
+
if (xhr.upload && option.onProgress) {
|
|
3011
|
+
xhr.upload.addEventListener('progress', function (evt) {
|
|
3012
|
+
evt.percent = evt.total > 0 ? evt.loaded / evt.total * 100 : 0;
|
|
3013
|
+
option.onProgress(evt);
|
|
3014
|
+
});
|
|
3015
|
+
}
|
|
3016
|
+
|
|
3002
3017
|
if (option.query) {
|
|
3003
3018
|
var queryString = new URLSearchParams(option.query).toString();
|
|
3004
3019
|
|
|
@@ -3024,18 +3039,22 @@ function fetch$1(option) {
|
|
|
3024
3039
|
xhr.open(option.method || 'get', action, true);
|
|
3025
3040
|
var formData;
|
|
3026
3041
|
|
|
3027
|
-
if (option.data) {
|
|
3028
|
-
if ((option.dataType || '').toLowerCase() !== 'json') {
|
|
3042
|
+
if (option.data || option.file) {
|
|
3043
|
+
if (option.file || (option.dataType || '').toLowerCase() !== 'json') {
|
|
3029
3044
|
formData = new FormData();
|
|
3030
|
-
Object.keys(option.data).map(function (key) {
|
|
3045
|
+
Object.keys(option.data || {}).map(function (key) {
|
|
3031
3046
|
formData.append(key, option.data[key]);
|
|
3032
3047
|
});
|
|
3033
3048
|
} else {
|
|
3034
|
-
formData = JSON.stringify(option.data);
|
|
3049
|
+
formData = JSON.stringify(option.data || {});
|
|
3035
3050
|
xhr.setRequestHeader('content-type', 'application/json');
|
|
3036
3051
|
}
|
|
3037
3052
|
}
|
|
3038
3053
|
|
|
3054
|
+
if (option.file) {
|
|
3055
|
+
formData.append(option.filename, option.file, option.file.name);
|
|
3056
|
+
}
|
|
3057
|
+
|
|
3039
3058
|
if (option.withCredentials && 'withCredentials' in xhr) {
|
|
3040
3059
|
xhr.withCredentials = true;
|
|
3041
3060
|
}
|
|
@@ -3502,7 +3521,11 @@ function Api(h) {
|
|
|
3502
3521
|
});
|
|
3503
3522
|
});
|
|
3504
3523
|
nextTick(function () {
|
|
3505
|
-
|
|
3524
|
+
nextTick(function () {
|
|
3525
|
+
nextTick(function () {
|
|
3526
|
+
api.clearValidateState(fields);
|
|
3527
|
+
});
|
|
3528
|
+
});
|
|
3506
3529
|
});
|
|
3507
3530
|
|
|
3508
3531
|
if (fields == null) {
|
|
@@ -3896,7 +3919,7 @@ function useRender$1(Render) {
|
|
|
3896
3919
|
if (!this.cacheConfig[ctx.trueType]) {
|
|
3897
3920
|
this.cacheConfig[ctx.trueType] = computed(function () {
|
|
3898
3921
|
var g = _this2.$handle.options.global;
|
|
3899
|
-
return mergeRule({}, [g['*'], g[ctx.originType] || g[ctx.type] || g[ctx.type] || {}]);
|
|
3922
|
+
return mergeRule({}, [g['*'] || g["default"] || {}, g[ctx.originType] || g[ctx.type] || g[ctx.type] || {}]);
|
|
3900
3923
|
});
|
|
3901
3924
|
}
|
|
3902
3925
|
|
|
@@ -3998,6 +4021,14 @@ function useRender$1(Render) {
|
|
|
3998
4021
|
children = _this4.renderChildren(_load, ctx);
|
|
3999
4022
|
}
|
|
4000
4023
|
|
|
4024
|
+
Object.keys(prop.renderSlots || {}).forEach(function (key) {
|
|
4025
|
+
children[key] = function () {
|
|
4026
|
+
var rule = _this4.parseSide(prop.renderSlots[key], ctx);
|
|
4027
|
+
|
|
4028
|
+
return _this4.renderRule(rule);
|
|
4029
|
+
};
|
|
4030
|
+
});
|
|
4031
|
+
|
|
4001
4032
|
var slot = _this4.getTypeSlot(ctx);
|
|
4002
4033
|
|
|
4003
4034
|
var _vn;
|
|
@@ -4119,6 +4150,11 @@ function useRender$1(Render) {
|
|
|
4119
4150
|
field: ctx.field,
|
|
4120
4151
|
rule: ctx.rule,
|
|
4121
4152
|
input: ctx.input,
|
|
4153
|
+
t: function t() {
|
|
4154
|
+
var _this6$$handle$api;
|
|
4155
|
+
|
|
4156
|
+
return (_this6$$handle$api = _this6.$handle.api).t.apply(_this6$$handle$api, arguments);
|
|
4157
|
+
},
|
|
4122
4158
|
updateValue: function updateValue(data) {
|
|
4123
4159
|
_this6.$handle.onUpdateValue(ctx, data);
|
|
4124
4160
|
}
|
|
@@ -4470,24 +4506,16 @@ function useInject(Handler) {
|
|
|
4470
4506
|
return _this4.loadStrVar(str, get);
|
|
4471
4507
|
};
|
|
4472
4508
|
|
|
4473
|
-
options.action = loadVal(options.action);
|
|
4474
|
-
|
|
4475
|
-
|
|
4476
|
-
|
|
4477
|
-
|
|
4478
|
-
|
|
4479
|
-
|
|
4480
|
-
|
|
4481
|
-
|
|
4482
|
-
|
|
4483
|
-
if (options.data) {
|
|
4484
|
-
var _data = {};
|
|
4485
|
-
Object.keys(options.data).forEach(function (k) {
|
|
4486
|
-
_data[loadVal(k)] = loadVal(options.data[k]);
|
|
4487
|
-
});
|
|
4488
|
-
options.data = _data;
|
|
4489
|
-
}
|
|
4490
|
-
|
|
4509
|
+
options.action = loadVal(options.action || '');
|
|
4510
|
+
['headers', 'data', 'query'].forEach(function (key) {
|
|
4511
|
+
if (options[key]) {
|
|
4512
|
+
var data = {};
|
|
4513
|
+
Object.keys(options[key]).forEach(function (k) {
|
|
4514
|
+
data[loadVal(k)] = loadVal(options[key][k]);
|
|
4515
|
+
});
|
|
4516
|
+
options[key] = data;
|
|
4517
|
+
}
|
|
4518
|
+
});
|
|
4491
4519
|
return options;
|
|
4492
4520
|
}
|
|
4493
4521
|
});
|
|
@@ -4756,7 +4784,9 @@ extend(RuleContext.prototype, {
|
|
|
4756
4784
|
parser.init(this);
|
|
4757
4785
|
},
|
|
4758
4786
|
initProp: function initProp() {
|
|
4759
|
-
var _this3 = this
|
|
4787
|
+
var _this3 = this,
|
|
4788
|
+
_this$refRule,
|
|
4789
|
+
_this$refRule$__$vali;
|
|
4760
4790
|
|
|
4761
4791
|
var rule = _objectSpread2({}, this.rule);
|
|
4762
4792
|
|
|
@@ -4765,7 +4795,7 @@ extend(RuleContext.prototype, {
|
|
|
4765
4795
|
this.prop = mergeRule({}, [rule].concat(_toConsumableArray(Object.keys(this.payload).map(function (k) {
|
|
4766
4796
|
return _this3.payload[k];
|
|
4767
4797
|
})), [this.computed]));
|
|
4768
|
-
this.prop.validate = [].concat(_toConsumableArray(this.refRule.__$validate.value || []), _toConsumableArray(this.prop.validate || []));
|
|
4798
|
+
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 || []));
|
|
4769
4799
|
},
|
|
4770
4800
|
initNone: function initNone() {
|
|
4771
4801
|
this.none = !(is.Undef(this.prop.display) || !!this.prop.display);
|
|
@@ -5334,6 +5364,8 @@ function isCtrl(ctx) {
|
|
|
5334
5364
|
function useInput(Handler) {
|
|
5335
5365
|
extend(Handler.prototype, {
|
|
5336
5366
|
setValue: function setValue(ctx, value, formValue, setFlag) {
|
|
5367
|
+
var _this = this;
|
|
5368
|
+
|
|
5337
5369
|
if (ctx.deleted) return;
|
|
5338
5370
|
ctx.rule.value = value;
|
|
5339
5371
|
this.changeStatus = true;
|
|
@@ -5352,6 +5384,16 @@ function useInput(Handler) {
|
|
|
5352
5384
|
api: this.api,
|
|
5353
5385
|
setFlag: setFlag || false
|
|
5354
5386
|
});
|
|
5387
|
+
|
|
5388
|
+
if (setFlag) {
|
|
5389
|
+
nextTick(function () {
|
|
5390
|
+
nextTick(function () {
|
|
5391
|
+
nextTick(function () {
|
|
5392
|
+
_this.api.clearValidateState(ctx.id);
|
|
5393
|
+
});
|
|
5394
|
+
});
|
|
5395
|
+
});
|
|
5396
|
+
}
|
|
5355
5397
|
},
|
|
5356
5398
|
onInput: function onInput(ctx, value) {
|
|
5357
5399
|
var val;
|
|
@@ -5361,24 +5403,24 @@ function useInput(Handler) {
|
|
|
5361
5403
|
}
|
|
5362
5404
|
},
|
|
5363
5405
|
onUpdateValue: function onUpdateValue(ctx, data) {
|
|
5364
|
-
var
|
|
5406
|
+
var _this2 = this;
|
|
5365
5407
|
|
|
5366
5408
|
this.deferSyncValue(function () {
|
|
5367
5409
|
var group = ctx.getParentGroup();
|
|
5368
|
-
var subForm = group ?
|
|
5410
|
+
var subForm = group ? _this2.subRuleData[group.id] : null;
|
|
5369
5411
|
var subData = {};
|
|
5370
5412
|
Object.keys(data || {}).forEach(function (k) {
|
|
5371
5413
|
if (subForm && hasProperty(subForm, k)) {
|
|
5372
5414
|
subData[k] = data[k];
|
|
5373
|
-
} else if (hasProperty(
|
|
5374
|
-
|
|
5375
|
-
} else if (
|
|
5376
|
-
|
|
5415
|
+
} else if (hasProperty(_this2.api.form, k)) {
|
|
5416
|
+
_this2.api.form[k] = data[k];
|
|
5417
|
+
} else if (_this2.api.top !== _this2.api && hasProperty(_this2.api.top.form, k)) {
|
|
5418
|
+
_this2.api.top.form[k] = data[k];
|
|
5377
5419
|
}
|
|
5378
5420
|
});
|
|
5379
5421
|
|
|
5380
5422
|
if (Object.keys(subData).length) {
|
|
5381
|
-
|
|
5423
|
+
_this2.api.setChildrenFormData(group.rule, subData);
|
|
5382
5424
|
}
|
|
5383
5425
|
});
|
|
5384
5426
|
},
|
|
@@ -5413,7 +5455,7 @@ function useInput(Handler) {
|
|
|
5413
5455
|
return this.formData[ctx.id];
|
|
5414
5456
|
},
|
|
5415
5457
|
syncForm: function syncForm() {
|
|
5416
|
-
var
|
|
5458
|
+
var _this3 = this;
|
|
5417
5459
|
|
|
5418
5460
|
var data = reactive({});
|
|
5419
5461
|
var fields = this.fields();
|
|
@@ -5422,7 +5464,7 @@ function useInput(Handler) {
|
|
|
5422
5464
|
if (this.options.appendValue !== false) {
|
|
5423
5465
|
Object.keys(this.appendData).reduce(function (initial, field) {
|
|
5424
5466
|
if (fields.indexOf(field) === -1) {
|
|
5425
|
-
initial[field] = toRef(
|
|
5467
|
+
initial[field] = toRef(_this3.appendData, field);
|
|
5426
5468
|
}
|
|
5427
5469
|
|
|
5428
5470
|
return initial;
|
|
@@ -5430,11 +5472,11 @@ function useInput(Handler) {
|
|
|
5430
5472
|
}
|
|
5431
5473
|
|
|
5432
5474
|
fields.reduce(function (initial, field) {
|
|
5433
|
-
var ctx = (
|
|
5434
|
-
return !
|
|
5435
|
-
})[0] ||
|
|
5475
|
+
var ctx = (_this3.fieldCtx[field] || []).filter(function (ctx) {
|
|
5476
|
+
return !_this3.isIgnore(ctx.rule);
|
|
5477
|
+
})[0] || _this3.fieldCtx[field][0];
|
|
5436
5478
|
|
|
5437
|
-
if (
|
|
5479
|
+
if (_this3.isIgnore(ctx.rule)) {
|
|
5438
5480
|
ignoreFields.push(field);
|
|
5439
5481
|
}
|
|
5440
5482
|
|
|
@@ -5479,7 +5521,7 @@ function useInput(Handler) {
|
|
|
5479
5521
|
}
|
|
5480
5522
|
},
|
|
5481
5523
|
syncValue: function syncValue() {
|
|
5482
|
-
var
|
|
5524
|
+
var _this4 = this;
|
|
5483
5525
|
|
|
5484
5526
|
if (this.deferSyncFn) {
|
|
5485
5527
|
return this.deferSyncFn.sync = true;
|
|
@@ -5487,8 +5529,8 @@ function useInput(Handler) {
|
|
|
5487
5529
|
|
|
5488
5530
|
var data = {};
|
|
5489
5531
|
Object.keys(this.form).forEach(function (k) {
|
|
5490
|
-
if (
|
|
5491
|
-
data[k] =
|
|
5532
|
+
if (_this4.ignoreFields.indexOf(k) === -1) {
|
|
5533
|
+
data[k] = _this4.form[k];
|
|
5492
5534
|
}
|
|
5493
5535
|
});
|
|
5494
5536
|
this.vm.setupState.updateValue(data);
|
|
@@ -5500,11 +5542,11 @@ function useInput(Handler) {
|
|
|
5500
5542
|
return (is.Object(value) || Array.isArray(value)) && value === ctx.rule.value;
|
|
5501
5543
|
},
|
|
5502
5544
|
refreshUpdate: function refreshUpdate(ctx, val, origin, field) {
|
|
5503
|
-
var
|
|
5545
|
+
var _this5 = this;
|
|
5504
5546
|
|
|
5505
5547
|
if (is.Function(ctx.rule.update)) {
|
|
5506
5548
|
var state = invoke(function () {
|
|
5507
|
-
return ctx.rule.update(val, ctx.origin,
|
|
5549
|
+
return ctx.rule.update(val, ctx.origin, _this5.api, {
|
|
5508
5550
|
origin: origin || 'change',
|
|
5509
5551
|
linkField: field
|
|
5510
5552
|
});
|
|
@@ -5528,18 +5570,18 @@ function useInput(Handler) {
|
|
|
5528
5570
|
this.refreshUpdate(ctx, val, origin, field);
|
|
5529
5571
|
},
|
|
5530
5572
|
appendLink: function appendLink(ctx) {
|
|
5531
|
-
var
|
|
5573
|
+
var _this6 = this;
|
|
5532
5574
|
|
|
5533
5575
|
var link = ctx.rule.link;
|
|
5534
5576
|
is.trueArray(link) && link.forEach(function (field) {
|
|
5535
5577
|
var fn = function fn() {
|
|
5536
|
-
return
|
|
5578
|
+
return _this6.refreshRule(ctx, ctx.rule.value, 'link', field);
|
|
5537
5579
|
};
|
|
5538
5580
|
|
|
5539
|
-
|
|
5581
|
+
_this6.bus.$on('change-' + field, fn);
|
|
5540
5582
|
|
|
5541
5583
|
ctx.linkOn.push(function () {
|
|
5542
|
-
return
|
|
5584
|
+
return _this6.bus.$off('change-' + field, fn);
|
|
5543
5585
|
});
|
|
5544
5586
|
});
|
|
5545
5587
|
},
|
|
@@ -6612,7 +6654,7 @@ var loadData = function loadData(fc) {
|
|
|
6612
6654
|
var loadData = {
|
|
6613
6655
|
name: 'loadData',
|
|
6614
6656
|
_fn: [],
|
|
6615
|
-
|
|
6657
|
+
loaded: function loaded(inject, rule, api) {
|
|
6616
6658
|
this.deleted(inject);
|
|
6617
6659
|
var attrs = toArray(inject.getValue());
|
|
6618
6660
|
var unwatchs = [];
|
|
@@ -6623,6 +6665,8 @@ var loadData = function loadData(fc) {
|
|
|
6623
6665
|
|
|
6624
6666
|
if (attr.template) {
|
|
6625
6667
|
value = fc.$handle.loadStrVar(attr.template, get);
|
|
6668
|
+
} else if (attr.handler && is.Function(attr.handler)) {
|
|
6669
|
+
value = attr.handler(get, rule, api);
|
|
6626
6670
|
} else {
|
|
6627
6671
|
value = get(attr.attr, attr["default"]);
|
|
6628
6672
|
}
|
|
@@ -6927,7 +6971,7 @@ var fetch = function fetch(fc) {
|
|
|
6927
6971
|
var fetchAttr = {
|
|
6928
6972
|
name: 'fetch',
|
|
6929
6973
|
_fn: [],
|
|
6930
|
-
|
|
6974
|
+
loaded: function loaded() {
|
|
6931
6975
|
run.apply(void 0, arguments);
|
|
6932
6976
|
},
|
|
6933
6977
|
watch: function watch() {
|
|
@@ -7012,6 +7056,20 @@ function getLocalStorage(name) {
|
|
|
7012
7056
|
return null;
|
|
7013
7057
|
}
|
|
7014
7058
|
|
|
7059
|
+
function getSessionStorage(name) {
|
|
7060
|
+
var value = sessionStorage.getItem(name);
|
|
7061
|
+
|
|
7062
|
+
if (value) {
|
|
7063
|
+
try {
|
|
7064
|
+
return JSON.parse(value);
|
|
7065
|
+
} catch (e) {
|
|
7066
|
+
return value;
|
|
7067
|
+
}
|
|
7068
|
+
}
|
|
7069
|
+
|
|
7070
|
+
return null;
|
|
7071
|
+
}
|
|
7072
|
+
|
|
7015
7073
|
function baseDriver(driver, name) {
|
|
7016
7074
|
if (!name) {
|
|
7017
7075
|
return null;
|
|
@@ -7036,6 +7094,9 @@ function cookieDriver(name) {
|
|
|
7036
7094
|
function localStorageDriver(name) {
|
|
7037
7095
|
return baseDriver(getLocalStorage, name);
|
|
7038
7096
|
}
|
|
7097
|
+
function sessionStorageDriver(name) {
|
|
7098
|
+
return baseDriver(getSessionStorage, name);
|
|
7099
|
+
}
|
|
7039
7100
|
|
|
7040
7101
|
function parseProp(name, id) {
|
|
7041
7102
|
var prop;
|
|
@@ -7436,10 +7497,6 @@ function FormCreateFactory(config) {
|
|
|
7436
7497
|
t: function t(id, params, get) {
|
|
7437
7498
|
var value = get ? get('$t.' + id) : this.globalLanguageDriver(id);
|
|
7438
7499
|
|
|
7439
|
-
if (value == null && this.vm.appContext.config.globalProperties.$i18n) {
|
|
7440
|
-
return this.vm.appContext.config.globalProperties.$i18n.t(id, params);
|
|
7441
|
-
}
|
|
7442
|
-
|
|
7443
7500
|
if (value == null) {
|
|
7444
7501
|
value = '';
|
|
7445
7502
|
}
|
|
@@ -7547,10 +7604,6 @@ function FormCreateFactory(config) {
|
|
|
7547
7604
|
return locale;
|
|
7548
7605
|
}
|
|
7549
7606
|
|
|
7550
|
-
if (this.vm.appContext.config.globalProperties.$i18n && this.vm.appContext.config.globalProperties.$i18n.locale) {
|
|
7551
|
-
return this.vm.appContext.config.globalProperties.$i18n.locale;
|
|
7552
|
-
}
|
|
7553
|
-
|
|
7554
7607
|
return 'zh-cn';
|
|
7555
7608
|
},
|
|
7556
7609
|
globalLanguageDriver: function globalLanguageDriver(id) {
|
|
@@ -7579,7 +7632,7 @@ function FormCreateFactory(config) {
|
|
|
7579
7632
|
var option = this.options.value.globalVariable && this.options.value.globalVariable[key];
|
|
7580
7633
|
|
|
7581
7634
|
if (option) {
|
|
7582
|
-
var handle = is.Function(option) ? option : option.handle;
|
|
7635
|
+
var handle = is.Function(option) ? option : parseFn(option.handle);
|
|
7583
7636
|
|
|
7584
7637
|
if (handle) {
|
|
7585
7638
|
return deepGet(invoke(function () {
|
|
@@ -7866,6 +7919,7 @@ function FormCreateFactory(config) {
|
|
|
7866
7919
|
useStatic(prototype);
|
|
7867
7920
|
setDataDriver('$cookie', cookieDriver);
|
|
7868
7921
|
setDataDriver('$localStorage', localStorageDriver);
|
|
7922
|
+
setDataDriver('$sessionStorage', sessionStorageDriver);
|
|
7869
7923
|
CreateNode.use({
|
|
7870
7924
|
fragment: 'fcFragment'
|
|
7871
7925
|
});
|
|
@@ -8097,7 +8151,7 @@ function getConfig() {
|
|
|
8097
8151
|
type: 'primary',
|
|
8098
8152
|
loading: false,
|
|
8099
8153
|
disabled: false,
|
|
8100
|
-
innerText: '
|
|
8154
|
+
innerText: '',
|
|
8101
8155
|
show: true,
|
|
8102
8156
|
col: undefined,
|
|
8103
8157
|
click: undefined
|
|
@@ -8106,7 +8160,7 @@ function getConfig() {
|
|
|
8106
8160
|
type: 'default',
|
|
8107
8161
|
loading: false,
|
|
8108
8162
|
disabled: false,
|
|
8109
|
-
innerText: '
|
|
8163
|
+
innerText: '',
|
|
8110
8164
|
show: false,
|
|
8111
8165
|
col: undefined,
|
|
8112
8166
|
click: undefined
|
|
@@ -8293,7 +8347,9 @@ var manager = {
|
|
|
8293
8347
|
return !(!title.title && !title["native"] || isFalse(title.show));
|
|
8294
8348
|
},
|
|
8295
8349
|
makeInfo: function makeInfo(rule, uni, ctx) {
|
|
8296
|
-
var
|
|
8350
|
+
var _ctx$refRule,
|
|
8351
|
+
_ctx$refRule2,
|
|
8352
|
+
_this5 = this;
|
|
8297
8353
|
|
|
8298
8354
|
var titleProp = _objectSpread2({}, rule.title);
|
|
8299
8355
|
|
|
@@ -8303,10 +8359,10 @@ var manager = {
|
|
|
8303
8359
|
var form = this.options.form;
|
|
8304
8360
|
var titleSlot = this.getSlot('title');
|
|
8305
8361
|
var children = [titleSlot ? titleSlot({
|
|
8306
|
-
title: ctx.refRule.__$title.value,
|
|
8362
|
+
title: (_ctx$refRule = ctx.refRule) === null || _ctx$refRule === void 0 ? void 0 : _ctx$refRule.__$title.value,
|
|
8307
8363
|
rule: ctx.rule,
|
|
8308
8364
|
options: this.options
|
|
8309
|
-
}) : ctx.refRule.__$title.value + (form.labelSuffix || form['label-suffix'] || '')];
|
|
8365
|
+
}) : ((_ctx$refRule2 = ctx.refRule) === null || _ctx$refRule2 === void 0 ? void 0 : _ctx$refRule2.__$title.value) + (form.labelSuffix || form['label-suffix'] || '')];
|
|
8310
8366
|
|
|
8311
8367
|
if (!isFalse(infoProp.show) && (infoProp.info || infoProp["native"]) && !isFalse(infoProp.icon)) {
|
|
8312
8368
|
var prop = {
|
|
@@ -8322,7 +8378,9 @@ var manager = {
|
|
|
8322
8378
|
var field = 'content';
|
|
8323
8379
|
|
|
8324
8380
|
if (infoProp.info && !hasProperty(prop.props, field)) {
|
|
8325
|
-
|
|
8381
|
+
var _ctx$refRule3;
|
|
8382
|
+
|
|
8383
|
+
prop.props[field] = (_ctx$refRule3 = ctx.refRule) === null || _ctx$refRule3 === void 0 ? void 0 : _ctx$refRule3.__$info.value;
|
|
8326
8384
|
}
|
|
8327
8385
|
|
|
8328
8386
|
children[infoProp.align !== 'left' ? 'unshift' : 'push'](this.$r(mergeProps([infoProp, prop]), _defineProperty({}, titleProp.slot || (isTip ? 'default' : 'reference'), function () {
|
|
@@ -8406,7 +8464,7 @@ var manager = {
|
|
|
8406
8464
|
|
|
8407
8465
|
var resetBtn = _objectSpread2({}, this.options.resetBtn);
|
|
8408
8466
|
|
|
8409
|
-
var innerText = resetBtn.innerText;
|
|
8467
|
+
var innerText = resetBtn.innerText || this.$handle.api.t('reset') || '重置';
|
|
8410
8468
|
delete resetBtn.innerText;
|
|
8411
8469
|
delete resetBtn.click;
|
|
8412
8470
|
delete resetBtn.col;
|
|
@@ -8432,7 +8490,7 @@ var manager = {
|
|
|
8432
8490
|
|
|
8433
8491
|
var submitBtn = _objectSpread2({}, this.options.submitBtn);
|
|
8434
8492
|
|
|
8435
|
-
var innerText = submitBtn.innerText;
|
|
8493
|
+
var innerText = submitBtn.innerText || this.$handle.api.t('submit') || '提交';
|
|
8436
8494
|
delete submitBtn.innerText;
|
|
8437
8495
|
delete submitBtn.click;
|
|
8438
8496
|
delete submitBtn.col;
|
|
@@ -8728,14 +8786,18 @@ var required = {
|
|
|
8728
8786
|
}
|
|
8729
8787
|
}, val);
|
|
8730
8788
|
|
|
8789
|
+
var title = rule.__fc__.refRule.__$title.value;
|
|
8790
|
+
|
|
8731
8791
|
if (!validate.message) {
|
|
8732
|
-
validate.message =
|
|
8792
|
+
validate.message = api.t('required', {
|
|
8793
|
+
title: title
|
|
8794
|
+
}) || title + (api.getLocale() === 'en' ? ' is required' : '不能为空');
|
|
8733
8795
|
} else {
|
|
8734
8796
|
var match = validate.message.match(/^\{\{\s*\$t\.(.+)\s*\}\}$/);
|
|
8735
8797
|
|
|
8736
8798
|
if (match) {
|
|
8737
8799
|
validate.message = api.t(match[1], {
|
|
8738
|
-
title:
|
|
8800
|
+
title: title
|
|
8739
8801
|
});
|
|
8740
8802
|
}
|
|
8741
8803
|
}
|
|
@@ -8797,7 +8859,7 @@ function install(FormCreate) {
|
|
|
8797
8859
|
function elmFormCreate() {
|
|
8798
8860
|
return FormCreateFactory({
|
|
8799
8861
|
ui: 'element-ui',
|
|
8800
|
-
version: '3.2.
|
|
8862
|
+
version: '3.2.18',
|
|
8801
8863
|
manager: manager,
|
|
8802
8864
|
extendApi: extendApi,
|
|
8803
8865
|
install: install,
|