@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.
@@ -1741,7 +1741,7 @@
1741
1741
  return [this.max !== 0 && total >= this.max ? null : this.addIcon(key), this.min === 0 || total > this.min ? this.delIcon(index, key) : null];
1742
1742
  }
1743
1743
 
1744
- if (index >= this.min) {
1744
+ if (total > this.min) {
1745
1745
  return this.delIcon(index, key);
1746
1746
  }
1747
1747
  },
@@ -1783,6 +1783,7 @@
1783
1783
  return [vue.createVNode(script$2, null, null)];
1784
1784
  }
1785
1785
  }) : vue.createVNode("div", {
1786
+ "style": "width: 100%;",
1786
1787
  "key": 2
1787
1788
  }, [keys.map(function (key, index) {
1788
1789
  var _slot;
@@ -1792,7 +1793,6 @@
1792
1793
  options = _this9$cacheRule$key.options;
1793
1794
  return vue.createVNode(vue.resolveComponent("ElRow"), {
1794
1795
  "align": "middle",
1795
- "type": "flex",
1796
1796
  "key": key,
1797
1797
  "style": "border-bottom:1px dashed #DCDFE6;margin-bottom:10px;"
1798
1798
  }, {
@@ -2956,6 +2956,10 @@
2956
2956
  this.clearCacheAll();
2957
2957
  },
2958
2958
  clearCache: function clearCache(ctx) {
2959
+ if (ctx.rule.cache) {
2960
+ return;
2961
+ }
2962
+
2959
2963
  if (!this.cache[ctx.id]) {
2960
2964
  ctx.parent && this.clearCache(ctx.parent);
2961
2965
  return;
@@ -3820,7 +3824,7 @@
3820
3824
  var rule = _objectSpread2({}, this.rule);
3821
3825
 
3822
3826
  delete rule.children;
3823
- this.prop = mergeProps([rule].concat(_toConsumableArray(Object.keys(this.payload).map(function (k) {
3827
+ this.prop = mergeRule({}, [rule].concat(_toConsumableArray(Object.keys(this.payload).map(function (k) {
3824
3828
  return _this3.payload[k];
3825
3829
  })), [this.computed]));
3826
3830
  },
@@ -3926,6 +3930,73 @@
3926
3930
  }
3927
3931
  });
3928
3932
 
3933
+ var condition = {
3934
+ '==': function _(b) {
3935
+ return function (a) {
3936
+ return a === b;
3937
+ };
3938
+ },
3939
+ '!=': function _(b) {
3940
+ return function (a) {
3941
+ return a !== b;
3942
+ };
3943
+ },
3944
+ '<>': function _(b) {
3945
+ return function (a) {
3946
+ return a !== b;
3947
+ };
3948
+ },
3949
+ '>': function _(b) {
3950
+ return function (a) {
3951
+ return a > b;
3952
+ };
3953
+ },
3954
+ '>=': function _(b) {
3955
+ return function (a) {
3956
+ return a >= b;
3957
+ };
3958
+ },
3959
+ '<': function _(b) {
3960
+ return function (a) {
3961
+ return a < b;
3962
+ };
3963
+ },
3964
+ '<=': function _(b) {
3965
+ return function (a) {
3966
+ return a <= b;
3967
+ };
3968
+ },
3969
+ 'in': function _in(b) {
3970
+ return function (a) {
3971
+ return b && b.indexOf && b.indexOf(a) > -1;
3972
+ };
3973
+ },
3974
+ 'on': function on(b) {
3975
+ return function (a) {
3976
+ return a && a.indexOf && a.indexOf(b) > -1;
3977
+ };
3978
+ },
3979
+ 'notIn': function notIn(b) {
3980
+ return function (a) {
3981
+ return !condition["in"](b)(a);
3982
+ };
3983
+ },
3984
+ 'notOn': function notOn(b) {
3985
+ return function (a) {
3986
+ return !condition.on(b)(a);
3987
+ };
3988
+ },
3989
+ 'between': function between(b) {
3990
+ return function (a) {
3991
+ return a > b[0] && a < b[1];
3992
+ };
3993
+ },
3994
+ 'notBetween': function notBetween(b) {
3995
+ return function (a) {
3996
+ return a < b[0] || a > b[1];
3997
+ };
3998
+ }
3999
+ };
3929
4000
  function useLoader(Handler) {
3930
4001
  extend(Handler.prototype, {
3931
4002
  nextRefresh: function nextRefresh(fn) {
@@ -4059,7 +4130,7 @@
4059
4130
  };
4060
4131
 
4061
4132
  rules.map(function (_rule, index) {
4062
- if (parent && (is.String(_rule) || is.Undef(_rule))) return;
4133
+ if (parent && !is.Object(_rule)) return;
4063
4134
  if (!_this6.pageEnd && !parent && index >= _this6.first) return;
4064
4135
 
4065
4136
  if (_rule.__fc__ && _rule.__fc__.root === rules && _this6.ctxs[_rule.__fc__.id]) {
@@ -4186,10 +4257,7 @@
4186
4257
 
4187
4258
  var _loop = function _loop(i) {
4188
4259
  var control = controls[i],
4189
- handleFn = control.handle || function (val) {
4190
- return val === control.value;
4191
- };
4192
-
4260
+ handleFn = control.handle || (condition[control.condition || '=='] || condition['=='])(control.value);
4193
4261
  if (!is.trueArray(control.rule)) return "continue";
4194
4262
 
4195
4263
  var data = _objectSpread2(_objectSpread2({}, control), {}, {
@@ -4221,7 +4289,8 @@
4221
4289
  prepend = _ref.prepend,
4222
4290
  append = _ref.append,
4223
4291
  child = _ref.child,
4224
- ctrl = _ref.ctrl;
4292
+ ctrl = _ref.ctrl,
4293
+ method = _ref.method;
4225
4294
 
4226
4295
  if (isHidden) {
4227
4296
  valid ? ctx.ctrlRule.push({
@@ -4230,7 +4299,21 @@
4230
4299
  valid: valid
4231
4300
  }) : ctx.ctrlRule.splice(ctx.ctrlRule.indexOf(ctrl), 1);
4232
4301
  hideLst[valid ? 'push' : 'unshift'](function () {
4233
- _this7.api.hidden(!valid, rule);
4302
+ if (method === 'disabled') {
4303
+ _this7.api.disabled(!valid, rule);
4304
+ } else if (method === 'display') {
4305
+ _this7.api.display(valid, rule);
4306
+ } else if (method === 'required') {
4307
+ rule.forEach(function (item) {
4308
+ _this7.api.setEffect(item, 'required', valid);
4309
+ });
4310
+
4311
+ if (!valid) {
4312
+ _this7.api.clearValidateState(rule);
4313
+ }
4314
+ } else {
4315
+ _this7.api.hidden(!valid, rule);
4316
+ }
4234
4317
  });
4235
4318
  return;
4236
4319
  }
@@ -4844,7 +4927,13 @@
4844
4927
  watchEffect: function watchEffect(ctx) {
4845
4928
  var _this3 = this;
4846
4929
 
4847
- var effect = {};
4930
+ var effect = {
4931
+ required: function required() {
4932
+ var _ctx$rule, _ctx$rule$effect;
4933
+
4934
+ 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;
4935
+ }
4936
+ };
4848
4937
  Object.keys(ctx.rule.effect || {}).forEach(function (k) {
4849
4938
  effect[k] = function () {
4850
4939
  return ctx.rule.effect[k];
@@ -4936,7 +5025,7 @@
4936
5025
  };
4937
5026
 
4938
5027
  data.mergeProp = function (prop) {
4939
- return mergeProps([prop], data.getProp());
5028
+ return mergeRule(data.getProp(), [prop]);
4940
5029
  };
4941
5030
  }
4942
5031
 
@@ -5475,18 +5564,19 @@
5475
5564
  var name;
5476
5565
 
5477
5566
  if (is.String(id)) {
5478
- name = toCase(id);
5567
+ name = id;
5479
5568
 
5480
5569
  if (component === undefined) {
5481
5570
  return components[name];
5482
5571
  }
5483
5572
  } else {
5484
- name = toCase(id.displayName || id.name);
5573
+ name = id.displayName || id.name;
5485
5574
  component = id;
5486
5575
  }
5487
5576
 
5488
5577
  if (!name || !component) return;
5489
5578
  components[name] = component;
5579
+ components[toCase(name)] = component;
5490
5580
  if (component.formCreateParser) parser(name, component.formCreateParser);
5491
5581
  }
5492
5582
 
@@ -6591,6 +6681,10 @@
6591
6681
  return {
6592
6682
  message: val
6593
6683
  };
6684
+ } else if (is.Undef(val)) {
6685
+ return {
6686
+ required: false
6687
+ };
6594
6688
  } else if (is.Function(val)) {
6595
6689
  return {
6596
6690
  validator: val
@@ -6625,7 +6719,7 @@
6625
6719
  function elmFormCreate() {
6626
6720
  return FormCreateFactory({
6627
6721
  ui: 'element-ui',
6628
- version: '3.1.18',
6722
+ version: '3.1.19',
6629
6723
  manager: manager,
6630
6724
  extendApi: extendApi,
6631
6725
  install: install,