@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.esm.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
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.
|
|
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.coverValue(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,13 +3007,22 @@ 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
|
|
|
3005
|
-
if (
|
|
3006
|
-
action
|
|
3007
|
-
|
|
3008
|
-
|
|
3020
|
+
if (queryString) {
|
|
3021
|
+
if (action.includes('?')) {
|
|
3022
|
+
action += "&".concat(queryString);
|
|
3023
|
+
} else {
|
|
3024
|
+
action += "?".concat(queryString);
|
|
3025
|
+
}
|
|
3009
3026
|
}
|
|
3010
3027
|
}
|
|
3011
3028
|
|
|
@@ -3024,18 +3041,22 @@ function fetch$1(option) {
|
|
|
3024
3041
|
xhr.open(option.method || 'get', action, true);
|
|
3025
3042
|
var formData;
|
|
3026
3043
|
|
|
3027
|
-
if (option.data) {
|
|
3028
|
-
if ((option.dataType || '').toLowerCase() !== 'json') {
|
|
3044
|
+
if (option.data || option.file) {
|
|
3045
|
+
if (option.file || (option.dataType || '').toLowerCase() !== 'json') {
|
|
3029
3046
|
formData = new FormData();
|
|
3030
|
-
Object.keys(option.data).map(function (key) {
|
|
3047
|
+
Object.keys(option.data || {}).map(function (key) {
|
|
3031
3048
|
formData.append(key, option.data[key]);
|
|
3032
3049
|
});
|
|
3033
3050
|
} else {
|
|
3034
|
-
formData = JSON.stringify(option.data);
|
|
3051
|
+
formData = JSON.stringify(option.data || {});
|
|
3035
3052
|
xhr.setRequestHeader('content-type', 'application/json');
|
|
3036
3053
|
}
|
|
3037
3054
|
}
|
|
3038
3055
|
|
|
3056
|
+
if (option.file) {
|
|
3057
|
+
formData.append(option.filename, option.file, option.file.name);
|
|
3058
|
+
}
|
|
3059
|
+
|
|
3039
3060
|
if (option.withCredentials && 'withCredentials' in xhr) {
|
|
3040
3061
|
xhr.withCredentials = true;
|
|
3041
3062
|
}
|
|
@@ -3502,7 +3523,11 @@ function Api(h) {
|
|
|
3502
3523
|
});
|
|
3503
3524
|
});
|
|
3504
3525
|
nextTick(function () {
|
|
3505
|
-
|
|
3526
|
+
nextTick(function () {
|
|
3527
|
+
nextTick(function () {
|
|
3528
|
+
api.clearValidateState(fields);
|
|
3529
|
+
});
|
|
3530
|
+
});
|
|
3506
3531
|
});
|
|
3507
3532
|
|
|
3508
3533
|
if (fields == null) {
|
|
@@ -3645,6 +3670,16 @@ function Api(h) {
|
|
|
3645
3670
|
}
|
|
3646
3671
|
});
|
|
3647
3672
|
},
|
|
3673
|
+
renderRule: function renderRule(id, onInput, force) {
|
|
3674
|
+
var flag = _typeof(id) === 'object';
|
|
3675
|
+
var ctx = flag ? byCtx(id) : h.getCtx(id);
|
|
3676
|
+
return ctx ? h.$render.createRuleVnode(ctx, onInput, force) : undefined;
|
|
3677
|
+
},
|
|
3678
|
+
renderChildren: function renderChildren(id, onInput, force) {
|
|
3679
|
+
var flag = _typeof(id) === 'object';
|
|
3680
|
+
var ctx = flag ? byCtx(id) : h.getCtx(id);
|
|
3681
|
+
return ctx ? h.$render.createChildrenVnodes(ctx, onInput, force) : undefined;
|
|
3682
|
+
},
|
|
3648
3683
|
nextTick: function nextTick(fn) {
|
|
3649
3684
|
h.bus.$once('next-tick', fn);
|
|
3650
3685
|
h.refresh();
|
|
@@ -3896,7 +3931,7 @@ function useRender$1(Render) {
|
|
|
3896
3931
|
if (!this.cacheConfig[ctx.trueType]) {
|
|
3897
3932
|
this.cacheConfig[ctx.trueType] = computed(function () {
|
|
3898
3933
|
var g = _this2.$handle.options.global;
|
|
3899
|
-
return mergeRule({}, [g['*'], g[ctx.originType] || g[ctx.type] || g[ctx.type] || {}]);
|
|
3934
|
+
return mergeRule({}, [g['*'] || g["default"] || {}, g[ctx.originType] || g[ctx.type] || g[ctx.type] || {}]);
|
|
3900
3935
|
});
|
|
3901
3936
|
}
|
|
3902
3937
|
|
|
@@ -3948,7 +3983,7 @@ function useRender$1(Render) {
|
|
|
3948
3983
|
if (ctx.type === 'hidden') return;
|
|
3949
3984
|
var rule = ctx.rule;
|
|
3950
3985
|
|
|
3951
|
-
if (!this.cache[ctx.id] || this.cache[ctx.id].slot !== rule.slot) {
|
|
3986
|
+
if (this.force || !this.cache[ctx.id] || this.cache[ctx.id].slot !== rule.slot) {
|
|
3952
3987
|
var vn;
|
|
3953
3988
|
ctx.initProp();
|
|
3954
3989
|
this.mergeGlobal(ctx);
|
|
@@ -3998,6 +4033,26 @@ function useRender$1(Render) {
|
|
|
3998
4033
|
children = _this4.renderChildren(_load, ctx);
|
|
3999
4034
|
}
|
|
4000
4035
|
|
|
4036
|
+
Object.keys(prop.renderSlots || {}).forEach(function (key) {
|
|
4037
|
+
children[key] = function () {
|
|
4038
|
+
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
4039
|
+
args[_key2] = arguments[_key2];
|
|
4040
|
+
}
|
|
4041
|
+
|
|
4042
|
+
if (is.Function(prop.renderSlots[key])) {
|
|
4043
|
+
return invoke(function () {
|
|
4044
|
+
var _prop$renderSlots;
|
|
4045
|
+
|
|
4046
|
+
return (_prop$renderSlots = prop.renderSlots)[key].apply(_prop$renderSlots, args);
|
|
4047
|
+
});
|
|
4048
|
+
}
|
|
4049
|
+
|
|
4050
|
+
var rule = _this4.parseSide(prop.renderSlots[key], ctx);
|
|
4051
|
+
|
|
4052
|
+
return _this4.renderRule(rule);
|
|
4053
|
+
};
|
|
4054
|
+
});
|
|
4055
|
+
|
|
4001
4056
|
var slot = _this4.getTypeSlot(ctx);
|
|
4002
4057
|
|
|
4003
4058
|
var _vn;
|
|
@@ -4119,6 +4174,11 @@ function useRender$1(Render) {
|
|
|
4119
4174
|
field: ctx.field,
|
|
4120
4175
|
rule: ctx.rule,
|
|
4121
4176
|
input: ctx.input,
|
|
4177
|
+
t: function t() {
|
|
4178
|
+
var _this6$$handle$api;
|
|
4179
|
+
|
|
4180
|
+
return (_this6$$handle$api = _this6.$handle.api).t.apply(_this6$$handle$api, arguments);
|
|
4181
|
+
},
|
|
4122
4182
|
updateValue: function updateValue(data) {
|
|
4123
4183
|
_this6.$handle.onUpdateValue(ctx, data);
|
|
4124
4184
|
}
|
|
@@ -4165,6 +4225,8 @@ function useRender$1(Render) {
|
|
|
4165
4225
|
}];
|
|
4166
4226
|
|
|
4167
4227
|
if (ctx.input) {
|
|
4228
|
+
var tmpInput = this.tmpInput;
|
|
4229
|
+
|
|
4168
4230
|
if (this.vm.props.disabled === true) {
|
|
4169
4231
|
ctx.prop.props.disabled = true;
|
|
4170
4232
|
}
|
|
@@ -4172,6 +4234,8 @@ function useRender$1(Render) {
|
|
|
4172
4234
|
var field = this.getModelField(ctx);
|
|
4173
4235
|
var model = {
|
|
4174
4236
|
callback: function callback(value) {
|
|
4237
|
+
tmpInput && tmpInput(ctx.field, value, ctx.rule);
|
|
4238
|
+
|
|
4175
4239
|
_this7.onInput(ctx, value);
|
|
4176
4240
|
},
|
|
4177
4241
|
modelField: field,
|
|
@@ -4244,6 +4308,23 @@ function useRender$1(Render) {
|
|
|
4244
4308
|
if (this.vNode[ctx.originType]) return this.vNode[ctx.originType](prop, children);
|
|
4245
4309
|
return this.vNode.make(lower(prop.type), prop, children);
|
|
4246
4310
|
},
|
|
4311
|
+
createChildrenVnodes: function createChildrenVnodes(ctx, onInput, force) {
|
|
4312
|
+
this.force = force !== false;
|
|
4313
|
+
this.tmpInput = onInput;
|
|
4314
|
+
var res = this.renderChildren(ctx.rule.children, ctx);
|
|
4315
|
+
this.force = false;
|
|
4316
|
+
this.tmpInput = null;
|
|
4317
|
+
return res;
|
|
4318
|
+
},
|
|
4319
|
+
createRuleVnode: function createRuleVnode(ctx, onInput, force) {
|
|
4320
|
+
this.force = force !== false;
|
|
4321
|
+
this.tmpInput = onInput;
|
|
4322
|
+
var slotBag = makeSlotBag();
|
|
4323
|
+
this.renderSlot(slotBag, ctx, ctx.parent);
|
|
4324
|
+
this.force = false;
|
|
4325
|
+
this.tmpInput = null;
|
|
4326
|
+
return slotBag.getSlots();
|
|
4327
|
+
},
|
|
4247
4328
|
renderRule: function renderRule(rule, children, origin) {
|
|
4248
4329
|
var _this9 = this;
|
|
4249
4330
|
|
|
@@ -4291,6 +4372,8 @@ function Render(handle) {
|
|
|
4291
4372
|
vm: handle.vm,
|
|
4292
4373
|
$manager: handle.$manager,
|
|
4293
4374
|
vNode: new handle.fc.CreateNode(handle.vm),
|
|
4375
|
+
force: false,
|
|
4376
|
+
tmpInput: null,
|
|
4294
4377
|
id: id$1++
|
|
4295
4378
|
});
|
|
4296
4379
|
funcProxy(this, {
|
|
@@ -4437,7 +4520,7 @@ function useInject(Handler) {
|
|
|
4437
4520
|
fn.__json = _fn.__json;
|
|
4438
4521
|
return fn;
|
|
4439
4522
|
},
|
|
4440
|
-
loadStrVar: function loadStrVar(str, get) {
|
|
4523
|
+
loadStrVar: function loadStrVar(str, get, group) {
|
|
4441
4524
|
var _this3 = this;
|
|
4442
4525
|
|
|
4443
4526
|
if (str && typeof str === 'string' && str.indexOf('{{') > -1 && str.indexOf('}}') > -1) {
|
|
@@ -4450,7 +4533,29 @@ function useInject(Handler) {
|
|
|
4450
4533
|
|
|
4451
4534
|
if (field) {
|
|
4452
4535
|
var def = (split[1] || '').trim();
|
|
4453
|
-
var val
|
|
4536
|
+
var val;
|
|
4537
|
+
var flag = false;
|
|
4538
|
+
|
|
4539
|
+
if (group && field.indexOf('$form.') === 0) {
|
|
4540
|
+
var _split = field.split('.');
|
|
4541
|
+
|
|
4542
|
+
_split.shift();
|
|
4543
|
+
|
|
4544
|
+
if (hasProperty(group.value, _split[0])) {
|
|
4545
|
+
flag = true;
|
|
4546
|
+
val = get ? get({
|
|
4547
|
+
id: '$form.' + _split[0] + '_' + group.rule.__fc__.id,
|
|
4548
|
+
getValue: function getValue() {
|
|
4549
|
+
return deepGet(group.value, _split);
|
|
4550
|
+
}
|
|
4551
|
+
}) : deepGet(group.value, _split);
|
|
4552
|
+
}
|
|
4553
|
+
}
|
|
4554
|
+
|
|
4555
|
+
if (!flag) {
|
|
4556
|
+
val = get ? get(field, def) : _this3.fc.getLoadData(field, def);
|
|
4557
|
+
}
|
|
4558
|
+
|
|
4454
4559
|
lastVal = val;
|
|
4455
4560
|
str = str.replaceAll("{{".concat(v, "}}"), val == null ? '' : val);
|
|
4456
4561
|
}
|
|
@@ -4463,11 +4568,20 @@ function useInject(Handler) {
|
|
|
4463
4568
|
|
|
4464
4569
|
return str;
|
|
4465
4570
|
},
|
|
4466
|
-
loadFetchVar: function loadFetchVar(options, get) {
|
|
4571
|
+
loadFetchVar: function loadFetchVar(options, get, rule) {
|
|
4467
4572
|
var _this4 = this;
|
|
4468
4573
|
|
|
4574
|
+
var group;
|
|
4575
|
+
|
|
4576
|
+
if (rule && rule.__fc__) {
|
|
4577
|
+
group = rule.__fc__.getParentGroup();
|
|
4578
|
+
}
|
|
4579
|
+
|
|
4469
4580
|
var loadVal = function loadVal(str) {
|
|
4470
|
-
return _this4.loadStrVar(str, get
|
|
4581
|
+
return _this4.loadStrVar(str, get, group ? {
|
|
4582
|
+
rule: rule,
|
|
4583
|
+
value: _this4.subRuleData[group.id] || {}
|
|
4584
|
+
} : null);
|
|
4471
4585
|
};
|
|
4472
4586
|
|
|
4473
4587
|
options.action = loadVal(options.action || '');
|
|
@@ -4748,7 +4862,9 @@ extend(RuleContext.prototype, {
|
|
|
4748
4862
|
parser.init(this);
|
|
4749
4863
|
},
|
|
4750
4864
|
initProp: function initProp() {
|
|
4751
|
-
var _this3 = this
|
|
4865
|
+
var _this3 = this,
|
|
4866
|
+
_this$refRule,
|
|
4867
|
+
_this$refRule$__$vali;
|
|
4752
4868
|
|
|
4753
4869
|
var rule = _objectSpread2({}, this.rule);
|
|
4754
4870
|
|
|
@@ -4757,7 +4873,7 @@ extend(RuleContext.prototype, {
|
|
|
4757
4873
|
this.prop = mergeRule({}, [rule].concat(_toConsumableArray(Object.keys(this.payload).map(function (k) {
|
|
4758
4874
|
return _this3.payload[k];
|
|
4759
4875
|
})), [this.computed]));
|
|
4760
|
-
this.prop.validate = [].concat(_toConsumableArray(this.refRule.__$validate.value || []), _toConsumableArray(this.prop.validate || []));
|
|
4876
|
+
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
4877
|
},
|
|
4762
4878
|
initNone: function initNone() {
|
|
4763
4879
|
this.none = !(is.Undef(this.prop.display) || !!this.prop.display);
|
|
@@ -5326,6 +5442,8 @@ function isCtrl(ctx) {
|
|
|
5326
5442
|
function useInput(Handler) {
|
|
5327
5443
|
extend(Handler.prototype, {
|
|
5328
5444
|
setValue: function setValue(ctx, value, formValue, setFlag) {
|
|
5445
|
+
var _this = this;
|
|
5446
|
+
|
|
5329
5447
|
if (ctx.deleted) return;
|
|
5330
5448
|
ctx.rule.value = value;
|
|
5331
5449
|
this.changeStatus = true;
|
|
@@ -5344,6 +5462,16 @@ function useInput(Handler) {
|
|
|
5344
5462
|
api: this.api,
|
|
5345
5463
|
setFlag: setFlag || false
|
|
5346
5464
|
});
|
|
5465
|
+
|
|
5466
|
+
if (setFlag) {
|
|
5467
|
+
nextTick(function () {
|
|
5468
|
+
nextTick(function () {
|
|
5469
|
+
nextTick(function () {
|
|
5470
|
+
_this.api.clearValidateState(ctx.id);
|
|
5471
|
+
});
|
|
5472
|
+
});
|
|
5473
|
+
});
|
|
5474
|
+
}
|
|
5347
5475
|
},
|
|
5348
5476
|
onInput: function onInput(ctx, value) {
|
|
5349
5477
|
var val;
|
|
@@ -5353,24 +5481,24 @@ function useInput(Handler) {
|
|
|
5353
5481
|
}
|
|
5354
5482
|
},
|
|
5355
5483
|
onUpdateValue: function onUpdateValue(ctx, data) {
|
|
5356
|
-
var
|
|
5484
|
+
var _this2 = this;
|
|
5357
5485
|
|
|
5358
5486
|
this.deferSyncValue(function () {
|
|
5359
5487
|
var group = ctx.getParentGroup();
|
|
5360
|
-
var subForm = group ?
|
|
5488
|
+
var subForm = group ? _this2.subRuleData[group.id] : null;
|
|
5361
5489
|
var subData = {};
|
|
5362
5490
|
Object.keys(data || {}).forEach(function (k) {
|
|
5363
5491
|
if (subForm && hasProperty(subForm, k)) {
|
|
5364
5492
|
subData[k] = data[k];
|
|
5365
|
-
} else if (hasProperty(
|
|
5366
|
-
|
|
5367
|
-
} else if (
|
|
5368
|
-
|
|
5493
|
+
} else if (hasProperty(_this2.api.form, k)) {
|
|
5494
|
+
_this2.api.form[k] = data[k];
|
|
5495
|
+
} else if (_this2.api.top !== _this2.api && hasProperty(_this2.api.top.form, k)) {
|
|
5496
|
+
_this2.api.top.form[k] = data[k];
|
|
5369
5497
|
}
|
|
5370
5498
|
});
|
|
5371
5499
|
|
|
5372
5500
|
if (Object.keys(subData).length) {
|
|
5373
|
-
|
|
5501
|
+
_this2.api.setChildrenFormData(group.rule, subData);
|
|
5374
5502
|
}
|
|
5375
5503
|
});
|
|
5376
5504
|
},
|
|
@@ -5405,7 +5533,7 @@ function useInput(Handler) {
|
|
|
5405
5533
|
return this.formData[ctx.id];
|
|
5406
5534
|
},
|
|
5407
5535
|
syncForm: function syncForm() {
|
|
5408
|
-
var
|
|
5536
|
+
var _this3 = this;
|
|
5409
5537
|
|
|
5410
5538
|
var data = reactive({});
|
|
5411
5539
|
var fields = this.fields();
|
|
@@ -5414,7 +5542,7 @@ function useInput(Handler) {
|
|
|
5414
5542
|
if (this.options.appendValue !== false) {
|
|
5415
5543
|
Object.keys(this.appendData).reduce(function (initial, field) {
|
|
5416
5544
|
if (fields.indexOf(field) === -1) {
|
|
5417
|
-
initial[field] = toRef(
|
|
5545
|
+
initial[field] = toRef(_this3.appendData, field);
|
|
5418
5546
|
}
|
|
5419
5547
|
|
|
5420
5548
|
return initial;
|
|
@@ -5422,11 +5550,11 @@ function useInput(Handler) {
|
|
|
5422
5550
|
}
|
|
5423
5551
|
|
|
5424
5552
|
fields.reduce(function (initial, field) {
|
|
5425
|
-
var ctx = (
|
|
5426
|
-
return !
|
|
5427
|
-
})[0] ||
|
|
5553
|
+
var ctx = (_this3.fieldCtx[field] || []).filter(function (ctx) {
|
|
5554
|
+
return !_this3.isIgnore(ctx.rule);
|
|
5555
|
+
})[0] || _this3.fieldCtx[field][0];
|
|
5428
5556
|
|
|
5429
|
-
if (
|
|
5557
|
+
if (_this3.isIgnore(ctx.rule)) {
|
|
5430
5558
|
ignoreFields.push(field);
|
|
5431
5559
|
}
|
|
5432
5560
|
|
|
@@ -5471,7 +5599,7 @@ function useInput(Handler) {
|
|
|
5471
5599
|
}
|
|
5472
5600
|
},
|
|
5473
5601
|
syncValue: function syncValue() {
|
|
5474
|
-
var
|
|
5602
|
+
var _this4 = this;
|
|
5475
5603
|
|
|
5476
5604
|
if (this.deferSyncFn) {
|
|
5477
5605
|
return this.deferSyncFn.sync = true;
|
|
@@ -5479,8 +5607,8 @@ function useInput(Handler) {
|
|
|
5479
5607
|
|
|
5480
5608
|
var data = {};
|
|
5481
5609
|
Object.keys(this.form).forEach(function (k) {
|
|
5482
|
-
if (
|
|
5483
|
-
data[k] =
|
|
5610
|
+
if (_this4.ignoreFields.indexOf(k) === -1) {
|
|
5611
|
+
data[k] = _this4.form[k];
|
|
5484
5612
|
}
|
|
5485
5613
|
});
|
|
5486
5614
|
this.vm.setupState.updateValue(data);
|
|
@@ -5492,11 +5620,11 @@ function useInput(Handler) {
|
|
|
5492
5620
|
return (is.Object(value) || Array.isArray(value)) && value === ctx.rule.value;
|
|
5493
5621
|
},
|
|
5494
5622
|
refreshUpdate: function refreshUpdate(ctx, val, origin, field) {
|
|
5495
|
-
var
|
|
5623
|
+
var _this5 = this;
|
|
5496
5624
|
|
|
5497
5625
|
if (is.Function(ctx.rule.update)) {
|
|
5498
5626
|
var state = invoke(function () {
|
|
5499
|
-
return ctx.rule.update(val, ctx.origin,
|
|
5627
|
+
return ctx.rule.update(val, ctx.origin, _this5.api, {
|
|
5500
5628
|
origin: origin || 'change',
|
|
5501
5629
|
linkField: field
|
|
5502
5630
|
});
|
|
@@ -5520,18 +5648,18 @@ function useInput(Handler) {
|
|
|
5520
5648
|
this.refreshUpdate(ctx, val, origin, field);
|
|
5521
5649
|
},
|
|
5522
5650
|
appendLink: function appendLink(ctx) {
|
|
5523
|
-
var
|
|
5651
|
+
var _this6 = this;
|
|
5524
5652
|
|
|
5525
5653
|
var link = ctx.rule.link;
|
|
5526
5654
|
is.trueArray(link) && link.forEach(function (field) {
|
|
5527
5655
|
var fn = function fn() {
|
|
5528
|
-
return
|
|
5656
|
+
return _this6.refreshRule(ctx, ctx.rule.value, 'link', field);
|
|
5529
5657
|
};
|
|
5530
5658
|
|
|
5531
|
-
|
|
5659
|
+
_this6.bus.$on('change-' + field, fn);
|
|
5532
5660
|
|
|
5533
5661
|
ctx.linkOn.push(function () {
|
|
5534
|
-
return
|
|
5662
|
+
return _this6.bus.$off('change-' + field, fn);
|
|
5535
5663
|
});
|
|
5536
5664
|
});
|
|
5537
5665
|
},
|
|
@@ -5924,7 +6052,9 @@ function useContext(Handler) {
|
|
|
5924
6052
|
return one.handler(_this2.api, ctx.rule);
|
|
5925
6053
|
});
|
|
5926
6054
|
} else {
|
|
5927
|
-
flag =
|
|
6055
|
+
flag = invoke(function () {
|
|
6056
|
+
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);
|
|
6057
|
+
});
|
|
5928
6058
|
}
|
|
5929
6059
|
|
|
5930
6060
|
if (or && flag) {
|
|
@@ -6604,7 +6734,7 @@ var loadData = function loadData(fc) {
|
|
|
6604
6734
|
var loadData = {
|
|
6605
6735
|
name: 'loadData',
|
|
6606
6736
|
_fn: [],
|
|
6607
|
-
|
|
6737
|
+
loaded: function loaded(inject, rule, api) {
|
|
6608
6738
|
this.deleted(inject);
|
|
6609
6739
|
var attrs = toArray(inject.getValue());
|
|
6610
6740
|
var unwatchs = [];
|
|
@@ -6858,7 +6988,7 @@ var fetch = function fetch(fc) {
|
|
|
6858
6988
|
return fetchAttr._fn[inject.id]();
|
|
6859
6989
|
}
|
|
6860
6990
|
|
|
6861
|
-
var _option = fc.$handle.loadFetchVar(deepCopy(option), get);
|
|
6991
|
+
var _option = fc.$handle.loadFetchVar(deepCopy(option), get, rule);
|
|
6862
6992
|
|
|
6863
6993
|
var config = _objectSpread2(_objectSpread2({
|
|
6864
6994
|
headers: {}
|
|
@@ -6921,7 +7051,7 @@ var fetch = function fetch(fc) {
|
|
|
6921
7051
|
var fetchAttr = {
|
|
6922
7052
|
name: 'fetch',
|
|
6923
7053
|
_fn: [],
|
|
6924
|
-
|
|
7054
|
+
loaded: function loaded() {
|
|
6925
7055
|
run.apply(void 0, arguments);
|
|
6926
7056
|
},
|
|
6927
7057
|
watch: function watch() {
|
|
@@ -7006,6 +7136,20 @@ function getLocalStorage(name) {
|
|
|
7006
7136
|
return null;
|
|
7007
7137
|
}
|
|
7008
7138
|
|
|
7139
|
+
function getSessionStorage(name) {
|
|
7140
|
+
var value = sessionStorage.getItem(name);
|
|
7141
|
+
|
|
7142
|
+
if (value) {
|
|
7143
|
+
try {
|
|
7144
|
+
return JSON.parse(value);
|
|
7145
|
+
} catch (e) {
|
|
7146
|
+
return value;
|
|
7147
|
+
}
|
|
7148
|
+
}
|
|
7149
|
+
|
|
7150
|
+
return null;
|
|
7151
|
+
}
|
|
7152
|
+
|
|
7009
7153
|
function baseDriver(driver, name) {
|
|
7010
7154
|
if (!name) {
|
|
7011
7155
|
return null;
|
|
@@ -7030,6 +7174,9 @@ function cookieDriver(name) {
|
|
|
7030
7174
|
function localStorageDriver(name) {
|
|
7031
7175
|
return baseDriver(getLocalStorage, name);
|
|
7032
7176
|
}
|
|
7177
|
+
function sessionStorageDriver(name) {
|
|
7178
|
+
return baseDriver(getSessionStorage, name);
|
|
7179
|
+
}
|
|
7033
7180
|
|
|
7034
7181
|
function parseProp(name, id) {
|
|
7035
7182
|
var prop;
|
|
@@ -7082,10 +7229,12 @@ function FormCreateFactory(config) {
|
|
|
7082
7229
|
var globalConfig = {
|
|
7083
7230
|
global: {}
|
|
7084
7231
|
};
|
|
7085
|
-
var
|
|
7232
|
+
var isMobile = config.isMobile === true;
|
|
7233
|
+
var loadData = reactive({
|
|
7234
|
+
$mobile: isMobile
|
|
7235
|
+
});
|
|
7086
7236
|
var CreateNode = CreateNodeFactory();
|
|
7087
7237
|
var formulas = {};
|
|
7088
|
-
var isMobile = config.isMobile === true;
|
|
7089
7238
|
var prototype = {};
|
|
7090
7239
|
exportAttrs(config.attrs || {});
|
|
7091
7240
|
|
|
@@ -7343,7 +7492,6 @@ function FormCreateFactory(config) {
|
|
|
7343
7492
|
},
|
|
7344
7493
|
drivers: drivers,
|
|
7345
7494
|
renderDriver: null,
|
|
7346
|
-
get: null,
|
|
7347
7495
|
refreshData: refreshData,
|
|
7348
7496
|
loadData: loadData,
|
|
7349
7497
|
CreateNode: CreateNode,
|
|
@@ -7568,11 +7716,18 @@ function FormCreateFactory(config) {
|
|
|
7568
7716
|
var handle = is.Function(option) ? option : parseFn(option.handle);
|
|
7569
7717
|
|
|
7570
7718
|
if (handle) {
|
|
7571
|
-
|
|
7572
|
-
|
|
7573
|
-
|
|
7574
|
-
|
|
7575
|
-
|
|
7719
|
+
var val;
|
|
7720
|
+
var unwatch = this.watchLoadData(function (get, flag) {
|
|
7721
|
+
if (flag) {
|
|
7722
|
+
_this5.bus.$emit('$loadData.$var.' + key);
|
|
7723
|
+
|
|
7724
|
+
unwatch();
|
|
7725
|
+
} else {
|
|
7726
|
+
val = handle(get, _this5.$handle.api);
|
|
7727
|
+
}
|
|
7728
|
+
});
|
|
7729
|
+
this.unwatch.push(unwatch);
|
|
7730
|
+
return val;
|
|
7576
7731
|
}
|
|
7577
7732
|
}
|
|
7578
7733
|
},
|
|
@@ -7609,6 +7764,8 @@ function FormCreateFactory(config) {
|
|
|
7609
7764
|
} else if (key === '$t') {
|
|
7610
7765
|
val = this.globalLanguageDriver(split.join('.'));
|
|
7611
7766
|
split = [];
|
|
7767
|
+
} else if (key === '$preview') {
|
|
7768
|
+
return this.$handle.preview;
|
|
7612
7769
|
} else {
|
|
7613
7770
|
var tmpData = this.vm.setupState.top.setupState.fc.tmpData;
|
|
7614
7771
|
|
|
@@ -7633,32 +7790,31 @@ function FormCreateFactory(config) {
|
|
|
7633
7790
|
var unwatch = {};
|
|
7634
7791
|
|
|
7635
7792
|
var run = function run(flag) {
|
|
7636
|
-
if (!_this6.get) {
|
|
7637
|
-
_this6.get = get;
|
|
7638
|
-
}
|
|
7639
|
-
|
|
7640
7793
|
invoke(function () {
|
|
7641
7794
|
fn(get, flag);
|
|
7642
7795
|
});
|
|
7643
|
-
|
|
7644
|
-
if (_this6.get === get) {
|
|
7645
|
-
_this6.get = undefined;
|
|
7646
|
-
}
|
|
7647
7796
|
};
|
|
7648
7797
|
|
|
7649
7798
|
var get = function get(id, def) {
|
|
7799
|
+
var getValue;
|
|
7800
|
+
|
|
7801
|
+
if (_typeof(id) === 'object') {
|
|
7802
|
+
getValue = id.getValue;
|
|
7803
|
+
id = id.id;
|
|
7804
|
+
}
|
|
7805
|
+
|
|
7650
7806
|
if (unwatch[id]) {
|
|
7651
7807
|
return unwatch[id].val;
|
|
7652
7808
|
}
|
|
7653
7809
|
|
|
7654
7810
|
var data = computed(function () {
|
|
7655
|
-
return _this6.getLoadData(id, def);
|
|
7811
|
+
return getValue ? getValue() : _this6.getLoadData(id, def);
|
|
7656
7812
|
});
|
|
7657
7813
|
var split = id.split('.');
|
|
7658
7814
|
var key = split.shift();
|
|
7659
7815
|
var key2 = split.shift() || '';
|
|
7660
7816
|
var callback = debounce(function () {
|
|
7661
|
-
var temp = _this6.getLoadData(id, def);
|
|
7817
|
+
var temp = getValue ? getValue() : _this6.getLoadData(id, def);
|
|
7662
7818
|
|
|
7663
7819
|
if (!unwatch[id]) {
|
|
7664
7820
|
return;
|
|
@@ -7852,6 +8008,7 @@ function FormCreateFactory(config) {
|
|
|
7852
8008
|
useStatic(prototype);
|
|
7853
8009
|
setDataDriver('$cookie', cookieDriver);
|
|
7854
8010
|
setDataDriver('$localStorage', localStorageDriver);
|
|
8011
|
+
setDataDriver('$sessionStorage', sessionStorageDriver);
|
|
7855
8012
|
CreateNode.use({
|
|
7856
8013
|
fragment: 'fcFragment'
|
|
7857
8014
|
});
|
|
@@ -8083,7 +8240,7 @@ function getConfig() {
|
|
|
8083
8240
|
type: 'primary',
|
|
8084
8241
|
loading: false,
|
|
8085
8242
|
disabled: false,
|
|
8086
|
-
innerText: '
|
|
8243
|
+
innerText: '',
|
|
8087
8244
|
show: true,
|
|
8088
8245
|
col: undefined,
|
|
8089
8246
|
click: undefined
|
|
@@ -8092,7 +8249,7 @@ function getConfig() {
|
|
|
8092
8249
|
type: 'default',
|
|
8093
8250
|
loading: false,
|
|
8094
8251
|
disabled: false,
|
|
8095
|
-
innerText: '
|
|
8252
|
+
innerText: '',
|
|
8096
8253
|
show: false,
|
|
8097
8254
|
col: undefined,
|
|
8098
8255
|
click: undefined
|
|
@@ -8279,7 +8436,9 @@ var manager = {
|
|
|
8279
8436
|
return !(!title.title && !title["native"] || isFalse(title.show));
|
|
8280
8437
|
},
|
|
8281
8438
|
makeInfo: function makeInfo(rule, uni, ctx) {
|
|
8282
|
-
var
|
|
8439
|
+
var _ctx$refRule,
|
|
8440
|
+
_ctx$refRule2,
|
|
8441
|
+
_this5 = this;
|
|
8283
8442
|
|
|
8284
8443
|
var titleProp = _objectSpread2({}, rule.title);
|
|
8285
8444
|
|
|
@@ -8289,10 +8448,10 @@ var manager = {
|
|
|
8289
8448
|
var form = this.options.form;
|
|
8290
8449
|
var titleSlot = this.getSlot('title');
|
|
8291
8450
|
var children = [titleSlot ? titleSlot({
|
|
8292
|
-
title: ctx.refRule.__$title.value,
|
|
8451
|
+
title: (_ctx$refRule = ctx.refRule) === null || _ctx$refRule === void 0 ? void 0 : _ctx$refRule.__$title.value,
|
|
8293
8452
|
rule: ctx.rule,
|
|
8294
8453
|
options: this.options
|
|
8295
|
-
}) : ctx.refRule.__$title.value + (form.labelSuffix || form['label-suffix'] || '')];
|
|
8454
|
+
}) : ((_ctx$refRule2 = ctx.refRule) === null || _ctx$refRule2 === void 0 ? void 0 : _ctx$refRule2.__$title.value) + (form.labelSuffix || form['label-suffix'] || '')];
|
|
8296
8455
|
|
|
8297
8456
|
if (!isFalse(infoProp.show) && (infoProp.info || infoProp["native"]) && !isFalse(infoProp.icon)) {
|
|
8298
8457
|
var prop = {
|
|
@@ -8308,7 +8467,9 @@ var manager = {
|
|
|
8308
8467
|
var field = 'content';
|
|
8309
8468
|
|
|
8310
8469
|
if (infoProp.info && !hasProperty(prop.props, field)) {
|
|
8311
|
-
|
|
8470
|
+
var _ctx$refRule3;
|
|
8471
|
+
|
|
8472
|
+
prop.props[field] = (_ctx$refRule3 = ctx.refRule) === null || _ctx$refRule3 === void 0 ? void 0 : _ctx$refRule3.__$info.value;
|
|
8312
8473
|
}
|
|
8313
8474
|
|
|
8314
8475
|
children[infoProp.align !== 'left' ? 'unshift' : 'push'](this.$r(mergeProps([infoProp, prop]), _defineProperty({}, titleProp.slot || (isTip ? 'default' : 'reference'), function () {
|
|
@@ -8392,7 +8553,7 @@ var manager = {
|
|
|
8392
8553
|
|
|
8393
8554
|
var resetBtn = _objectSpread2({}, this.options.resetBtn);
|
|
8394
8555
|
|
|
8395
|
-
var innerText = resetBtn.innerText;
|
|
8556
|
+
var innerText = resetBtn.innerText || this.$handle.api.t('reset') || '重置';
|
|
8396
8557
|
delete resetBtn.innerText;
|
|
8397
8558
|
delete resetBtn.click;
|
|
8398
8559
|
delete resetBtn.col;
|
|
@@ -8418,7 +8579,7 @@ var manager = {
|
|
|
8418
8579
|
|
|
8419
8580
|
var submitBtn = _objectSpread2({}, this.options.submitBtn);
|
|
8420
8581
|
|
|
8421
|
-
var innerText = submitBtn.innerText;
|
|
8582
|
+
var innerText = submitBtn.innerText || this.$handle.api.t('submit') || '提交';
|
|
8422
8583
|
delete submitBtn.innerText;
|
|
8423
8584
|
delete submitBtn.click;
|
|
8424
8585
|
delete submitBtn.col;
|
|
@@ -8714,14 +8875,18 @@ var required = {
|
|
|
8714
8875
|
}
|
|
8715
8876
|
}, val);
|
|
8716
8877
|
|
|
8878
|
+
var title = rule.__fc__.refRule.__$title.value;
|
|
8879
|
+
|
|
8717
8880
|
if (!validate.message) {
|
|
8718
|
-
validate.message =
|
|
8881
|
+
validate.message = api.t('required', {
|
|
8882
|
+
title: title
|
|
8883
|
+
}) || title + (api.getLocale() === 'en' ? ' is required' : '不能为空');
|
|
8719
8884
|
} else {
|
|
8720
8885
|
var match = validate.message.match(/^\{\{\s*\$t\.(.+)\s*\}\}$/);
|
|
8721
8886
|
|
|
8722
8887
|
if (match) {
|
|
8723
8888
|
validate.message = api.t(match[1], {
|
|
8724
|
-
title:
|
|
8889
|
+
title: title
|
|
8725
8890
|
});
|
|
8726
8891
|
}
|
|
8727
8892
|
}
|
|
@@ -8783,7 +8948,7 @@ function install(FormCreate) {
|
|
|
8783
8948
|
function elmFormCreate() {
|
|
8784
8949
|
return FormCreateFactory({
|
|
8785
8950
|
ui: 'element-ui',
|
|
8786
|
-
version: '3.2.
|
|
8951
|
+
version: '3.2.19',
|
|
8787
8952
|
manager: manager,
|
|
8788
8953
|
extendApi: extendApi,
|
|
8789
8954
|
install: install,
|