@form-create/element-ui 3.1.21 → 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 +76 -24
- package/dist/form-create.esm.min.js +2 -2
- package/dist/form-create.js +76 -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.esm.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.
|
|
@@ -1961,9 +1961,11 @@ var getRuleInject = function getRuleInject(vm, parent) {
|
|
|
1961
1961
|
}
|
|
1962
1962
|
};
|
|
1963
1963
|
|
|
1964
|
-
function $FormCreate(FormCreate) {
|
|
1964
|
+
function $FormCreate(FormCreate, components, directives) {
|
|
1965
1965
|
return defineComponent({
|
|
1966
1966
|
name: NAME$1,
|
|
1967
|
+
components: components,
|
|
1968
|
+
directives: directives,
|
|
1967
1969
|
props: {
|
|
1968
1970
|
rule: {
|
|
1969
1971
|
type: Array,
|
|
@@ -1988,7 +1990,7 @@ function $FormCreate(FormCreate) {
|
|
|
1988
1990
|
},
|
|
1989
1991
|
inFor: Boolean
|
|
1990
1992
|
},
|
|
1991
|
-
emits: ['update:api', 'update:modelValue', 'mounted', 'submit', 'change', 'emit-event', 'control', 'remove-rule', 'remove-field', 'sync', 'reload', 'repeat-field', 'update'],
|
|
1993
|
+
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'],
|
|
1992
1994
|
render: function render() {
|
|
1993
1995
|
return this.fc.render();
|
|
1994
1996
|
},
|
|
@@ -2957,7 +2959,6 @@ function useCache(Render) {
|
|
|
2957
2959
|
}
|
|
2958
2960
|
|
|
2959
2961
|
if (!this.cache[ctx.id]) {
|
|
2960
|
-
ctx.parent && this.clearCache(ctx.parent);
|
|
2961
2962
|
return;
|
|
2962
2963
|
}
|
|
2963
2964
|
|
|
@@ -2965,9 +2966,7 @@ function useCache(Render) {
|
|
|
2965
2966
|
this.$handle.refresh();
|
|
2966
2967
|
}
|
|
2967
2968
|
|
|
2968
|
-
var parent = this.cache[ctx.id].parent;
|
|
2969
2969
|
this.cache[ctx.id] = null;
|
|
2970
|
-
parent && this.clearCache(parent);
|
|
2971
2970
|
},
|
|
2972
2971
|
clearCacheAll: function clearCacheAll() {
|
|
2973
2972
|
this.cache = {};
|
|
@@ -3035,12 +3034,18 @@ function useRender$1(Render) {
|
|
|
3035
3034
|
initRender: function initRender() {
|
|
3036
3035
|
this.cacheConfig = {};
|
|
3037
3036
|
},
|
|
3038
|
-
getTypeSlot: function getTypeSlot(
|
|
3039
|
-
var name = 'type-' + toLine(type);
|
|
3040
|
-
|
|
3037
|
+
getTypeSlot: function getTypeSlot(ctx) {
|
|
3041
3038
|
var _fn = function _fn(vm) {
|
|
3042
3039
|
if (vm) {
|
|
3043
|
-
var slot =
|
|
3040
|
+
var slot = undefined;
|
|
3041
|
+
|
|
3042
|
+
if (ctx.rule.field) {
|
|
3043
|
+
slot = vm.slots['field-' + toLine(ctx.rule.field)] || vm.slots['field-' + ctx.rule.field];
|
|
3044
|
+
}
|
|
3045
|
+
|
|
3046
|
+
if (!slot) {
|
|
3047
|
+
slot = vm.slots['type-' + toLine(ctx.type)] || vm.slots['type-' + ctx.type];
|
|
3048
|
+
}
|
|
3044
3049
|
|
|
3045
3050
|
if (slot) {
|
|
3046
3051
|
return slot;
|
|
@@ -3118,12 +3123,16 @@ function useRender$1(Render) {
|
|
|
3118
3123
|
deepSet(ctx.prop, str, deep[str]);
|
|
3119
3124
|
});
|
|
3120
3125
|
},
|
|
3121
|
-
parseSide: function parseSide(side) {
|
|
3122
|
-
return is.Object(side) ? mergeRule({
|
|
3126
|
+
parseSide: function parseSide(side, ctx) {
|
|
3127
|
+
return is.Object(side) ? mergeRule({
|
|
3128
|
+
props: {
|
|
3129
|
+
formCreateInject: ctx.prop.props.formCreateInject
|
|
3130
|
+
}
|
|
3131
|
+
}, side) : side;
|
|
3123
3132
|
},
|
|
3124
3133
|
renderSides: function renderSides(vn, ctx, temp) {
|
|
3125
3134
|
var prop = ctx[temp ? 'rule' : 'prop'];
|
|
3126
|
-
return [this.renderRule(this.parseSide(prop.prefix)), vn, this.renderRule(this.parseSide(prop.suffix))];
|
|
3135
|
+
return [this.renderRule(this.parseSide(prop.prefix, ctx)), vn, this.renderRule(this.parseSide(prop.suffix, ctx))];
|
|
3127
3136
|
},
|
|
3128
3137
|
renderId: function renderId(name, type) {
|
|
3129
3138
|
var _this3 = this;
|
|
@@ -3190,7 +3199,7 @@ function useRender$1(Render) {
|
|
|
3190
3199
|
children = _this4.renderChildren(_load, ctx);
|
|
3191
3200
|
}
|
|
3192
3201
|
|
|
3193
|
-
var slot = _this4.getTypeSlot(ctx
|
|
3202
|
+
var slot = _this4.getTypeSlot(ctx);
|
|
3194
3203
|
|
|
3195
3204
|
var _vn;
|
|
3196
3205
|
|
|
@@ -4237,7 +4246,7 @@ function useLoader(Handler) {
|
|
|
4237
4246
|
|
|
4238
4247
|
if (is.Function(r.update)) {
|
|
4239
4248
|
_this6.bus.$once('load-end', function () {
|
|
4240
|
-
_this6.refreshUpdate(ctx, r.value);
|
|
4249
|
+
_this6.refreshUpdate(ctx, r.value, 'init');
|
|
4241
4250
|
});
|
|
4242
4251
|
}
|
|
4243
4252
|
|
|
@@ -4510,12 +4519,14 @@ function useInput(Handler) {
|
|
|
4510
4519
|
isQuote: function isQuote(ctx, value) {
|
|
4511
4520
|
return (is.Object(value) || Array.isArray(value)) && value === ctx.rule.value;
|
|
4512
4521
|
},
|
|
4513
|
-
refreshUpdate: function refreshUpdate(ctx, val) {
|
|
4522
|
+
refreshUpdate: function refreshUpdate(ctx, val, origin) {
|
|
4514
4523
|
var _this2 = this;
|
|
4515
4524
|
|
|
4516
4525
|
if (is.Function(ctx.rule.update)) {
|
|
4517
4526
|
var state = invoke(function () {
|
|
4518
|
-
return ctx.rule.update(val, ctx.origin, _this2.api
|
|
4527
|
+
return ctx.rule.update(val, ctx.origin, _this2.api, {
|
|
4528
|
+
origin: origin || 'change'
|
|
4529
|
+
});
|
|
4519
4530
|
});
|
|
4520
4531
|
if (state === undefined) return;
|
|
4521
4532
|
ctx.rule.hidden = state === true;
|
|
@@ -4525,7 +4536,7 @@ function useInput(Handler) {
|
|
|
4525
4536
|
this.refreshRule(ctx, val);
|
|
4526
4537
|
this.bus.$emit('change-' + ctx.field, val);
|
|
4527
4538
|
},
|
|
4528
|
-
refreshRule: function refreshRule(ctx, val) {
|
|
4539
|
+
refreshRule: function refreshRule(ctx, val, origin) {
|
|
4529
4540
|
if (this.refreshControl(ctx)) {
|
|
4530
4541
|
this.$render.clearCacheAll();
|
|
4531
4542
|
this.loadRule();
|
|
@@ -4533,7 +4544,7 @@ function useInput(Handler) {
|
|
|
4533
4544
|
this.refresh();
|
|
4534
4545
|
}
|
|
4535
4546
|
|
|
4536
|
-
this.refreshUpdate(ctx, val);
|
|
4547
|
+
this.refreshUpdate(ctx, val, origin);
|
|
4537
4548
|
},
|
|
4538
4549
|
appendLink: function appendLink(ctx) {
|
|
4539
4550
|
var _this3 = this;
|
|
@@ -4541,7 +4552,7 @@ function useInput(Handler) {
|
|
|
4541
4552
|
var link = ctx.rule.link;
|
|
4542
4553
|
is.trueArray(link) && link.forEach(function (field) {
|
|
4543
4554
|
var fn = function fn() {
|
|
4544
|
-
return _this3.refreshRule(ctx, ctx.rule.value);
|
|
4555
|
+
return _this3.refreshRule(ctx, ctx.rule.value, 'link');
|
|
4545
4556
|
};
|
|
4546
4557
|
|
|
4547
4558
|
_this3.bus.$on('change-' + field, fn);
|
|
@@ -5360,6 +5371,39 @@ extend(Manager.prototype, {
|
|
|
5360
5371
|
render: function render(children) {}
|
|
5361
5372
|
});
|
|
5362
5373
|
|
|
5374
|
+
var componentValidate = {
|
|
5375
|
+
name: 'componentValidate',
|
|
5376
|
+
load: function load(attr, rule, api) {
|
|
5377
|
+
var method = attr.getValue();
|
|
5378
|
+
|
|
5379
|
+
if (!method) {
|
|
5380
|
+
attr.clearProp();
|
|
5381
|
+
api.clearValidateState([rule.field]);
|
|
5382
|
+
} else {
|
|
5383
|
+
attr.getProp().validate = [{
|
|
5384
|
+
validator: function validator() {
|
|
5385
|
+
var ctx = byCtx(rule);
|
|
5386
|
+
|
|
5387
|
+
if (ctx) {
|
|
5388
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
5389
|
+
args[_key] = arguments[_key];
|
|
5390
|
+
}
|
|
5391
|
+
|
|
5392
|
+
return api.exec.apply(api, [ctx.id, method === true ? 'formCreateValidate' : method].concat(args, [{
|
|
5393
|
+
attr: attr,
|
|
5394
|
+
rule: rule,
|
|
5395
|
+
api: api
|
|
5396
|
+
}]));
|
|
5397
|
+
}
|
|
5398
|
+
}
|
|
5399
|
+
}];
|
|
5400
|
+
}
|
|
5401
|
+
},
|
|
5402
|
+
watch: function watch() {
|
|
5403
|
+
componentValidate.load.apply(componentValidate, arguments);
|
|
5404
|
+
}
|
|
5405
|
+
};
|
|
5406
|
+
|
|
5363
5407
|
var fetch = function fetch(fc) {
|
|
5364
5408
|
function parseOpt(option) {
|
|
5365
5409
|
if (is.String(option)) {
|
|
@@ -5456,7 +5500,8 @@ var fetch = function fetch(fc) {
|
|
|
5456
5500
|
};
|
|
5457
5501
|
|
|
5458
5502
|
var $provider = {
|
|
5459
|
-
fetch: fetch
|
|
5503
|
+
fetch: fetch,
|
|
5504
|
+
componentValidate: componentValidate
|
|
5460
5505
|
};
|
|
5461
5506
|
|
|
5462
5507
|
var name$6 = 'html';
|
|
@@ -5587,7 +5632,7 @@ function FormCreateFactory(config) {
|
|
|
5587
5632
|
}
|
|
5588
5633
|
|
|
5589
5634
|
function $form() {
|
|
5590
|
-
return $FormCreate(FormCreate);
|
|
5635
|
+
return $FormCreate(FormCreate, components, directives);
|
|
5591
5636
|
}
|
|
5592
5637
|
|
|
5593
5638
|
function createFormApp(rule, option) {
|
|
@@ -6487,7 +6532,7 @@ function useFrame(maker) {
|
|
|
6487
6532
|
return maker;
|
|
6488
6533
|
}
|
|
6489
6534
|
|
|
6490
|
-
var css_248z = ".form-create .form-create .el-form-item{margin-bottom:22px}.form-create
|
|
6535
|
+
var css_248z = ".form-create .form-create .el-form-item{margin-bottom:22px}.form-create{width:100%}";
|
|
6491
6536
|
styleInject(css_248z);
|
|
6492
6537
|
|
|
6493
6538
|
function tidyBtnProp(btn, def) {
|
|
@@ -6514,6 +6559,9 @@ function extendApi(api, h) {
|
|
|
6514
6559
|
})["catch"](function (e) {
|
|
6515
6560
|
reject(e);
|
|
6516
6561
|
callback && callback(e);
|
|
6562
|
+
h.vm.emit('validate-fail', e, {
|
|
6563
|
+
api: api
|
|
6564
|
+
});
|
|
6517
6565
|
});
|
|
6518
6566
|
});
|
|
6519
6567
|
},
|
|
@@ -6532,6 +6580,10 @@ function extendApi(api, h) {
|
|
|
6532
6580
|
})["catch"](function (e) {
|
|
6533
6581
|
reject(e);
|
|
6534
6582
|
callback && callback(e);
|
|
6583
|
+
h.vm.emit('validate-field-fail', e, {
|
|
6584
|
+
field: field,
|
|
6585
|
+
api: api
|
|
6586
|
+
});
|
|
6535
6587
|
});
|
|
6536
6588
|
});
|
|
6537
6589
|
},
|
|
@@ -6725,7 +6777,7 @@ function install(FormCreate) {
|
|
|
6725
6777
|
function elmFormCreate() {
|
|
6726
6778
|
return FormCreateFactory({
|
|
6727
6779
|
ui: 'element-ui',
|
|
6728
|
-
version: '3.1.
|
|
6780
|
+
version: '3.1.22',
|
|
6729
6781
|
manager: manager,
|
|
6730
6782
|
extendApi: extendApi,
|
|
6731
6783
|
install: install,
|