@form-create/element-ui 2.5.33 → 2.5.35
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.js +60 -24
- package/dist/form-create.min.js +3 -3
- package/dist/form-create.min.js.map +1 -1
- package/package.json +11 -11
- package/src/core/manager.js +6 -4
package/dist/form-create.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @form-create/element-ui v2.5.
|
|
3
|
-
* (c) 2018-
|
|
2
|
+
* @form-create/element-ui v2.5.35
|
|
3
|
+
* (c) 2018-2024 xaboy
|
|
4
4
|
* Github https://github.com/xaboy/form-create
|
|
5
5
|
* Released under the MIT License.
|
|
6
6
|
*/
|
|
@@ -1505,6 +1505,7 @@
|
|
|
1505
1505
|
for (var i = len; i < 0; i++) {
|
|
1506
1506
|
this.addRule(n.length + i);
|
|
1507
1507
|
}
|
|
1508
|
+
this.sort = Object.keys(this.cacheRule);
|
|
1508
1509
|
for (var _i = 0; _i < total; _i++) {
|
|
1509
1510
|
this.setValue(keys[_i], n[_i]);
|
|
1510
1511
|
}
|
|
@@ -1513,6 +1514,7 @@
|
|
|
1513
1514
|
for (var _i2 = 0; _i2 < len; _i2++) {
|
|
1514
1515
|
this.removeRule(keys[total - _i2 - 1]);
|
|
1515
1516
|
}
|
|
1517
|
+
this.sort = Object.keys(this.cacheRule);
|
|
1516
1518
|
}
|
|
1517
1519
|
n.forEach(function (val, i) {
|
|
1518
1520
|
_this2.setValue(keys[i], n[i]);
|
|
@@ -1933,6 +1935,7 @@
|
|
|
1933
1935
|
}
|
|
1934
1936
|
},
|
|
1935
1937
|
extendOption: Boolean,
|
|
1938
|
+
disabled: Boolean,
|
|
1936
1939
|
value: Object,
|
|
1937
1940
|
api: Object,
|
|
1938
1941
|
name: String,
|
|
@@ -1981,8 +1984,8 @@
|
|
|
1981
1984
|
deep: true
|
|
1982
1985
|
},
|
|
1983
1986
|
option: {
|
|
1984
|
-
handler: function handler(
|
|
1985
|
-
this.formCreate.initOptions(
|
|
1987
|
+
handler: function handler() {
|
|
1988
|
+
this.formCreate.initOptions();
|
|
1986
1989
|
this.$f.refresh();
|
|
1987
1990
|
},
|
|
1988
1991
|
deep: true
|
|
@@ -1994,14 +1997,14 @@
|
|
|
1994
1997
|
})) return;
|
|
1995
1998
|
this.formCreate.$handle.reloadRule(n);
|
|
1996
1999
|
this._renderRule();
|
|
2000
|
+
},
|
|
2001
|
+
disabled: function disabled(n) {
|
|
2002
|
+
this.$f.disabled(!!n);
|
|
1997
2003
|
}
|
|
1998
2004
|
},
|
|
1999
2005
|
beforeCreate: function beforeCreate() {
|
|
2000
2006
|
var _this2 = this;
|
|
2001
|
-
|
|
2002
|
-
rule = _this$$options$propsD.rule,
|
|
2003
|
-
option = _this$$options$propsD.option;
|
|
2004
|
-
this.formCreate = new FormCreate(this, rule, option);
|
|
2007
|
+
this.formCreate = new FormCreate(this);
|
|
2005
2008
|
Object.keys(this.formCreate.prop).forEach(function (k) {
|
|
2006
2009
|
extend(_this2.$options[k], _this2.formCreate.prop[k]);
|
|
2007
2010
|
});
|
|
@@ -2374,6 +2377,12 @@
|
|
|
2374
2377
|
get parent() {
|
|
2375
2378
|
return h.vm.$pfc && h.vm.$pfc.$f;
|
|
2376
2379
|
},
|
|
2380
|
+
get top() {
|
|
2381
|
+
if (api.parent) {
|
|
2382
|
+
return api.parent.top;
|
|
2383
|
+
}
|
|
2384
|
+
return api;
|
|
2385
|
+
},
|
|
2377
2386
|
get children() {
|
|
2378
2387
|
return allSubForm();
|
|
2379
2388
|
},
|
|
@@ -2793,7 +2802,8 @@
|
|
|
2793
2802
|
|
|
2794
2803
|
var id = 0;
|
|
2795
2804
|
function uniqueId() {
|
|
2796
|
-
|
|
2805
|
+
var num = 370 + ++id;
|
|
2806
|
+
return 'F' + Math.random().toString(36).substr(3, 3) + Number("".concat(Date.now())).toString(36) + num.toString(36) + 'c';
|
|
2797
2807
|
}
|
|
2798
2808
|
|
|
2799
2809
|
function deepSet(data, idx, val) {
|
|
@@ -4771,6 +4781,19 @@
|
|
|
4771
4781
|
form: function form() {
|
|
4772
4782
|
return this.vm.$refs[this.ref];
|
|
4773
4783
|
},
|
|
4784
|
+
getSlot: function getSlot(name) {
|
|
4785
|
+
var _fn = function _fn(vm) {
|
|
4786
|
+
if (vm) {
|
|
4787
|
+
var slot = vm.$scopedSlots[name];
|
|
4788
|
+
if (slot) {
|
|
4789
|
+
return slot;
|
|
4790
|
+
}
|
|
4791
|
+
return _fn(vm.$pfc);
|
|
4792
|
+
}
|
|
4793
|
+
return undefined;
|
|
4794
|
+
};
|
|
4795
|
+
return _fn(this.vm);
|
|
4796
|
+
},
|
|
4774
4797
|
mergeOptions: function mergeOptions(args, opt) {
|
|
4775
4798
|
var _this2 = this;
|
|
4776
4799
|
return mergeProps(args.map(function (v) {
|
|
@@ -5130,11 +5153,12 @@
|
|
|
5130
5153
|
}
|
|
5131
5154
|
function parser() {
|
|
5132
5155
|
var data = nameProp.apply(void 0, arguments);
|
|
5133
|
-
if (!data.id || !data.prop) return;
|
|
5156
|
+
if (!data.id || !data.prop) return BaseParser;
|
|
5134
5157
|
var name = toCase(data.id);
|
|
5135
5158
|
var parser = data.prop;
|
|
5136
5159
|
var base = parser.merge === true ? parsers[name] : undefined;
|
|
5137
|
-
parsers[name] =
|
|
5160
|
+
parsers[name] = parser;
|
|
5161
|
+
Object.setPrototypeOf(parser, base || BaseParser);
|
|
5138
5162
|
maker[name] = creatorFactory(name);
|
|
5139
5163
|
parser.maker && extend(maker, parser.maker);
|
|
5140
5164
|
}
|
|
@@ -5153,6 +5177,8 @@
|
|
|
5153
5177
|
}
|
|
5154
5178
|
if (!name || !component) return;
|
|
5155
5179
|
components[name] = component;
|
|
5180
|
+
delete CreateNode.aliasMap[name];
|
|
5181
|
+
delete parsers[name];
|
|
5156
5182
|
if (component.formCreateParser) parser(name, component.formCreateParser);
|
|
5157
5183
|
}
|
|
5158
5184
|
function _emitData(id) {
|
|
@@ -5204,7 +5230,8 @@
|
|
|
5204
5230
|
}
|
|
5205
5231
|
return FormCreateFactory(_config);
|
|
5206
5232
|
}
|
|
5207
|
-
function FormCreate(vm
|
|
5233
|
+
function FormCreate(vm) {
|
|
5234
|
+
var rules = vm.$options.propsData.rule;
|
|
5208
5235
|
extend(this, {
|
|
5209
5236
|
id: id$1++,
|
|
5210
5237
|
vm: vm,
|
|
@@ -5223,13 +5250,13 @@
|
|
|
5223
5250
|
CreateNode: CreateNode,
|
|
5224
5251
|
bus: new _vue(),
|
|
5225
5252
|
unwatch: null,
|
|
5226
|
-
options:
|
|
5253
|
+
options: {},
|
|
5227
5254
|
extendApi: config.extendApi || function (api) {
|
|
5228
5255
|
return api;
|
|
5229
5256
|
}
|
|
5230
5257
|
});
|
|
5231
5258
|
this.init();
|
|
5232
|
-
this.initOptions(
|
|
5259
|
+
this.initOptions();
|
|
5233
5260
|
if (this.name) {
|
|
5234
5261
|
if (this.inFor) {
|
|
5235
5262
|
if (!instance[this.name]) instance[this.name] = [];
|
|
@@ -5252,14 +5279,15 @@
|
|
|
5252
5279
|
_this2.unwatch = vm.$watch(function () {
|
|
5253
5280
|
return vm.$pfc.option;
|
|
5254
5281
|
}, function () {
|
|
5255
|
-
_this2.initOptions(
|
|
5282
|
+
_this2.initOptions();
|
|
5256
5283
|
vm.$f.refresh();
|
|
5257
5284
|
}, {
|
|
5258
5285
|
deep: true
|
|
5259
5286
|
});
|
|
5260
|
-
_this2.initOptions(
|
|
5287
|
+
_this2.initOptions();
|
|
5261
5288
|
}
|
|
5262
5289
|
_this2.created();
|
|
5290
|
+
vm.disabled && vm.$f.disabled(true);
|
|
5263
5291
|
});
|
|
5264
5292
|
vm.$on('hook:mounted', function () {
|
|
5265
5293
|
_this2.mounted();
|
|
@@ -5289,8 +5317,9 @@
|
|
|
5289
5317
|
isSub: function isSub() {
|
|
5290
5318
|
return this.vm.$pfc && this.vm.extendOption;
|
|
5291
5319
|
},
|
|
5292
|
-
initOptions: function initOptions(
|
|
5293
|
-
this.options =
|
|
5320
|
+
initOptions: function initOptions() {
|
|
5321
|
+
this.options = {};
|
|
5322
|
+
var options = _objectSpread2({
|
|
5294
5323
|
formData: {},
|
|
5295
5324
|
submitBtn: {},
|
|
5296
5325
|
resetBtn: {}
|
|
@@ -5298,6 +5327,7 @@
|
|
|
5298
5327
|
if (this.isSub()) {
|
|
5299
5328
|
this.mergeOptions(this.options, this.vm.$pfc.$f.config || {}, true);
|
|
5300
5329
|
}
|
|
5330
|
+
options = this.mergeOptions(options, this.vm.$options.propsData.option);
|
|
5301
5331
|
this.updateOptions(options);
|
|
5302
5332
|
},
|
|
5303
5333
|
mergeOptions: function mergeOptions(target, opt, parent) {
|
|
@@ -5666,7 +5696,7 @@
|
|
|
5666
5696
|
}
|
|
5667
5697
|
},
|
|
5668
5698
|
tidyOptions: function tidyOptions(options) {
|
|
5669
|
-
['submitBtn', 'resetBtn', 'row', 'info', 'wrap', 'col'].forEach(function (name) {
|
|
5699
|
+
['submitBtn', 'resetBtn', 'row', 'info', 'wrap', 'col', 'title'].forEach(function (name) {
|
|
5670
5700
|
tidyBool(options, name);
|
|
5671
5701
|
});
|
|
5672
5702
|
return options;
|
|
@@ -5686,7 +5716,8 @@
|
|
|
5686
5716
|
}, {}),
|
|
5687
5717
|
info: this.options.info || {},
|
|
5688
5718
|
wrap: this.options.wrap || {},
|
|
5689
|
-
col: this.options.col || {}
|
|
5719
|
+
col: this.options.col || {},
|
|
5720
|
+
title: this.options.title || {}
|
|
5690
5721
|
}, ctx.prop], {
|
|
5691
5722
|
info: {
|
|
5692
5723
|
trigger: 'hover',
|
|
@@ -5759,7 +5790,7 @@
|
|
|
5759
5790
|
key: "".concat(uni, "fi"),
|
|
5760
5791
|
ref: ctx.wrapRef,
|
|
5761
5792
|
type: 'formItem'
|
|
5762
|
-
}]), [children, isTitle ? this.makeInfo(rule, uni) : null]);
|
|
5793
|
+
}]), [children, isTitle ? this.makeInfo(rule, uni, ctx) : null]);
|
|
5763
5794
|
return inline === true || isFalse(_col) || isFalse(col.show) ? item : this.makeCol(rule, uni, [item]);
|
|
5764
5795
|
},
|
|
5765
5796
|
isTitle: function isTitle(rule) {
|
|
@@ -5767,12 +5798,17 @@
|
|
|
5767
5798
|
var title = rule.title;
|
|
5768
5799
|
return !(!title.title && !title["native"] || isFalse(title.show));
|
|
5769
5800
|
},
|
|
5770
|
-
makeInfo: function makeInfo(rule, uni) {
|
|
5801
|
+
makeInfo: function makeInfo(rule, uni, ctx) {
|
|
5771
5802
|
var titleProp = rule.title;
|
|
5772
5803
|
var infoProp = rule.info;
|
|
5773
5804
|
var isTip = isTooltip(infoProp);
|
|
5774
5805
|
var form = this.options.form;
|
|
5775
|
-
var
|
|
5806
|
+
var titleSlot = this.getSlot('title');
|
|
5807
|
+
var children = [titleSlot ? titleSlot({
|
|
5808
|
+
title: titleProp.title || '',
|
|
5809
|
+
rule: ctx.rule,
|
|
5810
|
+
options: this.options
|
|
5811
|
+
}) : (titleProp.title || '') + (form.labelSuffix || form['label-suffix'] || '')];
|
|
5776
5812
|
if (!isFalse(infoProp.show) && (infoProp.info || infoProp["native"]) && !isFalse(infoProp.icon)) {
|
|
5777
5813
|
var prop = {
|
|
5778
5814
|
type: infoProp.type || 'popover',
|
|
@@ -6139,7 +6175,7 @@
|
|
|
6139
6175
|
function elmFormCreate() {
|
|
6140
6176
|
return FormCreateFactory({
|
|
6141
6177
|
ui: "".concat("element-ui"),
|
|
6142
|
-
version: "".concat("2.5.
|
|
6178
|
+
version: "".concat("2.5.35"),
|
|
6143
6179
|
manager: manager,
|
|
6144
6180
|
extendApi: extendApi,
|
|
6145
6181
|
install: install,
|