@form-create/element-ui 3.1.20 → 3.1.22
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 +78 -24
- package/dist/form-create.esm.min.js +2 -2
- package/dist/form-create.js +78 -24
- package/dist/form-create.min.js +2 -2
- package/package.json +3 -3
- package/src/core/api.js +2 -0
- package/src/style/index.css +0 -4
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.22
|
|
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
|
},
|
|
@@ -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
|
|
|
@@ -3229,6 +3238,8 @@
|
|
|
3229
3238
|
|
|
3230
3239
|
if (cache) {
|
|
3231
3240
|
return cache.apply(void 0, arguments);
|
|
3241
|
+
} else if (_this4.cache[ctx.id]) {
|
|
3242
|
+
return;
|
|
3232
3243
|
}
|
|
3233
3244
|
|
|
3234
3245
|
var _vn = _this4.renderCtx(ctx, ctx.parent);
|
|
@@ -4239,7 +4250,7 @@
|
|
|
4239
4250
|
|
|
4240
4251
|
if (is.Function(r.update)) {
|
|
4241
4252
|
_this6.bus.$once('load-end', function () {
|
|
4242
|
-
_this6.refreshUpdate(ctx, r.value);
|
|
4253
|
+
_this6.refreshUpdate(ctx, r.value, 'init');
|
|
4243
4254
|
});
|
|
4244
4255
|
}
|
|
4245
4256
|
|
|
@@ -4512,12 +4523,14 @@
|
|
|
4512
4523
|
isQuote: function isQuote(ctx, value) {
|
|
4513
4524
|
return (is.Object(value) || Array.isArray(value)) && value === ctx.rule.value;
|
|
4514
4525
|
},
|
|
4515
|
-
refreshUpdate: function refreshUpdate(ctx, val) {
|
|
4526
|
+
refreshUpdate: function refreshUpdate(ctx, val, origin) {
|
|
4516
4527
|
var _this2 = this;
|
|
4517
4528
|
|
|
4518
4529
|
if (is.Function(ctx.rule.update)) {
|
|
4519
4530
|
var state = invoke(function () {
|
|
4520
|
-
return ctx.rule.update(val, ctx.origin, _this2.api
|
|
4531
|
+
return ctx.rule.update(val, ctx.origin, _this2.api, {
|
|
4532
|
+
origin: origin || 'change'
|
|
4533
|
+
});
|
|
4521
4534
|
});
|
|
4522
4535
|
if (state === undefined) return;
|
|
4523
4536
|
ctx.rule.hidden = state === true;
|
|
@@ -4527,7 +4540,7 @@
|
|
|
4527
4540
|
this.refreshRule(ctx, val);
|
|
4528
4541
|
this.bus.$emit('change-' + ctx.field, val);
|
|
4529
4542
|
},
|
|
4530
|
-
refreshRule: function refreshRule(ctx, val) {
|
|
4543
|
+
refreshRule: function refreshRule(ctx, val, origin) {
|
|
4531
4544
|
if (this.refreshControl(ctx)) {
|
|
4532
4545
|
this.$render.clearCacheAll();
|
|
4533
4546
|
this.loadRule();
|
|
@@ -4535,7 +4548,7 @@
|
|
|
4535
4548
|
this.refresh();
|
|
4536
4549
|
}
|
|
4537
4550
|
|
|
4538
|
-
this.refreshUpdate(ctx, val);
|
|
4551
|
+
this.refreshUpdate(ctx, val, origin);
|
|
4539
4552
|
},
|
|
4540
4553
|
appendLink: function appendLink(ctx) {
|
|
4541
4554
|
var _this3 = this;
|
|
@@ -4543,7 +4556,7 @@
|
|
|
4543
4556
|
var link = ctx.rule.link;
|
|
4544
4557
|
is.trueArray(link) && link.forEach(function (field) {
|
|
4545
4558
|
var fn = function fn() {
|
|
4546
|
-
return _this3.refreshRule(ctx, ctx.rule.value);
|
|
4559
|
+
return _this3.refreshRule(ctx, ctx.rule.value, 'link');
|
|
4547
4560
|
};
|
|
4548
4561
|
|
|
4549
4562
|
_this3.bus.$on('change-' + field, fn);
|
|
@@ -5362,6 +5375,39 @@
|
|
|
5362
5375
|
render: function render(children) {}
|
|
5363
5376
|
});
|
|
5364
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
|
+
|
|
5365
5411
|
var fetch = function fetch(fc) {
|
|
5366
5412
|
function parseOpt(option) {
|
|
5367
5413
|
if (is.String(option)) {
|
|
@@ -5458,7 +5504,8 @@
|
|
|
5458
5504
|
};
|
|
5459
5505
|
|
|
5460
5506
|
var $provider = {
|
|
5461
|
-
fetch: fetch
|
|
5507
|
+
fetch: fetch,
|
|
5508
|
+
componentValidate: componentValidate
|
|
5462
5509
|
};
|
|
5463
5510
|
|
|
5464
5511
|
var name$6 = 'html';
|
|
@@ -5589,7 +5636,7 @@
|
|
|
5589
5636
|
}
|
|
5590
5637
|
|
|
5591
5638
|
function $form() {
|
|
5592
|
-
return $FormCreate(FormCreate);
|
|
5639
|
+
return $FormCreate(FormCreate, components, directives);
|
|
5593
5640
|
}
|
|
5594
5641
|
|
|
5595
5642
|
function createFormApp(rule, option) {
|
|
@@ -6489,7 +6536,7 @@
|
|
|
6489
6536
|
return maker;
|
|
6490
6537
|
}
|
|
6491
6538
|
|
|
6492
|
-
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%}";
|
|
6493
6540
|
styleInject(css_248z);
|
|
6494
6541
|
|
|
6495
6542
|
function tidyBtnProp(btn, def) {
|
|
@@ -6516,6 +6563,9 @@
|
|
|
6516
6563
|
})["catch"](function (e) {
|
|
6517
6564
|
reject(e);
|
|
6518
6565
|
callback && callback(e);
|
|
6566
|
+
h.vm.emit('validate-fail', e, {
|
|
6567
|
+
api: api
|
|
6568
|
+
});
|
|
6519
6569
|
});
|
|
6520
6570
|
});
|
|
6521
6571
|
},
|
|
@@ -6534,6 +6584,10 @@
|
|
|
6534
6584
|
})["catch"](function (e) {
|
|
6535
6585
|
reject(e);
|
|
6536
6586
|
callback && callback(e);
|
|
6587
|
+
h.vm.emit('validate-field-fail', e, {
|
|
6588
|
+
field: field,
|
|
6589
|
+
api: api
|
|
6590
|
+
});
|
|
6537
6591
|
});
|
|
6538
6592
|
});
|
|
6539
6593
|
},
|
|
@@ -6727,7 +6781,7 @@
|
|
|
6727
6781
|
function elmFormCreate() {
|
|
6728
6782
|
return FormCreateFactory({
|
|
6729
6783
|
ui: 'element-ui',
|
|
6730
|
-
version: '3.1.
|
|
6784
|
+
version: '3.1.22',
|
|
6731
6785
|
manager: manager,
|
|
6732
6786
|
extendApi: extendApi,
|
|
6733
6787
|
install: install,
|