@form-create/element-ui 3.1.18 → 3.1.19

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.1.18
2
+ * @form-create/element-ui v3.1.19
3
3
  * (c) 2018-2023 xaboy
4
4
  * Github https://github.com/xaboy/form-create
5
5
  * Released under the MIT License.
@@ -1737,7 +1737,7 @@ var Group = defineComponent({
1737
1737
  return [this.max !== 0 && total >= this.max ? null : this.addIcon(key), this.min === 0 || total > this.min ? this.delIcon(index, key) : null];
1738
1738
  }
1739
1739
 
1740
- if (index >= this.min) {
1740
+ if (total > this.min) {
1741
1741
  return this.delIcon(index, key);
1742
1742
  }
1743
1743
  },
@@ -1779,6 +1779,7 @@ var Group = defineComponent({
1779
1779
  return [createVNode(script$2, null, null)];
1780
1780
  }
1781
1781
  }) : createVNode("div", {
1782
+ "style": "width: 100%;",
1782
1783
  "key": 2
1783
1784
  }, [keys.map(function (key, index) {
1784
1785
  var _slot;
@@ -1788,7 +1789,6 @@ var Group = defineComponent({
1788
1789
  options = _this9$cacheRule$key.options;
1789
1790
  return createVNode(resolveComponent("ElRow"), {
1790
1791
  "align": "middle",
1791
- "type": "flex",
1792
1792
  "key": key,
1793
1793
  "style": "border-bottom:1px dashed #DCDFE6;margin-bottom:10px;"
1794
1794
  }, {
@@ -2952,6 +2952,10 @@ function useCache(Render) {
2952
2952
  this.clearCacheAll();
2953
2953
  },
2954
2954
  clearCache: function clearCache(ctx) {
2955
+ if (ctx.rule.cache) {
2956
+ return;
2957
+ }
2958
+
2955
2959
  if (!this.cache[ctx.id]) {
2956
2960
  ctx.parent && this.clearCache(ctx.parent);
2957
2961
  return;
@@ -3816,7 +3820,7 @@ extend(RuleContext.prototype, {
3816
3820
  var rule = _objectSpread2({}, this.rule);
3817
3821
 
3818
3822
  delete rule.children;
3819
- this.prop = mergeProps([rule].concat(_toConsumableArray(Object.keys(this.payload).map(function (k) {
3823
+ this.prop = mergeRule({}, [rule].concat(_toConsumableArray(Object.keys(this.payload).map(function (k) {
3820
3824
  return _this3.payload[k];
3821
3825
  })), [this.computed]));
3822
3826
  },
@@ -3922,6 +3926,73 @@ extend(RuleContext.prototype, {
3922
3926
  }
3923
3927
  });
3924
3928
 
3929
+ var condition = {
3930
+ '==': function _(b) {
3931
+ return function (a) {
3932
+ return a === b;
3933
+ };
3934
+ },
3935
+ '!=': function _(b) {
3936
+ return function (a) {
3937
+ return a !== b;
3938
+ };
3939
+ },
3940
+ '<>': function _(b) {
3941
+ return function (a) {
3942
+ return a !== b;
3943
+ };
3944
+ },
3945
+ '>': function _(b) {
3946
+ return function (a) {
3947
+ return a > b;
3948
+ };
3949
+ },
3950
+ '>=': function _(b) {
3951
+ return function (a) {
3952
+ return a >= b;
3953
+ };
3954
+ },
3955
+ '<': function _(b) {
3956
+ return function (a) {
3957
+ return a < b;
3958
+ };
3959
+ },
3960
+ '<=': function _(b) {
3961
+ return function (a) {
3962
+ return a <= b;
3963
+ };
3964
+ },
3965
+ 'in': function _in(b) {
3966
+ return function (a) {
3967
+ return b && b.indexOf && b.indexOf(a) > -1;
3968
+ };
3969
+ },
3970
+ 'on': function on(b) {
3971
+ return function (a) {
3972
+ return a && a.indexOf && a.indexOf(b) > -1;
3973
+ };
3974
+ },
3975
+ 'notIn': function notIn(b) {
3976
+ return function (a) {
3977
+ return !condition["in"](b)(a);
3978
+ };
3979
+ },
3980
+ 'notOn': function notOn(b) {
3981
+ return function (a) {
3982
+ return !condition.on(b)(a);
3983
+ };
3984
+ },
3985
+ 'between': function between(b) {
3986
+ return function (a) {
3987
+ return a > b[0] && a < b[1];
3988
+ };
3989
+ },
3990
+ 'notBetween': function notBetween(b) {
3991
+ return function (a) {
3992
+ return a < b[0] || a > b[1];
3993
+ };
3994
+ }
3995
+ };
3925
3996
  function useLoader(Handler) {
3926
3997
  extend(Handler.prototype, {
3927
3998
  nextRefresh: function nextRefresh(fn) {
@@ -4055,7 +4126,7 @@ function useLoader(Handler) {
4055
4126
  };
4056
4127
 
4057
4128
  rules.map(function (_rule, index) {
4058
- if (parent && (is.String(_rule) || is.Undef(_rule))) return;
4129
+ if (parent && !is.Object(_rule)) return;
4059
4130
  if (!_this6.pageEnd && !parent && index >= _this6.first) return;
4060
4131
 
4061
4132
  if (_rule.__fc__ && _rule.__fc__.root === rules && _this6.ctxs[_rule.__fc__.id]) {
@@ -4182,10 +4253,7 @@ function useLoader(Handler) {
4182
4253
 
4183
4254
  var _loop = function _loop(i) {
4184
4255
  var control = controls[i],
4185
- handleFn = control.handle || function (val) {
4186
- return val === control.value;
4187
- };
4188
-
4256
+ handleFn = control.handle || (condition[control.condition || '=='] || condition['=='])(control.value);
4189
4257
  if (!is.trueArray(control.rule)) return "continue";
4190
4258
 
4191
4259
  var data = _objectSpread2(_objectSpread2({}, control), {}, {
@@ -4217,7 +4285,8 @@ function useLoader(Handler) {
4217
4285
  prepend = _ref.prepend,
4218
4286
  append = _ref.append,
4219
4287
  child = _ref.child,
4220
- ctrl = _ref.ctrl;
4288
+ ctrl = _ref.ctrl,
4289
+ method = _ref.method;
4221
4290
 
4222
4291
  if (isHidden) {
4223
4292
  valid ? ctx.ctrlRule.push({
@@ -4226,7 +4295,21 @@ function useLoader(Handler) {
4226
4295
  valid: valid
4227
4296
  }) : ctx.ctrlRule.splice(ctx.ctrlRule.indexOf(ctrl), 1);
4228
4297
  hideLst[valid ? 'push' : 'unshift'](function () {
4229
- _this7.api.hidden(!valid, rule);
4298
+ if (method === 'disabled') {
4299
+ _this7.api.disabled(!valid, rule);
4300
+ } else if (method === 'display') {
4301
+ _this7.api.display(valid, rule);
4302
+ } else if (method === 'required') {
4303
+ rule.forEach(function (item) {
4304
+ _this7.api.setEffect(item, 'required', valid);
4305
+ });
4306
+
4307
+ if (!valid) {
4308
+ _this7.api.clearValidateState(rule);
4309
+ }
4310
+ } else {
4311
+ _this7.api.hidden(!valid, rule);
4312
+ }
4230
4313
  });
4231
4314
  return;
4232
4315
  }
@@ -4840,7 +4923,13 @@ function useEffect(Handler) {
4840
4923
  watchEffect: function watchEffect(ctx) {
4841
4924
  var _this3 = this;
4842
4925
 
4843
- var effect = {};
4926
+ var effect = {
4927
+ required: function required() {
4928
+ var _ctx$rule, _ctx$rule$effect;
4929
+
4930
+ return (hasProperty(ctx.rule, '$required') ? ctx.rule['$required'] : (_ctx$rule = ctx.rule) === null || _ctx$rule === void 0 ? void 0 : (_ctx$rule$effect = _ctx$rule.effect) === null || _ctx$rule$effect === void 0 ? void 0 : _ctx$rule$effect.required) || false;
4931
+ }
4932
+ };
4844
4933
  Object.keys(ctx.rule.effect || {}).forEach(function (k) {
4845
4934
  effect[k] = function () {
4846
4935
  return ctx.rule.effect[k];
@@ -4932,7 +5021,7 @@ function useEffect(Handler) {
4932
5021
  };
4933
5022
 
4934
5023
  data.mergeProp = function (prop) {
4935
- return mergeProps([prop], data.getProp());
5024
+ return mergeRule(data.getProp(), [prop]);
4936
5025
  };
4937
5026
  }
4938
5027
 
@@ -5471,18 +5560,19 @@ function FormCreateFactory(config) {
5471
5560
  var name;
5472
5561
 
5473
5562
  if (is.String(id)) {
5474
- name = toCase(id);
5563
+ name = id;
5475
5564
 
5476
5565
  if (component === undefined) {
5477
5566
  return components[name];
5478
5567
  }
5479
5568
  } else {
5480
- name = toCase(id.displayName || id.name);
5569
+ name = id.displayName || id.name;
5481
5570
  component = id;
5482
5571
  }
5483
5572
 
5484
5573
  if (!name || !component) return;
5485
5574
  components[name] = component;
5575
+ components[toCase(name)] = component;
5486
5576
  if (component.formCreateParser) parser(name, component.formCreateParser);
5487
5577
  }
5488
5578
 
@@ -6587,6 +6677,10 @@ function parseVal(val) {
6587
6677
  return {
6588
6678
  message: val
6589
6679
  };
6680
+ } else if (is.Undef(val)) {
6681
+ return {
6682
+ required: false
6683
+ };
6590
6684
  } else if (is.Function(val)) {
6591
6685
  return {
6592
6686
  validator: val
@@ -6621,7 +6715,7 @@ function install(FormCreate) {
6621
6715
  function elmFormCreate() {
6622
6716
  return FormCreateFactory({
6623
6717
  ui: 'element-ui',
6624
- version: '3.1.18',
6718
+ version: '3.1.19',
6625
6719
  manager: manager,
6626
6720
  extendApi: extendApi,
6627
6721
  install: install,