@form-create/element-ui 3.1.17 → 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,6 +1,6 @@
1
1
  /*!
2
- * @form-create/element-ui v3.1.17
3
- * (c) 2018-2022 xaboy
2
+ * @form-create/element-ui v3.1.19
3
+ * (c) 2018-2023 xaboy
4
4
  * Github https://github.com/xaboy/form-create
5
5
  * Released under the MIT License.
6
6
  */
@@ -1161,6 +1161,14 @@
1161
1161
  var Upload = vue.defineComponent({
1162
1162
  name: NAME$4,
1163
1163
  inheritAttrs: false,
1164
+ formCreateParser: {
1165
+ toFormValue: function toFormValue(value) {
1166
+ return toArray(value);
1167
+ },
1168
+ toValue: function toValue(formValue, ctx) {
1169
+ return ctx.prop.props.limit === 1 ? formValue[0] || '' : formValue;
1170
+ }
1171
+ },
1164
1172
  props: {
1165
1173
  previewMask: undefined,
1166
1174
  onPreview: Function,
@@ -1181,11 +1189,6 @@
1181
1189
  watch: {
1182
1190
  modelValue: function modelValue(n) {
1183
1191
  this.fileList = toArray(n).map(parseFile);
1184
- },
1185
- limit: function limit(n, o) {
1186
- if (o === 1 || n === 1) {
1187
- this.update();
1188
- }
1189
1192
  }
1190
1193
  },
1191
1194
  methods: {
@@ -1203,7 +1206,7 @@
1203
1206
  }).filter(function (url) {
1204
1207
  return url !== undefined;
1205
1208
  });
1206
- this.$emit('update:modelValue', this.limit === 1 ? files[0] || '' : files);
1209
+ this.$emit('update:modelValue', files);
1207
1210
  },
1208
1211
  handleCancel: function handleCancel() {
1209
1212
  this.previewVisible = false;
@@ -1738,7 +1741,7 @@
1738
1741
  return [this.max !== 0 && total >= this.max ? null : this.addIcon(key), this.min === 0 || total > this.min ? this.delIcon(index, key) : null];
1739
1742
  }
1740
1743
 
1741
- if (index >= this.min) {
1744
+ if (total > this.min) {
1742
1745
  return this.delIcon(index, key);
1743
1746
  }
1744
1747
  },
@@ -1780,6 +1783,7 @@
1780
1783
  return [vue.createVNode(script$2, null, null)];
1781
1784
  }
1782
1785
  }) : vue.createVNode("div", {
1786
+ "style": "width: 100%;",
1783
1787
  "key": 2
1784
1788
  }, [keys.map(function (key, index) {
1785
1789
  var _slot;
@@ -1789,7 +1793,6 @@
1789
1793
  options = _this9$cacheRule$key.options;
1790
1794
  return vue.createVNode(vue.resolveComponent("ElRow"), {
1791
1795
  "align": "middle",
1792
- "type": "flex",
1793
1796
  "key": key,
1794
1797
  "style": "border-bottom:1px dashed #DCDFE6;margin-bottom:10px;"
1795
1798
  }, {
@@ -1953,8 +1956,8 @@
1953
1956
  return;
1954
1957
  }
1955
1958
 
1956
- if (vm.ctx.formCreateInject) {
1957
- return vm.ctx.formCreateInject;
1959
+ if (vm.props.formCreateInject) {
1960
+ return vm.props.formCreateInject;
1958
1961
  }
1959
1962
 
1960
1963
  if (vm.parent) {
@@ -2953,6 +2956,10 @@
2953
2956
  this.clearCacheAll();
2954
2957
  },
2955
2958
  clearCache: function clearCache(ctx) {
2959
+ if (ctx.rule.cache) {
2960
+ return;
2961
+ }
2962
+
2956
2963
  if (!this.cache[ctx.id]) {
2957
2964
  ctx.parent && this.clearCache(ctx.parent);
2958
2965
  return;
@@ -3817,7 +3824,7 @@
3817
3824
  var rule = _objectSpread2({}, this.rule);
3818
3825
 
3819
3826
  delete rule.children;
3820
- 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) {
3821
3828
  return _this3.payload[k];
3822
3829
  })), [this.computed]));
3823
3830
  },
@@ -3923,6 +3930,73 @@
3923
3930
  }
3924
3931
  });
