@cloud-app-dev/vidc 2.0.0-alpha.7 → 2.1.0-alpha.2

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/Auth/index.js +1 -1
  7. package/es/AutoExit/index.js +12 -10
  8. package/es/{ContentBox → Box}/BetweenBox/index.css +0 -0
  9. package/es/{ContentBox → Box}/BetweenBox/index.d.ts +0 -0
  10. package/es/{ContentBox → Box}/BetweenBox/index.js +0 -0
  11. package/es/{ContentBox → Box}/InfoBox/index.css +0 -0
  12. package/es/{ContentBox → Box}/InfoBox/index.d.ts +0 -0
  13. package/es/{ContentBox → Box}/InfoBox/index.js +0 -0
  14. package/es/{ContentBox → Box}/TwoColumnBox/index.css +0 -0
  15. package/es/{ContentBox → Box}/TwoColumnBox/index.d.ts +0 -0
  16. package/es/{ContentBox → Box}/TwoColumnBox/index.js +0 -0
  17. package/es/{ContentBox → Box}/deps/content-grid.d.ts +0 -0
  18. package/es/{ContentBox → Box}/deps/content-grid.js +0 -0
  19. package/es/{ContentBox → Box}/deps/grid-factory.d.ts +0 -0
  20. package/es/{ContentBox → Box}/deps/grid-factory.js +0 -0
  21. package/es/{ContentBox → Box}/deps/simple-grid.d.ts +0 -0
  22. package/es/{ContentBox → Box}/deps/simple-grid.js +0 -0
  23. package/es/{ContentBox → Box}/index.css +0 -0
  24. package/es/{ContentBox → Box}/index.d.ts +3 -3
  25. package/es/{ContentBox → Box}/index.js +5 -5
  26. package/es/CheckGroupFixed/index.js +4 -2
  27. package/es/Config/index.js +44 -14
  28. package/es/Config/interface.d.ts +12 -5
  29. package/es/Config/utils.d.ts +1 -1
  30. package/es/Config/utils.js +1 -3
  31. package/es/ConfigContext/index.d.ts +15 -2
  32. package/es/ConfigContext/index.js +25 -3
  33. package/es/DeviceSelect/TreeType.d.ts +6 -0
  34. package/es/DeviceSelect/TreeType.js +36 -0
  35. package/es/DeviceSelect/demo.js +2 -2
  36. package/es/DeviceSelect/index.css +6 -1
  37. package/es/DeviceSelect/index.d.ts +5 -0
  38. package/es/DeviceSelect/index.js +21 -52
  39. package/es/Dict/desc.js +3 -3
  40. package/es/Dict/utils.js +3 -3
  41. package/es/IconFont/index.d.ts +0 -1
  42. package/es/IconFont/index.js +12 -13
  43. package/es/InitialConfig/index.js +7 -4
  44. package/es/InitialConfig/utils.d.ts +5 -0
  45. package/es/InitialConfig/utils.js +33 -6
  46. package/es/InitialRequest/index.d.ts +3 -1
  47. package/es/InitialRequest/index.js +20 -16
  48. package/es/InitialRequest/utils.d.ts +6 -4
  49. package/es/InitialRequest/utils.js +52 -70
  50. package/es/Input/index.js +3 -2
  51. package/es/InstanceHistory/index.d.ts +3 -0
  52. package/es/InstanceHistory/index.js +9 -0
  53. package/es/List/CheckExt.d.ts +3 -5
  54. package/es/List/CheckExt.js +21 -13
  55. package/es/{AppRoute → List/DeviceList}/index.css +0 -0
  56. package/es/List/DeviceList/index.d.ts +11 -0
  57. package/es/{DeviceList → List/DeviceList}/index.js +6 -18
  58. package/es/{DynamicDeviceList → List/DynamicDeviceList}/Demo.d.ts +0 -0
  59. package/es/{DynamicList/demo.js → List/DynamicDeviceList/Demo.js} +25 -42
  60. package/es/{DynamicDeviceList → List/DynamicDeviceList}/index.css +5 -17
  61. package/es/List/DynamicDeviceList/index.d.ts +11 -0
  62. package/es/List/DynamicDeviceList/index.js +205 -0
  63. package/es/List/DynamicDeviceList/interface.d.ts +37 -0
  64. package/es/List/DynamicDeviceList/utils.d.ts +16 -0
  65. package/es/List/DynamicDeviceList/utils.js +61 -0
  66. package/es/{DynamicList/demo.d.ts → List/DynamicGridList/Demo.d.ts} +0 -0
  67. package/es/List/DynamicGridList/Demo.js +70 -0
  68. package/es/List/DynamicGridList/index.d.ts +26 -0
  69. package/es/List/DynamicGridList/index.js +73 -0
  70. package/es/List/GridList/Demo.d.ts +2 -0
  71. package/es/List/GridList/Demo.js +91 -0
  72. package/es/List/GridList/hook.d.ts +13 -0
  73. package/es/List/GridList/hook.js +301 -0
  74. package/es/List/GridList/index.css +7 -0
  75. package/es/List/GridList/index.d.ts +15 -0
  76. package/es/List/GridList/index.js +47 -0
  77. package/es/List/GridList/interface.d.ts +59 -0
  78. package/es/List/GridList/utils.d.ts +9 -0
  79. package/es/List/GridList/utils.js +43 -0
  80. package/es/List/ListExt/index.css +3 -0
  81. package/es/{ListExt → List/ListExt}/index.d.ts +1 -1
  82. package/es/{ListExt → List/ListExt}/index.js +3 -3
  83. package/es/List/VList/index.css +6 -0
  84. package/es/List/VList/index.d.ts +18 -0
  85. package/es/List/VList/index.js +51 -0
  86. package/es/List/VList/utils.d.ts +14 -0
  87. package/es/{VList → List/VList}/utils.js +0 -0
  88. package/es/List/index.css +11 -12
  89. package/es/List/index.d.ts +5 -70
  90. package/es/List/index.js +32 -24
  91. package/es/List/interface.d.ts +87 -0
  92. package/es/List/renderItem.d.ts +1 -1
  93. package/es/List/renderItem.js +13 -10
  94. package/es/LoaderApp/index.d.ts +1 -1
  95. package/es/LoaderApp/index.js +18 -18
  96. package/es/LoaderApp/utils.d.ts +2 -1
  97. package/es/LoaderApp/utils.js +6 -3
  98. package/es/LoaderScript/index.js +7 -89
  99. package/es/LoaderScript/utils.d.ts +2 -0
  100. package/es/LoaderScript/utils.js +170 -33
  101. package/es/Picture/component/MoveContent/index.js +3 -3
  102. package/es/RefDrawer/index.js +1 -1
  103. package/es/RefModal/index.js +1 -1
  104. package/es/Service/http.d.ts +6 -4
  105. package/es/Service/http.js +20 -22
  106. package/es/Service/index.d.ts +3 -3
  107. package/es/Service/index.js +7 -11
  108. package/es/Service/interface.d.ts +5 -11
  109. package/es/Service/middleware.d.ts +1 -1
  110. package/es/Service/middleware.js +1 -1
  111. package/es/TableLayout/index.d.ts +3 -0
  112. package/es/TableLayout/index.js +14 -45
  113. package/es/{TreeTitle → Title}/index.css +5 -5
  114. package/es/{TreeTitle → Title}/index.d.ts +2 -2
  115. package/es/{TreeTitle → Title}/index.js +7 -4
  116. package/es/{TreeMode → Tree/BaseTree}/demo.d.ts +0 -0
  117. package/es/Tree/BaseTree/demo.js +69 -0
  118. package/es/Tree/BaseTree/index.css +64 -0
  119. package/es/Tree/BaseTree/index.d.ts +24 -0
  120. package/es/Tree/BaseTree/index.js +83 -0
  121. package/es/Tree/demo.js +19 -56
  122. package/es/Tree/index.css +29 -55
  123. package/es/Tree/index.d.ts +19 -20
  124. package/es/Tree/index.js +185 -70
  125. package/es/UserSelect/index.js +6 -4
  126. package/es/WorkerFlow/Form/Condition.js +2 -4
  127. package/es/WorkerFlow/Form/EmptyUserSet.js +2 -4
  128. package/es/WorkerFlow/Form/FormAuth.js +2 -2
  129. package/es/WorkerFlow/Form/GroupList.js +2 -2
  130. package/es/WorkerFlow/Form/GroupSelect.js +2 -4
  131. package/es/WorkerFlow/Form/GroupSelectModalContent.js +1 -1
  132. package/es/WorkerFlow/Form/LevelGroupSelect.js +3 -5
  133. package/es/WorkerFlow/Form/UserAndGroupSelect.js +2 -4
  134. package/es/WorkerFlow/Form/UserSelect.js +2 -4
  135. package/es/WorkerFlow/Form/UserSelectModalContent.js +3 -3
  136. package/es/WorkerFlow/Form/UserSet.js +2 -2
  137. package/es/WorkerFlow/Nodes/TitleElement.js +71 -34
  138. package/es/WorkerFlow/index.css +9 -3
  139. package/es/WorkerFlow/index.js +13 -8
  140. package/es/WorkerFlow/utils.js +2 -2
  141. package/es/index.d.ts +3 -11
  142. package/es/index.js +3 -11
  143. package/es/useDrawer/index.d.ts +1 -1
  144. package/es/useDrawer/index.js +3 -2
  145. package/es/useHistory/index.d.ts +2 -2
  146. package/es/useHistory/index.js +3 -6
  147. package/es/useHttp/index.js +1 -1
  148. package/es/useModal/index.d.ts +1 -1
  149. package/es/useModal/index.js +3 -2
  150. package/es/utils.d.ts +9 -0
  151. package/es/utils.js +36 -1
  152. package/package.json +10 -11
  153. package/tsconfig.json +1 -1
  154. package/es/AppRoute/Render.d.ts +0 -23
  155. package/es/AppRoute/Render.js +0 -111
  156. package/es/AppRoute/Rendered.d.ts +0 -4
  157. package/es/AppRoute/Rendered.js +0 -11
  158. package/es/AppRoute/index.d.ts +0 -14
  159. package/es/AppRoute/index.js +0 -106
  160. package/es/AppRoute/interface.d.ts +0 -18
  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
