@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.esm.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.
|
|
@@ -3882,6 +3882,40 @@ function Api(h) {
|
|
|
3882
3882
|
var ctx = h.getCtx(id);
|
|
3883
3883
|
if (ctx) return ctx.el || h.vm.refs[ctx.ref];
|
|
3884
3884
|
},
|
|
3885
|
+
scrollTo: function scrollTo(id) {
|
|
3886
|
+
var arg = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
|
|
3887
|
+
block: 'center',
|
|
3888
|
+
inline: 'nearest',
|
|
3889
|
+
behavior: 'smooth'
|
|
3890
|
+
};
|
|
3891
|
+
var raw = api.el(id);
|
|
3892
|
+
if (!raw) return;
|
|
3893
|
+
var root = raw.$el !== undefined ? raw.$el : raw;
|
|
3894
|
+
if (!root) return;
|
|
3895
|
+
var el = root.nodeType === 1 ? root : root.firstElementChild;
|
|
3896
|
+
el && typeof el.scrollIntoView === 'function' && el.scrollIntoView(arg);
|
|
3897
|
+
},
|
|
3898
|
+
focus: function focus(id) {
|
|
3899
|
+
var raw = api.el(id);
|
|
3900
|
+
if (!raw) return;
|
|
3901
|
+
|
|
3902
|
+
var tryFocus = function tryFocus(node) {
|
|
3903
|
+
if (!node || typeof node.focus !== 'function') return false;
|
|
3904
|
+
invoke(function () {
|
|
3905
|
+
return node.focus();
|
|
3906
|
+
});
|
|
3907
|
+
return true;
|
|
3908
|
+
};
|
|
3909
|
+
|
|
3910
|
+
if (tryFocus(raw)) return;
|
|
3911
|
+
var root = raw.$el !== undefined ? raw.$el : raw;
|
|
3912
|
+
if (tryFocus(root)) return;
|
|
3913
|
+
var el = root && (root.nodeType === 1 ? root : root.firstElementChild);
|
|
3914
|
+
if (tryFocus(el)) return;
|
|
3915
|
+
if (!el || !el.querySelector) return;
|
|
3916
|
+
var inner = el.querySelector('input:not([type=hidden]):not([disabled]),textarea:not([disabled]),select:not([disabled]),[tabindex]:not([tabindex="-1"])');
|
|
3917
|
+
tryFocus(inner);
|
|
3918
|
+
},
|
|
3885
3919
|
closeModal: function closeModal(id) {
|
|
3886
3920
|
h.bus.$emit('fc:closeModal:' + id);
|
|
3887
3921
|
},
|
|
@@ -8790,7 +8824,7 @@ function FormCreateFactory(config) {
|
|
|
8790
8824
|
},
|
|
8791
8825
|
mergeOptions: function mergeOptions(target, opt, parent) {
|
|
8792
8826
|
opt = _objectSpread2({}, opt || {});
|
|
8793
|
-
parent && ['page', 'onSubmit', 'onReset', 'onCreated', 'onChange', 'onMounted', 'mounted', 'beforeUnmount', 'onBeforeUnmount', 'onReload', 'reload', 'formData', 'el', 'globalClass', 'style'].forEach(function (n) {
|
|
8827
|
+
parent && ['page', 'onSubmit', 'onReset', 'onCreated', 'onChange', 'onMounted', 'mounted', 'beforeUnmount', 'beforeSubmit', 'onBeforeUnmount', 'onReload', 'reload', 'formData', 'el', 'globalClass', 'style'].forEach(function (n) {
|
|
8794
8828
|
delete opt[n];
|
|
8795
8829
|
});
|
|
8796
8830
|
|
|
@@ -9683,7 +9717,13 @@ function extendApi(api, h) {
|
|
|
9683
9717
|
validateField: function validateField(field, callback) {
|
|
9684
9718
|
return new Promise(function (resolve, reject) {
|
|
9685
9719
|
var ctx = h.getFieldCtx(field);
|
|
9686
|
-
|
|
9720
|
+
|
|
9721
|
+
if (!ctx) {
|
|
9722
|
+
resolve(null);
|
|
9723
|
+
callback && callback(null);
|
|
9724
|
+
return;
|
|
9725
|
+
}
|
|
9726
|
+
|
|
9687
9727
|
var sub = h.subForm[ctx.id];
|
|
9688
9728
|
var all = [h.$manager.validateField(ctx.id)];
|
|
9689
9729
|
toArray(sub).filter(function (v) {
|
|
@@ -9704,6 +9744,21 @@ function extendApi(api, h) {
|
|
|
9704
9744
|
});
|
|
9705
9745
|
});
|
|
9706
9746
|
},
|
|
9747
|
+
validateFields: function validateFields(fields, callback) {
|
|
9748
|
+
return new Promise(function (resolve, reject) {
|
|
9749
|
+
if (!Array.isArray(fields)) fields = [fields];
|
|
9750
|
+
var list = fields.map(function (field) {
|
|
9751
|
+
return api.validateField(field);
|
|
9752
|
+
});
|
|
9753
|
+
Promise.all(list).then(function () {
|
|
9754
|
+
resolve(null);
|
|
9755
|
+
callback && callback(null);
|
|
9756
|
+
})["catch"](function (e) {
|
|
9757
|
+
reject(e);
|
|
9758
|
+
callback && callback(e);
|
|
9759
|
+
});
|
|
9760
|
+
});
|
|
9761
|
+
},
|
|
9707
9762
|
clearValidateState: function clearValidateState(fields) {
|
|
9708
9763
|
var _this = this;
|
|
9709
9764
|
|
|
@@ -9921,7 +9976,7 @@ function install(FormCreate) {
|
|
|
9921
9976
|
function elmFormCreate() {
|
|
9922
9977
|
return FormCreateFactory({
|
|
9923
9978
|
ui: 'element-ui',
|
|
9924
|
-
version: '3.2.
|
|
9979
|
+
version: '3.2.42',
|
|
9925
9980
|
manager: manager,
|
|
9926
9981
|
extendApi: extendApi,
|
|
9927
9982
|
install: install,
|