@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.esm.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.
|
|
@@ -2648,6 +2648,68 @@ function convertFieldToConditions(field) {
|
|
|
2648
2648
|
});
|
|
2649
2649
|
return conditions.join(' && ');
|
|
2650
2650
|
}
|
|
2651
|
+
function parseTemplateToTree(template) {
|
|
2652
|
+
var tokens = [];
|
|
2653
|
+
var current = '';
|
|
2654
|
+
var depth = 0;
|
|
2655
|
+
|
|
2656
|
+
for (var i = 0; i < template.length; i++) {
|
|
2657
|
+
var _char = template[i];
|
|
2658
|
+
|
|
2659
|
+
if (_char === '[') {
|
|
2660
|
+
if (depth === 0 && current) {
|
|
2661
|
+
tokens.push({
|
|
2662
|
+
type: 'key',
|
|
2663
|
+
value: current
|
|
2664
|
+
});
|
|
2665
|
+
current = '';
|
|
2666
|
+
}
|
|
2667
|
+
|
|
2668
|
+
depth++;
|
|
2669
|
+
current += _char;
|
|
2670
|
+
} else if (_char === ']') {
|
|
2671
|
+
depth--;
|
|
2672
|
+
current += _char;
|
|
2673
|
+
|
|
2674
|
+
if (depth === 0) {
|
|
2675
|
+
tokens.push({
|
|
2676
|
+
type: 'bracket',
|
|
2677
|
+
value: parseTemplateToTree(current.slice(1, -1))
|
|
2678
|
+
});
|
|
2679
|
+
current = '';
|
|
2680
|
+
}
|
|
2681
|
+
} else if (_char === '.' && depth === 0) {
|
|
2682
|
+
if (current) {
|
|
2683
|
+
tokens.push({
|
|
2684
|
+
type: 'key',
|
|
2685
|
+
value: current
|
|
2686
|
+
});
|
|
2687
|
+
current = '';
|
|
2688
|
+
}
|
|
2689
|
+
} else {
|
|
2690
|
+
current += _char;
|
|
2691
|
+
}
|
|
2692
|
+
}
|
|
2693
|
+
|
|
2694
|
+
if (current) {
|
|
2695
|
+
tokens.push({
|
|
2696
|
+
type: 'key',
|
|
2697
|
+
value: current
|
|
2698
|
+
});
|
|
2699
|
+
}
|
|
2700
|
+
|
|
2701
|
+
return tokens.map(function (token) {
|
|
2702
|
+
if (token.type === 'key') {
|
|
2703
|
+
return {
|
|
2704
|
+
key: token.value
|
|
2705
|
+
};
|
|
2706
|
+
} else {
|
|
2707
|
+
return {
|
|
2708
|
+
children: token.value
|
|
2709
|
+
};
|
|
2710
|
+
}
|
|
2711
|
+
});
|
|
2712
|
+
}
|
|
2651
2713
|
|
|
2652
2714
|
var _getGroupInject = function getGroupInject(vm, parent) {
|
|
2653
2715
|
if (!vm || vm === parent) {
|
|
@@ -2844,10 +2906,10 @@ function $FormCreate(FormCreate, components, directives) {
|
|
|
2844
2906
|
fapi.scope.bus.$off('$loadData.$scopeForm', emit$scopeForm);
|
|
2845
2907
|
}
|
|
2846
2908
|
|
|
2847
|
-
styleEl && document.head.removeChild(styleEl);
|
|
2848
2909
|
rmSubForm();
|
|
2849
2910
|
data.destroyed = true;
|
|
2850
2911
|
fc.unmount();
|
|
2912
|
+
styleEl && (styleEl.parentNode || styleEl.parentElement) && document.head.removeChild(styleEl);
|
|
2851
2913
|
});
|
|
2852
2914
|
onUpdated(function () {
|
|
2853
2915
|
fc.updated();
|
|
@@ -3740,9 +3802,7 @@ function Api(h) {
|
|
|
3740
3802
|
|
|
3741
3803
|
if (!config) {
|
|
3742
3804
|
resolve(h.fc.loadData[name]);
|
|
3743
|
-
}
|
|
3744
|
-
|
|
3745
|
-
if (config.type === 'fetch') {
|
|
3805
|
+
} else if (config.type === 'fetch') {
|
|
3746
3806
|
api.fetch(config).then(function (res) {
|
|
3747
3807
|
resolve(res);
|
|
3748
3808
|
})["catch"](inject);
|
|
@@ -4611,6 +4671,58 @@ function useInject(Handler) {
|
|
|
4611
4671
|
if (str && typeof str === 'string' && str.indexOf('{{') > -1 && str.indexOf('}}') > -1) {
|
|
4612
4672
|
var tmp = str;
|
|
4613
4673
|
var vars = extractVar(str);
|
|
4674
|
+
|
|
4675
|
+
var getValue = function getValue(field) {
|
|
4676
|
+
var flag = false;
|
|
4677
|
+
var val;
|
|
4678
|
+
|
|
4679
|
+
if (group && field.indexOf('$form.') === 0) {
|
|
4680
|
+
var _split = field.split('.');
|
|
4681
|
+
|
|
4682
|
+
_split.shift();
|
|
4683
|
+
|
|
4684
|
+
if (hasProperty(group.value, _split[0])) {
|
|
4685
|
+
flag = true;
|
|
4686
|
+
val = get ? get({
|
|
4687
|
+
id: '$form.' + _split[0] + '_' + group.rule.__fc__.id,
|
|
4688
|
+
getValue: function getValue() {
|
|
4689
|
+
return deepGet(group.value, _split);
|
|
4690
|
+
}
|
|
4691
|
+
}) : deepGet(group.value, _split);
|
|
4692
|
+
}
|
|
4693
|
+
}
|
|
4694
|
+
|
|
4695
|
+
if (!flag) {
|
|
4696
|
+
val = get ? get(field) : _this3.fc.getLoadData(field);
|
|
4697
|
+
}
|
|
4698
|
+
|
|
4699
|
+
return val;
|
|
4700
|
+
};
|
|
4701
|
+
|
|
4702
|
+
var treeToVal = function treeToVal(tree) {
|
|
4703
|
+
var fields = [];
|
|
4704
|
+
tree.forEach(function (item) {
|
|
4705
|
+
if (item.key) {
|
|
4706
|
+
fields.push(item.key);
|
|
4707
|
+
} else if (item.children) {
|
|
4708
|
+
fields.push(treeToVal(item.children));
|
|
4709
|
+
}
|
|
4710
|
+
});
|
|
4711
|
+
var flag = false;
|
|
4712
|
+
fields.forEach(function (field, idx) {
|
|
4713
|
+
if (field != null && (field.indexOf('\'') === 0 || field.indexOf('"') === 0)) {
|
|
4714
|
+
fields[idx] = field.slice(1, -1);
|
|
4715
|
+
flag = true;
|
|
4716
|
+
}
|
|
4717
|
+
});
|
|
4718
|
+
|
|
4719
|
+
if (fields.length === 1 && (flag || !isNaN(Number(fields[0])))) {
|
|
4720
|
+
return fields[0];
|
|
4721
|
+
}
|
|
4722
|
+
|
|
4723
|
+
return getValue(fields.join('.'));
|
|
4724
|
+
};
|
|
4725
|
+
|
|
4614
4726
|
var lastVal;
|
|
4615
4727
|
vars.forEach(function (v) {
|
|
4616
4728
|
var split = v.split('||');
|
|
@@ -4618,27 +4730,13 @@ function useInject(Handler) {
|
|
|
4618
4730
|
|
|
4619
4731
|
if (field) {
|
|
4620
4732
|
var def = (split[1] || '').trim();
|
|
4621
|
-
var
|
|
4622
|
-
var
|
|
4623
|
-
|
|
4624
|
-
|
|
4625
|
-
var _split = field.split('.');
|
|
4626
|
-
|
|
4627
|
-
_split.shift();
|
|
4628
|
-
|
|
4629
|
-
if (hasProperty(group.value, _split[0])) {
|
|
4630
|
-
flag = true;
|
|
4631
|
-
val = get ? get({
|
|
4632
|
-
id: '$form.' + _split[0] + '_' + group.rule.__fc__.id,
|
|
4633
|
-
getValue: function getValue() {
|
|
4634
|
-
return deepGet(group.value, _split);
|
|
4635
|
-
}
|
|
4636
|
-
}) : deepGet(group.value, _split);
|
|
4637
|
-
}
|
|
4638
|
-
}
|
|
4733
|
+
var tree = parseTemplateToTree(field);
|
|
4734
|
+
var val = invoke(function () {
|
|
4735
|
+
return treeToVal(tree);
|
|
4736
|
+
});
|
|
4639
4737
|
|
|
4640
|
-
if (
|
|
4641
|
-
val =
|
|
4738
|
+
if ((val == null || val === '') && split.length > 1) {
|
|
4739
|
+
val = def;
|
|
4642
4740
|
}
|
|
4643
4741
|
|
|
4644
4742
|
lastVal = val;
|
|
@@ -4963,6 +5061,9 @@ extend(RuleContext.prototype, {
|
|
|
4963
5061
|
initNone: function initNone() {
|
|
4964
5062
|
this.none = !(is.Undef(this.prop.display) || !!this.prop.display);
|
|
4965
5063
|
},
|
|
5064
|
+
hasHidden: function hasHidden() {
|
|
5065
|
+
return !!this.rule.hidden || (this.parent ? this.parent.hasHidden() : false);
|
|
5066
|
+
},
|
|
4966
5067
|
injectValidate: function injectValidate() {
|
|
4967
5068
|
return this.prop.validate;
|
|
4968
5069
|
},
|
|
@@ -5638,10 +5739,11 @@ function useInput(Handler) {
|
|
|
5638
5739
|
|
|
5639
5740
|
fields.reduce(function (initial, field) {
|
|
5640
5741
|
var ctx = (_this3.fieldCtx[field] || []).filter(function (ctx) {
|
|
5641
|
-
return !_this3.isIgnore(ctx
|
|
5642
|
-
})[0]
|
|
5742
|
+
return !_this3.isIgnore(ctx);
|
|
5743
|
+
})[0];
|
|
5643
5744
|
|
|
5644
|
-
if (
|
|
5745
|
+
if (!ctx) {
|
|
5746
|
+
ctx = _this3.fieldCtx[field][0];
|
|
5645
5747
|
ignoreFields.push(field);
|
|
5646
5748
|
}
|
|
5647
5749
|
|
|
@@ -5652,8 +5754,8 @@ function useInput(Handler) {
|
|
|
5652
5754
|
this.ignoreFields = ignoreFields;
|
|
5653
5755
|
this.syncValue();
|
|
5654
5756
|
},
|
|
5655
|
-
isIgnore: function isIgnore(
|
|
5656
|
-
return rule.ignore === true || rule.ignore === 'hidden'
|
|
5757
|
+
isIgnore: function isIgnore(ctx) {
|
|
5758
|
+
return ctx.rule.ignore === true || (ctx.rule.ignore === 'hidden' || this.options.ignoreHiddenFields) && ctx.hasHidden();
|
|
5657
5759
|
},
|
|
5658
5760
|
appendValue: function appendValue(rule) {
|
|
5659
5761
|
if ((!rule.field || !hasProperty(this.appendData, rule.field)) && !this.options.forceCoverValue) {
|
|
@@ -6581,7 +6683,7 @@ function useContext(Handler) {
|
|
|
6581
6683
|
|
|
6582
6684
|
if (is.trueArray(children)) {
|
|
6583
6685
|
children.forEach(function (h) {
|
|
6584
|
-
return h.__fc__ && _this8.rmCtx(h.__fc__);
|
|
6686
|
+
return h && h.__fc__ && _this8.rmCtx(h.__fc__);
|
|
6585
6687
|
});
|
|
6586
6688
|
}
|
|
6587
6689
|
}
|
|
@@ -7028,7 +7130,9 @@ function makeDirective(data, vn) {
|
|
|
7028
7130
|
function CreateNodeFactory() {
|
|
7029
7131
|
var aliasMap = {};
|
|
7030
7132
|
|
|
7031
|
-
function CreateNode() {
|
|
7133
|
+
function CreateNode(vm) {
|
|
7134
|
+
this.vm = vm;
|
|
7135
|
+
}
|
|
7032
7136
|
|
|
7033
7137
|
extend(CreateNode.prototype, {
|
|
7034
7138
|
make: function make(tag, data, children) {
|
|
@@ -7043,7 +7147,7 @@ function CreateNodeFactory() {
|
|
|
7043
7147
|
}
|
|
7044
7148
|
},
|
|
7045
7149
|
h: function h(tag, data, children) {
|
|
7046
|
-
var isNativeTag =
|
|
7150
|
+
var isNativeTag = this.vm.appContext.config.isNativeTag(tag);
|
|
7047
7151
|
|
|
7048
7152
|
if (isNativeTag) {
|
|
7049
7153
|
delete data.formCreateInject;
|
|
@@ -8357,7 +8461,7 @@ function FormCreateFactory(config) {
|
|
|
8357
8461
|
|
|
8358
8462
|
if (!unwatch[id]) {
|
|
8359
8463
|
return;
|
|
8360
|
-
} else if (JSON.stringify(temp) !== JSON.stringify(unwatch[id].val)) {
|
|
8464
|
+
} else if ((temp instanceof Function || is.Object(temp) || Array.isArray(temp)) && temp === unwatch[id].val || JSON.stringify(temp) !== JSON.stringify(unwatch[id].val)) {
|
|
8361
8465
|
unwatch[id].val = temp;
|
|
8362
8466
|
run(true);
|
|
8363
8467
|
}
|
|
@@ -9499,7 +9603,7 @@ function install(FormCreate) {
|
|
|
9499
9603
|
function elmFormCreate() {
|
|
9500
9604
|
return FormCreateFactory({
|
|
9501
9605
|
ui: 'element-ui',
|
|
9502
|
-
version: '3.2.
|
|
9606
|
+
version: '3.2.24',
|
|
9503
9607
|
manager: manager,
|
|
9504
9608
|
extendApi: extendApi,
|
|
9505
9609
|
install: install,
|