@@ -1,7 +1,7 @@
1
1
  import { __rest } from "tslib";
2
2
  import React from 'react';
3
- import List from '../List';
4
- import TreeTitle from '../TreeTitle';
3
+ import List from '../index';
4
+ import Title from '../../Title';
5
5
  import "./index.css";
6
6
 
7
7
  function ListExt(_a) {
@@ -28,7 +28,7 @@ function ListExtTitle(_ref) {
28
28
  inputPlaceholder = _ref.inputPlaceholder,
29
29
  onKeywordChange = _ref.onKeywordChange,
30
30
  titleExt = _ref.titleExt;
31
- return /*#__PURE__*/React.createElement(TreeTitle, {
31
+ return /*#__PURE__*/React.createElement(Title, {
32
32
  title: title,
33
33
  inputPlaceholder: inputPlaceholder,
34
34
  onChange: onKeywordChange,
@@ -0,0 +1,6 @@
1
+ .vidc-simple-list-layout {
2
+ width: 100%;
3
+ height: 100%;
4
+ overflow: auto;
5
+ contain: strict;
6
+ }
@@ -0,0 +1,18 @@
1
+ import './index.less';
2
+ interface IVListProps<T> {
3
+ data?: Array<T>;
4
+ rowHeight?: number;
5
+ className?: string;
6
+ renderItem?(item: T, index: number): JSX.Element;
7
+ overscan?: number;
8
+ }
9
+ declare function VList<T>({ className, rowHeight, data, renderItem }: IVListProps<T>): JSX.Element;
10
+ declare namespace VList {
11
+ var defaultProps: {
12
+ className: string;
13
+ rowHeight: number;
14
+ overscan: number;
15
+ data: any[];
16
+ };
17
+ }
18
+ export default VList;
@@ -0,0 +1,51 @@
1
+ import _useVirtualList3 from "ahooks/es/useVirtualList";
2
+
3
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
4
+
5
+ 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."); }
6
+
7
+ 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); }
8
+
9
+ 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; }
10
+
11
+ 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; }
12
+
13
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
14
+
15
+ import React, { useRef } from 'react';
16
+ import "./index.css";
17
+
18
+ function VList(_ref) {
19
+ var className = _ref.className,
20
+ rowHeight = _ref.rowHeight,
21
+ data = _ref.data,
22
+ renderItem = _ref.renderItem;
23
+ var containerRef = useRef();
24
+ var wrapperRef = useRef();
25
+
26
+ var _useVirtualList = _useVirtualList3(data, {
27
+ containerTarget: containerRef,
28
+ wrapperTarget: wrapperRef,
29
+ itemHeight: rowHeight,
30
+ overscan: 10
31
+ }),
32
+ _useVirtualList2 = _slicedToArray(_useVirtualList, 1),
33
+ list = _useVirtualList2[0];
34
+
35
+ return /*#__PURE__*/React.createElement("div", {
36
+ className: "vidc-simple-list-layout ".concat(className),
37
+ ref: containerRef
38
+ }, /*#__PURE__*/React.createElement("div", {
39
+ ref: wrapperRef
40
+ }, list.map(function (ele) {
41
+ return renderItem(ele.data, ele.index);
42
+ })));
43
+ }
44
+
45
+ VList.defaultProps = {
46
+ className: '',
47
+ rowHeight: 30,
48
+ overscan: 10,
49
+ data: []
50
+ };
51
+ export default VList;
@@ -0,0 +1,14 @@
1
+ import React, { Key } from 'react';
2
+ export declare function renderRowItem(rowRenderer?: ({ data, index, style }: {
3
+ data: any;
4
+ index: number;
5
+ style?: React.CSSProperties;
6
+ }) => JSX.Element, renderItem?: (item: any, index: number) => JSX.Element, data?: any[]): (({ data, index, style }: {
7
+ data: any;
8
+ index: number;
9
+ style?: React.CSSProperties;
10
+ }) => JSX.Element) | (({ key, index, style }: {
11
+ key: Key;
12
+ index: number;
13
+ style?: React.CSSProperties;
14
+ }) => JSX.Element);
File without changes
package/es/List/index.css CHANGED
@@ -11,10 +11,6 @@
11
11
  flex: 1;
12
12
  overflow: hidden;
13
13
  }
14
- .lm-c-check-list-wrapper .lm-c-virtual-layout {
15
- width: calc(100% - 5px);
16
- margin-right: 5px;
17
- }
18
14
  .lm-c-check-list-wrapper .list-item {
19
15
  cursor: pointer;
20
16
  height: 30px;
@@ -47,19 +43,22 @@
47
43
  color: var(--primary);
48
44
  border-bottom: 1px solid var(--primary);
49
45
  }
50
- .lm-c-check-list-wrapper .list-item.has-check-box {
51
- padding: 0 10px;
52
- }
53
- .lm-c-check-list-wrapper .list-item.has-check-box label {
46
+ .lm-c-check-list-wrapper .list-item.has-check-box > label {
54
47
  padding: 0 4px;
55
48
  }
56
- .lm-c-check-list-wrapper .c-check-list-checkext {
49
+ .cloudapp-c-check-list-checkext {
57
50
  font-size: var(--fs-small);
58
- padding: 5px 18px;
51
+ padding: 5px 15px;
59
52
  display: flex;
60
53
  justify-content: space-between;
61
54
  border-bottom: 1px solid var(--bd-color);
62
55
  }
63
- .lm-c-check-list-wrapper .c-check-list-checkext .cloudapp-checkbox-wrapper {
64
- font-size: var(--fs);
56
+ .cloudapp-c-check-list-checkext .select-group .anticon {
57
+ font-size: 16px;
58
+ cursor: pointer;
59
+ padding-right: 8px;
60
+ color: var(--icon);
61
+ }
62
+ .cloudapp-c-check-list-checkext .select-group .anticon:hover {
63
+ color: var(--primary);
65
64
  }
@@ -1,74 +1,5 @@
1
- import React from 'react';
1
+ import { CheckListProps } from './interface';
2
2
  import './index.less';
3
- export interface CheckListProps<T> {
4
- /**
5
- * @description 列表数据
6
- * @default []
7
- */
8
- list?: Array<T>;
9
- /**
10
- * @description 列表类名
11
- * @default ''
12
- */
13
- className?: string;
14
- /**
15
- * @description 列表样式
16
- * @default -
17
- */
18
- style?: React.CSSProperties;
19
- /**
20
- * @description 列表自定义渲染
21
- * @default -
22
- */
23
- CustomRender?: () => JSX.Element;
24
- /**
25
- * @description 列表渲染key字段
26
- * @default id
27
- */
28
- itemKey?: string;
29
- /**
30
- * @description 列表渲染label字段
31
- * @default name
32
- */
33
- itemNameKey?: string;
34
- /**
35
- * @description 激活列表key
36
- * @default -
37
- */
38
- activeKey?: string;
39
- /**
40
- * @description 列表拓展内容
41
- * @default -
42
- */
43
- checkExt?: React.ReactNode;
44
- /**
45
- * @description 选中事件,影响是否有checkbox
46
- * @default -
47
- */
48
- onChecked?: (ids: Array<string>) => void;
49
- /**
50
- * @description 选中的key
51
- * @default []
52
- */
53
- checkedKeys?: string[];
54
- /**
55
- * @description 默认选中的key
56
- * @default []
57
- */
58
- defaultCheckedIds?: string[];
59
- /**
60
- * @description 高亮关键字
61
- * @default -
62
- */
63
- keywords?: string;
64
- rowHeight?: number;
65
- whatIcon?: (item: T) => JSX.Element;
66
- renderItemExt?: (item: T) => JSX.Element;
67
- onClickItem?: (item: T) => void;
68
- onMouseOutItem?: (item: T) => void;
69
- onMouseOverItem?: (item: T) => void;
70
- renderHeader?: () => JSX.Element;
71
- }
72
3
  declare function List(props: CheckListProps<any>): JSX.Element;
73
4
  declare namespace List {
74
5
  var defaultProps: {
@@ -77,5 +8,9 @@ declare namespace List {
77
8
  itemKey: string;
78
9
  itemNameKey: string;
79
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;
80
15
  }
81
16
  export default List;
package/es/List/index.js CHANGED
@@ -21,11 +21,12 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
21
21
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
22
22
 
23
23
  import React, { useCallback, useEffect, useMemo, useState } from 'react';
24
- import { difference, uniq } from 'lodash';
25
- import VList from '../VList';
24
+ import VList from './VList';
26
25
  import { RenderItem } from './renderItem';
27
- import { computedCheckStatus } from './utils';
28
26
  import CheckExt from './CheckExt';
27
+ import DeviceList from './DeviceList';
28
+ import ListExt from './ListExt';
29
+ import DynamicDeviceList from './DynamicDeviceList';
29
30
  import "./index.css";
30
31
 
31
32
  function List(props) {
@@ -50,13 +51,6 @@ function List(props) {
50
51
  state = _useState2[0],
51
52
  setState = _useState2[1];
52
53
 
53
- var _useMemo = useMemo(function () {
54
- return computedCheckStatus(list, state.checkedKeys, itemKey);
55
- }, [itemKey, list, state.checkedKeys]),
56
- checkHalfStatus = _useMemo.checkHalfStatus,
57
- checkAllStatus = _useMemo.checkAllStatus,
58
- listKey = _useMemo.listKey;
59
-
60
54
  var checkable = useMemo(function () {
61
55
  return !!onChecked;
62
56
  }, []);
@@ -84,17 +78,14 @@ function List(props) {
84
78
  });
85
79
  onChecked && onChecked(ids);
86
80
  }, // eslint-disable-next-line react-hooks/exhaustive-deps
87
- [listKey, state.checkedKeys]);
81
+ [state.checkedKeys]);
88
82
  /**
89
83
  * 列表渲染
90
84
  */
91
85
 
92
- var renderRow = useCallback(function (_ref) {
93
- var key = _ref.key,
94
- index = _ref.index,
95
- style = _ref.style;
86
+ var renderRow = useCallback(function (data, index) {
96
87
  var options = Object.assign(Object.assign({}, state), {
97
- item: list[index],
88
+ item: data,
98
89
  onChecked: onCheckedAction,
99
90
  checkable: !!onChecked,
100
91
  index: index,
@@ -111,7 +102,7 @@ function List(props) {
111
102
  });
112
103
  var ItemRender = CustomRender ? CustomRender : RenderItem;
113
104
  return /*#__PURE__*/React.createElement(ItemRender, Object.assign({
114
- key: key
105
+ key: index
115
106
  }, options));
116
107
  }, // eslint-disable-next-line react-hooks/exhaustive-deps
117
108
  [list, state, onChecked, CustomRender, activeKey]);
@@ -119,15 +110,29 @@ function List(props) {
119
110
  * 列表全选处理
120
111
  */
121
112
 
122
- var onChangeCheckAll = useCallback(function () {
123
- var ids = checkAllStatus ? difference(state.checkedKeys, listKey) : uniq([].concat(state.checkedKeys, listKey));
113
+ var onCheck = useCallback(function () {
114
+ var ids = list.map(function (v) {
115
+ return v[itemKey];
116
+ });
124
117
  setState(function (old) {
125
118
  return Object.assign(Object.assign({}, old), {
126
119
  checkedKeys: _toConsumableArray(ids)
127
120
  });
128
121
  });
129
122
  props.onChecked && props.onChecked(ids); // eslint-disable-next-line react-hooks/exhaustive-deps
130
- }, [checkAllStatus, state.checkedKeys, listKey]);
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]);
131
136
  /**
132
137
  * 同步选中更新
133
138
  */
@@ -146,18 +151,17 @@ function List(props) {
146
151
  className: "lm-c-check-list-wrapper ".concat(className),
147
152
  style: style
148
153
  }, renderHeader && renderHeader(), checkExt, checkable && /*#__PURE__*/React.createElement(CheckExt, {
149
- checkHalfStatus: checkHalfStatus,
150
154
  selectCount: state.checkedKeys.length,
151
155
  count: list.length,
152
- onChange: onChangeCheckAll,
153
- checkAllStatus: checkAllStatus
156
+ onCheck: onCheck,
157
+ onCancel: onCancel
154
158
  }), /*#__PURE__*/React.createElement("div", {
155
159
  className: "lm-c-base-list-layout"
156
160
  }, /*#__PURE__*/React.createElement(VList, {
157
161
  className: "lm-c-virtual-layout",
158
162
  data: list,
159
163
  rowHeight: rowHeight || 30,
160
- rowRenderer: renderRow
164
+ renderItem: renderRow
161
165
  })));
162
166
  }
163
167
 
@@ -167,4 +171,8 @@ List.defaultProps = {
167
171
  itemKey: 'id',
168
172
  itemNameKey: 'name'
169
173
  };
174
+ List.VList = VList;
175
+ List.DeviceList = DeviceList;
176
+ List.ListExt = ListExt;
177
+ List.DynamicDeviceList = DynamicDeviceList;
170
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
+ }
@@ -16,5 +16,5 @@ interface IRenderItempProps<T> {
16
16
  onMouseOverItem?: (item: T) => void;
17
17
  onMouseOutItem?: (item: T) => void;
18
18
  }
19
- export declare function RenderItem(props: IRenderItempProps<any>): JSX.Element;
19
+ export declare function RenderItem({ item, checkedKeys, activeKey, style, itemNameKey, itemKey, checkable, keywords, ...props }: IRenderItempProps<any>): JSX.Element;
20
20
  export {};
@@ -1,18 +1,21 @@
1
1
  import "antd/lib/checkbox/style";
2
2
  import _Checkbox from "antd/lib/checkbox";
3
+ import { __rest } from "tslib";
3
4
  import React, { useCallback, useMemo } from 'react';
4
5
  import HightLevel from '../HightLevel';
5
- export function RenderItem(props) {
6
- var item = props.item,
7
- checkedKeys = props.checkedKeys,
8
- activeKey = props.activeKey,
9
- style = props.style,
10
- itemNameKey = props.itemNameKey,
11
- renderItemExt = props.renderItemExt,
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,
12
18
  whatIcon = props.whatIcon,
13
- itemKey = props.itemKey,
14
- checkable = props.checkable,
15
- keywords = props.keywords,
16
19
  onChecked = props.onChecked,
17
20
  onClickItem = props.onClickItem,
18
21
  onMouseOverItem = props.onMouseOverItem,
@@ -12,7 +12,6 @@ interface ILoaderAppProps {
12
12
  * @default {}
13
13
  */
14
14
  appProps: {
15
- updateTime?: number;
16
15
  [key: string]: any;
17
16
  };
18
17
  /**
@@ -26,6 +25,7 @@ declare namespace LoaderApp {
26
25
  var defaultProps: {
27
26
  appConfig: {};
28
27
  appProps: {};
28
+ style: {};
29
29
  };
30
30
  }
31
31
  export default LoaderApp;
@@ -41,18 +41,29 @@ function LoaderApp(_ref) {
41
41
  var config = getMicroConfig(appConfig, appProps, domRef.current);
42
42
 
43
43
  if (!config) {
44
- console.debug('微应用不存在', 'config ->', appConfig, 'appProps ->', appProps);
44
+ console.error('微应用不存在', 'config ->', appConfig, 'appProps ->', appProps);
45
+ return undefined;
46
+ }
47
+
48
+ if (!domRef.current || !styleRef.current) {
49
+ console.error('LoaderApp组件未正常初始化!', 'config ->', appConfig, 'appProps ->', appProps);
45
50
  return undefined;
46
51
  }
47
52
 
48
53
  var props = Object.assign(Object.assign({}, appProps), {
49
54
  container: domRef.current
50
55
  });
56
+ var routerPrefix = config.routerPrefix;
57
+
58
+ var _appConfig$resource = _slicedToArray(appConfig.resource, 2),
59
+ script = _appConfig$resource[0],
60
+ style = _appConfig$resource[1];
61
+
51
62
  var options = {
52
- script: appConfig.resource[0],
53
- style: appConfig.resource[1],
54
- name: config.name,
55
- prefix: ".".concat(appConfig.name, "-").concat(id),
63
+ script: script,
64
+ style: style,
65
+ name: routerPrefix,
66
+ prefix: ".".concat(routerPrefix, "-").concat(id),
56
67
  styleNode: styleRef.current
57
68
  };
58
69
  LoaderModule(options).then(function (mod) {
@@ -98,18 +109,6 @@ function LoaderApp(_ref) {
98
109
  }
99
110
  };
100
111
  }, []);
101
- useEffect(function () {
102
- var currentId = appProps.currentId,
103
- tabId = appProps.tabId;
104
-
105
- if (currentId === tabId && loadedAppRef.current) {
106
- var props = Object.assign(Object.assign({}, appProps), {
107
- container: domRef.current
108
- });
109
- console.debug('执行更新!', appProps);
110
- loadedAppRef.current.update && loadedAppRef.current.update(props);
111
- }
112
- }, [appProps.currentId, appProps.tabId, appProps.updateTime]);
113
112
  return /*#__PURE__*/React.createElement("main", {
114
113
  ref: domRef,
115
114
  className: "loaded-app-layout ".concat(appConfig.routerPrefix, "-").concat(id),
@@ -127,6 +126,7 @@ function LoaderApp(_ref) {
127
126
 
128
127
  LoaderApp.defaultProps = {
129
128
  appConfig: {},
130
- appProps: {}
129
+ appProps: {},
130
+ style: {}
131
131
  };
132
132
  export default LoaderApp;
@@ -1,6 +1,7 @@
1
1
  import { AppItemType } from '../Config/interface';
2
2
  export declare const getMicroConfig: (appConfig: AppItemType, appProps: any, container: HTMLDivElement) => {
3
- name: string;
3
+ title: string;
4
+ routerPrefix: string;
4
5
  container: HTMLDivElement;
5
6
  props: any;
6
7
  entry: {
@@ -3,14 +3,16 @@ export var getMicroConfig = function getMicroConfig() {
3
3
  var appProps = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
4
4
  var container = arguments.length > 2 ? arguments[2] : undefined;
5
5
  var routerPrefix = appConfig.routerPrefix,
6
- resource = appConfig.resource;
6
+ resource = appConfig.resource,
7
+ name = appConfig.name;
7
8
  var microAppEntry = {
8
9
  scripts: [resource[0]],
9
10
  styles: [resource[1]],
10
11
  html: "<div id=\"".concat(routerPrefix, "\" style=\"height:100%\"></div>")
11
12
  };
12
13
  return {
13
- name: routerPrefix,
14
+ title: name,
15
+ routerPrefix: routerPrefix,
14
16
  container: container,
15
17
  props: appProps,
16
18
  entry: microAppEntry
@@ -68,7 +70,8 @@ function ruleStyle(rule, prefix) {
68
70
  // handle :root { ... }
69
71
 
70
72
  if (selector === 'html' || selector === 'body' || selector === ':root') {
71
- return cssText.replace(rootSelectorRE, prefix);
73
+ return ''; //微应用模式下清楚顶层样式
74
+ // return cssText.replace(rootSelectorRE, prefix);
72
75
  } // handle html body { ... }
73
76
  // handle html > body { ... }
74
77