@douyinfe/semi-ui 2.50.0-alpha.0 → 2.50.0-beta.0

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.
Files changed (99) hide show
  1. package/dist/css/semi.css +76 -160
  2. package/dist/css/semi.min.css +1 -1
  3. package/dist/umd/semi-ui.js +582 -418
  4. package/dist/umd/semi-ui.js.map +1 -1
  5. package/dist/umd/semi-ui.min.js +1 -1
  6. package/dist/umd/semi-ui.min.js.map +1 -1
  7. package/lib/cjs/anchor/index.d.ts +1 -1
  8. package/lib/cjs/autoComplete/index.d.ts +1 -1
  9. package/lib/cjs/button/Button.d.ts +1 -1
  10. package/lib/cjs/button/index.d.ts +1 -1
  11. package/lib/cjs/carousel/index.d.ts +1 -1
  12. package/lib/cjs/datePicker/datePicker.d.ts +1 -1
  13. package/lib/cjs/datePicker/yearAndMonth.js +1 -5
  14. package/lib/cjs/dropdown/index.d.ts +1 -1
  15. package/lib/cjs/form/baseForm.d.ts +2 -2
  16. package/lib/cjs/form/field.d.ts +2 -2
  17. package/lib/cjs/image/interface.d.ts +3 -3
  18. package/lib/cjs/image/previewFooter.js +5 -8
  19. package/lib/cjs/image/previewHeader.d.ts +2 -2
  20. package/lib/cjs/image/previewHeader.js +9 -8
  21. package/lib/cjs/image/previewImage.d.ts +1 -12
  22. package/lib/cjs/image/previewImage.js +23 -83
  23. package/lib/cjs/image/previewInner.d.ts +11 -2
  24. package/lib/cjs/image/previewInner.js +60 -42
  25. package/lib/cjs/index.d.ts +2 -0
  26. package/lib/cjs/index.js +14 -0
  27. package/lib/cjs/modal/confirm.d.ts +17 -17
  28. package/lib/cjs/notification/index.d.ts +8 -8
  29. package/lib/cjs/notification/index.js +6 -5
  30. package/lib/cjs/notification/notice.d.ts +1 -1
  31. package/lib/cjs/notification/notice.js +1 -1
  32. package/lib/cjs/popover/index.d.ts +1 -1
  33. package/lib/cjs/select/index.d.ts +2 -2
  34. package/lib/cjs/table/Table.d.ts +1 -1
  35. package/lib/cjs/timePicker/TimePicker.d.ts +3 -3
  36. package/lib/cjs/timePicker/TimeShape.d.ts +1 -1
  37. package/lib/cjs/timePicker/index.d.ts +2 -2
  38. package/lib/cjs/tooltip/index.d.ts +1 -1
  39. package/lib/cjs/tree/indent.d.ts +9 -0
  40. package/lib/cjs/tree/indent.js +37 -0
  41. package/lib/cjs/tree/index.d.ts +2 -0
  42. package/lib/cjs/tree/index.js +8 -3
  43. package/lib/cjs/tree/interface.d.ts +2 -0
  44. package/lib/cjs/tree/treeNode.d.ts +3 -0
  45. package/lib/cjs/tree/treeNode.js +34 -6
  46. package/lib/cjs/treeSelect/index.d.ts +4 -3
  47. package/lib/cjs/treeSelect/index.js +124 -31
  48. package/lib/cjs/typography/base.d.ts +1 -1
  49. package/lib/cjs/typography/numeral.d.ts +1 -1
  50. package/lib/cjs/typography/paragraph.d.ts +1 -1
  51. package/lib/cjs/typography/text.d.ts +1 -1
  52. package/lib/cjs/typography/title.d.ts +1 -1
  53. package/lib/es/anchor/index.d.ts +1 -1
  54. package/lib/es/autoComplete/index.d.ts +1 -1
  55. package/lib/es/button/Button.d.ts +1 -1
  56. package/lib/es/button/index.d.ts +1 -1
  57. package/lib/es/carousel/index.d.ts +1 -1
  58. package/lib/es/datePicker/datePicker.d.ts +1 -1
  59. package/lib/es/datePicker/yearAndMonth.js +1 -5
  60. package/lib/es/dropdown/index.d.ts +1 -1
  61. package/lib/es/form/baseForm.d.ts +2 -2
  62. package/lib/es/form/field.d.ts +2 -2
  63. package/lib/es/image/interface.d.ts +3 -3
  64. package/lib/es/image/previewFooter.js +5 -8
  65. package/lib/es/image/previewHeader.d.ts +2 -2
  66. package/lib/es/image/previewHeader.js +4 -3
  67. package/lib/es/image/previewImage.d.ts +1 -12
  68. package/lib/es/image/previewImage.js +23 -83
  69. package/lib/es/image/previewInner.d.ts +11 -2
  70. package/lib/es/image/previewInner.js +60 -42
  71. package/lib/es/index.d.ts +2 -0
  72. package/lib/es/index.js +2 -0
  73. package/lib/es/modal/confirm.d.ts +17 -17
  74. package/lib/es/notification/index.d.ts +8 -8
  75. package/lib/es/notification/index.js +6 -5
  76. package/lib/es/notification/notice.d.ts +1 -1
  77. package/lib/es/notification/notice.js +1 -1
  78. package/lib/es/popover/index.d.ts +1 -1
  79. package/lib/es/select/index.d.ts +2 -2
  80. package/lib/es/table/Table.d.ts +1 -1
  81. package/lib/es/timePicker/TimePicker.d.ts +3 -3
  82. package/lib/es/timePicker/TimeShape.d.ts +1 -1
  83. package/lib/es/timePicker/index.d.ts +2 -2
  84. package/lib/es/tooltip/index.d.ts +1 -1
  85. package/lib/es/tree/indent.d.ts +9 -0
  86. package/lib/es/tree/indent.js +27 -0
  87. package/lib/es/tree/index.d.ts +2 -0
  88. package/lib/es/tree/index.js +8 -3
  89. package/lib/es/tree/interface.d.ts +2 -0
  90. package/lib/es/tree/treeNode.d.ts +3 -0
  91. package/lib/es/tree/treeNode.js +34 -6
  92. package/lib/es/treeSelect/index.d.ts +4 -3
  93. package/lib/es/treeSelect/index.js +125 -32
  94. package/lib/es/typography/base.d.ts +1 -1
  95. package/lib/es/typography/numeral.d.ts +1 -1
  96. package/lib/es/typography/paragraph.d.ts +1 -1
  97. package/lib/es/typography/text.d.ts +1 -1
  98. package/lib/es/typography/title.d.ts +1 -1
  99. package/package.json +8 -8
