shineout 1.10.9 → 1.10.12-beta.1

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
@@ -19,8 +19,6 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
19
19
 
20
20
  var _func = require("../utils/func");
21
21
 
22
- var _shallowEqual = _interopRequireDefault(require("../utils/shallowEqual"));
23
-
24
22
  var _strings = require("../utils/strings");
25
23
 
26
24
  var _types = require("./types");
@@ -97,11 +95,14 @@ var _default = (0, _func.curry)(function (options, Origin) {
97
95
  var _proto = _class.prototype;
98
96
 
99
97
  _proto.componentDidMount = function componentDidMount() {
98
+ this.datum.setLock(false);
100
99
  this.prevValues = this.props[key];
101
100
  };
102
101
 
103
102
  _proto.componentDidUpdate = function componentDidUpdate(prevProps) {
104
103
  // update datum.onchange
104
+ this.datum.setLock(false);
105
+
105
106
  if (prevProps.onChange !== this.props.onChange) {
106
107
  this.datum.onChange = this.props.onChange;
107
108
  }
@@ -127,6 +128,7 @@ var _default = (0, _func.curry)(function (options, Origin) {
127
128
 
128
129
  if (type === 'form' && values !== this.prevValues) {
129
130
  this.setValue(this.props.initValidate ? undefined : _types.IGNORE_VALIDATE);
131
+ this.datum.setLock(true);
130
132
  this.prevValues = values;
131
133
  }
132
134
 
@@ -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.12-beta.1' }
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.12-beta.1'
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) {
@@ -18119,11 +18139,10 @@ __webpack_require__.r(__webpack_exports__);
18119
18139
  /* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! prop-types */ "prop-types");
18120
18140
  /* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(prop_types__WEBPACK_IMPORTED_MODULE_7__);
18121
18141
  /* harmony import */ var _utils_func__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../utils/func */ "./src/utils/func.js");
18122
- /* harmony import */ var _utils_shallowEqual__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../utils/shallowEqual */ "./src/utils/shallowEqual.js");
18123
- /* harmony import */ var _utils_strings__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../utils/strings */ "./src/utils/strings.js");
18124
- /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./types */ "./src/Datum/types.js");
18125
- /* harmony import */ var _List__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./List */ "./src/Datum/List.js");
18126
- /* harmony import */ var _Form__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./Form */ "./src/Datum/Form.js");
18142
+ /* harmony import */ var _utils_strings__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../utils/strings */ "./src/utils/strings.js");
18143
+ /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./types */ "./src/Datum/types.js");
18144
+ /* harmony import */ var _List__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./List */ "./src/Datum/List.js");
18145
+ /* harmony import */ var _Form__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./Form */ "./src/Datum/Form.js");
18127
18146
 
18128
18147
 
18129
18148
 
@@ -18169,10 +18188,9 @@ function _createSuper2(Derived) {
18169
18188
 
18170
18189
 
18171
18190
 
18172
-
18173
18191
  var types = {
18174
- form: _Form__WEBPACK_IMPORTED_MODULE_13__["default"],
18175
- list: _List__WEBPACK_IMPORTED_MODULE_12__["default"]
18192
+ form: _Form__WEBPACK_IMPORTED_MODULE_12__["default"],
18193
+ list: _List__WEBPACK_IMPORTED_MODULE_11__["default"]
18176
18194
  };
18177
18195
  /* harmony default export */ __webpack_exports__["default"] = (Object(_utils_func__WEBPACK_IMPORTED_MODULE_8__["curry"])(function (options, Origin) {
18178
18196
  var _class, _temp;
@@ -18224,8 +18242,8 @@ var types = {
18224
18242
  ops[key] = props[key];
18225
18243
  }
18226
18244
 
18227
- if ("default".concat(Object(_utils_strings__WEBPACK_IMPORTED_MODULE_10__["capitalize"])(key)) in props) {
18228
- ops["default".concat(Object(_utils_strings__WEBPACK_IMPORTED_MODULE_10__["capitalize"])(key))] = props["default".concat(Object(_utils_strings__WEBPACK_IMPORTED_MODULE_10__["capitalize"])(key))];
18245
+ if ("default".concat(Object(_utils_strings__WEBPACK_IMPORTED_MODULE_9__["capitalize"])(key)) in props) {
18246
+ ops["default".concat(Object(_utils_strings__WEBPACK_IMPORTED_MODULE_9__["capitalize"])(key))] = props["default".concat(Object(_utils_strings__WEBPACK_IMPORTED_MODULE_9__["capitalize"])(key))];
18229
18247
  }
18230
18248
 
18231
18249
  _this.datum = new Datum(Object.assign(ops, datum));
@@ -18241,12 +18259,15 @@ var types = {
18241
18259
  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
18260
  key: "componentDidMount",
18243
18261
  value: function componentDidMount() {
18262
+ this.datum.setLock(false);
18244
18263
  this.prevValues = this.props[key];
18245
18264
  }
18246
18265
  }, {
18247
18266
  key: "componentDidUpdate",
18248
18267
  value: function componentDidUpdate(prevProps) {
18249
18268
  // update datum.onchange
18269
+ this.datum.setLock(false);
18270
+
18250
18271
  if (prevProps.onChange !== this.props.onChange) {
18251
18272
  this.datum.onChange = this.props.onChange;
18252
18273
  }
@@ -18274,11 +18295,12 @@ var types = {
18274
18295
  var values = this.props[key];
18275
18296
 
18276
18297
  if (type === 'form' && values !== this.prevValues) {
18277
- this.setValue(this.props.initValidate ? undefined : _types__WEBPACK_IMPORTED_MODULE_11__["IGNORE_VALIDATE"]);
18298
+ this.setValue(this.props.initValidate ? undefined : _types__WEBPACK_IMPORTED_MODULE_10__["IGNORE_VALIDATE"]);
18299
+ this.datum.setLock(true);
18278
18300
  this.prevValues = values;
18279
18301
  }
18280
18302
 
18281
- if (type === 'list') this.setValue(_types__WEBPACK_IMPORTED_MODULE_11__["WITH_OUT_DISPATCH"]); // delete props[key]
18303
+ if (type === 'list') this.setValue(_types__WEBPACK_IMPORTED_MODULE_10__["WITH_OUT_DISPATCH"]); // delete props[key]
18282
18304
 
18283
18305
  return (
18284
18306
  /*#__PURE__*/
@@ -18287,7 +18309,7 @@ var types = {
18287
18309
  __self: this,
18288
18310
  __source: {
18289
18311
  fileName: _jsxFileName,
18290
- lineNumber: 93,
18312
+ lineNumber: 95,
18291
18313
  columnNumber: 14
18292
18314
  }
18293
18315
  }))
@@ -61399,7 +61421,7 @@ __webpack_require__.r(__webpack_exports__);
61399
61421
 
61400
61422
  /* harmony default export */ __webpack_exports__["default"] = ({
61401
61423
  utils: _utils__WEBPACK_IMPORTED_MODULE_0__,
61402
- version: '1.10.9'
61424
+ version: '1.10.12-beta.1'
61403
61425
  });
61404
61426
 
61405
61427