shineout 1.10.12-beta.2 → 1.10.12

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.
@@ -88,6 +88,7 @@ var _default = (0, _func.curry)(function (Origin) {
88
88
  _this.handleError = _this.handleError.bind((0, _assertThisInitialized2.default)((0, _assertThisInitialized2.default)(_this)));
89
89
  _this.validate = _this.validate.bind((0, _assertThisInitialized2.default)((0, _assertThisInitialized2.default)(_this)));
90
90
  _this.validateHook = _this.validateHook.bind((0, _assertThisInitialized2.default)((0, _assertThisInitialized2.default)(_this)));
91
+ _this.forceValidate = _this.forceValidate.bind((0, _assertThisInitialized2.default)((0, _assertThisInitialized2.default)(_this)));
91
92
  _this.lastValue = formDatum && name ? formDatum.get(name) || {} : {};
92
93
  return _this;
93
94
  }
@@ -338,6 +339,10 @@ var _default = (0, _func.curry)(function (Origin) {
338
339
  if (fieldSetValidate) fieldSetValidate(true);
339
340
  };
340
341
 
342
+ _proto.forceValidate = function forceValidate() {
343
+ this.validate(this.props.value);
344
+ };
345
+
341
346
  _proto.handleUpdate = function handleUpdate(value, sn, type) {
342
347
  var _this5 = this;
343
348
 
@@ -400,7 +405,8 @@ var _default = (0, _func.curry)(function (Origin) {
400
405
  value: this.getValue(),
401
406
  onChange: this.handleChange,
402
407
  onDatumBind: this.handleDatumBind,
403
- validateHook: this.validateHook
408
+ validateHook: this.validateHook,
409
+ forceValidate: this.forceValidate
404
410
  }));
405
411
  };
406
412
 
@@ -207,14 +207,9 @@ function (_PureComponent) {
207
207
  cancelChange = _this$props6.cancelChange;
208
208
  if (cancelChange) cancelChange();
209
209
  var newVal = this.fixValue(value);
210
+ var canForceChange = !(clearToUndefined && newVal === '' && this.props.value === undefined);
211
+ if (canForceChange && forceChange && !this.invalidNumber(newVal)) forceChange(newVal);
210
212
  if (onBlur) onBlur(e);
211
- if (this.invalidNumber(newVal)) return;
212
-
213
- if (clearToUndefined && newVal === '' && this.props.value === undefined) {
214
- return;
215
- }
216
-
217
- if (forceChange) forceChange(newVal);
218
213
  };
219
214
 
220
215
  _proto.handleAutoSelect = function handleAutoSelect(event) {
@@ -366,6 +366,8 @@ function (_PureComponent) {
366
366
  this.setTop(scrollHeight, fullHeight, 1);
367
367
  return;
368
368
  }
369
+ } else {
370
+ return;
369
371
  }
370
372
  }
371
373
 
