@form-create/element-ui 3.2.7 → 3.2.8

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.7
2
+ * @form-create/element-ui v3.2.8
3
3
  * (c) 2018-2024 xaboy
4
4
  * Github https://github.com/xaboy/form-create
5
5
  * Released under the MIT License.
@@ -281,11 +281,12 @@
281
281
  }
282
282
 
283
283
  return vue.createVNode(Type, {
284
- "value": customValue.value,
285
- "label": customValue.value
284
+ "value": customValue.value || undefined,
285
+ "label": customValue.value || undefined
286
286
  }, {
287
287
  "default": function _default() {
288
288
  return [vue.createVNode(vue.resolveComponent("ElInput"), {
289
+ "size": "small",
289
290
  "modelValue": customValue.value,
290
291
  "onUpdate:modelValue": updateCustomValue
291
292
  }, null)];
@@ -1068,11 +1069,13 @@
1068
1069
  }
1069
1070
 
1070
1071
  return vue.createVNode(Type, {
1071
- "value": customValue.value,
1072
- "label": customValue.value
1072
+ "checked": false,
1073
+ "value": customValue.value || undefined,
1074
+ "label": customValue.value || undefined
1073
1075
  }, {
1074
1076
  "default": function _default() {
1075
1077
  return [vue.createVNode(vue.resolveComponent("ElInput"), {
1078
+ "size": "small",
1076
1079
  "modelValue": customValue.value,
1077
1080
  "onUpdate:modelValue": updateCustomValue
1078
1081
  }, null)];
@@ -1825,13 +1828,18 @@
1825
1828
  }, null);
1826
1829
  },
1827
1830
  changeSort: function changeSort(index, sort) {
1831
+ var _this10 = this;
1832
+
1828
1833
  var a = this.sort[index];
1829
1834
  this.sort[index] = this.sort[index + sort];
1830
1835
  this.sort[index + sort] = a;
1836
+ this.formCreateInject.subForm(this.sort.map(function (k) {
1837
+ return _this10.cacheRule[k].$f;
1838
+ }));
1831
1839
  this.formData(0);
1832
1840
  },
1833
1841
  makeIcon: function makeIcon(total, index, key) {
1834
- var _this10 = this;
1842
+ var _this11 = this;
1835
1843
 
1836
1844
  if (this.$slots.button) {
1837
1845
  return this.$slots.button({
@@ -1840,7 +1848,7 @@
1840
1848
  vm: this,
1841
1849
  key: key,
1842
1850
  del: function del() {
1843
- return _this10.del(index, key);
1851
+ return _this11.del(index, key);
1844
1852
  },
1845
1853
  add: this.add
1846
1854
  });
@@ -1876,12 +1884,12 @@
1876
1884
  }
1877
1885
  },
1878
1886
  created: function created() {
1879
- var _this11 = this;
1887
+ var _this12 = this;
1880
1888
 
1881
1889
  vue.watch(function () {
1882
- return _objectSpread2({}, _this11.cacheRule);
1890
+ return _objectSpread2({}, _this12.cacheRule);
1883
1891
  }, function (n) {
1884
- _this11.sort = Object.keys(n);
1892
+ _this12.sort = Object.keys(n);
1885
1893
  }, {
1886
1894
  immediate: true
1887
1895
  });
@@ -1896,7 +1904,7 @@
1896
1904
  }
1897
1905
  },
1898
1906
  render: function render() {
1899
- var _this12 = this;
1907
+ var _this13 = this;
1900
1908
 
1901
1909
  var keys = this.sort;
1902
1910
  var button = this.button;
@@ -1910,10 +1918,10 @@
1910
1918
  "class": "_fc-group-plus-minus _fc-group-add fc-clock",
1911
1919
  "onClick": this.add
1912
1920
  }, null) : keys.map(function (key, index) {
1913
- var _this12$cacheRule$key = _this12.cacheRule[key],
1914
- rule = _this12$cacheRule$key.rule,
1915
- options = _this12$cacheRule$key.options;
1916
- var btn = button && !disabled ? _this12.makeIcon(keys.length, index, key) : [];
1921
+ var _this13$cacheRule$key = _this13.cacheRule[key],
1922
+ rule = _this13$cacheRule$key.rule,
1923
+ options = _this13$cacheRule$key.options;
1924
+ var btn = button && !disabled ? _this13.makeIcon(keys.length, index, key) : [];
1917
1925
  return vue.createVNode("div", {
1918
1926
  "class": "_fc-group-container",
1919
1927
  "key": key
@@ -1922,20 +1930,20 @@
1922
1930
  }, {
1923
1931
  disabled: disabled,
1924
1932
  'onUpdate:modelValue': function onUpdateModelValue(formData) {
1925
- return _this12.formData(key, formData);
1933
+ return _this13.formData(key, formData);
1926
1934
  },
1927
1935
  'onEmit-event': function onEmitEvent(name) {
1928
1936
  for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
1929
1937
  args[_key - 1] = arguments[_key];
1930
1938
  }
1931
1939
 
1932
- return _this12.emitEvent(name, args, index, key);
1940
+ return _this13.emitEvent(name, args, index, key);
1933
1941
  },
1934
1942
  'onUpdate:api': function onUpdateApi($f) {
1935
- return _this12.add$f(index, key, $f);
1943
+ return _this13.add$f(index, key, $f);
1936
1944
  },
1937
1945
  inFor: true,
1938
- modelValue: _this12.field ? _defineProperty({}, _this12.field, _this12._value(_this12.modelValue[index])) : _this12.modelValue[index],
1946
+ modelValue: _this13.field ? _defineProperty({}, _this13.field, _this13._value(_this13.modelValue[index])) : _this13.modelValue[index],
1939
1947
  rule: rule,
1940
1948
  option: options,
1941
1949
  extendOption: true
@@ -2084,7 +2092,7 @@
2084
2092
  return str.replace(str[0], str[0].toLocaleUpperCase());
2085
2093
  }
2086
2094
 
2087
- var getRuleInject = function getRuleInject(vm, parent) {
2095
+ var _getGroupInject = function getGroupInject(vm, parent) {
2088
2096
  if (!vm || vm === parent) {
2089
2097
  return;
2090
2098
  }
@@ -2094,7 +2102,7 @@
2094
2102
  }
2095
2103
 
2096
2104
  if (vm.parent) {
2097
- return getRuleInject(vm.parent, parent);
2105
+ return _getGroupInject(vm.parent, parent);
2098
2106
  }
2099
2107
  };
2100
2108
 
@@ -2166,7 +2174,7 @@
2166
2174
 
2167
2175
  var addSubForm = function addSubForm() {
2168
2176
  if (parent) {
2169
- var _inject = getRuleInject(vm, parent);
2177
+ var _inject = _getGroupInject(vm, parent);
2170
2178
 
2171
2179
  if (_inject) {
2172
2180
  var sub;
@@ -2184,7 +2192,7 @@
2184
2192
  };
2185
2193
 
2186
2194
  var rmSubForm = function rmSubForm() {
2187
- var inject = getRuleInject(vm, parent);
2195
+ var inject = _getGroupInject(vm, parent);
2188
2196
 
2189
2197
  if (inject) {
2190
2198
  if (isMore) {
@@ -2202,33 +2210,36 @@
2202
2210
 
2203
2211
  var styleEl = null;
2204
2212
  vue.onBeforeMount(function () {
2205
- var content = '';
2206
- var globalClass = props.option && props.option.globalClass || {};
2207
- Object.keys(globalClass).forEach(function (k) {
2208
- var subCss = '';
2209
- globalClass[k].style && Object.keys(globalClass[k].style).forEach(function (key) {
2210
- subCss += toLine(key) + ':' + globalClass[k].style[key] + ';';
2213
+ vue.watchEffect(function () {
2214
+ var content = '';
2215
+ var globalClass = props.option && props.option.globalClass || {};
2216
+ Object.keys(globalClass).forEach(function (k) {
2217
+ var subCss = '';
2218
+ globalClass[k].style && Object.keys(globalClass[k].style).forEach(function (key) {
2219
+ subCss += toLine(key) + ':' + globalClass[k].style[key] + ';';
2220
+ });
2221
+
2222
+ if (globalClass[k].content) {
2223
+ subCss += globalClass[k].content + ';';
2224
+ }
2225
+
2226
+ if (subCss) {
2227
+ content += ".".concat(k, "{").concat(subCss, "}");
2228
+ }
2211
2229
  });
2212
2230
 
2213
- if (globalClass[k].content) {
2214
- subCss += globalClass[k].content + ';';
2231
+ if (props.option && props.option.style) {
2232
+ content += props.option.style;
2215
2233
  }
2216
2234
 
2217
- if (subCss) {
2218
- content += ".".concat(k, "{").concat(subCss, "}");
2235
+ if (!styleEl) {
2236
+ styleEl = document.createElement('style');
2237
+ styleEl.type = 'text/css';
2238
+ document.head.appendChild(styleEl);
2219
2239
  }
2220
- });
2221
-
2222
- if (props.option && props.option.style) {
2223
- content += props.option.style;
2224
- }
2225
2240
 
2226
- if (content) {
2227
- styleEl = document.createElement('style');
2228
- styleEl.type = 'text/css';
2229
- styleEl.innerHTML = content;
2230
- document.head.appendChild(styleEl);
2231
- }
2241
+ styleEl.innerHTML = content || '';
2242
+ });
2232
2243
  });
2233
2244
  var emit$topForm = debounce(function () {
2234
2245
  fc.bus.$emit('$loadData.$topForm');
@@ -2318,6 +2329,9 @@
2318
2329
  parent: parent ? vue.markRaw(parent) : parent,
2319
2330
  fapi: vue.markRaw(fapi)
2320
2331
  }, vue.toRefs(data)), {}, {
2332
+ getGroupInject: function getGroupInject() {
2333
+ return _getGroupInject(vm, parent);
2334
+ },
2321
2335
  refresh: function refresh() {
2322
2336
  ++data.unique;
2323
2337
  },
@@ -2423,7 +2437,7 @@
2423
2437
 
2424
2438
  var keyAttrs = ['type', 'slot', 'emitPrefix', 'value', 'name', 'native', 'hidden', 'display', 'inject', 'options', 'emit', 'link', 'prefix', 'suffix', 'update', 'sync', 'optionsTo', 'key', 'slotUpdate', 'computed', 'preview', 'component', 'cache', 'modelEmit'];
2425
2439
  var arrayAttrs = ['validate', 'children', 'control'];
2426
- var normalAttrs = ['effect'];
2440
+ var normalAttrs = ['effect', 'deep'];
2427
2441
  function attrs() {
2428
2442
  return [].concat(keyAttrs, _toConsumableArray(normalMerge), _toConsumableArray(toArrayMerge), _toConsumableArray(functionalMerge), arrayAttrs, normalAttrs);
2429
2443
  }
@@ -3009,6 +3023,31 @@
3009
3023
  return allSubForm();
3010
3024
  },
3011
3025
 
3026
+ get siblings() {
3027
+ var inject = h.vm.setupState.getGroupInject();
3028
+
3029
+ if (inject) {
3030
+ var subForm = inject.getSubForm();
3031
+
3032
+ if (Array.isArray(subForm)) {
3033
+ return _toConsumableArray(subForm);
3034
+ }
3035
+ }
3036
+
3037
+ return undefined;
3038
+ },
3039
+
3040
+ get index() {
3041
+ var siblings = api.siblings;
3042
+
3043
+ if (siblings) {
3044
+ var idx = siblings.indexOf(api);
3045
+ return idx > -1 ? idx : undefined;
3046
+ }
3047
+
3048
+ return undefined;
3049
+ },
3050
+
3012
3051
  formData: function formData(fields) {
3013
3052
  return tidyFields(fields).reduce(function (initial, id) {
3014
3053
  var ctx = h.getFieldCtx(id);
@@ -3324,6 +3363,9 @@
3324
3363
  ctx.rule.value = copy(ctx.defaultValue);
3325
3364
  });
3326
3365
  });
3366
+ vue.nextTick(function () {
3367
+ api.clearValidateState();
3368
+ });
3327
3369
  },
3328
3370
  method: function method(id, name) {
3329
3371
  var el = api.el(id);
@@ -5556,7 +5598,9 @@
5556
5598
  return or ? false : valid;
5557
5599
  };
5558
5600
 
5559
- return checkCondition(item);
5601
+ var _val = checkCondition(item);
5602
+
5603
+ return item.invert === true ? !_val : _val;
5560
5604
  } else if (is.Function(item)) {
5561
5605
  fn = function fn() {
5562
5606
  return item(_this.api.form, _this.api);
@@ -6987,6 +7031,8 @@
6987
7031
  unwatch();
6988
7032
 
6989
7033
  _this5.bus.$emit('$loadData.$var.' + key);
7034
+
7035
+ return val;
6990
7036
  }
6991
7037
 
6992
7038
  val = invoke(function () {
@@ -7632,11 +7678,12 @@
7632
7678
  var rule = ctx.prop;
7633
7679
  var uni = "".concat(this.key).concat(ctx.key);
7634
7680
  var col = rule.col;
7635
- var isTitle = this.isTitle(rule);
7681
+ var isTitle = this.isTitle(rule) && rule.wrap.title !== false;
7636
7682
  var labelWidth = !col.labelWidth && !isTitle ? 0 : col.labelWidth;
7637
7683
  var _this$rule$props = this.rule.props,
7638
7684
  inline = _this$rule$props.inline,
7639
7685
  _col = _this$rule$props.col;
7686
+ delete rule.wrap.title;
7640
7687
  var item = isFalse(rule.wrap.show) ? children : this.$r(mergeProps([rule.wrap, {
7641
7688
  props: _objectSpread2(_objectSpread2({
7642
7689
  labelWidth: labelWidth === void 0 ? labelWidth : toString(labelWidth),
@@ -8160,7 +8207,7 @@
8160
8207
  function elmFormCreate() {
8161
8208
  return FormCreateFactory({
8162
8209
  ui: 'element-ui',
8163
- version: '3.2.7',
8210
+ version: '3.2.8',
8164
8211
  manager: manager,
8165
8212
  extendApi: extendApi,
8166
8213
  install: install,