@form-create/element-ui 3.1.18 → 3.1.20

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.20
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;
@@ -3223,7 +3227,15 @@
3223
3227
  return function () {
3224
3228
  var cache = _this4.getCache(ctx);
3225
3229
 
3226
- return cache && cache.apply(void 0, arguments);
3230
+ if (cache) {
3231
+ return cache.apply(void 0, arguments);
3232
+ }
3233
+
3234
+ var _vn = _this4.renderCtx(ctx, ctx.parent);
3235
+
3236
+ if (_vn) {
3237
+ return _vn();
3238
+ }
3227
3239
  };
3228
3240
  } catch (e) {
3229
3241
  console.error(e);
@@ -3820,7 +3832,7 @@
3820
3832
  var rule = _objectSpread2({}, this.rule);
3821
3833
 
3822
3834
  delete rule.children;
3823
- this.prop = mergeProps([rule].concat(_toConsumableArray(Object.keys(this.payload).map(function (k) {
3835
+ this.prop = mergeRule({}, [rule].concat(_toConsumableArray(Object.keys(this.payload).map(function (k) {
3824
3836
  return _this3.payload[k];
3825
3837
  })), [this.computed]));
3826
3838
  },
@@ -3926,6 +3938,73 @@
3926
3938
  }
3927
3939
  });
3928
3940
 
3941
+ var condition = {
3942
+ '==': function _(b) {
3943
+ return function (a) {
3944
+ return a === b;
3945
+ };
3946
+ },
3947
+ '!=': function _(b) {
3948
+ return function (a) {
3949
+ return a !== b;
3950
+ };
3951
+ },
3952
+ '<>': function _(b) {
3953
+ return function (a) {
3954
+ return a !== b;
3955
+ };
3956
+ },
3957
+ '>': function _(b) {
3958
+ return function (a) {
3959
+ return a > b;
3960
+ };
3961
+ },
3962
+ '>=': function _(b) {
3963
+ return function (a) {
3964
+ return a >= b;
3965
+ };
3966
+ },
3967
+ '<': function _(b) {
3968
+ return function (a) {
3969
+ return a < b;
3970
+ };
3971
+ },
3972
+ '<=': function _(b) {
3973
+ return function (a) {
3974
+ return a <= b;
3975
+ };
3976
+ },
3977
+ 'in': function _in(b) {
3978
+ return function (a) {
3979
+ return b && b.indexOf && b.indexOf(a) > -1;
3980
+ };
3981
+ },
3982
+ 'on': function on(b) {
3983
+ return function (a) {
3984
+ return a && a.indexOf && a.indexOf(b) > -1;
3985
+ };
3986
+ },
3987
+ 'notIn': function notIn(b) {
3988
+ return function (a) {
3989
+ return !condition["in"](b)(a);
3990
+ };
3991
+ },
3992
+ 'notOn': function notOn(b) {
3993
+ return function (a) {
3994
+ return !condition.on(b)(a);
3995
+ };
3996
+ },
3997
+ 'between': function between(b) {
3998
+ return function (a) {
3999
+ return a > b[0] && a < b[1];
4000
+ };
4001
+ },
4002
+ 'notBetween': function notBetween(b) {
4003
+ return function (a) {
4004
+ return a < b[0] || a > b[1];
4005
+ };
4006
+ }
4007
+ };
3929
4008
  function useLoader(Handler) {
3930
4009
  extend(Handler.prototype, {
3931
4010
  nextRefresh: function nextRefresh(fn) {
@@ -4059,7 +4138,7 @@
4059
4138
  };
4060
4139
 
4061
4140
  rules.map(function (_rule, index) {
4062
- if (parent && (is.String(_rule) || is.Undef(_rule))) return;
4141
+ if (parent && !is.Object(_rule)) return;
4063
4142
  if (!_this6.pageEnd && !parent && index >= _this6.first) return;
4064
4143
 
4065
4144
  if (_rule.__fc__ && _rule.__fc__.root === rules && _this6.ctxs[_rule.__fc__.id]) {
@@ -4186,10 +4265,7 @@
4186
4265
 
4187
4266
  var _loop = function _loop(i) {
4188
4267
  var control = controls[i],
4189
- handleFn = control.handle || function (val) {
4190
- return val === control.value;
4191
- };
4192
-
4268
+ handleFn = control.handle || (condition[control.condition || '=='] || condition['=='])(control.value);
4193
4269
  if (!is.trueArray(control.rule)) return "continue";
4194
4270
 
4195
4271
  var data = _objectSpread2(_objectSpread2({}, control), {}, {
@@ -4221,7 +4297,8 @@
4221
4297
  prepend = _ref.prepend,
4222
4298
  append = _ref.append,
4223
4299
  child = _ref.child,
4224
- ctrl = _ref.ctrl;
4300
+ ctrl = _ref.ctrl,
4301
+ method = _ref.method;
4225
4302
 
4226
4303
  if (isHidden) {
4227
4304
  valid ? ctx.ctrlRule.push({
@@ -4230,7 +4307,21 @@
4230
4307
  valid: valid
4231
4308
  }) : ctx.ctrlRule.splice(ctx.ctrlRule.indexOf(ctrl), 1);
4232
4309
  hideLst[valid ? 'push' : 'unshift'](function () {
4233
- _this7.api.hidden(!valid, rule);
4310
+ if (method === 'disabled') {
4311
+ _this7.api.disabled(!valid, rule);
4312
+ } else if (method === 'display') {
4313
+ _this7.api.display(valid, rule);
4314
+ } else if (method === 'required') {
4315
+ rule.forEach(function (item) {
4316
+ _this7.api.setEffect(item, 'required', valid);
4317
+ });
4318
+
4319
+ if (!valid) {
4320
+ _this7.api.clearValidateState(rule);
4321
+ }
4322
+ } else {
4323
+ _this7.api.hidden(!valid, rule);
4324
+ }
4234
4325
  });
4235
4326
  return;
4236
4327
  }
@@ -4844,7 +4935,13 @@
4844
4935
  watchEffect: function watchEffect(ctx) {
4845
4936
  var _this3 = this;
4846
4937
 
4847
- var effect = {};
4938
+ var effect = {
4939
+ required: function required() {
4940
+ var _ctx$rule, _ctx$rule$effect;
4941
+
4942
+ 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;
4943
+ }
4944
+ };
4848
4945
  Object.keys(ctx.rule.effect || {}).forEach(function (k) {
4849
4946
  effect[k] = function () {
4850
4947
  return ctx.rule.effect[k];
@@ -4936,7 +5033,7 @@
4936
5033
  };
4937
5034
 
4938
5035
  data.mergeProp = function (prop) {
4939
- return mergeProps([prop], data.getProp());
5036
+ return mergeRule(data.getProp(), [prop]);
4940
5037
  };
4941
5038
  }
4942
5039
 
@@ -5475,18 +5572,19 @@
5475
5572
  var name;
5476
5573
 
5477
5574
  if (is.String(id)) {
5478
- name = toCase(id);
5575
+ name = id;
5479
5576
 
5480
5577
  if (component === undefined) {
5481
5578
  return components[name];
5482
5579
  }
5483
5580
  } else {
5484
- name = toCase(id.displayName || id.name);
5581
+ name = id.displayName || id.name;
5485
5582
  component = id;
5486
5583
  }
5487
5584
 
5488
5585
  if (!name || !component) return;
5489
5586
  components[name] = component;
5587
+ components[toCase(name)] = component;
5490
5588
  if (component.formCreateParser) parser(name, component.formCreateParser);
5491
5589
  }
5492
5590
 
@@ -6591,6 +6689,10 @@
6591
6689
  return {
6592
6690
  message: val
6593
6691
  };
6692
+ } else if (is.Undef(val)) {
6693
+ return {
6694
+ required: false
6695
+ };
6594
6696
  } else if (is.Function(val)) {
6595
6697
  return {
6596
6698
  validator: val
@@ -6625,7 +6727,7 @@
6625
6727
  function elmFormCreate() {
6626
6728
  return FormCreateFactory({
6627
6729
  ui: 'element-ui',
6628
- version: '3.1.18',
6730
+ version: '3.1.20',
6629
6731
  manager: manager,
6630
6732
  extendApi: extendApi,
6631
6733
  install: install,