shineout 1.10.9 → 1.10.10

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.
package/css/Datum/Form.js CHANGED
@@ -51,6 +51,7 @@ function () {
51
51
  this.$events = {}; // handle global errors
52
52
 
53
53
  this.$errors = {};
54
+ this.updateLock = false;
54
55
  this.deepSetOptions = {
55
56
  removeUndefined: removeUndefined,
56
57
  forceSet: true
@@ -73,6 +74,10 @@ function () {
73
74
  this.dispatch(_types.RESET_TOPIC);
74
75
  };
75
76
 
77
+ _proto.setLock = function setLock(lock) {
78
+ this.updateLock = lock;
79
+ };
80
+
76
81
  _proto.get = function get(name) {
77
82
  var _this = this;
78
83
 
@@ -243,13 +248,20 @@ function () {
243
248
  return (0, _clone.deepClone)(this.$values);
244
249
  };
245
250
 
246
- _proto.setValue = function setValue(values, type, forceSet) {
251
+ _proto.setValue = function setValue(v, type, forceSet) {
247
252
  var _this6 = this;
248
253
 
249
- if (values === void 0) {
250
- values = {};
254
+ if (v === void 0) {
255
+ v = {};
251
256
  }
252
257
 
258
+ var values = (0, _is.isObject)(v) ? v : {};
259
+
260
+ if (values !== v) {
261
+ console.warn('Form value must be an Object');
262
+ } // 兼容 value 传入 null 等错误等值
263
+
264
+
253
265
  if (!forceSet && (0, _deepEql.default)(values, this.$values)) return;
254
266
  this.$values = (0, _clone.deepClone)(values); // wait render end.
255
267
 
@@ -299,7 +311,9 @@ function () {
299
311
  delete this.$inputNames[name];
300
312
  delete this.$validator[name];
301
313
  delete this.$errors[name];
302
- delete this.$defaultValues[name];
314
+ delete this.$defaultValues[name]; // when setData due to unmount not delete value
315
+
316
+ if (this.updateLock) return;
303
317
  if (!(0, _objects.deepHas)(this.$values, name)) return;
304
318
  (0, _objects.deepRemove)(this.$values, name);
305
319
 
package/css/Datum/List.js CHANGED
@@ -124,6 +124,10 @@ function () {
124
124
  return flatten;
125
125
  };
126
126
 
127
+ _proto.setLock = function setLock(lock) {
128
+ this.updateLock = lock;
129
+ };
130
+
127
131
  _proto.add = function add(data, _, childrenKey, unshift) {
128
132
  var _this2 = this;
129
133
 
package/css/Datum/hoc.js CHANGED
@@ -97,11 +97,14 @@ var _default = (0, _func.curry)(function (options, Origin) {
97
97
  var _proto = _class.prototype;
98
98
 
99
99
  _proto.componentDidMount = function componentDidMount() {
100
+ this.datum.setLock(false);
100
101
  this.prevValues = this.props[key];
101
102
  };
102
103
 
103
104
  _proto.componentDidUpdate = function componentDidUpdate(prevProps) {
104
105
  // update datum.onchange
106
+ this.datum.setLock(false);
107
+
105
108
  if (prevProps.onChange !== this.props.onChange) {
106
109
  this.datum.onChange = this.props.onChange;
107
110
  }
@@ -126,7 +129,9 @@ var _default = (0, _func.curry)(function (options, Origin) {
126
129
  var values = this.props[key];
127
130
 
128
131
  if (type === 'form' && values !== this.prevValues) {
132
+ debugger;
129
133
  this.setValue(this.props.initValidate ? undefined : _types.IGNORE_VALIDATE);
134
+ this.datum.setLock(true);
130
135
  this.prevValues = values;
131
136
  }
132
137
 
@@ -388,7 +388,7 @@ export interface FormFieldSetProps<Value> {
388
388
  *
389
389
  * default:
390
390
  */
391
- empty?: (onInsert: Value) => ReactNode;
391
+ empty?: (onInsert: (value: Value) => void) => ReactNode;
392
392
 
393
393
  /**
394
394
  * Validation rules
package/css/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  // Created by scripts/src-index.js.
2
2
  import * as utils from './utils'
3
3
 
4
- export default { utils, version: '1.10.9' }
4
+ export default { utils, version: '1.10.10' }
5
5
  export { utils }
6
6
  export { setLocale } from './locale'
7
7
  export { color, style } from './utils/expose'
package/css/index.js CHANGED
@@ -224,6 +224,6 @@ exports.Upload = _Upload.default;
224
224
  // Created by scripts/src-index.js.
225
225
  var _default = {
226
226
  utils: utils,
227
- version: '1.10.9'
227
+ version: '1.10.10'
228
228
  };
229
229
  exports.default = _default;
package/dist/shineout.js CHANGED
@@ -16847,6 +16847,7 @@ function () {
16847
16847
  this.$events = {}; // handle global errors
16848
16848
 
16849
16849
  this.$errors = {};
16850
+ this.updateLock = false;
16850
16851
  this.deepSetOptions = {
16851
16852
  removeUndefined: removeUndefined,
16852
16853
  forceSet: true
@@ -16869,6 +16870,11 @@ function () {
16869
16870
  this.handleChange();
16870
16871
  this.dispatch(_types__WEBPACK_IMPORTED_MODULE_10__["RESET_TOPIC"]);
16871
16872
  }
16873
+ }, {
16874
+ key: "setLock",
16875
+ value: function setLock(lock) {
16876
+ this.updateLock = lock;
16877
+ }
16872
16878
  }, {
16873
16879
  key: "get",
16874
16880
  value: function get(name) {
@@ -17058,9 +17064,16 @@ function () {
17058
17064
  value: function setValue() {
17059
17065
  var _this6 = this;
17060
17066
 
17061
- var values = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
17067
+ var v = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
17062
17068
  var type = arguments.length > 1 ? arguments[1] : undefined;
17063
17069
  var forceSet = arguments.length > 2 ? arguments[2] : undefined;
17070
+ var values = Object(_utils_is__WEBPACK_IMPORTED_MODULE_8__["isObject"])(v) ? v : {};
17071
+
17072
+ if (values !== v) {
17073
+ console.warn('Form value must be an Object');
17074
+ } // 兼容 value 传入 null 等错误等值
17075
+
17076
+
17064
17077
  if (!forceSet && deep_eql__WEBPACK_IMPORTED_MODULE_4___default()(values, this.$values)) return;
17065
17078
  this.$values = Object(_utils_clone__WEBPACK_IMPORTED_MODULE_6__["deepClone"])(values); // wait render end.
17066
17079
 
@@ -17112,7 +17125,9 @@ function () {
17112
17125
  delete this.$inputNames[name];
17113
17126
  delete this.$validator[name];
17114
17127
  delete this.$errors[name];
17115
- delete this.$defaultValues[name];
17128
+ delete this.$defaultValues[name]; // when setData due to unmount not delete value
17129
+
17130
+ if (this.updateLock) return;
17116
17131
  if (!Object(_utils_objects__WEBPACK_IMPORTED_MODULE_7__["deepHas"])(this.$values, name)) return;
17117
17132
  Object(_utils_objects__WEBPACK_IMPORTED_MODULE_7__["deepRemove"])(this.$values, name);
17118
17133
 
@@ -17361,6 +17376,11 @@ function () {
17361
17376
  if (keys.length) this.$cachedFlatten.set(key, flatten);
17362
17377
  return flatten;
17363
17378
  }
17379
+ }, {
17380
+ key: "setLock",
17381
+ value: function setLock(lock) {
17382
+ this.updateLock = lock;
17383
+ }
17364
17384
  }, {
17365
17385
  key: "add",
17366
17386
  value: function add(data, _, childrenKey, unshift) {
@@ -18241,12 +18261,15 @@ var types = {
18241
18261
  Object(_Users_10008649_Desktop_workspace_fe_shein_shineout_node_modules_babel_preset_react_app_node_modules_babel_runtime_helpers_esm_createClass__WEBPACK_IMPORTED_MODULE_2__["default"])(_class, [{
18242
18262
  key: "componentDidMount",
18243
18263
  value: function componentDidMount() {
18264
+ this.datum.setLock(false);
18244
18265
  this.prevValues = this.props[key];
18245
18266
  }
18246
18267
  }, {
18247
18268
  key: "componentDidUpdate",
18248
18269
  value: function componentDidUpdate(prevProps) {
18249
18270
  // update datum.onchange
18271
+ this.datum.setLock(false);
18272
+
18250
18273
  if (prevProps.onChange !== this.props.onChange) {
18251
18274
  this.datum.onChange = this.props.onChange;
18252
18275
  }
@@ -18274,7 +18297,9 @@ var types = {
18274
18297
  var values = this.props[key];
18275
18298
 
18276
18299
  if (type === 'form' && values !== this.prevValues) {
18300
+ debugger;
18277
18301
  this.setValue(this.props.initValidate ? undefined : _types__WEBPACK_IMPORTED_MODULE_11__["IGNORE_VALIDATE"]);
18302
+ this.datum.setLock(true);
18278
18303
  this.prevValues = values;
18279
18304
  }
18280
18305
 
@@ -18287,7 +18312,7 @@ var types = {
18287
18312
  __self: this,
18288
18313
  __source: {
18289
18314
  fileName: _jsxFileName,
18290
- lineNumber: 93,
18315
+ lineNumber: 97,
18291
18316
  columnNumber: 14
18292
18317
  }
18293
18318
  }))
@@ -61399,7 +61424,7 @@ __webpack_require__.r(__webpack_exports__);
61399
61424
 
61400
61425
  /* harmony default export */ __webpack_exports__["default"] = ({
61401
61426
  utils: _utils__WEBPACK_IMPORTED_MODULE_0__,
61402
- version: '1.10.9'
61427
+ version: '1.10.10'
61403
61428
  });
61404
61429
 
61405
61430