@@ -17286,6 +17286,8 @@ __webpack_require__.d(__webpack_exports__, {
17286
17286
  "BackTop": () => (/* reexport */ BackTop),
17287
17287
  "Badge": () => (/* reexport */ Badge),
17288
17288
  "Banner": () => (/* reexport */ Banner),
17289
+ "BaseComponent": () => (/* reexport */ BaseComponent),
17290
+ "BaseFoundation": () => (/* reexport */ foundation),
17289
17291
  "Breadcrumb": () => (/* reexport */ breadcrumb_0),
17290
17292
  "Button": () => (/* reexport */ button_0),
17291
17293
  "ButtonGroup": () => (/* reexport */ ButtonGroup),
@@ -17375,45 +17377,12 @@ __webpack_require__.d(__webpack_exports__, {
17375
17377
 
17376
17378
  // EXTERNAL MODULE: ./_base/base.scss
17377
17379
  var base = __webpack_require__("q7sR");
17378
- // EXTERNAL MODULE: ../../node_modules/lodash/throttle.js
17379
- var throttle = __webpack_require__("Bcqe");
17380
- var throttle_default = /*#__PURE__*/__webpack_require__.n(throttle);
17381
- // EXTERNAL MODULE: ../../node_modules/lodash/debounce.js
17382
- var debounce = __webpack_require__("RNvQ");
17383
- var debounce_default = /*#__PURE__*/__webpack_require__.n(debounce);
17384
17380
  // EXTERNAL MODULE: ../../node_modules/lodash/noop.js
17385
17381
  var noop = __webpack_require__("nnm9");
17386
17382
  var noop_default = /*#__PURE__*/__webpack_require__.n(noop);
17387
- // EXTERNAL MODULE: external {"root":"React","commonjs2":"react","commonjs":"react","amd":"react"}
17388
- var external_root_React_commonjs2_react_commonjs_react_amd_react_ = __webpack_require__("neV8");
17389
- var external_root_React_commonjs2_react_commonjs_react_amd_react_default = /*#__PURE__*/__webpack_require__.n(external_root_React_commonjs2_react_commonjs_react_amd_react_);
17390
- // EXTERNAL MODULE: ../../node_modules/classnames/index.js
17391
- var classnames = __webpack_require__("O94r");
17392
- var classnames_default = /*#__PURE__*/__webpack_require__.n(classnames);
17393
- // EXTERNAL MODULE: ../../node_modules/prop-types/index.js
17394
- var prop_types = __webpack_require__("aWzz");
17395
- var prop_types_default = /*#__PURE__*/__webpack_require__.n(prop_types);
17396
- ;// CONCATENATED MODULE: ../semi-foundation/base/env.ts
17397
- const BASE_CLASS_PREFIX = 'semi';
17398
- ;// CONCATENATED MODULE: ../semi-foundation/anchor/constants.ts
17399
-
17400
- const cssClasses = {
17401
- PREFIX: `${BASE_CLASS_PREFIX}-anchor`
17402
- };
17403
- const constants_strings = {
17404
- SIZE: ['small', 'default'],
17405
- SLIDE_COLOR: ['primary', 'tertiary', 'muted'],
17406
- MAX_WIDTH: '200px',
17407
- MAX_HEIGHT: '750px',
17408
- POSITION_SET: ['top', 'topLeft', 'topRight', 'left', 'leftTop', 'leftBottom', 'right', 'rightTop', 'rightBottom', 'bottom', 'bottomLeft', 'bottomRight', 'leftTopOver', 'rightTopOver']
17409
- };
17410
-
17411
17383
  // EXTERNAL MODULE: ../../node_modules/lodash/get.js
17412
17384
  var get = __webpack_require__("2srY");
17413
17385
  var get_default = /*#__PURE__*/__webpack_require__.n(get);
17414
- // EXTERNAL MODULE: ../../node_modules/lodash/isArray.js
17415
- var isArray = __webpack_require__("wxYD");
17416
- var isArray_default = /*#__PURE__*/__webpack_require__.n(isArray);
17417
17386
  ;// CONCATENATED MODULE: ../semi-foundation/utils/log.ts
17418
17387
 
17419
17388
  const log = function (text) {
@@ -17540,6 +17509,115 @@ class BaseFoundation {
17540
17509
  }
17541
17510
  }
17542
17511
  /* harmony default export */ const foundation = (BaseFoundation);
17512
+ // EXTERNAL MODULE: external {"root":"React","commonjs2":"react","commonjs":"react","amd":"react"}
17513
+ var external_root_React_commonjs2_react_commonjs_react_amd_react_ = __webpack_require__("neV8");
17514
+ var external_root_React_commonjs2_react_commonjs_react_amd_react_default = /*#__PURE__*/__webpack_require__.n(external_root_React_commonjs2_react_commonjs_react_amd_react_);
17515
+ ;// CONCATENATED MODULE: ../semi-foundation/utils/getDataAttr.ts
17516
+ function getDataAttr(props) {
17517
+ return Object.keys(props).reduce((prev, key) => {
17518
+ if (key.substr(0, 5) === 'data-') {
17519
+ prev[key] = props[key];
17520
+ }
17521
+ return prev;
17522
+ }, {});
17523
+ }
17524
+ ;// CONCATENATED MODULE: ./_base/baseComponent.tsx
17525
+ /**
17526
+ * The Semi Foundation / Adapter architecture split was inspired by Material Component For Web. (https://github.com/material-components/material-components-web)
17527
+ * We re-implemented our own code based on the principle and added more functions we need according to actual needs.
17528
+ */
17529
+
17530
+
17531
+
17532
+ const {
17533
+ hasOwnProperty: baseComponent_hasOwnProperty
17534
+ } = Object.prototype;
17535
+ // eslint-disable-next-line
17536
+ class BaseComponent extends external_root_React_commonjs2_react_commonjs_react_amd_react_.Component {
17537
+ constructor(props) {
17538
+ super(props);
17539
+ // eslint-disable-next-line
17540
+ this.isControlled = key => Boolean(key && this.props && typeof this.props === 'object' && baseComponent_hasOwnProperty.call(this.props, key));
17541
+ this.cache = {};
17542
+ this.foundation = null;
17543
+ }
17544
+ componentDidMount() {
17545
+ this.foundation && typeof this.foundation.init === 'function' && this.foundation.init();
17546
+ }
17547
+ componentWillUnmount() {
17548
+ this.foundation && typeof this.foundation.destroy === 'function' && this.foundation.destroy();
17549
+ this.cache = {};
17550
+ }
17551
+ get adapter() {
17552
+ return {
17553
+ getContext: key => {
17554
+ if (this.context && key) {
17555
+ return this.context[key];
17556
+ }
17557
+ },
17558
+ getContexts: () => this.context,
17559
+ getProp: key => this.props[key],
17560
+ // return all props
17561
+ getProps: () => this.props,
17562
+ getState: key => this.state[key],
17563
+ getStates: () => this.state,
17564
+ setState: (states, cb) => this.setState(Object.assign({}, states), cb),
17565
+ getCache: key => key && this.cache[key],
17566
+ getCaches: () => this.cache,
17567
+ setCache: (key, value) => key && (this.cache[key] = value),
17568
+ stopPropagation: e => {
17569
+ try {
17570
+ e.stopPropagation();
17571
+ e.nativeEvent && e.nativeEvent.stopImmediatePropagation();
17572
+ } catch (error) {}
17573
+ },
17574
+ persistEvent: e => {
17575
+ e && e.persist && typeof e.persist === 'function' ? e.persist() : null;
17576
+ }
17577
+ };
17578
+ }
17579
+ log(text) {
17580
+ for (var _len = arguments.length, rest = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
17581
+ rest[_key - 1] = arguments[_key];
17582
+ }
17583
+ return utils_log(text, ...rest);
17584
+ }
17585
+ getDataAttr(props) {
17586
+ return getDataAttr(props);
17587
+ }
17588
+ }
17589
+ BaseComponent.propTypes = {};
17590
+ BaseComponent.defaultProps = {};
17591
+ // EXTERNAL MODULE: ../../node_modules/lodash/throttle.js
17592
+ var throttle = __webpack_require__("Bcqe");
17593
+ var throttle_default = /*#__PURE__*/__webpack_require__.n(throttle);
17594
+ // EXTERNAL MODULE: ../../node_modules/lodash/debounce.js
17595
+ var debounce = __webpack_require__("RNvQ");
17596
+ var debounce_default = /*#__PURE__*/__webpack_require__.n(debounce);
17597
+ // EXTERNAL MODULE: ../../node_modules/classnames/index.js
17598
+ var classnames = __webpack_require__("O94r");
17599
+ var classnames_default = /*#__PURE__*/__webpack_require__.n(classnames);
17600
+ // EXTERNAL MODULE: ../../node_modules/prop-types/index.js
17601
+ var prop_types = __webpack_require__("aWzz");
17602
+ var prop_types_default = /*#__PURE__*/__webpack_require__.n(prop_types);
17603
+ ;// CONCATENATED MODULE: ../semi-foundation/base/env.ts
17604
+ const BASE_CLASS_PREFIX = 'semi';
17605
+ ;// CONCATENATED MODULE: ../semi-foundation/anchor/constants.ts
17606
+
17607
+ const cssClasses = {
17608
+ PREFIX: `${BASE_CLASS_PREFIX}-anchor`
17609
+ };
17610
+ const constants_strings = {
17611
+ SIZE: ['small', 'default'],
17612
+ SLIDE_COLOR: ['primary', 'tertiary', 'muted'],
17613
+ MAX_WIDTH: '200px',
17614
+ MAX_HEIGHT: '750px',
17615
+ POSITION_SET: ['top', 'topLeft', 'topRight', 'left', 'leftTop', 'leftBottom', 'right', 'rightTop', 'rightBottom', 'bottom', 'bottomLeft', 'bottomRight', 'leftTopOver', 'rightTopOver']
17616
+ };
17617
+
17618
+ // EXTERNAL MODULE: ../../node_modules/lodash/isArray.js
17619
+ var isArray = __webpack_require__("wxYD");
17620
+ var isArray_default = /*#__PURE__*/__webpack_require__.n(isArray);
17543
17621
  ;// CONCATENATED MODULE: ../../node_modules/compute-scroll-into-view/dist/index.mjs
17544
17622
  function t(t){return"object"==typeof t&&null!=t&&1===t.nodeType}function e(t,e){return(!e||"hidden"!==t)&&"visible"!==t&&"clip"!==t}function n(t,n){if(t.clientHeight<t.scrollHeight||t.clientWidth<t.scrollWidth){var r=getComputedStyle(t,null);return e(r.overflowY,n)||e(r.overflowX,n)||function(t){var e=function(t){if(!t.ownerDocument||!t.ownerDocument.defaultView)return null;try{return t.ownerDocument.defaultView.frameElement}catch(t){return null}}(t);return!!e&&(e.clientHeight<t.scrollHeight||e.clientWidth<t.scrollWidth)}(t)}return!1}function r(t,e,n,r,i,o,l,d){return o<t&&l>e||o>t&&l<e?0:o<=t&&d<=n||l>=e&&d>=n?o-t-r:l>e&&d<n||o<t&&d>n?l-e+i:0}var i=function(e,i){var o=window,l=i.scrollMode,d=i.block,f=i.inline,h=i.boundary,u=i.skipOverflowHiddenElements,s="function"==typeof h?h:function(t){return t!==h};if(!t(e))throw new TypeError("Invalid target");for(var a,c,g=document.scrollingElement||document.documentElement,p=[],m=e;t(m)&&s(m);){if((m=null==(c=(a=m).parentElement)?a.getRootNode().host||null:c)===g){p.push(m);break}null!=m&&m===document.body&&n(m)&&!n(document.documentElement)||null!=m&&n(m,u)&&p.push(m)}for(var w=o.visualViewport?o.visualViewport.width:innerWidth,v=o.visualViewport?o.visualViewport.height:innerHeight,W=window.scrollX||pageXOffset,H=window.scrollY||pageYOffset,b=e.getBoundingClientRect(),y=b.height,E=b.width,M=b.top,V=b.right,x=b.bottom,I=b.left,C="start"===d||"nearest"===d?M:"end"===d?x:M+y/2,R="center"===f?I+E/2:"end"===f?V:I,T=[],k=0;k<p.length;k++){var B=p[k],D=B.getBoundingClientRect(),O=D.height,X=D.width,Y=D.top,L=D.right,S=D.bottom,j=D.left;if("if-needed"===l&&M>=0&&I>=0&&x<=v&&V<=w&&M>=Y&&x<=S&&I>=j&&V<=L)return T;var N=getComputedStyle(B),q=parseInt(N.borderLeftWidth,10),z=parseInt(N.borderTopWidth,10),A=parseInt(N.borderRightWidth,10),F=parseInt(N.borderBottomWidth,10),G=0,J=0,K="offsetWidth"in B?B.offsetWidth-B.clientWidth-q-A:0,P="offsetHeight"in B?B.offsetHeight-B.clientHeight-z-F:0,Q="offsetWidth"in B?0===B.offsetWidth?0:X/B.offsetWidth:0,U="offsetHeight"in B?0===B.offsetHeight?0:O/B.offsetHeight:0;if(g===B)G="start"===d?C:"end"===d?C-v:"nearest"===d?r(H,H+v,v,z,F,H+C,H+C+y,y):C-v/2,J="start"===f?R:"center"===f?R-w/2:"end"===f?R-w:r(W,W+w,w,q,A,W+R,W+R+E,E),G=Math.max(0,G+H),J=Math.max(0,J+W);else{G="start"===d?C-Y-z:"end"===d?C-S+F+P:"nearest"===d?r(Y,S,O,z,F+P,C,C+y,y):C-(Y+O/2)+P/2,J="start"===f?R-j-q:"center"===f?R-(j+X/2)+K/2:"end"===f?R-L+A+K:r(j,L,X,q,A+K,R,R+E,E);var Z=B.scrollLeft,$=B.scrollTop;C+=$-(G=Math.max(0,Math.min($+G/U,B.scrollHeight-O/U+P))),R+=Z-(J=Math.max(0,Math.min(Z+J/Q,B.scrollWidth-X/Q+K)))}T.push({el:B,top:G,left:J})}return T};
17545
17623
  //# sourceMappingURL=index.mjs.map
@@ -17793,82 +17871,6 @@ class AnchorFoundation extends foundation {
17793
17871
  };
17794
17872
  }
17795
17873
  }
17796
- ;// CONCATENATED MODULE: ../semi-foundation/utils/getDataAttr.ts
17797
- function getDataAttr(props) {
17798
- return Object.keys(props).reduce((prev, key) => {
17799
- if (key.substr(0, 5) === 'data-') {
17800
- prev[key] = props[key];
17801
- }
17802
- return prev;
17803
- }, {});
17804
- }
17805
- ;// CONCATENATED MODULE: ./_base/baseComponent.tsx
17806
- /**
17807
- * The Semi Foundation / Adapter architecture split was inspired by Material Component For Web. (https://github.com/material-components/material-components-web)
17808
- * We re-implemented our own code based on the principle and added more functions we need according to actual needs.
17809
- */
17810
-
17811
-
17812
-
17813
- const {
17814
- hasOwnProperty: baseComponent_hasOwnProperty
17815
- } = Object.prototype;
17816
- // eslint-disable-next-line
17817
- class BaseComponent extends external_root_React_commonjs2_react_commonjs_react_amd_react_.Component {
17818
- constructor(props) {
17819
- super(props);
17820
- // eslint-disable-next-line
17821
- this.isControlled = key => Boolean(key && this.props && typeof this.props === 'object' && baseComponent_hasOwnProperty.call(this.props, key));
17822
- this.cache = {};
17823
- this.foundation = null;
17824
- }
17825
- componentDidMount() {
17826
- this.foundation && typeof this.foundation.init === 'function' && this.foundation.init();
17827
- }
17828
- componentWillUnmount() {
17829
- this.foundation && typeof this.foundation.destroy === 'function' && this.foundation.destroy();
17830
- this.cache = {};
17831
- }
17832
- get adapter() {
17833
- return {
17834
- getContext: key => {
17835
- if (this.context && key) {
17836
- return this.context[key];
17837
- }
17838
- },
17839
- getContexts: () => this.context,
17840
- getProp: key => this.props[key],
17841
- // return all props
17842
- getProps: () => this.props,
17843
- getState: key => this.state[key],
17844
- getStates: () => this.state,
17845
- setState: (states, cb) => this.setState(Object.assign({}, states), cb),
17846
- getCache: key => key && this.cache[key],
17847
- getCaches: () => this.cache,
17848
- setCache: (key, value) => key && (this.cache[key] = value),
17849
- stopPropagation: e => {
17850
- try {
17851
- e.stopPropagation();
17852
- e.nativeEvent && e.nativeEvent.stopImmediatePropagation();
17853
- } catch (error) {}
17854
- },
17855
- persistEvent: e => {
17856
- e && e.persist && typeof e.persist === 'function' ? e.persist() : null;
17857
- }
17858
- };
17859
- }
17860
- log(text) {
17861
- for (var _len = arguments.length, rest = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
17862
- rest[_key - 1] = arguments[_key];
17863
- }
17864
- return utils_log(text, ...rest);
17865
- }
17866
- getDataAttr(props) {
17867
- return getDataAttr(props);
17868
- }
17869
- }
17870
- BaseComponent.propTypes = {};
17871
- BaseComponent.defaultProps = {};
17872
17874
  // EXTERNAL MODULE: ../../node_modules/lodash/isObject.js
17873
17875
  var isObject = __webpack_require__("tQYX");
17874
17876
  var isObject_default = /*#__PURE__*/__webpack_require__.n(isObject);
@@ -36363,7 +36365,8 @@ function flattenTreeData(treeNodeList, expandedKeys, keyMaps) {
36363
36365
  pos,
36364
36366
  children: null,
36365
36367
  data: treeNode,
36366
- _innerDataTag: true
36368
+ _innerDataTag: true,
36369
+ isEnd: [...(parent ? parent.isEnd : []), index === list.length - 1]
36367
36370
  });
36368
36371
  const isBooleanFilteredShownKeys = typeof filteredShownKeys === 'boolean';
36369
36372
  if (!filterSearch || !isBooleanFilteredShownKeys && filteredShownKeys.has(mergedKey)) {
@@ -59008,11 +59011,7 @@ class YearAndMonth extends BaseComponent {
59008
59011
  const right = datePicker_constants_strings.PANEL_TYPE_RIGHT;
59009
59012
  const needDisabled = year => {
59010
59013
  if (panelType === right && currentYear[left]) {
59011
- if (currentMonth[left] <= currentMonth[right]) {
59012
- return currentYear[left] > year;
59013
- } else {
59014
- return currentYear[left] >= year;
59015
- }
59014
+ return currentYear[left] > year;
59016
59015
  }
59017
59016
  return false;
59018
59017
  };
@@ -67748,7 +67747,7 @@ class Notice extends BaseComponent {
67748
67747
  Notice.contextType = context;
67749
67748
  Notice.propTypes = {
67750
67749
  duration: (prop_types_default()).number,
67751
- id: prop_types_default().oneOfType([(prop_types_default()).string, (prop_types_default()).number]),
67750
+ id: (prop_types_default()).string,
67752
67751
  title: (prop_types_default()).node,
67753
67752
  content: (prop_types_default()).node,
67754
67753
  type: prop_types_default().oneOf(notice_types),
@@ -68034,6 +68033,7 @@ class NotificationList extends BaseComponent {
68034
68033
  }
68035
68034
  static addNotice(notice) {
68036
68035
  var _a;
68036
+ notice = Object.assign(Object.assign({}, notification_defaultConfig), notice);
68037
68037
  const id = (_a = notice.id) !== null && _a !== void 0 ? _a : getUuid('notification');
68038
68038
  if (!ref) {
68039
68039
  const {
@@ -68077,27 +68077,27 @@ class NotificationList extends BaseComponent {
68077
68077
  return id;
68078
68078
  }
68079
68079
  static info(opts) {
68080
- return this.addNotice(Object.assign(Object.assign(Object.assign({}, notification_defaultConfig), opts), {
68080
+ return this.addNotice(Object.assign(Object.assign({}, opts), {
68081
68081
  type: 'info'
68082
68082
  }));
68083
68083
  }
68084
68084
  static success(opts) {
68085
- return this.addNotice(Object.assign(Object.assign(Object.assign({}, notification_defaultConfig), opts), {
68085
+ return this.addNotice(Object.assign(Object.assign({}, opts), {
68086
68086
  type: 'success'
68087
68087
  }));
68088
68088
  }
68089
68089
  static error(opts) {
68090
- return this.addNotice(Object.assign(Object.assign(Object.assign({}, notification_defaultConfig), opts), {
68090
+ return this.addNotice(Object.assign(Object.assign({}, opts), {
68091
68091
  type: 'error'
68092
68092
  }));
68093
68093
  }
68094
68094
  static warning(opts) {
68095
- return this.addNotice(Object.assign(Object.assign(Object.assign({}, notification_defaultConfig), opts), {
68095
+ return this.addNotice(Object.assign(Object.assign({}, opts), {
68096
68096
  type: 'warning'
68097
68097
  }));
68098
68098
  }
68099
68099
  static open(opts) {
68100
- return this.addNotice(Object.assign(Object.assign(Object.assign({}, notification_defaultConfig), opts), {
68100
+ return this.addNotice(Object.assign(Object.assign({}, opts), {
68101
68101
  type: 'default'
68102
68102
  }));
68103
68103
  }
@@ -69372,6 +69372,9 @@ class SelectFoundation extends foundation {
69372
69372
  const newOptions = this._filterOption(options, sugInput).filter(item => !item._inputCreateOnly);
69373
69373
  this._adapter.updateOptions(newOptions);
69374
69374
  this.toggle2SearchInput(true);
69375
+ } else {
69376
+ // whether it is a filter or not, isFocus is guaranteed to be true when open
69377
+ this._adapter.updateFocusState(true);
69375
69378
  }
69376
69379
  this._adapter.openMenu();
69377
69380
  this._setDropdownWidth();
@@ -69398,8 +69401,8 @@ class SelectFoundation extends foundation {
69398
69401
  this._adapter.setIsFocusInContainer(false);
69399
69402
  // this.unBindKeyBoardEvent();
69400
69403
  // this._notifyBlur(e);
69401
- this._adapter.unregisterClickOutsideHandler();
69402
69404
  // this._adapter.updateFocusState(false);
69405
+ this._adapter.unregisterClickOutsideHandler();
69403
69406
  const isFilterable = this._isFilterable();
69404
69407
  if (isFilterable) {
69405
69408
  this.toggle2SearchInput(false);
@@ -70086,7 +70089,6 @@ class SelectFoundation extends foundation {
70086
70089
  this._adapter.setIsFocusInContainer(false);
70087
70090
  }
70088
70091
  handleTriggerBlur(e) {
70089
- this._adapter.updateFocusState(false);
70090
70092
  const {
70091
70093
  filter,
70092
70094
  autoFocus
@@ -70099,6 +70101,7 @@ class SelectFoundation extends foundation {
70099
70101
  // But when autoFocus or the panel is close, because clickOutsideHandler is not register or unregister, you need to listen for the trigger's blur and trigger the notify callback
70100
70102
  if (isFocus && !isOpen) {
70101
70103
  this._notifyBlur(e);
70104
+ this._adapter.updateFocusState(false);
70102
70105
  }
70103
70106
  }
70104
70107
  handleInputBlur(e) {
@@ -88234,6 +88237,34 @@ function IconFolder_SvgComponent(props) {
88234
88237
  }
88235
88238
  const IconFolder_IconComponent = convertIcon(IconFolder_SvgComponent, 'folder');
88236
88239
  /* harmony default export */ const IconFolder = (IconFolder_IconComponent);
88240
+ ;// CONCATENATED MODULE: ./tree/indent.tsx
88241
+
88242
+
88243
+ const Indent = _ref => {
88244
+ let {
88245
+ prefixcls,
88246
+ level,
88247
+ isEnd,
88248
+ showLine
88249
+ } = _ref;
88250
+ const baseClassName = `${prefixcls}-indent-unit`;
88251
+ const list = [];
88252
+ for (let i = 0; i < level; i += 1) {
88253
+ list.push( /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("span", {
88254
+ key: i,
88255
+ className: classnames_default()(baseClassName, {
88256
+ [`${baseClassName}-end`]: isEnd[i]
88257
+ })
88258
+ }));
88259
+ }
88260
+ return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("span", {
88261
+ "aria-hidden": "true",
88262
+ className: classnames_default()(`${prefixcls}-indent`, {
88263
+ [`${prefixcls}-indent-show-line`]: showLine
88264
+ })
88265
+ }, list);
88266
+ };
88267
+ /* harmony default export */ const indent = (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.memo(Indent));
88237
88268
  ;// CONCATENATED MODULE: ./tree/treeNode.tsx
88238
88269
 
88239
88270
 
@@ -88258,6 +88289,7 @@ var treeNode_rest = undefined && undefined.__rest || function (s, e) {
88258
88289
 
88259
88290
 
88260
88291
 
88292
+
88261
88293
  const treeNode_prefixcls = tree_constants_cssClasses.PREFIX_OPTION;
88262
88294
  class TreeNode extends external_root_React_commonjs2_react_commonjs_react_amd_react_.PureComponent {
88263
88295
  constructor(props) {
@@ -88432,6 +88464,18 @@ class TreeNode extends external_root_React_commonjs2_react_commonjs_react_amd_re
88432
88464
  }
88433
88465
  return Boolean(treeDisabled || disabled);
88434
88466
  };
88467
+ // Switcher
88468
+ this.renderSwitcher = () => {
88469
+ if (this.isLeaf()) {
88470
+ // if switcherIconDom is null, no render switcher span
88471
+ return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("span", {
88472
+ className: classnames_default()(`${treeNode_prefixcls}-switcher`)
88473
+ }, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("span", {
88474
+ className: `${treeNode_prefixcls}-switcher-leaf-line`
88475
+ }));
88476
+ }
88477
+ return null;
88478
+ };
88435
88479
  this.renderRealLabel = () => {
88436
88480
  const {
88437
88481
  renderLabel
@@ -88471,7 +88515,8 @@ class TreeNode extends external_root_React_commonjs2_react_commonjs_react_amd_re
88471
88515
  const showIcon = !this.isLeaf();
88472
88516
  const {
88473
88517
  loading,
88474
- expanded
88518
+ expanded,
88519
+ showLine
88475
88520
  } = this.props;
88476
88521
  if (loading) {
88477
88522
  return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(spin_0, {
@@ -88487,6 +88532,9 @@ class TreeNode extends external_root_React_commonjs2_react_commonjs_react_amd_re
88487
88532
  onClick: this.onExpand
88488
88533
  });
88489
88534
  }
88535
+ if (showLine) {
88536
+ return this.renderSwitcher();
88537
+ }
88490
88538
  return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("span", {
88491
88539
  className: `${treeNode_prefixcls}-empty-icon`
88492
88540
  });
@@ -88570,9 +88618,11 @@ class TreeNode extends external_root_React_commonjs2_react_commonjs_react_amd_re
88570
88618
  filtered,
88571
88619
  treeNodeFilterProp,
88572
88620
  display,
88573
- style
88621
+ style,
88622
+ isEnd,
88623
+ showLine
88574
88624
  } = _a,
88575
- rest = treeNode_rest(_a, ["eventKey", "expanded", "selected", "checked", "halfChecked", "loading", "active", "level", "empty", "filtered", "treeNodeFilterProp", "display", "style"]);
88625
+ rest = treeNode_rest(_a, ["eventKey", "expanded", "selected", "checked", "halfChecked", "loading", "active", "level", "empty", "filtered", "treeNodeFilterProp", "display", "style", "isEnd", "showLine"]);
88576
88626
  if (empty) {
88577
88627
  return this.renderEmptyNode();
88578
88628
  }
@@ -88584,6 +88634,7 @@ class TreeNode extends external_root_React_commonjs2_react_commonjs_react_amd_re
88584
88634
  dropPosition,
88585
88635
  labelEllipsis
88586
88636
  } = this.context;
88637
+ const isEndNode = isEnd[isEnd.length - 1];
88587
88638
  const disabled = this.isDisabled();
88588
88639
  const dragOver = dragOverNodeKey === eventKey && dropPosition === 0;
88589
88640
  const dragOverGapTop = dragOverNodeKey === eventKey && dropPosition === -1;
@@ -88601,7 +88652,8 @@ class TreeNode extends external_root_React_commonjs2_react_commonjs_react_amd_re
88601
88652
  [`${treeNode_prefixcls}-fullLabel-draggable`]: !disabled && draggable && renderFullLabel,
88602
88653
  // When draggable + renderFullLabel is turned on, the style of dragover
88603
88654
  [`${treeNode_prefixcls}-fullLabel-drag-over-gap-top`]: !disabled && dragOverGapTop && renderFullLabel,
88604
- [`${treeNode_prefixcls}-fullLabel-drag-over-gap-bottom`]: !disabled && dragOverGapBottom && renderFullLabel
88655
+ [`${treeNode_prefixcls}-fullLabel-drag-over-gap-bottom`]: !disabled && dragOverGapBottom && renderFullLabel,
88656
+ [`${treeNode_prefixcls}-tree-node-last-leaf`]: isEndNode
88605
88657
  });
88606
88658
  const labelProps = {
88607
88659
  onClick: this.onClick,
@@ -88677,7 +88729,12 @@ class TreeNode extends external_root_React_commonjs2_react_commonjs_react_amd_re
88677
88729
  onDoubleClick: this.onDoubleClick,
88678
88730
  ref: this.setRef,
88679
88731
  style: style
88680
- }, dragProps), this.renderArrow(), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("span", {
88732
+ }, dragProps), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(indent, {
88733
+ showLine: showLine,
88734
+ prefixcls: treeNode_prefixcls,
88735
+ level: level,
88736
+ isEnd: isEnd
88737
+ }), this.renderArrow(), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("span", {
88681
88738
  className: labelCls
88682
88739
  }, multiple ? this.renderCheckbox() : null, this.renderIcon(), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("span", {
88683
88740
  className: `${treeNode_prefixcls}-label-text`
@@ -88702,7 +88759,9 @@ TreeNode.propTypes = {
88702
88759
  keyword: (prop_types_default()).string,
88703
88760
  treeNodeFilterProp: (prop_types_default()).string,
88704
88761
  selectedKey: (prop_types_default()).string,
88705
- motionKey: prop_types_default().oneOfType([(prop_types_default()).string, prop_types_default().arrayOf((prop_types_default()).string)])
88762
+ motionKey: prop_types_default().oneOfType([(prop_types_default()).string, prop_types_default().arrayOf((prop_types_default()).string)]),
88763
+ isEnd: prop_types_default().arrayOf((prop_types_default()).bool),
88764
+ showLine: (prop_types_default()).bool
88706
88765
  };
88707
88766
  TreeNode.defaultProps = {
88708
88767
  selectedKey: '',
@@ -89007,12 +89066,14 @@ class Tree extends BaseComponent {
89007
89066
  return null;
89008
89067
  }
89009
89068
  const {
89010
- keyMaps
89069
+ keyMaps,
89070
+ showLine
89011
89071
  } = this.props;
89012
- const props = pick_default()(treeNode, ['key', 'label', 'disabled', 'isLeaf', 'icon']);
89072
+ const props = pick_default()(treeNode, ['key', 'label', 'disabled', 'isLeaf', 'icon', 'isEnd']);
89013
89073
  const children = data[get_default()(keyMaps, 'children', 'children')];
89014
89074
  !isUndefined_default()(children) && (props.children = children);
89015
89075
  return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(TreeNode, Object.assign({}, treeNodeProps, data, props, {
89076
+ showLine: showLine,
89016
89077
  data: data,
89017
89078
  style: isEmpty_default()(style) ? {} : style
89018
89079
  }));
@@ -89446,6 +89507,7 @@ class Tree extends BaseComponent {
89446
89507
  directory,
89447
89508
  multiple,
89448
89509
  showFilteredOnly,
89510
+ showLine,
89449
89511
  motion,
89450
89512
  expandAction,
89451
89513
  loadData,
@@ -89456,7 +89518,7 @@ class Tree extends BaseComponent {
89456
89518
  virtualize,
89457
89519
  checkRelation
89458
89520
  } = _a,
89459
- rest = tree_rest(_a, ["blockNode", "className", "style", "filterTreeNode", "disabled", "icon", "directory", "multiple", "showFilteredOnly", "motion", "expandAction", "loadData", "renderLabel", "draggable", "renderFullLabel", "labelEllipsis", "virtualize", "checkRelation"]);
89521
+ rest = tree_rest(_a, ["blockNode", "className", "style", "filterTreeNode", "disabled", "icon", "directory", "multiple", "showFilteredOnly", "showLine", "motion", "expandAction", "loadData", "renderLabel", "draggable", "renderFullLabel", "labelEllipsis", "virtualize", "checkRelation"]);
89460
89522
  const wrapperCls = classnames_default()(`${tree_prefixcls}-wrapper`, className);
89461
89523
  const listCls = classnames_default()(`${tree_prefixcls}-option-list`, {
89462
89524
  [`${tree_prefixcls}-option-list-block`]: blockNode
@@ -89545,6 +89607,7 @@ Tree.propTypes = {
89545
89607
  searchStyle: (prop_types_default()).object,
89546
89608
  selectedKey: (prop_types_default()).string,
89547
89609
  showFilteredOnly: (prop_types_default()).bool,
89610
+ showLine: (prop_types_default()).bool,
89548
89611
  style: (prop_types_default()).object,
89549
89612
  treeData: prop_types_default().arrayOf(prop_types_default().shape({
89550
89613
  key: (prop_types_default()).string,
@@ -89596,6 +89659,7 @@ Tree.defaultProps = {
89596
89659
  motion: true,
89597
89660
  leafOnly: false,
89598
89661
  showFilteredOnly: false,
89662
+ showLine: false,
89599
89663
  expandAction: false,
89600
89664
  disableStrictly: false,
89601
89665
  draggable: false,
@@ -89641,6 +89705,12 @@ class TreeSelectFoundation extends foundation {
89641
89705
  this.close(e);
89642
89706
  });
89643
89707
  };
89708
+ this.clearInputValue = () => {
89709
+ const {
89710
+ inputValue
89711
+ } = this.getStates();
89712
+ inputValue && this._adapter.updateInputValue('');
89713
+ };
89644
89714
  }
89645
89715
  init() {
89646
89716
  const {
@@ -89792,7 +89862,7 @@ class TreeSelectFoundation extends foundation {
89792
89862
  const isSearching = Boolean(inputValue);
89793
89863
  const treeNodeProps = {
89794
89864
  eventKey: key,
89795
- expanded: isSearching && !this._isExpandControlled() ? filteredExpandedKeys.has(key) : expandedKeys.has(key),
89865
+ expanded: isSearching ? filteredExpandedKeys.has(key) : expandedKeys.has(key),
89796
89866
  selected: selectedKeys.includes(key),
89797
89867
  checked: realChecked,
89798
89868
  halfChecked: realHalfChecked,
@@ -90065,8 +90135,8 @@ class TreeSelectFoundation extends foundation {
90065
90135
  expandedOptsKeys.forEach(item => newExpandedKeys.add(item));
90066
90136
  const newFlattenNodes = flattenTreeData(treeData, newExpandedKeys, keyMaps);
90067
90137
  this._adapter.updateState({
90068
- expandedKeys: isExpandControlled ? expandedKeys : newExpandedKeys,
90069
- flattenNodes: isExpandControlled ? flattenNodes : newFlattenNodes,
90138
+ expandedKeys: newExpandedKeys,
90139
+ flattenNodes: newFlattenNodes,
90070
90140
  inputValue: '',
90071
90141
  motionKeys: new Set([]),
90072
90142
  filteredKeys: new Set([]),
@@ -90115,8 +90185,8 @@ class TreeSelectFoundation extends foundation {
90115
90185
  const newFilteredExpandedKeys = new Set(expandedOptsKeys);
90116
90186
  this._adapter.notifySearch(sugInput, Array.from(newFilteredExpandedKeys));
90117
90187
  this._adapter.updateState({
90118
- expandedKeys: this._isExpandControlled() ? expandedKeys : newExpandedKeys,
90119
- flattenNodes: this._isExpandControlled() ? flattenNodes : newFlattenNodes,
90188
+ expandedKeys: newExpandedKeys,
90189
+ flattenNodes: newFlattenNodes,
90120
90190
  motionKeys: new Set([]),
90121
90191
  filteredKeys: new Set(filteredOptsKeys),
90122
90192
  filteredExpandedKeys: newFilteredExpandedKeys,
@@ -90324,7 +90394,7 @@ class TreeSelectFoundation extends foundation {
90324
90394
  return;
90325
90395
  }
90326
90396
  const isExpandControlled = this._isExpandControlled();
90327
- if (isSearching && !isExpandControlled) {
90397
+ if (isSearching) {
90328
90398
  this.handleNodeExpandInSearch(e, treeNode);
90329
90399
  return;
90330
90400
  }
@@ -91094,23 +91164,40 @@ class TreeSelect extends BaseComponent {
91094
91164
  searchAutoFocus,
91095
91165
  searchPosition
91096
91166
  } = this.props;
91097
- if (isVisible === false && Boolean(filterTreeNode)) {
91098
- this.foundation.clearInput();
91167
+ // inputValue 清空,如果有选中值的话,选中项能够快速回显
91168
+ // Clear the inputValue. If there is a selected value, the selected item can be quickly echoed.
91169
+ if (isVisible === false && filterTreeNode) {
91170
+ this.foundation.clearInputValue();
91099
91171
  }
91100
91172
  if (filterTreeNode && searchPosition === treeSelect_constants_strings.SEARCH_POSITION_DROPDOWN && isVisible && searchAutoFocus) {
91101
91173
  this.foundation.focusInput(true);
91102
91174
  }
91103
91175
  };
91176
+ this.afterClose = () => {
91177
+ // flattenNode 的变化将导致弹出层面板中的选项数目变化
91178
+ // 在弹层完全收起之后,再通过 clearInput 重新计算 state 中的 expandedKey, flattenNode
91179
+ // 防止在弹出层未收起时弹层面板中选项数目变化导致视觉上出现弹层闪动问题
91180
+ // Changes to flattenNode will cause the number of options in the popup panel to change
91181
+ // After the pop-up layer is completely closed, recalculate the expandedKey and flattenNode in the state through clearInput.
91182
+ // Prevent the pop-up layer from flickering visually due to changes in the number of options in the pop-up panel when the pop-up layer is not collapsed.
91183
+ const {
91184
+ filterTreeNode
91185
+ } = this.props;
91186
+ filterTreeNode && this.foundation.clearInput();
91187
+ };
91104
91188
  this.renderTreeNode = (treeNode, ind, style) => {
91105
91189
  const {
91106
91190
  data,
91107
91191
  key
91108
91192
  } = treeNode;
91109
91193
  const treeNodeProps = this.foundation.getTreeNodeProps(key);
91194
+ const {
91195
+ showLine
91196
+ } = this.props;
91110
91197
  if (!treeNodeProps) {
91111
91198
  return null;
91112
91199
  }
91113
- const props = pick_default()(treeNode, ['key', 'label', 'disabled', 'isLeaf', 'icon']);
91200
+ const props = pick_default()(treeNode, ['key', 'label', 'disabled', 'isLeaf', 'icon', 'isEnd']);
91114
91201
  const {
91115
91202
  keyMaps
91116
91203
  } = this.props;
@@ -91118,7 +91205,8 @@ class TreeSelect extends BaseComponent {
91118
91205
  !isUndefined_default()(children) && (props.children = children);
91119
91206
  return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(TreeNode, Object.assign({}, treeNodeProps, data, props, {
91120
91207
  data: data,
91121
- style: style
91208
+ style: style,
91209
+ showLine: showLine
91122
91210
  }));
91123
91211
  };
91124
91212
  this.itemKey = (index, data) => {
@@ -91133,6 +91221,7 @@ class TreeSelect extends BaseComponent {
91133
91221
  this.renderNodeList = () => {
91134
91222
  const {
91135
91223
  flattenNodes,
91224
+ cachedFlattenNodes,
91136
91225
  motionKeys,
91137
91226
  motionType,
91138
91227
  filteredKeys
@@ -91148,7 +91237,7 @@ class TreeSelect extends BaseComponent {
91148
91237
  if (!virtualize || isEmpty_default()(virtualize)) {
91149
91238
  return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(NodeList, {
91150
91239
  flattenNodes: flattenNodes,
91151
- flattenList: this._flattenNodes,
91240
+ flattenList: cachedFlattenNodes,
91152
91241
  motionKeys: motionExpand ? motionKeys : new Set([]),
91153
91242
  motionType: motionType,
91154
91243
  // When motionKeys is empty, but filteredKeys is not empty (that is, the search hits), this situation should be distinguished from ordinary motionKeys
@@ -91267,6 +91356,7 @@ class TreeSelect extends BaseComponent {
91267
91356
  keyEntities: {},
91268
91357
  treeData: [],
91269
91358
  flattenNodes: [],
91359
+ cachedFlattenNodes: undefined,
91270
91360
  selectedKeys: [],
91271
91361
  checkedKeys: new Set(),
91272
91362
  halfCheckedKeys: new Set(),
@@ -91296,6 +91386,7 @@ class TreeSelect extends BaseComponent {
91296
91386
  };
91297
91387
  }
91298
91388
  static getDerivedStateFromProps(props, prevState) {
91389
+ var _a;
91299
91390
  const {
91300
91391
  prevProps,
91301
91392
  rePosKey
@@ -91313,6 +91404,8 @@ class TreeSelect extends BaseComponent {
91313
91404
  };
91314
91405
  const needUpdateTreeData = needUpdate('treeData');
91315
91406
  const needUpdateExpandedKeys = needUpdate('expandedKeys');
91407
+ const isExpandControlled = ('expandedKeys' in props);
91408
+ const isSearching = Boolean(props.filterTreeNode && prevState.inputValue && prevState.inputValue.length);
91316
91409
  // TreeNode
91317
91410
  if (needUpdateTreeData) {
91318
91411
  treeData = props.treeData;
@@ -91331,31 +91424,97 @@ class TreeSelect extends BaseComponent {
91331
91424
  }
91332
91425
  }
91333
91426
  const expandAllWhenDataChange = needUpdateTreeData && props.expandAll;
91334
- // expandedKeys
91335
- if (needUpdateExpandedKeys || prevProps && needUpdate('autoExpandParent')) {
91336
- newState.expandedKeys = calcExpandedKeys(props.expandedKeys, keyEntities, props.autoExpandParent || !prevProps);
91337
- // only show animation when treeData does not change
91338
- if (prevProps && props.motion && !treeData) {
91339
- const {
91340
- motionKeys,
91341
- motionType
91342
- } = calcMotionKeys(prevState.expandedKeys, newState.expandedKeys, keyEntities);
91343
- newState.motionKeys = new Set(motionKeys);
91344
- newState.motionType = motionType;
91345
- }
91346
- } else if (!prevProps && (props.defaultExpandAll || props.expandAll) || expandAllWhenDataChange) {
91347
- newState.expandedKeys = new Set(Object.keys(keyEntities));
91348
- } else if (!prevProps && props.defaultExpandedKeys) {
91349
- newState.expandedKeys = calcExpandedKeys(props.defaultExpandedKeys, keyEntities);
91350
- } else if (!prevProps && props.defaultValue) {
91351
- newState.expandedKeys = calcExpandedKeysForValues(normalizeValue(props.defaultValue, withObject, keyMaps), keyEntities, props.multiple, valueEntities);
91352
- } else if (!prevProps && props.value) {
91353
- newState.expandedKeys = calcExpandedKeysForValues(normalizeValue(props.value, withObject, keyMaps), keyEntities, props.multiple, valueEntities);
91354
- }
91355
- // flattenNodes
91356
- if (treeData || needUpdateExpandedKeys) {
91357
- const flattenNodes = flattenTreeData(treeData || prevState.treeData, newState.expandedKeys || prevState.expandedKeys, keyMaps);
91358
- newState.flattenNodes = flattenNodes;
91427
+ if (!isSearching) {
91428
+ // expandedKeys
91429
+ if (needUpdateExpandedKeys || prevProps && needUpdate('autoExpandParent')) {
91430
+ newState.expandedKeys = calcExpandedKeys(props.expandedKeys, keyEntities, props.autoExpandParent || !prevProps);
91431
+ // only show animation when treeData does not change
91432
+ if (prevProps && props.motion && !treeData) {
91433
+ const {
91434
+ motionKeys,
91435
+ motionType
91436
+ } = calcMotionKeys(prevState.expandedKeys, newState.expandedKeys, keyEntities);
91437
+ newState.motionKeys = new Set(motionKeys);
91438
+ newState.motionType = motionType;
91439
+ if (motionType === 'hide') {
91440
+ // cache flatten nodes: expandedKeys changed may not be triggered by interaction
91441
+ newState.cachedFlattenNodes = treeUtil_cloneDeep(prevState.flattenNodes);
91442
+ }
91443
+ }
91444
+ } else if (!prevProps && (props.defaultExpandAll || props.expandAll) || expandAllWhenDataChange) {
91445
+ newState.expandedKeys = new Set(Object.keys(keyEntities));
91446
+ } else if (!prevProps && props.defaultExpandedKeys) {
91447
+ newState.expandedKeys = calcExpandedKeys(props.defaultExpandedKeys, keyEntities);
91448
+ } else if (!prevProps && props.defaultValue) {
91449
+ newState.expandedKeys = calcExpandedKeysForValues(normalizeValue(props.defaultValue, withObject, keyMaps), keyEntities, props.multiple, valueEntities);
91450
+ } else if (!prevProps && props.value) {
91451
+ newState.expandedKeys = calcExpandedKeysForValues(normalizeValue(props.value, withObject, keyMaps), keyEntities, props.multiple, valueEntities);
91452
+ } else if (!isExpandControlled && needUpdateTreeData && props.value) {
91453
+ // 当 treeData 已经设置具体的值,并且设置了 props.loadData ,则认为 treeData 的更新是因为 loadData 导致的
91454
+ // 如果是因为 loadData 导致 treeData改变, 此时在这里重新计算 key 会导致为未选中的展开项目被收起
91455
+ // 所以此时不需要重新计算 expandedKeys,因为在点击展开按钮时候已经把被展开的项添加到 expandedKeys 中
91456
+ // When treeData has a specific value and props.loadData is set, it is considered that the update of treeData is caused by loadData
91457
+ // If the treeData is changed because of loadData, recalculating the key here will cause the unselected expanded items to be collapsed
91458
+ // So there is no need to recalculate expandedKeys at this time, because the expanded item has been added to expandedKeys when the expand button is clicked
91459
+ if (!(prevState.treeData && ((_a = prevState.treeData) === null || _a === void 0 ? void 0 : _a.length) > 0 && props.loadData)) {
91460
+ newState.expandedKeys = calcExpandedKeysForValues(props.value, keyEntities, props.multiple, valueEntities);
91461
+ }
91462
+ }
91463
+ if (!newState.expandedKeys) {
91464
+ delete newState.expandedKeys;
91465
+ }
91466
+ if (treeData || newState.expandedKeys) {
91467
+ const flattenNodes = flattenTreeData(treeData || prevState.treeData, newState.expandedKeys || prevState.expandedKeys, keyMaps);
91468
+ newState.flattenNodes = flattenNodes;
91469
+ }
91470
+ } else {
91471
+ let filteredState;
91472
+ // treeData changed while searching
91473
+ if (treeData) {
91474
+ // Get filter data
91475
+ filteredState = filterTreeData({
91476
+ treeData,
91477
+ inputValue: prevState.inputValue,
91478
+ filterTreeNode: props.filterTreeNode,
91479
+ filterProps: props.treeNodeFilterProp,
91480
+ showFilteredOnly: props.showFilteredOnly,
91481
+ keyEntities: newState.keyEntities,
91482
+ prevExpandedKeys: [...prevState.filteredExpandedKeys],
91483
+ keyMaps: keyMaps
91484
+ });
91485
+ newState.flattenNodes = filteredState.flattenNodes;
91486
+ newState.motionKeys = new Set([]);
91487
+ newState.filteredKeys = filteredState.filteredKeys;
91488
+ newState.filteredShownKeys = filteredState.filteredShownKeys;
91489
+ newState.filteredExpandedKeys = filteredState.filteredExpandedKeys;
91490
+ }
91491
+ // expandedKeys changed while searching
91492
+ if (props.expandedKeys) {
91493
+ newState.filteredExpandedKeys = calcExpandedKeys(props.expandedKeys, keyEntities, props.autoExpandParent || !prevProps);
91494
+ if (prevProps && props.motion) {
91495
+ const prevKeys = prevState ? prevState.filteredExpandedKeys : new Set([]);
91496
+ // only show animation when treeData does not change
91497
+ if (!treeData) {
91498
+ const motionResult = calcMotionKeys(prevKeys, newState.filteredExpandedKeys, keyEntities);
91499
+ let {
91500
+ motionKeys
91501
+ } = motionResult;
91502
+ const {
91503
+ motionType
91504
+ } = motionResult;
91505
+ if (props.showFilteredOnly) {
91506
+ motionKeys = motionKeys.filter(key => prevState.filteredShownKeys.has(key));
91507
+ }
91508
+ if (motionType === 'hide') {
91509
+ // cache flatten nodes: expandedKeys changed may not be triggered by interaction
91510
+ newState.cachedFlattenNodes = treeUtil_cloneDeep(prevState.flattenNodes);
91511
+ }
91512
+ newState.motionKeys = new Set(motionKeys);
91513
+ newState.motionType = motionType;
91514
+ }
91515
+ }
91516
+ newState.flattenNodes = flattenTreeData(treeData || prevState.treeData, newState.filteredExpandedKeys || prevState.filteredExpandedKeys, keyMaps, props.showFilteredOnly && prevState.filteredShownKeys);
91517
+ }
91359
91518
  }
91360
91519
  // selectedKeys: single mode controlled
91361
91520
  const isMultiple = props.multiple;
@@ -91462,7 +91621,9 @@ class TreeSelect extends BaseComponent {
91462
91621
  this.props.onSearch && this.props.onSearch(input, filteredExpandedKeys);
91463
91622
  },
91464
91623
  cacheFlattenNodes: bool => {
91465
- this._flattenNodes = bool ? treeUtil_cloneDeep(this.state.flattenNodes) : null;
91624
+ this.setState({
91625
+ cachedFlattenNodes: bool ? treeUtil_cloneDeep(this.state.flattenNodes) : undefined
91626
+ });
91466
91627
  },
91467
91628
  notifyLoad: (newLoadedKeys, data) => {
91468
91629
  const {
@@ -91607,7 +91768,8 @@ class TreeSelect extends BaseComponent {
91607
91768
  autoAdjustOverflow: autoAdjustOverflow,
91608
91769
  mouseLeaveDelay: mouseLeaveDelay,
91609
91770
  mouseEnterDelay: mouseEnterDelay,
91610
- onVisibleChange: this.handlePopoverClose
91771
+ onVisibleChange: this.handlePopoverClose,
91772
+ afterClose: this.afterClose
91611
91773
  }, selection);
91612
91774
  }
91613
91775
  }
@@ -91652,6 +91814,7 @@ TreeSelect.propTypes = {
91652
91814
  showSearchClear: (prop_types_default()).bool,
91653
91815
  autoAdjustOverflow: (prop_types_default()).bool,
91654
91816
  showFilteredOnly: (prop_types_default()).bool,
91817
+ showLine: (prop_types_default()).bool,
91655
91818
  motionExpand: (prop_types_default()).bool,
91656
91819
  emptyContent: (prop_types_default()).node,
91657
91820
  keyMaps: (prop_types_default()).object,
@@ -98962,14 +99125,14 @@ const PreviewContext = /*#__PURE__*/(0,external_root_React_commonjs2_react_commo
98962
99125
 
98963
99126
 
98964
99127
  const previewHeader_prefixCls = `${image_constants_cssClasses.PREFIX}-preview-header`;
98965
- const previewHeader_Header = _ref => {
99128
+ const previewHeader_Header = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef)((_ref, ref) => {
98966
99129
  let {
98967
99130
  onClose,
98968
99131
  titleStyle,
98969
99132
  className,
98970
99133
  renderHeader
98971
99134
  } = _ref;
98972
- return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(PreviewContext.Consumer, null, _ref2 => {
99135
+ return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(PreviewContext.Consumer, null, _ref2 => {
98973
99136
  let {
98974
99137
  currentIndex,
98975
99138
  titles
@@ -98978,17 +99141,18 @@ const previewHeader_Header = _ref => {
98978
99141
  if (titles && typeof currentIndex === "number") {
98979
99142
  title = titles[currentIndex];
98980
99143
  }
98981
- return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("section", {
99144
+ return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("section", {
99145
+ ref: ref,
98982
99146
  className: classnames_default()(previewHeader_prefixCls, className)
98983
- }, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("section", {
99147
+ }, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("section", {
98984
99148
  className: `${previewHeader_prefixCls}-title`,
98985
99149
  style: titleStyle
98986
- }, renderHeader ? renderHeader(title) : title), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("section", {
99150
+ }, renderHeader ? renderHeader(title) : title), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("section", {
98987
99151
  className: `${previewHeader_prefixCls}-close`,
98988
99152
  onMouseUp: onClose
98989
- }, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(IconClose, null)));
99153
+ }, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(IconClose, null)));
98990
99154
  });
98991
- };
99155
+ });
98992
99156
  /* harmony default export */ const previewHeader = (previewHeader_Header);
98993
99157
  ;// CONCATENATED MODULE: ../semi-icons/lib/es/icons/IconMinus.js
98994
99158
 
@@ -99144,7 +99308,6 @@ class PreviewFooterFoundation extends foundation {
99144
99308
  } else {
99145
99309
  onZoomOut(Number((value / 100).toFixed(2)));
99146
99310
  }
99147
- this._adapter.setStartMouseOffset(value);
99148
99311
  };
99149
99312
  this.handleRatioClick = () => {
99150
99313
  const {
@@ -99177,14 +99340,9 @@ class PreviewFooterFoundation extends foundation {
99177
99340
 
99178
99341
  const previewFooter_prefixCls = image_constants_cssClasses.PREFIX;
99179
99342
  const footerPrefixCls = `${image_constants_cssClasses.PREFIX}-preview-footer`;
99180
- let mouseActiveTime = 0;
99181
99343
  class previewFooter_Footer extends BaseComponent {
99182
99344
  get adapter() {
99183
- return Object.assign(Object.assign({}, super.adapter), {
99184
- setStartMouseOffset: time => {
99185
- mouseActiveTime = time;
99186
- }
99187
- });
99345
+ return Object.assign({}, super.adapter);
99188
99346
  }
99189
99347
  constructor(props) {
99190
99348
  super(props);
@@ -99424,13 +99582,15 @@ class previewFooter_Footer extends BaseComponent {
99424
99582
  render() {
99425
99583
  const {
99426
99584
  className,
99427
- renderPreviewMenu
99585
+ renderPreviewMenu,
99586
+ forwardRef
99428
99587
  } = this.props;
99429
99588
  const menuCls = classnames_default()(footerPrefixCls, `${footerPrefixCls}-wrapper`, className, {
99430
99589
  [`${footerPrefixCls}-content`]: !Boolean(renderPreviewMenu)
99431
99590
  });
99432
99591
  return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("section", {
99433
- className: menuCls
99592
+ className: menuCls,
99593
+ ref: forwardRef
99434
99594
  }, renderPreviewMenu ? this.customRenderViewMenu() : this.getFooterMenu());
99435
99595
  }
99436
99596
  }
@@ -99469,9 +99629,6 @@ previewFooter_Footer.defaultProps = {
99469
99629
  };
99470
99630
  ;// CONCATENATED MODULE: ../semi-foundation/image/previewImageFoundation.ts
99471
99631
 
99472
-
99473
-
99474
-
99475
99632
  const DefaultDOMRect = {
99476
99633
  bottom: 0,
99477
99634
  height: 0,
@@ -99486,6 +99643,12 @@ const DefaultDOMRect = {
99486
99643
  class PreviewImageFoundation extends foundation {
99487
99644
  constructor(adapter) {
99488
99645
  super(Object.assign({}, adapter));
99646
+ this.startMouseOffset = {
99647
+ x: 0,
99648
+ y: 0
99649
+ };
99650
+ this.originImageWidth = null;
99651
+ this.originImageHeight = null;
99489
99652
  this._isImageVertical = () => this.getProp("rotation") % 180 !== 0;
99490
99653
  this._getImageBounds = () => {
99491
99654
  const imageDOM = this._adapter.getImage();
@@ -99515,32 +99678,18 @@ class PreviewImageFoundation extends foundation {
99515
99678
  this._adapter.setLoading(loading);
99516
99679
  };
99517
99680
  this.handleWindowResize = () => {
99518
- const {
99519
- ratio,
99520
- setRatio
99521
- } = this.getProps();
99522
- const {
99523
- originImageWidth,
99524
- originImageHeight
99525
- } = this._adapter.getOriginImageSize();
99526
- if (originImageWidth && originImageHeight) {
99527
- if (ratio !== "adaptation") {
99528
- setRatio("adaptation");
99529
- } else {
99530
- this.handleResizeImage();
99531
- }
99681
+ if (this.originImageWidth && this.originImageHeight) {
99682
+ this.handleResizeImage();
99532
99683
  }
99533
99684
  };
99534
99685
  this.handleLoad = e => {
99535
99686
  if (e.target) {
99536
99687
  const {
99537
- width: w,
99538
- height: h
99688
+ naturalWidth: w,
99689
+ naturalHeight: h
99539
99690
  } = e.target;
99540
- this._adapter.setOriginImageSize({
99541
- originImageWidth: w,
99542
- originImageHeight: h
99543
- });
99691
+ this.originImageHeight = h;
99692
+ this.originImageWidth = w;
99544
99693
  this.setState({
99545
99694
  loading: false
99546
99695
  });
@@ -99565,13 +99714,14 @@ class PreviewImageFoundation extends foundation {
99565
99714
  this.handleResizeImage = () => {
99566
99715
  const horizontal = !this._isImageVertical();
99567
99716
  const {
99568
- originImageWidth,
99569
- originImageHeight
99570
- } = this._adapter.getOriginImageSize();
99571
- const imgWidth = horizontal ? originImageWidth : originImageHeight;
99572
- const imgHeight = horizontal ? originImageHeight : originImageWidth;
99717
+ currZoom
99718
+ } = this.getStates();
99719
+ const imgWidth = horizontal ? this.originImageWidth : this.originImageHeight;
99720
+ const imgHeight = horizontal ? this.originImageHeight : this.originImageWidth;
99573
99721
  const {
99574
- onZoom
99722
+ onZoom,
99723
+ setRatio,
99724
+ ratio
99575
99725
  } = this.getProps();
99576
99726
  const containerDOM = this._adapter.getContainer();
99577
99727
  if (containerDOM) {
@@ -99581,8 +99731,44 @@ class PreviewImageFoundation extends foundation {
99581
99731
  } = this._getContainerBounds();
99582
99732
  const reservedWidth = containerWidth - 80;
99583
99733
  const reservedHeight = containerHeight - 80;
99584
- const _zoom = Number(Math.min(reservedWidth / imgWidth, reservedHeight / imgHeight).toFixed(2));
99585
- onZoom(_zoom);
99734
+ let _zoom = 1;
99735
+ if (imgWidth > reservedWidth || imgHeight > reservedHeight) {
99736
+ _zoom = Number(Math.min(reservedWidth / imgWidth, reservedHeight / imgHeight).toFixed(2));
99737
+ }
99738
+ if (currZoom === _zoom) {
99739
+ this.calculatePreviewImage(_zoom, null);
99740
+ } else {
99741
+ onZoom(_zoom);
99742
+ }
99743
+ }
99744
+ };
99745
+ this.handleRatioChange = () => {
99746
+ if (this.originImageWidth && this.originImageHeight) {
99747
+ const {
99748
+ currZoom
99749
+ } = this.getStates();
99750
+ const {
99751
+ ratio,
99752
+ onZoom
99753
+ } = this.getProps();
99754
+ let _zoom;
99755
+ if (ratio === 'adaptation') {
99756
+ const horizontal = !this._isImageVertical();
99757
+ const imgWidth = horizontal ? this.originImageWidth : this.originImageHeight;
99758
+ const imgHeight = horizontal ? this.originImageHeight : this.originImageWidth;
99759
+ const {
99760
+ width: containerWidth,
99761
+ height: containerHeight
99762
+ } = this._getContainerBounds();
99763
+ const reservedWidth = containerWidth - 80;
99764
+ const reservedHeight = containerHeight - 80;
99765
+ _zoom = Number(Math.min(reservedWidth / imgWidth, reservedHeight / imgHeight).toFixed(2));
99766
+ } else {
99767
+ _zoom = 1;
99768
+ }
99769
+ if (currZoom !== _zoom) {
99770
+ onZoom(_zoom);
99771
+ }
99586
99772
  }
99587
99773
  };
99588
99774
  this.handleRightClickImage = e => {
@@ -99597,38 +99783,6 @@ class PreviewImageFoundation extends foundation {
99597
99783
  return true;
99598
99784
  }
99599
99785
  };
99600
- // e: WheelEvent<HTMLImageElement>
99601
- this.handleWheel = e => {
99602
- this.onWheel(e);
99603
- handlePrevent(e);
99604
- };
99605
- // e: WheelEvent<HTMLImageElement>
99606
- this.onWheel = throttle_default()(e => {
99607
- const {
99608
- onZoom,
99609
- zoomStep,
99610
- maxZoom,
99611
- minZoom
99612
- } = this.getProps();
99613
- const {
99614
- currZoom
99615
- } = this.getStates();
99616
- let _zoom;
99617
- if (e.deltaY < 0) {
99618
- /* zoom in */
99619
- if (currZoom + zoomStep <= maxZoom) {
99620
- _zoom = Number((currZoom + zoomStep).toFixed(2));
99621
- }
99622
- } else if (e.deltaY > 0) {
99623
- /* zoom out */
99624
- if (currZoom - zoomStep >= minZoom) {
99625
- _zoom = Number((currZoom - zoomStep).toFixed(2));
99626
- }
99627
- }
99628
- if (!isUndefined_default()(_zoom)) {
99629
- onZoom(_zoom);
99630
- }
99631
- }, 50);
99632
99786
  this.calcCanDragDirection = () => {
99633
99787
  const {
99634
99788
  width,
@@ -99652,12 +99806,8 @@ class PreviewImageFoundation extends foundation {
99652
99806
  canDragHorizontal
99653
99807
  };
99654
99808
  };
99655
- this.handleZoomChange = (newZoom, e) => {
99809
+ this.calculatePreviewImage = (newZoom, e) => {
99656
99810
  const imageDOM = this._adapter.getImage();
99657
- const {
99658
- originImageWidth,
99659
- originImageHeight
99660
- } = this._adapter.getOriginImageSize();
99661
99811
  const {
99662
99812
  canDragVertical,
99663
99813
  canDragHorizontal
@@ -99667,8 +99817,8 @@ class PreviewImageFoundation extends foundation {
99667
99817
  width: containerWidth,
99668
99818
  height: containerHeight
99669
99819
  } = this._getContainerBounds();
99670
- const newWidth = Math.floor(originImageWidth * newZoom);
99671
- const newHeight = Math.floor(originImageHeight * newZoom);
99820
+ const newWidth = Math.floor(this.originImageWidth * newZoom);
99821
+ const newHeight = Math.floor(this.originImageHeight * newZoom);
99672
99822
  // debugger;
99673
99823
  let _offset;
99674
99824
  const horizontal = !this._isImageVertical();
@@ -99727,13 +99877,13 @@ class PreviewImageFoundation extends foundation {
99727
99877
  width,
99728
99878
  height
99729
99879
  } = this.getStates();
99730
- const startMouseMove = this._adapter.getMouseMove();
99731
- const startMouseOffset = this._adapter.getMouseOffset();
99732
99880
  const {
99733
99881
  canDragVertical,
99734
99882
  canDragHorizontal
99735
99883
  } = this.calcCanDragDirection();
99736
- if (startMouseMove && (canDragVertical || canDragHorizontal)) {
99884
+ // https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/buttons
99885
+ const mouseLeftPress = e.buttons === 1;
99886
+ if (mouseLeftPress && (canDragVertical || canDragHorizontal)) {
99737
99887
  const {
99738
99888
  clientX,
99739
99889
  clientY
@@ -99746,8 +99896,8 @@ class PreviewImageFoundation extends foundation {
99746
99896
  left: extremeLeft,
99747
99897
  top: extremeTop
99748
99898
  } = this.calcExtremeBounds();
99749
- let newX = canDragHorizontal ? clientX - containerLeft - startMouseOffset.x : offset.x;
99750
- let newY = canDragVertical ? clientY - containerTop - startMouseOffset.y : offset.y;
99899
+ let newX = canDragHorizontal ? clientX - containerLeft - this.startMouseOffset.x : offset.x;
99900
+ let newY = canDragVertical ? clientY - containerTop - this.startMouseOffset.y : offset.y;
99751
99901
  if (canDragHorizontal) {
99752
99902
  newX = newX > 0 ? 0 : newX < extremeLeft ? extremeLeft : newX;
99753
99903
  }
@@ -99766,11 +99916,7 @@ class PreviewImageFoundation extends foundation {
99766
99916
  }
99767
99917
  };
99768
99918
  this.handleImageMouseDown = e => {
99769
- this._adapter.setStartMouseOffset(this._getOffset(e));
99770
- this._adapter.setStartMouseMove(true);
99771
- };
99772
- this.handleImageMouseUp = () => {
99773
- this._adapter.setStartMouseMove(false);
99919
+ this.startMouseOffset = this._getOffset(e);
99774
99920
  };
99775
99921
  }
99776
99922
  }
@@ -99783,38 +99929,14 @@ class PreviewImageFoundation extends foundation {
99783
99929
 
99784
99930
  const previewImage_prefixCls = image_constants_cssClasses.PREFIX;
99785
99931
  const preViewImgPrefixCls = `${previewImage_prefixCls}-preview-image`;
99786
- let originImageWidth = null;
99787
- let originImageHeight = null;
99788
- let startMouseMove = false;
99789
- // startMouseOffset:The offset of the mouse relative to the left and top of the picture
99790
- let startMouseOffset = {
99791
- x: 0,
99792
- y: 0
99793
- };
99794
99932
  class PreviewImage extends BaseComponent {
99795
99933
  get adapter() {
99796
99934
  return Object.assign(Object.assign({}, super.adapter), {
99797
- getOriginImageSize: () => ({
99798
- originImageWidth,
99799
- originImageHeight
99800
- }),
99801
- setOriginImageSize: size => {
99802
- originImageWidth = size.originImageWidth;
99803
- originImageHeight = size.originImageHeight;
99804
- },
99805
99935
  getContainer: () => {
99806
99936
  return this.containerRef.current;
99807
99937
  },
99808
99938
  getImage: () => {
99809
- return this.imageRef;
99810
- },
99811
- getMouseMove: () => startMouseMove,
99812
- setStartMouseMove: move => {
99813
- startMouseMove = move;
99814
- },
99815
- getMouseOffset: () => startMouseOffset,
99816
- setStartMouseOffset: offset => {
99817
- startMouseOffset = offset;
99939
+ return this.imageRef.current;
99818
99940
  },
99819
99941
  setLoading: loading => {
99820
99942
  this.setState({
@@ -99822,7 +99944,7 @@ class PreviewImage extends BaseComponent {
99822
99944
  });
99823
99945
  },
99824
99946
  setImageCursor: canDrag => {
99825
- this.imageRef.style.cursor = canDrag ? "grab" : "default";
99947
+ this.imageRef.current.style.cursor = canDrag ? "grab" : "default";
99826
99948
  }
99827
99949
  });
99828
99950
  }
@@ -99831,52 +99953,22 @@ class PreviewImage extends BaseComponent {
99831
99953
  this.onWindowResize = () => {
99832
99954
  this.foundation.handleWindowResize();
99833
99955
  };
99834
- this.handleZoomChange = (newZoom, e) => {
99835
- this.foundation.handleZoomChange(newZoom, e);
99836
- };
99837
99956
  // Determine the response method of right click according to the disableDownload parameter in props
99838
99957
  this.handleRightClickImage = e => {
99839
99958
  this.foundation.handleRightClickImage(e);
99840
99959
  };
99841
- this.handleWheel = e => {
99842
- this.foundation.handleWheel(e);
99843
- };
99844
99960
  this.handleLoad = e => {
99845
99961
  this.foundation.handleLoad(e);
99846
99962
  };
99847
99963
  this.handleError = e => {
99848
99964
  this.foundation.handleError(e);
99849
99965
  };
99850
- this.resizeImage = () => {
99851
- this.foundation.handleResizeImage();
99852
- };
99853
99966
  this.handleMoveImage = e => {
99854
99967
  this.foundation.handleMoveImage(e);
99855
99968
  };
99856
- // 为什么通过ref注册wheel而不是使用onWheel事件?
99857
- // 因为对于wheel事件,浏览器将 addEventListener 的 passive 默认值更改为 true。如此,事件监听器便不能取消事件,也不会在用户滚动页面时阻止页面呈现。
99858
- // 这里我们需要保持页面不动,仅放大图片,因此此处需要将 passive 更改设置为 false。
99859
- // Why register wheel via ref instead of using onWheel event?
99860
- // Because for wheel events, the browser changes the passive default of addEventListener to true. This way, the event listener cannot cancel the event, nor prevent the page from rendering when the user scrolls.
99861
- // Here we need to keep the page still and only zoom in on the image, so here we need to set the passive change to false.
99862
- // https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener#improving_scrolling_performance_with_passive_listeners。
99863
- this.registryImageRef = ref => {
99864
- if (this.imageRef) {
99865
- this.imageRef.removeEventListener("wheel", this.handleWheel);
99866
- }
99867
- if (ref) {
99868
- ref.addEventListener("wheel", this.handleWheel, {
99869
- passive: false
99870
- });
99871
- }
99872
- this.imageRef = ref;
99873
- };
99874
99969
  this.onImageMouseDown = e => {
99875
99970
  this.foundation.handleImageMouseDown(e);
99876
99971
  };
99877
- this.onImageMouseUp = () => {
99878
- this.foundation.handleImageMouseUp();
99879
- };
99880
99972
  this.state = {
99881
99973
  width: 0,
99882
99974
  height: 0,
@@ -99890,7 +99982,7 @@ class PreviewImage extends BaseComponent {
99890
99982
  left: 0
99891
99983
  };
99892
99984
  this.containerRef = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createRef();
99893
- this.imageRef = null;
99985
+ this.imageRef = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createRef();
99894
99986
  this.foundation = new PreviewImageFoundation(this.adapter);
99895
99987
  }
99896
99988
  componentDidMount() {
@@ -99901,27 +99993,22 @@ class PreviewImage extends BaseComponent {
99901
99993
  }
99902
99994
  componentDidUpdate(prevProps, prevStates) {
99903
99995
  // If src changes, start a new loading
99904
- if (this.props.src && this.props.src !== prevProps.src) {
99996
+ const zoomChange = "zoom" in this.props && this.props.zoom !== this.state.currZoom;
99997
+ const srcChange = this.props.src && this.props.src !== prevProps.src;
99998
+ if (srcChange) {
99905
99999
  this.foundation.setLoading(true);
99906
100000
  }
99907
100001
  // If the incoming zoom changes, other content changes are determined based on the new zoom value
99908
- if ("zoom" in this.props && this.props.zoom !== prevStates.currZoom) {
99909
- this.handleZoomChange(this.props.zoom, null);
99910
- }
99911
- // When the incoming ratio is changed, if it"s adaptation, then resizeImage is triggered to make the image adapt to the page
99912
- // else if it"s adaptation is realSize, then onZoom(1) is called to make the image size the original size;
99913
- if ("ratio" in this.props && this.props.ratio !== prevProps.ratio) {
99914
- if (originImageWidth && originImageHeight) {
99915
- if (this.props.ratio === "adaptation") {
99916
- this.resizeImage();
99917
- } else {
99918
- this.props.onZoom(1);
99919
- }
99920
- }
100002
+ if (zoomChange) {
100003
+ this.foundation.calculatePreviewImage(this.props.zoom, null);
99921
100004
  }
99922
- // When the incoming rotation angle of the image changes, it needs to be resized to make the image fit on the page
99923
- if ("rotation" in this.props && this.props.rotation !== prevProps.rotation) {
99924
- this.onWindowResize();
100005
+ if (!zoomChange && !srcChange && prevProps) {
100006
+ if ("ratio" in this.props && this.props.ratio !== prevProps.ratio) {
100007
+ this.foundation.handleRatioChange();
100008
+ }
100009
+ if ("rotation" in this.props && this.props.rotation !== prevProps.rotation) {
100010
+ this.onWindowResize();
100011
+ }
99925
100012
  }
99926
100013
  }
99927
100014
  render() {
@@ -99943,21 +100030,20 @@ class PreviewImage extends BaseComponent {
99943
100030
  transform: `rotate(${-rotation}deg)`,
99944
100031
  top,
99945
100032
  left,
99946
- width: loading ? "auto" : `${width}px`,
99947
- height: loading ? "auto" : `${height}px`
100033
+ width,
100034
+ height
99948
100035
  };
99949
100036
  return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
99950
100037
  className: `${preViewImgPrefixCls}`,
99951
100038
  ref: this.containerRef
99952
100039
  }, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("img", {
99953
- ref: this.registryImageRef,
100040
+ ref: this.imageRef,
99954
100041
  src: src,
99955
100042
  alt: "previewImag",
99956
100043
  className: `${preViewImgPrefixCls}-img`,
99957
100044
  key: src,
99958
100045
  onMouseMove: this.handleMoveImage,
99959
100046
  onMouseDown: this.onImageMouseDown,
99960
- onMouseUp: this.onImageMouseUp,
99961
100047
  onContextMenu: this.handleRightClickImage,
99962
100048
  onDragStart: e => e.preventDefault(),
99963
100049
  onLoad: this.handleLoad,
@@ -99974,9 +100060,9 @@ PreviewImage.propTypes = {
99974
100060
  src: (prop_types_default()).string,
99975
100061
  rotation: (prop_types_default()).number,
99976
100062
  style: (prop_types_default()).object,
99977
- maxZoom: (prop_types_default()).number,
99978
- minZoom: (prop_types_default()).number,
99979
- zoomStep: (prop_types_default()).number,
100063
+ // maxZoom: PropTypes.number,
100064
+ // minZoom: PropTypes.number,
100065
+ // zoomStep: PropTypes.number,
99980
100066
  zoom: (prop_types_default()).number,
99981
100067
  ratio: (prop_types_default()).string,
99982
100068
  disableDownload: (prop_types_default()).bool,
@@ -99987,9 +100073,9 @@ PreviewImage.propTypes = {
99987
100073
  onError: (prop_types_default()).func
99988
100074
  };
99989
100075
  PreviewImage.defaultProps = {
99990
- maxZoom: 5,
99991
- minZoom: 0.1,
99992
- zoomStep: 0.1,
100076
+ // maxZoom: 5,
100077
+ // minZoom: 0.1,
100078
+ // zoomStep: 0.1,
99993
100079
  zoom: undefined
99994
100080
  };
99995
100081
  ;// CONCATENATED MODULE: ../semi-foundation/image/utils.ts
@@ -100084,40 +100170,91 @@ const getPreloadImagArr = (imgSrc, currentIndex, preLoadGap, infinite) => {
100084
100170
 
100085
100171
 
100086
100172
 
100173
+
100174
+
100175
+
100087
100176
  const NOT_CLOSE_TARGETS = ["icon", "footer"];
100088
- const STOP_CLOSE_TARGET = ["icon", "footer", "header"];
100177
+ const STOP_CLOSE_TARGET = (/* unused pure expression or super */ null && (["icon", "footer", "header"]));
100089
100178
  class PreviewInnerFoundation extends foundation {
100090
100179
  constructor(adapter) {
100091
100180
  super(Object.assign({}, adapter));
100181
+ this._timer = null;
100182
+ this._startMouseDown = {
100183
+ x: 0,
100184
+ y: 0
100185
+ };
100092
100186
  this.handleViewVisibleChange = () => {
100093
- const nowTime = new Date().getTime();
100094
- const mouseActiveTime = this._adapter.getMouseActiveTime();
100095
- const stopTiming = this._adapter.getStopTiming();
100096
- const {
100097
- viewerVisibleDelay
100098
- } = this.getProps();
100099
100187
  const {
100100
100188
  viewerVisible
100101
100189
  } = this.getStates();
100102
- if (nowTime - mouseActiveTime > viewerVisibleDelay && !stopTiming) {
100103
- viewerVisible && this.setState({
100190
+ if (viewerVisible) {
100191
+ this.setState({
100104
100192
  viewerVisible: false
100105
100193
  });
100194
+ this.clearTimer();
100106
100195
  }
100107
100196
  };
100108
- this.handleMouseMoveEvent = (e, event) => {
100109
- const isTarget = isTargetEmit(e, STOP_CLOSE_TARGET);
100110
- if (isTarget && event === "over") {
100111
- this._adapter.setStopTiming(true);
100112
- } else if (isTarget && event === "out") {
100113
- this._adapter.setStopTiming(false);
100197
+ this.handleMouseMove = e => {
100198
+ this._persistEvent(e);
100199
+ this.mouseMoveHandler(e);
100200
+ };
100201
+ this.mouseMoveHandler = throttle_default()(e => {
100202
+ const {
100203
+ viewerVisible
100204
+ } = this.getStates();
100205
+ const isValidTarget = this._adapter.isValidTarget(e);
100206
+ if (isValidTarget) {
100207
+ if (!viewerVisible) {
100208
+ this.setState({
100209
+ viewerVisible: true
100210
+ });
100211
+ }
100212
+ this.updateTimer();
100213
+ } else {
100214
+ this.clearTimer();
100114
100215
  }
100216
+ }, 50);
100217
+ this.updateTimer = () => {
100218
+ const {
100219
+ viewerVisibleDelay
100220
+ } = this.getProps();
100221
+ this.clearTimer();
100222
+ this._timer = setTimeout(this.handleViewVisibleChange, viewerVisibleDelay);
100115
100223
  };
100116
- this.handleMouseMove = e => {
100117
- this._adapter.setMouseActiveTime(new Date().getTime());
100118
- this.setState({
100119
- viewerVisible: true
100120
- });
100224
+ this.clearTimer = () => {
100225
+ if (this._timer) {
100226
+ clearTimeout(this._timer);
100227
+ this._timer = null;
100228
+ }
100229
+ };
100230
+ this.handleWheel = e => {
100231
+ this.onWheel(e);
100232
+ handlePrevent(e);
100233
+ };
100234
+ this.onWheel = e => {
100235
+ const {
100236
+ zoomStep,
100237
+ maxZoom,
100238
+ minZoom
100239
+ } = this.getProps();
100240
+ const {
100241
+ zoom: currZoom
100242
+ } = this.getStates();
100243
+ let _zoom;
100244
+ if (e.deltaY < 0) {
100245
+ /* zoom in */
100246
+ if (currZoom + zoomStep <= maxZoom) {
100247
+ _zoom = Number((currZoom + zoomStep).toFixed(2));
100248
+ }
100249
+ } else if (e.deltaY > 0) {
100250
+ /* zoom out */
100251
+ if (currZoom - zoomStep >= minZoom) {
100252
+ _zoom = Number((currZoom - zoomStep).toFixed(2));
100253
+ }
100254
+ }
100255
+ if (!isUndefined_default()(_zoom)) {
100256
+ this.handleZoomImage(_zoom);
100257
+ }
100121
100258
  };
100122
100259
  this.handleMouseUp = e => {
100123
100260
  const {
@@ -100131,7 +100268,7 @@ class PreviewInnerFoundation extends foundation {
100131
100268
  const {
100132
100269
  x,
100133
100270
  y
100134
- } = this._adapter.getStartMouseDown();
100271
+ } = this._startMouseDown;
100135
100272
  // 对鼠标移动做容错处理,当 x 和 y 方向在 mouseUp 的时候移动距离都小于等于 5px 时候就可以关闭预览
100136
100273
  // Error-tolerant processing of mouse movement, when the movement distance in the x and y directions is less than or equal to 5px in mouseUp, the preview can be closed
100137
100274
  // 不做容错处理的话,直接用 clientX !== x || y !== clientY 做判断,鼠标在用户点击时候无意识的轻微移动无法关闭预览,不符合用户预期
@@ -100148,7 +100285,10 @@ class PreviewInnerFoundation extends foundation {
100148
100285
  clientX,
100149
100286
  clientY
100150
100287
  } = e;
100151
- this._adapter.setStartMouseDown(clientX, clientY);
100288
+ this._startMouseDown = {
100289
+ x: clientX,
100290
+ y: clientY
100291
+ };
100152
100292
  };
100153
100293
  this.handleKeyDown = e => {
100154
100294
  const {
@@ -100221,10 +100361,12 @@ class PreviewInnerFoundation extends foundation {
100221
100361
  const {
100222
100362
  zoom
100223
100363
  } = this.getStates();
100224
- this._adapter.notifyZoom(newZoom, newZoom > zoom);
100225
- this.setState({
100226
- zoom: newZoom
100227
- });
100364
+ if (zoom !== newZoom) {
100365
+ this._adapter.notifyZoom(newZoom, newZoom > zoom);
100366
+ this.setState({
100367
+ zoom: newZoom
100368
+ });
100369
+ }
100228
100370
  };
100229
100371
  // 当 visible 改变之后,预览组件完成首张图片加载后,启动预加载
100230
100372
  // 如: 1,2,3,4,5,6,7,8张图片, 点击第 4 张图片,preLoadGap 为 2
@@ -100342,10 +100484,12 @@ class PreviewInnerFoundation extends foundation {
100342
100484
  beforeShow() {
100343
100485
  this._adapter.registerKeyDownListener();
100344
100486
  this._adapter.disabledBodyScroll();
100487
+ this.updateTimer();
100345
100488
  }
100346
100489
  afterHide() {
100347
100490
  this._adapter.unregisterKeyDownListener();
100348
100491
  this._adapter.enabledBodyScroll();
100492
+ this.clearTimer();
100349
100493
  }
100350
100494
  }
100351
100495
  ;// CONCATENATED MODULE: ./image/previewInner.tsx
@@ -100365,14 +100509,6 @@ class PreviewInnerFoundation extends foundation {
100365
100509
 
100366
100510
 
100367
100511
  const previewInner_prefixCls = image_constants_cssClasses.PREFIX;
100368
- let startMouseDown = {
100369
- x: 0,
100370
- y: 0
100371
- };
100372
- let previewInner_mouseActiveTime = null;
100373
- let stopTiming = false;
100374
- let timer = null;
100375
- // let bodyOverflowValue = document.body.style.overflow;
100376
100512
  class PreviewInner extends BaseComponent {
100377
100513
  get adapter() {
100378
100514
  return Object.assign(Object.assign({}, super.adapter), {
@@ -100456,30 +100592,22 @@ class PreviewInner extends BaseComponent {
100456
100592
  unregisterKeyDownListener: () => {
100457
100593
  window && window.removeEventListener("keydown", this.handleKeyDown);
100458
100594
  },
100459
- getMouseActiveTime: () => {
100460
- return previewInner_mouseActiveTime;
100461
- },
100462
- getStopTiming: () => {
100463
- return stopTiming;
100464
- },
100465
- setStopTiming: value => {
100466
- stopTiming = value;
100467
- },
100468
- getStartMouseDown: () => {
100469
- return startMouseDown;
100470
- },
100471
- setStartMouseDown: (x, y) => {
100472
- startMouseDown = {
100473
- x,
100474
- y
100475
- };
100476
- },
100477
- setMouseActiveTime: time => {
100478
- previewInner_mouseActiveTime = time;
100479
- },
100480
100595
  getSetDownloadFunc: () => {
100481
100596
  var _a, _b;
100482
100597
  return (_b = (_a = this.context) === null || _a === void 0 ? void 0 : _a.setDownloadName) !== null && _b !== void 0 ? _b : this.props.setDownloadName;
100598
+ },
100599
+ isValidTarget: e => {
100600
+ const headerDom = this.headerRef && this.headerRef.current;
100601
+ const footerDom = this.footerRef && this.footerRef.current;
100602
+ const leftIconDom = this.leftIconRef && this.leftIconRef.current;
100603
+ const rightIconDom = this.rightIconRef && this.rightIconRef.current;
100604
+ const target = e.target;
100605
+ if (headerDom && headerDom.contains(target) || footerDom && footerDom.contains(target) || leftIconDom && leftIconDom.contains(target) || rightIconDom && rightIconDom.contains(target)) {
100606
+ // Move in the operation area, return false
100607
+ return false;
100608
+ }
100609
+ // Move in the preview area except the operation area, return true
100610
+ return true;
100483
100611
  }
100484
100612
  });
100485
100613
  }
@@ -100512,9 +100640,6 @@ class PreviewInner extends BaseComponent {
100512
100640
  this.handleMouseMove = e => {
100513
100641
  this.foundation.handleMouseMove(e);
100514
100642
  };
100515
- this.handleMouseEvent = (e, event) => {
100516
- this.foundation.handleMouseMoveEvent(e, event);
100517
- };
100518
100643
  this.handleKeyDown = e => {
100519
100644
  this.foundation.handleKeyDown(e);
100520
100645
  };
@@ -100527,6 +100652,31 @@ class PreviewInner extends BaseComponent {
100527
100652
  this.handleMouseDown = e => {
100528
100653
  this.foundation.handleMouseDown(e);
100529
100654
  };
100655
+ this.handleWheel = e => {
100656
+ this.foundation.handleWheel(e);
100657
+ };
100658
+ // 为什么通过 addEventListener 注册 wheel 事件而不是使用 onWheel 事件?
100659
+ // 因为 Passive Event Listeners(https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener#improving_scrolling_performance_with_passive_listeners)
100660
+ // Passive Event Listeners 是一种优化技术,用于提高滚动性能。在默认情况下,浏览器会假设事件的监听器不会调用
100661
+ // preventDefault() 方法来阻止事件的默认行为,从而允许进行一些优化操作,例如滚动平滑。
100662
+ // 对于 Image 而言,如果使用触控板,双指朝不同方向分开放大图片,则需要 preventDefault 防止页面整体放大。
100663
+ // Why register wheel event through addEventListener instead of using onWheel event?
100664
+ // Because of Passive Event Listeners(an optimization technique used to improve scrolling performance. By default,
100665
+ // the browser will assume that event listeners will not call preventDefault() method to prevent the default behavior of the event,
100666
+ // allowing some optimization operations such as scroll smoothing.)
100667
+ // For Image, if we use the trackpad and spread your fingers in different directions to enlarge the image, we need to preventDefault
100668
+ // to prevent the page from being enlarged as a whole.
100669
+ this.registryImageWrapRef = ref => {
100670
+ if (this.imageWrapRef) {
100671
+ this.imageWrapRef.removeEventListener("wheel", this.handleWheel);
100672
+ }
100673
+ if (ref) {
100674
+ ref.addEventListener("wheel", this.handleWheel, {
100675
+ passive: false
100676
+ });
100677
+ }
100678
+ this.imageWrapRef = ref;
100679
+ };
100530
100680
  this.state = {
100531
100681
  imgSrc: [],
100532
100682
  imgLoadStatus: new Map(),
@@ -100543,6 +100693,11 @@ class PreviewInner extends BaseComponent {
100543
100693
  this.bodyOverflow = '';
100544
100694
  this.originBodyWidth = '100%';
100545
100695
  this.scrollBarWidth = 0;
100696
+ this.imageWrapRef = null;
100697
+ this.headerRef = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createRef();
100698
+ this.footerRef = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createRef();
100699
+ this.leftIconRef = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createRef();
100700
+ this.rightIconRef = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createRef();
100546
100701
  }
100547
100702
  static getDerivedStateFromProps(props, state) {
100548
100703
  const willUpdateStates = {};
@@ -100558,6 +100713,9 @@ class PreviewInner extends BaseComponent {
100558
100713
  willUpdateStates.visible = props.visible;
100559
100714
  if (props.visible) {
100560
100715
  willUpdateStates.preloadAfterVisibleChange = true;
100716
+ willUpdateStates.viewerVisible = true;
100717
+ willUpdateStates.rotation = 0;
100718
+ willUpdateStates.ratio = 'adaptation';
100561
100719
  }
100562
100720
  }
100563
100721
  if ("currentIndex" in props && props.currentIndex !== state.currentIndex) {
@@ -100576,10 +100734,8 @@ class PreviewInner extends BaseComponent {
100576
100734
  }
100577
100735
  }
100578
100736
  componentDidUpdate(prevProps, prevState) {
100579
- if (prevState.visible !== this.props.visible && this.props.visible) {
100580
- previewInner_mouseActiveTime = new Date().getTime();
100581
- timer && clearInterval(timer);
100582
- timer = setInterval(this.viewVisibleChange, 1000);
100737
+ if (prevProps.src !== this.props.src) {
100738
+ this.foundation.updateTimer();
100583
100739
  }
100584
100740
  // hide => show
100585
100741
  if (!prevProps.visible && this.props.visible) {
@@ -100591,7 +100747,7 @@ class PreviewInner extends BaseComponent {
100591
100747
  }
100592
100748
  }
100593
100749
  componentWillUnmount() {
100594
- timer && clearInterval(timer);
100750
+ this.foundation.clearTimer();
100595
100751
  }
100596
100752
  isInGroup() {
100597
100753
  return Boolean(this.context && this.context.isGroup);
@@ -100656,10 +100812,10 @@ class PreviewInner extends BaseComponent {
100656
100812
  style: style,
100657
100813
  onMouseDown: this.handleMouseDown,
100658
100814
  onMouseUp: this.handleMouseUp,
100659
- onMouseMove: this.handleMouseMove,
100660
- onMouseOver: e => this.handleMouseEvent(e.nativeEvent, "over"),
100661
- onMouseOut: e => this.handleMouseEvent(e.nativeEvent, "out")
100815
+ ref: this.registryImageWrapRef,
100816
+ onMouseMove: this.handleMouseMove
100662
100817
  }, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(previewHeader, {
100818
+ ref: this.headerRef,
100663
100819
  className: classnames_default()(hideViewerCls),
100664
100820
  onClose: this.handlePreviewClose,
100665
100821
  renderHeader: renderHeader
@@ -100670,7 +100826,6 @@ class PreviewInner extends BaseComponent {
100670
100826
  setRatio: this.handleAdjustRatio,
100671
100827
  zoom: zoom,
100672
100828
  ratio: ratio,
100673
- zoomStep: zoomStep,
100674
100829
  rotation: rotation,
100675
100830
  crossOrigin: crossOrigin,
100676
100831
  onError: this.onImageError,
@@ -100679,6 +100834,7 @@ class PreviewInner extends BaseComponent {
100679
100834
  /*#__PURE__*/
100680
100835
  // eslint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-static-element-interactions
100681
100836
  external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
100837
+ ref: this.leftIconRef,
100682
100838
  className: classnames_default()(`${previewPrefixCls}-icon`, `${previewPrefixCls}-prev`, hideViewerCls),
100683
100839
  onClick: () => this.handleSwitchImage("prev")
100684
100840
  }, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(IconArrowLeft, {
@@ -100687,11 +100843,13 @@ class PreviewInner extends BaseComponent {
100687
100843
  /*#__PURE__*/
100688
100844
  // eslint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-static-element-interactions
100689
100845
  external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
100846
+ ref: this.rightIconRef,
100690
100847
  className: classnames_default()(`${previewPrefixCls}-icon`, `${previewPrefixCls}-next`, hideViewerCls),
100691
100848
  onClick: () => this.handleSwitchImage("next")
100692
100849
  }, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(IconArrowRight, {
100693
100850
  size: "large"
100694
100851
  })), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(previewFooter_Footer, {
100852
+ forwardRef: this.footerRef,
100695
100853
  className: hideViewerCls,
100696
100854
  totalNum: total,
100697
100855
  curPage: currentIndex + 1,
@@ -100749,6 +100907,8 @@ PreviewInner.propTypes = {
100749
100907
  disableDownload: (prop_types_default()).bool,
100750
100908
  viewerVisibleDelay: (prop_types_default()).number,
100751
100909
  zIndex: (prop_types_default()).number,
100910
+ maxZoom: (prop_types_default()).number,
100911
+ minZoom: (prop_types_default()).number,
100752
100912
  renderHeader: (prop_types_default()).func,
100753
100913
  renderPreviewMenu: (prop_types_default()).func,
100754
100914
  getPopupContainer: (prop_types_default()).func,
@@ -100773,7 +100933,9 @@ PreviewInner.defaultProps = {
100773
100933
  preLoadGap: 2,
100774
100934
  zIndex: 1000,
100775
100935
  maskClosable: true,
100776
- viewerVisibleDelay: 10000
100936
+ viewerVisibleDelay: 10000,
100937
+ maxZoom: 5,
100938
+ minZoom: 0.1
100777
100939
  };
100778
100940
  ;// CONCATENATED MODULE: ../semi-foundation/image/imageFoundation.ts
100779
100941
 
@@ -101417,6 +101579,8 @@ Preview.defaultProps = {
101417
101579
 
101418
101580
 
101419
101581
 
101582
+
101583
+
101420
101584
 
101421
101585
 
101422
101586