@form-create/element-ui 3.2.17 → 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 +135 -59
- package/dist/form-create.esm.min.js +2 -2
- package/dist/form-create.js +134 -58
- 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.esm.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @form-create/element-ui v3.2.
|
|
2
|
+
* @form-create/element-ui v3.2.18
|
|
3
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
|
}
|
|
@@ -4748,7 +4784,9 @@ extend(RuleContext.prototype, {
|
|
|
4748
4784
|
parser.init(this);
|
|
4749
4785
|
},
|
|
4750
4786
|
initProp: function initProp() {
|
|
4751
|
-
var _this3 = this
|
|
4787
|
+
var _this3 = this,
|
|
4788
|
+
_this$refRule,
|
|
4789
|
+
_this$refRule$__$vali;
|
|
4752
4790
|
|
|
4753
4791
|
var rule = _objectSpread2({}, this.rule);
|
|
4754
4792
|
|
|
@@ -4757,7 +4795,7 @@ extend(RuleContext.prototype, {
|
|
|
4757
4795
|
this.prop = mergeRule({}, [rule].concat(_toConsumableArray(Object.keys(this.payload).map(function (k) {
|
|
4758
4796
|
return _this3.payload[k];
|
|
4759
4797
|
})), [this.computed]));
|
|
4760
|
-
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 || []));
|
|
4761
4799
|
},
|
|
4762
4800
|
initNone: function initNone() {
|
|
4763
4801
|
this.none = !(is.Undef(this.prop.display) || !!this.prop.display);
|
|
@@ -5326,6 +5364,8 @@ function isCtrl(ctx) {
|
|
|
5326
5364
|
function useInput(Handler) {
|
|
5327
5365
|
extend(Handler.prototype, {
|
|
5328
5366
|
setValue: function setValue(ctx, value, formValue, setFlag) {
|
|
5367
|
+
var _this = this;
|
|
5368
|
+
|
|
5329
5369
|
if (ctx.deleted) return;
|
|
5330
5370
|
ctx.rule.value = value;
|
|
5331
5371
|
this.changeStatus = true;
|
|
@@ -5344,6 +5384,16 @@ function useInput(Handler) {
|
|
|
5344
5384
|
api: this.api,
|
|
5345
5385
|
setFlag: setFlag || false
|
|
5346
5386
|
});
|
|
5387
|
+
|
|
5388
|
+
if (setFlag) {
|
|
5389
|
+
nextTick(function () {
|
|
5390
|
+
nextTick(function () {
|
|
5391
|
+
nextTick(function () {
|
|
5392
|
+
_this.api.clearValidateState(ctx.id);
|
|
5393
|
+
});
|
|
5394
|
+
});
|
|
5395
|
+
});
|
|
5396
|
+
}
|
|
5347
5397
|
},
|
|
5348
5398
|
onInput: function onInput(ctx, value) {
|
|
5349
5399
|
var val;
|
|
@@ -5353,24 +5403,24 @@ function useInput(Handler) {
|
|
|
5353
5403
|
}
|
|
5354
5404
|
},
|
|
5355
5405
|
onUpdateValue: function onUpdateValue(ctx, data) {
|
|
5356
|
-
var
|
|
5406
|
+
var _this2 = this;
|
|
5357
5407
|
|
|
5358
5408
|
this.deferSyncValue(function () {
|
|
5359
5409
|
var group = ctx.getParentGroup();
|
|
5360
|
-
var subForm = group ?
|
|
5410
|
+
var subForm = group ? _this2.subRuleData[group.id] : null;
|
|
5361
5411
|
var subData = {};
|
|
5362
5412
|
Object.keys(data || {}).forEach(function (k) {
|
|
5363
5413
|
if (subForm && hasProperty(subForm, k)) {
|
|
5364
5414
|
subData[k] = data[k];
|
|
5365
|
-
} else if (hasProperty(
|
|
5366
|
-
|
|
5367
|
-
} else if (
|
|
5368
|
-
|
|
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];
|
|
5369
5419
|
}
|
|
5370
5420
|
});
|
|
5371
5421
|
|
|
5372
5422
|
if (Object.keys(subData).length) {
|
|
5373
|
-
|
|
5423
|
+
_this2.api.setChildrenFormData(group.rule, subData);
|
|
5374
5424
|
}
|
|
5375
5425
|
});
|
|
5376
5426
|
},
|
|
@@ -5405,7 +5455,7 @@ function useInput(Handler) {
|
|
|
5405
5455
|
return this.formData[ctx.id];
|
|
5406
5456
|
},
|
|
5407
5457
|
syncForm: function syncForm() {
|
|
5408
|
-
var
|
|
5458
|
+
var _this3 = this;
|
|
5409
5459
|
|
|
5410
5460
|
var data = reactive({});
|
|
5411
5461
|
var fields = this.fields();
|
|
@@ -5414,7 +5464,7 @@ function useInput(Handler) {
|
|
|
5414
5464
|
if (this.options.appendValue !== false) {
|
|
5415
5465
|
Object.keys(this.appendData).reduce(function (initial, field) {
|
|
5416
5466
|
if (fields.indexOf(field) === -1) {
|
|
5417
|
-
initial[field] = toRef(
|
|
5467
|
+
initial[field] = toRef(_this3.appendData, field);
|
|
5418
5468
|
}
|
|
5419
5469
|
|
|
5420
5470
|
return initial;
|
|
@@ -5422,11 +5472,11 @@ function useInput(Handler) {
|
|
|
5422
5472
|
}
|
|
5423
5473
|
|
|
5424
5474
|
fields.reduce(function (initial, field) {
|
|
5425
|
-
var ctx = (
|
|
5426
|
-
return !
|
|
5427
|
-
})[0] ||
|
|
5475
|
+
var ctx = (_this3.fieldCtx[field] || []).filter(function (ctx) {
|
|
5476
|
+
return !_this3.isIgnore(ctx.rule);
|
|
5477
|
+
})[0] || _this3.fieldCtx[field][0];
|
|
5428
5478
|
|
|
5429
|
-
if (
|
|
5479
|
+
if (_this3.isIgnore(ctx.rule)) {
|
|
5430
5480
|
ignoreFields.push(field);
|
|
5431
5481
|
}
|
|
5432
5482
|
|
|
@@ -5471,7 +5521,7 @@ function useInput(Handler) {
|
|
|
5471
5521
|
}
|
|
5472
5522
|
},
|
|
5473
5523
|
syncValue: function syncValue() {
|
|
5474
|
-
var
|
|
5524
|
+
var _this4 = this;
|
|
5475
5525
|
|
|
5476
5526
|
if (this.deferSyncFn) {
|
|
5477
5527
|
return this.deferSyncFn.sync = true;
|
|
@@ -5479,8 +5529,8 @@ function useInput(Handler) {
|
|
|
5479
5529
|
|
|
5480
5530
|
var data = {};
|
|
5481
5531
|
Object.keys(this.form).forEach(function (k) {
|
|
5482
|
-
if (
|
|
5483
|
-
data[k] =
|
|
5532
|
+
if (_this4.ignoreFields.indexOf(k) === -1) {
|
|
5533
|
+
data[k] = _this4.form[k];
|
|
5484
5534
|
}
|
|
5485
5535
|
});
|
|
5486
5536
|
this.vm.setupState.updateValue(data);
|
|
@@ -5492,11 +5542,11 @@ function useInput(Handler) {
|
|
|
5492
5542
|
return (is.Object(value) || Array.isArray(value)) && value === ctx.rule.value;
|
|
5493
5543
|
},
|
|
5494
5544
|
refreshUpdate: function refreshUpdate(ctx, val, origin, field) {
|
|
5495
|
-
var
|
|
5545
|
+
var _this5 = this;
|
|
5496
5546
|
|
|
5497
5547
|
if (is.Function(ctx.rule.update)) {
|
|
5498
5548
|
var state = invoke(function () {
|
|
5499
|
-
return ctx.rule.update(val, ctx.origin,
|
|
5549
|
+
return ctx.rule.update(val, ctx.origin, _this5.api, {
|
|
5500
5550
|
origin: origin || 'change',
|
|
5501
5551
|
linkField: field
|
|
5502
5552
|
});
|
|
@@ -5520,18 +5570,18 @@ function useInput(Handler) {
|
|
|
5520
5570
|
this.refreshUpdate(ctx, val, origin, field);
|
|
5521
5571
|
},
|
|
5522
5572
|
appendLink: function appendLink(ctx) {
|
|
5523
|
-
var
|
|
5573
|
+
var _this6 = this;
|
|
5524
5574
|
|
|
5525
5575
|
var link = ctx.rule.link;
|
|
5526
5576
|
is.trueArray(link) && link.forEach(function (field) {
|
|
5527
5577
|
var fn = function fn() {
|
|
5528
|
-
return
|
|
5578
|
+
return _this6.refreshRule(ctx, ctx.rule.value, 'link', field);
|
|
5529
5579
|
};
|
|
5530
5580
|
|
|
5531
|
-
|
|
5581
|
+
_this6.bus.$on('change-' + field, fn);
|
|
5532
5582
|
|
|
5533
5583
|
ctx.linkOn.push(function () {
|
|
5534
|
-
return
|
|
5584
|
+
return _this6.bus.$off('change-' + field, fn);
|
|
5535
5585
|
});
|
|
5536
5586
|
});
|
|
5537
5587
|
},
|
|
@@ -6604,7 +6654,7 @@ var loadData = function loadData(fc) {
|
|
|
6604
6654
|
var loadData = {
|
|
6605
6655
|
name: 'loadData',
|
|
6606
6656
|
_fn: [],
|
|
6607
|
-
|
|
6657
|
+
loaded: function loaded(inject, rule, api) {
|
|
6608
6658
|
this.deleted(inject);
|
|
6609
6659
|
var attrs = toArray(inject.getValue());
|
|
6610
6660
|
var unwatchs = [];
|
|
@@ -6921,7 +6971,7 @@ var fetch = function fetch(fc) {
|
|
|
6921
6971
|
var fetchAttr = {
|
|
6922
6972
|
name: 'fetch',
|
|
6923
6973
|
_fn: [],
|
|
6924
|
-
|
|
6974
|
+
loaded: function loaded() {
|
|
6925
6975
|
run.apply(void 0, arguments);
|
|
6926
6976
|
},
|
|
6927
6977
|
watch: function watch() {
|
|
@@ -7006,6 +7056,20 @@ function getLocalStorage(name) {
|
|
|
7006
7056
|
return null;
|
|
7007
7057
|
}
|
|
7008
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
|
+
|
|
7009
7073
|
function baseDriver(driver, name) {
|
|
7010
7074
|
if (!name) {
|
|
7011
7075
|
return null;
|
|
@@ -7030,6 +7094,9 @@ function cookieDriver(name) {
|
|
|
7030
7094
|
function localStorageDriver(name) {
|
|
7031
7095
|
return baseDriver(getLocalStorage, name);
|
|
7032
7096
|
}
|
|
7097
|
+
function sessionStorageDriver(name) {
|
|
7098
|
+
return baseDriver(getSessionStorage, name);
|
|
7099
|
+
}
|
|
7033
7100
|
|
|
7034
7101
|
function parseProp(name, id) {
|
|
7035
7102
|
var prop;
|
|
@@ -7852,6 +7919,7 @@ function FormCreateFactory(config) {
|
|
|
7852
7919
|
useStatic(prototype);
|
|
7853
7920
|
setDataDriver('$cookie', cookieDriver);
|
|
7854
7921
|
setDataDriver('$localStorage', localStorageDriver);
|
|
7922
|
+
setDataDriver('$sessionStorage', sessionStorageDriver);
|
|
7855
7923
|
CreateNode.use({
|
|
7856
7924
|
fragment: 'fcFragment'
|
|
7857
7925
|
});
|
|
@@ -8083,7 +8151,7 @@ function getConfig() {
|
|
|
8083
8151
|
type: 'primary',
|
|
8084
8152
|
loading: false,
|
|
8085
8153
|
disabled: false,
|
|
8086
|
-
innerText: '
|
|
8154
|
+
innerText: '',
|
|
8087
8155
|
show: true,
|
|
8088
8156
|
col: undefined,
|
|
8089
8157
|
click: undefined
|
|
@@ -8092,7 +8160,7 @@ function getConfig() {
|
|
|
8092
8160
|
type: 'default',
|
|
8093
8161
|
loading: false,
|
|
8094
8162
|
disabled: false,
|
|
8095
|
-
innerText: '
|
|
8163
|
+
innerText: '',
|
|
8096
8164
|
show: false,
|
|
8097
8165
|
col: undefined,
|
|
8098
8166
|
click: undefined
|
|
@@ -8279,7 +8347,9 @@ var manager = {
|
|
|
8279
8347
|
return !(!title.title && !title["native"] || isFalse(title.show));
|
|
8280
8348
|
},
|
|
8281
8349
|
makeInfo: function makeInfo(rule, uni, ctx) {
|
|
8282
|
-
var
|
|
8350
|
+
var _ctx$refRule,
|
|
8351
|
+
_ctx$refRule2,
|
|
8352
|
+
_this5 = this;
|
|
8283
8353
|
|
|
8284
8354
|
var titleProp = _objectSpread2({}, rule.title);
|
|
8285
8355
|
|
|
@@ -8289,10 +8359,10 @@ var manager = {
|
|
|
8289
8359
|
var form = this.options.form;
|
|
8290
8360
|
var titleSlot = this.getSlot('title');
|
|
8291
8361
|
var children = [titleSlot ? titleSlot({
|
|
8292
|
-
title: ctx.refRule.__$title.value,
|
|
8362
|
+
title: (_ctx$refRule = ctx.refRule) === null || _ctx$refRule === void 0 ? void 0 : _ctx$refRule.__$title.value,
|
|
8293
8363
|
rule: ctx.rule,
|
|
8294
8364
|
options: this.options
|
|
8295
|
-
}) : 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'] || '')];
|
|
8296
8366
|
|
|
8297
8367
|
if (!isFalse(infoProp.show) && (infoProp.info || infoProp["native"]) && !isFalse(infoProp.icon)) {
|
|
8298
8368
|
var prop = {
|
|
@@ -8308,7 +8378,9 @@ var manager = {
|
|
|
8308
8378
|
var field = 'content';
|
|
8309
8379
|
|
|
8310
8380
|
if (infoProp.info && !hasProperty(prop.props, field)) {
|
|
8311
|
-
|
|
8381
|
+
var _ctx$refRule3;
|
|
8382
|
+
|
|
8383
|
+
prop.props[field] = (_ctx$refRule3 = ctx.refRule) === null || _ctx$refRule3 === void 0 ? void 0 : _ctx$refRule3.__$info.value;
|
|
8312
8384
|
}
|
|
8313
8385
|
|
|
8314
8386
|
children[infoProp.align !== 'left' ? 'unshift' : 'push'](this.$r(mergeProps([infoProp, prop]), _defineProperty({}, titleProp.slot || (isTip ? 'default' : 'reference'), function () {
|
|
@@ -8392,7 +8464,7 @@ var manager = {
|
|
|
8392
8464
|
|
|
8393
8465
|
var resetBtn = _objectSpread2({}, this.options.resetBtn);
|
|
8394
8466
|
|
|
8395
|
-
var innerText = resetBtn.innerText;
|
|
8467
|
+
var innerText = resetBtn.innerText || this.$handle.api.t('reset') || '重置';
|
|
8396
8468
|
delete resetBtn.innerText;
|
|
8397
8469
|
delete resetBtn.click;
|
|
8398
8470
|
delete resetBtn.col;
|
|
@@ -8418,7 +8490,7 @@ var manager = {
|
|
|
8418
8490
|
|
|
8419
8491
|
var submitBtn = _objectSpread2({}, this.options.submitBtn);
|
|
8420
8492
|
|
|
8421
|
-
var innerText = submitBtn.innerText;
|
|
8493
|
+
var innerText = submitBtn.innerText || this.$handle.api.t('submit') || '提交';
|
|
8422
8494
|
delete submitBtn.innerText;
|
|
8423
8495
|
delete submitBtn.click;
|
|
8424
8496
|
delete submitBtn.col;
|
|
@@ -8714,14 +8786,18 @@ var required = {
|
|
|
8714
8786
|
}
|
|
8715
8787
|
}, val);
|
|
8716
8788
|
|
|
8789
|
+
var title = rule.__fc__.refRule.__$title.value;
|
|
8790
|
+
|
|
8717
8791
|
if (!validate.message) {
|
|
8718
|
-
validate.message =
|
|
8792
|
+
validate.message = api.t('required', {
|
|
8793
|
+
title: title
|
|
8794
|
+
}) || title + (api.getLocale() === 'en' ? ' is required' : '不能为空');
|
|
8719
8795
|
} else {
|
|
8720
8796
|
var match = validate.message.match(/^\{\{\s*\$t\.(.+)\s*\}\}$/);
|
|
8721
8797
|
|
|
8722
8798
|
if (match) {
|
|
8723
8799
|
validate.message = api.t(match[1], {
|
|
8724
|
-
title:
|
|
8800
|
+
title: title
|
|
8725
8801
|
});
|
|
8726
8802
|
}
|
|
8727
8803
|
}
|
|
@@ -8783,7 +8859,7 @@ function install(FormCreate) {
|
|
|
8783
8859
|
function elmFormCreate() {
|
|
8784
8860
|
return FormCreateFactory({
|
|
8785
8861
|
ui: 'element-ui',
|
|
8786
|
-
version: '3.2.
|
|
8862
|
+
version: '3.2.18',
|
|
8787
8863
|
manager: manager,
|
|
8788
8864
|
extendApi: extendApi,
|
|
8789
8865
|
install: install,
|