@xatlas/rainbow-core 2.3.6 → 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.
@@ -3470,6 +3470,7 @@ function list_toPrimitive(t, r) { if ("object" != list_typeof(t) || !t) return t
3470
3470
  }
3471
3471
  if (!this.parentIds && this.mode === 'page') {
3472
3472
  if (external_root_qs_commonjs2_qs_commonjs_qs_amd_qs_default.a.stringify(this.query) !== external_root_qs_commonjs2_qs_commonjs_qs_amd_qs_default.a.stringify(this.$route.query)) {
3473
+ this.query = list_objectSpread(list_objectSpread({}, this.query), this.$route.query);
3473
3474
  this.$router.push({
3474
3475
  query: this.query
3475
3476
  });
@@ -5983,10 +5984,24 @@ function form_base_toPrimitive(t, r) { if ("object" != form_base_typeof(t) || !t
5983
5984
  };
5984
5985
  },
5985
5986
  created: function created() {
5987
+ var _this = this;
5986
5988
  // this.actionModel = { ...this.defaultValues, ...this.actionModel }
5987
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
+ };
5988
6003
  for (var key in this.defaultValues) {
5989
- this.actionModel[key] === undefined && this.$set(this.actionModel, key, this.defaultValues[key]);
6004
+ _loop(key);
5990
6005
  }
5991
6006
  }
5992
6007
  },
@@ -6056,26 +6071,26 @@ function form_base_toPrimitive(t, r) { if ("object" != form_base_typeof(t) || !t
6056
6071
  // this.$emit('change', this.actionModel)
6057
6072
  },
6058
6073
  handleItemFill: function handleItemFill(fills) {
6059
- var _this = this;
6074
+ var _this2 = this;
6060
6075
  fills.forEach(function (item) {
6061
- return _this.setModel(item.name, item.value);
6076
+ return _this2.setModel(item.name, item.value);
6062
6077
  });
6063
6078
  // this.$emit('change', this.actionModel)
6064
6079
  },
6065
6080
  handleSubmit: function handleSubmit() {
6066
- var _this2 = this;
6081
+ var _this3 = this;
6067
6082
  return form_base_asyncToGenerator( /*#__PURE__*/form_base_regeneratorRuntime().mark(function _callee() {
6068
6083
  return form_base_regeneratorRuntime().wrap(function _callee$(_context) {
6069
6084
  while (1) switch (_context.prev = _context.next) {
6070
6085
  case 0:
6071
- if (!_this2.$refs.form) {
6086
+ if (!_this3.$refs.form) {
6072
6087
  _context.next = 3;
6073
6088
  break;
6074
6089
  }
6075
6090
  _context.next = 3;
6076
- return _this2.$refs.form.validate();
6091
+ return _this3.$refs.form.validate();
6077
6092
  case 3:
6078
- _this2.handleCommit();
6093
+ _this3.handleCommit();
6079
6094
  case 4:
6080
6095
  case "end":
6081
6096
  return _context.stop();
@@ -6084,25 +6099,25 @@ function form_base_toPrimitive(t, r) { if ("object" != form_base_typeof(t) || !t
6084
6099
  }))();
6085
6100
  },
6086
6101
  handleCommit: function handleCommit() {
6087
- var _this3 = this;
6102
+ var _this4 = this;
6088
6103
  return form_base_asyncToGenerator( /*#__PURE__*/form_base_regeneratorRuntime().mark(function _callee2() {
6089
- var data, _this3$params, _this3$params2, valuesName, columns;
6104
+ var data, _this4$params, _this4$params2, valuesName, columns;
6090
6105
  return form_base_regeneratorRuntime().wrap(function _callee2$(_context2) {
6091
6106
  while (1) switch (_context2.prev = _context2.next) {
6092
6107
  case 0:
6093
- if (Array.isArray(_this3.actionModel)) {
6094
- data = _this3.actionModel;
6108
+ if (Array.isArray(_this4.actionModel)) {
6109
+ data = _this4.actionModel;
6095
6110
  } else {
6096
- _this3$params = _this3.params, _this3$params2 = _this3$params === void 0 ? {} : _this3$params, valuesName = _this3$params2.valuesName;
6097
- 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), [{
6098
6113
  name: valuesName
6099
- }]) : _this3.columns;
6114
+ }]) : _this4.columns;
6100
6115
  data = Object.fromEntries(columns.map(function (c) {
6101
- 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];
6102
6117
  return [c.name, value];
6103
6118
  }));
6104
6119
  }
6105
- _this3.$emit('commit', data);
6120
+ _this4.$emit('commit', data);
6106
6121
  case 2:
6107
6122
  case "end":
6108
6123
  return _context2.stop();