@kep-platform/basic-component 0.0.43 → 0.0.45
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/BoxShadowBox/BoxShadowBox.js +3 -4
- package/dist/Button/Button.js +13 -14
- package/dist/Columns/Columns.js +13 -17
- package/dist/Flex/flex.js +7 -11
- package/dist/Grid/Col.js +3 -4
- package/dist/Grid/Row.js +3 -4
- package/dist/Indent/Indent.js +3 -4
- package/dist/Input/Input.js +3 -4
- package/dist/List/List.js +5 -9
- package/dist/Menu/Menu.js +5 -9
- package/dist/Pagination/Pagination.js +3 -4
- package/dist/PopupBox/PopupBox.js +4 -5
- package/dist/Select/Select.js +12 -28
- package/dist/Space/Space.js +4 -8
- package/dist/Spin/Spin.js +4 -8
- package/dist/Table/Table.js +15 -46
- package/dist/Tag/Tag.js +3 -4
- package/dist/Tree/MainProperties.js +4 -8
- package/dist/Tree/Tree.js +7 -14
- package/dist/Tree/TreeNode.js +10 -20
- package/dist/Tree/test.js +3 -4
- package/dist/ViewPort/Ripple.js +4 -5
- package/dist/ViewPort/ViewPort.d.ts +0 -1
- package/dist/ViewPort/ViewPort.js +4 -8
- package/dist/ViewPort/ViewPortStore.d.ts +7 -0
- package/dist/ViewPort/ViewPortStore.js +11 -6
- package/dist/ViewPort/ViewPortWindow.d.ts +7 -14
- package/dist/ViewPort/ViewPortWindow.js +44 -36
- package/dist/ViewPort/test.js +10 -14
- package/dist/Window/Window.js +17 -54
- package/dist/Window/WindowController.js +3 -4
- package/dist/Window/WindowOption.js +4 -5
- package/dist/Window/WindowStore.d.ts +5 -2
- package/dist/Window/WindowStore.js +14 -6
- package/dist/Window/test.js +18 -46
- package/dist/__styles/GlobalStyles.js +3 -1
- package/package.json +7 -7
package/dist/Table/Table.js
CHANGED
@@ -1,5 +1,6 @@
|
|
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
2
|
var _excluded = ["render"];
|
3
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13;
|
3
4
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
4
5
|
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
6
|
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; }
|
@@ -18,6 +19,7 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
18
19
|
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; }
|
19
20
|
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; } }
|
20
21
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
22
|
+
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
21
23
|
import CaretDownOutlined from '@ant-design/icons/CaretDownOutlined';
|
22
24
|
import CaretUpOutlined from '@ant-design/icons/CaretUpOutlined';
|
23
25
|
import FilterOutlined from '@ant-design/icons/FilterOutlined';
|
@@ -32,59 +34,32 @@ import { List, ListItem } from "../List";
|
|
32
34
|
import { Pagination } from "../Pagination";
|
33
35
|
import { Popup } from "../PopupBox";
|
34
36
|
import { Space } from "../Space";
|
35
|
-
var TableContainer = styled.div
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
var
|
40
|
-
displayName: "TableTitle",
|
41
|
-
componentId: "basic-component-347b__sc-12r61fm-1"
|
42
|
-
})(["font-weight:600;padding:var(--kep-platform-padding-sm);"]);
|
43
|
-
var TableToolbar = styled.div.withConfig({
|
44
|
-
displayName: "TableToolbar",
|
45
|
-
componentId: "basic-component-347b__sc-12r61fm-2"
|
46
|
-
})(["text-align:right;padding:var(--kep-platform-padding-sm);"]);
|
47
|
-
var TableHeaderRow = styled(Columns).withConfig({
|
48
|
-
displayName: "TableHeaderRow",
|
49
|
-
componentId: "basic-component-347b__sc-12r61fm-3"
|
50
|
-
})(["border-bottom:var(--kep-platform-line-width) solid var(--kep-platform-color-table-border);position:sticky;top:0;left:0;z-index:calc(var(--kep-platform-z-index-fixed) + 5);& ", "{background-color:var(--kep-platform-header-bg);font-weight:600;position:sticky;&:not(:last-child):after{content:'';width:1px;height:calc(100% - 2 * var(--kep-platform-padding-xs));position:absolute;top:var(--kep-platform-padding-xs);right:0;background-color:var(--kep-platform-color-border-secondary);}}"], Column);
|
51
|
-
var TableBody = styled(List).withConfig({
|
52
|
-
displayName: "TableBody",
|
53
|
-
componentId: "basic-component-347b__sc-12r61fm-4"
|
54
|
-
})([""]);
|
37
|
+
var TableContainer = styled.div(_templateObject || (_templateObject = _taggedTemplateLiteral([""])));
|
38
|
+
var TableTitle = styled.h5(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n font-weight: 600;\n padding: var(--kep-platform-padding-sm);\n"])));
|
39
|
+
var TableToolbar = styled.div(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n text-align: right;\n padding: var(--kep-platform-padding-sm);\n"])));
|
40
|
+
var TableHeaderRow = styled(Columns)(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n border-bottom: var(--kep-platform-line-width) solid var(--kep-platform-color-table-border);\n position: sticky;\n top: 0;\n left: 0;\n z-index: calc(var(--kep-platform-z-index-fixed) + 5);\n & ", " {\n background-color: var(--kep-platform-header-bg);\n font-weight: 600;\n position: sticky;\n &:not(:last-child):after {\n content: '';\n width: 1px;\n height: calc(100% - 2 * var(--kep-platform-padding-xs));\n position: absolute;\n top: var(--kep-platform-padding-xs);\n right: 0;\n background-color: var(--kep-platform-color-border-secondary);\n }\n }\n"])), Column);
|
41
|
+
var TableBody = styled(List)(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral([""])));
|
55
42
|
var TableBodyRow = styled(ListItem).withConfig({
|
56
43
|
shouldForwardProp: function shouldForwardProp(prop) {
|
57
44
|
return !['isActive'].includes(prop);
|
58
45
|
}
|
59
|
-
})
|
60
|
-
displayName: "TableBodyRow",
|
61
|
-
componentId: "basic-component-347b__sc-12r61fm-5"
|
62
|
-
})(["& ", "{", "}"], Column, function (props) {
|
46
|
+
})(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n & ", " {\n ", "\n }\n"])), Column, function (props) {
|
63
47
|
if (props.isActive) {
|
64
|
-
return css(["background-color:var(--kep-platform-color-bg-active) !important
|
48
|
+
return css(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n background-color: var(--kep-platform-color-bg-active) !important;\n "])));
|
65
49
|
}
|
66
50
|
});
|
67
|
-
var TableContent = styled.div
|
68
|
-
displayName: "TableContent",
|
69
|
-
componentId: "basic-component-347b__sc-12r61fm-6"
|
70
|
-
})(["position:relative;overflow:auto;border-radius:var(--kep-platform-border-radius);box-shadow:var(--kep-platform-box-shadow-tertiary);", ""], function (props) {
|
51
|
+
var TableContent = styled.div(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n position: relative;\n overflow: auto;\n border-radius: var(--kep-platform-border-radius);\n box-shadow: var(--kep-platform-box-shadow-tertiary);\n ", "\n"])), function (props) {
|
71
52
|
var _props$scroll;
|
72
53
|
if ((_props$scroll = props.scroll) !== null && _props$scroll !== void 0 && _props$scroll.y) {
|
73
|
-
return css(["height:", "px
|
54
|
+
return css(_templateObject9 || (_templateObject9 = _taggedTemplateLiteral(["\n height: ", "px;\n "])), props.scroll.y);
|
74
55
|
}
|
75
56
|
});
|
76
|
-
var SortIconList = styled(List)
|
77
|
-
displayName: "SortIconList",
|
78
|
-
componentId: "basic-component-347b__sc-12r61fm-7"
|
79
|
-
})([""]);
|
57
|
+
var SortIconList = styled(List)(_templateObject10 || (_templateObject10 = _taggedTemplateLiteral([""])));
|
80
58
|
var SortIconListItem = styled(ListItem).withConfig({
|
81
59
|
shouldForwardProp: function shouldForwardProp(prop) {
|
82
60
|
return !['active'].includes(prop);
|
83
61
|
}
|
84
|
-
})
|
85
|
-
displayName: "SortIconListItem",
|
86
|
-
componentId: "basic-component-347b__sc-12r61fm-8"
|
87
|
-
})(["height:10px;line-height:10px;font-size:10px;cursor:pointer;user-select:none;color:", ";"], function (props) {
|
62
|
+
})(_templateObject11 || (_templateObject11 = _taggedTemplateLiteral(["\n height: 10px;\n line-height: 10px;\n font-size: 10px;\n cursor: pointer;\n user-select: none;\n color: ", ";\n"])), function (props) {
|
88
63
|
return props.active ? 'var(--kep-platform-color-primary)' : 'currentColor';
|
89
64
|
});
|
90
65
|
var SortIconGroup = function SortIconGroup(_ref) {
|
@@ -115,14 +90,8 @@ var SortIconGroup = function SortIconGroup(_ref) {
|
|
115
90
|
active: sorter === 'desc'
|
116
91
|
}, /*#__PURE__*/React.createElement(CaretDownOutlined, null)));
|
117
92
|
};
|
118
|
-
var ColumnTitle = styled.div
|
119
|
-
|
120
|
-
componentId: "basic-component-347b__sc-12r61fm-9"
|
121
|
-
})([""]);
|
122
|
-
var FilterValue = styled.span.withConfig({
|
123
|
-
displayName: "FilterValue",
|
124
|
-
componentId: "basic-component-347b__sc-12r61fm-10"
|
125
|
-
})(["color:var(--kep-platform-color-primary);cursor:pointer;padding:var(--kep-platform-padding-xxs);border-radius:var(--kep-platform-border-radius-sm);&:hover{background-color:var(--kep-platform-color-bg-active);}"]);
|
93
|
+
var ColumnTitle = styled.div(_templateObject12 || (_templateObject12 = _taggedTemplateLiteral([""])));
|
94
|
+
var FilterValue = styled.span(_templateObject13 || (_templateObject13 = _taggedTemplateLiteral(["\n color: var(--kep-platform-color-primary);\n cursor: pointer;\n padding: var(--kep-platform-padding-xxs);\n border-radius: var(--kep-platform-border-radius-sm);\n &:hover {\n background-color: var(--kep-platform-color-bg-active);\n }\n"])));
|
126
95
|
var ColumnTitleController = function ColumnTitleController(_ref2) {
|
127
96
|
var onSorterChange = _ref2.onSorterChange,
|
128
97
|
title = _ref2.title,
|
package/dist/Tag/Tag.js
CHANGED
@@ -1,13 +1,12 @@
|
|
1
1
|
var _excluded = ["children"];
|
2
|
+
var _templateObject;
|
2
3
|
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; }
|
3
4
|
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; }
|
5
|
+
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
4
6
|
import React from 'react';
|
5
7
|
import styled from 'styled-components';
|
6
8
|
import theme from "../__consts/theme";
|
7
|
-
var StyledTag = styled.span.
|
8
|
-
displayName: "StyledTag",
|
9
|
-
componentId: "basic-component-347b__sc-14fuyeq-0"
|
10
|
-
})(["background-color:", ";color:1px soild ", ";"], theme.defaultTagBackgroundColor, theme.defaultTagColor);
|
9
|
+
var StyledTag = styled.span(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n background-color: ", ";\n color: 1px soild ", ";\n"])), theme.defaultTagBackgroundColor, theme.defaultTagColor);
|
11
10
|
var Tag = function Tag(_ref) {
|
12
11
|
var children = _ref.children,
|
13
12
|
rest = _objectWithoutProperties(_ref, _excluded);
|
@@ -1,14 +1,10 @@
|
|
1
|
+
var _templateObject, _templateObject2;
|
2
|
+
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
1
3
|
import React, { forwardRef } from 'react';
|
2
4
|
import styled from 'styled-components';
|
3
5
|
import { Flex, FlexItem } from "../Flex";
|
4
|
-
export var MainArea = styled(FlexItem)
|
5
|
-
|
6
|
-
componentId: "basic-component-347b__sc-u1pspr-0"
|
7
|
-
})(["overflow:hidden;position:sticky;left:0;z-index:20;align-self:stretch;display:flex;align-items:center;border-right:var(--kep-platform-line-width) var(--kep-platform-line-type) var(--kep-platform-color-border-secondary);border-bottom:var(--kep-platform-line-width) var(--kep-platform-line-type) var(--kep-platform-color-border-secondary);"]);
|
8
|
-
var PropertiesArea = styled(FlexItem).withConfig({
|
9
|
-
displayName: "PropertiesArea",
|
10
|
-
componentId: "basic-component-347b__sc-u1pspr-1"
|
11
|
-
})([""]);
|
6
|
+
export var MainArea = styled(FlexItem)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n overflow: hidden;\n position: sticky;\n left: 0;\n z-index: 20;\n align-self: stretch;\n display: flex;\n align-items: center;\n border-right: var(--kep-platform-line-width) var(--kep-platform-line-type)\n var(--kep-platform-color-border-secondary);\n border-bottom: var(--kep-platform-line-width) var(--kep-platform-line-type)\n var(--kep-platform-color-border-secondary);\n"])));
|
7
|
+
var PropertiesArea = styled(FlexItem)(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral([""])));
|
12
8
|
/* 有属性就渲染属性,没有属性就不处理 */
|
13
9
|
export var MainProperty = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
14
10
|
var mainWidth = _ref.mainWidth,
|
package/dist/Tree/Tree.js
CHANGED
@@ -1,7 +1,9 @@
|
|
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
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5;
|
2
3
|
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; }
|
3
4
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
4
5
|
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); }
|
6
|
+
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
5
7
|
import { observer } from 'mobx-react-lite';
|
6
8
|
import React, { useCallback, useMemo, useRef } from 'react';
|
7
9
|
import styled, { css } from 'styled-components';
|
@@ -15,29 +17,20 @@ var TreeContainer = styled('div').withConfig({
|
|
15
17
|
shouldForwardProp: function shouldForwardProp(prop) {
|
16
18
|
return !['bordered'].includes(prop);
|
17
19
|
}
|
18
|
-
})
|
19
|
-
displayName: "TreeContainer",
|
20
|
-
componentId: "basic-component-347b__sc-n4lkq9-0"
|
21
|
-
})(["position:relative;overflow-x:auto;border:1px solid var(--kep-platform-color-border-secondary);border-width:", ";"], function (props) {
|
20
|
+
})(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n position: relative;\n overflow-x: auto;\n border: 1px solid var(--kep-platform-color-border-secondary);\n border-width: ", ";\n"])), function (props) {
|
22
21
|
return props.bordered ? '1px' : 0;
|
23
22
|
});
|
24
|
-
var TreeBody = styled(List)
|
25
|
-
displayName: "TreeBody",
|
26
|
-
componentId: "basic-component-347b__sc-n4lkq9-1"
|
27
|
-
})([""]);
|
23
|
+
var TreeBody = styled(List)(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral([""])));
|
28
24
|
var TreeHeader = styled('div').withConfig({
|
29
25
|
shouldForwardProp: function shouldForwardProp(prop) {
|
30
26
|
return !['width', 'isFlex'].includes(prop);
|
31
27
|
}
|
32
|
-
})
|
33
|
-
displayName: "TreeHeader",
|
34
|
-
componentId: "basic-component-347b__sc-n4lkq9-2"
|
35
|
-
})(["", " background-color:var(--kep-platform-header-bg);& ", ",& ", "{background-color:var(--kep-platform-header-bg);font-weight:600;position:sticky;}"], function (props) {
|
28
|
+
})(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n ", "\n background-color: var(--kep-platform-header-bg);\n & ", ",& ", " {\n background-color: var(--kep-platform-header-bg);\n font-weight: 600;\n position: sticky;\n }\n"])), function (props) {
|
36
29
|
if (props.isFlex) {
|
37
|
-
return css(["width:100
|
30
|
+
return css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n width: 100%;\n "])));
|
38
31
|
}
|
39
32
|
if (props.width) {
|
40
|
-
return css(["width:", "px
|
33
|
+
return css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n width: ", "px;\n "])), props.width);
|
41
34
|
}
|
42
35
|
}, Column, MainArea);
|
43
36
|
var rootLevel = -1;
|
package/dist/Tree/TreeNode.js
CHANGED
@@ -1,9 +1,11 @@
|
|
1
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8;
|
1
2
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
2
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."); }
|
3
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); }
|
4
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; }
|
5
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; } }
|
6
7
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
8
|
+
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
7
9
|
import { CaretRightOutlined } from '@ant-design/icons';
|
8
10
|
import { observer } from 'mobx-react-lite';
|
9
11
|
import React, { useCallback, useMemo, useState } from 'react';
|
@@ -18,36 +20,24 @@ var ExpandedIcon = styled(CaretRightOutlined).withConfig({
|
|
18
20
|
shouldForwardProp: function shouldForwardProp(prop) {
|
19
21
|
return !['expanded'].includes(prop);
|
20
22
|
}
|
21
|
-
}).
|
22
|
-
displayName: "ExpandedIcon",
|
23
|
-
componentId: "basic-component-347b__sc-tzoomn-0"
|
24
|
-
})(["transition:transform 0.5s;display:block;user-select:none;", ";font-size:var(--kep-platform-font-size-sm);&:hover{color:var(--kep-platform-color-primary);}"], function (props) {
|
23
|
+
})(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n transition: transform 0.5s;\n display: block;\n user-select: none;\n ", ";\n font-size: var(--kep-platform-font-size-sm);\n &:hover {\n color: var(--kep-platform-color-primary);\n }\n"])), function (props) {
|
25
24
|
if (props.expanded) {
|
26
|
-
return css(["transform:rotate(90deg)
|
25
|
+
return css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n transform: rotate(90deg);\n "])));
|
27
26
|
}
|
28
27
|
});
|
29
|
-
var TitleArea = styled(FlexItem)
|
30
|
-
|
31
|
-
componentId: "basic-component-347b__sc-tzoomn-1"
|
32
|
-
})([""]);
|
33
|
-
var TreeNode = styled(ListItem).withConfig({
|
34
|
-
displayName: "TreeNode",
|
35
|
-
componentId: "basic-component-347b__sc-tzoomn-2"
|
36
|
-
})(["", " & ", ",& ", "{background-color:var(--kep-platform-color-bg-base);}&:hover{background-color:var(--kep-platform-color-bg-hover);& ", ",& ", "{background-color:var(--kep-platform-color-bg-hover);}& ", "{overflow-x:auto;& > ", "{width:auto;}}& ", "{overflow-x:auto;}}", ""], function (props) {
|
28
|
+
var TitleArea = styled(FlexItem)(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral([""])));
|
29
|
+
var TreeNode = styled(ListItem)(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n ", "\n & ", ",& ", " {\n background-color: var(--kep-platform-color-bg-base);\n }\n /* \u5904\u7406\u9F20\u6807\u79FB\u5165 */\n &:hover {\n background-color: var(--kep-platform-color-bg-hover);\n & ", ", & ", " {\n background-color: var(--kep-platform-color-bg-hover);\n }\n & ", " {\n overflow-x: auto;\n & > ", " {\n width: auto;\n }\n }\n & ", " {\n overflow-x: auto;\n }\n }\n /* \u5904\u7406\u8282\u70B9\u9009\u4E2D */\n ", "\n"])), function (props) {
|
37
30
|
if (props.width) {
|
38
|
-
return css(["width:", "px
|
31
|
+
return css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n width: ", "px;\n "])), props.width);
|
39
32
|
}
|
40
33
|
}, Column, MainArea, Column, MainArea, MainArea, Flex, TitleArea, function (props) {
|
41
34
|
if (props.selected) {
|
42
|
-
return css(["background-color:var(--kep-platform-color-bg-active) !important
|
35
|
+
return css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n background-color: var(--kep-platform-color-bg-active) !important;\n color: var(--kep-platform-color-text-active) !important;\n & ", ", & ", " {\n background-color: var(--kep-platform-color-bg-active) !important;\n color: var(--kep-platform-color-text-active) !important;\n }\n & ", " {\n overflow-x: auto;\n & > ", " {\n width: auto;\n }\n }\n & ", " {\n overflow-x: auto;\n }\n "])), Column, MainArea, MainArea, Flex, TitleArea);
|
43
36
|
}
|
44
37
|
});
|
45
|
-
var TreeNodeGroupNode = styled.li
|
46
|
-
displayName: "TreeNodeGroupNode",
|
47
|
-
componentId: "basic-component-347b__sc-tzoomn-3"
|
48
|
-
})(["height:40px;line-height:40px;background-color:var(--kep-platform-color-primary);color:var(--kep-platform-color-white);& span{color:var(--kep-platform-color-white) !important;}cursor:pointer;", ""], function (props) {
|
38
|
+
var TreeNodeGroupNode = styled.li(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n height: 40px;\n line-height: 40px;\n background-color: var(--kep-platform-color-primary);\n color: var(--kep-platform-color-white);\n & span {\n color: var(--kep-platform-color-white) !important;\n }\n cursor: pointer;\n ", "\n"])), function (props) {
|
49
39
|
if (props.width) {
|
50
|
-
return css(["width:", "px
|
40
|
+
return css(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n width: ", "px;\n "])), props.width);
|
51
41
|
}
|
52
42
|
});
|
53
43
|
var TreeNodeGroup = function TreeNodeGroup(props) {
|
package/dist/Tree/test.js
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
var _templateObject;
|
1
2
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
2
3
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
3
4
|
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."); }
|
@@ -5,6 +6,7 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
5
6
|
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
7
|
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
8
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
9
|
+
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
8
10
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
9
11
|
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
12
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
@@ -110,10 +112,7 @@ var mystore = new MyStore([{
|
|
110
112
|
count: 2
|
111
113
|
}]
|
112
114
|
}]);
|
113
|
-
var Title = styled.div
|
114
|
-
displayName: "Title",
|
115
|
-
componentId: "basic-component-347b__sc-bc9b32-0"
|
116
|
-
})(["width:100%;text-align:center;"]);
|
115
|
+
var Title = styled.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n width: 100%;\n text-align: center;\n"])));
|
117
116
|
export default (function () {
|
118
117
|
var _useState = useState([]),
|
119
118
|
_useState2 = _slicedToArray(_useState, 2),
|
package/dist/ViewPort/Ripple.js
CHANGED
@@ -1,18 +1,17 @@
|
|
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
|
+
var _templateObject, _templateObject2;
|
2
3
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
3
4
|
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); } }
|
4
5
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
5
6
|
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
7
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
7
8
|
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); }
|
9
|
+
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
8
10
|
import { makeAutoObservable } from 'mobx';
|
9
11
|
import React from 'react';
|
10
12
|
import styled, { keyframes } from 'styled-components';
|
11
|
-
var rippleAnimation = keyframes(["from{transform:scale(1)
|
12
|
-
export var Ripple = styled.div
|
13
|
-
displayName: "Ripple",
|
14
|
-
componentId: "basic-component-347b__sc-zqrqyo-0"
|
15
|
-
})(["position:absolute;border-radius:50%;width:10px;height:10px;background-color:#fff0;& > div{position:absolute;left:0;top:0;width:10px;height:10px;background-color:#fff;border-radius:50%;margin-left:-5px;margin-top:-5px;transform:scale(0);animation:", " 500ms linear;}& .first{}& .second{animation-delay:150ms;}"], rippleAnimation);
|
13
|
+
var rippleAnimation = keyframes(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n from {\n transform: scale(1);\n }\n to {\n\n transform: scale(4);\n opacity: 0;\n }\n"])));
|
14
|
+
export var Ripple = styled.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n position: absolute;\n border-radius: 50%;\n width: 10px;\n height: 10px;\n background-color: #fff0;\n & > div {\n position: absolute;\n left: 0;\n top: 0;\n width: 10px;\n height: 10px;\n background-color: #fff;\n border-radius: 50%;\n margin-left: -5px;\n margin-top: -5px;\n transform: scale(0);\n animation: ", " 500ms linear;\n }\n & .first {\n }\n & .second {\n animation-delay: 150ms;\n }\n"])), rippleAnimation);
|
16
15
|
export var RippleManagerStore = /*#__PURE__*/function () {
|
17
16
|
function RippleManagerStore() {
|
18
17
|
_classCallCheck(this, RippleManagerStore);
|
@@ -9,7 +9,6 @@ type ViewPortProps = {
|
|
9
9
|
declare function ViewPort(props: ViewPortProps): React.JSX.Element;
|
10
10
|
declare namespace ViewPort {
|
11
11
|
var Window: React.FunctionComponent<import("../Window/Window").WindowProps & {
|
12
|
-
viewPortStore: ViewPortStore;
|
13
12
|
window: import("./ViewPortWindow").ViewPortWindowStore;
|
14
13
|
}>;
|
15
14
|
}
|
@@ -1,22 +1,18 @@
|
|
1
1
|
var _excluded = ["children", "viewPortStore", "onScroll", "onScale"],
|
2
2
|
_excluded2 = ["children", "viewPortStore"];
|
3
|
+
var _templateObject, _templateObject2;
|
3
4
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
4
5
|
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
6
|
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
|
+
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
6
8
|
import { DndContext, useDraggable } from '@dnd-kit/core';
|
7
9
|
import { observer } from 'mobx-react-lite';
|
8
10
|
import React, { useEffect, useRef } from 'react';
|
9
11
|
import styled from 'styled-components';
|
10
12
|
import { RippleManagerStore } from "./Ripple";
|
11
13
|
import { ViewPortWindow } from "./ViewPortWindow";
|
12
|
-
var Container = styled.div
|
13
|
-
|
14
|
-
componentId: "basic-component-347b__sc-1qpmpop-0"
|
15
|
-
})(["position:relative;border:1px solid #eee;box-shadow:0 0 7px 0 inset #fefefe;"]);
|
16
|
-
var Content = styled.div.withConfig({
|
17
|
-
displayName: "Content",
|
18
|
-
componentId: "basic-component-347b__sc-1qpmpop-1"
|
19
|
-
})(["position:absolute;"]);
|
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
|
+
var Content = styled.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n position: absolute;\n"])));
|
20
16
|
var rippleManagerStore = new RippleManagerStore();
|
21
17
|
var ViewPortEntity = observer(function (props) {
|
22
18
|
var children = props.children,
|
@@ -37,6 +37,13 @@ export declare class ViewPortStore {
|
|
37
37
|
height: number;
|
38
38
|
scale: number;
|
39
39
|
};
|
40
|
+
posInViewPort(left: number, top: number, width: number, height: number): {
|
41
|
+
left: number;
|
42
|
+
top: number;
|
43
|
+
width: number;
|
44
|
+
height: number;
|
45
|
+
scale: number;
|
46
|
+
};
|
40
47
|
get containerStyle(): CSSProperties;
|
41
48
|
get info(): string;
|
42
49
|
}
|
@@ -131,20 +131,25 @@ export var ViewPortStore = /*#__PURE__*/function () {
|
|
131
131
|
width: this.width * this.ratio + 'px',
|
132
132
|
height: this.height * this.ratio + 'px',
|
133
133
|
transformOrigin: 'left top',
|
134
|
-
transition: this.isMoving ? 'none' : 'all
|
134
|
+
transition: this.isMoving ? 'none' : 'all 1s ease-in-out',
|
135
135
|
background: '#188fff67',
|
136
136
|
cursor: this.isMoving ? 'grab' : 'default'
|
137
137
|
};
|
138
138
|
}
|
139
|
-
/* 计算得到实际显示区域的偏移量 */
|
140
139
|
}, {
|
141
140
|
key: "viewPortRect",
|
142
141
|
get: function get() {
|
142
|
+
return this.posInViewPort(0, 0, this.width, this.height);
|
143
|
+
}
|
144
|
+
/* 这个函数比较重要,因为你想要让content中的元素在视窗相对位置显示,这个函数会帮你计算偏移量和缩放量,直接得出你的元素应该在content中的偏移量 */
|
145
|
+
}, {
|
146
|
+
key: "posInViewPort",
|
147
|
+
value: function posInViewPort(left, top, width, height) {
|
143
148
|
return {
|
144
|
-
left: -this.transform.left + this.offsetLeft,
|
145
|
-
top: -this.transform.top + this.offsetTop,
|
146
|
-
width: this.
|
147
|
-
height: this.
|
149
|
+
left: (-this.transform.left + this.offsetLeft + left) / this.scale,
|
150
|
+
top: (-this.transform.top + this.offsetTop + top) / this.scale,
|
151
|
+
width: width / this.scale,
|
152
|
+
height: height / this.scale,
|
148
153
|
scale: this.scale
|
149
154
|
};
|
150
155
|
}
|
@@ -5,7 +5,7 @@ import { WindowProps } from '../Window/Window';
|
|
5
5
|
import { WindowControllerType } from '../Window/WindowController';
|
6
6
|
import { ViewPortStore } from './ViewPortStore';
|
7
7
|
export declare class ViewPortWindowStore extends WindowStore {
|
8
|
-
|
8
|
+
viewPortStore: ViewPortStore;
|
9
9
|
get style(): {
|
10
10
|
left: string;
|
11
11
|
top: string;
|
@@ -13,17 +13,8 @@ export declare class ViewPortWindowStore extends WindowStore {
|
|
13
13
|
height: string;
|
14
14
|
zIndex: number;
|
15
15
|
transform: string;
|
16
|
+
transformOrigin: string;
|
16
17
|
transition: string;
|
17
|
-
transformOrigin?: undefined;
|
18
|
-
} | {
|
19
|
-
left: string;
|
20
|
-
top: string;
|
21
|
-
width: number;
|
22
|
-
height: number;
|
23
|
-
zIndex: number;
|
24
|
-
transform: string;
|
25
|
-
transition: string;
|
26
|
-
transformOrigin?: undefined;
|
27
18
|
} | {
|
28
19
|
left: string;
|
29
20
|
top: string;
|
@@ -31,17 +22,19 @@ export declare class ViewPortWindowStore extends WindowStore {
|
|
31
22
|
height: string;
|
32
23
|
zIndex: number;
|
33
24
|
transform: string;
|
34
|
-
transformOrigin: string;
|
35
25
|
transition: string;
|
26
|
+
transformOrigin?: undefined;
|
36
27
|
};
|
28
|
+
focus(): void;
|
37
29
|
calculateTransform(transform: Transform): {
|
38
30
|
x: number;
|
39
31
|
y: number;
|
40
32
|
};
|
41
33
|
controll(transform: Transform, type: WindowControllerType): void;
|
42
|
-
|
34
|
+
centerDisplay(): void;
|
35
|
+
fullscreenWindow(func?: () => void): void;
|
36
|
+
constructor(id: string, viewPort: ViewPortStore, onClosedHandler?: (id: string) => void);
|
43
37
|
}
|
44
38
|
export declare const ViewPortWindow: React.FunctionComponent<WindowProps & {
|
45
|
-
viewPortStore: ViewPortStore;
|
46
39
|
window: ViewPortWindowStore;
|
47
40
|
}>;
|
@@ -1,4 +1,4 @@
|
|
1
|
-
var _excluded = ["
|
1
|
+
var _excluded = ["window"];
|
2
2
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
3
3
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
4
4
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
@@ -16,7 +16,7 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
16
16
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
17
17
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
18
18
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
19
|
-
import {
|
19
|
+
import { action, makeObservable, override } from 'mobx';
|
20
20
|
import { observer } from 'mobx-react-lite';
|
21
21
|
import React, { useEffect } from 'react';
|
22
22
|
import { WindowStore } from "../Window";
|
@@ -24,15 +24,17 @@ import { default as Window } from "../Window/Window";
|
|
24
24
|
export var ViewPortWindowStore = /*#__PURE__*/function (_WindowStore) {
|
25
25
|
_inherits(ViewPortWindowStore, _WindowStore);
|
26
26
|
var _super = _createSuper(ViewPortWindowStore);
|
27
|
-
function ViewPortWindowStore(id, onClosedHandler) {
|
27
|
+
function ViewPortWindowStore(id, viewPort, onClosedHandler) {
|
28
28
|
var _this;
|
29
29
|
_classCallCheck(this, ViewPortWindowStore);
|
30
30
|
_this = _super.call(this, id, onClosedHandler);
|
31
|
-
_defineProperty(_assertThisInitialized(_this), "
|
31
|
+
_defineProperty(_assertThisInitialized(_this), "viewPortStore", void 0);
|
32
|
+
_this.viewPortStore = viewPort;
|
32
33
|
makeObservable(_assertThisInitialized(_this), {
|
33
34
|
style: override,
|
34
|
-
|
35
|
-
|
35
|
+
controll: override,
|
36
|
+
focus: override,
|
37
|
+
centerDisplay: action
|
36
38
|
});
|
37
39
|
return _this;
|
38
40
|
}
|
@@ -47,6 +49,7 @@ export var ViewPortWindowStore = /*#__PURE__*/function (_WindowStore) {
|
|
47
49
|
height: this.height + 'px',
|
48
50
|
zIndex: this.zIndex,
|
49
51
|
transform: 'scale(0)',
|
52
|
+
transformOrigin: 'center center',
|
50
53
|
transition: 'all 0.5s ease-out'
|
51
54
|
};
|
52
55
|
}
|
@@ -54,21 +57,22 @@ export var ViewPortWindowStore = /*#__PURE__*/function (_WindowStore) {
|
|
54
57
|
return {
|
55
58
|
left: this.minimizePos.left + 'px',
|
56
59
|
top: this.minimizePos.top + 'px',
|
57
|
-
width:
|
58
|
-
height:
|
60
|
+
width: this.width + 'px',
|
61
|
+
height: this.height + 'px',
|
59
62
|
zIndex: this.zIndex,
|
60
63
|
transform: 'scale(0)',
|
61
|
-
|
64
|
+
transformOrigin: 'left top',
|
65
|
+
transition: "all ".concat(0.5 + this.viewPortStore.scale, "s ease-out")
|
62
66
|
};
|
63
67
|
}
|
64
68
|
if (this.fullscreen) {
|
65
69
|
return {
|
66
|
-
left: this.fullscreenPos.left
|
67
|
-
top: this.fullscreenPos.top
|
68
|
-
width: this.fullscreenPos.width + 'px',
|
69
|
-
height: this.fullscreenPos.height + 'px',
|
70
|
+
left: this.fullscreenPos.left + 'px',
|
71
|
+
top: this.fullscreenPos.top + 'px',
|
72
|
+
width: this.fullscreenPos.width * this.viewPortStore.scale + 'px',
|
73
|
+
height: this.fullscreenPos.height * this.viewPortStore.scale + 'px',
|
70
74
|
zIndex: this.zIndex,
|
71
|
-
transform: "scale(".concat(1 / this.scale, ")
|
75
|
+
transform: "scale(".concat(1 / this.viewPortStore.scale, ")"),
|
72
76
|
transformOrigin: 'left top',
|
73
77
|
transition: 'width height 0.5s ease-out'
|
74
78
|
};
|
@@ -94,13 +98,18 @@ export var ViewPortWindowStore = /*#__PURE__*/function (_WindowStore) {
|
|
94
98
|
transition: 'all 0.5s ease-out'
|
95
99
|
};
|
96
100
|
}
|
101
|
+
}, {
|
102
|
+
key: "focus",
|
103
|
+
value: function focus() {
|
104
|
+
this.zIndex = ++this.viewPortStore.maxZIndex;
|
105
|
+
}
|
97
106
|
}, {
|
98
107
|
key: "calculateTransform",
|
99
108
|
value: function calculateTransform(transform) {
|
100
109
|
var _this$transform, _this$transform2;
|
101
110
|
return {
|
102
|
-
x: (transform.x - (((_this$transform = this.transform) === null || _this$transform === void 0 ? void 0 : _this$transform.x) || 0)) / this.scale,
|
103
|
-
y: (transform.y - (((_this$transform2 = this.transform) === null || _this$transform2 === void 0 ? void 0 : _this$transform2.y) || 0)) / this.scale
|
111
|
+
x: (transform.x - (((_this$transform = this.transform) === null || _this$transform === void 0 ? void 0 : _this$transform.x) || 0)) / this.viewPortStore.scale,
|
112
|
+
y: (transform.y - (((_this$transform2 = this.transform) === null || _this$transform2 === void 0 ? void 0 : _this$transform2.y) || 0)) / this.viewPortStore.scale
|
104
113
|
};
|
105
114
|
}
|
106
115
|
}, {
|
@@ -134,33 +143,32 @@ export var ViewPortWindowStore = /*#__PURE__*/function (_WindowStore) {
|
|
134
143
|
}
|
135
144
|
this.transform = transform;
|
136
145
|
}
|
146
|
+
}, {
|
147
|
+
key: "centerDisplay",
|
148
|
+
value: function centerDisplay() {
|
149
|
+
this.focus();
|
150
|
+
var rect = this.viewPortStore.viewPortRect;
|
151
|
+
this.left = rect.left + Math.max(0, rect.width - this.width) / 2;
|
152
|
+
this.top = rect.top + Math.max(0, rect.height - this.height) / 2;
|
153
|
+
}
|
154
|
+
}, {
|
155
|
+
key: "fullscreenWindow",
|
156
|
+
value: function fullscreenWindow(func) {
|
157
|
+
this.resetState();
|
158
|
+
this.fullscreen = true;
|
159
|
+
func === null || func === void 0 || func();
|
160
|
+
this.fullscreenPos = this.viewPortStore.viewPortRect;
|
161
|
+
}
|
137
162
|
}]);
|
138
163
|
return ViewPortWindowStore;
|
139
164
|
}(WindowStore);
|
140
165
|
export var ViewPortWindow = observer(function ViewPortWindow(props) {
|
141
|
-
var
|
142
|
-
window = props.window,
|
166
|
+
var window = props.window,
|
143
167
|
rest = _objectWithoutProperties(props, _excluded);
|
144
168
|
useEffect(function () {
|
145
|
-
|
146
|
-
var rect = viewPortStore.viewPortRect;
|
147
|
-
window.fullscreenPos = rect;
|
148
|
-
window.scale = rect.scale;
|
149
|
-
});
|
150
|
-
}, [viewPortStore.viewPortRect]);
|
151
|
-
useEffect(function () {
|
152
|
-
var rect = viewPortStore.viewPortRect;
|
153
|
-
/* rect.width/rect.scale就是实际上显示区域内容区的宽度 */
|
154
|
-
window.left = rect.left + Math.max(0, rect.width / rect.scale - window.width) / 2;
|
155
|
-
window.top = rect.top + Math.max(0, rect.height / rect.scale - window.height) / 2;
|
156
|
-
window.zIndex = ++viewPortStore.maxZIndex;
|
169
|
+
window.centerDisplay();
|
157
170
|
}, []);
|
158
171
|
return /*#__PURE__*/React.createElement(Window, _extends({
|
159
172
|
window: window
|
160
|
-
}, rest
|
161
|
-
onFocusHandler: function onFocusHandler() {
|
162
|
-
viewPortStore.maxZIndex++;
|
163
|
-
window.zIndex = viewPortStore.maxZIndex;
|
164
|
-
}
|
165
|
-
}));
|
173
|
+
}, rest));
|
166
174
|
});
|