@@ -176,9 +176,10 @@ function (_PureComponent) {
176
176
  disabled = _this$props2.disabled,
177
177
  treeColumnsName = _this$props2.treeColumnsName,
178
178
  treeCheckAll = _this$props2.treeCheckAll;
179
+ var isEmpty = !(data && data.length);
179
180
  var align = col.align && "align-" + col.align;
180
181
  var ignoreBorderRight = this.rightBorderRecord[col.key] && 'ignore-right-border';
181
- var resize = level === 0 && columnResizable && col.columnResizable !== false ? _react.default.createElement("span", {
182
+ var resize = level === 0 && !isEmpty && columnResizable && col.columnResizable !== false ? _react.default.createElement("span", {
182
183
  onMouseDown: this.handleMouseDown,
183
184
  className: (0, _styles.tableClass)('resize-spanner')
184
185
  }) : null;
@@ -59,7 +59,11 @@ function (_Component) {
59
59
  };
60
60
 
61
61
  _proto.focus = function focus() {
62
- _element.focusElement.select(this.editElement);
62
+ var _this2 = this;
63
+
64
+ requestAnimationFrame(function () {
65
+ _element.focusElement.select(_this2.editElement);
66
+ });
63
67
  };
64
68
 
65
69
  _proto.bindElement = function bindElement(el) {
@@ -116,6 +116,7 @@ function (_PureComponent) {
116
116
  _this.removeValue = _this.removeValue.bind((0, _assertThisInitialized2.default)((0, _assertThisInitialized2.default)(_this)));
117
117
  _this.recoverValue = _this.recoverValue.bind((0, _assertThisInitialized2.default)((0, _assertThisInitialized2.default)(_this)));
118
118
  _this.validatorHandle = _this.validatorHandle.bind((0, _assertThisInitialized2.default)((0, _assertThisInitialized2.default)(_this)));
119
+ _this.updateValidate = _this.updateValidate.bind((0, _assertThisInitialized2.default)((0, _assertThisInitialized2.default)(_this)));
119
120
  _this.useValidator = _this.useValidator.bind((0, _assertThisInitialized2.default)((0, _assertThisInitialized2.default)(_this)));
120
121
  _this.handleFileDrop = _this.handleFileDrop.bind((0, _assertThisInitialized2.default)((0, _assertThisInitialized2.default)(_this)));
121
122
  _this.handleReplace = _this.handleReplace.bind((0, _assertThisInitialized2.default)((0, _assertThisInitialized2.default)(_this)));
@@ -167,6 +168,8 @@ function (_PureComponent) {
167
168
  };
168
169
 
169
170
  _proto.removeFile = function removeFile(id) {
171
+ var _this2 = this;
172
+
170
173
  var onErrorRemove = this.props.onErrorRemove;
171
174
  var file = this.state.files[id];
172
175
 
@@ -178,12 +181,14 @@ function (_PureComponent) {
178
181
  if (file.status === _request.ERROR && onErrorRemove) {
179
182
  onErrorRemove(file.xhr, file.blob, file);
180
183
  }
184
+
185
+ _this2.updateValidate();
181
186
  });
182
187
  }
183
188
  };
184
189
 
185
190
  _proto.removeValue = function removeValue(index) {
186
- var _this2 = this;
191
+ var _this3 = this;
187
192
 
188
193
  var _this$props = this.props,
189
194
  recoverAble = _this$props.recoverAble,
@@ -193,19 +198,19 @@ function (_PureComponent) {
193
198
  var current = this.props.value[index];
194
199
  var startRemove = typeof beforeRemove === 'function' ? beforeRemove(current) : Promise.resolve();
195
200
  startRemove.then(function () {
196
- _this2.setState((0, _immer.default)(function (draft) {
197
- draft.recycle.push(_this2.props.value[index]);
201
+ _this3.setState((0, _immer.default)(function (draft) {
202
+ draft.recycle.push(_this3.props.value[index]);
198
203
 
199
204
  if (typeof recoverAble === 'number' && draft.recycle.length > recoverAble) {
200
205
  draft.recycle.shift();
201
206
  }
202
207
  }));
203
208
 
204
- var value = (0, _immer.default)(_this2.props.value, function (draft) {
209
+ var value = (0, _immer.default)(_this3.props.value, function (draft) {
205
210
  draft.splice(index, 1);
206
211
  });
207
212
 
208
- _this2.props.onChange(value);
213
+ _this3.props.onChange(value);
209
214
  }).catch(function () {});
210
215
  };
211
216
 
@@ -314,7 +319,7 @@ function (_PureComponent) {
314
319
  var _addFile = (0, _asyncToGenerator2.default)(
315
320
  /*#__PURE__*/
316
321
  _regenerator.default.mark(function _callee2(e) {
317
- var _this3 = this;
322
+ var _this4 = this;
318
323
 
319
324
  var _this$props3, beforeUpload, value, limit, filesFilter, files, finishedCode, fileList, addLength, list, _loop, i, _ret;
320
325
 
@@ -360,7 +365,7 @@ function (_PureComponent) {
360
365
  files[id] = file; // eslint-disable-next-line no-await-in-loop
361
366
 
362
367
  _context2.next = 6;
363
- return _this3.useValidator(blob);
368
+ return _this4.useValidator(blob);
364
369
 
365
370
  case 6:
366
371
  error = _context2.sent;
@@ -370,7 +375,7 @@ function (_PureComponent) {
370
375
  break;
371
376
  }
372
377
 
373
- if (_this3.validatorHandle(error, file.blob)) {
378
+ if (_this4.validatorHandle(error, file.blob)) {
374
379
  _context2.next = 11;
375
380
  break;
376
381
  }
@@ -383,10 +388,10 @@ function (_PureComponent) {
383
388
  file.status = _request.ERROR;
384
389
 
385
390
  if (beforeUpload) {
386
- beforeUpload(blob, _this3.validatorHandle) // eslint-disable-next-line no-loop-func
391
+ beforeUpload(blob, _this4.validatorHandle) // eslint-disable-next-line no-loop-func
387
392
  .then(function (args) {
388
393
  if (finishedCode) {
389
- _this3.setState((0, _immer.default)(function (draft) {
394
+ _this4.setState((0, _immer.default)(function (draft) {
390
395
  draft.files[id] = Object.assign({}, draft.files[id], args);
391
396
  }));
392
397
  } else {
@@ -401,12 +406,12 @@ function (_PureComponent) {
401
406
 
402
407
  case 15:
403
408
  if (beforeUpload) {
404
- beforeUpload(blob, _this3.validatorHandle) // eslint-disable-next-line no-loop-func
409
+ beforeUpload(blob, _this4.validatorHandle) // eslint-disable-next-line no-loop-func
405
410
  .then(function (args) {
406
- if (args.status !== _request.ERROR) files[id].xhr = _this3.uploadFile(id, blob, args.data);
411
+ if (args.status !== _request.ERROR) files[id].xhr = _this4.uploadFile(id, blob, args.data);
407
412
 
408
413
  if (finishedCode) {
409
- _this3.setState((0, _immer.default)(function (draft) {
414
+ _this4.setState((0, _immer.default)(function (draft) {
410
415
  draft.files[id] = Object.assign({}, draft.files[id], args);
411
416
  }));
412
417
  } else {
@@ -415,7 +420,7 @@ function (_PureComponent) {
415
420
  }) // eslint-disable-next-line no-loop-func
416
421
  .catch(function () {
417
422
  if (finishedCode) {
418
- _this3.setState((0, _immer.default)(function (draft) {
423
+ _this4.setState((0, _immer.default)(function (draft) {
419
424
  delete draft.files[id];
420
425
  }));
421
426
  } else {
@@ -423,7 +428,7 @@ function (_PureComponent) {
423
428
  }
424
429
  });
425
430
  } else {
426
- files[id].xhr = _this3.uploadFile(id, blob);
431
+ files[id].xhr = _this4.uploadFile(id, blob);
427
432
  }
428
433
 
429
434
  case 16:
@@ -462,6 +467,8 @@ function (_PureComponent) {
462
467
  finishedCode = true;
463
468
  this.setState({
464
469
  files: files
470
+ }, function () {
471
+ _this4.updateValidate();
465
472
  });
466
473
 
467
474
  case 21:
@@ -480,7 +487,7 @@ function (_PureComponent) {
480
487
  }();
481
488
 
482
489
  _proto.uploadFile = function uploadFile(id, file, data) {
483
- var _this4 = this;
490
+ var _this5 = this;
484
491
 
485
492
  var _this$props4 = this.props,
486
493
  onSuccess = _this$props4.onSuccess,
@@ -514,14 +521,14 @@ function (_PureComponent) {
514
521
  throttle = false;
515
522
  }, 16);
516
523
 
517
- if (_this4.state.files[id]) {
518
- _this4.setState((0, _immer.default)(function (draft) {
524
+ if (_this5.state.files[id]) {
525
+ _this5.setState((0, _immer.default)(function (draft) {
519
526
  draft.files[id].process = percent;
520
527
  if (msg) draft.files[id].message = msg;
521
528
  }), // expose the file progress to Upload.Button
522
529
  function () {
523
530
  if (typeof _onProgress === 'function') {
524
- _onProgress(_this4.state.files[id]);
531
+ _onProgress(_this5.state.files[id]);
525
532
  }
526
533
  });
527
534
  }
@@ -529,7 +536,7 @@ function (_PureComponent) {
529
536
  onSuccess: onSuccess,
530
537
  onLoad: function onLoad(xhr) {
531
538
  if (!/^2|1223/.test(xhr.status)) {
532
- _this4.handleError(id, xhr, file);
539
+ _this5.handleError(id, xhr, file);
533
540
 
534
541
  return;
535
542
  }
@@ -543,26 +550,26 @@ function (_PureComponent) {
543
550
  }
544
551
 
545
552
  if (value instanceof Error) {
546
- _this4.setState((0, _immer.default)(function (draft) {
553
+ _this5.setState((0, _immer.default)(function (draft) {
547
554
  draft.files[id].status = _request.ERROR;
548
555
  draft.files[id].name = file.name;
549
556
  draft.files[id].message = value.message;
550
557
  }));
551
558
  } else {
552
- _this4.setState((0, _immer.default)(function (draft) {
559
+ _this5.setState((0, _immer.default)(function (draft) {
553
560
  delete draft.files[id];
554
561
  })); // add value
555
562
 
556
563
 
557
- var values = (0, _immer.default)(_this4.props.value, function (draft) {
564
+ var values = (0, _immer.default)(_this5.props.value, function (draft) {
558
565
  draft.push(value);
559
566
  });
560
567
 
561
- _this4.props.onChange(values);
568
+ _this5.props.onChange(values);
562
569
  }
563
570
  },
564
571
  onError: function onError(xhr) {
565
- return _this4.handleError(id, xhr, file);
572
+ return _this5.handleError(id, xhr, file);
566
573
  }
567
574
  };
568
575
 
@@ -581,11 +588,11 @@ function (_PureComponent) {
581
588
  };
582
589
 
583
590
  _proto.handleReplace = function handleReplace(files, index) {
584
- var _this5 = this;
591
+ var _this6 = this;
585
592
 
586
593
  this.removeValue(index);
587
594
  setTimeout(function () {
588
- _this5.addFile({
595
+ _this6.addFile({
589
596
  files: files,
590
597
  fromDragger: true
591
598
  });
@@ -593,6 +600,8 @@ function (_PureComponent) {
593
600
  };
594
601
 
595
602
  _proto.handleError = function handleError(id, xhr, file) {
603
+ var _this7 = this;
604
+
596
605
  var _this$props5 = this.props,
597
606
  onError = _this$props5.onError,
598
607
  onHttpError = _this$props5.onHttpError;
@@ -603,7 +612,14 @@ function (_PureComponent) {
603
612
  if (!draft.files[id]) return;
604
613
  draft.files[id].status = _request.ERROR;
605
614
  draft.files[id].message = message;
606
- }));
615
+ }), function () {
616
+ _this7.updateValidate();
617
+ });
618
+ };
619
+
620
+ _proto.updateValidate = function updateValidate() {
621
+ var forceValidate = this.props.forceValidate;
622
+ forceValidate();
607
623
  };
608
624
 
609
625
  _proto.renderHandle = function renderHandle() {
@@ -646,7 +662,7 @@ function (_PureComponent) {
646
662
  };
647
663
 
648
664
  _proto.render = function render() {
649
- var _this6 = this;
665
+ var _this8 = this;
650
666
 
651
667
  var _this$props7 = this.props,
652
668
  limit = _this$props7.limit,
@@ -697,7 +713,7 @@ function (_PureComponent) {
697
713
  accept: accept,
698
714
  dropData: i,
699
715
  disabled: disabled,
700
- onDrop: _this6.handleReplace
716
+ onDrop: _this8.handleReplace
701
717
  }, _react.default.createElement(ResultComponent, {
702
718
  renderContent: renderContent,
703
719
  value: v,
@@ -705,7 +721,7 @@ function (_PureComponent) {
705
721
  index: i,
706
722
  style: imageStyle,
707
723
  renderResult: renderResult,
708
- onRemove: _this6.getCanDelete(v, i) ? _this6.removeValue : undefined,
724
+ onRemove: _this8.getCanDelete(v, i) ? _this8.removeValue : undefined,
709
725
  removeConfirm: removeConfirm,
710
726
  onPreview: onPreview
711
727
  }));
@@ -714,7 +730,7 @@ function (_PureComponent) {
714
730
  key: id,
715
731
  id: id,
716
732
  style: imageStyle,
717
- onRemove: _this6.removeFile
733
+ onRemove: _this8.removeFile
718
734
  }));
719
735
  }), imageStyle && !leftHandler && this.renderHandle(), recoverAble && recycle.map(function (v, i) {
720
736
  return _react.default.createElement(ResultComponent, {
@@ -726,7 +742,7 @@ function (_PureComponent) {
726
742
  renderResult: renderResult,
727
743
  recoverAble: !!recoverAble,
728
744
  showRecover: recoverAble && limit > value.length,
729
- onRecover: _this6.recoverValue,
745
+ onRecover: _this8.recoverValue,
730
746
  style: imageStyle
731
747
  });
732
748
  })));
@@ -759,6 +775,7 @@ Upload.propTypes = {
759
775
  request: _propTypes.default.func,
760
776
  validateHook: _propTypes.default.func,
761
777
  validator: _propTypes.default.object,
778
+ forceValidate: _propTypes.default.func,
762
779
  value: _propTypes.default.array,
763
780
  customResult: _propTypes.default.oneOfType([_propTypes.default.element, _propTypes.default.func]),
764
781
  style: _propTypes.default.object,
package/css/hoc/delay.js CHANGED
@@ -99,8 +99,6 @@ var _default = (0, _func.curry)(function (defaultDelay, Origin) {
99
99
  _proto.forceChange = function forceChange(value) {
100
100
  var _this$props2;
101
101
 
102
- var delay = this.props.delay;
103
- if (delay === 0) return;
104
102
  this.setState({
105
103
  value: value
106
104
  });
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.12-beta.2' }
4
+ export default { utils, version: '1.10.12' }
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.12-beta.2'
227
+ version: '1.10.12'
228
228
  };
229
229
  exports.default = _default;
@@ -7,7 +7,7 @@ exports.default = cleanProps;
7
7
 
8
8
  var _immer = _interopRequireDefault(require("immer"));
9
9
 
10
- var names = ['delay', 'onDatumBind', 'rules', 'formDatum', 'forceChange', 'trim', 'beforeChange', 'validateHook', 'innerFormNamePath', 'fieldSetValidate', 'combineRules', 'popoverProps', 'inputFocus', 'placeTitle', 'cancelChange', 'integerLimit', 'autoSelect', 'autoFix', 'numType'];
10
+ var names = ['delay', 'onDatumBind', 'rules', 'formDatum', 'forceChange', 'trim', 'beforeChange', 'validateHook', 'innerFormNamePath', 'fieldSetValidate', 'combineRules', 'popoverProps', 'inputFocus', 'placeTitle', 'cancelChange', 'integerLimit', 'autoSelect', 'autoFix', 'numType', 'forceValidate'];
11
11
  /**
12
12
  * delete some props if needed, will not modify the pass argument
13
13
  * @param props