@kep-platform/basic-component 0.0.43 → 0.0.44
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/dist/ViewPort/ViewPort.d.ts +0 -1
 - package/dist/ViewPort/ViewPortStore.d.ts +7 -0
 - package/dist/ViewPort/ViewPortStore.js +11 -6
 - package/dist/ViewPort/ViewPortWindow.d.ts +7 -14
 - package/dist/ViewPort/ViewPortWindow.js +44 -36
 - package/dist/ViewPort/test.js +7 -10
 - package/dist/Window/Window.js +1 -0
 - package/dist/Window/WindowStore.d.ts +5 -2
 - package/dist/Window/WindowStore.js +14 -6
 - package/package.json +3 -3
 
| 
         @@ -9,7 +9,6 @@ type ViewPortProps = { 
     | 
|
| 
       9 
9 
     | 
    
         
             
            declare function ViewPort(props: ViewPortProps): React.JSX.Element;
         
     | 
| 
       10 
10 
     | 
    
         
             
            declare namespace ViewPort {
         
     | 
| 
       11 
11 
     | 
    
         
             
                var Window: React.FunctionComponent<import("../Window/Window").WindowProps & {
         
     | 
| 
       12 
     | 
    
         
            -
                    viewPortStore: ViewPortStore;
         
     | 
| 
       13 
12 
     | 
    
         
             
                    window: import("./ViewPortWindow").ViewPortWindowStore;
         
     | 
| 
       14 
13 
     | 
    
         
             
                }>;
         
     | 
| 
       15 
14 
     | 
    
         
             
            }
         
     | 
| 
         @@ -37,6 +37,13 @@ export declare class ViewPortStore { 
     | 
|
| 
       37 
37 
     | 
    
         
             
                    height: number;
         
     | 
| 
       38 
38 
     | 
    
         
             
                    scale: number;
         
     | 
| 
       39 
39 
     | 
    
         
             
                };
         
     | 
| 
      
 40 
     | 
    
         
            +
                posInViewPort(left: number, top: number, width: number, height: number): {
         
     | 
| 
      
 41 
     | 
    
         
            +
                    left: number;
         
     | 
| 
      
 42 
     | 
    
         
            +
                    top: number;
         
     | 
| 
      
 43 
     | 
    
         
            +
                    width: number;
         
     | 
| 
      
 44 
     | 
    
         
            +
                    height: number;
         
     | 
| 
      
 45 
     | 
    
         
            +
                    scale: number;
         
     | 
| 
      
 46 
     | 
    
         
            +
                };
         
     | 
| 
       40 
47 
     | 
    
         
             
                get containerStyle(): CSSProperties;
         
     | 
| 
       41 
48 
     | 
    
         
             
                get info(): string;
         
     | 
| 
       42 
49 
     | 
    
         
             
            }
         
     | 
| 
         @@ -131,20 +131,25 @@ export var ViewPortStore = /*#__PURE__*/function () { 
     | 
|
| 
       131 
131 
     | 
    
         
             
                    width: this.width * this.ratio + 'px',
         
     | 
| 
       132 
132 
     | 
    
         
             
                    height: this.height * this.ratio + 'px',
         
     | 
| 
       133 
133 
     | 
    
         
             
                    transformOrigin: 'left top',
         
     | 
| 
       134 
     | 
    
         
            -
                    transition: this.isMoving ? 'none' : 'all  
     | 
| 
      
 134 
     | 
    
         
            +
                    transition: this.isMoving ? 'none' : 'all 1s ease-in-out',
         
     | 
| 
       135 
135 
     | 
    
         
             
                    background: '#188fff67',
         
     | 
| 
       136 
136 
     | 
    
         
             
                    cursor: this.isMoving ? 'grab' : 'default'
         
     | 
| 
       137 
137 
     | 
    
         
             
                  };
         
     | 
| 
       138 
138 
     | 
    
         
             
                }
         
     | 
| 
       139 
     | 
    
         
            -
                /* 计算得到实际显示区域的偏移量 */
         
     | 
| 
       140 
