@xatlas/rainbow-core 2.3.7 → 2.3.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.
@@ -5984,10 +5984,24 @@ function form_base_toPrimitive(t, r) { if ("object" != form_base_typeof(t) || !t
5984
5984
  };
5985
5985
  },
5986
5986
  created: function created() {
5987
+ var _this = this;
5987
5988
  // this.actionModel = { ...this.defaultValues, ...this.actionModel }
5988
5989
  if (this.defaultValues) {
5990
+ var _loop = function _loop(key) {
5991
+ var attr = _this.columns.find(function (c) {
5992
+ return c.name === key;
5993
+ }) || undefined;
5994
+ var required = (attr === null || attr === void 0 ? void 0 : attr.required) || false;
5995
+ if (attr !== null && attr !== void 0 && attr.configs.length) {
5996
+ var configs = Object.fromEntries(attr.configs.map(function (c) {
5997
+ return [c.key, c.value];
5998
+ }));
5999
+ required = configs && configs.required ? configs.required === '1' : attr === null || attr === void 0 ? void 0 : attr.required;
6000
+ }
6001
+ if (_this.actionModel[key] === undefined || _this.actionModel[key] === '' && required) _this.$set(_this.actionModel, key, _this.defaultValues[key]);
6002
+ };
5989
6003
  for (var key in this.defaultValues) {
5990
- this.actionModel[key] === undefined && this.$set(this.actionModel, key, this.defaultValues[key]);
6004
+ _loop(key);
5991
6005
  }
5992
6006
  }
5993
6007
  },
@@ -6057,26 +6071,26 @@ function form_base_toPrimitive(t, r) { if ("object" != form_base_typeof(t) || !t
6057
6071
  // this.$emit('change', this.actionModel)
6058
6072
  },
6059
6073
  handleItemFill: function handleItemFill(fills) {
6060
- var _this = this;
6074
+ var _this2 = this;
6061
6075
  fills.forEach(function (item) {
6062
- return _this.setModel(item.name, item.value);
6076
+ return _this2.setModel(item.name, item.value);
6063
6077
  });
6064
6078
  // this.$emit('change', this.actionModel)
6065
6079
  },
6066
6080
  handleSubmit: function handleSubmit() {
6067
- var _this2 = this;
6081
+ var _this3 = this;
6068
6082
  return form_base_asyncToGenerator( /*#__PURE__*/form_base_regeneratorRuntime().mark(function _callee() {
6069
6083
  return form_base_regeneratorRuntime().wrap(function _callee$(_context) {
6070
6084
  while (1) switch (_context.prev = _context.next) {
6071
6085
  case 0:
6072
- if (!_this2.$refs.form) {
6086
+ if (!_this3.$refs.form) {
6073
6087
  _context.next = 3;
6074
6088
  break;
6075
6089
  }
6076
6090
  _context.next = 3;
6077
- return _this2.$refs.form.validate();
6091
+ return _this3.$refs.form.validate();
6078
6092
  case 3:
6079
- _this2.handleCommit();
6093
+ _this3.handleCommit();
6080
6094
  case 4:
6081
6095
  case "end":
6082
6096
  return _context.stop();
@@ -6085,25 +6099,25 @@ function form_base_toPrimitive(t, r) { if ("object" != form_base_typeof(t) || !t
6085
6099
  }))();
6086
6100
  },
6087
6101
  handleCommit: function handleCommit() {
6088
- var _this3 = this;
6102
+ var _this4 = this;
6089
6103
  return form_base_asyncToGenerator( /*#__PURE__*/form_base_regeneratorRuntime().mark(function _callee2() {
6090
- var data, _this3$params, _this3$params2, valuesName, columns;
6104
+ var data, _this4$params, _this4$params2, valuesName, columns;
6091
6105
  return form_base_regeneratorRuntime().wrap(function _callee2$(_context2) {
6092
6106
  while (1) switch (_context2.prev = _context2.next) {
6093
6107
  case 0:
6094
- if (Array.isArray(_this3.actionModel)) {
6095
- data = _this3.actionModel;
6108
+ if (Array.isArray(_this4.actionModel)) {
6109
+ data = _this4.actionModel;
6096
6110
  } else {
6097
- _this3$params = _this3.params, _this3$params2 = _this3$params === void 0 ? {} : _this3$params, valuesName = _this3$params2.valuesName;
6098
- columns = valuesName ? [].concat(base_toConsumableArray(_this3.columns), [{
6111
+ _this4$params = _this4.params, _this4$params2 = _this4$params === void 0 ? {} : _this4$params, valuesName = _this4$params2.valuesName;
6112
+ columns = valuesName ? [].concat(base_toConsumableArray(_this4.columns), [{
6099
6113
  name: valuesName
6100
- }]) : _this3.columns;
6114
+ }]) : _this4.columns;
6101
6115
  data = Object.fromEntries(columns.map(function (c) {
6102
- var value = _this3.actionModel[c.name] === undefined ? null : _this3.actionModel[c.name];
6116
+ var value = _this4.actionModel[c.name] === undefined ? null : _this4.actionModel[c.name];
6103
6117
  return [c.name, value];
6104
6118
  }));
6105
6119
  }
6106
- _this3.$emit('commit', data);
6120
+ _this4.$emit('commit', data);
6107
6121
  case 2:
6108
6122
  case "end":
6109
6123
  return _context2.stop();