@kep-platform/basic-component 0.0.36 → 0.0.38

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,10 +1,13 @@
1
1
  import { Transform } from '@dnd-kit/utilities';
2
2
  import React, { HtmlHTMLAttributes, ReactNode } from 'react';
3
+ import { WindowStore } from '../Window';
4
+ import { WindowProps } from '../Window/Window';
5
+ import { WindowControllerType } from '../Window/WindowController';
3
6
  type ViewPortProps = {
4
7
  children?: ReactNode;
5
- ratio?: number;
6
- width?: number;
7
- height?: number;
8
+ viewPortStore: ViewPortStore;
9
+ onScale?: (left: number, top: number, scale: number, ratio: number) => void;
10
+ onScroll?: (left: number, top: number, scale: number, ratio: number) => void;
8
11
  } & HtmlHTMLAttributes<HTMLDivElement>;
9
12
  export declare class ViewPortStore {
10
13
  transform: {
@@ -19,8 +22,12 @@ export declare class ViewPortStore {
19
22
  width: number;
20
23
  height: number;
21
24
  ratio: number;
22
- constructor(ratio?: number);
25
+ isMoving: boolean;
26
+ maxZIndex: number;
27
+ constructor(width?: number, height?: number, ratio?: number);
23
28
  increaseScale(): void;
29
+ setScale(scale: number): void;
30
+ focus(left: number, top: number): void;
24
31
  decreaseScale(): void;
25
32
  move(transform: Transform): void;
26
33
  endMove(): void;
@@ -34,26 +41,68 @@ export declare class ViewPortStore {
34
41
  min: number;
35
42
  };
36
43
  };
37
- get formatedTransform(): {
44
+ formatedTransform(left: number, top: number): {
38
45
  left: number;
39
46
  top: number;
40
47
  };
41
- get minScale(): number;
42
- get maxScale(): number;
43
48
  get formatedScale(): number;
44
49
  get contentStyle(): {
45
- left: string;
46
- top: string;
47
50
  transform: string;
48
51
  width: string;
49
52
  height: string;
50
53
  transformOrigin: string;
54
+ backgroundColor: string;
55
+ transition: string;
51
56
  };
52
57
  get containerStyle(): {
53
58
  width: string;
54
59
  height: string;
55
60
  overflow: string;
56
61
  };
62
+ get info(): string;
63
+ }
64
+ declare function ViewPort(props: ViewPortProps): React.JSX.Element;
65
+ declare namespace ViewPort {
66
+ var Window: React.FunctionComponent<WindowProps & {
67
+ viewPortStore: ViewPortStore;
68
+ window: ViewPortWindowStore;
69
+ }>;
70
+ }
71
+ export default ViewPort;
72
+ export declare class ViewPortWindowStore extends WindowStore {
73
+ scale: number;
74
+ get style(): {
75
+ left: string;
76
+ top: string;
77
+ width: string;
78
+ height: string;
79
+ zIndex: number;
80
+ transform: string;
81
+ transition: string;
82
+ transformOrigin?: undefined;
83
+ } | {
84
+ left: string;
85
+ top: string;
86
+ width: number;
87
+ height: number;
88
+ zIndex: number;
89
+ transform: string;
90
+ transition: string;
91
+ transformOrigin?: undefined;
92
+ } | {
93
+ left: string;
94
+ top: string;
95
+ width: string;
96
+ height: string;
97
+ zIndex: number;
98
+ transform: string;
99
+ transformOrigin: string;
100
+ transition: string;
101
+ };
102
+ calculateTransform(transform: Transform): {
103
+ x: number;
104
+ y: number;
105
+ };
106
+ controll(transform: Transform, type: WindowControllerType): void;
107
+ constructor(id: string, onClosedHandler?: (id: string) => void);
57
108
  }
58
- export default function ViewPort(props: ViewPortProps): React.JSX.Element;
59
- export {};
@@ -1,10 +1,15 @@
1
+ var _excluded = ["children", "viewPortStore"],
2
+ _excluded2 = ["viewPortStore", "window"];
1
3
  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); }
2
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
3
- function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
4
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
5
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
6
- function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
7
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
4
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
5
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
6
+ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
7
+ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
8
+ function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
9
+ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
10
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
11
+ 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; }
12
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
8
13
  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); }
9
14
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
10
15
  function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
@@ -13,22 +18,23 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
13
18
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
14
19
  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); }
15
20
  import { DndContext, useDraggable } from '@dnd-kit/core';
16
- import { makeAutoObservable, runInAction } from 'mobx';
21
+ import { makeAutoObservable, makeObservable, observable, override, runInAction } from 'mobx';
17
22
  import { observer } from 'mobx-react-lite';
18
- import React, { useEffect, useRef, useState } from 'react';
23
+ import React, { useEffect, useRef } from 'react';
19
24
  import styled from 'styled-components';
25
+ import { WindowStore } from "../Window";
26
+ import { default as Window } from "../Window/Window";
20
27
  import { GlobalStyles } from "../__styles";
21
28
  var Container = styled.div.withConfig({
22
29
  displayName: "Container",
23
30
  componentId: "basic-component-347b__sc-1qpmpop-0"
24
- })(["position:relative;border:1px solid #eee;"]);
31
+ })(["position:relative;border:1px solid #eee;box-shadow:0 0 7px 0 inset #fefefe;"]);
25
32
  var Content = styled.div.withConfig({
26
33
  displayName: "Content",
27
34
  componentId: "basic-component-347b__sc-1qpmpop-1"
28
35
  })(["position:absolute;"]);
