@kep-platform/basic-component 1.0.19 → 1.0.20

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.
@@ -6,6 +6,7 @@ import { WindowControllerType } from '../Window/WindowController';
6
6
  import { ViewPortStore } from './ViewPortStore';
7
7
  export declare class ViewPortWindowStore extends WindowStore {
8
8
  viewPortStore: ViewPortStore;
9
+ disableDefaultCenterDisplay: boolean;
9
10
  get style(): {
10
11
  left: string;
11
12
  top: string;
@@ -36,7 +37,10 @@ export declare class ViewPortWindowStore extends WindowStore {
36
37
  fullscreenWindow(func?: () => void): void;
37
38
  toggleWindow(): void;
38
39
  onSplitWindowHandler(arr: string[], index: number): void;
39
- constructor(id: string, viewPort: ViewPortStore, onClosedHandler?: (id: string) => void);
40
+ constructor(id: string, viewPort: ViewPortStore, config?: {
41
+ disableDefaultCenterDisplay?: boolean;
42
+ onClosedHandler?: (id: string) => void;
43
+ });
40
44
  get disabled(): boolean;
41
45
  }
42
46
  export type ViewPortWindowProps = WindowProps & {
@@ -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 { action, makeObservable, override } from 'mobx';
19
+ import { action, makeObservable, observable, 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,19 +24,22 @@ 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, viewPort, onClosedHandler) {
27
+ function ViewPortWindowStore(id, viewPort, config) {
28
28
  var _this;
29
29
  _classCallCheck(this, ViewPortWindowStore);
30
- _this = _super.call(this, id, onClosedHandler);
30
+ _this = _super.call(this, id, config === null || config === void 0 ? void 0 : config.onClosedHandler);
31
31
  _defineProperty(_assertThisInitialized(_this), "viewPortStore", void 0);
32
+ _defineProperty(_assertThisInitialized(_this), "disableDefaultCenterDisplay", false);
32
33
  _this.viewPortStore = viewPort;
33
34
  _this.fullscreenPos = viewPort.viewPortRect;
35
+ _this.disableDefaultCenterDisplay = (config === null || config === void 0 ? void 0 : config.disableDefaultCenterDisplay) || false;
34
36
  makeObservable(_assertThisInitialized(_this), {
35
37
  style: override,
36
38
  controll: override,
37
39
  focus: override,
38
40
  centerDisplay: action,
39
- disabled: override
41
+ disabled: override,
42
+ disableDefaultCenterDisplay: observable
40
43
  });
41
44
  return _this;
42
45
  }
@@ -219,7 +222,9 @@ export var ViewPortWindow = observer(function ViewPortWindow(props) {
219
222
  var window = props.window,
220
223
  rest = _objectWithoutProperties(props, _excluded);
221
224
  useEffect(function () {
222
- window.centerDisplay();
225
+ if (!window.disableDefaultCenterDisplay) {
226
+ window.centerDisplay();
227
+ }
223
228
  }, []);
224
229
  return /*#__PURE__*/React.createElement(Window, _extends({
225
230
  window: window
@@ -20,13 +20,22 @@ var viewPortStore = new ViewPortStore(600, 600, 1);
20
20
  var WindowManager = /*#__PURE__*/function () {
21
21
  function WindowManager() {
22
22
  _classCallCheck(this, WindowManager);
23
- _defineProperty(this, "windows", [new ViewPortWindowStore('jss', viewPortStore, this.closeWindowHanlder.bind(this)), new ViewPortWindowStore('jss12', viewPortStore, this.closeWindowHanlder.bind(this))]);
23
+ _defineProperty(this, "windows", [new ViewPortWindowStore('jss', viewPortStore, {
24
+ onClosedHandler: this.closeWindowHanlder.bind(this)
25
+ }), new ViewPortWindowStore('jss12', viewPortStore, {
26
+ onClosedHandler: this.closeWindowHanlder.bind(this)
27
+ })]);
24
28
  makeAutoObservable(this);
25
29
  }
26
30
  _createClass(WindowManager, [{
27
31
  key: "createWindow",
28
32
  value: function createWindow() {
29
- this.windows.push(new ViewPortWindowStore('jss' + Math.random(), viewPortStore, this.closeWindowHanlder.bind(this)));
33
+ var newWindow = new ViewPortWindowStore('jss' + Math.random(), viewPortStore, {
34
+ onClosedHandler: this.closeWindowHanlder.bind(this),
35
+ disableDefaultCenterDisplay: true
36
+ });
37
+ newWindow.onSplitWindowHandler(['66%', '34%'], 1);
38
+ this.windows.push(newWindow);
30
39
  }
31
40
  }, {
32
41
  key: "closeWindowHanlder",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kep-platform/basic-component",
3
- "version": "1.0.19",
3
+ "version": "1.0.20",
4
4
  "description": "A react library developed with dumi",
5
5
  "license": "MIT",
6
6
  "module": "dist/index.js",
@@ -87,5 +87,5 @@
87
87
  "authors": [
88
88
  "less-step-jss 1599925910@qq.com"
89
89
  ],
90
- "gitHead": "9e52ed5f84aa43275a2c1107e6a9de9c96ab3a2b"
90
+ "gitHead": "111251d1ba815452a258dd87095534e1a783cf7f"
91
91
  }