shineout 1.11.3-beta.3 → 1.11.3

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/Form/Item.js CHANGED
@@ -170,10 +170,14 @@ function (_Component) {
170
170
  };
171
171
 
172
172
  _proto2.renderHelp = function renderHelp(errors) {
173
- if (errors.length > 0) {
173
+ var realErrors = errors.filter(function (e) {
174
+ return e.message;
175
+ });
176
+
177
+ if (realErrors.length > 0) {
174
178
  return _react.default.createElement("div", {
175
179
  className: (0, _styles.formClass)('error')
176
- }, errors.map(function (e, i) {
180
+ }, realErrors.map(function (e, i) {
177
181
  return _react.default.createElement("div", {
178
182
  key: i
179
183
  }, e.message);
@@ -88,7 +88,6 @@ 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)));
92
91
  _this.lastValue = formDatum && name ? formDatum.get(name) || {} : {};
93
92
  return _this;
94
93
  }
@@ -340,10 +339,6 @@ var _default = (0, _func.curry)(function (Origin) {
340
339
  if (fieldSetValidate) fieldSetValidate(true);
341
340
  };
342
341
 
343
- _proto.forceValidate = function forceValidate() {
344
- this.validate(this.props.value);
345
- };
346
-
347
342
  _proto.handleUpdate = function handleUpdate(value, sn, type) {
348
343
  var _this5 = this;
349
344
 
@@ -407,8 +402,7 @@ var _default = (0, _func.curry)(function (Origin) {
407
402
  value: this.getValue(),
408
403
  onChange: this.handleChange,
409
404
  onDatumBind: this.handleDatumBind,
410
- validateHook: this.validateHook,
411
- forceValidate: this.forceValidate
405
+ validateHook: this.validateHook
412
406
  }));
413
407
  };
414
408
 
@@ -19,6 +19,8 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
19
19
 
20
20
  var _classnames = _interopRequireDefault(require("classnames"));
21
21
 
22
+ var _scrollBehavior = require("../utils/dom/scrollBehavior");
23
+
22
24
  var _component = require("../component");
23
25
 
24
26
  var _proptypes = require("../utils/proptypes");
@@ -88,6 +90,7 @@ function (_PureComponent) {
88
90
  });
89
91
  this.inner.addEventListener('scroll', this.handleInnerScroll);
90
92
  this.wheelElement.addEventListener('scroll', this.handleInnerScroll);
93
+ this.rmOverScrollListener = (0, _scrollBehavior.banOverScrollX)(this.wheelElement);
91
94
  };
92
95
 
93
96
  _proto.componentDidUpdate = function componentDidUpdate(prevProps) {
@@ -106,6 +109,7 @@ function (_PureComponent) {
106
109
  this.wheelElement.removeEventListener('touchmove', this.handleTouchMove);
107
110
  this.inner.removeEventListener('scroll', this.handleInnerScroll);
108
111
  this.wheelElement.removeEventListener('scroll', this.handleInnerScroll);
112
+ if (this.rmOverScrollListener) this.rmOverScrollListener();
109
113
  };
110
114
 
111
115
  _proto.getWheelRect = function getWheelRect() {
@@ -621,7 +621,8 @@ function (_PureComponent) {
621
621
  keygen = _this$props12.keygen,
622
622
  convertBr = _this$props12.convertBr,
623
623
  data = _this$props12.data,
624
- onFilter = _this$props12.onFilter;
624
+ onFilter = _this$props12.onFilter,
625
+ treeData = _this$props12.treeData;
625
626
  var disabled = this.getDisabledStatus();
626
627
  var className = (0, _styles.selectClass)('inner', size, this.state.focus && 'focus', this.state.position, multiple && 'multiple', disabled === true && (0, _classname.getDirectionClass)('disabled'), !trim && 'pre');
627
628
  return _react.default.createElement("div", {
@@ -663,7 +664,7 @@ function (_PureComponent) {
663
664
  resultClassName: resultClassName,
664
665
  innerTitle: innerTitle,
665
666
  keygen: keygen,
666
- data: data,
667
+ data: treeData || data,
667
668
  convertBr: convertBr
668
669
  }), this.renderOptions());
669
670
  };
@@ -53,6 +53,8 @@ var _Td = require("./Td");
53
53
 
54
54
  var _Sticky = _interopRequireDefault(require("../Sticky"));
55
55
 
56
+ var _scrollBehavior = require("../utils/dom/scrollBehavior");
57
+
56
58
  var SeperateTable =
57
59
  /*#__PURE__*/
58
60
  function (_PureComponent) {
@@ -119,6 +121,12 @@ function (_PureComponent) {
119
121
  this.ajustBottom(dataChange);
120
122
  };
121
123
 
124
+ _proto.componentWillUnmount = function componentWillUnmount() {
125
+ _PureComponent.prototype.componentWillUnmount.call(this);
126
+
127
+ if (this.rmOverScrollListener) this.rmOverScrollListener();
128
+ };
129
+
122
130
  _proto.getIndex = function getIndex(scrollTop) {
123
131
  if (scrollTop === void 0) {
124
132
  scrollTop = this.state.scrollTop;
@@ -429,6 +437,15 @@ function (_PureComponent) {
429
437
 
430
438
  _proto.bindElement = function bindElement(key, el) {
431
439
  this[key] = el;
440
+
441
+ if (key === 'headWrapper') {
442
+ if (el) {
443
+ this.rmOverScrollListener = (0, _scrollBehavior.banOverScrollX)(el);
444
+ } else if (this.rmOverScrollListener) {
445
+ this.rmOverScrollListener();
446
+ this.rmOverScrollListener = null;
447
+ }
448
+ }
432
449
  };
433
450
 
434
451
  _proto.scrollToTop = function scrollToTop() {
@@ -116,7 +116,6 @@ 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)));
120
119
  _this.useValidator = _this.useValidator.bind((0, _assertThisInitialized2.default)((0, _assertThisInitialized2.default)(_this)));
121
120
  _this.handleFileDrop = _this.handleFileDrop.bind((0, _assertThisInitialized2.default)((0, _assertThisInitialized2.default)(_this)));
122
121
  _this.handleReplace = _this.handleReplace.bind((0, _assertThisInitialized2.default)((0, _assertThisInitialized2.default)(_this)));
@@ -168,8 +167,6 @@ function (_PureComponent) {
168
167
  };
169
168
 
170
169
  _proto.removeFile = function removeFile(id) {
171
- var _this2 = this;
172
-
173
170
  var _this$props = this.props,
174
171
  beforeCancel = _this$props.beforeCancel,
175
172
  onErrorRemove = _this$props.onErrorRemove;
@@ -184,14 +181,12 @@ function (_PureComponent) {
184
181
  if (file.status === _request.ERROR && onErrorRemove) {
185
182
  onErrorRemove(file.xhr, file.blob, file);
186
183
  }
187
-
188
- _this2.updateValidate();
189
184
  });
190
185
  }
191
186
  };
192
187
 
193
188
  _proto.removeValue = function removeValue(index) {
194
- var _this3 = this;
189
+ var _this2 = this;
195
190
 
196
191
  var _this$props2 = this.props,
197
192
  recoverAble = _this$props2.recoverAble,
@@ -201,19 +196,19 @@ function (_PureComponent) {
201
196
  var current = this.props.value[index];
202
197
  var startRemove = typeof beforeRemove === 'function' ? beforeRemove(current) : Promise.resolve();
203
198
  startRemove.then(function () {
204
- _this3.setState((0, _immer.default)(function (draft) {
205
- draft.recycle.push(_this3.props.value[index]);
199
+ _this2.setState((0, _immer.default)(function (draft) {
200
+ draft.recycle.push(_this2.props.value[index]);
206
201
 
207
202
  if (typeof recoverAble === 'number' && draft.recycle.length > recoverAble) {
208
203
  draft.recycle.shift();
209
204
  }
210
205
  }));
211
206
 
212
- var value = (0, _immer.default)(_this3.props.value, function (draft) {
207
+ var value = (0, _immer.default)(_this2.props.value, function (draft) {
213
208
  draft.splice(index, 1);
214
209
  });
215
210
 
216
- _this3.props.onChange(value);
211
+ _this2.props.onChange(value);
217
212
  }).catch(function () {});
218
213
  };
219
214
 
@@ -322,7 +317,7 @@ function (_PureComponent) {
322
317
  var _addFile = (0, _asyncToGenerator2.default)(
323
318
  /*#__PURE__*/
324
319
  _regenerator.default.mark(function _callee2(e) {
325
- var _this4 = this;
320
+ var _this3 = this;
326
321
 
327
322
  var _this$props4, beforeUpload, value, limit, filesFilter, files, finishedCode, fileList, addLength, list, _loop, i, _ret;
328
323
 
@@ -368,7 +363,7 @@ function (_PureComponent) {
368
363
  files[id] = file; // eslint-disable-next-line no-await-in-loop
369
364
 
370
365
  _context2.next = 6;
371
- return _this4.useValidator(blob);
366
+ return _this3.useValidator(blob);
372
367
 
373
368
  case 6:
374
369
  error = _context2.sent;
@@ -378,7 +373,7 @@ function (_PureComponent) {
378
373
  break;
379
374
  }
380
375
 
381
- if (_this4.validatorHandle(error, file.blob)) {
376
+ if (_this3.validatorHandle(error, file.blob)) {
382
377
  _context2.next = 11;
383
378
  break;
384
379
  }
@@ -391,10 +386,10 @@ function (_PureComponent) {
391
386
  file.status = _request.ERROR;
392
387
 
393
388
  if (beforeUpload) {
394
- beforeUpload(blob, _this4.validatorHandle) // eslint-disable-next-line no-loop-func
389
+ beforeUpload(blob, _this3.validatorHandle) // eslint-disable-next-line no-loop-func
395
390
  .then(function (args) {
396
391
  if (finishedCode) {
397
- _this4.setState((0, _immer.default)(function (draft) {
392
+ _this3.setState((0, _immer.default)(function (draft) {
398
393
  draft.files[id] = Object.assign({}, draft.files[id], args);
399
394
  }));
400
395
  } else {
@@ -409,12 +404,12 @@ function (_PureComponent) {
409
404
 
410
405
  case 15:
411
406
  if (beforeUpload) {
412
- beforeUpload(blob, _this4.validatorHandle) // eslint-disable-next-line no-loop-func
407
+ beforeUpload(blob, _this3.validatorHandle) // eslint-disable-next-line no-loop-func
413
408
  .then(function (args) {
414
- if (args.status !== _request.ERROR) files[id].xhr = _this4.uploadFile(id, blob, args.data);
409
+ if (args.status !== _request.ERROR) files[id].xhr = _this3.uploadFile(id, blob, args.data);
415
410
 
416
411
  if (finishedCode) {
417
- _this4.setState((0, _immer.default)(function (draft) {
412
+ _this3.setState((0, _immer.default)(function (draft) {
418
413
  draft.files[id] = Object.assign({}, draft.files[id], args);
419
414
  }));
420
415
  } else {
@@ -423,7 +418,7 @@ function (_PureComponent) {
423
418
  }) // eslint-disable-next-line no-loop-func
424
419
  .catch(function () {
425
420
  if (finishedCode) {
426
- _this4.setState((0, _immer.default)(function (draft) {
421
+ _this3.setState((0, _immer.default)(function (draft) {
427
422
  delete draft.files[id];
428
423
  }));
429
424
  } else {
@@ -431,7 +426,7 @@ function (_PureComponent) {
431
426
  }
432
427
  });
433
428
  } else {
434
- files[id].xhr = _this4.uploadFile(id, blob);
429
+ files[id].xhr = _this3.uploadFile(id, blob);
435
430
  }
436
431
 
437
432
  case 16:
@@ -470,8 +465,6 @@ function (_PureComponent) {
470
465
  finishedCode = true;
471
466
  this.setState({
472
467
  files: files
473
- }, function () {
474
- _this4.updateValidate();
475
468
  });
476
469
 
477
470
  case 21:
@@ -490,7 +483,7 @@ function (_PureComponent) {
490
483
  }();
491
484
 
492
485
  _proto.uploadFile = function uploadFile(id, file, data) {
493
- var _this5 = this;
486
+ var _this4 = this;
494
487
 
495
488
  var _this$props5 = this.props,
496
489
  onSuccess = _this$props5.onSuccess,
@@ -524,14 +517,14 @@ function (_PureComponent) {
524
517
  throttle = false;
525
518
  }, 16);
526
519
 
527
- if (_this5.state.files[id]) {
528
- _this5.setState((0, _immer.default)(function (draft) {
520
+ if (_this4.state.files[id]) {
521
+ _this4.setState((0, _immer.default)(function (draft) {
529
522
  draft.files[id].process = percent;
530
523
  if (msg) draft.files[id].message = msg;
531
524
  }), // expose the file progress to Upload.Button
532
525
  function () {
533
526
  if (typeof _onProgress === 'function') {
534
- _onProgress(_this5.state.files[id]);
527
+ _onProgress(_this4.state.files[id]);
535
528
  }
536
529
  });
537
530
  }
@@ -539,7 +532,7 @@ function (_PureComponent) {
539
532
  onSuccess: onSuccess,
540
533
  onLoad: function onLoad(xhr) {
541
534
  if (!/^2|1223/.test(xhr.status)) {
542
- _this5.handleError(id, xhr, file);
535
+ _this4.handleError(id, xhr, file);
543
536
 
544
537
  return;
545
538
  }
@@ -553,26 +546,26 @@ function (_PureComponent) {
553
546
  }
554
547
 
555
548
  if (value instanceof Error) {
556
- _this5.setState((0, _immer.default)(function (draft) {
549
+ _this4.setState((0, _immer.default)(function (draft) {
557
550
  draft.files[id].status = _request.ERROR;
558
551
  draft.files[id].name = file.name;
559
552
  draft.files[id].message = value.message;
560
553
  }));
561
554
  } else {
562
- _this5.setState((0, _immer.default)(function (draft) {
555
+ _this4.setState((0, _immer.default)(function (draft) {
563
556
  delete draft.files[id];
564
557
  })); // add value
565
558
 
566
559
 
567
- var values = (0, _immer.default)(_this5.props.value, function (draft) {
560
+ var values = (0, _immer.default)(_this4.props.value, function (draft) {
568
561
  draft.push(value);
569
562
  });
570
563
 
571
- _this5.props.onChange(values);
564
+ _this4.props.onChange(values);
572
565
  }
573
566
  },
574
567
  onError: function onError(xhr) {
575
- return _this5.handleError(id, xhr, file);
568
+ return _this4.handleError(id, xhr, file);
576
569
  }
577
570
  };
578
571
 
@@ -591,11 +584,11 @@ function (_PureComponent) {
591
584
  };
592
585
 
593
586
  _proto.handleReplace = function handleReplace(files, index) {
594
- var _this6 = this;
587
+ var _this5 = this;
595
588
 
596
589
  this.removeValue(index);
597
590
  setTimeout(function () {
598
- _this6.addFile({
591
+ _this5.addFile({
599
592
  files: files,
600
593
  fromDragger: true
601
594
  });
@@ -603,8 +596,6 @@ function (_PureComponent) {
603
596
  };
604
597
 
605
598
  _proto.handleError = function handleError(id, xhr, file) {
606
- var _this7 = this;
607
-
608
599
  var _this$props6 = this.props,
609
600
  onError = _this$props6.onError,
610
601
  onHttpError = _this$props6.onHttpError;
@@ -615,14 +606,7 @@ function (_PureComponent) {
615
606
  if (!draft.files[id]) return;
616
607
  draft.files[id].status = _request.ERROR;
617
608
  draft.files[id].message = message;
618
- }), function () {
619
- _this7.updateValidate();
620
- });
621
- };
622
-
623
- _proto.updateValidate = function updateValidate() {
624
- var forceValidate = this.props.forceValidate;
625
- forceValidate();
609
+ }));
626
610
  };
627
611
 
628
612
  _proto.renderHandle = function renderHandle() {
@@ -665,7 +649,7 @@ function (_PureComponent) {
665
649
  };
666
650
 
667
651
  _proto.render = function render() {
668
- var _this8 = this;
652
+ var _this6 = this;
669
653
 
670
654
  var _this$props8 = this.props,
671
655
  limit = _this$props8.limit,
@@ -716,7 +700,7 @@ function (_PureComponent) {
716
700
  accept: accept,
717
701
  dropData: i,
718
702
  disabled: disabled,
719
- onDrop: _this8.handleReplace
703
+ onDrop: _this6.handleReplace
720
704
  }, _react.default.createElement(ResultComponent, {
721
705
  renderContent: renderContent,
722
706
  value: v,
@@ -724,7 +708,7 @@ function (_PureComponent) {
724
708
  index: i,
725
709
  style: imageStyle,
726
710
  renderResult: renderResult,
727
- onRemove: _this8.getCanDelete(v, i) ? _this8.removeValue : undefined,
711
+ onRemove: _this6.getCanDelete(v, i) ? _this6.removeValue : undefined,
728
712
  removeConfirm: removeConfirm,
729
713
  onPreview: onPreview
730
714
  }));
@@ -733,7 +717,7 @@ function (_PureComponent) {
733
717
  key: id,
734
718
  id: id,
735
719
  style: imageStyle,
736
- onRemove: _this8.removeFile
720
+ onRemove: _this6.removeFile
737
721
  }));
738
722
  }), imageStyle && !leftHandler && this.renderHandle(), recoverAble && recycle.map(function (v, i) {
739
723
  return _react.default.createElement(ResultComponent, {
@@ -745,7 +729,7 @@ function (_PureComponent) {
745
729
  renderResult: renderResult,
746
730
  recoverAble: !!recoverAble,
747
731
  showRecover: recoverAble && limit > value.length,
748
- onRecover: _this8.recoverValue,
732
+ onRecover: _this6.recoverValue,
749
733
  style: imageStyle
750
734
  });
751
735
  })));
@@ -779,7 +763,6 @@ Upload.propTypes = {
779
763
  request: _propTypes.default.func,
780
764
  validateHook: _propTypes.default.func,
781
765
  validator: _propTypes.default.object,
782
- forceValidate: _propTypes.default.func,
783
766
  value: _propTypes.default.array,
784
767
  customResult: _propTypes.default.oneOfType([_propTypes.default.element, _propTypes.default.func]),
785
768
  style: _propTypes.default.object,
package/css/index.d.ts CHANGED
@@ -3,7 +3,7 @@ import * as utils from './utils'
3
3
 
4
4
  declare const __default: {
5
5
  utils: typeof utils,
6
- version: '1.11.2'
6
+ version: '1.11.3'
7
7
  }
8
8
 
9
9
  export default __default
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.11.2'
227
+ version: '1.11.3'
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', 'forceValidate'];
10
+ var names = ['delay', 'onDatumBind', 'rules', 'formDatum', 'forceChange', 'trim', 'beforeChange', 'validateHook', 'innerFormNamePath', 'fieldSetValidate', 'combineRules', 'popoverProps', 'inputFocus', 'placeTitle', 'cancelChange', 'integerLimit', 'autoSelect', 'autoFix', 'numType'];
11
11
  /**
12
12
  * delete some props if needed, will not modify the pass argument
13
13
  * @param props
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+
3
+ exports.__esModule = true;
4
+ exports.banOverScrollX = void 0;
5
+ var htmlDom;
6
+ var lastStyle = null;
7
+
8
+ var getHtml = function getHtml() {
9
+ if (!htmlDom) htmlDom = document.body.parentElement;
10
+ return htmlDom;
11
+ };
12
+
13
+ var setScrollBehavior = function setScrollBehavior() {
14
+ if (lastStyle !== null) return;
15
+ lastStyle = getHtml().style.overscrollBehaviorX;
16
+ htmlDom.style.overscrollBehaviorX = 'none';
17
+ };
18
+
19
+ var resetScrollBehavior = function resetScrollBehavior() {
20
+ htmlDom.style.overscrollBehaviorX = lastStyle;
21
+ lastStyle = null;
22
+ };
23
+
24
+ var banOverScrollX = function banOverScrollX(el) {
25
+ el.addEventListener('mouseenter', setScrollBehavior);
26
+ el.addEventListener('mouseleave', resetScrollBehavior);
27
+ return function () {
28
+ el.removeEventListener('mouseenter', setScrollBehavior);
29
+ el.removeEventListener('mouseleave', resetScrollBehavior);
30
+ };
31
+ };
32
+
33
+ exports.banOverScrollX = banOverScrollX;