shineout 1.10.8 → 1.10.11

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.
@@ -31,7 +31,7 @@ var _styles = require("./styles");
31
31
 
32
32
  var _config = require("../config");
33
33
 
34
- var _classname = _interopRequireDefault(require("../utils/classname"));
34
+ var _classname = require("../utils/classname");
35
35
 
36
36
  var Button =
37
37
  /*#__PURE__*/
@@ -104,7 +104,7 @@ function (_PureComponent) {
104
104
  type: htmlType,
105
105
  className: className
106
106
  }), loading && _react.default.createElement("span", {
107
- className: (0, _styles.buttonClass)((0, _classname.default)('spin'))
107
+ className: (0, _styles.buttonClass)((0, _classname.getDirectionClass)('spin'))
108
108
  }, _react.default.createElement(_Spin.default, {
109
109
  size: 12,
110
110
  name: "ring",
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/Tree.js CHANGED
@@ -69,6 +69,12 @@ function () {
69
69
 
70
70
  var _proto = _default.prototype;
71
71
 
72
+ _proto.updateDisabled = function updateDisabled(dis) {
73
+ this.disabled = dis || function () {
74
+ return false;
75
+ };
76
+ };
77
+
72
78
  _proto.bind = function bind(id, update) {
73
79
  this.events[id] = update;
74
80
  };
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
@@ -70,7 +70,11 @@ function (_PureComponent) {
70
70
 
71
71
  _proto.componentDidUpdate = function componentDidUpdate(prevProps) {
72
72
  this.scrollCheck();
73
- var resize = prevProps.data.length === 0 && this.props.data.length;
73
+ var resize = prevProps.data.length === 0 && this.props.data.length; // when resize
74
+
75
+ if (resize && this.body) this.handleScroll({
76
+ currentTarget: this.body
77
+ });
74
78
  var shouldResetColgroup = this.props.dataChangeResize && this.props.data !== prevProps.data;
75
79
 
76
80
  if (resize || shouldResetColgroup || !(0, _shallowEqual.compareColumns)(prevProps.columns, this.props.columns)) {
@@ -27,6 +27,8 @@ var _Spin = _interopRequireDefault(require("../Spin"));
27
27
 
28
28
  var _Checkbox = _interopRequireDefault(require("./Checkbox"));
29
29
 
30
+ var _types = require("../Datum/types");
31
+
30
32
  var loading = _react.default.createElement("span", {
31
33
  className: (0, _styles.treeClass)('icon-loading')
32
34
  }, _react.default.createElement(_Spin.default, {
@@ -46,11 +48,26 @@ function (_PureComponent) {
46
48
  _this.handleNodeClick = _this.handleNodeClick.bind((0, _assertThisInitialized2.default)((0, _assertThisInitialized2.default)(_this)));
47
49
  _this.handleNodeExpand = _this.handleNodeExpand.bind((0, _assertThisInitialized2.default)((0, _assertThisInitialized2.default)(_this)));
48
50
  _this.handleIndicatorClick = _this.handleIndicatorClick.bind((0, _assertThisInitialized2.default)((0, _assertThisInitialized2.default)(_this)));
51
+ _this.handleUpdate = _this.handleUpdate.bind((0, _assertThisInitialized2.default)((0, _assertThisInitialized2.default)(_this)));
49
52
  return _this;
50
53
  }
51
54
 
52
55
  var _proto = Content.prototype;
53
56
 
57
+ _proto.componentDidMount = function componentDidMount() {
58
+ _PureComponent.prototype.componentDidMount.call(this);
59
+
60
+ var datum = this.props.datum;
61
+ datum.subscribe(_types.CHANGE_TOPIC, this.handleUpdate);
62
+ };
63
+
64
+ _proto.componentWillUnmount = function componentWillUnmount() {
65
+ _PureComponent.prototype.componentWillUnmount.call(this);
66
+
67
+ var datum = this.props.datum;
68
+ datum.unsubscribe(_types.CHANGE_TOPIC, this.handleUpdate);
69
+ };
70
+
54
71
  _proto.handleNodeClick = function handleNodeClick() {
55
72
  var _this$props = this.props,
56
73
  data = _this$props.data,
@@ -67,6 +84,10 @@ function (_PureComponent) {
67
84
  }
68
85
  };
69
86
 
87
+ _proto.handleUpdate = function handleUpdate() {
88
+ this.forceUpdate();
89
+ };
90
+
70
91
  _proto.handleNodeExpand = function handleNodeExpand() {
71
92
  var _this$props2 = this.props,
72
93
  data = _this$props2.data,
@@ -176,7 +197,8 @@ Content.propTypes = {
176
197
  setFetching: _propTypes.default.func,
177
198
  fetching: _propTypes.default.bool,
178
199
  doubleClickExpand: _propTypes.default.bool,
179
- iconClass: _propTypes.default.string
200
+ iconClass: _propTypes.default.string,
201
+ datum: _propTypes.default.object
180
202
  };
181
203
  var _default = Content;
182
204
  exports.default = _default;
@@ -55,7 +55,8 @@ function datum(Origin) {
55
55
 
56
56
  _proto.componentDidUpdate = function componentDidUpdate(prevProps) {
57
57
  if (!(0, _shallowEqual.default)(prevProps.data, this.props.data)) {
58
- this.datum.setData(this.props.data);
58
+ this.datum.updateDisabled(this.props.disabled);
59
+ this.datum.setData(this.props.data, true);
59
60
  this.forceUpdate();
60
61
  }
61
62
  };
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.8' }
4
+ export default { utils, version: '1.10.11' }
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.8'
227
+ version: '1.10.11'
228
228
  };
229
229
  exports.default = _default;