@form-create/element-ui 3.1.21 → 3.1.23
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 +81 -29
- package/dist/form-create.esm.min.js +2 -2
- package/dist/form-create.js +81 -29
- package/dist/form-create.min.js +2 -2
- package/package.json +11 -11
- package/src/core/api.js +2 -0
- package/src/style/index.css +0 -4
- package/types/config.d.ts +3 -3
package/dist/form-create.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @form-create/element-ui v3.1.
|
|
2
|
+
* @form-create/element-ui v3.1.23
|
|
3
3
|
* (c) 2018-2023 xaboy
|
|
4
4
|
* Github https://github.com/xaboy/form-create
|
|
5
5
|
* Released under the MIT License.
|
|
@@ -1965,9 +1965,11 @@
|
|
|
1965
1965
|
}
|
|
1966
1966
|
};
|
|
1967
1967
|
|
|
1968
|
-
function $FormCreate(FormCreate) {
|
|
1968
|
+
function $FormCreate(FormCreate, components, directives) {
|
|
1969
1969
|
return vue.defineComponent({
|
|
1970
1970
|
name: NAME$1,
|
|
1971
|
+
components: components,
|
|
1972
|
+
directives: directives,
|
|
1971
1973
|
props: {
|
|
1972
1974
|
rule: {
|
|
1973
1975
|
type: Array,
|
|
@@ -1992,7 +1994,7 @@
|
|
|
1992
1994
|
},
|
|
1993
1995
|
inFor: Boolean
|
|
1994
1996
|
},
|
|
1995
|
-
emits: ['update:api', 'update:modelValue', 'mounted', 'submit', 'change', 'emit-event', 'control', 'remove-rule', 'remove-field', 'sync', 'reload', 'repeat-field', 'update'],
|
|
1997
|
+
emits: ['update:api', 'update:modelValue', 'mounted', 'submit', 'change', 'emit-event', 'control', 'remove-rule', 'remove-field', 'sync', 'reload', 'repeat-field', 'update', 'validate-field-fail', 'validate-fail'],
|
|
1996
1998
|
render: function render() {
|
|
1997
1999
|
return this.fc.render();
|
|
1998
2000
|
},
|
|
@@ -2240,7 +2242,7 @@
|
|
|
2240
2242
|
}
|
|
2241
2243
|
|
|
2242
2244
|
function makeFn(fn) {
|
|
2243
|
-
return
|
|
2245
|
+
return new Function('return ' + fn)();
|
|
2244
2246
|
}
|
|
2245
2247
|
|
|
2246
2248
|
function parseFn(fn, mode) {
|
|
@@ -2961,7 +2963,6 @@
|
|
|
2961
2963
|
}
|
|
2962
2964
|
|
|
2963
2965
|
if (!this.cache[ctx.id]) {
|
|
2964
|
-
ctx.parent && this.clearCache(ctx.parent);
|
|
2965
2966
|
return;
|
|
2966
2967
|
}
|
|
2967
2968
|
|
|
@@ -2969,9 +2970,7 @@
|
|
|
2969
2970
|
this.$handle.refresh();
|
|
2970
2971
|
}
|
|
2971
2972
|
|
|
2972
|
-
var parent = this.cache[ctx.id].parent;
|
|
2973
2973
|
this.cache[ctx.id] = null;
|
|
2974
|
-
parent && this.clearCache(parent);
|
|
2975
2974
|
},
|
|
2976
2975
|
clearCacheAll: function clearCacheAll() {
|
|
2977
2976
|
this.cache = {};
|
|
@@ -3039,12 +3038,18 @@
|
|
|
3039
3038
|
initRender: function initRender() {
|
|
3040
3039
|
this.cacheConfig = {};
|
|
3041
3040
|
},
|
|
3042
|
-
getTypeSlot: function getTypeSlot(
|
|
3043
|
-
var name = 'type-' + toLine(type);
|
|
3044
|
-
|
|
3041
|
+
getTypeSlot: function getTypeSlot(ctx) {
|
|
3045
3042
|
var _fn = function _fn(vm) {
|
|
3046
3043
|
if (vm) {
|
|
3047
|
-
var slot =
|
|
3044
|
+
var slot = undefined;
|
|
3045
|
+
|
|
3046
|
+
if (ctx.rule.field) {
|
|
3047
|
+
slot = vm.slots['field-' + toLine(ctx.rule.field)] || vm.slots['field-' + ctx.rule.field];
|
|
3048
|
+
}
|
|
3049
|
+
|
|
3050
|
+
if (!slot) {
|
|
3051
|
+
slot = vm.slots['type-' + toLine(ctx.type)] || vm.slots['type-' + ctx.type];
|
|
3052
|
+
}
|
|
3048
3053
|
|
|
3049
3054
|
if (slot) {
|
|
3050
3055
|
return slot;
|
|
@@ -3122,12 +3127,16 @@
|
|
|
3122
3127
|
deepSet(ctx.prop, str, deep[str]);
|
|
3123
3128
|
});
|
|
3124
3129
|
},
|
|
3125
|
-
parseSide: function parseSide(side) {
|
|
3126
|
-
return is.Object(side) ? mergeRule({
|
|
3130
|
+
parseSide: function parseSide(side, ctx) {
|
|
3131
|
+
return is.Object(side) ? mergeRule({
|
|
3132
|
+
props: {
|
|
3133
|
+
formCreateInject: ctx.prop.props.formCreateInject
|
|
3134
|
+
}
|
|
3135
|
+
}, side) : side;
|
|
3127
3136
|
},
|
|
3128
3137
|
renderSides: function renderSides(vn, ctx, temp) {
|
|
3129
3138
|
var prop = ctx[temp ? 'rule' : 'prop'];
|
|
3130
|
-
return [this.renderRule(this.parseSide(prop.prefix)), vn, this.renderRule(this.parseSide(prop.suffix))];
|
|
3139
|
+
return [this.renderRule(this.parseSide(prop.prefix, ctx)), vn, this.renderRule(this.parseSide(prop.suffix, ctx))];
|
|
3131
3140
|
},
|
|
3132
3141
|
renderId: function renderId(name, type) {
|
|
3133
3142
|
var _this3 = this;
|
|
@@ -3194,7 +3203,7 @@
|
|
|
3194
3203
|
children = _this4.renderChildren(_load, ctx);
|
|
3195
3204
|
}
|
|
3196
3205
|
|
|
3197
|
-
var slot = _this4.getTypeSlot(ctx
|
|
3206
|
+
var slot = _this4.getTypeSlot(ctx);
|
|
3198
3207
|
|
|
3199
3208
|
var _vn;
|
|
3200
3209
|
|
|
@@ -3539,9 +3548,9 @@
|
|
|
3539
3548
|
return event;
|
|
3540
3549
|
},
|
|
3541
3550
|
getInjectData: function getInjectData(self, inject) {
|
|
3542
|
-
var _this$vm = this.vm,
|
|
3543
|
-
option = _this$vm.option,
|
|
3544
|
-
rule = _this$vm.rule;
|
|
3551
|
+
var _this$vm$props = this.vm.props,
|
|
3552
|
+
option = _this$vm$props.option,
|
|
3553
|
+
rule = _this$vm$props.rule;
|
|
3545
3554
|
return {
|
|
3546
3555
|
$f: this.api,
|
|
3547
3556
|
api: this.api,
|
|
@@ -4241,7 +4250,7 @@
|
|
|
4241
4250
|
|
|
4242
4251
|
if (is.Function(r.update)) {
|
|
4243
4252
|
_this6.bus.$once('load-end', function () {
|
|
4244
|
-
_this6.refreshUpdate(ctx, r.value);
|
|
4253
|
+
_this6.refreshUpdate(ctx, r.value, 'init');
|
|
4245
4254
|
});
|
|
4246
4255
|
}
|
|
4247
4256
|
|
|
@@ -4514,12 +4523,14 @@
|
|
|
4514
4523
|
isQuote: function isQuote(ctx, value) {
|
|
4515
4524
|
return (is.Object(value) || Array.isArray(value)) && value === ctx.rule.value;
|
|
4516
4525
|
},
|
|
4517
|
-
refreshUpdate: function refreshUpdate(ctx, val) {
|
|
4526
|
+
refreshUpdate: function refreshUpdate(ctx, val, origin) {
|
|
4518
4527
|
var _this2 = this;
|
|
4519
4528
|
|
|
4520
4529
|
if (is.Function(ctx.rule.update)) {
|
|
4521
4530
|
var state = invoke(function () {
|
|
4522
|
-
return ctx.rule.update(val, ctx.origin, _this2.api
|
|
4531
|
+
return ctx.rule.update(val, ctx.origin, _this2.api, {
|
|
4532
|
+
origin: origin || 'change'
|
|
4533
|
+
});
|
|
4523
4534
|
});
|
|
4524
4535
|
if (state === undefined) return;
|
|
4525
4536
|
ctx.rule.hidden = state === true;
|
|
@@ -4529,7 +4540,7 @@
|
|
|
4529
4540
|
this.refreshRule(ctx, val);
|
|
4530
4541
|
this.bus.$emit('change-' + ctx.field, val);
|
|
4531
4542
|
},
|
|
4532
|
-
refreshRule: function refreshRule(ctx, val) {
|
|
4543
|
+
refreshRule: function refreshRule(ctx, val, origin) {
|
|
4533
4544
|
if (this.refreshControl(ctx)) {
|
|
4534
4545
|
this.$render.clearCacheAll();
|
|
4535
4546
|
this.loadRule();
|
|
@@ -4537,7 +4548,7 @@
|
|
|
4537
4548
|
this.refresh();
|
|
4538
4549
|
}
|
|
4539
4550
|
|
|
4540
|
-
this.refreshUpdate(ctx, val);
|
|
4551
|
+
this.refreshUpdate(ctx, val, origin);
|
|
4541
4552
|
},
|
|
4542
4553
|
appendLink: function appendLink(ctx) {
|
|
4543
4554
|
var _this3 = this;
|
|
@@ -4545,7 +4556,7 @@
|
|
|
4545
4556
|
var link = ctx.rule.link;
|
|
4546
4557
|
is.trueArray(link) && link.forEach(function (field) {
|
|
4547
4558
|
var fn = function fn() {
|
|
4548
|
-
return _this3.refreshRule(ctx, ctx.rule.value);
|
|
4559
|
+
return _this3.refreshRule(ctx, ctx.rule.value, 'link');
|
|
4549
4560
|
};
|
|
4550
4561
|
|
|
4551
4562
|
_this3.bus.$on('change-' + field, fn);
|
|
@@ -5364,6 +5375,39 @@
|
|
|
5364
5375
|
render: function render(children) {}
|
|
5365
5376
|
});
|
|
5366
5377
|
|
|
5378
|
+
var componentValidate = {
|
|
5379
|
+
name: 'componentValidate',
|
|
5380
|
+
load: function load(attr, rule, api) {
|
|
5381
|
+
var method = attr.getValue();
|
|
5382
|
+
|
|
5383
|
+
if (!method) {
|
|
5384
|
+
attr.clearProp();
|
|
5385
|
+
api.clearValidateState([rule.field]);
|
|
5386
|
+
} else {
|
|
5387
|
+
attr.getProp().validate = [{
|
|
5388
|
+
validator: function validator() {
|
|
5389
|
+
var ctx = byCtx(rule);
|
|
5390
|
+
|
|
5391
|
+
if (ctx) {
|
|
5392
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
5393
|
+
args[_key] = arguments[_key];
|
|
5394
|
+
}
|
|
5395
|
+
|
|
5396
|
+
return api.exec.apply(api, [ctx.id, method === true ? 'formCreateValidate' : method].concat(args, [{
|
|
5397
|
+
attr: attr,
|
|
5398
|
+
rule: rule,
|
|
5399
|
+
api: api
|
|
5400
|
+
}]));
|
|
5401
|
+
}
|
|
5402
|
+
}
|
|
5403
|
+
}];
|
|
5404
|
+
}
|
|
5405
|
+
},
|
|
5406
|
+
watch: function watch() {
|
|
5407
|
+
componentValidate.load.apply(componentValidate, arguments);
|
|
5408
|
+
}
|
|
5409
|
+
};
|
|
5410
|
+
|
|
5367
5411
|
var fetch = function fetch(fc) {
|
|
5368
5412
|
function parseOpt(option) {
|
|
5369
5413
|
if (is.String(option)) {
|
|
@@ -5460,7 +5504,8 @@
|
|
|
5460
5504
|
};
|
|
5461
5505
|
|
|
5462
5506
|
var $provider = {
|
|
5463
|
-
fetch: fetch
|
|
5507
|
+
fetch: fetch,
|
|
5508
|
+
componentValidate: componentValidate
|
|
5464
5509
|
};
|
|
5465
5510
|
|
|
5466
5511
|
var name$6 = 'html';
|
|
@@ -5591,7 +5636,7 @@
|
|
|
5591
5636
|
}
|
|
5592
5637
|
|
|
5593
5638
|
function $form() {
|
|
5594
|
-
return $FormCreate(FormCreate);
|
|
5639
|
+
return $FormCreate(FormCreate, components, directives);
|
|
5595
5640
|
}
|
|
5596
5641
|
|
|
5597
5642
|
function createFormApp(rule, option) {
|
|
@@ -5728,7 +5773,7 @@
|
|
|
5728
5773
|
this.$handle.init();
|
|
5729
5774
|
},
|
|
5730
5775
|
isSub: function isSub() {
|
|
5731
|
-
return this.vm.setupState.parent && this.vm.
|
|
5776
|
+
return this.vm.setupState.parent && this.vm.props.extendOption;
|
|
5732
5777
|
},
|
|
5733
5778
|
initOptions: function initOptions(options) {
|
|
5734
5779
|
this.options.value = _objectSpread2({
|
|
@@ -6491,7 +6536,7 @@
|
|
|
6491
6536
|
return maker;
|
|
6492
6537
|
}
|
|
6493
6538
|
|
|
6494
|
-
var css_248z = ".form-create .form-create .el-form-item{margin-bottom:22px}.form-create
|
|
6539
|
+
var css_248z = ".form-create .form-create .el-form-item{margin-bottom:22px}.form-create{width:100%}";
|
|
6495
6540
|
styleInject(css_248z);
|
|
6496
6541
|
|
|
6497
6542
|
function tidyBtnProp(btn, def) {
|
|
@@ -6518,6 +6563,9 @@
|
|
|
6518
6563
|
})["catch"](function (e) {
|
|
6519
6564
|
reject(e);
|
|
6520
6565
|
callback && callback(e);
|
|
6566
|
+
h.vm.emit('validate-fail', e, {
|
|
6567
|
+
api: api
|
|
6568
|
+
});
|
|
6521
6569
|
});
|
|
6522
6570
|
});
|
|
6523
6571
|
},
|
|
@@ -6536,6 +6584,10 @@
|
|
|
6536
6584
|
})["catch"](function (e) {
|
|
6537
6585
|
reject(e);
|
|
6538
6586
|
callback && callback(e);
|
|
6587
|
+
h.vm.emit('validate-field-fail', e, {
|
|
6588
|
+
field: field,
|
|
6589
|
+
api: api
|
|
6590
|
+
});
|
|
6539
6591
|
});
|
|
6540
6592
|
});
|
|
6541
6593
|
},
|
|
@@ -6729,7 +6781,7 @@
|
|
|
6729
6781
|
function elmFormCreate() {
|
|
6730
6782
|
return FormCreateFactory({
|
|
6731
6783
|
ui: 'element-ui',
|
|
6732
|
-
version: '3.1.
|
|
6784
|
+
version: '3.1.23',
|
|
6733
6785
|
manager: manager,
|
|
6734
6786
|
extendApi: extendApi,
|
|
6735
6787
|
install: install,
|