@form-create/element-ui 3.2.23 → 3.2.24
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 +139 -35
- package/dist/form-create.esm.min.js +2 -2
- package/dist/form-create.js +139 -35
- package/dist/form-create.min.js +2 -2
- package/package.json +3 -3
package/dist/form-create.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @form-create/element-ui v3.2.
|
|
2
|
+
* @form-create/element-ui v3.2.24
|
|
3
3
|
* (c) 2018-2025 xaboy
|
|
4
4
|
* Github https://github.com/xaboy/form-create
|
|
5
5
|
* Released under the MIT License.
|
|
@@ -2652,6 +2652,68 @@
|
|
|
2652
2652
|
});
|
|
2653
2653
|
return conditions.join(' && ');
|
|
2654
2654
|
}
|
|
2655
|
+
function parseTemplateToTree(template) {
|
|
2656
|
+
var tokens = [];
|
|
2657
|
+
var current = '';
|
|
2658
|
+
var depth = 0;
|
|
2659
|
+
|
|
2660
|
+
for (var i = 0; i < template.length; i++) {
|
|
2661
|
+
var _char = template[i];
|
|
2662
|
+
|
|
2663
|
+
if (_char === '[') {
|
|
2664
|
+
if (depth === 0 && current) {
|
|
2665
|
+
tokens.push({
|
|
2666
|
+
type: 'key',
|
|
2667
|
+
value: current
|
|
2668
|
+
});
|
|
2669
|
+
current = '';
|
|
2670
|
+
}
|
|
2671
|
+
|
|
2672
|
+
depth++;
|
|
2673
|
+
current += _char;
|
|
2674
|
+
} else if (_char === ']') {
|
|
2675
|
+
depth--;
|
|
2676
|
+
current += _char;
|
|
2677
|
+
|
|
2678
|
+
if (depth === 0) {
|
|
2679
|
+
tokens.push({
|
|
2680
|
+
type: 'bracket',
|
|
2681
|
+
value: parseTemplateToTree(current.slice(1, -1))
|
|
2682
|
+
});
|
|
2683
|
+
current = '';
|
|
2684
|
+
}
|
|
2685
|
+
} else if (_char === '.' && depth === 0) {
|
|
2686
|
+
if (current) {
|
|
2687
|
+
tokens.push({
|
|
2688
|
+
type: 'key',
|
|
2689
|
+
value: current
|
|
2690
|
+
});
|
|
2691
|
+
current = '';
|
|
2692
|
+
}
|
|
2693
|
+
} else {
|
|
2694
|
+
current += _char;
|
|
2695
|
+
}
|
|
2696
|
+
}
|
|
2697
|
+
|
|
2698
|
+
if (current) {
|
|
2699
|
+
tokens.push({
|
|
2700
|
+
type: 'key',
|
|
2701
|
+
value: current
|
|
2702
|
+
});
|
|
2703
|
+
}
|
|
2704
|
+
|
|
2705
|
+
return tokens.map(function (token) {
|
|
2706
|
+
if (token.type === 'key') {
|
|
2707
|
+
return {
|
|
2708
|
+
key: token.value
|
|
2709
|
+
};
|
|
2710
|
+
} else {
|
|
2711
|
+
return {
|
|
2712
|
+
children: token.value
|
|
2713
|
+
};
|
|
2714
|
+
}
|
|
2715
|
+
});
|
|
2716
|
+
}
|
|
2655
2717
|
|
|
2656
2718
|
var _getGroupInject = function getGroupInject(vm, parent) {
|
|
2657
2719
|
if (!vm || vm === parent) {
|
|
@@ -2848,10 +2910,10 @@
|
|
|
2848
2910
|
fapi.scope.bus.$off('$loadData.$scopeForm', emit$scopeForm);
|
|
2849
2911
|
}
|
|
2850
2912
|
|
|
2851
|
-
styleEl && document.head.removeChild(styleEl);
|
|
2852
2913
|
rmSubForm();
|
|
2853
2914
|
data.destroyed = true;
|
|
2854
2915
|
fc.unmount();
|
|
2916
|
+
styleEl && (styleEl.parentNode || styleEl.parentElement) && document.head.removeChild(styleEl);
|
|
2855
2917
|
});
|
|
2856
2918
|
vue.onUpdated(function () {
|
|
2857
2919
|
fc.updated();
|
|
@@ -3744,9 +3806,7 @@
|
|
|
3744
3806
|
|
|
3745
3807
|
if (!config) {
|
|
3746
3808
|
resolve(h.fc.loadData[name]);
|
|
3747
|
-
}
|
|
3748
|
-
|
|
3749
|
-
if (config.type === 'fetch') {
|
|
3809
|
+
} else if (config.type === 'fetch') {
|
|
3750
3810
|
api.fetch(config).then(function (res) {
|
|
3751
3811
|
resolve(res);
|
|
3752
3812
|
})["catch"](inject);
|
|
@@ -4615,6 +4675,58 @@
|
|
|
4615
4675
|
if (str && typeof str === 'string' && str.indexOf('{{') > -1 && str.indexOf('}}') > -1) {
|
|
4616
4676
|
var tmp = str;
|
|
4617
4677
|
var vars = extractVar(str);
|
|
4678
|
+
|
|
4679
|
+
var getValue = function getValue(field) {
|
|
4680
|
+
var flag = false;
|
|
4681
|
+
var val;
|
|
4682
|
+
|
|
4683
|
+
if (group && field.indexOf('$form.') === 0) {
|
|
4684
|
+
var _split = field.split('.');
|
|
4685
|
+
|
|
4686
|
+
_split.shift();
|
|
4687
|
+
|
|
4688
|
+
if (hasProperty(group.value, _split[0])) {
|
|
4689
|
+
flag = true;
|
|
4690
|
+
val = get ? get({
|
|
4691
|
+
id: '$form.' + _split[0] + '_' + group.rule.__fc__.id,
|
|
4692
|
+
getValue: function getValue() {
|
|
4693
|
+
return deepGet(group.value, _split);
|
|
4694
|
+
}
|
|
4695
|
+
}) : deepGet(group.value, _split);
|
|
4696
|
+
}
|
|
4697
|
+
}
|
|
4698
|
+
|
|
4699
|
+
if (!flag) {
|
|
4700
|
+
val = get ? get(field) : _this3.fc.getLoadData(field);
|
|
4701
|
+
}
|
|
4702
|
+
|
|
4703
|
+
return val;
|
|
4704
|
+
};
|
|
4705
|
+
|
|
4706
|
+
var treeToVal = function treeToVal(tree) {
|
|
4707
|
+
var fields = [];
|
|
4708
|
+
tree.forEach(function (item) {
|
|
4709
|
+
if (item.key) {
|
|
4710
|
+
fields.push(item.key);
|
|
4711
|
+
} else if (item.children) {
|
|
4712
|
+
fields.push(treeToVal(item.children));
|
|
4713
|
+
}
|
|
4714
|
+
});
|
|
4715
|
+
var flag = false;
|
|
4716
|
+
fields.forEach(function (field, idx) {
|
|
4717
|
+
if (field != null && (field.indexOf('\'') === 0 || field.indexOf('"') === 0)) {
|
|
4718
|
+
fields[idx] = field.slice(1, -1);
|
|
4719
|
+
flag = true;
|
|
4720
|
+
}
|
|
4721
|
+
});
|
|
4722
|
+
|
|
4723
|
+
if (fields.length === 1 && (flag || !isNaN(Number(fields[0])))) {
|
|
4724
|
+
return fields[0];
|
|
4725
|
+
}
|
|
4726
|
+
|
|
4727
|
+
return getValue(fields.join('.'));
|
|
4728
|
+
};
|
|
4729
|
+
|
|
4618
4730
|
var lastVal;
|
|
4619
4731
|
vars.forEach(function (v) {
|
|
4620
4732
|
var split = v.split('||');
|
|
@@ -4622,27 +4734,13 @@
|
|
|
4622
4734
|
|
|
4623
4735
|
if (field) {
|
|
4624
4736
|
var def = (split[1] || '').trim();
|
|
4625
|
-
var
|
|
4626
|
-
var
|
|
4627
|
-
|
|
4628
|
-
|
|
4629
|
-
var _split = field.split('.');
|
|
4630
|
-
|
|
4631
|
-
_split.shift();
|
|
4632
|
-
|
|
4633
|
-
if (hasProperty(group.value, _split[0])) {
|
|
4634
|
-
flag = true;
|
|
4635
|
-
val = get ? get({
|
|
4636
|
-
id: '$form.' + _split[0] + '_' + group.rule.__fc__.id,
|
|
4637
|
-
getValue: function getValue() {
|
|
4638
|
-
return deepGet(group.value, _split);
|
|
4639
|
-
}
|
|
4640
|
-
}) : deepGet(group.value, _split);
|
|
4641
|
-
}
|
|
4642
|
-
}
|
|
4737
|
+
var tree = parseTemplateToTree(field);
|
|
4738
|
+
var val = invoke(function () {
|
|
4739
|
+
return treeToVal(tree);
|
|
4740
|
+
});
|
|
4643
4741
|
|
|
4644
|
-
if (
|
|
4645
|
-
val =
|
|
4742
|
+
if ((val == null || val === '') && split.length > 1) {
|
|
4743
|
+
val = def;
|
|
4646
4744
|
}
|
|
4647
4745
|
|
|
4648
4746
|
lastVal = val;
|
|
@@ -4967,6 +5065,9 @@
|
|
|
4967
5065
|
initNone: function initNone() {
|
|
4968
5066
|
this.none = !(is.Undef(this.prop.display) || !!this.prop.display);
|
|
4969
5067
|
},
|
|
5068
|
+
hasHidden: function hasHidden() {
|
|
5069
|
+
return !!this.rule.hidden || (this.parent ? this.parent.hasHidden() : false);
|
|
5070
|
+
},
|
|
4970
5071
|
injectValidate: function injectValidate() {
|
|
4971
5072
|
return this.prop.validate;
|
|
4972
5073
|
},
|
|
@@ -5642,10 +5743,11 @@
|
|
|
5642
5743
|
|
|
5643
5744
|
fields.reduce(function (initial, field) {
|
|
5644
5745
|
var ctx = (_this3.fieldCtx[field] || []).filter(function (ctx) {
|
|
5645
|
-
return !_this3.isIgnore(ctx
|
|
5646
|
-
})[0]
|
|
5746
|
+
return !_this3.isIgnore(ctx);
|
|
5747
|
+
})[0];
|
|
5647
5748
|
|
|
5648
|
-
if (
|
|
5749
|
+
if (!ctx) {
|
|
5750
|
+
ctx = _this3.fieldCtx[field][0];
|
|
5649
5751
|
ignoreFields.push(field);
|
|
5650
5752
|
}
|
|
5651
5753
|
|
|
@@ -5656,8 +5758,8 @@
|
|
|
5656
5758
|
this.ignoreFields = ignoreFields;
|
|
5657
5759
|
this.syncValue();
|
|
5658
5760
|
},
|
|
5659
|
-
isIgnore: function isIgnore(
|
|
5660
|
-
return rule.ignore === true || rule.ignore === 'hidden'
|
|
5761
|
+
isIgnore: function isIgnore(ctx) {
|
|
5762
|
+
return ctx.rule.ignore === true || (ctx.rule.ignore === 'hidden' || this.options.ignoreHiddenFields) && ctx.hasHidden();
|
|
5661
5763
|
},
|
|
5662
5764
|
appendValue: function appendValue(rule) {
|
|
5663
5765
|
if ((!rule.field || !hasProperty(this.appendData, rule.field)) && !this.options.forceCoverValue) {
|
|
@@ -6585,7 +6687,7 @@
|
|
|
6585
6687
|
|
|
6586
6688
|
if (is.trueArray(children)) {
|
|
6587
6689
|
children.forEach(function (h) {
|
|
6588
|
-
return h.__fc__ && _this8.rmCtx(h.__fc__);
|
|
6690
|
+
return h && h.__fc__ && _this8.rmCtx(h.__fc__);
|
|
6589
6691
|
});
|
|
6590
6692
|
}
|
|
6591
6693
|
}
|
|
@@ -7032,7 +7134,9 @@
|
|
|
7032
7134
|
function CreateNodeFactory() {
|
|
7033
7135
|
var aliasMap = {};
|
|
7034
7136
|
|
|
7035
|
-
function CreateNode() {
|
|
7137
|
+
function CreateNode(vm) {
|
|
7138
|
+
this.vm = vm;
|
|
7139
|
+
}
|
|
7036
7140
|
|
|
7037
7141
|
extend(CreateNode.prototype, {
|
|
7038
7142
|
make: function make(tag, data, children) {
|
|
@@ -7047,7 +7151,7 @@
|
|
|
7047
7151
|
}
|
|
7048
7152
|
},
|
|
7049
7153
|
h: function h(tag, data, children) {
|
|
7050
|
-
var isNativeTag =
|
|
7154
|
+
var isNativeTag = this.vm.appContext.config.isNativeTag(tag);
|
|
7051
7155
|
|
|
7052
7156
|
if (isNativeTag) {
|
|
7053
7157
|
delete data.formCreateInject;
|
|
@@ -8361,7 +8465,7 @@
|
|
|
8361
8465
|
|
|
8362
8466
|
if (!unwatch[id]) {
|
|
8363
8467
|
return;
|
|
8364
|
-
} else if (JSON.stringify(temp) !== JSON.stringify(unwatch[id].val)) {
|
|
8468
|
+
} else if ((temp instanceof Function || is.Object(temp) || Array.isArray(temp)) && temp === unwatch[id].val || JSON.stringify(temp) !== JSON.stringify(unwatch[id].val)) {
|
|
8365
8469
|
unwatch[id].val = temp;
|
|
8366
8470
|
run(true);
|
|
8367
8471
|
}
|
|
@@ -9503,7 +9607,7 @@
|
|
|
9503
9607
|
function elmFormCreate() {
|
|
9504
9608
|
return FormCreateFactory({
|
|
9505
9609
|
ui: 'element-ui',
|
|
9506
|
-
version: '3.2.
|
|
9610
|
+
version: '3.2.24',
|
|
9507
9611
|
manager: manager,
|
|
9508
9612
|
extendApi: extendApi,
|
|
9509
9613
|
install: install,
|