@cloud-app-dev/vidc 2.0.0-alpha.3 → 2.0.0-alpha.30

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.
Files changed (197) hide show
  1. package/.fatherrc.js +11 -4
  2. package/.umirc.ts +1 -1
  3. package/es/Api/index.js +7 -7
  4. package/es/AppRedirect/index.d.ts +1 -1
  5. package/es/AppRedirect/index.js +7 -12
  6. package/es/AppRoute/index.d.ts +3 -7
  7. package/es/AppRoute/index.js +50 -44
  8. package/es/AppRoute/interface.d.ts +2 -12
  9. package/es/Auth/index.js +1 -1
  10. package/es/AutoExit/index.js +12 -10
  11. package/es/{ContentBox → Box}/BetweenBox/index.css +0 -0
  12. package/es/{ContentBox → Box}/BetweenBox/index.d.ts +0 -0
  13. package/es/{ContentBox → Box}/BetweenBox/index.js +0 -0
  14. package/es/{ContentBox → Box}/InfoBox/index.css +0 -0
  15. package/es/{ContentBox → Box}/InfoBox/index.d.ts +0 -0
  16. package/es/{ContentBox → Box}/InfoBox/index.js +0 -0
  17. package/es/{ContentBox → Box}/TwoColumnBox/index.css +0 -0
  18. package/es/{ContentBox → Box}/TwoColumnBox/index.d.ts +0 -0
  19. package/es/{ContentBox → Box}/TwoColumnBox/index.js +0 -0
  20. package/es/{ContentBox → Box}/deps/content-grid.d.ts +0 -0
  21. package/es/{ContentBox → Box}/deps/content-grid.js +0 -0
  22. package/es/{ContentBox → Box}/deps/grid-factory.d.ts +0 -0
  23. package/es/{ContentBox → Box}/deps/grid-factory.js +0 -0
  24. package/es/{ContentBox → Box}/deps/simple-grid.d.ts +0 -0
  25. package/es/{ContentBox → Box}/deps/simple-grid.js +0 -0
  26. package/es/{ContentBox → Box}/index.css +0 -0
  27. package/es/{ContentBox → Box}/index.d.ts +3 -3
  28. package/es/{ContentBox → Box}/index.js +5 -5
  29. package/es/CheckGroupFixed/index.js +4 -2
  30. package/es/Config/index.js +51 -15
  31. package/es/Config/interface.d.ts +27 -10
  32. package/es/Config/utils.d.ts +2 -16
  33. package/es/Config/utils.js +1 -12
  34. package/es/ConfigContext/index.d.ts +15 -2
  35. package/es/ConfigContext/index.js +25 -3
  36. package/es/DeviceSelect/TreeType.d.ts +6 -0
  37. package/es/DeviceSelect/TreeType.js +36 -0
  38. package/es/DeviceSelect/demo.js +2 -2
  39. package/es/DeviceSelect/index.css +6 -1
  40. package/es/DeviceSelect/index.d.ts +5 -0
  41. package/es/DeviceSelect/index.js +21 -52
  42. package/es/Dict/desc.js +3 -3
  43. package/es/Dict/utils.js +3 -3
  44. package/es/IconFont/index.d.ts +0 -1
  45. package/es/IconFont/index.js +12 -13
  46. package/es/InitialConfig/index.js +7 -4
  47. package/es/InitialConfig/utils.d.ts +6 -1
  48. package/es/InitialConfig/utils.js +38 -34
  49. package/es/InitialRequest/index.d.ts +3 -1
  50. package/es/InitialRequest/index.js +29 -19
  51. package/es/InitialRequest/utils.d.ts +8 -6
  52. package/es/InitialRequest/utils.js +59 -95
  53. package/es/Input/index.js +3 -2
  54. package/es/InstanceHistory/index.d.ts +3 -0
  55. package/es/InstanceHistory/index.js +9 -0
  56. package/es/List/CheckExt.d.ts +3 -5
  57. package/es/List/CheckExt.js +21 -13
  58. package/es/{AppRoute → List/DeviceList}/index.css +0 -0
  59. package/es/List/DeviceList/index.d.ts +11 -0
  60. package/es/{DeviceList → List/DeviceList}/index.js +6 -18
  61. package/es/{DynamicDeviceList → List/DynamicDeviceList}/Demo.d.ts +0 -0
  62. package/es/{DynamicList/demo.js → List/DynamicDeviceList/Demo.js} +25 -42
  63. package/es/{DynamicDeviceList → List/DynamicDeviceList}/index.css +5 -17
  64. package/es/List/DynamicDeviceList/index.d.ts +11 -0
  65. package/es/List/DynamicDeviceList/index.js +205 -0
  66. package/es/List/DynamicDeviceList/interface.d.ts +37 -0
  67. package/es/List/DynamicDeviceList/utils.d.ts +16 -0
  68. package/es/List/DynamicDeviceList/utils.js +61 -0
  69. package/es/{DynamicList/demo.d.ts → List/DynamicGridList/Demo.d.ts} +0 -0
  70. package/es/List/DynamicGridList/Demo.js +70 -0
  71. package/es/List/DynamicGridList/index.d.ts +26 -0
  72. package/es/List/DynamicGridList/index.js +73 -0
  73. package/es/List/GridList/Demo.d.ts +2 -0
  74. package/es/List/GridList/Demo.js +91 -0
  75. package/es/List/GridList/hook.d.ts +13 -0
  76. package/es/List/GridList/hook.js +301 -0
  77. package/es/List/GridList/index.css +7 -0
  78. package/es/List/GridList/index.d.ts +15 -0
  79. package/es/List/GridList/index.js +47 -0
  80. package/es/List/GridList/interface.d.ts +59 -0
  81. package/es/List/GridList/utils.d.ts +9 -0
  82. package/es/List/GridList/utils.js +43 -0
  83. package/es/List/ListExt/index.css +3 -0
  84. package/es/{ListExt → List/ListExt}/index.d.ts +1 -1
  85. package/es/{ListExt → List/ListExt}/index.js +3 -3
  86. package/es/List/VList/index.css +6 -0
  87. package/es/List/VList/index.d.ts +18 -0
  88. package/es/List/VList/index.js +51 -0
  89. package/es/List/VList/utils.d.ts +14 -0
  90. package/es/{VList → List/VList}/utils.js +0 -0
  91. package/es/List/index.css +11 -12
  92. package/es/List/index.d.ts +5 -70
  93. package/es/List/index.js +32 -24
  94. package/es/List/interface.d.ts +87 -0
  95. package/es/List/renderItem.d.ts +1 -1
  96. package/es/List/renderItem.js +13 -10
  97. package/es/LoaderApp/index.d.ts +1 -0
  98. package/es/LoaderApp/index.js +24 -10
  99. package/es/LoaderApp/utils.d.ts +2 -1
  100. package/es/LoaderApp/utils.js +8 -10
  101. package/es/LoaderScript/index.js +7 -89
  102. package/es/LoaderScript/utils.d.ts +2 -0
  103. package/es/LoaderScript/utils.js +170 -33
  104. package/es/Picture/component/MoveContent/index.js +3 -3
  105. package/es/RefDrawer/index.js +1 -1
  106. package/es/RefModal/index.js +1 -1
  107. package/es/Service/http.d.ts +6 -4
  108. package/es/Service/http.js +20 -22
  109. package/es/Service/index.d.ts +3 -3
  110. package/es/Service/index.js +7 -11
  111. package/es/Service/interface.d.ts +5 -11
  112. package/es/Service/middleware.d.ts +1 -1
  113. package/es/Service/middleware.js +1 -1
  114. package/es/TableLayout/index.d.ts +3 -0
  115. package/es/TableLayout/index.js +14 -45
  116. package/es/{TreeTitle → Title}/index.css +5 -5
  117. package/es/{TreeTitle → Title}/index.d.ts +2 -2
  118. package/es/{TreeTitle → Title}/index.js +7 -4
  119. package/es/{TreeMode → Tree/BaseTree}/demo.d.ts +0 -0
  120. package/es/Tree/BaseTree/demo.js +69 -0
  121. package/es/Tree/BaseTree/index.css +64 -0
  122. package/es/Tree/BaseTree/index.d.ts +24 -0
  123. package/es/Tree/BaseTree/index.js +83 -0
  124. package/es/Tree/demo.js +19 -56
  125. package/es/Tree/index.css +29 -55
  126. package/es/Tree/index.d.ts +19 -20
  127. package/es/Tree/index.js +185 -70
  128. package/es/UserSelect/index.js +6 -4
  129. package/es/WorkerFlow/Form/Condition.js +2 -4
  130. package/es/WorkerFlow/Form/EmptyUserSet.js +2 -4
  131. package/es/WorkerFlow/Form/FormAuth.js +2 -2
  132. package/es/WorkerFlow/Form/GroupList.js +2 -2
  133. package/es/WorkerFlow/Form/GroupSelect.js +2 -4
  134. package/es/WorkerFlow/Form/GroupSelectModalContent.js +1 -1
  135. package/es/WorkerFlow/Form/LevelGroupSelect.js +3 -5
  136. package/es/WorkerFlow/Form/UserAndGroupSelect.js +2 -4
  137. package/es/WorkerFlow/Form/UserSelect.js +2 -4
  138. package/es/WorkerFlow/Form/UserSelectModalContent.js +3 -3
  139. package/es/WorkerFlow/Form/UserSet.js +2 -2
  140. package/es/WorkerFlow/Nodes/TitleElement.js +71 -34
  141. package/es/WorkerFlow/index.css +9 -3
  142. package/es/WorkerFlow/index.js +13 -8
  143. package/es/WorkerFlow/utils.js +2 -2
  144. package/es/index.d.ts +3 -10
  145. package/es/index.js +3 -10
  146. package/es/useDrawer/index.d.ts +1 -1
  147. package/es/useDrawer/index.js +3 -2
  148. package/es/useHistory/index.d.ts +2 -2
  149. package/es/useHistory/index.js +3 -6
  150. package/es/useHttp/index.js +1 -1
  151. package/es/useModal/index.d.ts +1 -1
  152. package/es/useModal/index.js +3 -2
  153. package/es/utils.d.ts +9 -0
  154. package/es/utils.js +36 -1
  155. package/package.json +10 -12
  156. package/tsconfig.json +1 -1
  157. package/es/AppRoute/Render.d.ts +0 -23
  158. package/es/AppRoute/Render.js +0 -111
  159. package/es/AppRoute/Rendered.d.ts +0 -4
  160. package/es/AppRoute/Rendered.js +0 -11
  161. package/es/AppRoute/utils.d.ts +0 -1
  162. package/es/AppRoute/utils.js +0 -28
  163. package/es/DeviceList/index.css +0 -32
  164. package/es/DeviceList/index.d.ts +0 -14
  165. package/es/DynamicDeviceList/CheckExt.d.ts +0 -8
  166. package/es/DynamicDeviceList/CheckExt.js +0 -36
  167. package/es/DynamicDeviceList/Demo.js +0 -17
  168. package/es/DynamicDeviceList/index.d.ts +0 -35
  169. package/es/DynamicDeviceList/index.js +0 -224
  170. package/es/DynamicDeviceList/utils.d.ts +0 -2
  171. package/es/DynamicDeviceList/utils.js +0 -15
  172. package/es/DynamicList/index.css +0 -7
  173. package/es/DynamicList/index.d.ts +0 -31
  174. package/es/DynamicList/index.js +0 -132
  175. package/es/IconFont/index.css +0 -0
  176. package/es/List/utils.d.ts +0 -5
  177. package/es/List/utils.js +0 -18
  178. package/es/ListExt/index.css +0 -9
  179. package/es/ScrollList/index.css +0 -73
  180. package/es/ScrollList/index.d.ts +0 -24
  181. package/es/ScrollList/index.js +0 -261
  182. package/es/ScrollList/utils.js +0 -84
  183. package/es/Service/logger.d.ts +0 -3
  184. package/es/Service/logger.js +0 -13
  185. package/es/Service/utils.d.ts +0 -3
  186. package/es/Service/utils.js +0 -11
  187. package/es/TreeMode/demo.js +0 -32
  188. package/es/TreeMode/index.css +0 -38
  189. package/es/TreeMode/index.d.ts +0 -23
  190. package/es/TreeMode/index.js +0 -201
  191. package/es/VList/index.css +0 -4
  192. package/es/VList/index.d.ts +0 -16
  193. package/es/VList/index.js +0 -56
  194. package/es/VList/utils.d.ts +0 -10
  195. package/es/useChangeEffect/index.d.ts +0 -3
  196. package/es/useChangeEffect/index.js +0 -32
  197. package/es/useHistory/index.css +0 -0
