@douyinfe/semi-ui 2.49.1 → 2.50.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. package/dist/css/semi.css +74 -161
  2. package/dist/css/semi.min.css +1 -1
  3. package/dist/umd/semi-ui.js +465 -389
  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/image/interface.d.ts +3 -3
  8. package/lib/cjs/image/previewFooter.js +8 -5
  9. package/lib/cjs/image/previewHeader.d.ts +2 -2
  10. package/lib/cjs/image/previewHeader.js +8 -9
  11. package/lib/cjs/image/previewImage.d.ts +12 -1
  12. package/lib/cjs/image/previewImage.js +83 -23
  13. package/lib/cjs/image/previewInner.d.ts +2 -11
  14. package/lib/cjs/image/previewInner.js +42 -60
  15. package/lib/cjs/index.d.ts +0 -2
  16. package/lib/cjs/index.js +0 -14
  17. package/lib/cjs/modal/confirm.d.ts +6 -6
  18. package/lib/cjs/notification/index.d.ts +8 -8
  19. package/lib/cjs/notification/notice.d.ts +1 -1
  20. package/lib/cjs/notification/notice.js +1 -1
  21. package/lib/cjs/table/ColumnSorter.d.ts +3 -1
  22. package/lib/cjs/table/ColumnSorter.js +26 -15
  23. package/lib/cjs/table/Table.js +1 -0
  24. package/lib/cjs/table/interface.d.ts +4 -0
  25. package/lib/cjs/tree/indent.d.ts +9 -0
  26. package/lib/cjs/tree/indent.js +37 -0
  27. package/lib/cjs/tree/index.d.ts +2 -0
  28. package/lib/cjs/tree/index.js +8 -3
  29. package/lib/cjs/tree/interface.d.ts +2 -0
  30. package/lib/cjs/tree/treeNode.d.ts +3 -0
  31. package/lib/cjs/tree/treeNode.js +34 -6
  32. package/lib/cjs/treeSelect/index.d.ts +2 -1
  33. package/lib/cjs/treeSelect/index.js +7 -2
  34. package/lib/es/image/interface.d.ts +3 -3
  35. package/lib/es/image/previewFooter.js +8 -5
  36. package/lib/es/image/previewHeader.d.ts +2 -2
  37. package/lib/es/image/previewHeader.js +3 -4
  38. package/lib/es/image/previewImage.d.ts +12 -1
  39. package/lib/es/image/previewImage.js +83 -23
  40. package/lib/es/image/previewInner.d.ts +2 -11
  41. package/lib/es/image/previewInner.js +42 -60
  42. package/lib/es/index.d.ts +0 -2
  43. package/lib/es/index.js +0 -2
  44. package/lib/es/modal/confirm.d.ts +6 -6
  45. package/lib/es/notification/index.d.ts +8 -8
  46. package/lib/es/notification/notice.d.ts +1 -1
  47. package/lib/es/notification/notice.js +1 -1
  48. package/lib/es/table/ColumnSorter.d.ts +3 -1
  49. package/lib/es/table/ColumnSorter.js +26 -15
  50. package/lib/es/table/Table.js +1 -0
  51. package/lib/es/table/interface.d.ts +4 -0
  52. package/lib/es/tree/indent.d.ts +9 -0
  53. package/lib/es/tree/indent.js +27 -0
  54. package/lib/es/tree/index.d.ts +2 -0
  55. package/lib/es/tree/index.js +8 -3
  56. package/lib/es/tree/interface.d.ts +2 -0
  57. package/lib/es/tree/treeNode.d.ts +3 -0
  58. package/lib/es/tree/treeNode.js +34 -6
  59. package/lib/es/treeSelect/index.d.ts +2 -1
  60. package/lib/es/treeSelect/index.js +7 -2
  61. package/package.json +8 -8
@@ -17286,8 +17286,6 @@ __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),
17291
17289
  "Breadcrumb": () => (/* reexport */ breadcrumb_0),
17292
17290
  "Button": () => (/* reexport */ button_0),
17293
17291
  "ButtonGroup": () => (/* reexport */ ButtonGroup),
@@ -17377,12 +17375,45 @@ __webpack_require__.d(__webpack_exports__, {
17377
17375
 
17378
17376
  // EXTERNAL MODULE: ./_base/base.scss
17379
17377
  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);
17380
17384
  // EXTERNAL MODULE: ../../node_modules/lodash/noop.js
17381
17385
  var noop = __webpack_require__("nnm9");
17382
17386
  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
+
17383
17411
  // EXTERNAL MODULE: ../../node_modules/lodash/get.js
17384
17412
  var get = __webpack_require__("2srY");
17385
17413
  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);
17386
17417
  ;// CONCATENATED MODULE: ../semi-foundation/utils/log.ts
17387
17418
 
17388
17419
  const log = function (text) {
@@ -17509,115 +17540,6 @@ class BaseFoundation {
17509
17540
  }
17510
17541
  }
17511
17542
  /* 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);
17621
17543
  ;// CONCATENATED MODULE: ../../node_modules/compute-scroll-into-view/dist/index.mjs
17622
17544
  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};
17623
17545
  //# sourceMappingURL=index.mjs.map
@@ -17871,6 +17793,82 @@ class AnchorFoundation extends foundation {
17871
17793
  };
17872
17794
  }
17873
17795
  }
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 = {};
17874
17872
  // EXTERNAL MODULE: ../../node_modules/lodash/isObject.js
17875
17873
  var isObject = __webpack_require__("tQYX");
17876
17874
  var isObject_default = /*#__PURE__*/__webpack_require__.n(isObject);
@@ -36365,7 +36363,8 @@ function flattenTreeData(treeNodeList, expandedKeys, keyMaps) {
36365
36363
  pos,
36366
36364
  children: null,
36367
36365
  data: treeNode,
36368
- _innerDataTag: true
36366
+ _innerDataTag: true,
36367
+ isEnd: [...(parent ? parent.isEnd : []), index === list.length - 1]
36369
36368
  });
36370
36369
  const isBooleanFilteredShownKeys = typeof filteredShownKeys === 'boolean';
36371
36370
  if (!filterSearch || !isBooleanFilteredShownKeys && filteredShownKeys.has(mergedKey)) {
@@ -67750,7 +67749,7 @@ class Notice extends BaseComponent {
67750
67749
  Notice.contextType = context;
67751
67750
  Notice.propTypes = {
67752
67751
  duration: (prop_types_default()).number,
67753
- id: prop_types_default().oneOfType([(prop_types_default()).string, (prop_types_default()).number]),
67752
+ id: (prop_types_default()).string,
67754
67753
  title: (prop_types_default()).node,
67755
67754
  content: (prop_types_default()).node,
67756
67755
  type: prop_types_default().oneOf(notice_types),
@@ -69383,7 +69382,6 @@ class SelectFoundation extends foundation {
69383
69382
  this.close(e);
69384
69383
  this._notifyBlur(e);
69385
69384
  this._adapter.updateFocusState(false);
69386
- this._adapter.unregisterClickOutsideHandler();
69387
69385
  });
69388
69386
  }
69389
69387
  toggle2SearchInput(isShow) {
@@ -69401,6 +69399,7 @@ class SelectFoundation extends foundation {
69401
69399
  this._adapter.setIsFocusInContainer(false);
69402
69400
  // this.unBindKeyBoardEvent();
69403
69401
  // this._notifyBlur(e);
69402
+ this._adapter.unregisterClickOutsideHandler();
69404
69403
  // this._adapter.updateFocusState(false);
69405
69404
  const isFilterable = this._isFilterable();
69406
69405
  if (isFilterable) {
@@ -79988,7 +79987,8 @@ class ColumnSorter extends external_root_React_commonjs2_react_commonjs_react_am
79988
79987
  onClick,
79989
79988
  sortOrder,
79990
79989
  style,
79991
- title
79990
+ title,
79991
+ sortIcon
79992
79992
  } = this.props;
79993
79993
  const iconBtnSize = 'default';
79994
79994
  const upCls = classnames_default()(`${prefixCls}-column-sorter-up`, {
@@ -80005,25 +80005,34 @@ class ColumnSorter extends external_root_React_commonjs2_react_commonjs_react_am
80005
80005
  'aria-label': `Current sort order is ${sortOrder ? `${sortOrder}ing` : 'none'}`,
80006
80006
  'aria-roledescription': 'Sort data with this column'
80007
80007
  };
80008
+ const renderSortIcon = () => {
80009
+ if (typeof sortIcon === 'function') {
80010
+ return sortIcon({
80011
+ sortOrder
80012
+ });
80013
+ } else {
80014
+ return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
80015
+ style: style,
80016
+ className: `${prefixCls}-column-sorter`
80017
+ }, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("span", {
80018
+ className: `${upCls}`
80019
+ }, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(IconCaretup, {
80020
+ size: iconBtnSize
80021
+ })), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("span", {
80022
+ className: `${downCls}`
80023
+ }, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(IconCaretdown, {
80024
+ size: iconBtnSize
80025
+ })));
80026
+ }
80027
+ };
80008
80028
  return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", Object.assign({
80009
- role: 'button'
80029
+ role: "button"
80010
80030
  }, ariaProps, {
80011
80031
  tabIndex: -1,
80012
80032
  className: `${prefixCls}-column-sorter-wrapper`,
80013
80033
  onClick: onClick,
80014
80034
  onKeyPress: e => utils_isEnterPress(e) && onClick(e)
80015
- }), title, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
80016
- style: style,
80017
- className: `${prefixCls}-column-sorter`
80018
- }, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("span", {
80019
- className: `${upCls}`
80020
- }, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(IconCaretup, {
80021
- size: iconBtnSize
80022
- })), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("span", {
80023
- className: `${downCls}`
80024
- }, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(IconCaretdown, {
80025
- size: iconBtnSize
80026
- }))));
80035
+ }), title, renderSortIcon());
80027
80036
  }