29
36
  export var ViewPortStore = /*#__PURE__*/function () {
30
- //缩放比例
31
- function ViewPortStore(ratio) {
37
+ function ViewPortStore(width, height, ratio) {
32
38
  _classCallCheck(this, ViewPortStore);
33
39
  _defineProperty(this, "transform", {
34
40
  left: 0,
@@ -39,10 +45,15 @@ export var ViewPortStore = /*#__PURE__*/function () {
39
45
  y: 0
40
46
  });
41
47
  _defineProperty(this, "scale", 1);
42
- _defineProperty(this, "width", 800);
43
- _defineProperty(this, "height", 800);
48
+ _defineProperty(this, "width", 600);
49
+ _defineProperty(this, "height", 600);
44
50
  _defineProperty(this, "ratio", 5);
51
+ //缩放比例
52
+ _defineProperty(this, "isMoving", false);
53
+ _defineProperty(this, "maxZIndex", 1);
45
54
  if (ratio) this.ratio = ratio;
55
+ if (width) this.width = width;
56
+ if (height) this.height = height;
46
57
  makeAutoObservable(this);
47
58
  }
48
59
  _createClass(ViewPortStore, [{
@@ -50,16 +61,30 @@ export var ViewPortStore = /*#__PURE__*/function () {
50
61
  value: function increaseScale() {
51
62
  if (this.scale < 1) this.scale += 0.03125;else this.scale = 1;
52
63
  }
64
+ }, {
65
+ key: "setScale",
66
+ value: function setScale(scale) {
67
+ this.scale = scale;
68
+ }
69
+ }, {
70
+ key: "focus",
71
+ value: function focus(left, top) {
72
+ this.scale = 0.8;
73
+ this.transform = {
74
+ left: (1 - this.ratio) * left,
75
+ top: (1 - this.ratio) * top
76
+ };
77
+ }
53
78
  }, {
54
79
  key: "decreaseScale",
55
80
  value: function decreaseScale() {
56
- if (this.scale > this.minScale) this.scale -= 0.03125;
81
+ if (this.scale > parseFloat((1 / this.ratio).toFixed(1))) this.scale -= 0.03125;
57
82
  }
58
83
  }, {
59
84
  key: "move",
60
85
  value: function move(transform) {
61
- this.transform.left = transform.x - this.offset.x + this.transform.left;
62
- this.transform.top = transform.y - this.offset.y + this.transform.top;
86
+ this.isMoving = true;
87
+ this.transform = this.formatedTransform(transform.x - this.offset.x + this.transform.left, transform.y - this.offset.y + this.transform.top);
63
88
  this.offset.x = transform.x;
64
89
  this.offset.y = transform.y;
65
90
  }
@@ -68,6 +93,7 @@ export var ViewPortStore = /*#__PURE__*/function () {
68
93
  value: function endMove() {
69
94
  this.offset.x = 0;
70
95
  this.offset.y = 0;
96
+ this.isMoving = false;
71
97
  }
72
98
  }, {
73
99
  key: "transformLimit",
@@ -85,37 +111,28 @@ export var ViewPortStore = /*#__PURE__*/function () {
85
111
  }
86
112
  }, {
87
113
  key: "formatedTransform",
88
- get: function get() {
114
+ value: function formatedTransform(left, top) {
89
115
  return {
90
- left: Math.max(this.transformLimit.left.min, Math.min(this.transform.left, this.transformLimit.left.max)),
91
- top: Math.max(this.transformLimit.top.min, Math.min(this.transform.top, this.transformLimit.top.max))
116
+ left: Math.max(this.transformLimit.left.min, Math.min(left, this.transformLimit.left.max)),
117
+ top: Math.max(this.transformLimit.top.min, Math.min(top, this.transformLimit.top.max))
92
118
  };
93
119
  }
94
- }, {
95
- key: "minScale",
96
- get: function get() {
97
- return parseFloat((1 / this.ratio).toFixed(1));
98
- }
99
- }, {
100
- key: "maxScale",
101
- get: function get() {
102
- return 1;
103
- }
104
120
  }, {
105
121
  key: "formatedScale",
106
122
  get: function get() {
107
- return Math.min(this.maxScale, Math.max(this.minScale, this.scale));
123
+ return Math.min(1, Math.max(1 / this.ratio, this.scale));
108
124
  }
109
125
  }, {
110
126
  key: "contentStyle",
111
127
  get: function get() {
128
+ var transform = this.formatedTransform(this.transform.left, this.transform.top);
112
129
  return {
113
- left: this.formatedTransform.left + 'px',
114
- top: this.formatedTransform.top + 'px',
115
- transform: "scale(".concat(this.formatedScale, ")"),
130
+ transform: "translate(".concat(transform.left, "px,").concat(transform.top, "px) scale(").concat(this.formatedScale, ")"),
116
131
  width: this.width * this.ratio + 'px',
117
132
  height: this.height * this.ratio + 'px',
118
- transformOrigin: 'left top'
133
+ transformOrigin: "0 0",
134
+ backgroundColor: 'pink',
135
+ transition: this.isMoving ? 'none' : 'all 0.5s'
119
136
  };
120
137
  }
121
138
  }, {
@@ -127,12 +144,19 @@ export var ViewPortStore = /*#__PURE__*/function () {
127
144
  overflow: 'hidden'
128
145
  };
129
146
  }
147
+ }, {
148
+ key: "info",
149
+ get: function get() {
150
+ return JSON.stringify(this.formatedTransform(this.transform.left, this.transform.top), null, 4);
151
+ }
130
152
  }]);
131
153
  return ViewPortStore;
132
154
  }();
133
155
  var ViewPortEntity = observer(function (props) {
134
156
  var children = props.children,
135
- viewPortStore = props.viewPortStore;
157
+ viewPortStore = props.viewPortStore,
158
+ onScroll = props.onScroll,
159
+ onScale = props.onScale;
136
160
  var _useDraggable = useDraggable({
137
161
  id: 'ViewPortEntity'
138
162
  }),
@@ -145,6 +169,7 @@ var ViewPortEntity = observer(function (props) {
145
169
  useEffect(function () {
146
170
  if (transform) {
147
171
  viewPortStore.move(transform);
172
+ onScroll === null || onScroll === void 0 || onScroll(viewPortStore.transform.left, viewPortStore.transform.top, viewPortStore.scale, viewPortStore.ratio);
148
173
  } else {
149
174
  viewPortStore.endMove();
150
175
  }
@@ -159,6 +184,7 @@ var ViewPortEntity = observer(function (props) {
159
184
  } else {
160
185
  viewPortStore.decreaseScale();
161
186
  }
187
+ onScale === null || onScale === void 0 || onScale(viewPortStore.transform.left, viewPortStore.transform.top, viewPortStore.scale, viewPortStore.ratio);
162
188
  }
163
189
  (_ref$current = _ref.current) === null || _ref$current === void 0 || _ref$current.addEventListener('wheel', scaleHandler, {
164
190
  passive: false
@@ -169,7 +195,18 @@ var ViewPortEntity = observer(function (props) {
169
195
  };
170
196
  }, []);
171
197
  return /*#__PURE__*/React.createElement(Container, {
172
- style: viewPortStore.containerStyle
198
+ style: viewPortStore.containerStyle,
199
+ onDoubleClick: function onDoubleClick(e) {
200
+ var container = e.target;
201
+ var _container$getBoundin = container.getBoundingClientRect(),
202
+ left = _container$getBoundin.left,
203
+ top = _container$getBoundin.top;
204
+ var offsetLeft = e.clientX - left;
205
+ var offsetTop = e.clientY - top;
206
+ if (viewPortStore.formatedScale > 0.5) {
207
+ viewPortStore.setScale(1 / viewPortStore.ratio);
208
+ } else viewPortStore.focus(offsetLeft, offsetTop);
209
+ }
173
210
  }, /*#__PURE__*/React.createElement(Content, _extends({
174
211
  ref: function ref(dom) {
175
212
  _ref.current = dom;
@@ -178,28 +215,154 @@ var ViewPortEntity = observer(function (props) {
178
215
  }
179
216
  }, attributes, listeners, {
180
217
  style: viewPortStore.contentStyle
181
- }), viewPortStore.ratio, children));
218
+ }), children));
182
219
  });
183
220
  export default function ViewPort(props) {
184
221
  var children = props.children,
185
- ratio = props.ratio,
186
- width = props.width,
187
- height = props.height;
188
- var _useState = useState(function () {
189
- return new ViewPortStore(ratio);
190
- }),
191
- _useState2 = _slicedToArray(_useState, 1),
192
- viewPortStore = _useState2[0];
193
- useEffect(function () {
194
- runInAction(function () {
195
- if (ratio) viewPortStore.ratio = ratio;
196
- if (width) viewPortStore.width = width;
197
- if (height) viewPortStore.height = height;
198
- });
199
- }, [ratio, width, height]);
222
+ viewPortStore = props.viewPortStore,
223
+ rest = _objectWithoutProperties(props, _excluded);
200
224
  return /*#__PURE__*/React.createElement(DndContext, null, /*#__PURE__*/React.createElement(GlobalStyles, {
201
225
  $css: []
202
- }), /*#__PURE__*/React.createElement(ViewPortEntity, {
226
+ }), /*#__PURE__*/React.createElement(ViewPortEntity, _extends({
203
227
  viewPortStore: viewPortStore
204
- }, children));
205
- }
228
+ }, rest), children));
229
+ }
230
+ export var ViewPortWindowStore = /*#__PURE__*/function (_WindowStore) {
231
+ _inherits(ViewPortWindowStore, _WindowStore);
232
+ var _super = _createSuper(ViewPortWindowStore);
233
+ function ViewPortWindowStore(id, onClosedHandler) {
234
+ var _this;
235
+ _classCallCheck(this, ViewPortWindowStore);
236
+ _this = _super.call(this, id, onClosedHandler);
237
+ _defineProperty(_assertThisInitialized(_this), "scale", 1);
238
+ makeObservable(_assertThisInitialized(_this), {
239
+ style: override,
240
+ scale: observable,
241
+ controll: override
242
+ });
243
+ return _this;
244
+ }
245
+ _createClass(ViewPortWindowStore, [{
246
+ key: "style",
247
+ get: function get() {
248
+ if (this.isClosed) {
249
+ return {
250
+ left: this.left + 'px',
251
+ top: this.top + 'px',
252
+ width: this.width + 'px',
253
+ height: this.height + 'px',
254
+ zIndex: this.zIndex,
255
+ transform: 'scale(0)',
256
+ transition: 'all 0.5s ease-out'
257
+ };
258
+ }
259
+ if (this.isMinimize && this.minimizePos) {
260
+ return {
261
+ left: this.minimizePos.left + 'px',
262
+ top: this.minimizePos.top + 'px',
263
+ width: 0,
264
+ height: 0,
265
+ zIndex: this.zIndex,
266
+ transform: 'scale(0)',
267
+ transition: 'all 0.5s ease-out'
268
+ };
269
+ }
270
+ if (this.fullscreen) {
271
+ return {
272
+ left: this.fullscreenPos.left / this.scale + 'px',
273
+ top: this.fullscreenPos.top / this.scale + 'px',
274
+ width: this.fullscreenPos.width + 'px',
275
+ height: this.fullscreenPos.height + 'px',
276
+ zIndex: this.zIndex,
277
+ transform: "scale(".concat(1 / this.scale, ") "),
278
+ transformOrigin: 'left top',
279
+ transition: 'width height 0.5s ease-out'
280
+ };
281
+ }
282
+ if (this.isMoving || this.isResizing) {
283
+ return {
284
+ left: this.left + 'px',
285
+ top: this.top + 'px',
286
+ width: this.width + 'px',
287
+ height: this.height + 'px',
288
+ zIndex: this.zIndex,
289
+ transform: 'none',
290
+ transition: 'none'
291
+ };
292
+ }
293
+ return {
294
+ left: this.left + 'px',
295
+ top: this.top + 'px',
296
+ width: this.width + 'px',
297
+ height: this.height + 'px',
298
+ zIndex: this.zIndex,
299
+ transform: 'none',
300
+ transition: 'all 0.5s ease-out'
301
+ };
302
+ }
303
+ }, {
304
+ key: "calculateTransform",
305
+ value: function calculateTransform(transform) {
306
+ var _this$transform, _this$transform2;
307
+ return {
308
+ x: (transform.x - (((_this$transform = this.transform) === null || _this$transform === void 0 ? void 0 : _this$transform.x) || 0)) / this.scale,
309
+ y: (transform.y - (((_this$transform2 = this.transform) === null || _this$transform2 === void 0 ? void 0 : _this$transform2.y) || 0)) / this.scale
310
+ };
311
+ }
312
+ }, {
313
+ key: "controll",
314
+ value: function controll(transform, type) {
315
+ var offsetTransform = this.calculateTransform(transform);
316
+ if (type === 'move') {
317
+ this.isMoving = true;
318
+ this.isResizing = false;
319
+ } else {
320
+ this.isMoving = false;
321
+ this.isResizing = true;
322
+ }
323
+ if (type.includes('left')) {
324
+ this.left = Math.round(this.left + offsetTransform.x);
325
+ this.width = Math.round(this.width - offsetTransform.x);
326
+ }
327
+ if (type.includes('right')) {
328
+ this.width = Math.round(this.width + offsetTransform.x);
329
+ }
330
+ if (type.includes('top')) {
331
+ this.top = Math.round(this.top + offsetTransform.y);
332
+ this.height = Math.round(this.height - offsetTransform.y);
333
+ }
334
+ if (type.includes('bottom')) {
335
+ this.height = Math.round(this.height + offsetTransform.y);
336
+ }
337
+ if (type.includes('move')) {
338
+ this.left = Math.round(this.left + offsetTransform.x);
339
+ this.top = Math.round(this.top + offsetTransform.y);
340
+ }
341
+ this.transform = transform;
342
+ }
343
+ }]);
344
+ return ViewPortWindowStore;
345
+ }(WindowStore);
346
+ ViewPort.Window = observer(function ViewPortWindow(props) {
347
+ var viewPortStore = props.viewPortStore,
348
+ window = props.window,
349
+ rest = _objectWithoutProperties(props, _excluded2);
350
+ useEffect(function () {
351
+ runInAction(function () {
352
+ var transform = viewPortStore.formatedTransform(viewPortStore.transform.left, viewPortStore.transform.top);
353
+ window.fullscreenPos.left = -transform.left;
354
+ window.fullscreenPos.top = -transform.top;
355
+ window.fullscreenPos.width = viewPortStore.width;
356
+ window.fullscreenPos.height = viewPortStore.height;
357
+ window.scale = viewPortStore.formatedScale;
358
+ });
359
+ }, [viewPortStore.transform.left, viewPortStore.transform.top, viewPortStore.scale, viewPortStore.ratio, viewPortStore.width, viewPortStore.height]);
360
+ return /*#__PURE__*/React.createElement(Window, _extends({
361
+ window: window
362
+ }, rest, {
363
+ onFocusHandler: function onFocusHandler() {
364
+ viewPortStore.maxZIndex++;
365
+ window.zIndex = viewPortStore.maxZIndex;
366
+ }
367
+ }));
368
+ });
@@ -1,2 +1,3 @@
1
1
  import React from 'react';
2
- export default function Test(): React.JSX.Element;
2
+ declare const _default: React.FunctionComponent<object>;
3
+ export default _default;
@@ -1,24 +1,18 @@
1
1
  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); }
2
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
3
- function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
4
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
5
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
6
- function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
7
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
8
2
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
9
3
  function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
10
4
  function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
11
5
  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; }