package/.fatherrc.js CHANGED
@@ -1,10 +1,6 @@
1
- import nodePolyfills from 'rollup-plugin-node-polyfills';
2
-
3
1
  export default {
4
2
  target: 'browser',
5
3
  esm: 'babel',
6
- extraRollupPlugins: [nodePolyfills()],
7
- lessInBabelMode: true, // babel 模式下做 less 编译
8
4
  pkgs: [
9
5
  // 组件依赖构建顺序, 例如 a组件依赖于b组件,那么需要先编译 b,在编译a,则 这里可以控制组件编译顺序
10
6
  ],
@@ -15,4 +11,15 @@ export default {
15
11
  ['import', { libraryName: 'ahooks', style: false, camel2DashComponentName: false, libraryDirectory: 'es' }, 'ahooks'],
16
12
  ['import', { libraryName: '@cloud-app-dev/map', style: false, camel2DashComponentName: false, libraryDirectory: 'es' }, 'map-components'],
17
13
  ],
14
+ lessInRollupMode: {
15
+ modifyVars: {
16
+ '@ant-prefix': 'cloudapp',
17
+ },
18
+ },
19
+ lessInBabelMode: {
20
+ // babel 模式下做 less 编译
21
+ modifyVars: {
22
+ '@ant-prefix': 'cloudapp',
23
+ },
24
+ },
18
25
  };
