@cloud-app-dev/vidc 2.0.0-alpha.1 → 2.0.0-alpha.5
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 +1 -2
- 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 +38 -0
- package/es/AppRoute/Render.d.ts +23 -0
- package/es/AppRoute/Render.js +111 -0
- package/es/AppRoute/Rendered.d.ts +4 -0
- package/es/AppRoute/Rendered.js +11 -0
- package/es/AppRoute/index.css +0 -0
- package/es/AppRoute/index.d.ts +14 -0
- package/es/AppRoute/index.js +106 -0
- package/es/AppRoute/interface.d.ts +18 -0
- package/es/AppRoute/utils.d.ts +1 -0
- package/es/AppRoute/utils.js +28 -0
- package/es/Auth/index.d.ts +8 -0
- package/es/Auth/index.js +17 -0
- package/es/AutoExit/index.js +8 -5
- package/es/CheckGroupFixed/index.css +49 -0
- package/es/CheckGroupFixed/index.d.ts +17 -0
- package/es/CheckGroupFixed/index.js +146 -0
- package/es/Config/index.js +27 -4
- package/es/Config/interface.d.ts +13 -3
- package/es/Config/utils.d.ts +9 -2
- package/es/ConfigContext/index.d.ts +3 -0
- package/es/ContentBox/BetweenBox/index.css +5 -0
- package/es/ContentBox/BetweenBox/index.d.ts +12 -0
- package/es/ContentBox/BetweenBox/index.js +24 -0
- package/es/ContentBox/InfoBox/index.css +23 -0
- package/es/ContentBox/InfoBox/index.d.ts +12 -0
- package/es/ContentBox/InfoBox/index.js +26 -0
- package/es/ContentBox/TwoColumnBox/index.css +77 -0
- package/es/ContentBox/TwoColumnBox/index.d.ts +10 -0
- package/es/ContentBox/TwoColumnBox/index.js +50 -0
- package/es/ContentBox/deps/content-grid.d.ts +9 -0
- package/es/ContentBox/deps/content-grid.js +9 -0
- package/es/ContentBox/deps/grid-factory.d.ts +10 -0
- package/es/ContentBox/deps/grid-factory.js +72 -0
- package/es/ContentBox/deps/simple-grid.d.ts +9 -0
- package/es/ContentBox/deps/simple-grid.js +8 -0
- package/es/ContentBox/index.css +9 -0
- package/es/ContentBox/index.d.ts +14 -0
- package/es/ContentBox/index.js +28 -0
- package/es/DeviceIcon/icon.js +5 -5
- package/es/DeviceIcon/index.js +2 -2
- package/es/DeviceList/index.d.ts +1 -1
- package/es/DeviceList/index.js +4 -4
- package/es/DeviceSelect/index.js +2 -2
- 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/DynamicDeviceList/CheckExt.js +3 -3
- package/es/DynamicDeviceList/index.js +2 -2
- package/es/DynamicDeviceList/utils.js +2 -2
- package/es/DynamicList/demo.d.ts +2 -0
- package/es/DynamicList/demo.js +71 -0
- package/es/DynamicList/index.css +7 -0
- package/es/DynamicList/index.d.ts +31 -0
- package/es/DynamicList/index.js +132 -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 +22 -0
- package/es/IconFont/index.css +0 -0
- package/es/IconFont/index.d.ts +13 -0
- package/es/IconFont/index.js +58 -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 +4 -4
- package/es/InitialRequest/utils.js +1 -1
- package/es/Input/index.css +8 -0
- package/es/Input/index.d.ts +18 -0
- package/es/Input/index.js +75 -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/List/CheckExt.d.ts +10 -0
- package/es/List/CheckExt.js +28 -0
- package/es/List/index.css +62 -6
- package/es/List/index.d.ts +73 -11
- package/es/List/index.js +162 -36
- package/es/List/renderItem.d.ts +20 -0
- package/es/List/renderItem.js +68 -0
- package/es/List/utils.d.ts +5 -0
- package/es/List/utils.js +18 -0
- package/es/ListExt/index.css +9 -0
- package/es/ListExt/index.d.ts +19 -0
- package/es/ListExt/index.js +44 -0
- package/es/LoaderApp/index.css +3 -0
- package/es/LoaderApp/index.d.ts +31 -0
- package/es/LoaderApp/index.js +132 -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 +126 -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 +110 -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/ScrollList/index.css +73 -0
- package/es/ScrollList/index.d.ts +24 -0
- package/es/ScrollList/index.js +261 -0
- package/es/ScrollList/utils.js +84 -0
- package/es/Service/http.js +0 -17
- package/es/TableLayout/index.css +4 -0
- package/es/TableLayout/index.d.ts +10 -0
- package/es/TableLayout/index.js +64 -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/Tree/demo.d.ts +2 -0
- package/es/Tree/demo.js +69 -0
- package/es/Tree/index.css +64 -0
- package/es/Tree/index.d.ts +24 -0
- package/es/Tree/index.js +83 -0
- package/es/TreeMode/index.d.ts +1 -1
- package/es/TreeMode/index.js +6 -6
- package/es/TreeTitle/index.js +2 -2
- package/es/UserSelect/index.d.ts +3 -3
- package/es/UserSelect/index.js +13 -15
- package/es/VList/index.css +4 -0
- package/es/VList/index.d.ts +16 -0
- package/es/VList/index.js +56 -0
- package/es/VList/utils.d.ts +10 -0
- package/es/VList/utils.js +17 -0
- package/es/WorkerFlow/Form/Condition.js +6 -6
- package/es/WorkerFlow/Form/EmptyUserSet.js +2 -2
- package/es/WorkerFlow/Form/FormAuth.js +2 -2
- package/es/WorkerFlow/Form/GroupSelect.js +2 -2
- package/es/WorkerFlow/Form/GroupSelectModalContent.js +5 -5
- package/es/WorkerFlow/Form/LevelGroupSelect.js +3 -3
- package/es/WorkerFlow/Form/UserAndGroupSelect.js +2 -2
- package/es/WorkerFlow/Form/UserSelect.js +2 -2
- package/es/WorkerFlow/Form/UserSelectModalContent.js +3 -4
- package/es/WorkerFlow/Form/UserSet.js +2 -2
- 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 +5 -8
- package/es/WorkerFlow/index.js +2 -3
- package/es/core.d.ts +27 -0
- package/es/index.d.ts +31 -0
- package/es/index.js +31 -0
- package/es/useChangeEffect/index.d.ts +3 -0
- package/es/useChangeEffect/index.js +32 -0
- package/es/useDrawer/index.d.ts +14 -0
- package/es/useDrawer/index.js +90 -0
- package/es/useHistory/index.css +0 -0
- package/es/useHistory/index.d.ts +3 -0
- package/es/useHistory/index.js +14 -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 +92 -0
- package/es/utils.d.ts +2 -0
- package/es/utils.js +32 -0
- package/package.json +11 -5
package/.umirc.ts
CHANGED
|
@@ -13,7 +13,6 @@ export default defineConfig({
|
|
|
13
13
|
targets: { chrome: 60 },
|
|
14
14
|
extraBabelPlugins: [
|
|
15
15
|
['import', { libraryName: 'antd', style: true }, 'antd'],
|
|
16
|
-
['import', { libraryName: '@cloud-app-dev/basic-components', style: false, camel2DashComponentName: false, libraryDirectory: 'es' }, 'basic-components'],
|
|
17
16
|
['import', { libraryName: '@cloud-app-dev/utils', style: false, camel2DashComponentName: false, libraryDirectory: 'es' }, 'utils'],
|
|
18
17
|
['import', { libraryName: 'ahooks', style: false, camel2DashComponentName: false, libraryDirectory: 'es' }, 'ahooks'],
|
|
19
18
|
['import', { libraryName: '@cloud-app-dev/map', style: false, camel2DashComponentName: false, libraryDirectory: 'es' }, 'map-components'],
|
|
@@ -25,7 +24,7 @@ export default defineConfig({
|
|
|
25
24
|
null, // null 值代表保留约定式生成的导航,只做增量配置
|
|
26
25
|
{
|
|
27
26
|
title: 'GitLab',
|
|
28
|
-
path: 'https://git.topvdn.com/
|
|
27
|
+
path: 'https://git.topvdn.com/cloudapp/vidc',
|
|
29
28
|
},
|
|
30
29
|
],
|
|
31
30
|
alias: {
|
package/es/Api/index.d.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { OrgItemType } from '
|
|
2
|
-
import {
|
|
3
|
-
import { BzTreeItemType, PostItemType } from '../core';
|
|
1
|
+
import { BzTreeItemType, PostItemType, OrgItemType } from '../core';
|
|
2
|
+
import { UserInfoType } from '../AppContext/interface';
|
|
4
3
|
declare class Api {
|
|
5
4
|
getOrgs(): Promise<OrgItemType[]>;
|
|
6
|
-
getUsers(organizationId: string, params?: any, filterUserIds?: string[]): Promise<
|
|
5
|
+
getUsers(organizationId: string, params?: any, filterUserIds?: string[]): Promise<UserInfoType[]>;
|
|
7
6
|
getPosts(orgId: string): Promise<PostItemType[]>;
|
|
8
7
|
getDeviceBzTree(): Promise<BzTreeItemType[]>;
|
|
9
8
|
getCustomDeviceGroup(): Promise<BzTreeItemType[]>;
|
package/es/Api/index.js
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import _Service from "@cloud-app-dev/basic-components/es/Service";
|
|
2
|
-
|
|
3
1
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
4
2
|
|
|
5
3
|
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
@@ -7,6 +5,7 @@ function _defineProperties(target, props) { for (var i = 0; i < props.length; i+
|
|
|
7
5
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
8
6
|
|
|
9
7
|
import { __awaiter } from "tslib";
|
|
8
|
+
import Service from '../Service';
|
|
10
9
|
import { getHeader } from '../utils';
|
|
11
10
|
|
|
12
11
|
var Api = /*#__PURE__*/function () {
|
|
@@ -24,7 +23,7 @@ var Api = /*#__PURE__*/function () {
|
|
|
24
23
|
switch (_context.prev = _context.next) {
|
|
25
24
|
case 0:
|
|
26
25
|
_context.next = 2;
|
|
27
|
-
return
|
|
26
|
+
return Service.$http({
|
|
28
27
|
url: '/api/user/v1/organization/queryChildOrganizationsById',
|
|
29
28
|
method: 'post',
|
|
30
29
|
requestId: 'queryChildOrganizationsById',
|
|
@@ -61,7 +60,7 @@ var Api = /*#__PURE__*/function () {
|
|
|
61
60
|
switch (_context2.prev = _context2.next) {
|
|
62
61
|
case 0:
|
|
63
62
|
_context2.next = 2;
|
|
64
|
-
return
|
|
63
|
+
return Service.$http({
|
|
65
64
|
url: '/api/user/v1/queryUsers',
|
|
66
65
|
method: 'post',
|
|
67
66
|
requestId: 'queryUsers',
|
|
@@ -99,7 +98,7 @@ var Api = /*#__PURE__*/function () {
|
|
|
99
98
|
switch (_context3.prev = _context3.next) {
|
|
100
99
|
case 0:
|
|
101
100
|
_context3.next = 2;
|
|
102
|
-
return
|
|
101
|
+
return Service.$http({
|
|
103
102
|
url: "/api/user/v2/post/queryPostByOrgId/".concat(orgId),
|
|
104
103
|
method: 'post',
|
|
105
104
|
requestId: 'queryPostByOrgId',
|
|
@@ -129,7 +128,7 @@ var Api = /*#__PURE__*/function () {
|
|
|
129
128
|
switch (_context4.prev = _context4.next) {
|
|
130
129
|
case 0:
|
|
131
130
|
_context4.next = 2;
|
|
132
|
-
return
|
|
131
|
+
return Service.$http({
|
|
133
132
|
url: '/api/udm-api/DeviceBuzTree/queryList',
|
|
134
133
|
method: 'post',
|
|
135
134
|
requestId: 'getDeviceBzTree',
|
|
@@ -159,7 +158,7 @@ var Api = /*#__PURE__*/function () {
|
|
|
159
158
|
switch (_context5.prev = _context5.next) {
|
|
160
159
|
case 0:
|
|
161
160
|
_context5.next = 2;
|
|
162
|
-
return
|
|
161
|
+
return Service.$http({
|
|
163
162
|
url: '/api/udm-api/customDeviceGroup/queryList',
|
|
164
163
|
method: 'post',
|
|
165
164
|
requestId: 'customDeviceGroup',
|
|
@@ -189,7 +188,7 @@ var Api = /*#__PURE__*/function () {
|
|
|
189
188
|
switch (_context6.prev = _context6.next) {
|
|
190
189
|
case 0:
|
|
191
190
|
_context6.next = 2;
|
|
192
|
-
return
|
|
191
|
+
return Service.$http({
|
|
193
192
|
url: '/api/place/v1/getPlacesByHasDevice',
|
|
194
193
|
method: 'post',
|
|
195
194
|
requestId: 'getPlacesByHasDevice',
|
|
File without changes
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as H from 'history';
|
|
2
|
+
import './index.less';
|
|
3
|
+
interface AppRedirectProps {
|
|
4
|
+
/**
|
|
5
|
+
* @description 匹配路径
|
|
6
|
+
* @default -
|
|
7
|
+
*/
|
|
8
|
+
path?: string | string[];
|
|
9
|
+
/**
|
|
10
|
+
* @description 重定向路径
|
|
11
|
+
* @description -
|
|
12
|
+
*/
|
|
13
|
+
to: H.LocationDescriptor<any>;
|
|
14
|
+
}
|
|
15
|
+
declare function AppRedirect({ path, to }: AppRedirectProps): JSX.Element;
|
|
16
|
+
export default AppRedirect;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import React, { useEffect } from 'react';
|
|
2
|
+
import { useLocation } from 'react-router-dom';
|
|
3
|
+
import useHistory from '../useHistory';
|
|
4
|
+
import "./index.css";
|
|
5
|
+
|
|
6
|
+
var getKey = function getKey() {
|
|
7
|
+
return Math.random().toString(36).substr(2);
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
function AppRedirect(_ref) {
|
|
11
|
+
var path = _ref.path,
|
|
12
|
+
to = _ref.to;
|
|
13
|
+
var history = useHistory();
|
|
14
|
+
var location = useLocation();
|
|
15
|
+
useEffect(function () {
|
|
16
|
+
if (path === location.pathname) {
|
|
17
|
+
if (typeof to !== 'string') {
|
|
18
|
+
history.replace(Object.assign(Object.assign({}, to), {
|
|
19
|
+
search: to.search ? "".concat(to.search, "&key=").concat(getKey()) : "?key=".concat(getKey()),
|
|
20
|
+
state: Object.assign({}, to.state, {
|
|
21
|
+
isReplace: true
|
|
22
|
+
})
|
|
23
|
+
}));
|
|
24
|
+
} else {
|
|
25
|
+
history.push({
|
|
26
|
+
pathname: to,
|
|
27
|
+
search: "?key".concat(getKey()),
|
|
28
|
+
state: {
|
|
29
|
+
isReplace: true
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}, [path, location.pathname, to, history]);
|
|
35
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export default AppRedirect;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { match, RouteProps } from 'react-router-dom';
|
|
3
|
+
import { IRenderRouteProps } from './interface';
|
|
4
|
+
import * as H from 'history';
|
|
5
|
+
/**
|
|
6
|
+
* @TODO
|
|
7
|
+
* @多种修正使用url判断异步处理这里防止回调执行的时候url变化导致一直执行
|
|
8
|
+
* @每次执行先清除上一次的
|
|
9
|
+
*/
|
|
10
|
+
export declare const RenderRoute: React.MemoExoticComponent<({ location, match, history, setRouteProps }: IRenderRouteProps) => any>;
|
|
11
|
+
interface IRenderComponentsProps {
|
|
12
|
+
state: any;
|
|
13
|
+
props: any;
|
|
14
|
+
}
|
|
15
|
+
export declare const RenderComponents: React.MemoExoticComponent<({ state, props }: IRenderComponentsProps) => any>;
|
|
16
|
+
interface IRenderRoutesProps extends RouteProps {
|
|
17
|
+
routes?: RouteProps[];
|
|
18
|
+
setRouteProps: (match: match<any>, location: H.Location, history: H.History) => void;
|
|
19
|
+
children?: React.ReactNode;
|
|
20
|
+
}
|
|
21
|
+
export declare function RenderRoutes({ routes, setRouteProps, children }: IRenderRoutesProps): JSX.Element;
|
|
22
|
+
export declare function RenderSingleRoute({ exact, strict, sensitive, path, setRouteProps, children }: IRenderRoutesProps): JSX.Element;
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { __rest } from "tslib";
|
|
2
|
+
import React, { useEffect, useMemo } from 'react';
|
|
3
|
+
import { getRouteItem } from './utils';
|
|
4
|
+
import useHistory from '../useHistory';
|
|
5
|
+
import { Route, Switch } from 'react-router-dom';
|
|
6
|
+
/**
|
|
7
|
+
* @TODO
|
|
8
|
+
* @多种修正使用url判断异步处理这里防止回调执行的时候url变化导致一直执行
|
|
9
|
+
* @每次执行先清除上一次的
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
export var RenderRoute = /*#__PURE__*/React.memo(function (_ref) {
|
|
13
|
+
var location = _ref.location,
|
|
14
|
+
match = _ref.match,
|
|
15
|
+
history = _ref.history,
|
|
16
|
+
setRouteProps = _ref.setRouteProps;
|
|
17
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
18
|
+
useEffect(function () {
|
|
19
|
+
return setRouteProps(match, location, history);
|
|
20
|
+
}, [location.pathname]);
|
|
21
|
+
return null;
|
|
22
|
+
});
|
|
23
|
+
export var RenderComponents = /*#__PURE__*/React.memo(function (_ref2) {
|
|
24
|
+
var state = _ref2.state,
|
|
25
|
+
props = _ref2.props;
|
|
26
|
+
|
|
27
|
+
var _useMemo = useMemo(function () {
|
|
28
|
+
return state;
|
|
29
|
+
}, [state]),
|
|
30
|
+
match = _useMemo.match,
|
|
31
|
+
location = _useMemo.location;
|
|
32
|
+
|
|
33
|
+
var history = useHistory();
|
|
34
|
+
|
|
35
|
+
var _a = useMemo(function () {
|
|
36
|
+
return props;
|
|
37
|
+
}, [props]),
|
|
38
|
+
path = _a.path,
|
|
39
|
+
component = _a.component,
|
|
40
|
+
render = _a.render,
|
|
41
|
+
routes = _a.routes,
|
|
42
|
+
other = __rest(_a, ["path", "component", "render", "routes"]);
|
|
43
|
+
|
|
44
|
+
var _useMemo2 = useMemo(function () {
|
|
45
|
+
var Com, Ren;
|
|
46
|
+
|
|
47
|
+
if (!routes) {
|
|
48
|
+
Com = component;
|
|
49
|
+
Ren = render;
|
|
50
|
+
} else {
|
|
51
|
+
var routeItem = getRouteItem(match, routes);
|
|
52
|
+
Com = routeItem.component;
|
|
53
|
+
Ren = routeItem.render;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
return {
|
|
57
|
+
Com: Com,
|
|
58
|
+
Ren: Ren
|
|
59
|
+
};
|
|
60
|
+
}, [component, match, render, routes]),
|
|
61
|
+
Com = _useMemo2.Com,
|
|
62
|
+
Ren = _useMemo2.Ren;
|
|
63
|
+
|
|
64
|
+
return Com ? /*#__PURE__*/React.cloneElement( /*#__PURE__*/React.createElement(Com, null), Object.assign(Object.assign({}, other), {
|
|
65
|
+
match: match,
|
|
66
|
+
location: location,
|
|
67
|
+
history: history
|
|
68
|
+
})) : Ren(Object.assign(Object.assign({}, other), {
|
|
69
|
+
match: match,
|
|
70
|
+
location: location,
|
|
71
|
+
history: history
|
|
72
|
+
}));
|
|
73
|
+
});
|
|
74
|
+
export function RenderRoutes(_ref3) {
|
|
75
|
+
var routes = _ref3.routes,
|
|
76
|
+
setRouteProps = _ref3.setRouteProps,
|
|
77
|
+
children = _ref3.children;
|
|
78
|
+
return /*#__PURE__*/React.createElement(Switch, null, routes.map(function (item, i) {
|
|
79
|
+
return /*#__PURE__*/React.createElement(Route, {
|
|
80
|
+
exact: !!item.exact,
|
|
81
|
+
sensitive: !!item.sensitive,
|
|
82
|
+
strict: !!item.strict,
|
|
83
|
+
key: i,
|
|
84
|
+
path: item.path,
|
|
85
|
+
render: function render(props) {
|
|
86
|
+
return /*#__PURE__*/React.createElement(RenderRoute, Object.assign({}, props, {
|
|
87
|
+
setRouteProps: setRouteProps
|
|
88
|
+
}));
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
}), children);
|
|
92
|
+
}
|
|
93
|
+
export function RenderSingleRoute(_ref4) {
|
|
94
|
+
var exact = _ref4.exact,
|
|
95
|
+
strict = _ref4.strict,
|
|
96
|
+
sensitive = _ref4.sensitive,
|
|
97
|
+
path = _ref4.path,
|
|
98
|
+
setRouteProps = _ref4.setRouteProps,
|
|
99
|
+
children = _ref4.children;
|
|
100
|
+
return /*#__PURE__*/React.createElement(Switch, null, /*#__PURE__*/React.createElement(Route, {
|
|
101
|
+
exact: !!exact,
|
|
102
|
+
strict: !!strict,
|
|
103
|
+
sensitive: !!sensitive,
|
|
104
|
+
path: path,
|
|
105
|
+
render: function render(props) {
|
|
106
|
+
return /*#__PURE__*/React.createElement(RenderRoute, Object.assign({}, props, {
|
|
107
|
+
setRouteProps: setRouteProps
|
|
108
|
+
}));
|
|
109
|
+
}
|
|
110
|
+
}), children);
|
|
111
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React, { useEffect } from 'react';
|
|
2
|
+
|
|
3
|
+
function Rendered(_ref) {
|
|
4
|
+
var onRendered = _ref.onRendered;
|
|
5
|
+
useEffect(function () {
|
|
6
|
+
return onRendered();
|
|
7
|
+
}, []);
|
|
8
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export default Rendered;
|
|
File without changes
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { match } from 'react-router-dom';
|
|
3
|
+
import { IAppRouteType, IAppRouteProps } from './interface';
|
|
4
|
+
import * as H from 'history';
|
|
5
|
+
import './index.less';
|
|
6
|
+
declare class AppRoute extends React.Component<IAppRouteProps, IAppRouteType> {
|
|
7
|
+
private isRender;
|
|
8
|
+
constructor(props: IAppRouteProps);
|
|
9
|
+
shouldComponentUpdate(props: IAppRouteProps): boolean;
|
|
10
|
+
componentWillUnmount(): void;
|
|
11
|
+
setRouteProps: (newMatch: match<any>, newLocation: H.Location<any>, history: H.History<any>) => void;
|
|
12
|
+
render(): JSX.Element;
|
|
13
|
+
}
|
|
14
|
+
export default AppRoute;
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
2
|
+
|
|
3
|
+
import _logger from "@cloud-app-dev/utils/es/logger";
|
|
4
|
+
import _cache from "@cloud-app-dev/utils/es/cache";
|
|
5
|
+
import _isEqual from "@cloud-app-dev/utils/es/isEqual";
|
|
6
|
+
|
|
7
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
8
|
+
|
|
9
|
+
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, descriptor.key, descriptor); } }
|
|
10
|
+
|
|
11
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
12
|
+
|
|
13
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
14
|
+
|
|
15
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
16
|
+
|
|
17
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
18
|
+
|
|
19
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
20
|
+
|
|
21
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
22
|
+
|
|
23
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
24
|
+
|
|
25
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
26
|
+
|
|
27
|
+
import React from 'react';
|
|
28
|
+
import { RenderComponents, RenderRoutes, RenderSingleRoute } from './Render';
|
|
29
|
+
import Rendered from './Rendered';
|
|
30
|
+
import "./index.css";
|
|
31
|
+
var _global = window;
|
|
32
|
+
|
|
33
|
+
var AppRoute = /*#__PURE__*/function (_React$Component) {
|
|
34
|
+
_inherits(AppRoute, _React$Component);
|
|
35
|
+
|
|
36
|
+
var _super = _createSuper(AppRoute);
|
|
37
|
+
|
|
38
|
+
function AppRoute(props) {
|
|
39
|
+
var _this;
|
|
40
|
+
|
|
41
|
+
_classCallCheck(this, AppRoute);
|
|
42
|
+
|
|
43
|
+
_this = _super.call(this, props);
|
|
44
|
+
|
|
45
|
+
_this.setRouteProps = function (newMatch, newLocation, history) {
|
|
46
|
+
if (!_isEqual(_this.props.match, newMatch)) {
|
|
47
|
+
_this.setState({
|
|
48
|
+
match: newMatch,
|
|
49
|
+
location: newLocation,
|
|
50
|
+
history: history
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
}; //可能存在路由创建但是没有render 导致UI无法渲染
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
_this.isRender = false;
|
|
57
|
+
_this.state = {
|
|
58
|
+
match: undefined,
|
|
59
|
+
location: undefined,
|
|
60
|
+
history: undefined
|
|
61
|
+
};
|
|
62
|
+
return _this;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
_createClass(AppRoute, [{
|
|
66
|
+
key: "shouldComponentUpdate",
|
|
67
|
+
value: function shouldComponentUpdate(props) {
|
|
68
|
+
if (!_global._IS_RUN_MICRO_BASIC || !this.isRender || _global._IS_ALLOW_ROUTE_RENDER) {
|
|
69
|
+
return true;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
return (props.currentId || _cache.getCache('currentTabKey', 'session')) === props.tabId;
|
|
73
|
+
}
|
|
74
|
+
}, {
|
|
75
|
+
key: "componentWillUnmount",
|
|
76
|
+
value: function componentWillUnmount() {
|
|
77
|
+
_logger.debug('路由销毁');
|
|
78
|
+
}
|
|
79
|
+
}, {
|
|
80
|
+
key: "render",
|
|
81
|
+
value: function render() {
|
|
82
|
+
var _this2 = this;
|
|
83
|
+
|
|
84
|
+
var _this$state = this.state,
|
|
85
|
+
match = _this$state.match,
|
|
86
|
+
location = _this$state.location;
|
|
87
|
+
var isRouteMath = match && location;
|
|
88
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, this.props.routes ? /*#__PURE__*/React.createElement(RenderRoutes, Object.assign({}, this.props, {
|
|
89
|
+
setRouteProps: this.setRouteProps
|
|
90
|
+
})) : /*#__PURE__*/React.createElement(RenderSingleRoute, Object.assign({}, this.props, {
|
|
91
|
+
setRouteProps: this.setRouteProps
|
|
92
|
+
})), isRouteMath && /*#__PURE__*/React.createElement(RenderComponents, {
|
|
93
|
+
state: this.state,
|
|
94
|
+
props: this.props
|
|
95
|
+
}), isRouteMath && /*#__PURE__*/React.createElement(Rendered, {
|
|
96
|
+
onRendered: function onRendered() {
|
|
97
|
+
return _this2.isRender = true;
|
|
98
|
+
}
|
|
99
|
+
}));
|
|
100
|
+
}
|
|
101
|
+
}]);
|
|
102
|
+
|
|
103
|
+
return AppRoute;
|
|
104
|
+
}(React.Component);
|
|
105
|
+
|
|
106
|
+
export default AppRoute;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as H from 'history';
|
|
2
|
+
import { RouteProps, match } from 'react-router-dom';
|
|
3
|
+
|
|
4
|
+
export interface IAppRouteType {
|
|
5
|
+
match?: match<any>;
|
|
6
|
+
location?: H.Location | undefined;
|
|
7
|
+
history?: H.History;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface IAppRouteProps extends RouteProps, IAppRouteType {
|
|
11
|
+
routes?: RouteProps[];
|
|
12
|
+
tabId?: string;
|
|
13
|
+
currentId?: string;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export interface IRenderRouteProps extends IAppRouteType {
|
|
17
|
+
setRouteProps: (match: match<any>, location: H.Location, history: H.History) => void;
|
|
18
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const getRouteItem: (match: any, routes: any[]) => any;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export var getRouteItem = function getRouteItem(match, routes) {
|
|
2
|
+
var matchParams = match.params || {};
|
|
3
|
+
var routeItem = routes.find(function (v) {
|
|
4
|
+
return v.path === match.url;
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
if (routeItem) {
|
|
8
|
+
return routeItem;
|
|
9
|
+
} else {
|
|
10
|
+
var keys = Object.keys(matchParams);
|
|
11
|
+
var tempPaths = routes.map(function (v) {
|
|
12
|
+
return v.path;
|
|
13
|
+
});
|
|
14
|
+
tempPaths.forEach(function (path, index) {
|
|
15
|
+
var newPath = path;
|
|
16
|
+
keys.forEach(function (key) {
|
|
17
|
+
if (path.includes(":".concat(key))) {
|
|
18
|
+
newPath = path.replace(":".concat(key), matchParams[key]);
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
tempPaths[index] = newPath;
|
|
22
|
+
});
|
|
23
|
+
var index = tempPaths.findIndex(function (v) {
|
|
24
|
+
return v === match.url;
|
|
25
|
+
});
|
|
26
|
+
return routes[index];
|
|
27
|
+
}
|
|
28
|
+
};
|
package/es/Auth/index.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React, { useMemo } from 'react';
|
|
2
|
+
import Config from '../Config';
|
|
3
|
+
|
|
4
|
+
function Auth(_ref) {
|
|
5
|
+
var featureId = _ref.featureId,
|
|
6
|
+
noAuthContent = _ref.noAuthContent,
|
|
7
|
+
children = _ref.children;
|
|
8
|
+
var action = useMemo(function () {
|
|
9
|
+
return !!Config.feature.find(function (v) {
|
|
10
|
+
return v.id === featureId;
|
|
11
|
+
});
|
|
12
|
+
}, [featureId]); //获取按钮权限
|
|
13
|
+
|
|
14
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, !action ? noAuthContent ? noAuthContent : null : children);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export default Auth;
|
package/es/AutoExit/index.js
CHANGED
|
@@ -1,13 +1,16 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import React, { useContext } from 'react';
|
|
2
|
+
import useHistory from '../useHistory';
|
|
3
|
+
import AppContext from '../AppContext';
|
|
4
4
|
|
|
5
5
|
function AutoExit(_ref) {
|
|
6
6
|
var children = _ref.children;
|
|
7
7
|
|
|
8
|
-
var
|
|
8
|
+
var _useContext = useContext(AppContext.Context),
|
|
9
|
+
loginStatus = _useContext.loginStatus;
|
|
9
10
|
|
|
10
|
-
|
|
11
|
+
var history = useHistory();
|
|
12
|
+
|
|
13
|
+
if (!loginStatus) {
|
|
11
14
|
history.replace('/login');
|
|
12
15
|
return null;
|
|
13
16
|
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
.c-check-group-layout {
|
|
2
|
+
position: relative;
|
|
3
|
+
}
|
|
4
|
+
.c-check-group-layout .c-check-group-box {
|
|
5
|
+
padding: 10px;
|
|
6
|
+
display: flex;
|
|
7
|
+
}
|
|
8
|
+
.c-check-group-layout .check-label-box {
|
|
9
|
+
width: 80px;
|
|
10
|
+
color: #999;
|
|
11
|
+
}
|
|
12
|
+
.c-check-group-layout .check-content-box {
|
|
13
|
+
width: 100%;
|
|
14
|
+
flex: 1;
|
|
15
|
+
overflow: hidden;
|
|
16
|
+
height: 30px;
|
|
17
|
+
}
|
|
18
|
+
.c-check-group-layout .check-content-box .cloudapp-checkbox-group {
|
|
19
|
+
display: grid;
|
|
20
|
+
grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
|
|
21
|
+
grid-row-gap: 10px;
|
|
22
|
+
grid-column-gap: 10px;
|
|
23
|
+
}
|
|
24
|
+
.c-check-group-layout .check-content-box .cloudapp-checkbox-group .cloudapp-checkbox-wrapper {
|
|
25
|
+
width: 120px;
|
|
26
|
+
margin-left: 0;
|
|
27
|
+
height: 30px;
|
|
28
|
+
display: flex;
|
|
29
|
+
}
|
|
30
|
+
.c-check-group-layout .check-content-box .cloudapp-checkbox-group .cloudapp-checkbox-wrapper > span:not(.cloudapp-checkbox) {
|
|
31
|
+
flex: 1;
|
|
32
|
+
white-space: nowrap;
|
|
33
|
+
overflow: hidden;
|
|
34
|
+
text-overflow: ellipsis;
|
|
35
|
+
}
|
|
36
|
+
.c-check-group-layout .sider-mask {
|
|
37
|
+
position: fixed;
|
|
38
|
+
z-index: 98;
|
|
39
|
+
width: 100%;
|
|
40
|
+
height: 100%;
|
|
41
|
+
left: 0;
|
|
42
|
+
top: 0;
|
|
43
|
+
}
|
|
44
|
+
.c-check-group-layout .slice-btn {
|
|
45
|
+
color: var(--primary);
|
|
46
|
+
cursor: pointer;
|
|
47
|
+
position: relative;
|
|
48
|
+
top: 4px;
|
|
49
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import './index.less';
|
|
2
|
+
export interface SourceDictType {
|
|
3
|
+
value?: string | number;
|
|
4
|
+
label: string;
|
|
5
|
+
icon?: string;
|
|
6
|
+
}
|
|
7
|
+
interface ICheckGroupFixedProps {
|
|
8
|
+
label: string;
|
|
9
|
+
source: SourceDictType[];
|
|
10
|
+
onChange?: (keys: string[] & number[] & boolean[]) => void;
|
|
11
|
+
checboxSize?: number;
|
|
12
|
+
labelSize?: number;
|
|
13
|
+
cutRow?: number;
|
|
14
|
+
value?: string[] & number[] & boolean[];
|
|
15
|
+
}
|
|
16
|
+
declare function CheckGroupFixed({ label, source, checboxSize, cutRow, labelSize, value, onChange }: ICheckGroupFixedProps): JSX.Element;
|
|
17
|
+
export default CheckGroupFixed;
|