12
6
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
13
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); }
14
- import { makeAutoObservable } from 'mobx';
15
- import React, { useEffect, useState } from 'react';
16
- import { Window, WindowStore } from "../Window";
17
- import ViewPort from "./ViewPort";
8
+ import { makeAutoObservable, runInAction } from 'mobx';
9
+ import { observer, useLocalObservable } from 'mobx-react-lite';
10
+ import React, { useEffect } from 'react';
11
+ import ViewPort, { ViewPortStore, ViewPortWindowStore } from "./ViewPort";
18
12
  var WindowManager = /*#__PURE__*/function () {
19
13
  function WindowManager() {
20
14
  _classCallCheck(this, WindowManager);
21
- _defineProperty(this, "windows", [new WindowStore('jss', this.closeWindowHanlder.bind(this)), new WindowStore('jx', this.closeWindowHanlder.bind(this)), new WindowStore('jiangxin', this.closeWindowHanlder.bind(this)), new WindowStore('xixi', this.closeWindowHanlder.bind(this))]);
15
+ _defineProperty(this, "windows", [new ViewPortWindowStore('jss', this.closeWindowHanlder.bind(this)), new ViewPortWindowStore('jss12', this.closeWindowHanlder.bind(this))]);
22
16
  makeAutoObservable(this);
23
17
  }
24
18
  _createClass(WindowManager, [{
@@ -39,19 +33,16 @@ var WindowManager = /*#__PURE__*/function () {
39
33
  return WindowManager;
40
34
  }();
41
35
  var windowManager = new WindowManager();
42
- export default function Test() {
43
- var _useState = useState(0),
44
- _useState2 = _slicedToArray(_useState, 2),
45
- width = _useState2[0],
46
- setWidth = _useState2[1];
47
- var _useState3 = useState(0),
48
- _useState4 = _slicedToArray(_useState3, 2),
49
- height = _useState4[0],
50
- setHeight = _useState4[1];
36
+ export default observer(function Test() {
37
+ var viewPortStore = useLocalObservable(function () {
38
+ return new ViewPortStore(600, 600, 5);
39
+ });
51
40
  useEffect(function () {
52
41
  function setWidthHeight() {
53
- setWidth(document.body.offsetWidth);
54
- setHeight(document.body.offsetHeight);
42
+ runInAction(function () {
43
+ viewPortStore.width = 800;
44
+ viewPortStore.height = 800;
45
+ });
55
46
  }
56
47
  window.addEventListener('resize', setWidthHeight);
57
48
  setWidthHeight();
@@ -60,14 +51,13 @@ export default function Test() {
60
51
  };
61
52
  }, []);
62
53
  return /*#__PURE__*/React.createElement(ViewPort, {
63
- ratio: 5,
64
- width: width,
65
- height: height
54
+ viewPortStore: viewPortStore
66
55
  }, windowManager.windows.map(function (windowStore) {
67
- return /*#__PURE__*/React.createElement(Window, {
56
+ return /*#__PURE__*/React.createElement(ViewPort.Window, {
68
57
  window: windowStore,
69
58
  key: windowStore.id,
70
- title: 'xixi'
71
- }, "123");
59
+ title: 'xixi',
60
+ viewPortStore: viewPortStore
61
+ }, /*#__PURE__*/React.createElement("br", null));
72
62
  }));
73
- }
63
+ });
@@ -4,10 +4,8 @@ export type WindowProps = {
4
4
  window: WindowStore;
5
5
  children: ReactNode;
6
6
  title: ReactNode;
7
- minimizePos?: {
8
- left: number;
9
- top: number;
10
- };
7
+ onFullscreenHandler?: () => void;
8
+ onFocusHandler?: () => void;
11
9
  };
12
10
  declare const Window: ((props: WindowProps) => React.JSX.Element) & {
13
11
  displayName: string;
@@ -1,6 +1,6 @@
1
1
  import { CloseCircleOutlined, FullscreenExitOutlined, FullscreenOutlined, MinusCircleOutlined } from '@ant-design/icons';
2
2
  import { observer } from 'mobx-react-lite';
3
- import React from 'react';
3
+ import React, { useEffect, useRef } from 'react';
4
4
  import styled, { css } from 'styled-components';
5
5
  import { Space } from "../Space";
6
6
  import WindowController from "./WindowController";
@@ -75,11 +75,21 @@ var Window = observer(function (props) {
75
75
  var window = props.window,
76
76
  title = props.title,
77
77
  children = props.children,
78
- _props$minimizePos = props.minimizePos,
79
- minimizePos = _props$minimizePos === void 0 ? {
80
- left: 0,
81
- top: 0
82
- } : _props$minimizePos;
78
+ onFullscreenHandler = props.onFullscreenHandler,
79
+ onFocusHandler = props.onFocusHandler;
80
+ var windowContainerRef = useRef(null);
81
+ useEffect(function () {
82
+ var _windowContainerRef$c;
83
+ function stopWheel(e) {
84
+ e.stopPropagation();
85
+ e.preventDefault();
86
+ }
87
+ (_windowContainerRef$c = windowContainerRef.current) === null || _windowContainerRef$c === void 0 || _windowContainerRef$c.addEventListener('wheel', stopWheel);
88
+ return function () {
89
+ var _windowContainerRef$c2;
90
+ (_windowContainerRef$c2 = windowContainerRef.current) === null || _windowContainerRef$c2 === void 0 || _windowContainerRef$c2.removeEventListener('wheel', stopWheel);
91
+ };
92
+ }, []);
83
93
  /* style 的原因是因为性能问题 */
84
94
  return /*#__PURE__*/React.createElement(WindowContainer, {
85
95
  style: window.style,
@@ -92,7 +102,9 @@ var Window = observer(function (props) {
92
102
  },
93
103
  onPointerDown: function onPointerDown(e) {
94
104
  e.stopPropagation();
95
- }
105
+ onFocusHandler === null || onFocusHandler === void 0 || onFocusHandler();
106
+ },
107
+ ref: windowContainerRef
96
108
  }, /*#__PURE__*/React.createElement(WindowControllerLeft, {
97
109
  window: window,
98
110
  type: "left"
@@ -121,7 +133,16 @@ var Window = observer(function (props) {
121
133
  window: window,
122
134
  type: "move"
123
135
  }, /*#__PURE__*/React.createElement(WindowHeader, {
124
- isDragging: window.isMoving
136
+ isDragging: window.isMoving,
137
+ onDoubleClick: function onDoubleClick(e) {
138
+ e.stopPropagation();
139
+ e.preventDefault();
140
+ if (window.fullscreen) {
141
+ window.fullscreenExitWindow();
142
+ } else {
143
+ window.fullscreenWindow(onFullscreenHandler);
144
+ }
145
+ }
125
146
  }, /*#__PURE__*/React.createElement("h5", null, title), /*#__PURE__*/React.createElement(WindowHeaderOptions, {
126
147
  onPointerDown: function onPointerDown(e) {
127
148
  e.stopPropagation();
@@ -130,7 +151,7 @@ var Window = observer(function (props) {
130
151
  color: "var(--kep-platform-orange-4)",
131
152
  icon: /*#__PURE__*/React.createElement(FullscreenOutlined, null),
132
153
  onClick: function onClick() {
133
- return window.fullscreenWindow();
154
+ window.fullscreenWindow(onFullscreenHandler);
134
155
  }
135
156
  }) : /*#__PURE__*/React.createElement(WindowOption, {
136
157
  color: "var(--kep-platform-orange-4)",
@@ -142,7 +163,7 @@ var Window = observer(function (props) {
142
163
  color: "var(--kep-platform-green-3)",
143
164
  icon: /*#__PURE__*/React.createElement(MinusCircleOutlined, null),
144
165
  onClick: function onClick() {
145
- window.minimizeWindow(minimizePos);
166
+ window.minimizeWindow();
146
167
  }
147
168
  }), /*#__PURE__*/React.createElement(WindowOption, {
148
169
  onClick: function onClick() {
@@ -1,10 +1,10 @@
1
1
  import { Transform } from '@dnd-kit/utilities';
2
2
  import { WindowControllerType } from './WindowController';
3
3
  export default class WindowStore {
4
- width: string;
5
- height: string;
6
- left: string;
7
- top: string;
4
+ width: number;
5
+ height: number;
6
+ left: number;
7
+ top: number;
8
8
  zIndex: number;
9
9
  fullscreen: boolean;
10
10
  id: string;
@@ -17,12 +17,18 @@ export default class WindowStore {
17
17
  minimizePos: {
18
18
  left: number;
19
19
  top: number;
20
- } | null;
20
+ };
21
+ fullscreenPos: {
22
+ left: number;
23
+ top: number;
24
+ width: number;
25
+ height: number;
26
+ };
21
27
  isMinimize: boolean;
22
28
  isClosed: boolean;
23
29
  onClosedHandler: ((id: string) => void) | undefined;
24
30
  constructor(id: string, onClosedHandler?: (id: string) => void);
25
- fullscreenWindow(): void;
31
+ fullscreenWindow(func?: () => void): void;
26
32
  fullscreenExitWindow(): void;
27
33
  resetState(): void;
28
34
  calculateTransform(transform: Transform): {
@@ -31,19 +37,25 @@ export default class WindowStore {
31
37
  };
32
38
  controll(transform: Transform, type: WindowControllerType): void;
33
39
  endControll(): void;
34
- minimizeWindow(minimize: {
35
- left: number;
36
- top: number;
37
- }): void;
40
+ minimizeWindow(): void;
38
41
  normalizeWindow(): void;
39
42
  closeWindow(): void;
40
43
  get style(): {
41
- left: string | number;
42
- top: string | number;
43
- width: string | number;
44
- height: string | number;
44
+ left: string;
45
+ top: string;
46
+ width: string;
47
+ height: string;
48
+ zIndex: number;
49
+ transform: string;
50
+ transition: string;
51
+ } | {
52
+ left: string;
53
+ top: string;
54
+ width: number;
55
+ height: number;
45
56
  zIndex: number;
46
57
  transform: string;
47
58
  transition: string;
48
59
  };
60
+ get info(): string;
49
61
  }
@@ -9,17 +9,26 @@ import { action, computed, makeObservable, observable } from 'mobx';
9
9
  var WindowStore = /*#__PURE__*/function () {
10
10
  function WindowStore(id, onClosedHandler) {
11
11
  _classCallCheck(this, WindowStore);
12
- _defineProperty(this, "width", '400px');
13
- _defineProperty(this, "height", '400px');
14
- _defineProperty(this, "left", '0px');
15
- _defineProperty(this, "top", '0px');
12
+ _defineProperty(this, "width", 400);
13
+ _defineProperty(this, "height", 400);
14
+ _defineProperty(this, "left", 0);
15
+ _defineProperty(this, "top", 0);
16
16
  _defineProperty(this, "zIndex", 1);
17
17
  _defineProperty(this, "fullscreen", false);
18
18
  _defineProperty(this, "id", '');
19
19
  _defineProperty(this, "transform", null);
20
20
  _defineProperty(this, "isMoving", false);
21
21
  _defineProperty(this, "isResizing", false);
22
- _defineProperty(this, "minimizePos", null);
22
+ _defineProperty(this, "minimizePos", {
23
+ left: 0,
24
+ top: 0
25
+ });
26
+ _defineProperty(this, "fullscreenPos", {
27
+ left: 0,
28
+ top: 0,
29
+ width: 1000,
30
+ height: 1000
31
+ });
23
32
  _defineProperty(this, "isMinimize", false);
24
33
  _defineProperty(this, "isClosed", false);
25
34
  _defineProperty(this, "onClosedHandler", void 0);
@@ -41,19 +50,22 @@ var WindowStore = /*#__PURE__*/function () {
41
50
  style: computed.struct,
42
51
  isMinimize: observable,
43
52
  minimizePos: observable.struct,
53
+ fullscreenPos: observable.struct,
44
54
  minimizeWindow: action,
45
55
  normalizeWindow: action,
46
56
  closeWindow: action,
47
- resetState: action
57
+ resetState: action,
58
+ info: computed
48
59
  });
49
60
  this.id = id;
50
61
  this.onClosedHandler = onClosedHandler;
51
62
  }
52
63
  _createClass(WindowStore, [{
53
64
  key: "fullscreenWindow",
54
- value: function fullscreenWindow() {
65
+ value: function fullscreenWindow(func) {
55
66
  this.resetState();
56
67
  this.fullscreen = true;
68
+ func === null || func === void 0 || func();
57
69
  }
58
70
  }, {
59
71
  key: "fullscreenExitWindow",
@@ -87,22 +99,22 @@ var WindowStore = /*#__PURE__*/function () {
87
99
  this.isResizing = true;
88
100
  }
89
101
  if (type.includes('left')) {
90
- this.left = Math.round(parseFloat(this.left) + offsetTransform.x) + 'px';
91
- this.width = Math.round(parseFloat(this.width) - offsetTransform.x) + 'px';
102
+ this.left = Math.round(this.left + offsetTransform.x);
103
+ this.width = Math.round(this.width - offsetTransform.x);
92
104
  }
93
105
  if (type.includes('right')) {
94
- this.width = Math.round(parseFloat(this.width) + offsetTransform.x) + 'px';
106
+ this.width = Math.round(this.width + offsetTransform.x);
95
107
  }
96
108
  if (type.includes('top')) {
97
- this.top = Math.round(parseFloat(this.top) + offsetTransform.y) + 'px';
98
- this.height = Math.round(parseFloat(this.height) - offsetTransform.y) + 'px';
109
+ this.top = Math.round(this.top + offsetTransform.y);
110
+ this.height = Math.round(this.height - offsetTransform.y);
99
111
  }
100
112
  if (type.includes('bottom')) {
101
- this.height = Math.round(parseFloat(this.height) + offsetTransform.y) + 'px';
113
+ this.height = Math.round(this.height + offsetTransform.y);
102
114
  }
103
115
  if (type.includes('move')) {
104
- this.left = Math.round(parseFloat(this.left) + offsetTransform.x) + 'px';
105
- this.top = Math.round(parseFloat(this.top) + offsetTransform.y) + 'px';
116
+ this.left = Math.round(this.left + offsetTransform.x);
117
+ this.top = Math.round(this.top + offsetTransform.y);
106
118
  }
107
119
  this.transform = transform;
108
120
  }
@@ -115,8 +127,7 @@ var WindowStore = /*#__PURE__*/function () {
115
127
  }
116
128
  }, {
117
129
  key: "minimizeWindow",
118
- value: function minimizeWindow(minimize) {
119
- this.minimizePos = minimize;
130
+ value: function minimizeWindow() {
120
131
  this.isMinimize = true;
121
132
  this.fullscreen = false;
122
133
  this.resetState();
@@ -124,7 +135,6 @@ var WindowStore = /*#__PURE__*/function () {
124
135
  }, {
125
136
  key: "normalizeWindow",
126
137
  value: function normalizeWindow() {
127
- this.minimizePos = null;
128
138
  this.isMinimize = false;
129
139
  this.fullscreen = false;
130
140
  this.resetState();
@@ -138,16 +148,64 @@ var WindowStore = /*#__PURE__*/function () {
138
148
  }, {
139
149
  key: "style",
140
150
  get: function get() {
141
- var renderStyle = {
142
- left: this.isClosed ? this.left : this.isMinimize && this.minimizePos ? this.minimizePos.left : this.fullscreen ? 0 : this.left,
143
- top: this.isClosed ? this.top : this.isMinimize && this.minimizePos ? this.minimizePos.top : this.fullscreen ? 0 : this.top,
144
- width: this.isClosed ? this.width : this.isMinimize ? 0 : this.fullscreen ? '100%' : this.width,
145
- height: this.isClosed ? this.height : this.isMinimize ? 0 : this.fullscreen ? '100%' : this.height,
151
+ if (this.isClosed) {
152
+ return {
153
+ left: this.left + 'px',
154
+ top: this.top + 'px',
155
+ width: this.width + 'px',
156
+ height: this.height + 'px',
157
+ zIndex: this.zIndex,
158
+ transform: 'scale(0)',
159
+ transition: 'all 0.5s ease-out'
160
+ };
161
+ }
162
+ if (this.isMinimize && this.minimizePos) {
163
+ return {
164
+ left: this.minimizePos.left + 'px',
165
+ top: this.minimizePos.top + 'px',
166
+ width: 0,
167
+ height: 0,
168
+ zIndex: this.zIndex,
169
+ transform: 'scale(0)',
170
+ transition: 'all 0.5s ease-out'
171
+ };
172
+ }
173
+ if (this.fullscreen) {
174
+ return {
175
+ left: this.fullscreenPos.left + 'px',
176
+ top: this.fullscreenPos.top + 'px',
177
+ width: this.fullscreenPos.width + 'px',
178
+ height: this.fullscreenPos.height + 'px',
179
+ zIndex: this.zIndex,
180
+ transform: 'none',
181
+ transition: 'all 0.5s ease-out'
182
+ };
183
+ }
184
+ if (this.isMoving || this.isResizing) {
185
+ return {
186
+ left: this.left + 'px',
187
+ top: this.top + 'px',
188
+ width: this.width + 'px',
189
+ height: this.height + 'px',
190
+ zIndex: this.zIndex,
191
+ transform: 'none',
192
+ transition: 'none'
193
+ };
194
+ }
195
+ return {
196
+ left: this.left + 'px',
197
+ top: this.top + 'px',
198
+ width: this.width + 'px',
199
+ height: this.height + 'px',
146
200
  zIndex: this.zIndex,
147
- transform: this.isMinimize || this.isClosed ? 'scale(0)' : 'none',
148
- transition: this.isMoving || this.isResizing ? 'none' : 'all 0.5s ease-out'
201
+ transform: 'none',
202
+ transition: 'all 0.5s ease-out'
149
203
  };
150
- return renderStyle;
204
+ }
205
+ }, {
206
+ key: "info",
207
+ get: function get() {
208
+ return JSON.stringify(this.fullscreenPos, null, 4);
151
209
  }
152
210
  }]);
153
211
  return WindowStore;
@@ -7,11 +7,9 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
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 { DndContext } from '@dnd-kit/core';
9
9
  import { makeAutoObservable } from 'mobx';
10
- import { observer } from 'mobx-react-lite';
10
+ import { observer, useLocalObservable } from 'mobx-react-lite';
11
11
  import React from 'react';
12
- import { Button } from "../Button";
13
- import { Space } from "../Space";
14
- import { ViewPort } from "../ViewPort";
12
+ import { ViewPort, ViewPortStore } from "../ViewPort";
15
13
  import { GlobalStyles } from "../__styles";
16
14
  import Window from "./Window";
17
15
  import { WindowStore } from "./index";
@@ -40,23 +38,18 @@ var WindowManager = /*#__PURE__*/function () {
40
38
  }();
41
39
  var windowManager = new WindowManager();
42
40
  export default observer(function Test() {
41
+ var viewPortStore = useLocalObservable(function () {
42
+ return new ViewPortStore();
43
+ });
43
44
  return /*#__PURE__*/React.createElement(DndContext, null, /*#__PURE__*/React.createElement(GlobalStyles, {
44
45
  $css: []
45
- }), /*#__PURE__*/React.createElement(ViewPort, null, /*#__PURE__*/React.createElement(Space, null, windowManager.report, /*#__PURE__*/React.createElement(Button, {
46
- onClick: function onClick() {
47
- windowManager.windows.forEach(function (window) {
48
- window.normalizeWindow();
49
- });
50
- }
51
- }, "\u5C55\u5F00")), windowManager.windows.map(function (windowStore) {
46
+ }), /*#__PURE__*/React.createElement(ViewPort, {
47
+ viewPortStore: viewPortStore
48
+ }, windowManager.windows.map(function (windowStore) {
52
49
  return /*#__PURE__*/React.createElement(Window, {
53
50
  window: windowStore,
54
51
  key: windowStore.id,
55
52
  title: 'xixi'
56
- }, /*#__PURE__*/React.createElement(Button, {
57
- onClick: function onClick() {
58
- alert('jss好帅');
59
- }
60
- }, "123"));
53
+ }, "123");
61
54
  })));
62
55
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kep-platform/basic-component",
3
- "version": "0.0.36",
3
+ "version": "0.0.38",
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.36",
50
+ "@kep-platform/hooks": "^0.0.38",
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": "7186f791c3f0e372fa7421eebedfa338bba9cd59"
90
+ "gitHead": "8e28a8926ce994e43661454098fac1f15d7e9ead"
91
91
  }