package/.umirc.ts CHANGED
@@ -2,7 +2,7 @@ import { defineConfig } from 'dumi';
2
2
  import path from 'path';
3
3
 
4
4
  const token =
5
- 'eyJhbGciOiJIUzI1NiJ9.eyJvcmdhbml6YXRpb25JZCI6IjEwMDEwMTAwMDQ0NiIsImV4dCI6MTYzODY4NzgyNzEwNywidWlkIjoiMTAxMDAwMDAwMjQ5IiwidmFsaWRTdGF0ZSI6MTA0NDA2LCJyb2xlSWQiOlsxMDAwMDAxMTAzODddLCJ2YWxpZFRpbWUiOm51bGwsIm9wdENlbnRlcklkIjoiMTAwMTAwMDAwMjMzIiwidXNlclR5cGUiOjEwMDcwMiwiaWF0IjoxNjM4NDI4NjI3MTA3fQ.eEvUc9_eGBdUi2QCMDNjOYgTzTKwiLX-7DEQ_O9kjhs';
5
+ 'eyJhbGciOiJIUzI1NiJ9.eyJvcmdhbml6YXRpb25JZCI6IjEwMDEwMTAwMDQ0NiIsImV4dCI6MTY0MDQwOTc4NjQ3OCwidWlkIjoiMTAxMDAwMDAwMjQ5IiwidmFsaWRTdGF0ZSI6MTA0NDA2LCJyb2xlSWQiOlsxMDAwMDAxMTAzODddLCJ2YWxpZFRpbWUiOm51bGwsIm9wdENlbnRlcklkIjoiMTAwMTAwMDAwMjMzIiwidXNlclR5cGUiOjEwMDcwMiwiaWF0IjoxNjQwMTUwNTg2NDc4fQ.9a8me82dxS_DJ52Ac8eBu1Y2Gigs7mZ6Cm3Rd-tj5Vk';
6
6
 
