@form-create/element-ui 3.2.40 → 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.
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @form-create/element-ui v3.2.40
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.
@@ -2909,7 +2909,7 @@ function $FormCreate(FormCreate, components, directives) {
2909
2909
  },
2910
2910
  inFor: Boolean
2911
2911
  },
2912
- emits: ['update:api', 'update:modelValue', 'mounted', 'submit', 'reset', 'change', 'emit-event', 'control', 'remove-rule', 'remove-field', 'sync', 'reload', 'repeat-field', 'update', 'validate-field-fail', 'validate-fail', 'created'],
2912
+ emits: ['update:api', 'update:modelValue', 'mounted', 'beforeUnmount', 'submit', 'reset', 'change', 'emit-event', 'control', 'remove-rule', 'remove-field', 'sync', 'reload', 'repeat-field', 'update', 'validate-field-fail', 'validate-fail', 'created'],
2913
2913
  render: function render() {
2914
2914
  return this.fc.render();
2915
2915
  },
@@ -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
  },
@@ -4045,9 +4079,10 @@ function Api(h) {
4045
4079
 
4046
4080
  return (_h$vm$setupState$getG = h.vm.setupState.getGroupInject()) === null || _h$vm$setupState$getG === void 0 ? void 0 : _h$vm$setupState$getG.rule;
4047
4081
  },
4048
- fetch: function fetch(opt) {
4082
+ fetch: function fetch(_opt) {
4049
4083
  return new Promise(function (resolve, reject) {
4050
- opt = deepCopy(opt);
4084
+ var opt = _objectSpread2({}, _opt);
4085
+
4051
4086
  opt = h.loadFetchVar(opt);
4052
4087
 
4053
4088
  var fail = function fail(e) {
@@ -4073,7 +4108,7 @@ function Api(h) {
4073
4108
  },
4074
4109
  watchFetch: function watchFetch(opt, callback, error, beforeFetch) {
4075
4110
  return h.fc.watchLoadData(function (get, change) {
4076
- var _opt = deepCopy(opt);
4111
+ var _opt = _objectSpread2({}, opt);
4077
4112
 
4078
4113
  _opt = h.loadFetchVar(_opt, get);
4079
4114
 
@@ -4958,6 +4993,10 @@ function useInject(Handler) {
4958
4993
  group = rule.__fc__.getParentGroup();
4959
4994
  }
4960
4995
 
4996
+ if (!group && options.targetRule && options.targetRule.__fc__) {
4997
+ group = options.targetRule.__fc__.getParentGroup();
4998
+ }
4999
+
4961
5000
  var loadVal = function loadVal(str) {
4962
5001
  return _this4.loadStrVar(str, get, group ? {
4963
5002
  rule: rule,
@@ -8785,7 +8824,7 @@ function FormCreateFactory(config) {
8785
8824
  },
8786
8825
  mergeOptions: function mergeOptions(target, opt, parent) {
8787
8826
  opt = _objectSpread2({}, opt || {});
8788
- parent && ['page', 'onSubmit', 'onReset', 'onCreated', 'onChange', 'onMounted', 'mounted', '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) {
8789
8828
  delete opt[n];
8790
8829
  });
8791
8830
 
@@ -8814,6 +8853,10 @@ function FormCreateFactory(config) {
8814
8853
  unmount: function unmount() {
8815
8854
  var _this7 = this;
8816
8855
 
8856
+ invoke(function () {
8857
+ return _this7.$handle.lifecycle('beforeUnmount');
8858
+ });
8859
+
8817
8860
  if (this.name) {
8818
8861
  if (this.inFor) {
8819
8862
  var idx = instance[this.name].indexOf(this);
@@ -9674,7 +9717,13 @@ function extendApi(api, h) {
9674
9717
  validateField: function validateField(field, callback) {
9675
9718
  return new Promise(function (resolve, reject) {
9676
9719
  var ctx = h.getFieldCtx(field);
9677
- if (!ctx) return;
9720
+
9721
+ if (!ctx) {
9722
+ resolve(null);
9723
+ callback && callback(null);
9724
+ return;
9725
+ }
9726
+
9678
9727
  var sub = h.subForm[ctx.id];
9679
9728
  var all = [h.$manager.validateField(ctx.id)];
9680
9729
  toArray(sub).filter(function (v) {
@@ -9695,6 +9744,21 @@ function extendApi(api, h) {
9695
9744
  });
9696
9745
  });
9697
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
+ },
9698
9762
  clearValidateState: function clearValidateState(fields) {
9699
9763
  var _this = this;
9700
9764
 
@@ -9912,7 +9976,7 @@ function install(FormCreate) {
9912
9976
  function elmFormCreate() {
9913
9977
  return FormCreateFactory({
9914
9978
  ui: 'element-ui',
9915
- version: '3.2.40',
9979
+ version: '3.2.42',
9916
9980
  manager: manager,
9917
9981
  extendApi: extendApi,
9918
9982
  install: install,