80028
80037
  }
80029
80038
  ColumnSorter.propTypes = {
@@ -80031,7 +80040,8 @@ ColumnSorter.propTypes = {
80031
80040
  style: (prop_types_default()).object,
80032
80041
  onClick: (prop_types_default()).func,
80033
80042
  prefixCls: (prop_types_default()).string,
80034
- sortOrder: prop_types_default().oneOfType([(prop_types_default()).string, (prop_types_default()).bool])
80043
+ sortOrder: prop_types_default().oneOfType([(prop_types_default()).string, (prop_types_default()).bool]),
80044
+ sortIcon: (prop_types_default()).func
80035
80045
  };
80036
80046
  ColumnSorter.defaultProps = {
80037
80047
  prefixCls: table_constants_cssClasses.PREFIX,
@@ -83319,6 +83329,7 @@ class Table extends BaseComponent {
83319
83329
  const sorter = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(ColumnSorter, {
83320
83330
  key: table_constants_strings.DEFAULT_KEY_COLUMN_SORTER,
83321
83331
  sortOrder: sortOrder,
83332
+ sortIcon: column.sortIcon,
83322
83333
  onClick: e => _this2.foundation.handleSort(column, e),
83323
83334
  title: TitleNode
83324
83335
  });
@@ -88224,6 +88235,34 @@ function IconFolder_SvgComponent(props) {
88224
88235
  }
88225
88236
  const IconFolder_IconComponent = convertIcon(IconFolder_SvgComponent, 'folder');
88226
88237
  /* harmony default export */ const IconFolder = (IconFolder_IconComponent);
88238
+ ;// CONCATENATED MODULE: ./tree/indent.tsx
88239
+
88240
+
88241
+ const Indent = _ref => {
88242
+ let {
88243
+ prefixcls,
88244
+ level,
88245
+ isEnd,
88246
+ showLine
88247
+ } = _ref;
88248
+ const baseClassName = `${prefixcls}-indent-unit`;
88249
+ const list = [];
88250
+ for (let i = 0; i < level; i += 1) {
88251
+ list.push( /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("span", {
88252
+ key: i,
88253
+ className: classnames_default()(baseClassName, {
88254
+ [`${baseClassName}-end`]: isEnd[i]
88255
+ })
88256
+ }));
88257
+ }
88258
+ return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("span", {
88259
+ "aria-hidden": "true",
88260
+ className: classnames_default()(`${prefixcls}-indent`, {
88261
+ [`${prefixcls}-indent-show-line`]: showLine
88262
+ })
88263
+ }, list);
88264
+ };
88265
+ /* harmony default export */ const indent = (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.memo(Indent));
88227
88266
  ;// CONCATENATED MODULE: ./tree/treeNode.tsx
88228
88267
 
88229
88268
 
@@ -88248,6 +88287,7 @@ var treeNode_rest = undefined && undefined.__rest || function (s, e) {
88248
88287
 
88249
88288
 
88250
88289
 
88290
+
88251
88291
  const treeNode_prefixcls = tree_constants_cssClasses.PREFIX_OPTION;
88252
88292
  class TreeNode extends external_root_React_commonjs2_react_commonjs_react_amd_react_.PureComponent {
88253
88293
  constructor(props) {
@@ -88422,6 +88462,18 @@ class TreeNode extends external_root_React_commonjs2_react_commonjs_react_amd_re
88422
88462
  }
88423
88463
  return Boolean(treeDisabled || disabled);
88424
88464
  };
88465
+ // Switcher
88466
+ this.renderSwitcher = () => {
88467
+ if (this.isLeaf()) {
88468
+ // if switcherIconDom is null, no render switcher span
88469
+ return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("span", {
88470
+ className: classnames_default()(`${treeNode_prefixcls}-switcher`)
88471
+ }, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("span", {
88472
+ className: `${treeNode_prefixcls}-switcher-leaf-line`
88473
+ }));
88474
+ }
88475
+ return null;
88476
+ };
88425
88477
  this.renderRealLabel = () => {
88426
88478
  const {
88427
88479
  renderLabel
@@ -88461,7 +88513,8 @@ class TreeNode extends external_root_React_commonjs2_react_commonjs_react_amd_re
88461
88513
  const showIcon = !this.isLeaf();
88462
88514
  const {
88463
88515
  loading,
88464
- expanded
88516
+ expanded,
88517
+ showLine
88465
88518
  } = this.props;
88466
88519
  if (loading) {
88467
88520
  return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(spin_0, {
@@ -88477,6 +88530,9 @@ class TreeNode extends external_root_React_commonjs2_react_commonjs_react_amd_re
88477
88530
  onClick: this.onExpand
88478
88531
  });
88479
88532
  }
88533
+ if (showLine) {
88534
+ return this.renderSwitcher();
88535
+ }
88480
88536
  return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("span", {
88481
88537
  className: `${treeNode_prefixcls}-empty-icon`
88482
88538
  });
@@ -88560,9 +88616,11 @@ class TreeNode extends external_root_React_commonjs2_react_commonjs_react_amd_re
88560
88616
  filtered,
88561
88617
  treeNodeFilterProp,
88562
88618
  display,
88563
- style
88619
+ style,
88620
+ isEnd,
88621
+ showLine
88564
88622
  } = _a,
88565
- rest = treeNode_rest(_a, ["eventKey", "expanded", "selected", "checked", "halfChecked", "loading", "active", "level", "empty", "filtered", "treeNodeFilterProp", "display", "style"]);
88623
+ rest = treeNode_rest(_a, ["eventKey", "expanded", "selected", "checked", "halfChecked", "loading", "active", "level", "empty", "filtered", "treeNodeFilterProp", "display", "style", "isEnd", "showLine"]);
88566
88624
  if (empty) {
88567
88625
  return this.renderEmptyNode();
88568
88626
  }
@@ -88574,6 +88632,7 @@ class TreeNode extends external_root_React_commonjs2_react_commonjs_react_amd_re
88574
88632
  dropPosition,
88575
88633
  labelEllipsis
88576
88634
  } = this.context;
88635
+ const isEndNode = isEnd[isEnd.length - 1];
88577
88636
  const disabled = this.isDisabled();
88578
88637
  const dragOver = dragOverNodeKey === eventKey && dropPosition === 0;
88579
88638
  const dragOverGapTop = dragOverNodeKey === eventKey && dropPosition === -1;
@@ -88591,7 +88650,8 @@ class TreeNode extends external_root_React_commonjs2_react_commonjs_react_amd_re
88591
88650
  [`${treeNode_prefixcls}-fullLabel-draggable`]: !disabled && draggable && renderFullLabel,
88592
88651
  // When draggable + renderFullLabel is turned on, the style of dragover
88593
88652
  [`${treeNode_prefixcls}-fullLabel-drag-over-gap-top`]: !disabled && dragOverGapTop && renderFullLabel,
88594
- [`${treeNode_prefixcls}-fullLabel-drag-over-gap-bottom`]: !disabled && dragOverGapBottom && renderFullLabel
88653
+ [`${treeNode_prefixcls}-fullLabel-drag-over-gap-bottom`]: !disabled && dragOverGapBottom && renderFullLabel,
88654
+ [`${treeNode_prefixcls}-tree-node-last-leaf`]: isEndNode
88595
88655
  });
88596
88656
  const labelProps = {
88597
88657
  onClick: this.onClick,
@@ -88667,7 +88727,12 @@ class TreeNode extends external_root_React_commonjs2_react_commonjs_react_amd_re
88667
88727
  onDoubleClick: this.onDoubleClick,
88668
88728
  ref: this.setRef,
88669
88729
  style: style
88670
- }, dragProps), this.renderArrow(), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("span", {
88730
+ }, dragProps), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(indent, {
88731
+ showLine: showLine,
88732
+ prefixcls: treeNode_prefixcls,
88733
+ level: level,
88734
+ isEnd: isEnd
88735
+ }), this.renderArrow(), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("span", {
88671
88736
  className: labelCls
88672
88737
  }, multiple ? this.renderCheckbox() : null, this.renderIcon(), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("span", {
88673
88738
  className: `${treeNode_prefixcls}-label-text`
@@ -88692,7 +88757,9 @@ TreeNode.propTypes = {
88692
88757
  keyword: (prop_types_default()).string,
88693
88758
  treeNodeFilterProp: (prop_types_default()).string,
88694
88759
  selectedKey: (prop_types_default()).string,
88695
- motionKey: prop_types_default().oneOfType([(prop_types_default()).string, prop_types_default().arrayOf((prop_types_default()).string)])
88760
+ motionKey: prop_types_default().oneOfType([(prop_types_default()).string, prop_types_default().arrayOf((prop_types_default()).string)]),
88761
+ isEnd: prop_types_default().arrayOf((prop_types_default()).bool),
88762
+ showLine: (prop_types_default()).bool
88696
88763
  };
88697
88764
  TreeNode.defaultProps = {
88698
88765
  selectedKey: '',
@@ -88997,12 +89064,14 @@ class Tree extends BaseComponent {
88997
89064
  return null;
88998
89065
  }
88999
89066
  const {
89000
- keyMaps
89067
+ keyMaps,
89068
+ showLine
89001
89069
  } = this.props;
89002
- const props = pick_default()(treeNode, ['key', 'label', 'disabled', 'isLeaf', 'icon']);
89070
+ const props = pick_default()(treeNode, ['key', 'label', 'disabled', 'isLeaf', 'icon', 'isEnd']);
89003
89071
  const children = data[get_default()(keyMaps, 'children', 'children')];
89004
89072
  !isUndefined_default()(children) && (props.children = children);
89005
89073
  return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(TreeNode, Object.assign({}, treeNodeProps, data, props, {
89074
+ showLine: showLine,
89006
89075
  data: data,
89007
89076
  style: isEmpty_default()(style) ? {} : style
89008
89077
  }));
@@ -89436,6 +89505,7 @@ class Tree extends BaseComponent {
89436
89505
  directory,
89437
89506
  multiple,
89438
89507
  showFilteredOnly,
89508
+ showLine,
89439
89509
  motion,
89440
89510
  expandAction,
89441
89511
  loadData,
@@ -89446,7 +89516,7 @@ class Tree extends BaseComponent {
89446
89516
  virtualize,
89447
89517
  checkRelation
89448
89518
  } = _a,
89449
- rest = tree_rest(_a, ["blockNode", "className", "style", "filterTreeNode", "disabled", "icon", "directory", "multiple", "showFilteredOnly", "motion", "expandAction", "loadData", "renderLabel", "draggable", "renderFullLabel", "labelEllipsis", "virtualize", "checkRelation"]);
89519
+ rest = tree_rest(_a, ["blockNode", "className", "style", "filterTreeNode", "disabled", "icon", "directory", "multiple", "showFilteredOnly", "showLine", "motion", "expandAction", "loadData", "renderLabel", "draggable", "renderFullLabel", "labelEllipsis", "virtualize", "checkRelation"]);
89450
89520
  const wrapperCls = classnames_default()(`${tree_prefixcls}-wrapper`, className);
89451
89521
  const listCls = classnames_default()(`${tree_prefixcls}-option-list`, {
89452
89522
  [`${tree_prefixcls}-option-list-block`]: blockNode
@@ -89535,6 +89605,7 @@ Tree.propTypes = {
89535
89605
  searchStyle: (prop_types_default()).object,
89536
89606
  selectedKey: (prop_types_default()).string,
89537
89607
  showFilteredOnly: (prop_types_default()).bool,
89608
+ showLine: (prop_types_default()).bool,
89538
89609
  style: (prop_types_default()).object,
89539
89610
  treeData: prop_types_default().arrayOf(prop_types_default().shape({
89540
89611
  key: (prop_types_default()).string,
@@ -89586,6 +89657,7 @@ Tree.defaultProps = {
89586
89657
  motion: true,
89587
89658
  leafOnly: false,
89588
89659
  showFilteredOnly: false,
89660
+ showLine: false,
89589
89661
  expandAction: false,
89590
89662
  disableStrictly: false,
89591
89663
  draggable: false,
@@ -91097,10 +91169,13 @@ class TreeSelect extends BaseComponent {
91097
91169
  key
91098
91170
  } = treeNode;
91099
91171
  const treeNodeProps = this.foundation.getTreeNodeProps(key);
91172
+ const {
91173
+ showLine
91174
+ } = this.props;
91100
91175
  if (!treeNodeProps) {
91101
91176
  return null;
91102
91177
  }
91103
- const props = pick_default()(treeNode, ['key', 'label', 'disabled', 'isLeaf', 'icon']);
91178
+ const props = pick_default()(treeNode, ['key', 'label', 'disabled', 'isLeaf', 'icon', 'isEnd']);
91104
91179
  const {
91105
91180
  keyMaps
91106
91181
  } = this.props;
@@ -91108,7 +91183,8 @@ class TreeSelect extends BaseComponent {
91108
91183
  !isUndefined_default()(children) && (props.children = children);
91109
91184
  return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(TreeNode, Object.assign({}, treeNodeProps, data, props, {
91110
91185
  data: data,
91111
- style: style
91186
+ style: style,
91187
+ showLine: showLine
91112
91188
  }));
91113
91189
  };
91114
91190
  this.itemKey = (index, data) => {
@@ -91642,6 +91718,7 @@ TreeSelect.propTypes = {
91642
91718
  showSearchClear: (prop_types_default()).bool,
91643
91719
  autoAdjustOverflow: (prop_types_default()).bool,
91644
91720
  showFilteredOnly: (prop_types_default()).bool,
91721
+ showLine: (prop_types_default()).bool,
91645
91722
  motionExpand: (prop_types_default()).bool,
91646
91723
  emptyContent: (prop_types_default()).node,
91647
91724
  keyMaps: (prop_types_default()).object,
@@ -98952,14 +99029,14 @@ const PreviewContext = /*#__PURE__*/(0,external_root_React_commonjs2_react_commo
98952
99029
 
98953
99030
 
98954
99031
  const previewHeader_prefixCls = `${image_constants_cssClasses.PREFIX}-preview-header`;
98955
- const previewHeader_Header = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef)((_ref, ref) => {
99032
+ const previewHeader_Header = _ref => {
98956
99033
  let {
98957
99034
  onClose,
98958
99035
  titleStyle,
98959
99036
  className,
98960
99037
  renderHeader
98961
99038
  } = _ref;
98962
- return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(PreviewContext.Consumer, null, _ref2 => {
99039
+ return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(PreviewContext.Consumer, null, _ref2 => {
98963
99040
  let {
98964
99041
  currentIndex,
98965
99042
  titles
@@ -98968,18 +99045,17 @@ const previewHeader_Header = /*#__PURE__*/(0,external_root_React_commonjs2_react
98968
99045
  if (titles && typeof currentIndex === "number") {
98969
99046
  title = titles[currentIndex];
98970
99047
  }
98971
- return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("section", {
98972
- ref: ref,
99048
+ return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("section", {
98973
99049
  className: classnames_default()(previewHeader_prefixCls, className)
98974
- }, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("section", {
99050
+ }, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("section", {
98975
99051
  className: `${previewHeader_prefixCls}-title`,
98976
99052
  style: titleStyle
98977
- }, renderHeader ? renderHeader(title) : title), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("section", {
99053
+ }, renderHeader ? renderHeader(title) : title), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("section", {
98978
99054
  className: `${previewHeader_prefixCls}-close`,
98979
99055
  onMouseUp: onClose
98980
- }, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(IconClose, null)));
99056
+ }, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(IconClose, null)));
98981
99057
  });
98982
- });
99058
+ };
98983
99059
  /* harmony default export */ const previewHeader = (previewHeader_Header);
98984
99060
  ;// CONCATENATED MODULE: ../semi-icons/lib/es/icons/IconMinus.js
98985
99061
 
@@ -99135,6 +99211,7 @@ class PreviewFooterFoundation extends foundation {
99135
99211
  } else {
99136
99212
  onZoomOut(Number((value / 100).toFixed(2)));
99137
99213
  }
99214
+ this._adapter.setStartMouseOffset(value);
99138
99215
  };
99139
99216
  this.handleRatioClick = () => {
99140
99217
  const {
@@ -99167,9 +99244,14 @@ class PreviewFooterFoundation extends foundation {
99167
99244
 
99168
99245
  const previewFooter_prefixCls = image_constants_cssClasses.PREFIX;
99169
99246
  const footerPrefixCls = `${image_constants_cssClasses.PREFIX}-preview-footer`;
99247
+ let mouseActiveTime = 0;
99170
99248
  class previewFooter_Footer extends BaseComponent {
99171
99249
  get adapter() {
99172
- return Object.assign({}, super.adapter);
99250
+ return Object.assign(Object.assign({}, super.adapter), {
99251
+ setStartMouseOffset: time => {
99252
+ mouseActiveTime = time;
99253
+ }
99254
+ });
99173
99255
  }
99174
99256
  constructor(props) {
99175
99257
  super(props);
@@ -99409,15 +99491,13 @@ class previewFooter_Footer extends BaseComponent {
99409
99491
  render() {
99410
99492
  const {
99411
99493
  className,
99412
- renderPreviewMenu,
99413
- forwardRef
99494
+ renderPreviewMenu
99414
99495
  } = this.props;
99415
99496
  const menuCls = classnames_default()(footerPrefixCls, `${footerPrefixCls}-wrapper`, className, {
99416
99497
  [`${footerPrefixCls}-content`]: !Boolean(renderPreviewMenu)
99417
99498
  });
99418
99499
  return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("section", {
99419
- className: menuCls,
99420
- ref: forwardRef
99500
+ className: menuCls
99421
99501
  }, renderPreviewMenu ? this.customRenderViewMenu() : this.getFooterMenu());
99422
99502
  }
99423
99503
  }
@@ -99456,6 +99536,9 @@ previewFooter_Footer.defaultProps = {
99456
99536
  };
99457
99537
  ;// CONCATENATED MODULE: ../semi-foundation/image/previewImageFoundation.ts
99458
99538
 
99539
+
99540
+
99541
+
99459
99542
  const DefaultDOMRect = {
99460
99543
  bottom: 0,
99461
99544
  height: 0,
@@ -99470,12 +99553,6 @@ const DefaultDOMRect = {
99470
99553
  class PreviewImageFoundation extends foundation {
99471
99554
  constructor(adapter) {
99472
99555
  super(Object.assign({}, adapter));
99473
- this.startMouseOffset = {
99474
- x: 0,
99475
- y: 0
99476
- };
99477
- this.originImageWidth = null;
99478
- this.originImageHeight = null;
99479
99556
  this._isImageVertical = () => this.getProp("rotation") % 180 !== 0;
99480
99557
  this._getImageBounds = () => {
99481
99558
  const imageDOM = this._adapter.getImage();
@@ -99505,18 +99582,32 @@ class PreviewImageFoundation extends foundation {
99505
99582
  this._adapter.setLoading(loading);
99506
99583
  };
99507
99584
  this.handleWindowResize = () => {
99508
- if (this.originImageWidth && this.originImageHeight) {
99509
- this.handleResizeImage();
99585
+ const {
99586
+ ratio,
99587
+ setRatio
99588
+ } = this.getProps();
99589
+ const {
99590
+ originImageWidth,
99591
+ originImageHeight
99592
+ } = this._adapter.getOriginImageSize();
99593
+ if (originImageWidth && originImageHeight) {
99594
+ if (ratio !== "adaptation") {
99595
+ setRatio("adaptation");
99596
+ } else {
99597
+ this.handleResizeImage();
99598
+ }
99510
99599
  }
99511
99600
  };
99512
99601
  this.handleLoad = e => {
99513
99602
  if (e.target) {
99514
99603
  const {
99515
- naturalWidth: w,
99516
- naturalHeight: h
99604
+ width: w,
99605
+ height: h
99517
99606
  } = e.target;
99518
- this.originImageHeight = h;
99519
- this.originImageWidth = w;
99607
+ this._adapter.setOriginImageSize({
99608
+ originImageWidth: w,
99609
+ originImageHeight: h
99610
+ });
99520
99611
  this.setState({
99521
99612
  loading: false
99522
99613
  });
@@ -99541,14 +99632,13 @@ class PreviewImageFoundation extends foundation {
99541
99632
  this.handleResizeImage = () => {
99542
99633
  const horizontal = !this._isImageVertical();
99543
99634
  const {
99544
- currZoom
99545
- } = this.getStates();
99546
- const imgWidth = horizontal ? this.originImageWidth : this.originImageHeight;
99547
- const imgHeight = horizontal ? this.originImageHeight : this.originImageWidth;
99635
+ originImageWidth,
99636
+ originImageHeight
99637
+ } = this._adapter.getOriginImageSize();
99638
+ const imgWidth = horizontal ? originImageWidth : originImageHeight;
99639
+ const imgHeight = horizontal ? originImageHeight : originImageWidth;
99548
99640
  const {
99549
- onZoom,
99550
- setRatio,
99551
- ratio
99641
+ onZoom
99552
99642
  } = this.getProps();
99553
99643
  const containerDOM = this._adapter.getContainer();
99554
99644
  if (containerDOM) {
@@ -99558,44 +99648,8 @@ class PreviewImageFoundation extends foundation {
99558
99648
  } = this._getContainerBounds();
99559
99649
  const reservedWidth = containerWidth - 80;
99560
99650
  const reservedHeight = containerHeight - 80;
99561
- let _zoom = 1;
99562
- if (imgWidth > reservedWidth || imgHeight > reservedHeight) {
99563
- _zoom = Number(Math.min(reservedWidth / imgWidth, reservedHeight / imgHeight).toFixed(2));
99564
- }
99565
- if (currZoom === _zoom) {
99566
- this.calculatePreviewImage(_zoom, null);
99567
- } else {
99568
- onZoom(_zoom);
99569
- }
99570
- }
99571
- };
99572
- this.handleRatioChange = () => {
99573
- if (this.originImageWidth && this.originImageHeight) {
99574
- const {
99575
- currZoom
99576
- } = this.getStates();
99577
- const {
99578
- ratio,
99579
- onZoom
99580
- } = this.getProps();
99581
- let _zoom;
99582
- if (ratio === 'adaptation') {
99583
- const horizontal = !this._isImageVertical();
99584
- const imgWidth = horizontal ? this.originImageWidth : this.originImageHeight;
99585
- const imgHeight = horizontal ? this.originImageHeight : this.originImageWidth;
99586
- const {
99587
- width: containerWidth,
99588
- height: containerHeight
99589
- } = this._getContainerBounds();
99590
- const reservedWidth = containerWidth - 80;
99591
- const reservedHeight = containerHeight - 80;
99592
- _zoom = Number(Math.min(reservedWidth / imgWidth, reservedHeight / imgHeight).toFixed(2));
99593
- } else {
99594
- _zoom = 1;
99595
- }
99596
- if (currZoom !== _zoom) {
99597
- onZoom(_zoom);
99598
- }
99651
+ const _zoom = Number(Math.min(reservedWidth / imgWidth, reservedHeight / imgHeight).toFixed(2));
99652
+ onZoom(_zoom);
99599
99653
  }
99600
99654
  };
99601
99655
  this.handleRightClickImage = e => {
@@ -99610,6 +99664,38 @@ class PreviewImageFoundation extends foundation {
99610
99664
  return true;
99611
99665
  }
99612
99666
  };
99667
+ // e: WheelEvent<HTMLImageElement>
99668
+ this.handleWheel = e => {
99669
+ this.onWheel(e);
99670
+ handlePrevent(e);
99671
+ };
99672
+ // e: WheelEvent<HTMLImageElement>
99673
+ this.onWheel = throttle_default()(e => {
99674
+ const {
99675
+ onZoom,
99676
+ zoomStep,
99677
+ maxZoom,
99678
+ minZoom
99679
+ } = this.getProps();
99680
+ const {
99681
+ currZoom
99682
+ } = this.getStates();
99683
+ let _zoom;
99684
+ if (e.deltaY < 0) {
99685
+ /* zoom in */
99686
+ if (currZoom + zoomStep <= maxZoom) {
99687
+ _zoom = Number((currZoom + zoomStep).toFixed(2));
99688
+ }
99689
+ } else if (e.deltaY > 0) {
99690
+ /* zoom out */
99691
+ if (currZoom - zoomStep >= minZoom) {
99692
+ _zoom = Number((currZoom - zoomStep).toFixed(2));
99693
+ }
99694
+ }
99695
+ if (!isUndefined_default()(_zoom)) {
99696
+ onZoom(_zoom);
99697
+ }
99698
+ }, 50);
99613
99699
  this.calcCanDragDirection = () => {
99614
99700
  const {
99615
99701
  width,
@@ -99633,8 +99719,12 @@ class PreviewImageFoundation extends foundation {
99633
99719
  canDragHorizontal
99634
99720
  };
99635
99721
  };
99636
- this.calculatePreviewImage = (newZoom, e) => {
99722
+ this.handleZoomChange = (newZoom, e) => {
99637
99723
  const imageDOM = this._adapter.getImage();
99724
+ const {
99725
+ originImageWidth,
99726
+ originImageHeight
99727
+ } = this._adapter.getOriginImageSize();
99638
99728
  const {
99639
99729
  canDragVertical,
99640
99730
  canDragHorizontal
@@ -99644,8 +99734,8 @@ class PreviewImageFoundation extends foundation {
99644
99734
  width: containerWidth,
99645
99735
  height: containerHeight
99646
99736
  } = this._getContainerBounds();
99647
- const newWidth = Math.floor(this.originImageWidth * newZoom);
99648
- const newHeight = Math.floor(this.originImageHeight * newZoom);
99737
+ const newWidth = Math.floor(originImageWidth * newZoom);
99738
+ const newHeight = Math.floor(originImageHeight * newZoom);
99649
99739
  // debugger;
99650
99740
  let _offset;
99651
99741
  const horizontal = !this._isImageVertical();
@@ -99704,13 +99794,13 @@ class PreviewImageFoundation extends foundation {
99704
99794
  width,
99705
99795
  height
99706
99796
  } = this.getStates();
99797
+ const startMouseMove = this._adapter.getMouseMove();
99798
+ const startMouseOffset = this._adapter.getMouseOffset();
99707
99799
  const {
99708
99800
  canDragVertical,
99709
99801
  canDragHorizontal
99710
99802
  } = this.calcCanDragDirection();
99711
- // https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/buttons
99712
- const mouseLeftPress = e.buttons === 1;
99713
- if (mouseLeftPress && (canDragVertical || canDragHorizontal)) {
99803
+ if (startMouseMove && (canDragVertical || canDragHorizontal)) {
99714
99804
  const {
99715
99805
  clientX,
99716
99806
  clientY
@@ -99723,8 +99813,8 @@ class PreviewImageFoundation extends foundation {
99723
99813
  left: extremeLeft,
99724
99814
  top: extremeTop
99725
99815
  } = this.calcExtremeBounds();
99726
- let newX = canDragHorizontal ? clientX - containerLeft - this.startMouseOffset.x : offset.x;
99727
- let newY = canDragVertical ? clientY - containerTop - this.startMouseOffset.y : offset.y;
99816
+ let newX = canDragHorizontal ? clientX - containerLeft - startMouseOffset.x : offset.x;
99817
+ let newY = canDragVertical ? clientY - containerTop - startMouseOffset.y : offset.y;
99728
99818
  if (canDragHorizontal) {
99729
99819
  newX = newX > 0 ? 0 : newX < extremeLeft ? extremeLeft : newX;
99730
99820
  }
@@ -99743,7 +99833,11 @@ class PreviewImageFoundation extends foundation {
99743
99833
  }
99744
99834
  };
99745
99835
  this.handleImageMouseDown = e => {
99746
- this.startMouseOffset = this._getOffset(e);
99836
+ this._adapter.setStartMouseOffset(this._getOffset(e));
99837
+ this._adapter.setStartMouseMove(true);
99838
+ };
99839
+ this.handleImageMouseUp = () => {
99840
+ this._adapter.setStartMouseMove(false);
99747
99841
  };
99748
99842
  }
99749
99843
  }
@@ -99756,14 +99850,38 @@ class PreviewImageFoundation extends foundation {
99756
99850
 
99757
99851
  const previewImage_prefixCls = image_constants_cssClasses.PREFIX;
99758
99852
  const preViewImgPrefixCls = `${previewImage_prefixCls}-preview-image`;
99853
+ let originImageWidth = null;
99854
+ let originImageHeight = null;
99855
+ let startMouseMove = false;
99856
+ // startMouseOffset:The offset of the mouse relative to the left and top of the picture
99857
+ let startMouseOffset = {
99858
+ x: 0,
99859
+ y: 0
99860
+ };
99759
99861
  class PreviewImage extends BaseComponent {
99760
99862
  get adapter() {
99761
99863
  return Object.assign(Object.assign({}, super.adapter), {
99864
+ getOriginImageSize: () => ({
99865
+ originImageWidth,
99866
+ originImageHeight
99867
+ }),
99868
+ setOriginImageSize: size => {
99869
+ originImageWidth = size.originImageWidth;
99870
+ originImageHeight = size.originImageHeight;
99871
+ },
99762
99872
  getContainer: () => {
99763
99873
  return this.containerRef.current;
99764
99874
  },
99765
99875
  getImage: () => {
99766
- return this.imageRef.current;
99876
+ return this.imageRef;
99877
+ },
99878
+ getMouseMove: () => startMouseMove,
99879
+ setStartMouseMove: move => {
99880
+ startMouseMove = move;
99881
+ },
99882
+ getMouseOffset: () => startMouseOffset,
99883
+ setStartMouseOffset: offset => {
99884
+ startMouseOffset = offset;
99767
99885
  },
99768
99886
  setLoading: loading => {
99769
99887
  this.setState({
@@ -99771,7 +99889,7 @@ class PreviewImage extends BaseComponent {
99771
99889
  });
99772
99890
  },
99773
99891
  setImageCursor: canDrag => {
99774
- this.imageRef.current.style.cursor = canDrag ? "grab" : "default";
99892
+ this.imageRef.style.cursor = canDrag ? "grab" : "default";
99775
99893
  }
99776
99894
  });
99777
99895
  }
@@ -99780,22 +99898,52 @@ class PreviewImage extends BaseComponent {
99780
99898
  this.onWindowResize = () => {
99781
99899
  this.foundation.handleWindowResize();
99782
99900
  };
99901
+ this.handleZoomChange = (newZoom, e) => {
99902
+ this.foundation.handleZoomChange(newZoom, e);
99903
+ };
99783
99904
  // Determine the response method of right click according to the disableDownload parameter in props
99784
99905
  this.handleRightClickImage = e => {
99785
99906
  this.foundation.handleRightClickImage(e);
99786
99907
  };
99908
+ this.handleWheel = e => {
99909
+ this.foundation.handleWheel(e);
99910
+ };
99787
99911
  this.handleLoad = e => {
99788
99912
  this.foundation.handleLoad(e);
99789
99913
  };
99790
99914
  this.handleError = e => {
99791
99915
  this.foundation.handleError(e);
99792
99916
  };
99917
+ this.resizeImage = () => {
99918
+ this.foundation.handleResizeImage();
99919
+ };
99793
99920
  this.handleMoveImage = e => {
99794
99921
  this.foundation.handleMoveImage(e);
99795
99922
  };
99923
+ // 为什么通过ref注册wheel而不是使用onWheel事件?
99924
+ // 因为对于wheel事件,浏览器将 addEventListener 的 passive 默认值更改为 true。如此,事件监听器便不能取消事件,也不会在用户滚动页面时阻止页面呈现。
99925
+ // 这里我们需要保持页面不动,仅放大图片,因此此处需要将 passive 更改设置为 false。
99926
+ // Why register wheel via ref instead of using onWheel event?
99927
+ // 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.
99928
+ // 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.
99929
+ // https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener#improving_scrolling_performance_with_passive_listeners。
99930
+ this.registryImageRef = ref => {
99931
+ if (this.imageRef) {
99932
+ this.imageRef.removeEventListener("wheel", this.handleWheel);
99933
+ }
99934
+ if (ref) {
99935
+ ref.addEventListener("wheel", this.handleWheel, {
99936
+ passive: false
99937
+ });
99938
+ }
99939
+ this.imageRef = ref;
99940
+ };
99796
99941
  this.onImageMouseDown = e => {
99797
99942
  this.foundation.handleImageMouseDown(e);
99798
99943
  };
99944
+ this.onImageMouseUp = () => {
99945
+ this.foundation.handleImageMouseUp();
99946
+ };
99799
99947
  this.state = {
99800
99948
  width: 0,
99801
99949
  height: 0,
@@ -99809,7 +99957,7 @@ class PreviewImage extends BaseComponent {
99809
99957
  left: 0
99810
99958
  };
99811
99959
  this.containerRef = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createRef();
99812
- this.imageRef = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createRef();
99960
+ this.imageRef = null;
99813
99961
  this.foundation = new PreviewImageFoundation(this.adapter);
99814
99962
  }
99815
99963
  componentDidMount() {
@@ -99820,23 +99968,28 @@ class PreviewImage extends BaseComponent {
99820
99968
  }
99821
99969
  componentDidUpdate(prevProps, prevStates) {
99822
99970
  // If src changes, start a new loading
99823
- const zoomChange = "zoom" in this.props && this.props.zoom !== this.state.currZoom;
99824
- const srcChange = this.props.src && this.props.src !== prevProps.src;
99825
- if (srcChange) {
99971
+ if (this.props.src && this.props.src !== prevProps.src) {
99826
99972
  this.foundation.setLoading(true);
99827
99973
  }
99828
99974
  // If the incoming zoom changes, other content changes are determined based on the new zoom value
99829
- if (zoomChange) {
99830
- this.foundation.calculatePreviewImage(this.props.zoom, null);
99831
- }
99832
- if (!zoomChange && !srcChange && prevProps) {
99833
- if ("ratio" in this.props && this.props.ratio !== prevProps.ratio) {
99834
- this.foundation.handleRatioChange();
99835
- }
99836
- if ("rotation" in this.props && this.props.rotation !== prevProps.rotation) {
99837
- this.onWindowResize();
99975
+ if ("zoom" in this.props && this.props.zoom !== prevStates.currZoom) {
99976
+ this.handleZoomChange(this.props.zoom, null);
99977
+ }
99978
+ // When the incoming ratio is changed, if it"s adaptation, then resizeImage is triggered to make the image adapt to the page
99979
+ // else if it"s adaptation is realSize, then onZoom(1) is called to make the image size the original size;
99980
+ if ("ratio" in this.props && this.props.ratio !== prevProps.ratio) {
99981
+ if (originImageWidth && originImageHeight) {
99982
+ if (this.props.ratio === "adaptation") {
99983
+ this.resizeImage();
99984
+ } else {
99985
+ this.props.onZoom(1);
99986
+ }
99838
99987
  }
99839
99988
  }
99989
+ // When the incoming rotation angle of the image changes, it needs to be resized to make the image fit on the page
99990
+ if ("rotation" in this.props && this.props.rotation !== prevProps.rotation) {
99991
+ this.onWindowResize();
99992
+ }
99840
99993
  }
99841
99994
  render() {
99842
99995
  const {
@@ -99857,20 +100010,21 @@ class PreviewImage extends BaseComponent {
99857
100010
  transform: `rotate(${-rotation}deg)`,
99858
100011
  top,
99859
100012
  left,
99860
- width,
99861
- height
100013
+ width: loading ? "auto" : `${width}px`,
100014
+ height: loading ? "auto" : `${height}px`
99862
100015
  };
99863
100016
  return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
99864
100017
  className: `${preViewImgPrefixCls}`,
99865
100018
  ref: this.containerRef
99866
100019
  }, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("img", {
99867
- ref: this.imageRef,
100020
+ ref: this.registryImageRef,
99868
100021
  src: src,
99869
100022
  alt: "previewImag",
99870
100023
  className: `${preViewImgPrefixCls}-img`,
99871
100024
  key: src,
99872
100025
  onMouseMove: this.handleMoveImage,
99873
100026
  onMouseDown: this.onImageMouseDown,
100027
+ onMouseUp: this.onImageMouseUp,
99874
100028
  onContextMenu: this.handleRightClickImage,
99875
100029
  onDragStart: e => e.preventDefault(),
99876
100030
  onLoad: this.handleLoad,
@@ -99887,9 +100041,9 @@ PreviewImage.propTypes = {
99887
100041
  src: (prop_types_default()).string,
99888
100042
  rotation: (prop_types_default()).number,
99889
100043
  style: (prop_types_default()).object,
99890
- // maxZoom: PropTypes.number,
99891
- // minZoom: PropTypes.number,
99892
- // zoomStep: PropTypes.number,
100044
+ maxZoom: (prop_types_default()).number,
100045
+ minZoom: (prop_types_default()).number,
100046
+ zoomStep: (prop_types_default()).number,
99893
100047
  zoom: (prop_types_default()).number,
99894
100048
  ratio: (prop_types_default()).string,
99895
100049
  disableDownload: (prop_types_default()).bool,
@@ -99900,9 +100054,9 @@ PreviewImage.propTypes = {
99900
100054
  onError: (prop_types_default()).func
99901
100055
  };
99902
100056
  PreviewImage.defaultProps = {
99903
- // maxZoom: 5,
99904
- // minZoom: 0.1,
99905
- // zoomStep: 0.1,
100057
+ maxZoom: 5,
100058
+ minZoom: 0.1,
100059
+ zoomStep: 0.1,
99906
100060
  zoom: undefined
99907
100061
  };
99908
100062
  ;// CONCATENATED MODULE: ../semi-foundation/image/utils.ts
@@ -99997,91 +100151,40 @@ const getPreloadImagArr = (imgSrc, currentIndex, preLoadGap, infinite) => {
99997
100151
 
99998
100152
 
99999
100153
 
100000
-
100001
-
100002
-
100003
100154
  const NOT_CLOSE_TARGETS = ["icon", "footer"];
100004
- const STOP_CLOSE_TARGET = (/* unused pure expression or super */ null && (["icon", "footer", "header"]));
100155
+ const STOP_CLOSE_TARGET = ["icon", "footer", "header"];
100005
100156
  class PreviewInnerFoundation extends foundation {
100006
100157
  constructor(adapter) {
100007
100158
  super(Object.assign({}, adapter));
100008
- this._timer = null;
100009
- this._startMouseDown = {
100010
- x: 0,
100011
- y: 0
100012
- };
100013
100159
  this.handleViewVisibleChange = () => {
100160
+ const nowTime = new Date().getTime();
100161
+ const mouseActiveTime = this._adapter.getMouseActiveTime();
100162
+ const stopTiming = this._adapter.getStopTiming();
100163
+ const {
100164
+ viewerVisibleDelay
100165
+ } = this.getProps();
100014
100166
  const {
100015
100167
  viewerVisible
100016
100168
  } = this.getStates();
100017
- if (viewerVisible) {
100018
- this.setState({
100169
+ if (nowTime - mouseActiveTime > viewerVisibleDelay && !stopTiming) {
100170
+ viewerVisible && this.setState({
100019
100171
  viewerVisible: false
100020
100172
  });
100021
- this.clearTimer();
100022
- }
100023
- };
100024
- this.handleMouseMove = e => {
100025
- this._persistEvent(e);
100026
- this.mouseMoveHandler(e);
100027
- };
100028
- this.mouseMoveHandler = throttle_default()(e => {
100029
- const {
100030
- viewerVisible
100031
- } = this.getStates();
100032
- const isValidTarget = this._adapter.isValidTarget(e);
100033
- if (isValidTarget) {
100034
- if (!viewerVisible) {
100035
- this.setState({
100036
- viewerVisible: true
100037
- });
100038
- }
100039
- this.updateTimer();
100040
- } else {
100041
- this.clearTimer();
100042
100173
  }
100043
- }, 50);
100044
- this.updateTimer = () => {
100045
- const {
100046
- viewerVisibleDelay
100047
- } = this.getProps();
100048
- this.clearTimer();
100049
- this._timer = setTimeout(this.handleViewVisibleChange, viewerVisibleDelay);
100050
100174
  };
100051
- this.clearTimer = () => {
100052
- if (this._timer) {
100053
- clearTimeout(this._timer);
100054
- this._timer = null;
100175
+ this.handleMouseMoveEvent = (e, event) => {
100176
+ const isTarget = isTargetEmit(e, STOP_CLOSE_TARGET);
100177
+ if (isTarget && event === "over") {
100178
+ this._adapter.setStopTiming(true);
100179
+ } else if (isTarget && event === "out") {
100180
+ this._adapter.setStopTiming(false);
100055
100181
  }
100056
100182
  };
100057
- this.handleWheel = e => {
100058
- this.onWheel(e);
100059
- handlePrevent(e);
100060
- };
100061
- this.onWheel = e => {
100062
- const {
100063
- zoomStep,
100064
- maxZoom,
100065
- minZoom
100066
- } = this.getProps();
100067
- const {
100068
- zoom: currZoom
100069
- } = this.getStates();
100070
- let _zoom;
100071
- if (e.deltaY < 0) {
100072
- /* zoom in */
100073
- if (currZoom + zoomStep <= maxZoom) {
100074
- _zoom = Number((currZoom + zoomStep).toFixed(2));
100075
- }
100076
- } else if (e.deltaY > 0) {
100077
- /* zoom out */
100078
- if (currZoom - zoomStep >= minZoom) {
100079
- _zoom = Number((currZoom - zoomStep).toFixed(2));
100080
- }
100081
- }
100082
- if (!isUndefined_default()(_zoom)) {
100083
- this.handleZoomImage(_zoom);
100084
- }
100183
+ this.handleMouseMove = e => {
100184
+ this._adapter.setMouseActiveTime(new Date().getTime());
100185
+ this.setState({
100186
+ viewerVisible: true
100187
+ });
100085
100188
  };
100086
100189
  this.handleMouseUp = e => {
100087
100190
  const {
@@ -100095,7 +100198,7 @@ class PreviewInnerFoundation extends foundation {
100095
100198
  const {
100096
100199
  x,
100097
100200
  y
100098
- } = this._startMouseDown;
100201
+ } = this._adapter.getStartMouseDown();
100099
100202
  // 对鼠标移动做容错处理,当 x 和 y 方向在 mouseUp 的时候移动距离都小于等于 5px 时候就可以关闭预览
100100
100203
  // 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
100101
100204
  // 不做容错处理的话,直接用 clientX !== x || y !== clientY 做判断,鼠标在用户点击时候无意识的轻微移动无法关闭预览,不符合用户预期
@@ -100112,10 +100215,7 @@ class PreviewInnerFoundation extends foundation {
100112
100215
  clientX,
100113
100216
  clientY
100114
100217
  } = e;
100115
- this._startMouseDown = {
100116
- x: clientX,
100117
- y: clientY
100118
- };
100218
+ this._adapter.setStartMouseDown(clientX, clientY);
100119
100219
  };
100120
100220
  this.handleKeyDown = e => {
100121
100221
  const {
@@ -100188,12 +100288,10 @@ class PreviewInnerFoundation extends foundation {
100188
100288
  const {
100189
100289
  zoom
100190
100290
  } = this.getStates();
100191
- if (zoom !== newZoom) {
100192
- this._adapter.notifyZoom(newZoom, newZoom > zoom);
100193
- this.setState({
100194
- zoom: newZoom
100195
- });
100196
- }
100291
+ this._adapter.notifyZoom(newZoom, newZoom > zoom);
100292
+ this.setState({
100293
+ zoom: newZoom
100294
+ });
100197
100295
  };
100198
100296
  // 当 visible 改变之后,预览组件完成首张图片加载后,启动预加载
100199
100297
  // 如: 1,2,3,4,5,6,7,8张图片, 点击第 4 张图片,preLoadGap 为 2
@@ -100311,12 +100409,10 @@ class PreviewInnerFoundation extends foundation {
100311
100409
  beforeShow() {
100312
100410
  this._adapter.registerKeyDownListener();
100313
100411
  this._adapter.disabledBodyScroll();
100314
- this.updateTimer();
100315
100412
  }
100316
100413
  afterHide() {
100317
100414
  this._adapter.unregisterKeyDownListener();
100318
100415
  this._adapter.enabledBodyScroll();
100319
- this.clearTimer();
100320
100416
  }
100321
100417
  }
100322
100418
  ;// CONCATENATED MODULE: ./image/previewInner.tsx
@@ -100336,6 +100432,14 @@ class PreviewInnerFoundation extends foundation {
100336
100432
 
100337
100433
 
100338
100434
  const previewInner_prefixCls = image_constants_cssClasses.PREFIX;
100435
+ let startMouseDown = {
100436
+ x: 0,
100437
+ y: 0
100438
+ };
100439
+ let previewInner_mouseActiveTime = null;
100440
+ let stopTiming = false;
100441
+ let timer = null;
100442
+ // let bodyOverflowValue = document.body.style.overflow;
100339
100443
  class PreviewInner extends BaseComponent {
100340
100444
  get adapter() {
100341
100445
  return Object.assign(Object.assign({}, super.adapter), {
@@ -100419,22 +100523,30 @@ class PreviewInner extends BaseComponent {
100419
100523
  unregisterKeyDownListener: () => {
100420
100524
  window && window.removeEventListener("keydown", this.handleKeyDown);
100421
100525
  },
100526
+ getMouseActiveTime: () => {
100527
+ return previewInner_mouseActiveTime;
100528
+ },
100529
+ getStopTiming: () => {
100530
+ return stopTiming;
100531
+ },
100532
+ setStopTiming: value => {
100533
+ stopTiming = value;
100534
+ },
100535
+ getStartMouseDown: () => {
100536
+ return startMouseDown;
100537
+ },
100538
+ setStartMouseDown: (x, y) => {
100539
+ startMouseDown = {
100540
+ x,
100541
+ y
100542
+ };
100543
+ },
100544
+ setMouseActiveTime: time => {
100545
+ previewInner_mouseActiveTime = time;
100546
+ },
100422
100547
  getSetDownloadFunc: () => {
100423
100548
  var _a, _b;
100424
100549
  return (_b = (_a = this.context) === null || _a === void 0 ? void 0 : _a.setDownloadName) !== null && _b !== void 0 ? _b : this.props.setDownloadName;
100425
- },
100426
- isValidTarget: e => {
100427
- const headerDom = this.headerRef && this.headerRef.current;
100428
- const footerDom = this.footerRef && this.footerRef.current;
100429
- const leftIconDom = this.leftIconRef && this.leftIconRef.current;
100430
- const rightIconDom = this.rightIconRef && this.rightIconRef.current;
100431
- const target = e.target;
100432
- if (headerDom && headerDom.contains(target) || footerDom && footerDom.contains(target) || leftIconDom && leftIconDom.contains(target) || rightIconDom && rightIconDom.contains(target)) {
100433
- // Move in the operation area, return false
100434
- return false;
100435
- }
100436
- // Move in the preview area except the operation area, return true
100437
- return true;
100438
100550
  }
100439
100551
  });
100440
100552
  }
@@ -100467,6 +100579,9 @@ class PreviewInner extends BaseComponent {
100467
100579
  this.handleMouseMove = e => {
100468
100580
  this.foundation.handleMouseMove(e);
100469
100581
  };
100582
+ this.handleMouseEvent = (e, event) => {
100583
+ this.foundation.handleMouseMoveEvent(e, event);
100584
+ };
100470
100585
  this.handleKeyDown = e => {
100471
100586
  this.foundation.handleKeyDown(e);
100472
100587
  };
@@ -100479,31 +100594,6 @@ class PreviewInner extends BaseComponent {
100479
100594
  this.handleMouseDown = e => {
100480
100595
  this.foundation.handleMouseDown(e);
100481
100596
  };
100482
- this.handleWheel = e => {
100483
- this.foundation.handleWheel(e);
100484
- };
100485
- // 为什么通过 addEventListener 注册 wheel 事件而不是使用 onWheel 事件?
100486
- // 因为 Passive Event Listeners(https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener#improving_scrolling_performance_with_passive_listeners)
100487
- // Passive Event Listeners 是一种优化技术,用于提高滚动性能。在默认情况下,浏览器会假设事件的监听器不会调用
100488
- // preventDefault() 方法来阻止事件的默认行为,从而允许进行一些优化操作,例如滚动平滑。
100489
- // 对于 Image 而言,如果使用触控板,双指朝不同方向分开放大图片,则需要 preventDefault 防止页面整体放大。
100490
- // Why register wheel event through addEventListener instead of using onWheel event?
100491
- // Because of Passive Event Listeners(an optimization technique used to improve scrolling performance. By default,
100492
- // the browser will assume that event listeners will not call preventDefault() method to prevent the default behavior of the event,
100493
- // allowing some optimization operations such as scroll smoothing.)
100494
- // For Image, if we use the trackpad and spread your fingers in different directions to enlarge the image, we need to preventDefault
100495
- // to prevent the page from being enlarged as a whole.
100496
- this.registryImageWrapRef = ref => {
100497
- if (this.imageWrapRef) {
100498
- this.imageWrapRef.removeEventListener("wheel", this.handleWheel);
100499
- }
100500
- if (ref) {
100501
- ref.addEventListener("wheel", this.handleWheel, {
100502
- passive: false
100503
- });
100504
- }
100505
- this.imageWrapRef = ref;
100506
- };
100507
100597
  this.state = {
100508
100598
  imgSrc: [],
100509
100599
  imgLoadStatus: new Map(),
@@ -100520,11 +100610,6 @@ class PreviewInner extends BaseComponent {
100520
100610
  this.bodyOverflow = '';
100521
100611
  this.originBodyWidth = '100%';
100522
100612
  this.scrollBarWidth = 0;
100523
- this.imageWrapRef = null;
100524
- this.headerRef = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createRef();
100525
- this.footerRef = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createRef();
100526
- this.leftIconRef = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createRef();
100527
- this.rightIconRef = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createRef();
100528
100613
  }
100529
100614
  static getDerivedStateFromProps(props, state) {
100530
100615
  const willUpdateStates = {};
@@ -100540,9 +100625,6 @@ class PreviewInner extends BaseComponent {
100540
100625
  willUpdateStates.visible = props.visible;
100541
100626
  if (props.visible) {
100542
100627
  willUpdateStates.preloadAfterVisibleChange = true;
100543
- willUpdateStates.viewerVisible = true;
100544
- willUpdateStates.rotation = 0;
100545
- willUpdateStates.ratio = 'adaptation';
100546
100628
  }
100547
100629
  }
100548
100630
  if ("currentIndex" in props && props.currentIndex !== state.currentIndex) {
@@ -100561,8 +100643,10 @@ class PreviewInner extends BaseComponent {
100561
100643
  }
100562
100644
  }
100563
100645
  componentDidUpdate(prevProps, prevState) {
100564
- if (prevProps.src !== this.props.src) {
100565
- this.foundation.updateTimer();
100646
+ if (prevState.visible !== this.props.visible && this.props.visible) {
100647
+ previewInner_mouseActiveTime = new Date().getTime();
100648
+ timer && clearInterval(timer);
100649
+ timer = setInterval(this.viewVisibleChange, 1000);
100566
100650
  }
100567
100651
  // hide => show
100568
100652
  if (!prevProps.visible && this.props.visible) {
@@ -100574,7 +100658,7 @@ class PreviewInner extends BaseComponent {
100574
100658
  }
100575
100659
  }
100576
100660
  componentWillUnmount() {
100577
- this.foundation.clearTimer();
100661
+ timer && clearInterval(timer);
100578
100662
  }
100579
100663
  isInGroup() {
100580
100664
  return Boolean(this.context && this.context.isGroup);
@@ -100639,10 +100723,10 @@ class PreviewInner extends BaseComponent {
100639
100723
  style: style,
100640
100724
  onMouseDown: this.handleMouseDown,
100641
100725
  onMouseUp: this.handleMouseUp,
100642
- ref: this.registryImageWrapRef,
100643
- onMouseMove: this.handleMouseMove
100726
+ onMouseMove: this.handleMouseMove,
100727
+ onMouseOver: e => this.handleMouseEvent(e.nativeEvent, "over"),
100728
+ onMouseOut: e => this.handleMouseEvent(e.nativeEvent, "out")
100644
100729
  }, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(previewHeader, {
100645
- ref: this.headerRef,
100646
100730
  className: classnames_default()(hideViewerCls),
100647
100731
  onClose: this.handlePreviewClose,
100648
100732
  renderHeader: renderHeader
@@ -100653,6 +100737,7 @@ class PreviewInner extends BaseComponent {
100653
100737
  setRatio: this.handleAdjustRatio,
100654
100738
  zoom: zoom,
100655
100739
  ratio: ratio,
100740
+ zoomStep: zoomStep,
100656
100741
  rotation: rotation,
100657
100742
  crossOrigin: crossOrigin,
100658
100743
  onError: this.onImageError,
@@ -100661,7 +100746,6 @@ class PreviewInner extends BaseComponent {
100661
100746
  /*#__PURE__*/
100662
100747
  // eslint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-static-element-interactions
100663
100748
  external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
100664
- ref: this.leftIconRef,
100665
100749
  className: classnames_default()(`${previewPrefixCls}-icon`, `${previewPrefixCls}-prev`, hideViewerCls),
100666
100750
  onClick: () => this.handleSwitchImage("prev")
100667
100751
  }, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(IconArrowLeft, {
@@ -100670,13 +100754,11 @@ class PreviewInner extends BaseComponent {
100670
100754
  /*#__PURE__*/
100671
100755
  // eslint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-static-element-interactions
100672
100756
  external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
100673
- ref: this.rightIconRef,
100674
100757
  className: classnames_default()(`${previewPrefixCls}-icon`, `${previewPrefixCls}-next`, hideViewerCls),
100675
100758
  onClick: () => this.handleSwitchImage("next")
100676
100759
  }, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(IconArrowRight, {
100677
100760
  size: "large"
100678
100761
  })), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(previewFooter_Footer, {
100679
- forwardRef: this.footerRef,
100680
100762
  className: hideViewerCls,
100681
100763
  totalNum: total,
100682
100764
  curPage: currentIndex + 1,
@@ -100734,8 +100816,6 @@ PreviewInner.propTypes = {
100734
100816
  disableDownload: (prop_types_default()).bool,
100735
100817
  viewerVisibleDelay: (prop_types_default()).number,
100736
100818
  zIndex: (prop_types_default()).number,
100737
- maxZoom: (prop_types_default()).number,
100738
- minZoom: (prop_types_default()).number,
100739
100819
  renderHeader: (prop_types_default()).func,
100740
100820
  renderPreviewMenu: (prop_types_default()).func,
100741
100821
  getPopupContainer: (prop_types_default()).func,
@@ -100760,9 +100840,7 @@ PreviewInner.defaultProps = {
100760
100840
  preLoadGap: 2,
100761
100841
  zIndex: 1000,
100762
100842
  maskClosable: true,
100763
- viewerVisibleDelay: 10000,
100764
- maxZoom: 5,
100765
- minZoom: 0.1
100843
+ viewerVisibleDelay: 10000
100766
100844
  };
100767
100845
  ;// CONCATENATED MODULE: ../semi-foundation/image/imageFoundation.ts
100768
100846
 
@@ -101406,8 +101484,6 @@ Preview.defaultProps = {
101406
101484
 
101407
101485
 
101408
101486
 
101409
-
101410
-
101411
101487
 
101412
101488
 
101413
101489