7
7
  export default defineConfig({
8
8
  title: '云应用-业务组件库',
package/es/Api/index.js CHANGED
@@ -2,7 +2,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
2
2
 
3
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); } }
4
4
 
5
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
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; }
6
6
 
7
7
  import { __awaiter } from "tslib";
8
8
  import Service from '../Service';
@@ -23,7 +23,7 @@ var Api = /*#__PURE__*/function () {
23
23
  switch (_context.prev = _context.next) {
24
24
  case 0:
25
25
  _context.next = 2;
26
- return Service.$http({
26
+ return Service.http({
27
27
  url: '/api/user/v1/organization/queryChildOrganizationsById',
28
28
  method: 'post',
29
29
  requestId: 'queryChildOrganizationsById',
@@ -60,7 +60,7 @@ var Api = /*#__PURE__*/function () {
60
60
  switch (_context2.prev = _context2.next) {
61
61
  case 0:
62
62
  _context2.next = 2;
63
- return Service.$http({
63
+ return Service.http({
64
64
  url: '/api/user/v1/queryUsers',
65
65
  method: 'post',
66
66
  requestId: 'queryUsers',
@@ -98,7 +98,7 @@ var Api = /*#__PURE__*/function () {
98
98
  switch (_context3.prev = _context3.next) {
99
99
  case 0:
100
100
  _context3.next = 2;
101
- return Service.$http({
101
+ return Service.http({
102
102
  url: "/api/user/v2/post/queryPostByOrgId/".concat(orgId),
103
103
  method: 'post',
104
104
  requestId: 'queryPostByOrgId',
@@ -128,7 +128,7 @@ var Api = /*#__PURE__*/function () {
128
128
  switch (_context4.prev = _context4.next) {
129
129
  case 0:
130
130
  _context4.next = 2;
131
- return Service.$http({
131
+ return Service.http({
132
132
  url: '/api/udm-api/DeviceBuzTree/queryList',
133
133
  method: 'post',
134
134
  requestId: 'getDeviceBzTree',
@@ -158,7 +158,7 @@ var Api = /*#__PURE__*/function () {
158
158
  switch (_context5.prev = _context5.next) {
159
159
  case 0:
160
160
  _context5.next = 2;
161
- return Service.$http({
161
+ return Service.http({
162
162
  url: '/api/udm-api/customDeviceGroup/queryList',
163
163
  method: 'post',
164
164
  requestId: 'customDeviceGroup',
@@ -188,7 +188,7 @@ var Api = /*#__PURE__*/function () {
188
188
  switch (_context6.prev = _context6.next) {
189
189
  case 0:
190
190
  _context6.next = 2;
191
- return Service.$http({
191
+ return Service.http({
192
192
  url: '/api/place/v1/getPlacesByHasDevice',
193
193
  method: 'post',
194
194
  requestId: 'getPlacesByHasDevice',
@@ -10,7 +10,7 @@ interface AppRedirectProps {
10
10
  * @description 重定向路径
11
11
  * @description -
12
12
  */
13
- to: H.LocationDescriptor<any>;
13
+ to: H.Location;
14
14
  }
15
15
  declare function AppRedirect({ path, to }: AppRedirectProps): JSX.Element;
16
16
  export default AppRedirect;
@@ -1,6 +1,5 @@
1
1
  import React, { useEffect } from 'react';
2
- import { useLocation } from 'react-router-dom';
3
- import useHistory from '../useHistory';
2
+ import { useLocation, useNavigate } from 'react-router-dom';
4
3
  import "./index.css";
5
4
 
6
5
  var getKey = function getKey() {
@@ -10,24 +9,20 @@ var getKey = function getKey() {
10
9
  function AppRedirect(_ref) {
11
10
  var path = _ref.path,
12
11
  to = _ref.to;
13
- var history = useHistory();
12
+ var navigate = useNavigate();
14
13
  var location = useLocation();
15
14
  useEffect(function () {
16
15
  if (path === location.pathname) {
17
16
  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()),
17
+ navigate("".concat(to.pathname).concat(to.search ? "".concat(to.search, "&key=").concat(getKey()) : "?key=".concat(getKey())), {
18
+ replace: true,
20
19
  state: Object.assign({}, to.state, {
21
20
  isReplace: true
22
21
  })
23
- }));
22
+ });
24
23
  } else {
25
- history.push({
26
- pathname: to,
27
- search: "?key".concat(getKey()),
28
- state: {
29
- isReplace: true
30
- }
24
+ navigate("".concat(to, "?key").concat(getKey()), {
25
+ replace: true
31
26
  });
32
27
  }
33
28
  }
@@ -1,14 +1,10 @@
1
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;
2
+ import { IAppRouteProps } from './interface';
3
+ declare class AppRoute extends React.Component<IAppRouteProps, any> {
4
+ static defaultProps: IAppRouteProps;
8
5
  constructor(props: IAppRouteProps);
9
6
  shouldComponentUpdate(props: IAppRouteProps): boolean;
10
7
  componentWillUnmount(): void;
11
- setRouteProps: (newMatch: match<any>, newLocation: H.Location<any>, history: H.History<any>) => void;
12
8
  render(): JSX.Element;
13
9
  }
14
10
  export default AppRoute;
@@ -1,16 +1,15 @@
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); }
1
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
2
2
 
3
- import _logger from "@cloud-app-dev/utils/es/logger";
4
3
  import _cache from "@cloud-app-dev/utils/es/cache";
5
- import _isEqual from "@cloud-app-dev/utils/es/isEqual";
4
+ import _useMount from "ahooks/es/useMount";
6
5
 
7
6
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
8
7
 
9
8
  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
9
 
11
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
10
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
12
11
 
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); }
12
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
14
13
 
15
14
  function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
16
15
 
@@ -24,12 +23,21 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
24
23
 
25
24
  function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
26
25
 
26
+ import { __rest } from "tslib";
27
27
  import React from 'react';
28
- import { RenderComponents, RenderRoutes, RenderSingleRoute } from './Render';
29
- import Rendered from './Rendered';
30
- import "./index.css";
28
+ import { Route, Routes } from 'react-router-dom';
31
29
  var _global = window;
32
30
 
31
+ function RenderSingleRoute(_ref) {
32
+ var onMount = _ref.onMount;
33
+
34
+ _useMount(function () {
35
+ return onMount();
36
+ });
37
+
38
+ return /*#__PURE__*/React.createElement(React.Fragment, null);
39
+ }
40
+
33
41
  var AppRoute = /*#__PURE__*/function (_React$Component) {
34
42
  _inherits(AppRoute, _React$Component);
35
43
 
@@ -41,23 +49,8 @@ var AppRoute = /*#__PURE__*/function (_React$Component) {
41
49
  _classCallCheck(this, AppRoute);
42
50
 
43
51
  _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
52
  _this.state = {
58
- match: undefined,
59
- location: undefined,
60
- history: undefined
53
+ matchIndex: -1
61
54
  };
62
55
  return _this;
63
56
  }
@@ -65,42 +58,55 @@ var AppRoute = /*#__PURE__*/function (_React$Component) {
65
58
  _createClass(AppRoute, [{
66
59
  key: "shouldComponentUpdate",
67
60
  value: function shouldComponentUpdate(props) {
68
- if (!_global._IS_RUN_MICRO_BASIC || !this.isRender || _global._IS_ALLOW_ROUTE_RENDER) {
61
+ var tabId = _cache.getCache('currentTabKey', 'session');
62
+
63
+ if (!_global._IS_RUN_MICRO_BASIC) {
69
64
  return true;
70
- }
65
+ } // 页签变化拦截
71
66
 
72
- return (props.currentId || _cache.getCache('currentTabKey', 'session')) === props.tabId;
67
+
68
+ console.debug("App \u66F4\u65B0\u62E6\u622A\uFF0C\u62E6\u622AAppId\uFF1A".concat(props.tabId, "\uFF0C\u53EF\u66F4\u65B0AppId\uFF1A").concat(tabId));
69
+ return tabId === props.tabId;
73
70
  }
74
71
  }, {
75
72
  key: "componentWillUnmount",
76
73
  value: function componentWillUnmount() {
77
- _logger.debug('路由销毁');
74
+ console.debug('路由销毁');
78
75
  }
79
76
  }, {
80
77
  key: "render",
81
78
  value: function render() {
82
79
  var _this2 = this;
83
80
 
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
- }));
81
+ var matchIndex = this.state.matchIndex;
82
+
83
+ var _a = this.props,
84
+ _a$routes = _a.routes,
85
+ routes = _a$routes === void 0 ? [] : _a$routes,
86
+ props = __rest(_a, ["routes"]);
87
+
88
+ var component = matchIndex > -1 ? routes[matchIndex].element : undefined;
89
+ console.debug('Route Match Index', matchIndex);
90
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Routes, null, routes.map(function (item, index) {
91
+ return /*#__PURE__*/React.createElement(Route, {
92
+ path: item.path,
93
+ key: item.path,
94
+ element: /*#__PURE__*/React.createElement(RenderSingleRoute, {
95
+ onMount: function onMount() {
96
+ return _this2.setState({
97
+ matchIndex: index
98
+ });
99
+ }
100
+ })
101
+ });
102
+ })), component && /*#__PURE__*/React.cloneElement(component, props));
100
103
  }
101
104
  }]);
102
105
 
103
106
  return AppRoute;
104
107
  }(React.Component);
105
108
 
109
+ AppRoute.defaultProps = {
110
+ routes: []
111
+ };
106
112
  export default AppRoute;
@@ -1,18 +1,8 @@
1
1
  import * as H from 'history';
2
- import { RouteProps, match } from 'react-router-dom';
2
+ import { RouteProps } from 'react-router-dom';
3
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 {
4
+ export interface IAppRouteProps {
11
5
  routes?: RouteProps[];
12
6
  tabId?: string;
13
7
  currentId?: string;
14
8
  }
15
-
16
- export interface IRenderRouteProps extends IAppRouteType {
17
- setRouteProps: (match: match<any>, location: H.Location, history: H.History) => void;
18
- }
package/es/Auth/index.js CHANGED
@@ -7,7 +7,7 @@ function Auth(_ref) {
7
7
  children = _ref.children;
8
8
  var action = useMemo(function () {
9
9
  return !!Config.feature.find(function (v) {
10
- return v.id === featureId;
10
+ return v === featureId;
11
11
  });
12
12
  }, [featureId]); //获取按钮权限
13
13
 
@@ -1,5 +1,6 @@
1
- import React, { useContext } from 'react';
2
- import useHistory from '../useHistory';
1
+ import _nextTick from "@cloud-app-dev/utils/es/nextTick";
2
+ import React, { useContext, useEffect } from 'react';
3
+ import { useNavigate } from 'react-router-dom';
3
4
  import AppContext from '../AppContext';
4
5
 
5
6
  function AutoExit(_ref) {
@@ -8,14 +9,15 @@ function AutoExit(_ref) {
8
9
  var _useContext = useContext(AppContext.Context),
9
10
  loginStatus = _useContext.loginStatus;
10
11
 
11
- var history = useHistory();
12
-
13
- if (!loginStatus) {
14
- history.replace('/login');
15
- return null;
16
- }
17
-
18
- return /*#__PURE__*/React.createElement(React.Fragment, null, children);
12
+ var navigate = useNavigate();
13
+ useEffect(function () {
14
+ if (!loginStatus) {
15
+ _nextTick(function () {
16
+ return navigate('/login');
17
+ });
18
+ }
19
+ }, [loginStatus, navigate]);
20
+ return /*#__PURE__*/React.createElement(React.Fragment, null, loginStatus ? children : null);
19
21
  }
20
22
 
21
23
  export default AutoExit;
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -5,10 +5,10 @@ export interface ContentBoxProps {
5
5
  contentGrid?: any;
6
6
  children?: React.ReactNode;
7
7
  }
8
- declare function ContentBox({ className, contentGrid, children }: ContentBoxProps): JSX.Element;
9
- declare namespace ContentBox {
8
+ declare function Box({ className, contentGrid, children }: ContentBoxProps): JSX.Element;
9
+ declare namespace Box {
10
10
  var TwoColumnBox: typeof import("./TwoColumnBox").default;
11
11
  var InfoBox: typeof import("./InfoBox").default;
12
12
  var BetweenBox: typeof import("./BetweenBox").default;
13
13
  }
14
- export default ContentBox;
14
+ export default Box;
@@ -9,7 +9,7 @@ import defaultContentGrid from './deps/content-grid';
9
9
  import BetweenBox from './BetweenBox';
10
10
  import "./index.css";
11
11
 
12
- function ContentBox(_ref) {
12
+ function Box(_ref) {
13
13
  var _ref$className = _ref.className,
14
14
  className = _ref$className === void 0 ? '' : _ref$className,
15
15
  _ref$contentGrid = _ref.contentGrid,
@@ -22,7 +22,7 @@ function ContentBox(_ref) {
22
22
  }, contentGrid), children));
23
23
  }
24
24
 
25
- ContentBox.TwoColumnBox = TwoColumnBox;
26
- ContentBox.InfoBox = InfoBox;
27
- ContentBox.BetweenBox = BetweenBox;
28
- export default ContentBox;
25
+ Box.TwoColumnBox = TwoColumnBox;
26
+ Box.InfoBox = InfoBox;
27
+ Box.BetweenBox = BetweenBox;
28
+ export default Box;
@@ -2,6 +2,7 @@ import "antd/lib/badge/style";
2
2
  import _Badge from "antd/lib/badge";
3
3
  import "antd/lib/checkbox/style";
4
4
  import _Checkbox from "antd/lib/checkbox";
5
+ import _useUpdateEffect from "ahooks/es/useUpdateEffect";
5
6
 
6
7
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
7
8
 
@@ -16,7 +17,6 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
16
17
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
17
18
 
18
19
  import React, { useLayoutEffect, useMemo, useRef, useState } from 'react';
19
- import useChangeEffect from '../useChangeEffect';
20
20
  import "./index.css";
21
21
 
22
22
  function CheckGroupFixed(_ref) {
@@ -72,9 +72,11 @@ function CheckGroupFixed(_ref) {
72
72
  boxShadow: ' 0 0 10px rgba(0,0,0,0.1)'
73
73
  } : {};
74
74
  }, [state.sider, state.w]);
75
- useChangeEffect(function () {
75
+
76
+ _useUpdateEffect(function () {
76
77
  return onChange && onChange(state.selectKeys);
77
78
  }, [state.selectKeys]);
79
+
78
80
  useLayoutEffect(function () {
79
81
  var dom = domRef.current.querySelector('.check-box-group-layout');
80
82
  dom === null || dom === void 0 ? void 0 : dom.setAttribute('style', "grid-template-columns:repeat(auto-fill, minmax(".concat(checboxSize, "px, 1fr));"));
@@ -1,34 +1,70 @@
1
1
  import produce from 'immer';
2
+ import { insertThemeStyle } from './utils';
2
3
  var Config = {
3
- app: produce([], function () {}),
4
+ app: produce({}, function () {}),
4
5
  bs: produce({}, function () {}),
5
- feature: produce([], function () {}),
6
- pFeature: produce([], function () {}),
6
+ features: produce([], function () {}),
7
+ featureIds: produce([], function () {}),
7
8
  theme: produce({}, function () {}),
8
- registerAppConfig: function registerAppConfig(app) {
9
+ registerAppConfig: function registerAppConfig() {
10
+ var app = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
9
11
  Config.app = produce(Config.app, function (draft) {
10
- draft = app;
12
+ app.forEach(function (item) {
13
+ draft[item.routerPrefix] = item;
14
+ });
11
15
  });
12
16
  },
13
- registerFeatrue: function registerFeatrue(feature) {
14
- Config.feature = produce(Config.feature, function (draft) {
15
- draft = feature;
17
+ registerFeatrueIds: function registerFeatrueIds() {
18
+ var featureIds = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
19
+ Config.featureIds = produce(Config.featureIds, function (draft) {
20
+ featureIds.forEach(function (id) {
21
+ var index = draft.findIndex(function (v) {
22
+ return v === id;
23
+ });
24
+
25
+ if (index === -1) {
26
+ draft.push(id);
27
+ } else {
28
+ draft[index] = id;
29
+ }
30
+ });
16
31
  });
17
32
  },
18
- registerBSConfig: function registerBSConfig(bs) {
33
+ registerBSConfig: function registerBSConfig() {
34
+ var bs = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
19
35
  Config.bs = produce(Config.bs, function (draft) {
20
- draft = bs;
36
+ Object.keys(bs).forEach(function (key) {
37
+ draft[key] = bs[key];
38
+ });
21
39
  });
22
40
  },
23
- registerPlatformFeature: function registerPlatformFeature(pFeature) {
24
- Config.pFeature = produce(Config.pFeature, function (draft) {
25
- draft = pFeature;
41
+ registerPlatformFeature: function registerPlatformFeature() {
42
+ var features = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
43
+ Config.features = produce(Config.features, function (draft) {
44
+ features.forEach(function (item) {
45
+ var index = draft.findIndex(function (v) {
46
+ return v.id === item.id;
47
+ });
48
+
49
+ if (index === -1) {
50
+ draft.push(item);
51
+ } else {
52
+ draft[index] = item;
53
+ }
54
+ });
26
55
  });
27
56
  },
28
- registerThemeConfig: function registerThemeConfig(theme) {
57
+ registerThemeConfig: function registerThemeConfig() {
58
+ var theme = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
59
+ insertThemeStyle(theme);
29
60
  Config.theme = produce(Config.theme, function (draft) {
30
- draft = theme;
61
+ Object.keys(theme).forEach(function (key) {
62
+ draft[key] = theme[key];
63
+ });
31
64
  });
65
+ },
66
+ getThemeVarValue: function getThemeVarValue(themeKey) {
67
+ return getComputedStyle(document.querySelector(':root')).getPropertyValue("--".concat(themeKey));
32
68
  }
33
69
  };
34
70
 
@@ -17,31 +17,48 @@ export type FeatureItemType = {
17
17
  type: 1 | 2 | 3; //功能类型1:实际菜单,2:权限,3:虚拟分组
18
18
  interfaceCodes: string[];
19
19
  icon: string;
20
- routerUrl: string;
20
+ routeUrl: string;
21
21
  sort: number;
22
+ children?: FeatureItemType[];
23
+ parentId?: string;
24
+ level?: number;
22
25
  };
23
26
 
24
27
  export type BSConfigType = {
25
28
  systemLogo: string;
26
29
  systemName: string;
30
+ parterLogo: string[];
31
+ loginBG: string;
27
32
  icp: string[];
28
33
  openSocket: boolean;
29
34
  chromeDownloadUrl: string;
35
+ AppTimeOut: number;
36
+ shortcut: string;
37
+ download: { chrome: string; player: string };
38
+ [key: string]: any;
39
+ };
40
+
41
+ export type ThemeInfoType = {
42
+ vars: { [key: string]: string[] };
43
+ style: {
44
+ menuType: 'inline' | 'horizontal';
45
+ hasTab: boolean;
46
+ };
30
47
  };
31
48
 
32
- export type ConfigKey = 'app' | 'feature' | 'pFeature' | 'bs';
49
+ export type ConfigKey = 'app' | 'feature' | 'featureIds' | 'bs' | 'theme';
33
50
 
34
51
  export type ConfigJOSN = {
35
- app: AppItemType[];
36
- feature: FeatureItemType[];
37
- pFeature: FeatureItemType[];
52
+ app: { [key: string]: AppItemType };
53
+ features: FeatureItemType[];
54
+ featureIds: string[];
38
55
  bs: BSConfigType;
39
- theme: any;
40
- registerAppConfig: (conf: AppItemType) => void;
41
- registerFeatrue: (conf: FeatureItemType[]) => void;
56
+ theme: ThemeInfoType;
57
+ registerAppConfig: (conf: AppItemType[]) => void;
58
+ registerFeatrueIds: (conf: string[]) => void;
42
59
  registerBSConfig: (conf: BSConfigType) => void;
43
60
  registerPlatformFeature: (conf: FeatureItemType[]) => void;
44
- registerThemeConfig: (conf: { [key: string]: any }) => void;
45
-
61
+ registerThemeConfig: (conf: ThemeInfoType) => void;
62
+ getThemeVarValue: (themeKey: string) => string;
46
63
  [key: string]: any;
47
64
  };