139 
     | 
    
         
             
              }, {
         
     | 
| 
       141 
140 
     | 
    
         
             
                key: "viewPortRect",
         
     | 
| 
       142 
141 
     | 
    
         
             
                get: function get() {
         
     | 
| 
      
 142 
     | 
    
         
            +
                  return this.posInViewPort(0, 0, this.width, this.height);
         
     | 
| 
      
 143 
     | 
    
         
            +
                }
         
     | 
| 
      
 144 
     | 
    
         
            +
                /* 这个函数比较重要,因为你想要让content中的元素在视窗相对位置显示,这个函数会帮你计算偏移量和缩放量,直接得出你的元素应该在content中的偏移量 */
         
     | 
| 
      
 145 
     | 
    
         
            +
              }, {
         
     | 
| 
      
 146 
     | 
    
         
            +
                key: "posInViewPort",
         
     | 
| 
      
 147 
     | 
    
         
            +
                value: function posInViewPort(left, top, width, height) {
         
     | 
| 
       143 
148 
     | 
    
         
             
                  return {
         
     | 
| 
       144 
     | 
    
         
            -
                    left: -this.transform.left + this.offsetLeft,
         
     | 
| 
       145 
     | 
    
         
            -
                    top: -this.transform.top + this.offsetTop,
         
     | 
| 
       146 
     | 
    
         
            -
                    width: this. 
     | 
| 
       147 
     | 
    
         
            -
                    height: this. 
     | 
| 
      
 149 
     | 
    
         
            +
                    left: (-this.transform.left + this.offsetLeft + left) / this.scale,
         
     | 
| 
      
 150 
     | 
    
         
            +
                    top: (-this.transform.top + this.offsetTop + top) / this.scale,
         
     | 
| 
      
 151 
     | 
    
         
            +
                    width: width / this.scale,
         
     | 
| 
      
 152 
     | 
    
         
            +
                    height: height / this.scale,
         
     | 
| 
       148 
153 
     | 
    
         
             
                    scale: this.scale
         
     | 
| 
       149 
154 
     | 
    
         
             
                  };
         
     | 
| 
       150 
155 
     | 
    
         
             
                }
         
     | 
| 
         @@ -5,7 +5,7 @@ import { WindowProps } from '../Window/Window'; 
     | 
|
| 
       5 
5 
     | 
    
         
             
            import { WindowControllerType } from '../Window/WindowController';
         
     | 
| 
       6 
6 
     | 
    
         
             
            import { ViewPortStore } from './ViewPortStore';
         
     | 
| 
       7 
7 
     | 
    
         
             
            export declare class ViewPortWindowStore extends WindowStore {
         
     | 
| 
       8 
     | 
    
         
            -
                 
     | 
| 
      
 8 
     | 
    
         
            +
                viewPortStore: ViewPortStore;
         
     | 
| 
       9 
9 
     | 
    
         
             
                get style(): {
         
     | 
| 
       10 
10 
     | 
    
         
             
                    left: string;
         
     | 
| 
       11 
11 
     | 
    
         
             
                    top: string;
         
     | 
| 
         @@ -13,17 +13,8 @@ export declare class ViewPortWindowStore extends WindowStore { 
     | 
|
| 
       13 
13 
     | 
    
         
             
                    height: string;
         
     | 
| 
       14 
14 
     | 
    
         
             
                    zIndex: number;
         
     | 
| 
       15 
15 
     | 
    
         
             
                    transform: string;
         
     | 
| 
      
 16 
     | 
    
         
            +
                    transformOrigin: string;
         
     | 
| 
       16 
17 
     | 
    
         
             
                    transition: string;
         
     | 
| 
       17 
     | 
    
         
            -
                    transformOrigin?: undefined;
         
     | 
| 
       18 
     | 
    
         
            -
                } | {
         
     | 
| 
       19 
     | 
    
         
            -
                    left: string;
         
     | 
| 
       20 
     | 
    
         
            -
                    top: string;
         
     | 
| 
       21 
     | 
    
         
            -
                    width: number;
         
     | 
| 
       22 
     | 
    
         
            -
                    height: number;
         
     | 
| 
       23 
     | 
    
         
            -
                    zIndex: number;
         
     | 
| 
       24 
     | 
    
         
            -
                    transform: string;
         
     | 
| 
       25 
     | 
    
         
            -
                    transition: string;
         
     | 
| 
       26 
     | 
    
         
            -
                    transformOrigin?: undefined;
         
     | 
| 
       27 
18 
     | 
    
         
             
                } | {
         
     | 
| 
       28 
19 
     | 
    
         
             
                    left: string;
         
     | 
| 
       29 
20 
     | 
    
         
             
                    top: string;
         
     | 
| 
         @@ -31,17 +22,19 @@ export declare class ViewPortWindowStore extends WindowStore { 
     | 
|
| 
       31 
22 
     | 
    
         
             
                    height: string;
         
     | 
| 
       32 
23 
     | 
    
         
             
                    zIndex: number;
         
     | 
| 
       33 
24 
     | 
    
         
             
                    transform: string;
         
     | 
| 
       34 
     | 
    
         
            -
                    transformOrigin: string;
         
     | 
| 
       35 
25 
     | 
    
         
             
                    transition: string;
         
     | 
| 
      
 26 
     | 
    
         
            +
                    transformOrigin?: undefined;
         
     | 
| 
       36 
27 
     | 
    
         
             
                };
         
     | 
| 
      
 28 
     | 
    
         
            +
                focus(): void;
         
     | 
| 
       37 
29 
     | 
    
         
             
                calculateTransform(transform: Transform): {
         
     | 
| 
       38 
30 
     | 
    
         
             
                    x: number;
         
     | 
| 
       39 
31 
     | 
    
         
             
                    y: number;
         
     | 
| 
       40 
32 
     | 
    
         
             
                };
         
     | 
| 
       41 
33 
     | 
    
         
             
                controll(transform: Transform, type: WindowControllerType): void;
         
     | 
| 
       42 
     | 
    
         
            -
                 
     | 
| 
      
 34 
     | 
    
         
            +
                centerDisplay(): void;
         
     | 
| 
      
 35 
     | 
    
         
            +
                fullscreenWindow(func?: () => void): void;
         
     | 
| 
      
 36 
     | 
    
         
            +
                constructor(id: string, viewPort: ViewPortStore, onClosedHandler?: (id: string) => void);
         
     | 
| 
       43 
37 
     | 
    
         
             
            }
         
     | 
| 
       44 
38 
     | 
    
         
             
            export declare const ViewPortWindow: React.FunctionComponent<WindowProps & {
         
     | 
| 
       45 
     | 
    
         
            -
                viewPortStore: ViewPortStore;
         
     | 
| 
       46 
39 
     | 
    
         
             
                window: ViewPortWindowStore;
         
     | 
| 
       47 
40 
     | 
    
         
             
            }>;
         
     | 
| 
         @@ -1,4 +1,4 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            var _excluded = [" 
     | 
| 
      
 1 
     | 
    
         
            +
            var _excluded = ["window"];
         
     | 
| 
       2 
2 
     | 
    
         
             
            function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
         
     | 
| 
       3 
3 
     | 
    
         
             
            function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
         
     | 
| 
       4 
4 
     | 
    
         
             
            function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
         
     | 
| 
         @@ -16,7 +16,7 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g 
     | 
|
| 
       16 
16 
     | 
    
         
             
            function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
         
     | 
| 
       17 
17 
     | 
    
         
             
            function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
         
     | 
| 
       18 
18 
     | 
    
         
             
            function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
         
     | 
| 
       19 
     | 
    
         
            -
            import {  
     | 
| 
      
 19 
     | 
    
         
            +
            import { action, makeObservable, override } from 'mobx';
         
     | 
| 
       20 
20 
     | 
    
         
             
            import { observer } from 'mobx-react-lite';
         
     | 
| 
       21 
21 
     | 
    
         
             
            import React, { useEffect } from 'react';
         
     | 
| 
       22 
22 
     | 
    
         
             
            import { WindowStore } from "../Window";
         
     | 
| 
         @@ -24,15 +24,17 @@ import { default as Window } from "../Window/Window"; 
     | 
|
| 
       24 
24 
     | 
    
         
             
            export var ViewPortWindowStore = /*#__PURE__*/function (_WindowStore) {
         
     | 
| 
       25 
25 
     | 
    
         
             
              _inherits(ViewPortWindowStore, _WindowStore);
         
     | 
| 
       26 
26 
     | 
    
         
             
              var _super = _createSuper(ViewPortWindowStore);
         
     | 
| 
       27 
     | 
    
         
            -
              function ViewPortWindowStore(id, onClosedHandler) {
         
     | 
| 
      
 27 
     | 
    
         
            +
              function ViewPortWindowStore(id, viewPort, onClosedHandler) {
         
     | 
| 
       28 
28 
     | 
    
         
             
                var _this;
         
     | 
| 
       29 
29 
     | 
    
         
             
                _classCallCheck(this, ViewPortWindowStore);
         
     | 
| 
       30 
30 
     | 
    
         
             
                _this = _super.call(this, id, onClosedHandler);
         
     | 
| 
       31 
     | 
    
         
            -
                _defineProperty(_assertThisInitialized(_this), " 
     | 
| 
      
 31 
     | 
    
         
            +
                _defineProperty(_assertThisInitialized(_this), "viewPortStore", void 0);
         
     | 
| 
      
 32 
     | 
    
         
            +
                _this.viewPortStore = viewPort;
         
     | 
| 
       32 
33 
     | 
    
         
             
                makeObservable(_assertThisInitialized(_this), {
         
     | 
| 
       33 
34 
     | 
    
         
             
                  style: override,
         
     | 
| 
       34 
     | 
    
         
            -
                   
     | 
| 
       35 
     | 
    
         
            -
                   
     | 
| 
      
 35 
     | 
    
         
            +
                  controll: override,
         
     | 
| 
      
 36 
     | 
    
         
            +
                  focus: override,
         
     | 
| 
      
 37 
     | 
    
         
            +
                  centerDisplay: action
         
     | 
| 
       36 
38 
     | 
    
         
             
                });
         
     | 
| 
       37 
39 
     | 
    
         
             
                return _this;
         
     | 
| 
       38 
40 
     | 
    
         
             
              }
         
     | 
| 
         @@ -47,6 +49,7 @@ export var ViewPortWindowStore = /*#__PURE__*/function (_WindowStore) { 
     | 
|
| 
       47 
49 
     | 
    
         
             
                      height: this.height + 'px',
         
     | 
| 
       48 
50 
     | 
    
         
             
                      zIndex: this.zIndex,
         
     | 
| 
       49 
51 
     | 
    
         
             
                      transform: 'scale(0)',
         
     | 
| 
      
 52 
     | 
    
         
            +
                      transformOrigin: 'center center',
         
     | 
| 
       50 
53 
     | 
    
         
             
                      transition: 'all 0.5s ease-out'
         
     | 
| 
       51 
54 
     | 
    
         
             
                    };
         
     | 
| 
       52 
55 
     | 
    
         
             
                  }
         
     | 
| 
         @@ -54,21 +57,22 @@ export var ViewPortWindowStore = /*#__PURE__*/function (_WindowStore) { 
     | 
|
| 
       54 
57 
     | 
    
         
             
                    return {
         
     | 
| 
       55 
58 
     | 
    
         
             
                      left: this.minimizePos.left + 'px',
         
     | 
| 
       56 
59 
     | 
    
         
             
                      top: this.minimizePos.top + 'px',
         
     | 
| 
       57 
     | 
    
         
            -
                      width:  
     | 
| 
       58 
     | 
    
         
            -
                      height:  
     | 
| 
      
 60 
     | 
    
         
            +
                      width: this.width + 'px',
         
     | 
| 
      
 61 
     | 
    
         
            +
                      height: this.height + 'px',
         
     | 
| 
       59 
62 
     | 
    
         
             
                      zIndex: this.zIndex,
         
     | 
| 
       60 
63 
     | 
    
         
             
                      transform: 'scale(0)',
         
     | 
| 
       61 
     | 
    
         
            -
                       
     | 
| 
      
 64 
     | 
    
         
            +
                      transformOrigin: 'left top',
         
     | 
| 
      
 65 
     | 
    
         
            +
                      transition: "all ".concat(0.5 + this.viewPortStore.scale, "s ease-out")
         
     | 
| 
       62 
66 
     | 
    
         
             
                    };
         
     | 
| 
       63 
67 
     | 
    
         
             
                  }
         
     | 
| 
       64 
68 
     | 
    
         
             
                  if (this.fullscreen) {
         
     | 
| 
       65 
69 
     | 
    
         
             
                    return {
         
     | 
| 
       66 
     | 
    
         
            -
                      left: this.fullscreenPos.left  
     | 
| 
       67 
     | 
    
         
            -
                      top: this.fullscreenPos.top  
     | 
| 
       68 
     | 
    
         
            -
                      width: this.fullscreenPos.width + 'px',
         
     | 
| 
       69 
     | 
    
         
            -
                      height: this.fullscreenPos.height + 'px',
         
     | 
| 
      
 70 
     | 
    
         
            +
                      left: this.fullscreenPos.left + 'px',
         
     | 
| 
      
 71 
     | 
    
         
            +
                      top: this.fullscreenPos.top + 'px',
         
     | 
| 
      
 72 
     | 
    
         
            +
                      width: this.fullscreenPos.width * this.viewPortStore.scale + 'px',
         
     | 
| 
      
 73 
     | 
    
         
            +
                      height: this.fullscreenPos.height * this.viewPortStore.scale + 'px',
         
     | 
| 
       70 
74 
     | 
    
         
             
                      zIndex: this.zIndex,
         
     | 
| 
       71 
     | 
    
         
            -
                      transform: "scale(".concat(1 / this.scale, ") 
     | 
| 
      
 75 
     | 
    
         
            +
                      transform: "scale(".concat(1 / this.viewPortStore.scale, ")"),
         
     | 
| 
       72 
76 
     | 
    
         
             
                      transformOrigin: 'left top',
         
     | 
| 
       73 
77 
     | 
    
         
             
                      transition: 'width height 0.5s ease-out'
         
     | 
| 
       74 
78 
     | 
    
         
             
                    };
         
     | 
| 
         @@ -94,13 +98,18 @@ export var ViewPortWindowStore = /*#__PURE__*/function (_WindowStore) { 
     | 
|
| 
       94 
98 
     | 
    
         
             
                    transition: 'all 0.5s ease-out'
         
     | 
| 
       95 
99 
     | 
    
         
             
                  };
         
     | 
| 
       96 
100 
     | 
    
         
             
                }
         
     | 
| 
      
 101 
     | 
    
         
            +
              }, {
         
     | 
| 
      
 102 
     | 
    
         
            +
                key: "focus",
         
     | 
| 
      
 103 
     | 
    
         
            +
                value: function focus() {
         
     | 
| 
      
 104 
     | 
    
         
            +
                  this.zIndex = ++this.viewPortStore.maxZIndex;
         
     | 
| 
      
 105 
     | 
    
         
            +
                }
         
     | 
| 
       97 
106 
     | 
    
         
             
              }, {
         
     | 
| 
       98 
107 
     | 
    
         
             
                key: "calculateTransform",
         
     | 
| 
       99 
108 
     | 
    
         
             
                value: function calculateTransform(transform) {
         
     | 
| 
       100 
109 
     | 
    
         
             
                  var _this$transform, _this$transform2;
         
     | 
| 
       101 
110 
     | 
    
         
             
                  return {
         
     | 
| 
       102 
     | 
    
         
            -
                    x: (transform.x - (((_this$transform = this.transform) === null || _this$transform === void 0 ? void 0 : _this$transform.x) || 0)) / this.scale,
         
     | 
| 
       103 
     | 
    
         
            -
                    y: (transform.y - (((_this$transform2 = this.transform) === null || _this$transform2 === void 0 ? void 0 : _this$transform2.y) || 0)) / this.scale
         
     | 
| 
      
 111 
     | 
    
         
            +
                    x: (transform.x - (((_this$transform = this.transform) === null || _this$transform === void 0 ? void 0 : _this$transform.x) || 0)) / this.viewPortStore.scale,
         
     | 
| 
      
 112 
     | 
    
         
            +
                    y: (transform.y - (((_this$transform2 = this.transform) === null || _this$transform2 === void 0 ? void 0 : _this$transform2.y) || 0)) / this.viewPortStore.scale
         
     | 
| 
       104 
113 
     | 
    
         
             
                  };
         
     | 
| 
       105 
114 
     | 
    
         
             
                }
         
     | 
| 
       106 
115 
     | 
    
         
             
              }, {
         
     | 
| 
         @@ -134,33 +143,32 @@ export var ViewPortWindowStore = /*#__PURE__*/function (_WindowStore) { 
     | 
|
| 
       134 
143 
     | 
    
         
             
                  }
         
     | 
| 
       135 
144 
     | 
    
         
             
                  this.transform = transform;
         
     | 
| 
       136 
145 
     | 
    
         
             
                }
         
     | 
| 
      
 146 
     | 
    
         
            +
              }, {
         
     | 
| 
      
 147 
     | 
    
         
            +
                key: "centerDisplay",
         
     | 
| 
      
 148 
     | 
    
         
            +
                value: function centerDisplay() {
         
     | 
| 
      
 149 
     | 
    
         
            +
                  this.focus();
         
     | 
| 
      
 150 
     | 
    
         
            +
                  var rect = this.viewPortStore.viewPortRect;
         
     | 
| 
      
 151 
     | 
    
         
            +
                  this.left = rect.left + Math.max(0, rect.width - this.width) / 2;
         
     | 
| 
      
 152 
     | 
    
         
            +
                  this.top = rect.top + Math.max(0, rect.height - this.height) / 2;
         
     | 
| 
      
 153 
     | 
    
         
            +
                }
         
     | 
| 
      
 154 
     | 
    
         
            +
              }, {
         
     | 
| 
      
 155 
     | 
    
         
            +
                key: "fullscreenWindow",
         
     | 
| 
      
 156 
     | 
    
         
            +
                value: function fullscreenWindow(func) {
         
     | 
| 
      
 157 
     | 
    
         
            +
                  this.resetState();
         
     | 
| 
      
 158 
     | 
    
         
            +
                  this.fullscreen = true;
         
     | 
| 
      
 159 
     | 
    
         
            +
                  func === null || func === void 0 || func();
         
     | 
| 
      
 160 
     | 
    
         
            +
                  this.fullscreenPos = this.viewPortStore.viewPortRect;
         
     | 
| 
      
 161 
     | 
    
         
            +
                }
         
     | 
| 
       137 
162 
     | 
    
         
             
              }]);
         
     | 
| 
       138 
163 
     | 
    
         
             
              return ViewPortWindowStore;
         
     | 
| 
       139 
164 
     | 
    
         
             
            }(WindowStore);
         
     | 
| 
       140 
165 
     | 
    
         
             
            export var ViewPortWindow = observer(function ViewPortWindow(props) {
         
     | 
| 
       141 
     | 
    
         
            -
              var  
     | 
| 
       142 
     | 
    
         
            -
                window = props.window,
         
     | 
| 
      
 166 
     | 
    
         
            +
              var window = props.window,
         
     | 
| 
       143 
167 
     | 
    
         
             
                rest = _objectWithoutProperties(props, _excluded);
         
     | 
| 
       144 
168 
     | 
    
         
             
              useEffect(function () {
         
     | 
| 
       145 
     | 
    
         
            -
                 
     | 
| 
       146 
     | 
    
         
            -
                  var rect = viewPortStore.viewPortRect;
         
     | 
| 
       147 
     | 
    
         
            -
                  window.fullscreenPos = rect;
         
     | 
| 
       148 
     | 
    
         
            -
                  window.scale = rect.scale;
         
     | 
| 
       149 
     | 
    
         
            -
                });
         
     | 
| 
       150 
     | 
    
         
            -
              }, [viewPortStore.viewPortRect]);
         
     | 
| 
       151 
     | 
    
         
            -
              useEffect(function () {
         
     | 
| 
       152 
     | 
    
         
            -
                var rect = viewPortStore.viewPortRect;
         
     | 
| 
       153 
     | 
    
         
            -
                /* rect.width/rect.scale就是实际上显示区域内容区的宽度 */
         
     | 
| 
       154 
     | 
    
         
            -
                window.left = rect.left + Math.max(0, rect.width / rect.scale - window.width) / 2;
         
     | 
| 
       155 
     | 
    
         
            -
                window.top = rect.top + Math.max(0, rect.height / rect.scale - window.height) / 2;
         
     | 
| 
       156 
     | 
    
         
            -
                window.zIndex = ++viewPortStore.maxZIndex;
         
     | 
| 
      
 169 
     | 
    
         
            +
                window.centerDisplay();
         
     | 
| 
       157 
170 
     | 
    
         
             
              }, []);
         
     | 
| 
       158 
171 
     | 
    
         
             
              return /*#__PURE__*/React.createElement(Window, _extends({
         
     | 
| 
       159 
172 
     | 
    
         
             
                window: window
         
     | 
| 
       160 
     | 
    
         
            -
              }, rest 
     | 
| 
       161 
     | 
    
         
            -
                onFocusHandler: function onFocusHandler() {
         
     | 
| 
       162 
     | 
    
         
            -
                  viewPortStore.maxZIndex++;
         
     | 
| 
       163 
     | 
    
         
            -
                  window.zIndex = viewPortStore.maxZIndex;
         
     | 
| 
       164 
     | 
    
         
            -
                }
         
     | 
| 
       165 
     | 
    
         
            -
              }));
         
     | 
| 
      
 173 
     | 
    
         
            +
              }, rest));
         
     | 