3925
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
+ };
3926
4000
  function useLoader(Handler) {
3927
4001
  extend(Handler.prototype, {
3928
4002
  nextRefresh: function nextRefresh(fn) {
@@ -4056,7 +4130,7 @@
4056
4130
  };
4057
4131
 
4058
4132
  rules.map(function (_rule, index) {
4059
- if (parent && (is.String(_rule) || is.Undef(_rule))) return;
4133
+ if (parent && !is.Object(_rule)) return;
4060
4134
  if (!_this6.pageEnd && !parent && index >= _this6.first) return;
4061
4135
 
4062
4136
  if (_rule.__fc__ && _rule.__fc__.root === rules && _this6.ctxs[_rule.__fc__.id]) {
@@ -4183,10 +4257,7 @@
4183
4257
 
4184
4258
  var _loop = function _loop(i) {
4185
4259
  var control = controls[i],
4186
- handleFn = control.handle || function (val) {
4187
- return val === control.value;
4188
- };
4189
-
4260
+ handleFn = control.handle || (condition[control.condition || '=='] || condition['=='])(control.value);
4190
4261
  if (!is.trueArray(control.rule)) return "continue";
4191
4262
 
4192
4263
  var data = _objectSpread2(_objectSpread2({}, control), {}, {
@@ -4218,7 +4289,8 @@
4218
4289
  prepend = _ref.prepend,
4219
4290
  append = _ref.append,
4220
4291
  child = _ref.child,
4221
- ctrl = _ref.ctrl;
4292
+ ctrl = _ref.ctrl,
4293
+ method = _ref.method;
4222
4294
 
4223
4295
  if (isHidden) {
4224
4296
  valid ? ctx.ctrlRule.push({
@@ -4227,7 +4299,21 @@
4227
4299
  valid: valid
4228
4300
  }) : ctx.ctrlRule.splice(ctx.ctrlRule.indexOf(ctrl), 1);
4229
4301
  hideLst[valid ? 'push' : 'unshift'](function () {
4230
- _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
+ }
4231
4317
  });
4232
4318
  return;
4233
4319
  }
@@ -4841,7 +4927,13 @@
4841
4927
  watchEffect: function watchEffect(ctx) {
4842
4928
  var _this3 = this;
4843
4929
 
4844
- 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
+ };
4845
4937
  Object.keys(ctx.rule.effect || {}).forEach(function (k) {
4846
4938
  effect[k] = function () {
4847
4939
  return ctx.rule.effect[k];
@@ -4933,7 +5025,7 @@
4933
5025
  };
4934
5026
 
4935
5027
  data.mergeProp = function (prop) {
4936
- return mergeProps([prop], data.getProp());
5028
+ return mergeRule(data.getProp(), [prop]);
4937
5029
  };
4938
5030
  }
4939
5031
 
@@ -5472,18 +5564,19 @@
5472
5564
  var name;
5473
5565
 
5474
5566
  if (is.String(id)) {
5475
- name = toCase(id);
5567
+ name = id;
5476
5568
 
5477
5569
  if (component === undefined) {
5478
5570
  return components[name];
5479
5571
  }
5480
5572
  } else {
5481
- name = toCase(id.displayName || id.name);
5573
+ name = id.displayName || id.name;
5482
5574
  component = id;
5483
5575
  }
5484
5576
 
5485
5577
  if (!name || !component) return;
5486
5578
  components[name] = component;
5579
+ components[toCase(name)] = component;
5487
5580
  if (component.formCreateParser) parser(name, component.formCreateParser);
5488
5581
  }
5489
5582
 
@@ -6588,6 +6681,10 @@
6588
6681
  return {
6589
6682
  message: val
6590
6683
  };
6684
+ } else if (is.Undef(val)) {
6685
+ return {
6686
+ required: false
6687
+ };
6591
6688
  } else if (is.Function(val)) {
6592
6689
  return {
6593
6690
  validator: val
@@ -6622,7 +6719,7 @@
6622
6719
  function elmFormCreate() {
6623
6720
  return FormCreateFactory({
6624
6721
  ui: 'element-ui',
6625
- version: '3.1.17',
6722
+ version: '3.1.19',
6626
6723
  manager: manager,
6627
6724
  extendApi: extendApi,
6628
6725
  install: install,