@cloud-app-dev/vidc 2.0.0-alpha.1 → 2.0.0-alpha.13
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/.umirc.ts +2 -3
- package/es/Api/index.d.ts +3 -4
- package/es/Api/index.js +7 -8
- package/es/AppRedirect/index.css +0 -0
- package/es/AppRedirect/index.d.ts +16 -0
- package/es/AppRedirect/index.js +34 -0
- package/es/AppRoute/index.d.ts +10 -0
- package/es/AppRoute/index.js +115 -0
- package/es/AppRoute/interface.d.ts +8 -0
- package/es/Auth/index.d.ts +8 -0
- package/es/Auth/index.js +17 -0
- package/es/AutoExit/index.js +15 -10
- package/es/Box/BetweenBox/index.css +5 -0
- package/es/Box/BetweenBox/index.d.ts +12 -0
- package/es/Box/BetweenBox/index.js +24 -0
- package/es/Box/InfoBox/index.css +23 -0
- package/es/Box/InfoBox/index.d.ts +12 -0
- package/es/Box/InfoBox/index.js +26 -0
- package/es/Box/TwoColumnBox/index.css +77 -0
- package/es/Box/TwoColumnBox/index.d.ts +10 -0
- package/es/Box/TwoColumnBox/index.js +50 -0
- package/es/Box/deps/content-grid.d.ts +9 -0
- package/es/Box/deps/content-grid.js +9 -0
- package/es/Box/deps/grid-factory.d.ts +10 -0
- package/es/Box/deps/grid-factory.js +72 -0
- package/es/Box/deps/simple-grid.d.ts +9 -0
- package/es/Box/deps/simple-grid.js +8 -0
- package/es/Box/index.css +9 -0
- package/es/Box/index.d.ts +14 -0
- package/es/Box/index.js +28 -0
- package/es/CheckGroupFixed/index.css +49 -0
- package/es/CheckGroupFixed/index.d.ts +17 -0
- package/es/CheckGroupFixed/index.js +148 -0
- package/es/Config/index.js +63 -6
- package/es/Config/interface.d.ts +30 -5
- package/es/Config/utils.d.ts +2 -11
- package/es/Config/utils.js +1 -12
- package/es/ConfigContext/index.d.ts +3 -0
- package/es/DeviceIcon/icon.js +5 -5
- package/es/DeviceIcon/index.js +2 -2
- package/es/DeviceSelect/TreeType.d.ts +6 -0
- package/es/DeviceSelect/TreeType.js +36 -0
- package/es/DeviceSelect/demo.js +2 -2
- package/es/DeviceSelect/index.css +6 -1
- package/es/DeviceSelect/index.d.ts +5 -0
- package/es/DeviceSelect/index.js +22 -53
- package/es/Dict/cache.d.ts +3 -0
- package/es/Dict/cache.js +21 -0
- package/es/Dict/desc.d.ts +64 -0
- package/es/Dict/desc.js +162 -0
- package/es/Dict/device.d.ts +28 -0
- package/es/Dict/device.js +117 -0
- package/es/Dict/hook.d.ts +4 -0
- package/es/Dict/hook.js +114 -0
- package/es/Dict/index.d.ts +13 -0
- package/es/Dict/index.js +14 -0
- package/es/Dict/interface.d.ts +16 -0
- package/es/Dict/utils.d.ts +11 -0
- package/es/Dict/utils.js +51 -0
- package/es/Drag/DragAndDropItem.d.ts +4 -0
- package/es/Drag/DragAndDropItem.js +145 -0
- package/es/Drag/DropItem.d.ts +4 -0
- package/es/Drag/DropItem.js +54 -0
- package/es/Drag/index.css +0 -0
- package/es/Drag/index.d.ts +7 -0
- package/es/Drag/index.js +7 -0
- package/es/Drag/interface.d.ts +16 -0
- package/es/Drawer/Demo.d.ts +3 -0
- package/es/Drawer/Demo.js +52 -0
- package/es/Drawer/Footer.d.ts +4 -0
- package/es/Drawer/Footer.js +26 -0
- package/es/Drawer/index.css +39 -0
- package/es/Drawer/index.d.ts +12 -0
- package/es/Drawer/index.js +41 -0
- package/es/Drawer/interface.d.ts +191 -0
- package/es/FullScreen/index.css +16 -0
- package/es/FullScreen/index.d.ts +10 -0
- package/es/FullScreen/index.js +68 -0
- package/es/HightLevel/index.css +3 -0
- package/es/HightLevel/index.d.ts +9 -0
- package/es/HightLevel/index.js +23 -0
- package/es/IconFont/index.d.ts +12 -0
- package/es/IconFont/index.js +57 -0
- package/es/ImageView/index.css +6 -0
- package/es/ImageView/index.d.ts +17 -0
- package/es/ImageView/index.js +58 -0
- package/es/InitialConfig/index.js +7 -11
- package/es/InitialConfig/utils.d.ts +1 -1
- package/es/InitialConfig/utils.js +8 -31
- package/es/InitialRequest/index.d.ts +1 -1
- package/es/InitialRequest/index.js +19 -11
- package/es/InitialRequest/utils.d.ts +5 -4
- package/es/InitialRequest/utils.js +58 -94
- package/es/Input/index.css +8 -0
- package/es/Input/index.d.ts +18 -0
- package/es/Input/index.js +76 -0
- package/es/LabelValue/index.css +18 -0
- package/es/LabelValue/index.d.ts +23 -0
- package/es/LabelValue/index.js +32 -0
- package/es/{DynamicDeviceList → List}/CheckExt.d.ts +0 -0
- package/es/{DynamicDeviceList → List}/CheckExt.js +4 -4
- package/es/List/DeviceList/index.css +0 -0
- package/es/List/DeviceList/index.d.ts +11 -0
- package/es/{DeviceList → List/DeviceList}/index.js +8 -20
- package/es/{DynamicDeviceList → List/DynamicDeviceList}/Demo.d.ts +0 -0
- package/es/List/DynamicDeviceList/Demo.js +54 -0
- package/es/{DynamicDeviceList → List/DynamicDeviceList}/index.css +5 -17
- package/es/List/DynamicDeviceList/index.d.ts +11 -0
- package/es/List/DynamicDeviceList/index.js +205 -0
- package/es/List/DynamicDeviceList/interface.d.ts +37 -0
- package/es/List/DynamicDeviceList/utils.d.ts +16 -0
- package/es/List/DynamicDeviceList/utils.js +61 -0
- package/es/List/DynamicGridList/Demo.d.ts +2 -0
- package/es/List/DynamicGridList/Demo.js +70 -0
- package/es/List/DynamicGridList/index.d.ts +26 -0
- package/es/List/DynamicGridList/index.js +73 -0
- package/es/List/GridList/Demo.d.ts +2 -0
- package/es/List/GridList/Demo.js +91 -0
- package/es/List/GridList/hook.d.ts +13 -0
- package/es/List/GridList/hook.js +301 -0
- package/es/List/GridList/index.css +7 -0
- package/es/List/GridList/index.d.ts +15 -0
- package/es/List/GridList/index.js +47 -0
- package/es/List/GridList/interface.d.ts +59 -0
- package/es/List/GridList/utils.d.ts +9 -0
- package/es/List/GridList/utils.js +43 -0
- package/es/List/ListExt/index.css +3 -0
- package/es/List/ListExt/index.d.ts +19 -0
- package/es/List/ListExt/index.js +44 -0
- package/es/List/VList/index.css +6 -0
- package/es/List/VList/index.d.ts +18 -0
- package/es/List/VList/index.js +51 -0
- package/es/List/VList/utils.d.ts +14 -0
- package/es/List/VList/utils.js +17 -0
- package/es/List/index.css +60 -5
- package/es/List/index.d.ts +10 -13
- package/es/List/index.js +170 -36
- package/es/List/interface.d.ts +87 -0
- package/es/List/renderItem.d.ts +20 -0
- package/es/List/renderItem.js +71 -0
- package/es/LoaderApp/index.css +3 -0
- package/es/LoaderApp/index.d.ts +31 -0
- package/es/LoaderApp/index.js +135 -0
- package/es/LoaderApp/interface.d.ts +6 -0
- package/es/LoaderApp/loader.d.ts +20 -0
- package/es/LoaderApp/loader.js +86 -0
- package/es/LoaderApp/utils.d.ts +13 -0
- package/es/LoaderApp/utils.js +121 -0
- package/es/LoaderScript/index.d.ts +26 -0
- package/es/LoaderScript/index.js +127 -0
- package/es/LoaderScript/interface.d.ts +26 -0
- package/es/LoaderScript/utils.d.ts +12 -0
- package/es/LoaderScript/utils.js +133 -0
- package/es/Modal/index.css +43 -0
- package/es/Modal/index.d.ts +17 -0
- package/es/Modal/index.js +34 -0
- package/es/Modal/interface.d.ts +339 -0
- package/es/Picture/component/DefaultRects/RectInfo.d.ts +7 -0
- package/es/Picture/component/DefaultRects/RectInfo.js +94 -0
- package/es/Picture/component/DefaultRects/index.css +247 -0
- package/es/Picture/component/DefaultRects/index.d.ts +12 -0
- package/es/Picture/component/DefaultRects/index.js +47 -0
- package/es/Picture/component/DefaultRects/utils.d.ts +2 -0
- package/es/Picture/component/DefaultRects/utils.js +11 -0
- package/es/Picture/component/DrawRect/index.css +8 -0
- package/es/Picture/component/DrawRect/index.d.ts +14 -0
- package/es/Picture/component/DrawRect/index.js +41 -0
- package/es/Picture/component/MoveContent/index.css +0 -0
- package/es/Picture/component/MoveContent/index.d.ts +39 -0
- package/es/Picture/component/MoveContent/index.js +240 -0
- package/es/Picture/component/MoveContent/utils.d.ts +4 -0
- package/es/Picture/component/MoveContent/utils.js +19 -0
- package/es/Picture/component/RectMenu/index.css +31 -0
- package/es/Picture/component/RectMenu/index.d.ts +13 -0
- package/es/Picture/component/RectMenu/index.js +81 -0
- package/es/Picture/component/RectMenu/utils.d.ts +12 -0
- package/es/Picture/component/RectMenu/utils.js +22 -0
- package/es/Picture/component/Tools/index.css +42 -0
- package/es/Picture/component/Tools/index.d.ts +13 -0
- package/es/Picture/component/Tools/index.js +83 -0
- package/es/Picture/component/WheelScale/index.d.ts +6 -0
- package/es/Picture/component/WheelScale/index.js +29 -0
- package/es/Picture/dragBound.d.ts +5 -0
- package/es/Picture/dragBound.js +77 -0
- package/es/Picture/index.css +12 -0
- package/es/Picture/index.d.ts +16 -0
- package/es/Picture/index.js +344 -0
- package/es/Picture/interface.d.ts +67 -0
- package/es/Picture/loadCaptureRectImage.d.ts +8 -0
- package/es/Picture/loadCaptureRectImage.js +119 -0
- package/es/Picture/useDraw.d.ts +1 -0
- package/es/Picture/useDraw.js +136 -0
- package/es/Picture/utils.d.ts +22 -0
- package/es/Picture/utils.js +90 -0
- package/es/Progress/index.css +20 -0
- package/es/Progress/index.d.ts +11 -0
- package/es/Progress/index.js +68 -0
- package/es/RefDrawer/index.js +4 -5
- package/es/RefModal/index.js +4 -5
- package/es/Service/http.d.ts +1 -1
- package/es/Service/http.js +2 -25
- package/es/TableLayout/index.css +4 -0
- package/es/TableLayout/index.d.ts +13 -0
- package/es/TableLayout/index.js +33 -0
- package/es/ThemeAntd/index.css +501 -0
- package/es/ThemeAntd/index.d.ts +7 -0
- package/es/ThemeAntd/index.js +6 -0
- package/es/ThemeAntd/style/button.css +46 -0
- package/es/ThemeAntd/style/checkbox.css +64 -0
- package/es/ThemeAntd/style/form.css +10 -0
- package/es/ThemeAntd/style/input.css +58 -0
- package/es/ThemeAntd/style/pagination.css +44 -0
- package/es/ThemeAntd/style/picker.css +86 -0
- package/es/ThemeAntd/style/popover.css +3 -0
- package/es/ThemeAntd/style/radio.css +71 -0
- package/es/ThemeAntd/style/scrollbar.css +19 -0
- package/es/ThemeAntd/style/select.css +57 -0
- package/es/ThemeAntd/style/table.css +36 -0
- package/es/ThemeAntd/style/tree.css +4 -0
- package/es/{TreeTitle → Title}/index.css +5 -5
- package/es/{TreeTitle → Title}/index.d.ts +2 -2
- package/es/{TreeTitle → Title}/index.js +9 -6
- package/es/{TreeMode → Tree/BaseTree}/demo.d.ts +0 -0
- package/es/Tree/BaseTree/demo.js +69 -0
- package/es/Tree/BaseTree/index.css +64 -0
- package/es/Tree/BaseTree/index.d.ts +24 -0
- package/es/Tree/BaseTree/index.js +83 -0
- package/es/Tree/demo.d.ts +2 -0
- package/es/{TreeMode → Tree}/demo.js +0 -0
- package/es/{TreeMode → Tree}/index.css +1 -1
- package/es/{TreeMode → Tree}/index.d.ts +1 -1
- package/es/{TreeMode → Tree}/index.js +9 -12
- package/es/UserSelect/index.d.ts +3 -3
- package/es/UserSelect/index.js +18 -15
- package/es/WorkerFlow/Form/Condition.js +6 -8
- package/es/WorkerFlow/Form/EmptyUserSet.js +4 -6
- package/es/WorkerFlow/Form/FormAuth.js +3 -3
- package/es/WorkerFlow/Form/GroupList.js +2 -2
- package/es/WorkerFlow/Form/GroupSelect.js +4 -6
- package/es/WorkerFlow/Form/GroupSelectModalContent.js +8 -7
- package/es/WorkerFlow/Form/LevelGroupSelect.js +5 -7
- package/es/WorkerFlow/Form/UserAndGroupSelect.js +4 -6
- package/es/WorkerFlow/Form/UserSelect.js +4 -6
- package/es/WorkerFlow/Form/UserSelectModalContent.js +8 -6
- package/es/WorkerFlow/Form/UserSet.js +3 -3
- package/es/WorkerFlow/Nodes/Add.js +2 -3
- package/es/WorkerFlow/Nodes/AddOption.js +2 -2
- package/es/WorkerFlow/Nodes/Approver.js +2 -2
- package/es/WorkerFlow/Nodes/Condition.js +2 -2
- package/es/WorkerFlow/Nodes/Handle.js +2 -2
- package/es/WorkerFlow/Nodes/Notifier.js +2 -2
- package/es/WorkerFlow/Nodes/TitleElement.js +70 -36
- package/es/WorkerFlow/index.css +9 -3
- package/es/WorkerFlow/index.js +3 -3
- package/es/WorkerFlow/utils.js +2 -2
- package/es/core.d.ts +27 -0
- package/es/index.d.ts +27 -4
- package/es/index.js +27 -4
- package/es/useDrawer/index.d.ts +14 -0
- package/es/useDrawer/index.js +91 -0
- package/es/useHttp/index.d.ts +8 -0
- package/es/useHttp/index.js +78 -0
- package/es/useModal/index.d.ts +14 -0
- package/es/useModal/index.js +93 -0
- package/es/useNavigate/index.css +0 -0
- package/es/useNavigate/index.d.ts +4 -0
- package/es/useNavigate/index.js +14 -0
- package/es/utils.d.ts +11 -0
- package/es/utils.js +68 -1
- package/package.json +10 -8
- package/es/DeviceList/index.css +0 -32
- package/es/DeviceList/index.d.ts +0 -14
- package/es/DynamicDeviceList/Demo.js +0 -17
- package/es/DynamicDeviceList/index.d.ts +0 -35
- package/es/DynamicDeviceList/index.js +0 -224
- package/es/DynamicDeviceList/utils.d.ts +0 -2
- package/es/DynamicDeviceList/utils.js +0 -15
package/es/List/index.css
CHANGED
|
@@ -1,9 +1,64 @@
|
|
|
1
|
-
.
|
|
2
|
-
|
|
1
|
+
.lm-c-check-list-wrapper {
|
|
2
|
+
display: flex;
|
|
3
|
+
flex-direction: column;
|
|
4
|
+
overflow: hidden;
|
|
5
|
+
height: 100%;
|
|
6
|
+
cursor: auto;
|
|
7
|
+
border: 1px solid var(--bd-color);
|
|
8
|
+
/*列表项*/
|
|
3
9
|
}
|
|
4
|
-
.
|
|
10
|
+
.lm-c-check-list-wrapper .lm-c-base-list-layout {
|
|
11
|
+
flex: 1;
|
|
12
|
+
overflow: hidden;
|
|
13
|
+
}
|
|
14
|
+
.lm-c-check-list-wrapper .list-item {
|
|
15
|
+
cursor: pointer;
|
|
16
|
+
height: 30px;
|
|
17
|
+
line-height: 30px;
|
|
18
|
+
color: var(--color);
|
|
19
|
+
font-size: var(--fs-small);
|
|
20
|
+
padding: 0 10px;
|
|
21
|
+
}
|
|
22
|
+
.lm-c-check-list-wrapper .list-item > label {
|
|
23
|
+
margin: 0px;
|
|
24
|
+
width: 100%;
|
|
25
|
+
display: flex;
|
|
26
|
+
}
|
|
27
|
+
.lm-c-check-list-wrapper .list-item .item-info {
|
|
28
|
+
flex: 1;
|
|
29
|
+
overflow: hidden;
|
|
30
|
+
white-space: nowrap;
|
|
31
|
+
text-overflow: ellipsis;
|
|
32
|
+
cursor: pointer;
|
|
33
|
+
font-size: var(--fs-small);
|
|
34
|
+
}
|
|
35
|
+
.lm-c-check-list-wrapper .list-item .item-info > .anticon {
|
|
36
|
+
font-size: 16px;
|
|
37
|
+
margin: 0 4px;
|
|
38
|
+
position: relative;
|
|
39
|
+
top: 2px;
|
|
40
|
+
}
|
|
41
|
+
.lm-c-check-list-wrapper .list-item:hover > label,
|
|
42
|
+
.lm-c-check-list-wrapper .list-item.list-item-active > label {
|
|
43
|
+
color: var(--primary);
|
|
44
|
+
border-bottom: 1px solid var(--primary);
|
|
45
|
+
}
|
|
46
|
+
.lm-c-check-list-wrapper .list-item.has-check-box > label {
|
|
47
|
+
padding: 0 4px;
|
|
48
|
+
}
|
|
49
|
+
.cloudapp-c-check-list-checkext {
|
|
50
|
+
font-size: var(--fs-small);
|
|
51
|
+
padding: 5px 15px;
|
|
52
|
+
display: flex;
|
|
53
|
+
justify-content: space-between;
|
|
54
|
+
border-bottom: 1px solid var(--bd-color);
|
|
55
|
+
}
|
|
56
|
+
.cloudapp-c-check-list-checkext .select-group .anticon {
|
|
57
|
+
font-size: 16px;
|
|
58
|
+
cursor: pointer;
|
|
59
|
+
padding-right: 8px;
|
|
5
60
|
color: var(--icon);
|
|
6
61
|
}
|
|
7
|
-
.
|
|
8
|
-
color:
|
|
62
|
+
.cloudapp-c-check-list-checkext .select-group .anticon:hover {
|
|
63
|
+
color: var(--primary);
|
|
9
64
|
}
|
package/es/List/index.d.ts
CHANGED
|
@@ -1,19 +1,16 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { CheckListProps } from '@cloud-app-dev/basic-components/es/CheckList';
|
|
1
|
+
import { CheckListProps } from './interface';
|
|
3
2
|
import './index.less';
|
|
4
|
-
|
|
5
|
-
}
|
|
6
|
-
export interface IListExtProps {
|
|
7
|
-
title?: string;
|
|
8
|
-
titleExt?: React.ReactNode;
|
|
9
|
-
inputPlaceholder?: string;
|
|
10
|
-
onKeywordChange?: (key: string) => void;
|
|
11
|
-
}
|
|
12
|
-
declare function List<T>({ onKeywordChange, title, inputPlaceholder, titleExt, className, ...props }: IListProps<T>): JSX.Element;
|
|
3
|
+
declare function List(props: CheckListProps<any>): JSX.Element;
|
|
13
4
|
declare namespace List {
|
|
14
5
|
var defaultProps: {
|
|
15
|
-
|
|
16
|
-
|
|
6
|
+
className: string;
|
|
7
|
+
list: any[];
|
|
8
|
+
itemKey: string;
|
|
9
|
+
itemNameKey: string;
|
|
17
10
|
};
|
|
11
|
+
var VList: typeof import("./VList").default;
|
|
12
|
+
var DeviceList: typeof import("./DeviceList").default;
|
|
13
|
+
var ListExt: typeof import("./ListExt").default;
|
|
14
|
+
var DynamicDeviceList: typeof import("./DynamicDeviceList").default;
|
|
18
15
|
}
|
|
19
16
|
export default List;
|
package/es/List/index.js
CHANGED
|
@@ -1,44 +1,178 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import _isEqual from "@cloud-app-dev/utils/es/isEqual";
|
|
2
|
+
|
|
3
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
4
|
+
|
|
5
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
6
|
+
|
|
7
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
8
|
+
|
|
9
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
10
|
+
|
|
11
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
12
|
+
|
|
13
|
+
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."); }
|
|
14
|
+
|
|
15
|
+
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); }
|
|
16
|
+
|
|
17
|
+
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; }
|
|
18
|
+
|
|
19
|
+
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
20
|
+
|
|
21
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
22
|
+
|
|
23
|
+
import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
|
24
|
+
import VList from './VList';
|
|
25
|
+
import { RenderItem } from './renderItem';
|
|
26
|
+
import CheckExt from './CheckExt';
|
|
27
|
+
import DeviceList from './DeviceList';
|
|
28
|
+
import ListExt from './ListExt';
|
|
29
|
+
import DynamicDeviceList from './DynamicDeviceList';
|
|
5
30
|
import "./index.css";
|
|
6
31
|
|
|
7
|
-
function List(
|
|
8
|
-
var
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}
|
|
32
|
+
function List(props) {
|
|
33
|
+
var className = props.className,
|
|
34
|
+
style = props.style,
|
|
35
|
+
CustomRender = props.CustomRender,
|
|
36
|
+
itemNameKey = props.itemNameKey,
|
|
37
|
+
activeKey = props.activeKey,
|
|
38
|
+
checkExt = props.checkExt,
|
|
39
|
+
onChecked = props.onChecked,
|
|
40
|
+
list = props.list,
|
|
41
|
+
checkedKeys = props.checkedKeys,
|
|
42
|
+
itemKey = props.itemKey,
|
|
43
|
+
defaultCheckedIds = props.defaultCheckedIds,
|
|
44
|
+
rowHeight = props.rowHeight,
|
|
45
|
+
renderHeader = props.renderHeader;
|
|
46
|
+
|
|
47
|
+
var _useState = useState({
|
|
48
|
+
checkedKeys: defaultCheckedIds || checkedKeys || []
|
|
49
|
+
}),
|
|
50
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
51
|
+
state = _useState2[0],
|
|
52
|
+
setState = _useState2[1];
|
|
53
|
+
|
|
54
|
+
var checkable = useMemo(function () {
|
|
55
|
+
return !!onChecked;
|
|
56
|
+
}, []);
|
|
57
|
+
/**
|
|
58
|
+
* 列表选中处理
|
|
59
|
+
*/
|
|
60
|
+
|
|
61
|
+
var onCheckedAction = useCallback(function (e) {
|
|
62
|
+
var ids = state.checkedKeys || [];
|
|
63
|
+
var id = e.target.value;
|
|
64
|
+
var flag = e.target.checked;
|
|
65
|
+
|
|
66
|
+
if (flag) {
|
|
67
|
+
ids.push(id);
|
|
68
|
+
} else {
|
|
69
|
+
ids = ids.filter(function (v) {
|
|
70
|
+
return v !== id;
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
setState(function (old) {
|
|
75
|
+
return Object.assign(Object.assign({}, old), {
|
|
76
|
+
checkedKeys: _toConsumableArray(ids)
|
|
77
|
+
});
|
|
78
|
+
});
|
|
79
|
+
onChecked && onChecked(ids);
|
|
80
|
+
}, // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
81
|
+
[state.checkedKeys]);
|
|
82
|
+
/**
|
|
83
|
+
* 列表渲染
|
|
84
|
+
*/
|
|
85
|
+
|
|
86
|
+
var renderRow = useCallback(function (data, index) {
|
|
87
|
+
var options = Object.assign(Object.assign({}, state), {
|
|
88
|
+
item: data,
|
|
89
|
+
onChecked: onCheckedAction,
|
|
90
|
+
checkable: !!onChecked,
|
|
91
|
+
index: index,
|
|
92
|
+
style: style,
|
|
93
|
+
keywords: props.keywords,
|
|
94
|
+
whatIcon: props.whatIcon,
|
|
95
|
+
renderItemExt: props.renderItemExt,
|
|
96
|
+
onClickItem: props.onClickItem,
|
|
97
|
+
onMouseOutItem: props.onMouseOutItem,
|
|
98
|
+
onMouseOverItem: props.onMouseOverItem,
|
|
99
|
+
itemKey: itemKey,
|
|
100
|
+
itemNameKey: itemNameKey,
|
|
101
|
+
activeKey: activeKey
|
|
102
|
+
});
|
|
103
|
+
var ItemRender = CustomRender ? CustomRender : RenderItem;
|
|
104
|
+
return /*#__PURE__*/React.createElement(ItemRender, Object.assign({
|
|
105
|
+
key: index
|
|
106
|
+
}, options));
|
|
107
|
+
}, // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
108
|
+
[list, state, onChecked, CustomRender, activeKey]);
|
|
109
|
+
/**
|
|
110
|
+
* 列表全选处理
|
|
111
|
+
*/
|
|
112
|
+
|
|
113
|
+
var onCheck = useCallback(function () {
|
|
114
|
+
var ids = list.map(function (v) {
|
|
115
|
+
return v[itemKey];
|
|
116
|
+
});
|
|
117
|
+
setState(function (old) {
|
|
118
|
+
return Object.assign(Object.assign({}, old), {
|
|
119
|
+
checkedKeys: _toConsumableArray(ids)
|
|
120
|
+
});
|
|
121
|
+
});
|
|
122
|
+
props.onChecked && props.onChecked(ids); // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
123
|
+
}, [itemKey, list]);
|
|
124
|
+
/**
|
|
125
|
+
* 列表取消
|
|
126
|
+
*/
|
|
127
|
+
|
|
128
|
+
var onCancel = useCallback(function () {
|
|
129
|
+
setState(function (old) {
|
|
130
|
+
return Object.assign(Object.assign({}, old), {
|
|
131
|
+
checkedKeys: []
|
|
132
|
+
});
|
|
133
|
+
});
|
|
134
|
+
props.onChecked && props.onChecked([]); // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
135
|
+
}, [itemKey, list]);
|
|
136
|
+
/**
|
|
137
|
+
* 同步选中更新
|
|
138
|
+
*/
|
|
139
|
+
|
|
140
|
+
useEffect(function () {
|
|
141
|
+
if (props.checkedKeys && !_isEqual(props.checkedKeys, state.checkedKeys)) {
|
|
142
|
+
setState(function (old) {
|
|
143
|
+
return Object.assign(Object.assign({}, old), {
|
|
144
|
+
checkedKeys: props.checkedKeys
|
|
145
|
+
});
|
|
146
|
+
});
|
|
147
|
+
} // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
25
148
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
}
|
|
149
|
+
}, [props.checkedKeys]);
|
|
150
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
151
|
+
className: "lm-c-check-list-wrapper ".concat(className),
|
|
152
|
+
style: style
|
|
153
|
+
}, renderHeader && renderHeader(), checkExt, checkable && /*#__PURE__*/React.createElement(CheckExt, {
|
|
154
|
+
selectCount: state.checkedKeys.length,
|
|
155
|
+
count: list.length,
|
|
156
|
+
onCheck: onCheck,
|
|
157
|
+
onCancel: onCancel
|
|
158
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
159
|
+
className: "lm-c-base-list-layout"
|
|
160
|
+
}, /*#__PURE__*/React.createElement(VList, {
|
|
161
|
+
className: "lm-c-virtual-layout",
|
|
162
|
+
data: list,
|
|
163
|
+
rowHeight: rowHeight || 30,
|
|
164
|
+
renderItem: renderRow
|
|
165
|
+
})));
|
|
38
166
|
}
|
|
39
167
|
|
|
40
168
|
List.defaultProps = {
|
|
41
|
-
|
|
42
|
-
|
|
169
|
+
className: '',
|
|
170
|
+
list: [],
|
|
171
|
+
itemKey: 'id',
|
|
172
|
+
itemNameKey: 'name'
|
|
43
173
|
};
|
|
174
|
+
List.VList = VList;
|
|
175
|
+
List.DeviceList = DeviceList;
|
|
176
|
+
List.ListExt = ListExt;
|
|
177
|
+
List.DynamicDeviceList = DynamicDeviceList;
|
|
44
178
|
export default List;
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
export interface CheckListProps<T> {
|
|
2
|
+
/**
|
|
3
|
+
* @description 列表数据
|
|
4
|
+
* @default []
|
|
5
|
+
*/
|
|
6
|
+
list?: Array<T>;
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* @description 列表类名
|
|
10
|
+
* @default ''
|
|
11
|
+
*/
|
|
12
|
+
className?: string;
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* @description 列表样式
|
|
16
|
+
* @default -
|
|
17
|
+
*/
|
|
18
|
+
style?: React.CSSProperties;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* @description 列表自定义渲染
|
|
22
|
+
* @default -
|
|
23
|
+
*/
|
|
24
|
+
CustomRender?: () => JSX.Element;
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* @description 列表渲染key字段
|
|
28
|
+
* @default id
|
|
29
|
+
*/
|
|
30
|
+
itemKey?: string;
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* @description 列表渲染label字段
|
|
34
|
+
* @default name
|
|
35
|
+
*/
|
|
36
|
+
itemNameKey?: string;
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* @description 激活列表key
|
|
40
|
+
* @default -
|
|
41
|
+
*/
|
|
42
|
+
activeKey?: string;
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* @description 列表拓展内容
|
|
46
|
+
* @default -
|
|
47
|
+
*/
|
|
48
|
+
checkExt?: React.ReactNode;
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* @description 选中事件,影响是否有checkbox
|
|
52
|
+
* @default -
|
|
53
|
+
*/
|
|
54
|
+
onChecked?: (ids: Array<string>) => void;
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* @description 选中的key
|
|
58
|
+
* @default []
|
|
59
|
+
*/
|
|
60
|
+
checkedKeys?: string[];
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* @description 默认选中的key
|
|
64
|
+
* @default []
|
|
65
|
+
*/
|
|
66
|
+
defaultCheckedIds?: string[];
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* @description 高亮关键字
|
|
70
|
+
* @default -
|
|
71
|
+
*/
|
|
72
|
+
keywords?: string;
|
|
73
|
+
|
|
74
|
+
rowHeight?: number;
|
|
75
|
+
|
|
76
|
+
whatIcon?: (item: T) => JSX.Element;
|
|
77
|
+
|
|
78
|
+
renderItemExt?: (item: T) => JSX.Element;
|
|
79
|
+
|
|
80
|
+
onClickItem?: (item: T) => void;
|
|
81
|
+
|
|
82
|
+
onMouseOutItem?: (item: T) => void;
|
|
83
|
+
|
|
84
|
+
onMouseOverItem?: (item: T) => void;
|
|
85
|
+
|
|
86
|
+
renderHeader?: () => JSX.Element;
|
|
87
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { CheckboxChangeEvent } from 'antd/lib/checkbox';
|
|
3
|
+
interface IRenderItempProps<T> {
|
|
4
|
+
item: T;
|
|
5
|
+
checkedKeys: any[];
|
|
6
|
+
activeKey: any;
|
|
7
|
+
style?: React.CSSProperties;
|
|
8
|
+
itemNameKey: string;
|
|
9
|
+
renderItemExt?: (item: T) => JSX.Element;
|
|
10
|
+
whatIcon?: (item: T) => JSX.Element;
|
|
11
|
+
itemKey?: string;
|
|
12
|
+
checkable?: boolean;
|
|
13
|
+
keywords?: string;
|
|
14
|
+
onChecked?: (e: CheckboxChangeEvent) => void;
|
|
15
|
+
onClickItem?: (item: T) => void;
|
|
16
|
+
onMouseOverItem?: (item: T) => void;
|
|
17
|
+
onMouseOutItem?: (item: T) => void;
|
|
18
|
+
}
|
|
19
|
+
export declare function RenderItem({ item, checkedKeys, activeKey, style, itemNameKey, itemKey, checkable, keywords, ...props }: IRenderItempProps<any>): JSX.Element;
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import "antd/lib/checkbox/style";
|
|
2
|
+
import _Checkbox from "antd/lib/checkbox";
|
|
3
|
+
import { __rest } from "tslib";
|
|
4
|
+
import React, { useCallback, useMemo } from 'react';
|
|
5
|
+
import HightLevel from '../HightLevel';
|
|
6
|
+
export function RenderItem(_a) {
|
|
7
|
+
var item = _a.item,
|
|
8
|
+
checkedKeys = _a.checkedKeys,
|
|
9
|
+
activeKey = _a.activeKey,
|
|
10
|
+
style = _a.style,
|
|
11
|
+
itemNameKey = _a.itemNameKey,
|
|
12
|
+
itemKey = _a.itemKey,
|
|
13
|
+
checkable = _a.checkable,
|
|
14
|
+
keywords = _a.keywords,
|
|
15
|
+
props = __rest(_a, ["item", "checkedKeys", "activeKey", "style", "itemNameKey", "itemKey", "checkable", "keywords"]);
|
|
16
|
+
|
|
17
|
+
var renderItemExt = props.renderItemExt,
|
|
18
|
+
whatIcon = props.whatIcon,
|
|
19
|
+
onChecked = props.onChecked,
|
|
20
|
+
onClickItem = props.onClickItem,
|
|
21
|
+
onMouseOverItem = props.onMouseOverItem,
|
|
22
|
+
onMouseOutItem = props.onMouseOutItem;
|
|
23
|
+
var checked = checkedKeys ? checkedKeys.includes(item[itemKey]) : false;
|
|
24
|
+
var active = !activeKey ? false : Array.isArray(activeKey) ? activeKey.includes(item[itemKey]) : activeKey === item[itemKey];
|
|
25
|
+
var itemIcon = whatIcon ? whatIcon(item) : null;
|
|
26
|
+
var itemClick = useCallback(function (e) {
|
|
27
|
+
return e.stopPropagation();
|
|
28
|
+
}, []);
|
|
29
|
+
|
|
30
|
+
var _onMouseOver = useCallback(function (item) {
|
|
31
|
+
return onMouseOverItem && onMouseOverItem(item);
|
|
32
|
+
}, []);
|
|
33
|
+
|
|
34
|
+
var _onMouseOut = useCallback(function (item) {
|
|
35
|
+
return onMouseOutItem && onMouseOutItem(item);
|
|
36
|
+
}, []);
|
|
37
|
+
|
|
38
|
+
var _onClick = useCallback(function (item) {
|
|
39
|
+
return onClickItem && onClickItem(item);
|
|
40
|
+
}, []);
|
|
41
|
+
|
|
42
|
+
var className = useMemo(function () {
|
|
43
|
+
return "list-item ".concat(checkable ? 'has-check-box' : '', " ").concat(active ? 'list-item-active' : '');
|
|
44
|
+
}, [checkable, active]);
|
|
45
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
46
|
+
style: style,
|
|
47
|
+
className: className,
|
|
48
|
+
onClick: function onClick() {
|
|
49
|
+
return _onClick(item);
|
|
50
|
+
},
|
|
51
|
+
onMouseOver: function onMouseOver() {
|
|
52
|
+
return _onMouseOver(item);
|
|
53
|
+
},
|
|
54
|
+
onMouseOut: function onMouseOut() {
|
|
55
|
+
return _onMouseOut(item);
|
|
56
|
+
}
|
|
57
|
+
}, /*#__PURE__*/React.createElement("label", null, checkable && /*#__PURE__*/React.createElement(_Checkbox, {
|
|
58
|
+
value: item[itemKey],
|
|
59
|
+
disabled: item.disabled,
|
|
60
|
+
onClick: itemClick,
|
|
61
|
+
checked: checked,
|
|
62
|
+
onChange: onChecked
|
|
63
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
64
|
+
className: "item-info"
|
|
65
|
+
}, itemIcon, keywords ? /*#__PURE__*/React.createElement(HightLevel, {
|
|
66
|
+
name: item[itemNameKey],
|
|
67
|
+
keyword: keywords
|
|
68
|
+
}) : /*#__PURE__*/React.createElement("span", {
|
|
69
|
+
title: item[itemNameKey]
|
|
70
|
+
}, item[itemNameKey])), renderItemExt && renderItemExt(item)));
|
|
71
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { AppItemType } from '../Config/interface';
|
|
3
|
+
import './index.less';
|
|
4
|
+
interface ILoaderAppProps {
|
|
5
|
+
/**
|
|
6
|
+
* @description 微应用配置信息
|
|
7
|
+
* @default -
|
|
8
|
+
*/
|
|
9
|
+
appConfig: AppItemType;
|
|
10
|
+
/**
|
|
11
|
+
* @description 需要传递微应用的参数
|
|
12
|
+
* @default {}
|
|
13
|
+
*/
|
|
14
|
+
appProps: {
|
|
15
|
+
updateTime?: number;
|
|
16
|
+
[key: string]: any;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* @description 微应用加载容器样式
|
|
20
|
+
* @default -
|
|
21
|
+
*/
|
|
22
|
+
style?: React.CSSProperties;
|
|
23
|
+
}
|
|
24
|
+
declare function LoaderApp({ appConfig, appProps, style }: ILoaderAppProps): JSX.Element;
|
|
25
|
+
declare namespace LoaderApp {
|
|
26
|
+
var defaultProps: {
|
|
27
|
+
appConfig: {};
|
|
28
|
+
appProps: {};
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
export default LoaderApp;
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import _useUpdateEffect from "ahooks/es/useUpdateEffect";
|
|
2
|
+
import _uuid from "@cloud-app-dev/utils/es/uuid";
|
|
3
|
+
|
|
4
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
5
|
+
|
|
6
|
+
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."); }
|
|
7
|
+
|
|
8
|
+
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); }
|
|
9
|
+
|
|
10
|
+
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; }
|
|
11
|
+
|
|
12
|
+
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
13
|
+
|
|
14
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
15
|
+
|
|
16
|
+
import { __awaiter } from "tslib";
|
|
17
|
+
import React, { useRef, useEffect, useState, useMemo } from 'react';
|
|
18
|
+
import { getMicroConfig } from './utils';
|
|
19
|
+
import LoaderModule from './loader';
|
|
20
|
+
import "./index.css";
|
|
21
|
+
|
|
22
|
+
function LoaderApp(_ref) {
|
|
23
|
+
var _this = this;
|
|
24
|
+
|
|
25
|
+
var appConfig = _ref.appConfig,
|
|
26
|
+
appProps = _ref.appProps,
|
|
27
|
+
style = _ref.style;
|
|
28
|
+
var domRef = useRef(null);
|
|
29
|
+
var styleRef = useRef(null);
|
|
30
|
+
var loadedAppRef = useRef(null);
|
|
31
|
+
var id = useMemo(function () {
|
|
32
|
+
return _uuid();
|
|
33
|
+
}, []);
|
|
34
|
+
|
|
35
|
+
var _useState = useState('empty'),
|
|
36
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
37
|
+
status = _useState2[0],
|
|
38
|
+
setStatus = _useState2[1];
|
|
39
|
+
|
|
40
|
+
useEffect(function () {
|
|
41
|
+
var app;
|
|
42
|
+
var config = getMicroConfig(appConfig, appProps, domRef.current);
|
|
43
|
+
|
|
44
|
+
if (!config) {
|
|
45
|
+
console.debug('微应用不存在', 'config ->', appConfig, 'appProps ->', appProps);
|
|
46
|
+
return undefined;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
var props = Object.assign(Object.assign({}, appProps), {
|
|
50
|
+
container: domRef.current
|
|
51
|
+
});
|
|
52
|
+
var options = {
|
|
53
|
+
script: appConfig.resource[0],
|
|
54
|
+
style: appConfig.resource[1],
|
|
55
|
+
name: config.name,
|
|
56
|
+
prefix: ".".concat(appConfig.name, "-").concat(id),
|
|
57
|
+
styleNode: styleRef.current
|
|
58
|
+
};
|
|
59
|
+
LoaderModule(options).then(function (mod) {
|
|
60
|
+
return __awaiter(_this, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
|
|
61
|
+
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
62
|
+
while (1) {
|
|
63
|
+
switch (_context.prev = _context.next) {
|
|
64
|
+
case 0:
|
|
65
|
+
app = mod;
|
|
66
|
+
loadedAppRef.current = mod;
|
|
67
|
+
|
|
68
|
+
if (!status) {
|
|
69
|
+
_context.next = 5;
|
|
70
|
+
break;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
_context.next = 5;
|
|
74
|
+
return app.bootstrap(props);
|
|
75
|
+
|
|
76
|
+
case 5:
|
|
77
|
+
setStatus('bootstrap');
|
|
78
|
+
_context.next = 8;
|
|
79
|
+
return app.mount(props);
|
|
80
|
+
|
|
81
|
+
case 8:
|
|
82
|
+
setStatus('mount');
|
|
83
|
+
|
|
84
|
+
case 9:
|
|
85
|
+
case "end":
|
|
86
|
+
return _context.stop();
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}, _callee);
|
|
90
|
+
}));
|
|
91
|
+
});
|
|
92
|
+
return function () {
|
|
93
|
+
try {
|
|
94
|
+
app.unmount(props);
|
|
95
|
+
setStatus('unmount');
|
|
96
|
+
app = null;
|
|
97
|
+
} catch (error) {
|
|
98
|
+
console.error(error);
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
}, []);
|
|
102
|
+
|
|
103
|
+
_useUpdateEffect(function () {
|
|
104
|
+
var currentId = appProps.currentId,
|
|
105
|
+
tabId = appProps.tabId;
|
|
106
|
+
|
|
107
|
+
if (currentId === tabId && loadedAppRef.current) {
|
|
108
|
+
var props = Object.assign(Object.assign({}, appProps), {
|
|
109
|
+
container: domRef.current
|
|
110
|
+
});
|
|
111
|
+
console.debug('执行更新!', appProps);
|
|
112
|
+
loadedAppRef.current.update && loadedAppRef.current.update(props);
|
|
113
|
+
}
|
|
114
|
+
}, [appProps.currentId, appProps.tabId, appProps.updateTime]);
|
|
115
|
+
|
|
116
|
+
return /*#__PURE__*/React.createElement("main", {
|
|
117
|
+
ref: domRef,
|
|
118
|
+
className: "loaded-app-layout ".concat(appConfig.routerPrefix, "-").concat(id),
|
|
119
|
+
style: style
|
|
120
|
+
}, /*#__PURE__*/React.createElement("style", {
|
|
121
|
+
ref: styleRef
|
|
122
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
123
|
+
id: appConfig.routerPrefix,
|
|
124
|
+
style: {
|
|
125
|
+
width: '100%',
|
|
126
|
+
height: '100%'
|
|
127
|
+
}
|
|
128
|
+
}));
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
LoaderApp.defaultProps = {
|
|
132
|
+
appConfig: {},
|
|
133
|
+
appProps: {}
|
|
134
|
+
};
|
|
135
|
+
export default LoaderApp;
|