@form-create/element-ui 3.2.41 → 3.2.42
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 +59 -4
- package/dist/form-create.esm.min.js +2 -2
- package/dist/form-create.js +59 -4
- package/dist/form-create.min.js +2 -2
- package/package.json +3 -3
- package/src/core/api.js +19 -1
- package/types/config.d.ts +2 -0
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.42
|
|
3
3
|
* (c) 2018-2026 xaboy
|
|
4
4
|
* Github https://github.com/xaboy/form-create
|
|
5
5
|
* Released under the MIT License.
|
|
@@ -3886,6 +3886,40 @@
|
|
|
3886
3886
|
var ctx = h.getCtx(id);
|
|
3887
3887
|
if (ctx) return ctx.el || h.vm.refs[ctx.ref];
|
|
3888
3888
|
},
|
|
3889
|
+
scrollTo: function scrollTo(id) {
|
|
3890
|
+
var arg = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
|
|
3891
|
+
block: 'center',
|
|
3892
|
+
inline: 'nearest',
|
|
3893
|
+
behavior: 'smooth'
|
|
3894
|
+
};
|
|
3895
|
+
var raw = api.el(id);
|
|
3896
|
+
if (!raw) return;
|
|
3897
|
+
var root = raw.$el !== undefined ? raw.$el : raw;
|
|
3898
|
+
if (!root) return;
|
|
3899
|
+
var el = root.nodeType === 1 ? root : root.firstElementChild;
|
|
3900
|
+
el && typeof el.scrollIntoView === 'function' && el.scrollIntoView(arg);
|
|
3901
|
+
},
|
|
3902
|
+
focus: function focus(id) {
|
|
3903
|
+
var raw = api.el(id);
|
|
3904
|
+
if (!raw) return;
|
|
3905
|
+
|
|
3906
|
+
var tryFocus = function tryFocus(node) {
|
|
3907
|
+
if (!node || typeof node.focus !== 'function') return false;
|
|
3908
|
+
invoke(function () {
|
|
3909
|
+
return node.focus();
|
|
3910
|
+
});
|
|
3911
|
+
return true;
|
|
3912
|
+
};
|
|
3913
|
+
|
|
3914
|
+
if (tryFocus(raw)) return;
|
|
3915
|
+
var root = raw.$el !== undefined ? raw.$el : raw;
|
|
3916
|
+
if (tryFocus(root)) return;
|
|
3917
|
+
var el = root && (root.nodeType === 1 ? root : root.firstElementChild);
|
|
3918
|
+
if (tryFocus(el)) return;
|
|
3919
|
+
if (!el || !el.querySelector) return;
|
|
3920
|
+
var inner = el.querySelector('input:not([type=hidden]):not([disabled]),textarea:not([disabled]),select:not([disabled]),[tabindex]:not([tabindex="-1"])');
|
|
3921
|
+
tryFocus(inner);
|
|
3922
|
+
},
|
|
3889
3923
|
closeModal: function closeModal(id) {
|
|
3890
3924
|
h.bus.$emit('fc:closeModal:' + id);
|
|
3891
3925
|
},
|
|
@@ -8794,7 +8828,7 @@
|
|
|
8794
8828
|
},
|
|
8795
8829
|
mergeOptions: function mergeOptions(target, opt, parent) {
|
|
8796
8830
|
opt = _objectSpread2({}, opt || {});
|
|
8797
|
-
parent && ['page', 'onSubmit', 'onReset', 'onCreated', 'onChange', 'onMounted', 'mounted', 'beforeUnmount', 'onBeforeUnmount', 'onReload', 'reload', 'formData', 'el', 'globalClass', 'style'].forEach(function (n) {
|
|
8831
|
+
parent && ['page', 'onSubmit', 'onReset', 'onCreated', 'onChange', 'onMounted', 'mounted', 'beforeUnmount', 'beforeSubmit', 'onBeforeUnmount', 'onReload', 'reload', 'formData', 'el', 'globalClass', 'style'].forEach(function (n) {
|
|
8798
8832
|
delete opt[n];
|
|
8799
8833
|
});
|
|
8800
8834
|
|
|
@@ -9687,7 +9721,13 @@
|
|
|
9687
9721
|
validateField: function validateField(field, callback) {
|
|
9688
9722
|
return new Promise(function (resolve, reject) {
|
|
9689
9723
|
var ctx = h.getFieldCtx(field);
|
|
9690
|
-
|
|
9724
|
+
|
|
9725
|
+
if (!ctx) {
|
|
9726
|
+
resolve(null);
|
|
9727
|
+
callback && callback(null);
|
|
9728
|
+
return;
|
|
9729
|
+
}
|
|
9730
|
+
|
|
9691
9731
|
var sub = h.subForm[ctx.id];
|
|
9692
9732
|
var all = [h.$manager.validateField(ctx.id)];
|
|
9693
9733
|
toArray(sub).filter(function (v) {
|
|
@@ -9708,6 +9748,21 @@
|
|
|
9708
9748
|
});
|
|
9709
9749
|
});
|
|
9710
9750
|
},
|
|
9751
|
+
validateFields: function validateFields(fields, callback) {
|
|
9752
|
+
return new Promise(function (resolve, reject) {
|
|
9753
|
+
if (!Array.isArray(fields)) fields = [fields];
|
|
9754
|
+
var list = fields.map(function (field) {
|
|
9755
|
+
return api.validateField(field);
|
|
9756
|
+
});
|
|
9757
|
+
Promise.all(list).then(function () {
|
|
9758
|
+
resolve(null);
|
|
9759
|
+
callback && callback(null);
|
|
9760
|
+
})["catch"](function (e) {
|
|
9761
|
+
reject(e);
|
|
9762
|
+
callback && callback(e);
|
|
9763
|
+
});
|
|
9764
|
+
});
|
|
9765
|
+
},
|
|
9711
9766
|
clearValidateState: function clearValidateState(fields) {
|
|
9712
9767
|
var _this = this;
|
|
9713
9768
|
|
|
@@ -9925,7 +9980,7 @@
|
|
|
9925
9980
|
function elmFormCreate() {
|
|
9926
9981
|
return FormCreateFactory({
|
|
9927
9982
|
ui: 'element-ui',
|
|
9928
|
-
version: '3.2.
|
|
9983
|
+
version: '3.2.42',
|
|
9929
9984
|
manager: manager,
|
|
9930
9985
|
extendApi: extendApi,
|
|
9931
9986
|
install: install,
|