| 
       166 
174 
     | 
    
         
             
            });
         
     | 
    
        package/dist/ViewPort/test.js
    CHANGED
    
    | 
         @@ -6,23 +6,24 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i 
     | 
|
| 
       6 
6 
     | 
    
         
             
            function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
         
     | 
| 
       7 
7 
     | 
    
         
             
            function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
         
     | 
| 
       8 
8 
     | 
    
         
             
            import { makeAutoObservable, runInAction } from 'mobx';
         
     | 
| 
       9 
     | 
    
         
            -
            import { observer 
     | 
| 
      
 9 
     | 
    
         
            +
            import { observer } from 'mobx-react-lite';
         
     | 
| 
       10 
10 
     | 
    
         
             
            import React, { useEffect } from 'react';
         
     | 
| 
       11 
11 
     | 
    
         
             
            import styled from 'styled-components';
         
     | 
| 
       12 
12 
     | 
    
         
             
            import { Button, GlobalStyles } from '..';
         
     | 
| 
       13 
13 
     | 
    
         
             
            import ViewPort from "./ViewPort";
         
     | 
| 
       14 
14 
     | 
    
         
             
            import { ViewPortStore } from "./ViewPortStore";
         
     | 
| 
       15 
15 
     | 
    
         
             
            import { ViewPortWindowStore } from "./ViewPortWindow";
         
     | 
| 
      
 16 
     | 
    
         
            +
            var viewPortStore = new ViewPortStore(600, 600, 5);
         
     | 
| 
       16 
17 
     | 
    
         
             
            var WindowManager = /*#__PURE__*/function () {
         
     | 
| 
       17 
18 
     | 
    
         
             
              function WindowManager() {
         
     | 
| 
       18 
19 
     | 
    
         
             
                _classCallCheck(this, WindowManager);
         
     | 
| 
       19 
     | 
    
         
            -
                _defineProperty(this, "windows", [new ViewPortWindowStore('jss', this.closeWindowHanlder.bind(this)), new ViewPortWindowStore('jss12', this.closeWindowHanlder.bind(this))]);
         
     | 
| 
      
 20 
     | 
    
         
            +
                _defineProperty(this, "windows", [new ViewPortWindowStore('jss', viewPortStore, this.closeWindowHanlder.bind(this)), new ViewPortWindowStore('jss12', viewPortStore, this.closeWindowHanlder.bind(this))]);
         
     | 
| 
       20 
21 
     | 
    
         
             
                makeAutoObservable(this);
         
     | 
| 
       21 
22 
     | 
    
         
             
              }
         
     | 
| 
       22 
23 
     | 
    
         
             
              _createClass(WindowManager, [{
         
     | 
| 
       23 
24 
     | 
    
         
             
                key: "createWindow",
         
     | 
| 
       24 
25 
     | 
    
         
             
                value: function createWindow() {
         
     | 
| 
       25 
     | 
    
         
            -
                  this.windows.push(new ViewPortWindowStore('jss' + Math.random(), this.closeWindowHanlder.bind(this)));
         
     | 
| 
      
 26 
     | 
    
         
            +
                  this.windows.push(new ViewPortWindowStore('jss' + Math.random(), viewPortStore, this.closeWindowHanlder.bind(this)));
         
     | 
| 
       26 
27 
     | 
    
         
             
                }
         
     | 
| 
       27 
28 
     | 
    
         
             
              }, {
         
     | 
| 
       28 
29 
     | 
    
         
             
                key: "closeWindowHanlder",
         
     | 
| 
         @@ -47,14 +48,11 @@ var StyledViewPort = styled(ViewPort).withConfig({ 
     | 
|
| 
       47 
48 
     | 
    
         
             
              componentId: "basic-component-347b__sc-1b1xrkc-0"
         
     | 
| 
       48 
49 
     | 
    
         
             
            })(["border:1px solid #eee;"]);
         
     | 
| 
       49 
50 
     | 
    
         
             
            export default observer(function Test() {
         
     | 
| 
       50 
     | 
    
         
            -
              var viewPortStore = useLocalObservable(function () {
         
     | 
| 
       51 
     | 
    
         
            -
                return new ViewPortStore(600, 600, 2);
         
     | 
| 
       52 
     | 
    
         
            -
              });
         
     | 
| 
       53 
51 
     | 
    
         
             
              useEffect(function () {
         
     | 
| 
       54 
52 
     | 
    
         
             
                function setWidthHeight() {
         
     | 
| 
       55 
53 
     | 
    
         
             
                  runInAction(function () {
         
     | 
| 
       56 
     | 
    
         
            -
                    viewPortStore.width =  
     | 
| 
       57 
     | 
    
         
            -
                    viewPortStore.height =  
     | 
| 
      
 54 
     | 
    
         
            +
                    viewPortStore.width = 800;
         
     | 
| 
      
 55 
     | 
    
         
            +
                    viewPortStore.height = 800;
         
     | 
| 
       58 
56 
     | 
    
         
             
                  });
         
     | 
| 
       59 
57 
     | 
    
         
             
                }
         
     | 
| 
       60 
58 
     | 
    
         
             
                window.addEventListener('resize', setWidthHeight);
         
     | 
| 
         @@ -75,8 +73,7 @@ export default observer(function Test() { 
     | 
|
| 
       75 
73 
     | 
    
         
             
                return /*#__PURE__*/React.createElement(ViewPort.Window, {
         
     | 
| 
       76 
74 
     | 
    
         
             
                  window: windowStore,
         
     | 
| 
       77 
75 
     | 
    
         
             
                  key: windowStore.id,
         
     | 
| 
       78 
     | 
    
         
            -
                  title: 'xixi' 
     | 
| 
       79 
     | 
    
         
            -
                  viewPortStore: viewPortStore
         
     | 
| 
      
 76 
     | 
    
         
            +
                  title: 'xixi'
         
     | 
| 
       80 
77 
     | 
    
         
             
                }, /*#__PURE__*/React.createElement("br", null));
         
     | 
| 
       81 
78 
     | 
    
         
             
              })));
         
     | 
| 
       82 
79 
     | 
    
         
             
            });
         
     | 
    
        package/dist/Window/Window.js
    CHANGED
    
    
| 
         @@ -40,6 +40,7 @@ export default class WindowStore { 
     | 
|
| 
       40 
40 
     | 
    
         
             
                minimizeWindow(): void;
         
     | 
| 
       41 
41 
     | 
    
         
             
                normalizeWindow(): void;
         
     | 
| 
       42 
42 
     | 
    
         
             
                closeWindow(): void;
         
     | 
| 
      
 43 
     | 
    
         
            +
                focus(): void;
         
     | 
| 
       43 
44 
     | 
    
         
             
                get style(): {
         
     | 
| 
       44 
45 
     | 
    
         
             
                    left: string;
         
     | 
| 
       45 
46 
     | 
    
         
             
                    top: string;
         
     | 
| 
         @@ -47,15 +48,17 @@ export default class WindowStore { 
     | 
|
| 
       47 
48 
     | 
    
         
             
                    height: string;
         
     | 
| 
       48 
49 
     | 
    
         
             
                    zIndex: number;
         
     | 
| 
       49 
50 
     | 
    
         
             
                    transform: string;
         
     | 
| 
      
 51 
     | 
    
         
            +
                    transformOrigin: string;
         
     | 
| 
       50 
52 
     | 
    
         
             
                    transition: string;
         
     | 
| 
       51 
53 
     | 
    
         
             
                } | {
         
     | 
| 
       52 
54 
     | 
    
         
             
                    left: string;
         
     | 
| 
       53 
55 
     | 
    
         
             
                    top: string;
         
     | 
| 
       54 
     | 
    
         
            -
                    width:  
     | 
| 
       55 
     | 
    
         
            -
                    height:  
     | 
| 
      
 56 
     | 
    
         
            +
                    width: string;
         
     | 
| 
      
 57 
     | 
    
         
            +
                    height: string;
         
     | 
| 
       56 
58 
     | 
    
         
             
                    zIndex: number;
         
     | 
| 
       57 
59 
     | 
    
         
             
                    transform: string;
         
     | 
| 
       58 
60 
     | 
    
         
             
                    transition: string;
         
     | 
| 
      
 61 
     | 
    
         
            +
                    transformOrigin?: undefined;
         
     | 
| 
       59 
62 
     | 
    
         
             
                };
         
     | 
| 
       60 
63 
     | 
    
         
             
                get info(): string;
         
     | 
| 
       61 
64 
     | 
    
         
             
            }
         
     | 
| 
         @@ -55,6 +55,7 @@ var WindowStore = /*#__PURE__*/function () { 
     | 
|
| 
       55 
55 
     | 
    
         
             
                  normalizeWindow: action,
         
     | 
| 
       56 
56 
     | 
    
         
             
                  closeWindow: action,
         
     | 
| 
       57 
57 
     | 
    
         
             
                  resetState: action,
         
     | 
| 
      
 58 
     | 
    
         
            +
                  focus: action,
         
     | 
| 
       58 
59 
     | 
    
         
             
                  info: computed
         
     | 
| 
       59 
60 
     | 
    
         
             
                });
         
     | 
| 
       60 
61 
     | 
    
         
             
                this.id = id;
         
     | 
| 
         @@ -145,6 +146,11 @@ var WindowStore = /*#__PURE__*/function () { 
     | 
|
| 
       145 
146 
     | 
    
         
             
                  this.isClosed = true;
         
     | 
| 
       146 
147 
     | 
    
         
             
                  this.resetState();
         
     | 
| 
       147 
148 
     | 
    
         
             
                }
         
     | 
| 
      
 149 
     | 
    
         
            +
              }, {
         
     | 
| 
      
 150 
     | 
    
         
            +
                key: "focus",
         
     | 
| 
      
 151 
     | 
    
         
            +
                value: function focus() {
         
     | 
| 
      
 152 
     | 
    
         
            +
                  this.zIndex++;
         
     | 
| 
      
 153 
     | 
    
         
            +
                }
         
     | 
| 
       148 
154 
     | 
    
         
             
              }, {
         
     | 
| 
       149 
155 
     | 
    
         
             
                key: "style",
         
     | 
| 
       150 
156 
     | 
    
         
             
                get: function get() {
         
     | 
| 
         @@ -156,18 +162,20 @@ var WindowStore = /*#__PURE__*/function () { 
     | 
|
| 
       156 
162 
     | 
    
         
             
                      height: this.height + 'px',
         
     | 
| 
       157 
163 
     | 
    
         
             
                      zIndex: this.zIndex,
         
     | 
| 
       158 
164 
     | 
    
         
             
                      transform: 'scale(0)',
         
     | 
| 
       159 
     | 
    
         
            -
                       
     | 
| 
      
 165 
     | 
    
         
            +
                      transformOrigin: 'center center',
         
     | 
| 
      
 166 
     | 
    
         
            +
                      transition: 'all 1s ease-in-out'
         
     | 
| 
       160 
167 
     | 
    
         
             
                    };
         
     | 
| 
       161 
168 
     | 
    
         
             
                  }
         
     | 
| 
       162 
169 
     | 
    
         
             
                  if (this.isMinimize && this.minimizePos) {
         
     | 
| 
       163 
170 
     | 
    
         
             
                    return {
         
     | 
| 
       164 
171 
     | 
    
         
             
                      left: this.minimizePos.left + 'px',
         
     | 
| 
       165 
172 
     | 
    
         
             
                      top: this.minimizePos.top + 'px',
         
     | 
| 
       166 
     | 
    
         
            -
                      width:  
     | 
| 
       167 
     | 
    
         
            -
                      height:  
     | 
| 
      
 173 
     | 
    
         
            +
                      width: this.width + 'px',
         
     | 
| 
      
 174 
     | 
    
         
            +
                      height: this.width + 'px',
         
     | 
| 
       168 
175 
     | 
    
         
             
                      zIndex: this.zIndex,
         
     | 
| 
       169 
176 
     | 
    
         
             
                      transform: 'scale(0)',
         
     | 
| 
       170 
     | 
    
         
            -
                       
     | 
| 
      
 177 
     | 
    
         
            +
                      transformOrigin: 'left top',
         
     | 
| 
      
 178 
     | 
    
         
            +
                      transition: 'all 1s ease-in-out'
         
     | 
| 
       171 
179 
     | 
    
         
             
                    };
         
     | 
| 
       172 
180 
     | 
    
         
             
                  }
         
     | 
| 
       173 
181 
     | 
    
         
             
                  if (this.fullscreen) {
         
     | 
| 
         @@ -178,7 +186,7 @@ var WindowStore = /*#__PURE__*/function () { 
     | 
|
| 
       178 
186 
     | 
    
         
             
                      height: this.fullscreenPos.height + 'px',
         
     | 
| 
       179 
187 
     | 
    
         
             
                      zIndex: this.zIndex,
         
     | 
| 
       180 
188 
     | 
    
         
             
                      transform: 'none',
         
     | 
| 
       181 
     | 
    
         
            -
                      transition: 'all  
     | 
| 
      
 189 
     | 
    
         
            +
                      transition: 'all 1s ease-in-out'
         
     | 
| 
       182 
190 
     | 
    
         
             
                    };
         
     | 
| 
       183 
191 
     | 
    
         
             
                  }
         
     | 
| 
       184 
192 
     | 
    
         
             
                  if (this.isMoving || this.isResizing) {
         
     | 
| 
         @@ -199,7 +207,7 @@ var WindowStore = /*#__PURE__*/function () { 
     | 
|
| 
       199 
207 
     | 
    
         
             
                    height: this.height + 'px',
         
     | 
| 
       200 
208 
     | 
    
         
             
                    zIndex: this.zIndex,
         
     | 
| 
       201 
209 
     | 
    
         
             
                    transform: 'none',
         
     | 
| 
       202 
     | 
    
         
            -
                    transition: 'all  
     | 
| 
      
 210 
     | 
    
         
            +
                    transition: 'all 1s ease-in-out'
         
     | 
| 
       203 
211 
     | 
    
         
             
                  };
         
     | 
| 
       204 
212 
     | 
    
         
             
                }
         
     | 
| 
       205 
213 
     | 
    
         
             
              }, {
         
     | 
    
        package/package.json
    CHANGED
    
    | 
         @@ -1,6 +1,6 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            {
         
     | 
| 
       2 
2 
     | 
    
         
             
                "name": "@kep-platform/basic-component",
         
     | 
| 
       3 
     | 
    
         
            -
                "version": "0.0. 
     | 
| 
      
 3 
     | 
    
         
            +
                "version": "0.0.44",
         
     | 
| 
       4 
4 
     | 
    
         
             
                "description": "A react library developed with dumi",
         
     | 
| 
       5 
5 
     | 
    
         
             
                "license": "MIT",
         
     | 
| 
       6 
6 
     | 
    
         
             
                "module": "dist/index.js",
         
     | 
| 
         @@ -47,7 +47,7 @@ 
     | 
|
| 
       47 
47 
     | 
    
         
             
                },
         
     | 
| 
       48 
48 
     | 
    
         
             
                "dependencies": {
         
     | 
| 
       49 
49 
     | 
    
         
             
                    "@ant-design/icons": "^5.3.7",
         
     | 
| 
       50 
     | 
    
         
            -
                    "@kep-platform/hooks": "^0.0. 
     | 
| 
      
 50 
     | 
    
         
            +
                    "@kep-platform/hooks": "^0.0.44",
         
     | 
| 
       51 
51 
     | 
    
         
             
                    "color": "^4.2.3",
         
     | 
| 
       52 
52 
     | 
    
         
             
                    "rc-pagination": "^4.1.0",
         
     | 
| 
       53 
53 
     | 
    
         
             
                    "styled-components": "^6.1.11"
         
     | 
| 
         @@ -87,5 +87,5 @@ 
     | 
|
| 
       87 
87 
     | 
    
         
             
                "authors": [
         
     | 
| 
       88 
88 
     | 
    
         
             
                    "lee-step-jss 1599925910@qq.com"
         
     | 
| 
       89 
89 
     | 
    
         
             
                ],
         
     | 
| 
       90 
     | 
    
         
            -
                "gitHead": " 
     | 
| 
      
 90 
     | 
    
         
            +
                "gitHead": "d7ee92047ae7296763e391b3f01553d4105500bb"
         
     | 
| 
       91 
91 
     | 
    
         
             
            }
         
     |