@kep-platform/basic-component 0.0.45 → 0.0.47
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/Draggable/index.d.ts +3 -0
- package/dist/Draggable/index.js +181 -0
- package/dist/Draggable/test.js +2 -10
- package/dist/ViewPort/ViewPort.d.ts +6 -8
- package/dist/ViewPort/ViewPort.js +72 -38
- package/dist/ViewPort/ViewPortStore.d.ts +10 -6
- package/dist/ViewPort/ViewPortStore.js +63 -19
- package/dist/ViewPort/ViewPortWindow.d.ts +4 -2
- package/dist/ViewPort/ViewPortWindow.js +7 -1
- package/dist/ViewPort/test.js +7 -4
- package/dist/Window/Window.js +21 -2
- package/dist/Window/WindowController.d.ts +2 -2
- package/dist/Window/WindowController.js +7 -7
- package/dist/Window/WindowStore.d.ts +4 -19
- package/dist/Window/WindowStore.js +14 -1
- package/dist/Window/test.js +2 -1
- package/package.json +3 -3
package/dist/Draggable/index.js
CHANGED
@@ -0,0 +1,181 @@
|
|
1
|
+
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); }
|
2
|
+
import { observable, runInAction, toJS } from 'mobx';
|
3
|
+
import { observer, useLocalObservable } from 'mobx-react-lite';
|
4
|
+
import React, { useContext, useEffect, useRef } from 'react';
|
5
|
+
var posStore = observable({
|
6
|
+
left: 0,
|
7
|
+
top: 0,
|
8
|
+
setPos: function setPos(offsetLeft, offsetTop) {
|
9
|
+
this.left += offsetLeft;
|
10
|
+
this.top += offsetTop;
|
11
|
+
}
|
12
|
+
});
|
13
|
+
var DropContext = /*#__PURE__*/React.createContext(observable({
|
14
|
+
registedDrop: {},
|
15
|
+
registDrop: function registDrop(id, dropStore) {
|
16
|
+
this.registedDrop[id] = dropStore;
|
17
|
+
}
|
18
|
+
}));
|
19
|
+
function useDrag(props) {
|
20
|
+
var dragNodeRef = useRef(null);
|
21
|
+
var dropProviderStore = useContext(DropContext);
|
22
|
+
var onMove = props.onMove,
|
23
|
+
_props$stepX = props.stepX,
|
24
|
+
stepX = _props$stepX === void 0 ? 1 : _props$stepX,
|
25
|
+
_props$stepY = props.stepY,
|
26
|
+
stepY = _props$stepY === void 0 ? 1 : _props$stepY,
|
27
|
+
id = props.id;
|
28
|
+
var dragStore = useLocalObservable(function () {
|
29
|
+
return {
|
30
|
+
dragging: false,
|
31
|
+
lastPos: {
|
32
|
+
left: 0,
|
33
|
+
top: 0
|
34
|
+
},
|
35
|
+
offset: {
|
36
|
+
left: 0,
|
37
|
+
top: 0
|
38
|
+
},
|
39
|
+
id: id,
|
40
|
+
startMove: function startMove(left, top) {
|
41
|
+
this.lastPos.left = left;
|
42
|
+
this.lastPos.top = top;
|
43
|
+
this.dragging = true;
|
44
|
+
},
|
45
|
+
move: function move(left, top) {
|
46
|
+
this.offset.left = left - this.lastPos.left; //处理每次的偏移量
|
47
|
+
this.offset.top = top - this.lastPos.top; //处理每次的偏移量
|
48
|
+
this.lastPos.left = left;
|
49
|
+
this.lastPos.top = top;
|
50
|
+
},
|
51
|
+
endMove: function endMove() {
|
52
|
+
this.dragging = false;
|
53
|
+
this.offset.left = 0;
|
54
|
+
this.offset.top = 0;
|
55
|
+
}
|
56
|
+
};
|
57
|
+
});
|
58
|
+
useEffect(function () {
|
59
|
+
dropProviderStore.registDrop(dragStore.id, dragStore);
|
60
|
+
}, []);
|
61
|
+
function onDragStart(e) {
|
62
|
+
var event = e;
|
63
|
+
runInAction(function () {
|
64
|
+
event.dataTransfer.setDragImage(new Image(), 0, 0);
|
65
|
+
dragStore.startMove(e.clientX, e.clientY);
|
66
|
+
});
|
67
|
+
}
|
68
|
+
function onDragEnd() {
|
69
|
+
runInAction(function () {
|
70
|
+
dragStore.endMove();
|
71
|
+
});
|
72
|
+
}
|
73
|
+
function onDrag(e) {
|
74
|
+
var event = e;
|
75
|
+
var mouseMoveX = event.clientX - dragStore.lastPos.left;
|
76
|
+
var mouseMoveY = event.clientY - dragStore.lastPos.top;
|
77
|
+
var shouldMove = false;
|
78
|
+
var movePosX = dragStore.lastPos.left;
|
79
|
+
var movePosY = dragStore.lastPos.top;
|
80
|
+
if (Math.abs(mouseMoveX) > stepX) {
|
81
|
+
shouldMove = true;
|
82
|
+
var moveStepX = Math.floor(mouseMoveX / stepX) * stepX;
|
83
|
+
movePosX = movePosX + moveStepX;
|
84
|
+
}
|
85
|
+
if (Math.abs(mouseMoveY) > stepY) {
|
86
|
+
shouldMove = true;
|
87
|
+
var moveStepY = Math.floor(mouseMoveY / stepY) * stepY;
|
88
|
+
movePosY = movePosY + moveStepY;
|
89
|
+
}
|
90
|
+
if (!shouldMove) {
|
91
|
+
return;
|
92
|
+
}
|
93
|
+
runInAction(function () {
|
94
|
+
dragStore.move(movePosX, movePosY);
|
95
|
+
onMove === null || onMove === void 0 || onMove(toJS(dragStore));
|
96
|
+
});
|
97
|
+
}
|
98
|
+
return {
|
99
|
+
listeners: {
|
100
|
+
onDragStart: onDragStart,
|
101
|
+
onDrag: onDrag,
|
102
|
+
onDragEnd: onDragEnd
|
103
|
+
},
|
104
|
+
attributes: {
|
105
|
+
draggable: true,
|
106
|
+
'drag-id': id
|
107
|
+
},
|
108
|
+
dragNodeRef: dragNodeRef
|
109
|
+
};
|
110
|
+
}
|
111
|
+
function DndProvider(props) {
|
112
|
+
var dropProviderStore = useLocalObservable(function () {
|
113
|
+
return {
|
114
|
+
registedDrop: {},
|
115
|
+
registDrop: function registDrop(id, dropStore) {
|
116
|
+
this.registedDrop[id] = dropStore;
|
117
|
+
}
|
118
|
+
};
|
119
|
+
});
|
120
|
+
return /*#__PURE__*/React.createElement(DropContext.Provider, {
|
121
|
+
value: dropProviderStore
|
122
|
+
}, props.children);
|
123
|
+
}
|
124
|
+
function useDrop() {
|
125
|
+
var dropNodeRef = useRef(null);
|
126
|
+
var dropStore = useLocalObservable(function () {
|
127
|
+
return {
|
128
|
+
isOver: false,
|
129
|
+
setIsOver: function setIsOver(over) {
|
130
|
+
this.isOver = over;
|
131
|
+
},
|
132
|
+
id: 'dropContext'
|
133
|
+
};
|
134
|
+
});
|
135
|
+
var dropProviderStore = useContext(DropContext);
|
136
|
+
useEffect(function () {
|
137
|
+
dropProviderStore.registDrop(dropStore.id, dropStore);
|
138
|
+
}, []);
|
139
|
+
return {
|
140
|
+
isOver: dropStore.isOver,
|
141
|
+
dropNodeRef: dropNodeRef
|
142
|
+
};
|
143
|
+
}
|
144
|
+
export default observer(function CustomDraggable() {
|
145
|
+
var _useDrag = useDrag({
|
146
|
+
onMove: function onMove(v) {
|
147
|
+
posStore.left += v.offset.left;
|
148
|
+
posStore.top += v.offset.top;
|
149
|
+
},
|
150
|
+
id: 'div1s'
|
151
|
+
}),
|
152
|
+
listeners = _useDrag.listeners,
|
153
|
+
attributes = _useDrag.attributes,
|
154
|
+
dragNodeRef = _useDrag.dragNodeRef;
|
155
|
+
var _useDrop = useDrop(),
|
156
|
+
isOver = _useDrop.isOver,
|
157
|
+
dropNodeRef = _useDrop.dropNodeRef;
|
158
|
+
return /*#__PURE__*/React.createElement(DndProvider, null, /*#__PURE__*/React.createElement("div", {
|
159
|
+
onDragOver: function onDragOver(e) {
|
160
|
+
e.preventDefault();
|
161
|
+
},
|
162
|
+
ref: dropNodeRef,
|
163
|
+
style: {
|
164
|
+
width: '1000px',
|
165
|
+
height: '1000px',
|
166
|
+
position: 'relative',
|
167
|
+
backgroundColor: isOver ? 'yellow' : 'blue'
|
168
|
+
}
|
169
|
+
}, /*#__PURE__*/React.createElement("div", _extends({}, listeners, attributes, {
|
170
|
+
style: {
|
171
|
+
position: 'absolute',
|
172
|
+
left: posStore.left,
|
173
|
+
top: posStore.top,
|
174
|
+
backgroundColor: 'pink',
|
175
|
+
width: '200px',
|
176
|
+
height: '200px',
|
177
|
+
cursor: 'grab'
|
178
|
+
},
|
179
|
+
ref: dragNodeRef
|
180
|
+
}), "CustomDraggable")));
|
181
|
+
});
|
package/dist/Draggable/test.js
CHANGED
@@ -1,13 +1,5 @@
|
|
1
|
-
import { DndContext } from '@dnd-kit/core';
|
2
1
|
import React from 'react';
|
3
|
-
import
|
4
|
-
import Droppable from "./Droppable";
|
2
|
+
import CustomDraggable from '.';
|
5
3
|
export default (function () {
|
6
|
-
return /*#__PURE__*/React.createElement(
|
7
|
-
onDragStart: function onDragStart() {}
|
8
|
-
}, /*#__PURE__*/React.createElement(DndContext, {
|
9
|
-
onDragEnd: function onDragEnd() {}
|
10
|
-
}, /*#__PURE__*/React.createElement(Draggable, null, "123"), /*#__PURE__*/React.createElement(Droppable, null, "456")), /*#__PURE__*/React.createElement(DndContext, {
|
11
|
-
onDragEnd: function onDragEnd() {}
|
12
|
-
}, /*#__PURE__*/React.createElement(Draggable, null, "123"), /*#__PURE__*/React.createElement(Droppable, null, "456"))));
|
4
|
+
return /*#__PURE__*/React.createElement(CustomDraggable, null);
|
13
5
|
});
|
@@ -1,15 +1,13 @@
|
|
1
|
-
import React, { HtmlHTMLAttributes, ReactNode } from 'react';
|
1
|
+
import React, { FunctionComponent, HtmlHTMLAttributes, ReactNode } from 'react';
|
2
2
|
import { ViewPortStore } from './ViewPortStore';
|
3
|
+
import { ViewPortWindowProps } from './ViewPortWindow';
|
3
4
|
type ViewPortProps = {
|
4
|
-
children
|
5
|
+
children: ReactNode;
|
5
6
|
viewPortStore: ViewPortStore;
|
6
7
|
onScale?: (left: number, top: number, scale: number, ratio: number) => void;
|
7
8
|
onScroll?: (left: number, top: number, scale: number, ratio: number) => void;
|
8
9
|
} & HtmlHTMLAttributes<HTMLDivElement>;
|
9
|
-
declare
|
10
|
-
|
11
|
-
|
12
|
-
window: import("./ViewPortWindow").ViewPortWindowStore;
|
13
|
-
}>;
|
14
|
-
}
|
10
|
+
declare const ViewPort: React.FunctionComponent<ViewPortProps> & {
|
11
|
+
Window: FunctionComponent<ViewPortWindowProps>;
|
12
|
+
};
|
15
13
|
export default ViewPort;
|
@@ -1,20 +1,21 @@
|
|
1
|
-
var _excluded = ["children", "viewPortStore", "onScroll", "onScale"]
|
2
|
-
|
3
|
-
var _templateObject, _templateObject2;
|
1
|
+
var _excluded = ["children", "viewPortStore", "onScroll", "onScale"];
|
2
|
+
var _templateObject, _templateObject2, _templateObject3;
|
4
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); }
|
5
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; }
|
6
5
|
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; }
|
7
6
|
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
8
|
-
import {
|
7
|
+
import { useDraggable } from '@dnd-kit/core';
|
8
|
+
import { runInAction } from 'mobx';
|
9
9
|
import { observer } from 'mobx-react-lite';
|
10
|
-
import React, { useEffect, useRef } from 'react';
|
10
|
+
import React, { useCallback, useEffect, useRef } from 'react';
|
11
11
|
import styled from 'styled-components';
|
12
12
|
import { RippleManagerStore } from "./Ripple";
|
13
13
|
import { ViewPortWindow } from "./ViewPortWindow";
|
14
14
|
var Container = styled.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n position: relative;\n border: 1px solid #eee;\n box-shadow: 0 0 7px 0 inset #fefefe;\n"])));
|
15
15
|
var Content = styled.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n position: absolute;\n"])));
|
16
|
+
var Overlay = styled.div(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral([""])));
|
16
17
|
var rippleManagerStore = new RippleManagerStore();
|
17
|
-
var
|
18
|
+
var ViewPortComponent = observer(function (props) {
|
18
19
|
var children = props.children,
|
19
20
|
viewPortStore = props.viewPortStore,
|
20
21
|
onScroll = props.onScroll,
|
@@ -28,11 +29,15 @@ var ViewPortEntity = observer(function (props) {
|
|
28
29
|
listeners = _useDraggable.listeners,
|
29
30
|
setActivatorNodeRef = _useDraggable.setActivatorNodeRef,
|
30
31
|
transform = _useDraggable.transform;
|
31
|
-
var
|
32
|
+
var contentRef = useRef(null);
|
33
|
+
var containerRef = useRef(null);
|
34
|
+
var pointerDownTimer = useRef();
|
32
35
|
var createRipple = function createRipple(event) {
|
36
|
+
var _containerRef$current;
|
33
37
|
event.preventDefault();
|
34
38
|
event.stopPropagation();
|
35
|
-
var rect =
|
39
|
+
var rect = (_containerRef$current = containerRef.current) === null || _containerRef$current === void 0 ? void 0 : _containerRef$current.getBoundingClientRect();
|
40
|
+
if (!rect) return;
|
36
41
|
var left = event.clientX - rect.left;
|
37
42
|
var top = event.clientY - rect.top;
|
38
43
|
rippleManagerStore.addRipple(left, top);
|
@@ -49,7 +54,7 @@ var ViewPortEntity = observer(function (props) {
|
|
49
54
|
}
|
50
55
|
}, [transform]);
|
51
56
|
useEffect(function () {
|
52
|
-
var
|
57
|
+
var _contentRef$current;
|
53
58
|
function scaleHandler(e) {
|
54
59
|
e.stopPropagation();
|
55
60
|
e.preventDefault();
|
@@ -60,44 +65,73 @@ var ViewPortEntity = observer(function (props) {
|
|
60
65
|
}
|
61
66
|
onScale === null || onScale === void 0 || onScale(viewPortStore.transform.left, viewPortStore.transform.top, viewPortStore.scale, viewPortStore.ratio);
|
62
67
|
}
|
63
|
-
(
|
68
|
+
(_contentRef$current = contentRef.current) === null || _contentRef$current === void 0 || _contentRef$current.addEventListener('wheel', scaleHandler, {
|
64
69
|
passive: false
|
65
70
|
});
|
66
71
|
return function () {
|
67
|
-
var
|
68
|
-
(
|
72
|
+
var _contentRef$current2;
|
73
|
+
(_contentRef$current2 = contentRef.current) === null || _contentRef$current2 === void 0 || _contentRef$current2.removeEventListener('wheel', scaleHandler);
|
69
74
|
};
|
70
75
|
}, []);
|
76
|
+
var onContainerDoubleClickHandler = function onContainerDoubleClickHandler(e) {
|
77
|
+
//在transition期间禁止操作
|
78
|
+
if (viewPortStore.isTransition) {
|
79
|
+
return;
|
80
|
+
}
|
81
|
+
//双击的时候取消pointerDown的触发事件
|
82
|
+
if (pointerDownTimer.current) clearTimeout(pointerDownTimer.current);
|
83
|
+
pointerDownTimer.current = null;
|
84
|
+
createRipple(e);
|
85
|
+
var container = containerRef.current;
|
86
|
+
var _container$getBoundin = container.getBoundingClientRect(),
|
87
|
+
left = _container$getBoundin.left,
|
88
|
+
top = _container$getBoundin.top;
|
89
|
+
var offsetLeft = e.clientX - left;
|
90
|
+
var offsetTop = e.clientY - top;
|
91
|
+
if (viewPortStore.scale === 1) {
|
92
|
+
viewPortStore.unfocus();
|
93
|
+
} else viewPortStore.focus(offsetLeft, offsetTop);
|
94
|
+
};
|
95
|
+
var onContentTransitionEnd = useCallback(function (e) {
|
96
|
+
if (e.target === contentRef.current) {
|
97
|
+
runInAction(function () {
|
98
|
+
viewPortStore.isTransition = false;
|
99
|
+
});
|
100
|
+
}
|
101
|
+
}, []);
|
102
|
+
var onContentPointerDownHandler = useCallback(function (e) {
|
103
|
+
if (viewPortStore.isTransition) return;
|
104
|
+
//鼠标点击的时候,先清除定时器,然后再异步触发pointerDown操作,这样保证doubleClick的优先级高于pointerDown
|
105
|
+
if (pointerDownTimer.current) clearTimeout(pointerDownTimer.current);
|
106
|
+
pointerDownTimer.current = setTimeout(function () {
|
107
|
+
var _onPointerDown, _ref;
|
108
|
+
listeners === null || listeners === void 0 || (_onPointerDown = (_ref = listeners).onPointerDown) === null || _onPointerDown === void 0 || _onPointerDown.call(_ref, e);
|
109
|
+
}, 0);
|
110
|
+
}, [listeners]);
|
111
|
+
var onContentPointerUpHandler = useCallback(function (e) {
|
112
|
+
var _onPointerUp, _ref2;
|
113
|
+
if (viewPortStore.isTransition) return;
|
114
|
+
listeners === null || listeners === void 0 || (_onPointerUp = (_ref2 = listeners).onPointerUp) === null || _onPointerUp === void 0 || _onPointerUp.call(_ref2, e);
|
115
|
+
}, [listeners]);
|
71
116
|
return /*#__PURE__*/React.createElement(Container, _extends({
|
72
117
|
style: viewPortStore.containerStyle,
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
top = _container$getBoundin.top;
|
79
|
-
var offsetLeft = e.clientX - left;
|
80
|
-
var offsetTop = e.clientY - top;
|
81
|
-
if (viewPortStore.scale === 1) {
|
82
|
-
viewPortStore.unfocus();
|
83
|
-
} else viewPortStore.focus(offsetLeft, offsetTop);
|
84
|
-
}
|
85
|
-
}, rest), rippleManagerStore.rippleInfo, /*#__PURE__*/React.createElement(Content, _extends({
|
118
|
+
onDoubleClick: onContainerDoubleClickHandler,
|
119
|
+
ref: containerRef
|
120
|
+
}, rest), /*#__PURE__*/React.createElement(Overlay, {
|
121
|
+
style: viewPortStore.overlayStyle
|
122
|
+
}), /*#__PURE__*/React.createElement(Content, _extends({
|
86
123
|
ref: function ref(dom) {
|
87
|
-
|
88
|
-
setNodeRef(
|
89
|
-
setActivatorNodeRef(
|
124
|
+
contentRef.current = dom;
|
125
|
+
setNodeRef(contentRef.current);
|
126
|
+
setActivatorNodeRef(contentRef.current);
|
90
127
|
}
|
91
|
-
}, attributes,
|
128
|
+
}, attributes, {
|
129
|
+
onPointerDown: onContentPointerDownHandler,
|
130
|
+
onPointerUp: onContentPointerUpHandler,
|
131
|
+
onTransitionEnd: onContentTransitionEnd,
|
92
132
|
style: viewPortStore.contentStyle
|
93
133
|
}), children));
|
94
134
|
});
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
rest = _objectWithoutProperties(props, _excluded2);
|
99
|
-
return /*#__PURE__*/React.createElement(DndContext, null, /*#__PURE__*/React.createElement(ViewPortEntity, _extends({
|
100
|
-
viewPortStore: viewPortStore
|
101
|
-
}, rest), children));
|
102
|
-
}
|
103
|
-
ViewPort.Window = ViewPortWindow;
|
135
|
+
var ViewPort = ViewPortComponent;
|
136
|
+
ViewPort.Window = ViewPortWindow;
|
137
|
+
export default ViewPort;
|
@@ -15,21 +15,27 @@ export declare class ViewPortStore {
|
|
15
15
|
ratio: number;
|
16
16
|
isMoving: boolean;
|
17
17
|
maxZIndex: number;
|
18
|
+
isTransition: boolean;
|
18
19
|
constructor(width?: number, height?: number, ratio?: number);
|
19
20
|
get scaleStep(): number;
|
20
21
|
increaseScale(): void;
|
21
22
|
decreaseScale(): void;
|
22
|
-
|
23
|
-
|
24
|
-
|
23
|
+
validScale(scale: number): number;
|
24
|
+
setScale(scale: number): void;
|
25
|
+
setTransform(left: number, top: number): void;
|
25
26
|
get offsetLeft(): number;
|
26
27
|
get offsetTop(): number;
|
27
|
-
|
28
|
+
formatedTransform(left: number, top: number): {
|
29
|
+
left: number;
|
30
|
+
top: number;
|
31
|
+
};
|
28
32
|
focus(left: number, top: number): void;
|
29
33
|
unfocus(): void;
|
30
34
|
move(transform: Transform): void;
|
31
35
|
endMove(): void;
|
32
36
|
get contentStyle(): CSSProperties;
|
37
|
+
get containerStyle(): CSSProperties;
|
38
|
+
get overlayStyle(): CSSProperties;
|
33
39
|
get viewPortRect(): {
|
34
40
|
left: number;
|
35
41
|
top: number;
|
@@ -44,6 +50,4 @@ export declare class ViewPortStore {
|
|
44
50
|
height: number;
|
45
51
|
scale: number;
|
46
52
|
};
|
47
|
-
get containerStyle(): CSSProperties;
|
48
|
-
get info(): string;
|
49
53
|
}
|
@@ -5,8 +5,9 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d
|
|
5
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; }
|
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
|
-
import {
|
8
|
+
import { action, computed, makeObservable, observable } from 'mobx';
|
9
9
|
export var ViewPortStore = /*#__PURE__*/function () {
|
10
|
+
//在动画执行期间,禁止任何鼠标操作
|
10
11
|
function ViewPortStore(width, height, ratio) {
|
11
12
|
_classCallCheck(this, ViewPortStore);
|
12
13
|
_defineProperty(this, "transform", {
|
@@ -24,10 +25,36 @@ export var ViewPortStore = /*#__PURE__*/function () {
|
|
24
25
|
//缩放比例
|
25
26
|
_defineProperty(this, "isMoving", false);
|
26
27
|
_defineProperty(this, "maxZIndex", 1);
|
28
|
+
_defineProperty(this, "isTransition", false);
|
27
29
|
if (ratio) this.ratio = ratio;
|
28
30
|
if (width) this.width = width;
|
29
31
|
if (height) this.height = height;
|
30
|
-
|
32
|
+
makeObservable(this, {
|
33
|
+
transform: observable.struct,
|
34
|
+
offset: observable.struct,
|
35
|
+
scale: observable,
|
36
|
+
width: observable,
|
37
|
+
height: observable,
|
38
|
+
ratio: observable,
|
39
|
+
isMoving: observable,
|
40
|
+
maxZIndex: observable,
|
41
|
+
isTransition: observable,
|
42
|
+
scaleStep: computed,
|
43
|
+
increaseScale: action,
|
44
|
+
decreaseScale: action,
|
45
|
+
setScale: action,
|
46
|
+
setTransform: action,
|
47
|
+
offsetLeft: computed,
|
48
|
+
offsetTop: computed,
|
49
|
+
focus: action,
|
50
|
+
unfocus: action,
|
51
|
+
move: action,
|
52
|
+
endMove: action,
|
53
|
+
containerStyle: computed.struct,
|
54
|
+
contentStyle: computed.struct,
|
55
|
+
viewPortRect: computed.struct,
|
56
|
+
overlayStyle: computed.struct
|
57
|
+
});
|
31
58
|
}
|
32
59
|
_createClass(ViewPortStore, [{
|
33
60
|
key: "scaleStep",
|
@@ -39,12 +66,14 @@ export var ViewPortStore = /*#__PURE__*/function () {
|
|
39
66
|
value: function increaseScale() {
|
40
67
|
this.setScale(this.scale + this.scaleStep);
|
41
68
|
this.setTransform(this.transform.left, this.transform.top);
|
69
|
+
this.isTransition = true;
|
42
70
|
}
|
43
71
|
}, {
|
44
72
|
key: "decreaseScale",
|
45
73
|
value: function decreaseScale() {
|
46
74
|
this.setScale(this.scale - this.scaleStep);
|
47
75
|
this.setTransform(this.transform.left, this.transform.top);
|
76
|
+
this.isTransition = true;
|
48
77
|
}
|
49
78
|
}, {
|
50
79
|
key: "validScale",
|
@@ -97,12 +126,14 @@ export var ViewPortStore = /*#__PURE__*/function () {
|
|
97
126
|
value: function focus(left, top) {
|
98
127
|
this.setScale(1);
|
99
128
|
this.setTransform((1 - this.ratio) * left + this.offsetLeft, (1 - this.ratio) * top + this.offsetTop);
|
129
|
+
this.isTransition = true;
|
100
130
|
}
|
101
131
|
}, {
|
102
132
|
key: "unfocus",
|
103
133
|
value: function unfocus() {
|
104
134
|
this.setScale(1 / this.ratio);
|
105
135
|
this.setTransform(0, 0);
|
136
|
+
this.isTransition = true;
|
106
137
|
}
|
107
138
|
}, {
|
108
139
|
key: "move",
|
@@ -125,9 +156,10 @@ export var ViewPortStore = /*#__PURE__*/function () {
|
|
125
156
|
key: "contentStyle",
|
126
157
|
get: function get() {
|
127
158
|
return {
|
128
|
-
|
129
|
-
|
130
|
-
|
159
|
+
position: 'absolute',
|
160
|
+
left: 0,
|
161
|
+
top: 0,
|
162
|
+
transform: " translate(".concat(this.transform.left - this.offsetLeft, "px,").concat(this.transform.top - this.offsetTop, "px) scale(").concat(this.scale, ")"),
|
131
163
|
width: this.width * this.ratio + 'px',
|
132
164
|
height: this.height * this.ratio + 'px',
|
133
165
|
transformOrigin: 'left top',
|
@@ -136,11 +168,37 @@ export var ViewPortStore = /*#__PURE__*/function () {
|
|
136
168
|
cursor: this.isMoving ? 'grab' : 'default'
|
137
169
|
};
|
138
170
|
}
|
171
|
+
}, {
|
172
|
+
key: "containerStyle",
|
173
|
+
get: function get() {
|
174
|
+
return {
|
175
|
+
width: this.width + 'px',
|
176
|
+
height: this.height + 'px',
|
177
|
+
overflow: 'hidden'
|
178
|
+
};
|
179
|
+
}
|
180
|
+
}, {
|
181
|
+
key: "overlayStyle",
|
182
|
+
get: function get() {
|
183
|
+
return {
|
184
|
+
position: 'absolute',
|
185
|
+
top: 0,
|
186
|
+
left: 0,
|
187
|
+
width: this.width,
|
188
|
+
height: this.height,
|
189
|
+
pointerEvents: this.isTransition ? 'all' : 'none',
|
190
|
+
userSelect: 'none',
|
191
|
+
display: this.isTransition ? 'block' : 'none',
|
192
|
+
backgroundColor: 'transparent',
|
193
|
+
zIndex: 9999
|
194
|
+
};
|
195
|
+
}
|
139
196
|
}, {
|
140
197
|
key: "viewPortRect",
|
141
198
|
get: function get() {
|
142
199
|
return this.posInViewPort(0, 0, this.width, this.height);
|
143
200
|
}
|
201
|
+
|
144
202
|
/* 这个函数比较重要,因为你想要让content中的元素在视窗相对位置显示,这个函数会帮你计算偏移量和缩放量,直接得出你的元素应该在content中的偏移量 */
|
145
203
|
}, {
|
146
204
|
key: "posInViewPort",
|
@@ -153,20 +211,6 @@ export var ViewPortStore = /*#__PURE__*/function () {
|
|
153
211
|
scale: this.scale
|
154
212
|
};
|
155
213
|
}
|
156
|
-
}, {
|
157
|
-
key: "containerStyle",
|
158
|
-
get: function get() {
|
159
|
-
return {
|
160
|
-
width: this.width + 'px',
|
161
|
-
height: this.height + 'px',
|
162
|
-
overflow: 'hidden'
|
163
|
-
};
|
164
|
-
}
|
165
|
-
}, {
|
166
|
-
key: "info",
|
167
|
-
get: function get() {
|
168
|
-
return JSON.stringify(this.formatedTransform(this.transform.left, this.transform.top), null, 4);
|
169
|
-
}
|
170
214
|
}]);
|
171
215
|
return ViewPortStore;
|
172
216
|
}();
|
@@ -34,7 +34,9 @@ export declare class ViewPortWindowStore extends WindowStore {
|
|
34
34
|
centerDisplay(): void;
|
35
35
|
fullscreenWindow(func?: () => void): void;
|
36
36
|
constructor(id: string, viewPort: ViewPortStore, onClosedHandler?: (id: string) => void);
|
37
|
+
get disabled(): boolean;
|
37
38
|
}
|
38
|
-
export
|
39
|
+
export type ViewPortWindowProps = WindowProps & {
|
39
40
|
window: ViewPortWindowStore;
|
40
|
-
}
|
41
|
+
};
|
42
|
+
export declare const ViewPortWindow: React.FunctionComponent<ViewPortWindowProps>;
|
@@ -34,7 +34,8 @@ export var ViewPortWindowStore = /*#__PURE__*/function (_WindowStore) {
|
|
34
34
|
style: override,
|
35
35
|
controll: override,
|
36
36
|
focus: override,
|
37
|
-
centerDisplay: action
|
37
|
+
centerDisplay: action,
|
38
|
+
disabled: override
|
38
39
|
});
|
39
40
|
return _this;
|
40
41
|
}
|
@@ -159,6 +160,11 @@ export var ViewPortWindowStore = /*#__PURE__*/function (_WindowStore) {
|
|
159
160
|
func === null || func === void 0 || func();
|
160
161
|
this.fullscreenPos = this.viewPortStore.viewPortRect;
|
161
162
|
}
|
163
|
+
}, {
|
164
|
+
key: "disabled",
|
165
|
+
get: function get() {
|
166
|
+
return this.viewPortStore.isTransition || this.isTransition;
|
167
|
+
}
|
162
168
|
}]);
|
163
169
|
return ViewPortWindowStore;
|
164
170
|
}(WindowStore);
|
package/dist/ViewPort/test.js
CHANGED
@@ -7,6 +7,7 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d
|
|
7
7
|
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; }
|
8
8
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
9
9
|
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); }
|
10
|
+
import { DndContext } from '@dnd-kit/core';
|
10
11
|
import { makeAutoObservable, runInAction } from 'mobx';
|
11
12
|
import { observer } from 'mobx-react-lite';
|
12
13
|
import React, { useEffect } from 'react';
|
@@ -66,13 +67,15 @@ export default observer(function Test() {
|
|
66
67
|
onClick: function onClick() {
|
67
68
|
windowManager.createWindow();
|
68
69
|
}
|
69
|
-
}, "\u65B0\u589E"), /*#__PURE__*/React.createElement(StyledViewPort, {
|
70
|
+
}, "\u65B0\u589E"), /*#__PURE__*/React.createElement(DndContext, null, /*#__PURE__*/React.createElement(StyledViewPort, {
|
70
71
|
viewPortStore: viewPortStore
|
71
72
|
}, windowManager.windows.map(function (windowStore) {
|
72
|
-
return /*#__PURE__*/React.createElement(
|
73
|
+
return /*#__PURE__*/React.createElement(DndContext, {
|
74
|
+
key: windowStore.id
|
75
|
+
}, /*#__PURE__*/React.createElement(ViewPort.Window, {
|
73
76
|
window: windowStore,
|
74
77
|
key: windowStore.id,
|
75
78
|
title: 'xixi'
|
76
|
-
}, /*#__PURE__*/React.createElement("br", null));
|
77
|
-
})));
|
79
|
+
}, /*#__PURE__*/React.createElement("br", null)));
|
80
|
+
}))));
|
78
81
|
});
|
package/dist/Window/Window.js
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13, _templateObject14;
|
2
2
|
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
3
3
|
import { CloseCircleOutlined, FullscreenExitOutlined, FullscreenOutlined, MinusCircleOutlined } from '@ant-design/icons';
|
4
|
+
import { runInAction } from 'mobx';
|
4
5
|
import { observer } from 'mobx-react-lite';
|
5
6
|
import React, { useEffect, useRef } from 'react';
|
6
7
|
import styled, { css } from 'styled-components';
|
@@ -52,22 +53,33 @@ var Window = observer(function (props) {
|
|
52
53
|
(_windowContainerRef$c2 = windowContainerRef.current) === null || _windowContainerRef$c2 === void 0 || _windowContainerRef$c2.removeEventListener('wheel', stopWheel);
|
53
54
|
};
|
54
55
|
}, []);
|
56
|
+
|
55
57
|
/* style 的原因是因为性能问题 */
|
56
58
|
return /*#__PURE__*/React.createElement(WindowContainer, {
|
57
59
|
style: window.style,
|
58
60
|
isMinimize: !!window.isMinimize,
|
59
61
|
onTransitionEnd: function onTransitionEnd(e) {
|
62
|
+
e.stopPropagation();
|
63
|
+
e.preventDefault();
|
64
|
+
if (e.target === e.currentTarget && e.propertyName === 'transform') {
|
65
|
+
runInAction(function () {
|
66
|
+
window.isTransition = false;
|
67
|
+
});
|
68
|
+
}
|
60
69
|
if (e.target === e.currentTarget && window.isClosed && e.nativeEvent.propertyName === 'transform') {
|
61
70
|
var _window$onClosedHandl;
|
62
71
|
(_window$onClosedHandl = window.onClosedHandler) === null || _window$onClosedHandl === void 0 || _window$onClosedHandl.call(window, window.id);
|
63
72
|
}
|
64
73
|
},
|
74
|
+
onDoubleClick: function onDoubleClick(e) {
|
75
|
+
e.stopPropagation();
|
76
|
+
},
|
65
77
|
onPointerDown: function onPointerDown(e) {
|
78
|
+
if (window.disabled) return;
|
66
79
|
e.stopPropagation();
|
67
80
|
window.focus();
|
68
81
|
onFocusHandler === null || onFocusHandler === void 0 || onFocusHandler();
|
69
|
-
}
|
70
|
-
ref: windowContainerRef
|
82
|
+
}
|
71
83
|
}, /*#__PURE__*/React.createElement(WindowControllerLeft, {
|
72
84
|
window: window,
|
73
85
|
type: "left"
|
@@ -97,6 +109,9 @@ var Window = observer(function (props) {
|
|
97
109
|
type: "move"
|
98
110
|
}, /*#__PURE__*/React.createElement(WindowHeader, {
|
99
111
|
isDragging: window.isMoving,
|
112
|
+
onPointerDown: function onPointerDown(e) {
|
113
|
+
if (window.disabled) e.stopPropagation();
|
114
|
+
},
|
100
115
|
onDoubleClick: function onDoubleClick(e) {
|
101
116
|
e.stopPropagation();
|
102
117
|
e.preventDefault();
|
@@ -114,22 +129,26 @@ var Window = observer(function (props) {
|
|
114
129
|
color: "var(--kep-platform-orange-4)",
|
115
130
|
icon: /*#__PURE__*/React.createElement(FullscreenOutlined, null),
|
116
131
|
onClick: function onClick() {
|
132
|
+
if (window.disabled) return;
|
117
133
|
window.fullscreenWindow(onFullscreenHandler);
|
118
134
|
}
|
119
135
|
}) : /*#__PURE__*/React.createElement(WindowOption, {
|
120
136
|
color: "var(--kep-platform-orange-4)",
|
121
137
|
icon: /*#__PURE__*/React.createElement(FullscreenExitOutlined, null),
|
122
138
|
onClick: function onClick() {
|
139
|
+
if (window.disabled) return;
|
123
140
|
window.fullscreenExitWindow();
|
124
141
|
}
|
125
142
|
}), /*#__PURE__*/React.createElement(WindowOption, {
|
126
143
|
color: "var(--kep-platform-green-3)",
|
127
144
|
icon: /*#__PURE__*/React.createElement(MinusCircleOutlined, null),
|
128
145
|
onClick: function onClick() {
|
146
|
+
if (window.disabled) return;
|
129
147
|
window.minimizeWindow();
|
130
148
|
}
|
131
149
|
}), /*#__PURE__*/React.createElement(WindowOption, {
|
132
150
|
onClick: function onClick() {
|
151
|
+
if (window.disabled) return;
|
133
152
|
window.closeWindow();
|
134
153
|
},
|
135
154
|
icon: /*#__PURE__*/React.createElement(CloseCircleOutlined, null),
|
@@ -6,5 +6,5 @@ type WindowControllerProps = {
|
|
6
6
|
window: WindowStore;
|
7
7
|
children?: ReactNode;
|
8
8
|
};
|
9
|
-
|
10
|
-
export
|
9
|
+
declare const _default: React.FunctionComponent<WindowControllerProps>;
|
10
|
+
export default _default;
|
@@ -4,18 +4,18 @@ function _extends() { _extends = Object.assign ? Object.assign.bind() : function
|
|
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; }
|
5
5
|
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; }
|
6
6
|
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
7
|
-
import { useDraggable } from '@dnd-kit/core';
|
7
|
+
import { DndContext, useDraggable } from '@dnd-kit/core';
|
8
|
+
import { observer } from 'mobx-react-lite';
|
8
9
|
import React, { useEffect } from 'react';
|
9
10
|
import styled from 'styled-components';
|
10
11
|
var WindowControllerContainer = styled.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n &:active,\n &:focus {\n outline: none;\n }\n"])));
|
11
|
-
export default function WindowController(props) {
|
12
|
+
export default observer(function WindowController(props) {
|
12
13
|
var type = props.type,
|
13
14
|
window = props.window,
|
14
15
|
children = props.children,
|
15
16
|
rest = _objectWithoutProperties(props, _excluded);
|
16
17
|
var _useDraggable = useDraggable({
|
17
|
-
id: "".concat(window.id, "/").concat(type)
|
18
|
-
disabled: window.fullscreen
|
18
|
+
id: "".concat(window.id, "/").concat(type)
|
19
19
|
}),
|
20
20
|
attributes = _useDraggable.attributes,
|
21
21
|
transform = _useDraggable.transform,
|
@@ -29,8 +29,8 @@ export default function WindowController(props) {
|
|
29
29
|
window.endControll();
|
30
30
|
}
|
31
31
|
}, [transform, isDragging, type]);
|
32
|
-
return /*#__PURE__*/React.createElement(WindowControllerContainer, _extends({}, rest, attributes, listeners, {
|
32
|
+
return /*#__PURE__*/React.createElement(DndContext, null, /*#__PURE__*/React.createElement(WindowControllerContainer, _extends({}, rest, attributes, listeners, {
|
33
33
|
ref: setNodeRef,
|
34
34
|
role: "div"
|
35
|
-
}), children);
|
36
|
-
}
|
35
|
+
}), children));
|
36
|
+
});
|
@@ -1,4 +1,5 @@
|
|
1
1
|
import { Transform } from '@dnd-kit/utilities';
|
2
|
+
import { CSSProperties } from 'react';
|
2
3
|
import { WindowControllerType } from './WindowController';
|
3
4
|
export default class WindowStore {
|
4
5
|
width: number;
|
@@ -7,6 +8,7 @@ export default class WindowStore {
|
|
7
8
|
top: number;
|
8
9
|
zIndex: number;
|
9
10
|
fullscreen: boolean;
|
11
|
+
isTransition: boolean;
|
10
12
|
id: string;
|
11
13
|
transform: {
|
12
14
|
x: number;
|
@@ -31,6 +33,7 @@ export default class WindowStore {
|
|
31
33
|
fullscreenWindow(func?: () => void): void;
|
32
34
|
fullscreenExitWindow(): void;
|
33
35
|
resetState(): void;
|
36
|
+
get disabled(): boolean;
|
34
37
|
calculateTransform(transform: Transform): {
|
35
38
|
x: number;
|
36
39
|
y: number;
|
@@ -41,24 +44,6 @@ export default class WindowStore {
|
|
41
44
|
normalizeWindow(): void;
|
42
45
|
closeWindow(): void;
|
43
46
|
focus(): void;
|
44
|
-
get style():
|
45
|
-
left: string;
|
46
|
-
top: string;
|
47
|
-
width: string;
|
48
|
-
height: string;
|
49
|
-
zIndex: number;
|
50
|
-
transform: string;
|
51
|
-
transformOrigin: string;
|
52
|
-
transition: string;
|
53
|
-
} | {
|
54
|
-
left: string;
|
55
|
-
top: string;
|
56
|
-
width: string;
|
57
|
-
height: string;
|
58
|
-
zIndex: number;
|
59
|
-
transform: string;
|
60
|
-
transition: string;
|
61
|
-
transformOrigin?: undefined;
|
62
|
-
};
|
47
|
+
get style(): CSSProperties;
|
63
48
|
get info(): string;
|
64
49
|
}
|
@@ -15,6 +15,7 @@ var WindowStore = /*#__PURE__*/function () {
|
|
15
15
|
_defineProperty(this, "top", 0);
|
16
16
|
_defineProperty(this, "zIndex", 1);
|
17
17
|
_defineProperty(this, "fullscreen", false);
|
18
|
+
_defineProperty(this, "isTransition", false);
|
18
19
|
_defineProperty(this, "id", '');
|
19
20
|
_defineProperty(this, "transform", null);
|
20
21
|
_defineProperty(this, "isMoving", false);
|
@@ -41,6 +42,7 @@ var WindowStore = /*#__PURE__*/function () {
|
|
41
42
|
fullscreen: observable,
|
42
43
|
transform: observable.struct,
|
43
44
|
isMoving: observable,
|
45
|
+
isTransition: observable,
|
44
46
|
isResizing: observable,
|
45
47
|
isClosed: observable,
|
46
48
|
fullscreenExitWindow: action,
|
@@ -56,7 +58,8 @@ var WindowStore = /*#__PURE__*/function () {
|
|
56
58
|
closeWindow: action,
|
57
59
|
resetState: action,
|
58
60
|
focus: action,
|
59
|
-
info: computed
|
61
|
+
info: computed,
|
62
|
+
disabled: computed
|
60
63
|
});
|
61
64
|
this.id = id;
|
62
65
|
this.onClosedHandler = onClosedHandler;
|
@@ -66,12 +69,14 @@ var WindowStore = /*#__PURE__*/function () {
|
|
66
69
|
value: function fullscreenWindow(func) {
|
67
70
|
this.resetState();
|
68
71
|
this.fullscreen = true;
|
72
|
+
this.isTransition = true;
|
69
73
|
func === null || func === void 0 || func();
|
70
74
|
}
|
71
75
|
}, {
|
72
76
|
key: "fullscreenExitWindow",
|
73
77
|
value: function fullscreenExitWindow() {
|
74
78
|
this.resetState();
|
79
|
+
this.isTransition = true;
|
75
80
|
this.fullscreen = false;
|
76
81
|
}
|
77
82
|
}, {
|
@@ -79,6 +84,11 @@ var WindowStore = /*#__PURE__*/function () {
|
|
79
84
|
value: function resetState() {
|
80
85
|
this.transform = null;
|
81
86
|
}
|
87
|
+
}, {
|
88
|
+
key: "disabled",
|
89
|
+
get: function get() {
|
90
|
+
return this.isTransition;
|
91
|
+
}
|
82
92
|
}, {
|
83
93
|
key: "calculateTransform",
|
84
94
|
value: function calculateTransform(transform) {
|
@@ -131,6 +141,7 @@ var WindowStore = /*#__PURE__*/function () {
|
|
131
141
|
value: function minimizeWindow() {
|
132
142
|
this.isMinimize = true;
|
133
143
|
this.fullscreen = false;
|
144
|
+
this.isTransition = true;
|
134
145
|
this.resetState();
|
135
146
|
}
|
136
147
|
}, {
|
@@ -138,12 +149,14 @@ var WindowStore = /*#__PURE__*/function () {
|
|
138
149
|
value: function normalizeWindow() {
|
139
150
|
this.isMinimize = false;
|
140
151
|
this.fullscreen = false;
|
152
|
+
this.isTransition = true;
|
141
153
|
this.resetState();
|
142
154
|
}
|
143
155
|
}, {
|
144
156
|
key: "closeWindow",
|
145
157
|
value: function closeWindow() {
|
146
158
|
this.isClosed = true;
|
159
|
+
this.isTransition = true;
|
147
160
|
this.resetState();
|
148
161
|
}
|
149
162
|
}, {
|
package/dist/Window/test.js
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
import { DndContext } from '@dnd-kit/core';
|
1
2
|
import { observer, useLocalObservable } from 'mobx-react-lite';
|
2
3
|
import React from 'react';
|
3
4
|
import { GlobalStyles } from "../__styles";
|
@@ -7,7 +8,7 @@ export default observer(function Test() {
|
|
7
8
|
var windowStore = useLocalObservable(function () {
|
8
9
|
return new WindowStore('jss');
|
9
10
|
});
|
10
|
-
return /*#__PURE__*/React.createElement(
|
11
|
+
return /*#__PURE__*/React.createElement(DndContext, null, /*#__PURE__*/React.createElement(GlobalStyles, {
|
11
12
|
$css: []
|
12
13
|
}), /*#__PURE__*/React.createElement("div", {
|
13
14
|
style: {
|
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.47",
|
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.47",
|
51
51
|
"color": "^4.2.3",
|
52
52
|
"rc-pagination": "^4.1.0"
|
53
53
|
},
|
@@ -87,5 +87,5 @@
|
|
87
87
|
"authors": [
|
88
88
|
"less-step-jss 1599925910@qq.com"
|
89
89
|
],
|
90
|
-
"gitHead": "
|
90
|
+
"gitHead": "4d341942ad974a956b2eee087f28518e33425173"
|
91
91
|
}
|