@sheinx/hooks 3.4.4-beta.6 → 3.5.0-beta.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.
- package/cjs/components/use-table/use-table-virtual.d.ts +3 -0
 - package/cjs/components/use-table/use-table-virtual.d.ts.map +1 -1
 - package/cjs/components/use-table/use-table-virtual.js +30 -1
 - package/cjs/utils/position.d.ts.map +1 -1
 - package/cjs/utils/position.js +15 -14
 - package/esm/components/use-table/use-table-virtual.d.ts +3 -0
 - package/esm/components/use-table/use-table-virtual.d.ts.map +1 -1
 - package/esm/components/use-table/use-table-virtual.js +30 -1
 - package/esm/utils/position.d.ts.map +1 -1
 - package/esm/utils/position.js +15 -14
 - package/package.json +1 -1
 
| 
         @@ -10,6 +10,7 @@ interface UseTableVirtualProps { 
     | 
|
| 
       10 
10 
     | 
    
         
             
                disabled?: boolean;
         
     | 
| 
       11 
11 
     | 
    
         
             
                isRtl?: boolean;
         
     | 
| 
       12 
12 
     | 
    
         
             
                columns: TableFormatColumn<any>[];
         
     | 
| 
      
 13 
     | 
    
         
            +
                colgroup: (number | string | undefined)[];
         
     | 
| 
       13 
14 
     | 
    
         
             
            }
         
     | 
| 
       14 
15 
     | 
    
         
             
            declare const useTableVirtual: (props: UseTableVirtualProps) => {
         
     | 
| 
       15 
16 
     | 
    
         
             
                scrollHeight: number;
         
     | 
| 
         @@ -27,6 +28,8 @@ declare const useTableVirtual: (props: UseTableVirtualProps) => { 
     | 
|
| 
       27 
28 
     | 
    
         
             
                setRowHeight: (index: number, height: number) => void;
         
     | 
| 
       28 
29 
     | 
    
         
             
                getTranslate: (left?: number, top?: number) => string;
         
     | 
| 
       29 
30 
     | 
    
         
             
                scrollToIndex: (index: number, callback?: () => void) => void;
         
     | 
| 
      
 31 
     | 
    
         
            +
                scrollColumnByLeft: (targetLeft: number) => void;
         
     | 
| 
      
 32 
     | 
    
         
            +
                scrollColumnIntoView: (colKey: string | number) => void;
         
     | 
| 
       30 
33 
     | 
    
         
             
            };
         
     | 
| 
       31 
34 
     | 
    
         
             
            export default useTableVirtual;
         
     | 
| 
       32 
35 
     | 
    
         
             
            //# sourceMappingURL=use-table-virtual.d.ts.map
         
     | 
| 
         @@ -1 +1 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            {"version":3,"file":"use-table-virtual.d.ts","sourceRoot":"","sources":["use-table-virtual.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAGrD,UAAU,oBAAoB;IAC5B,IAAI,EAAE,GAAG,EAAE,CAAC;IACZ,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,KAAK,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC;IAC3C,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC;IAC1C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE,iBAAiB,CAAC,GAAG,CAAC,EAAE,CAAC; 
     | 
| 
      
 1 
     | 
    
         
            +
            {"version":3,"file":"use-table-virtual.d.ts","sourceRoot":"","sources":["use-table-virtual.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAGrD,UAAU,oBAAoB;IAC5B,IAAI,EAAE,GAAG,EAAE,CAAC;IACZ,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,KAAK,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC;IAC3C,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC;IAC1C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE,iBAAiB,CAAC,GAAG,CAAC,EAAE,CAAC;IAClC,QAAQ,EAAE,CAAC,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC,EAAE,CAAC;CAC3C;AACD,QAAA,MAAM,eAAe,UAAW,oBAAoB;;;;;;;oBAqLpC,MAAM;mBACP,MAAM;WACd,MAAM;gBACD,MAAM;kBACJ,OAAO;;0BAzFuB,MAAM,UAAU,MAAM;0BAxBtB,MAAM,QAAQ,MAAM;2BAqJnB,MAAM,aAAa,MAAM,IAAI;qCAoBnB,MAAM;mCAWR,MAAM,GAAG,MAAM;CAyFnE,CAAC;AAEF,eAAe,eAAe,CAAC"}
         
     | 
| 
         @@ -259,6 +259,33 @@ var useTableVirtual = function useTableVirtual(props) { 
     | 
|
| 
       259 
259 
     | 
    
         
             
                  props.scrollRef.current.scrollTop = beforeHeight;
         
     | 
| 
       260 
260 
     | 
    
         
             
                }
         
     | 
| 
       261 
261 
     | 
    
         
             
              });
         
     | 
| 
      
 262 
     | 
    
         
            +
              var scrollColumnByLeft = (0, _usePersistFn.usePersistFn)(function (targetLeft) {
         
     | 
| 
      
 263 
     | 
    
         
            +
                if (targetLeft < 0) return;
         
     | 
| 
      
 264 
     | 
    
         
            +
                var scrollEl = props.scrollRef.current;
         
     | 
| 
      
 265 
     | 
    
         
            +
                if (!scrollEl) return;
         
     | 
| 
      
 266 
     | 
    
         
            +
                // scrollLeft max
         
     | 
| 
      
 267 
     | 
    
         
            +
                var max = scrollEl.scrollWidth - scrollEl.clientWidth;
         
     | 
| 
      
 268 
     | 
    
         
            +
                var left = Math.min(targetLeft, max);
         
     | 
| 
      
 269 
     | 
    
         
            +
                if (left === scrollEl.scrollLeft) return;
         
     | 
| 
      
 270 
     | 
    
         
            +
                setLeft(left);
         
     | 
| 
      
 271 
     | 
    
         
            +
                scrollEl.scrollLeft = left;
         
     | 
| 
      
 272 
     | 
    
         
            +
              });
         
     | 
| 
      
 273 
     | 
    
         
            +
              var scrollColumnIntoView = (0, _usePersistFn.usePersistFn)(function (colKey) {
         
     | 
| 
      
 274 
     | 
    
         
            +
                if (colKey === undefined) return;
         
     | 
| 
      
 275 
     | 
    
         
            +
                var col = props.columns.find(function (col) {
         
     | 
| 
      
 276 
     | 
    
         
            +
                  return col.key === colKey;
         
     | 
| 
      
 277 
     | 
    
         
            +
                });
         
     | 
| 
      
 278 
     | 
    
         
            +
                if (!col || col.fixed) return;
         
     | 
| 
      
 279 
     | 
    
         
            +
                var left = 0;
         
     | 
| 
      
 280 
     | 
    
         
            +
                for (var i = 0, len = col.index; i < len; i++) {
         
     | 
| 
      
 281 
     | 
    
         
            +
                  if (props.columns[i].fixed) {
         
     | 
| 
      
 282 
     | 
    
         
            +
                    left = 0;
         
     | 
| 
      
 283 
     | 
    
         
            +
                  } else {
         
     | 
| 
      
 284 
     | 
    
         
            +
                    left += props.colgroup[i];
         
     | 
| 
      
 285 
     | 
    
         
            +
                  }
         
     | 
| 
      
 286 
     | 
    
         
            +
                }
         
     | 
| 
      
 287 
     | 
    
         
            +
                scrollColumnByLeft(left);
         
     | 
| 
      
 288 
     | 
    
         
            +
              });
         
     | 
| 
       262 
289 
     | 
    
         
             
              (0, _react.useEffect)(function () {
         
     | 
| 
       263 
290 
     | 
    
         
             
                var scrollRefHeight = props.scrollRef.current ? props.scrollRef.current.clientHeight : 0;
         
     | 
| 
       264 
291 
     | 
    
         
             
                var tableRefHeight = props.innerRef.current ? props.innerRef.current.clientHeight : 0;
         
     | 
| 
         @@ -322,7 +349,9 @@ var useTableVirtual = function useTableVirtual(props) { 
     | 
|
| 
       322 
349 
     | 
    
         
             
                handleScroll: handleScroll,
         
     | 
| 
       323 
350 
     | 
    
         
             
                setRowHeight: setRowHeight,
         
     | 
| 
       324 
351 
     | 
    
         
             
                getTranslate: getTranslate,
         
     | 
| 
       325 
     | 
    
         
            -
                scrollToIndex: scrollToIndex
         
     | 
| 
      
 352 
     | 
    
         
            +
                scrollToIndex: scrollToIndex,
         
     | 
| 
      
 353 
     | 
    
         
            +
                scrollColumnByLeft: scrollColumnByLeft,
         
     | 
| 
      
 354 
     | 
    
         
            +
                scrollColumnIntoView: scrollColumnIntoView
         
     | 
| 
       326 
355 
     | 
    
         
             
              };
         
     | 
| 
       327 
356 
     | 
    
         
             
            };
         
     | 
| 
       328 
357 
     | 
    
         
             
            var _default = exports.default = useTableVirtual;
         
     | 
| 
         @@ -1 +1 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            {"version":3,"file":"position.d.ts","sourceRoot":"","sources":["position.ts"],"names":[],"mappings":" 
     | 
| 
      
 1 
     | 
    
         
            +
            {"version":3,"file":"position.d.ts","sourceRoot":"","sources":["position.ts"],"names":[],"mappings":"AAkGA,eAAO,MAAM,WAAW,WACd,WAAW,GAAG,IAAI,2EAEpB,SAAS,GAAG,MAAM,GAAG,MAAM,UACzB,WAAW,gKAKpB,CAAC"}
         
     | 
    
        package/cjs/utils/position.js
    CHANGED
    
    | 
         @@ -66,22 +66,23 @@ var getPopoverPosition = function getPopoverPosition(target) { 
     | 
|
| 
       66 
66 
     | 
    
         
             
                var popupRect = popup === null || popup === void 0 ? void 0 : popup.getBoundingClientRect();
         
     | 
| 
       67 
67 
     | 
    
         
             
                if (verticalPoint > windowHeight / 2) position = 'top';else position = 'bottom';
         
     | 
| 
       68 
68 
     | 
    
         | 
| 
      
 69 
     | 
    
         
            +
                // TODO: 暂时移除,另考虑方案
         
     | 
| 
       69 
70 
     | 
    
         
             
                // 如果渲染了弹出内容,则根据弹出内容宽度计算是否自动调整位置
         
     | 
| 
       70 
     | 
    
         
            -
                if (popupRect) {
         
     | 
| 
       71 
     | 
    
         
            -
             
     | 
| 
       72 
     | 
    
         
            -
             
     | 
| 
       73 
     | 
    
         
            -
             
     | 
| 
       74 
     | 
    
         
            -
             
     | 
| 
       75 
     | 
    
         
            -
             
     | 
| 
       76 
     | 
    
         
            -
             
     | 
| 
       77 
     | 
    
         
            -
                } else {
         
     | 
| 
       78 
     | 
    
         
            -
             
     | 
| 
       79 
     | 
    
         
            -
             
     | 
| 
       80 
     | 
    
         
            -
             
     | 
| 
       81 
     | 
    
         
            -
             
     | 
| 
       82 
     | 
    
         
            -
             
     | 
| 
       83 
     | 
    
         
            -
                  }
         
     | 
| 
      
 71 
     | 
    
         
            +
                // if (popupRect && popupRect?.width) {
         
     | 
| 
      
 72 
     | 
    
         
            +
                //   if (popupRect?.width / 2 > rect.left) {
         
     | 
| 
      
 73 
     | 
    
         
            +
                //     position += '-left';
         
     | 
| 
      
 74 
     | 
    
         
            +
                //   }
         
     | 
| 
      
 75 
     | 
    
         
            +
                //   if (popupRect?.width / 2 > windowWidth - rect.right) {
         
     | 
| 
      
 76 
     | 
    
         
            +
                //     position += '-right';
         
     | 
| 
      
 77 
     | 
    
         
            +
                //   }
         
     | 
| 
      
 78 
     | 
    
         
            +
                // } else {
         
     | 
| 
      
 79 
     | 
    
         
            +
                // 兜底计算
         
     | 
| 
      
 80 
     | 
    
         
            +
                if (horizontalPoint > windowWidth * 0.6) {
         
     | 
| 
      
 81 
     | 
    
         
            +
                  position += '-right';
         
     | 
| 
      
 82 
     | 
    
         
            +
                } else if (horizontalPoint < windowWidth * 0.4) {
         
     | 
| 
      
 83 
     | 
    
         
            +
                  position += '-left';
         
     | 
| 
       84 
84 
     | 
    
         
             
                }
         
     | 
| 
      
 85 
     | 
    
         
            +
                // }
         
     | 
| 
       85 
86 
     | 
    
         
             
              }
         
     | 
| 
       86 
87 
     | 
    
         
             
              return position;
         
     | 
| 
       87 
88 
     | 
    
         
             
            };
         
     | 
| 
         @@ -10,6 +10,7 @@ interface UseTableVirtualProps { 
     | 
|
| 
       10 
10 
     | 
    
         
             
                disabled?: boolean;
         
     | 
| 
       11 
11 
     | 
    
         
             
                isRtl?: boolean;
         
     | 
| 
       12 
12 
     | 
    
         
             
                columns: TableFormatColumn<any>[];
         
     | 
| 
      
 13 
     | 
    
         
            +
                colgroup: (number | string | undefined)[];
         
     | 
| 
       13 
14 
     | 
    
         
             
            }
         
     | 
| 
       14 
15 
     | 
    
         
             
            declare const useTableVirtual: (props: UseTableVirtualProps) => {
         
     | 
| 
       15 
16 
     | 
    
         
             
                scrollHeight: number;
         
     | 
| 
         @@ -27,6 +28,8 @@ declare const useTableVirtual: (props: UseTableVirtualProps) => { 
     | 
|
| 
       27 
28 
     | 
    
         
             
                setRowHeight: (index: number, height: number) => void;
         
     | 
| 
       28 
29 
     | 
    
         
             
                getTranslate: (left?: number, top?: number) => string;
         
     | 
| 
       29 
30 
     | 
    
         
             
                scrollToIndex: (index: number, callback?: () => void) => void;
         
     | 
| 
      
 31 
     | 
    
         
            +
                scrollColumnByLeft: (targetLeft: number) => void;
         
     | 
| 
      
 32 
     | 
    
         
            +
                scrollColumnIntoView: (colKey: string | number) => void;
         
     | 
| 
       30 
33 
     | 
    
         
             
            };
         
     | 
| 
       31 
34 
     | 
    
         
             
            export default useTableVirtual;
         
     | 
| 
       32 
35 
     | 
    
         
             
            //# sourceMappingURL=use-table-virtual.d.ts.map
         
     | 
| 
         @@ -1 +1 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            {"version":3,"file":"use-table-virtual.d.ts","sourceRoot":"","sources":["use-table-virtual.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAGrD,UAAU,oBAAoB;IAC5B,IAAI,EAAE,GAAG,EAAE,CAAC;IACZ,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,KAAK,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC;IAC3C,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC;IAC1C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE,iBAAiB,CAAC,GAAG,CAAC,EAAE,CAAC; 
     | 
| 
      
 1 
     | 
    
         
            +
            {"version":3,"file":"use-table-virtual.d.ts","sourceRoot":"","sources":["use-table-virtual.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAGrD,UAAU,oBAAoB;IAC5B,IAAI,EAAE,GAAG,EAAE,CAAC;IACZ,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,KAAK,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC;IAC3C,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC;IAC1C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE,iBAAiB,CAAC,GAAG,CAAC,EAAE,CAAC;IAClC,QAAQ,EAAE,CAAC,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC,EAAE,CAAC;CAC3C;AACD,QAAA,MAAM,eAAe,UAAW,oBAAoB;;;;;;;oBAqLpC,MAAM;mBACP,MAAM;WACd,MAAM;gBACD,MAAM;kBACJ,OAAO;;0BAzFuB,MAAM,UAAU,MAAM;0BAxBtB,MAAM,QAAQ,MAAM;2BAqJnB,MAAM,aAAa,MAAM,IAAI;qCAoBnB,MAAM;mCAWR,MAAM,GAAG,MAAM;CAyFnE,CAAC;AAEF,eAAe,eAAe,CAAC"}
         
     | 
| 
         @@ -253,6 +253,33 @@ var useTableVirtual = function useTableVirtual(props) { 
     | 
|
| 
       253 
253 
     | 
    
         
             
                  props.scrollRef.current.scrollTop = beforeHeight;
         
     | 
| 
       254 
254 
     | 
    
         
             
                }
         
     | 
| 
       255 
255 
     | 
    
         
             
              });
         
     | 
| 
      
 256 
     | 
    
         
            +
              var scrollColumnByLeft = usePersistFn(function (targetLeft) {
         
     | 
| 
      
 257 
     | 
    
         
            +
                if (targetLeft < 0) return;
         
     | 
| 
      
 258 
     | 
    
         
            +
                var scrollEl = props.scrollRef.current;
         
     | 
| 
      
 259 
     | 
    
         
            +
                if (!scrollEl) return;
         
     | 
| 
      
 260 
     | 
    
         
            +
                // scrollLeft max
         
     | 
| 
      
 261 
     | 
    
         
            +
                var max = scrollEl.scrollWidth - scrollEl.clientWidth;
         
     | 
| 
      
 262 
     | 
    
         
            +
                var left = Math.min(targetLeft, max);
         
     | 
| 
      
 263 
     | 
    
         
            +
                if (left === scrollEl.scrollLeft) return;
         
     | 
| 
      
 264 
     | 
    
         
            +
                setLeft(left);
         
     | 
| 
      
 265 
     | 
    
         
            +
                scrollEl.scrollLeft = left;
         
     | 
| 
      
 266 
     | 
    
         
            +
              });
         
     | 
| 
      
 267 
     | 
    
         
            +
              var scrollColumnIntoView = usePersistFn(function (colKey) {
         
     | 
| 
      
 268 
     | 
    
         
            +
                if (colKey === undefined) return;
         
     | 
| 
      
 269 
     | 
    
         
            +
                var col = props.columns.find(function (col) {
         
     | 
| 
      
 270 
     | 
    
         
            +
                  return col.key === colKey;
         
     | 
| 
      
 271 
     | 
    
         
            +
                });
         
     | 
| 
      
 272 
     | 
    
         
            +
                if (!col || col.fixed) return;
         
     | 
| 
      
 273 
     | 
    
         
            +
                var left = 0;
         
     | 
| 
      
 274 
     | 
    
         
            +
                for (var i = 0, len = col.index; i < len; i++) {
         
     | 
| 
      
 275 
     | 
    
         
            +
                  if (props.columns[i].fixed) {
         
     | 
| 
      
 276 
     | 
    
         
            +
                    left = 0;
         
     | 
| 
      
 277 
     | 
    
         
            +
                  } else {
         
     | 
| 
      
 278 
     | 
    
         
            +
                    left += props.colgroup[i];
         
     | 
| 
      
 279 
     | 
    
         
            +
                  }
         
     | 
| 
      
 280 
     | 
    
         
            +
                }
         
     | 
| 
      
 281 
     | 
    
         
            +
                scrollColumnByLeft(left);
         
     | 
| 
      
 282 
     | 
    
         
            +
              });
         
     | 
| 
       256 
283 
     | 
    
         
             
              useEffect(function () {
         
     | 
| 
       257 
284 
     | 
    
         
             
                var scrollRefHeight = props.scrollRef.current ? props.scrollRef.current.clientHeight : 0;
         
     | 
| 
       258 
285 
     | 
    
         
             
                var tableRefHeight = props.innerRef.current ? props.innerRef.current.clientHeight : 0;
         
     | 
| 
         @@ -316,7 +343,9 @@ var useTableVirtual = function useTableVirtual(props) { 
     | 
|
| 
       316 
343 
     | 
    
         
             
                handleScroll: handleScroll,
         
     | 
| 
       317 
344 
     | 
    
         
             
                setRowHeight: setRowHeight,
         
     | 
| 
       318 
345 
     | 
    
         
             
                getTranslate: getTranslate,
         
     | 
| 
       319 
     | 
    
         
            -
                scrollToIndex: scrollToIndex
         
     | 
| 
      
 346 
     | 
    
         
            +
                scrollToIndex: scrollToIndex,
         
     | 
| 
      
 347 
     | 
    
         
            +
                scrollColumnByLeft: scrollColumnByLeft,
         
     | 
| 
      
 348 
     | 
    
         
            +
                scrollColumnIntoView: scrollColumnIntoView
         
     | 
| 
       320 
349 
     | 
    
         
             
              };
         
     | 
| 
       321 
350 
     | 
    
         
             
            };
         
     | 
| 
       322 
351 
     | 
    
         
             
            export default useTableVirtual;
         
     | 
| 
         @@ -1 +1 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            {"version":3,"file":"position.d.ts","sourceRoot":"","sources":["position.ts"],"names":[],"mappings":" 
     | 
| 
      
 1 
     | 
    
         
            +
            {"version":3,"file":"position.d.ts","sourceRoot":"","sources":["position.ts"],"names":[],"mappings":"AAkGA,eAAO,MAAM,WAAW,WACd,WAAW,GAAG,IAAI,2EAEpB,SAAS,GAAG,MAAM,GAAG,MAAM,UACzB,WAAW,gKAKpB,CAAC"}
         
     | 
    
        package/esm/utils/position.js
    CHANGED
    
    | 
         @@ -60,22 +60,23 @@ var getPopoverPosition = function getPopoverPosition(target) { 
     | 
|
| 
       60 
60 
     | 
    
         
             
                var popupRect = popup === null || popup === void 0 ? void 0 : popup.getBoundingClientRect();
         
     | 
| 
       61 
61 
     | 
    
         
             
                if (verticalPoint > windowHeight / 2) position = 'top';else position = 'bottom';
         
     | 
| 
       62 
62 
     | 
    
         | 
| 
      
 63 
     | 
    
         
            +
                // TODO: 暂时移除,另考虑方案
         
     | 
| 
       63 
64 
     | 
    
         
             
                // 如果渲染了弹出内容,则根据弹出内容宽度计算是否自动调整位置
         
     | 
| 
       64 
     | 
    
         
            -
                if (popupRect) {
         
     | 
| 
       65 
     | 
    
         
            -
             
     | 
| 
       66 
     | 
    
         
            -
             
     | 
| 
       67 
     | 
    
         
            -
             
     | 
| 
       68 
     | 
    
         
            -
             
     | 
| 
       69 
     | 
    
         
            -
             
     | 
| 
       70 
     | 
    
         
            -
             
     | 
| 
       71 
     | 
    
         
            -
                } else {
         
     | 
| 
       72 
     | 
    
         
            -
             
     | 
| 
       73 
     | 
    
         
            -
             
     | 
| 
       74 
     | 
    
         
            -
             
     | 
| 
       75 
     | 
    
         
            -
             
     | 
| 
       76 
     | 
    
         
            -
             
     | 
| 
       77 
     | 
    
         
            -
                  }
         
     | 
| 
      
 65 
     | 
    
         
            +
                // if (popupRect && popupRect?.width) {
         
     | 
| 
      
 66 
     | 
    
         
            +
                //   if (popupRect?.width / 2 > rect.left) {
         
     | 
| 
      
 67 
     | 
    
         
            +
                //     position += '-left';
         
     | 
| 
      
 68 
     | 
    
         
            +
                //   }
         
     | 
| 
      
 69 
     | 
    
         
            +
                //   if (popupRect?.width / 2 > windowWidth - rect.right) {
         
     | 
| 
      
 70 
     | 
    
         
            +
                //     position += '-right';
         
     | 
| 
      
 71 
     | 
    
         
            +
                //   }
         
     | 
| 
      
 72 
     | 
    
         
            +
                // } else {
         
     | 
| 
      
 73 
     | 
    
         
            +
                // 兜底计算
         
     | 
| 
      
 74 
     | 
    
         
            +
                if (horizontalPoint > windowWidth * 0.6) {
         
     | 
| 
      
 75 
     | 
    
         
            +
                  position += '-right';
         
     | 
| 
      
 76 
     | 
    
         
            +
                } else if (horizontalPoint < windowWidth * 0.4) {
         
     | 
| 
      
 77 
     | 
    
         
            +
                  position += '-left';
         
     | 
| 
       78 
78 
     | 
    
         
             
                }
         
     | 
| 
      
 79 
     | 
    
         
            +
                // }
         
     | 
| 
       79 
80 
     | 
    
         
             
              }
         
     | 
| 
       80 
81 
     | 
    
         
             
              return position;
         
     | 
| 
       81 
82 
     | 
    
         
             
            };
         
     |