@cloud-app-dev/vidc 2.0.0-alpha.11 → 2.0.0-alpha.12
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 -1
- package/es/AppRedirect/index.js +7 -11
- package/es/AppRoute/index.d.ts +2 -6
- package/es/AppRoute/index.js +46 -37
- package/es/AppRoute/interface.d.ts +1 -11
- package/es/AutoExit/index.js +7 -7
- package/es/{ContentBox → Box}/BetweenBox/index.css +0 -0
- package/es/{ContentBox → Box}/BetweenBox/index.d.ts +0 -0
- package/es/{ContentBox → Box}/BetweenBox/index.js +0 -0
- package/es/{ContentBox → Box}/InfoBox/index.css +0 -0
- package/es/{ContentBox → Box}/InfoBox/index.d.ts +0 -0
- package/es/{ContentBox → Box}/InfoBox/index.js +0 -0
- package/es/{ContentBox → Box}/TwoColumnBox/index.css +0 -0
- package/es/{ContentBox → Box}/TwoColumnBox/index.d.ts +0 -0
- package/es/{ContentBox → Box}/TwoColumnBox/index.js +0 -0
- package/es/{ContentBox → Box}/deps/content-grid.d.ts +0 -0
- package/es/{ContentBox → Box}/deps/content-grid.js +0 -0
- package/es/{ContentBox → Box}/deps/grid-factory.d.ts +0 -0
- package/es/{ContentBox → Box}/deps/grid-factory.js +0 -0
- package/es/{ContentBox → Box}/deps/simple-grid.d.ts +0 -0
- package/es/{ContentBox → Box}/deps/simple-grid.js +0 -0
- package/es/{ContentBox → Box}/index.css +0 -0
- package/es/{ContentBox → Box}/index.d.ts +3 -3
- package/es/{ContentBox → Box}/index.js +5 -5
- package/es/CheckGroupFixed/index.js +4 -2
- package/es/Config/interface.d.ts +3 -1
- package/es/DeviceSelect/TreeType.d.ts +6 -0
- package/es/DeviceSelect/TreeType.js +36 -0
- package/es/DeviceSelect/demo.js +2 -2
- package/es/DeviceSelect/index.css +6 -1
- package/es/DeviceSelect/index.d.ts +5 -0
- package/es/DeviceSelect/index.js +22 -54
- package/es/IconFont/index.d.ts +0 -1
- package/es/IconFont/index.js +12 -13
- package/es/InitialRequest/utils.js +8 -9
- package/es/Input/index.js +3 -2
- package/es/List/CheckExt.d.ts +3 -5
- package/es/List/CheckExt.js +21 -13
- package/es/{AppRoute → List/DeviceList}/index.css +0 -0
- package/es/List/DeviceList/index.d.ts +11 -0
- package/es/{DeviceList → List/DeviceList}/index.js +6 -18
- package/es/{DynamicDeviceList → List/DynamicDeviceList}/Demo.d.ts +0 -0
- package/es/{DynamicList/demo.js → List/DynamicDeviceList/Demo.js} +25 -42
- package/es/{DynamicDeviceList → List/DynamicDeviceList}/index.css +5 -17
- package/es/List/DynamicDeviceList/index.d.ts +11 -0
- package/es/List/DynamicDeviceList/index.js +205 -0
- package/es/List/DynamicDeviceList/interface.d.ts +37 -0
- package/es/List/DynamicDeviceList/utils.d.ts +16 -0
- package/es/List/DynamicDeviceList/utils.js +61 -0
- package/es/{DynamicList/demo.d.ts → List/DynamicGridList/Demo.d.ts} +0 -0
- package/es/List/DynamicGridList/Demo.js +70 -0
- package/es/List/DynamicGridList/index.d.ts +26 -0
- package/es/List/DynamicGridList/index.js +73 -0
- package/es/List/GridList/Demo.d.ts +2 -0
- package/es/List/GridList/Demo.js +91 -0
- package/es/List/GridList/hook.d.ts +13 -0
- package/es/List/GridList/hook.js +301 -0
- package/es/List/GridList/index.css +7 -0
- package/es/List/GridList/index.d.ts +15 -0
- package/es/List/GridList/index.js +47 -0
- package/es/List/GridList/interface.d.ts +59 -0
- package/es/List/GridList/utils.d.ts +9 -0
- package/es/List/GridList/utils.js +43 -0
- package/es/List/ListExt/index.css +3 -0
- package/es/{ListExt → List/ListExt}/index.d.ts +1 -1
- package/es/{ListExt → List/ListExt}/index.js +3 -3
- package/es/List/VList/index.css +6 -0
- package/es/List/VList/index.d.ts +18 -0
- package/es/List/VList/index.js +51 -0
- package/es/List/VList/utils.d.ts +14 -0
- package/es/{VList → List/VList}/utils.js +0 -0
- package/es/List/index.css +11 -12
- package/es/List/index.d.ts +5 -70
- package/es/List/index.js +32 -25
- package/es/List/interface.d.ts +87 -0
- package/es/List/renderItem.d.ts +1 -1
- package/es/List/renderItem.js +13 -10
- package/es/LoaderApp/index.js +4 -1
- package/es/LoaderScript/utils.js +60 -37
- package/es/Service/http.d.ts +1 -1
- package/es/Service/http.js +2 -8
- package/es/TableLayout/index.d.ts +3 -0
- package/es/TableLayout/index.js +14 -45
- package/es/{TreeTitle → Title}/index.css +5 -5
- package/es/{TreeTitle → Title}/index.d.ts +2 -2
- package/es/{TreeTitle → Title}/index.js +7 -4
- package/es/{TreeMode → Tree/BaseTree}/demo.d.ts +0 -0
- package/es/Tree/BaseTree/demo.js +69 -0
- package/es/Tree/BaseTree/index.css +64 -0
- package/es/Tree/BaseTree/index.d.ts +24 -0
- package/es/Tree/BaseTree/index.js +83 -0
- package/es/Tree/demo.js +19 -56
- package/es/Tree/index.css +29 -55
- package/es/Tree/index.d.ts +19 -20
- package/es/Tree/index.js +185 -70
- package/es/UserSelect/index.js +6 -4
- package/es/WorkerFlow/Form/Condition.js +2 -4
- package/es/WorkerFlow/Form/FormAuth.js +2 -2
- package/es/WorkerFlow/Form/GroupList.js +2 -2
- package/es/WorkerFlow/Form/GroupSelectModalContent.js +1 -1
- package/es/WorkerFlow/Form/UserSelectModalContent.js +2 -2
- package/es/WorkerFlow/Form/UserSet.js +2 -2
- package/es/WorkerFlow/Nodes/TitleElement.js +71 -34
- package/es/WorkerFlow/index.css +9 -3
- package/es/WorkerFlow/index.js +3 -2
- package/es/index.d.ts +3 -11
- package/es/index.js +3 -11
- package/es/useDrawer/index.d.ts +1 -1
- package/es/useDrawer/index.js +2 -1
- package/es/useModal/index.d.ts +1 -1
- package/es/useModal/index.js +2 -1
- package/es/{IconFont → useNavigate}/index.css +0 -0
- package/es/useNavigate/index.d.ts +4 -0
- package/es/useNavigate/index.js +14 -0
- package/es/utils.d.ts +9 -0
- package/es/utils.js +36 -1
- package/package.json +4 -8
- package/es/AppRoute/Render.d.ts +0 -23
- package/es/AppRoute/Render.js +0 -111
- package/es/AppRoute/Rendered.d.ts +0 -4
- package/es/AppRoute/Rendered.js +0 -11
- package/es/AppRoute/utils.d.ts +0 -1
- package/es/AppRoute/utils.js +0 -28
- package/es/DeviceList/index.css +0 -32
- package/es/DeviceList/index.d.ts +0 -14
- package/es/DynamicDeviceList/CheckExt.d.ts +0 -8
- package/es/DynamicDeviceList/CheckExt.js +0 -36
- package/es/DynamicDeviceList/Demo.js +0 -17
- package/es/DynamicDeviceList/index.d.ts +0 -35
- package/es/DynamicDeviceList/index.js +0 -224
- package/es/DynamicDeviceList/utils.d.ts +0 -2
- package/es/DynamicDeviceList/utils.js +0 -15
- package/es/DynamicList/index.css +0 -7
- package/es/DynamicList/index.d.ts +0 -31
- package/es/DynamicList/index.js +0 -132
- package/es/List/utils.d.ts +0 -5
- package/es/List/utils.js +0 -18
- package/es/ListExt/index.css +0 -9
- package/es/ScrollList/index.css +0 -73
- package/es/ScrollList/index.d.ts +0 -24
- package/es/ScrollList/index.js +0 -262
- package/es/ScrollList/utils.js +0 -84
- package/es/TreeMode/demo.js +0 -32
- package/es/TreeMode/index.css +0 -38
- package/es/TreeMode/index.d.ts +0 -23
- package/es/TreeMode/index.js +0 -201
- package/es/VList/index.css +0 -4
- package/es/VList/index.d.ts +0 -16
- package/es/VList/index.js +0 -56
- package/es/VList/utils.d.ts +0 -10
- package/es/useChangeEffect/index.d.ts +0 -3
- package/es/useChangeEffect/index.js +0 -32
- package/es/useHistory/index.css +0 -0
- package/es/useHistory/index.d.ts +0 -3
- package/es/useHistory/index.js +0 -14
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import React, { useRef, useMemo, useState, useEffect, RefObject, MutableRefObject } from 'react';
|
|
2
|
+
|
|
3
|
+
export type ConstRef<T> = Readonly<MutableRefObject<T>>;
|
|
4
|
+
|
|
5
|
+
export interface ElementSize {
|
|
6
|
+
width: number;
|
|
7
|
+
height: number;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface ElementScroll {
|
|
11
|
+
x: number;
|
|
12
|
+
y: number;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface GridListItemData {
|
|
16
|
+
key: string;
|
|
17
|
+
height: number;
|
|
18
|
+
width: number;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface GridListEntry<P> {
|
|
22
|
+
item: P;
|
|
23
|
+
data: GridListItemData;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export interface GridListConfigData<P> {
|
|
27
|
+
windowMargin: number;
|
|
28
|
+
gridGap: number;
|
|
29
|
+
columnCount: number;
|
|
30
|
+
entries: GridListEntry<P>[];
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export interface GridListContainerData {
|
|
34
|
+
windowSize: ElementSize;
|
|
35
|
+
elementSize: ElementSize | null;
|
|
36
|
+
windowScroll: ElementScroll;
|
|
37
|
+
elementWindowOffset: number | null;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export interface GridListCell<P> {
|
|
41
|
+
key: string;
|
|
42
|
+
columnNumber: number;
|
|
43
|
+
rowNumber: number;
|
|
44
|
+
offset: number;
|
|
45
|
+
height: number;
|
|
46
|
+
width: number;
|
|
47
|
+
item: P;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export interface GridListLayoutData<P> {
|
|
51
|
+
totalHeight: number;
|
|
52
|
+
cells: GridListCell<P>[];
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export interface GridListRenderData<P> {
|
|
56
|
+
cellsToRender: GridListCell<P>[];
|
|
57
|
+
firstRenderedRowNumber: number | null;
|
|
58
|
+
firstRenderedRowOffset: number | null;
|
|
59
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ElementScroll, ElementSize, GridListCell, GridListRenderData } from './interface';
|
|
2
|
+
export declare function isSameElementSize(a: ElementSize, b: ElementSize): boolean;
|
|
3
|
+
export declare function getWindowSize(): ElementSize;
|
|
4
|
+
export declare function getElementSize(element: Element): ElementSize;
|
|
5
|
+
export declare function isSameElementScroll(a: ElementScroll, b: ElementScroll): boolean;
|
|
6
|
+
export declare function getWindowScroll(): ElementScroll;
|
|
7
|
+
export declare function getElementOffset(element: Element): number;
|
|
8
|
+
export declare function getColumnWidth(columnCount: number | null, gridGap: number | null, elementWidth: number | null): number;
|
|
9
|
+
export declare function getGridRowStart<P>(cell: GridListCell<P>, renderData: GridListRenderData<P> | null): string;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
export function isSameElementSize(a, b) {
|
|
2
|
+
return a.width === b.width && a.height === b.height;
|
|
3
|
+
}
|
|
4
|
+
export function getWindowSize() {
|
|
5
|
+
return {
|
|
6
|
+
width: window.innerWidth,
|
|
7
|
+
height: window.innerHeight
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
export function getElementSize(element) {
|
|
11
|
+
var rect = element.getBoundingClientRect();
|
|
12
|
+
return {
|
|
13
|
+
width: rect.width,
|
|
14
|
+
height: rect.height
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
export function isSameElementScroll(a, b) {
|
|
18
|
+
return a.x === b.x && a.y === b.y;
|
|
19
|
+
}
|
|
20
|
+
export function getWindowScroll() {
|
|
21
|
+
return {
|
|
22
|
+
x: window.scrollX,
|
|
23
|
+
y: window.scrollY
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
export function getElementOffset(element) {
|
|
27
|
+
return window.scrollY + element.getBoundingClientRect().top;
|
|
28
|
+
}
|
|
29
|
+
export function getColumnWidth(columnCount, gridGap, elementWidth) {
|
|
30
|
+
if (columnCount === null || gridGap === null || elementWidth === null) {
|
|
31
|
+
return null;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
var totalGapSpace = (columnCount - 1) * gridGap;
|
|
35
|
+
var columnWidth = Math.round((elementWidth - totalGapSpace) / columnCount);
|
|
36
|
+
return columnWidth;
|
|
37
|
+
}
|
|
38
|
+
export function getGridRowStart(cell, renderData) {
|
|
39
|
+
if (renderData === null) return undefined;
|
|
40
|
+
var offset = renderData.firstRenderedRowNumber !== null ? renderData.firstRenderedRowNumber - 1 : 0;
|
|
41
|
+
var gridRowStart = cell.rowNumber - offset;
|
|
42
|
+
return "".concat(gridRowStart);
|
|
43
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { __rest } from "tslib";
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import List from '../
|
|
4
|
-
import
|
|
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(
|
|
31
|
+
return /*#__PURE__*/React.createElement(Title, {
|
|
32
32
|
title: title,
|
|
33
33
|
inputPlaceholder: inputPlaceholder,
|
|
34
34
|
onChange: onKeywordChange,
|
|
@@ -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
|
-
.
|
|
49
|
+
.cloudapp-c-check-list-checkext {
|
|
57
50
|
font-size: var(--fs-small);
|
|
58
|
-
padding: 5px
|
|
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
|
-
.
|
|
64
|
-
font-size:
|
|
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
|
}
|
package/es/List/index.d.ts
CHANGED
|
@@ -1,74 +1,5 @@
|
|
|
1
|
-
import
|
|
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,12 +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
|
|
25
|
-
import uniq from 'lodash-es/uniq';
|
|
26
|
-
import VList from '../VList';
|
|
24
|
+
import VList from './VList';
|
|
27
25
|
import { RenderItem } from './renderItem';
|
|
28
|
-
import { computedCheckStatus } from './utils';
|
|
29
26
|
import CheckExt from './CheckExt';
|
|
27
|
+
import DeviceList from './DeviceList';
|
|
28
|
+
import ListExt from './ListExt';
|
|
29
|
+
import DynamicDeviceList from './DynamicDeviceList';
|
|
30
30
|
import "./index.css";
|
|
31
31
|
|
|
32
32
|
function List(props) {
|
|
@@ -51,13 +51,6 @@ function List(props) {
|
|
|
51
51
|
state = _useState2[0],
|
|
52
52
|
setState = _useState2[1];
|
|
53
53
|
|
|
54
|
-
var _useMemo = useMemo(function () {
|
|
55
|
-
return computedCheckStatus(list, state.checkedKeys, itemKey);
|
|
56
|
-
}, [itemKey, list, state.checkedKeys]),
|
|
57
|
-
checkHalfStatus = _useMemo.checkHalfStatus,
|
|
58
|
-
checkAllStatus = _useMemo.checkAllStatus,
|
|
59
|
-
listKey = _useMemo.listKey;
|
|
60
|
-
|
|
61
54
|
var checkable = useMemo(function () {
|
|
62
55
|
return !!onChecked;
|
|
63
56
|
}, []);
|
|
@@ -85,17 +78,14 @@ function List(props) {
|
|
|
85
78
|
});
|
|
86
79
|
onChecked && onChecked(ids);
|
|
87
80
|
}, // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
88
|
-
[
|
|
81
|
+
[state.checkedKeys]);
|
|
89
82
|
/**
|
|
90
83
|
* 列表渲染
|
|
91
84
|
*/
|
|
92
85
|
|
|
93
|
-
var renderRow = useCallback(function (
|
|
94
|
-
var key = _ref.key,
|
|
95
|
-
index = _ref.index,
|
|
96
|
-
style = _ref.style;
|
|
86
|
+
var renderRow = useCallback(function (data, index) {
|
|
97
87
|
var options = Object.assign(Object.assign({}, state), {
|
|
98
|
-
item:
|
|
88
|
+
item: data,
|
|
99
89
|
onChecked: onCheckedAction,
|
|
100
90
|
checkable: !!onChecked,
|
|
101
91
|
index: index,
|
|
@@ -112,7 +102,7 @@ function List(props) {
|
|
|
112
102
|
});
|
|
113
103
|
var ItemRender = CustomRender ? CustomRender : RenderItem;
|
|
114
104
|
return /*#__PURE__*/React.createElement(ItemRender, Object.assign({
|
|
115
|
-
key:
|
|
105
|
+
key: index
|
|
116
106
|
}, options));
|
|
117
107
|
}, // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
118
108
|
[list, state, onChecked, CustomRender, activeKey]);
|
|
@@ -120,15 +110,29 @@ function List(props) {
|
|
|
120
110
|
* 列表全选处理
|
|
121
111
|
*/
|
|
122
112
|
|
|
123
|
-
var
|
|
124
|
-
var ids =
|
|
113
|
+
var onCheck = useCallback(function () {
|
|
114
|
+
var ids = list.map(function (v) {
|
|
115
|
+
return v[itemKey];
|
|
116
|
+
});
|
|
125
117
|
setState(function (old) {
|
|
126
118
|
return Object.assign(Object.assign({}, old), {
|
|
127
119
|
checkedKeys: _toConsumableArray(ids)
|
|
128
120
|
});
|
|
129
121
|
});
|
|
130
122
|
props.onChecked && props.onChecked(ids); // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
131
|
-
}, [
|
|
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]);
|
|
132
136
|
/**
|
|
133
137
|
* 同步选中更新
|
|
134
138
|
*/
|
|
@@ -147,18 +151,17 @@ function List(props) {
|
|
|
147
151
|
className: "lm-c-check-list-wrapper ".concat(className),
|
|
148
152
|
style: style
|
|
149
153
|
}, renderHeader && renderHeader(), checkExt, checkable && /*#__PURE__*/React.createElement(CheckExt, {
|
|
150
|
-
checkHalfStatus: checkHalfStatus,
|
|
151
154
|
selectCount: state.checkedKeys.length,
|
|
152
155
|
count: list.length,
|
|
153
|
-
|
|
154
|
-
|
|
156
|
+
onCheck: onCheck,
|
|
157
|
+
onCancel: onCancel
|
|
155
158
|
}), /*#__PURE__*/React.createElement("div", {
|
|
156
159
|
className: "lm-c-base-list-layout"
|
|
157
160
|
}, /*#__PURE__*/React.createElement(VList, {
|
|
158
161
|
className: "lm-c-virtual-layout",
|
|
159
162
|
data: list,
|
|
160
163
|
rowHeight: rowHeight || 30,
|
|
161
|
-
|
|
164
|
+
renderItem: renderRow
|
|
162
165
|
})));
|
|
163
166
|
}
|
|
164
167
|
|
|
@@ -168,4 +171,8 @@ List.defaultProps = {
|
|
|
168
171
|
itemKey: 'id',
|
|
169
172
|
itemNameKey: 'name'
|
|
170
173
|
};
|
|
174
|
+
List.VList = VList;
|
|
175
|
+
List.DeviceList = DeviceList;
|
|
176
|
+
List.ListExt = ListExt;
|
|
177
|
+
List.DynamicDeviceList = DynamicDeviceList;
|
|
171
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
|
+
}
|
package/es/List/renderItem.d.ts
CHANGED
|
@@ -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 {};
|
package/es/List/renderItem.js
CHANGED
|
@@ -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(
|
|
6
|
-
var item =
|
|
7
|
-
checkedKeys =
|
|
8
|
-
activeKey =
|
|
9
|
-
style =
|
|
10
|
-
itemNameKey =
|
|
11
|
-
|
|
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,
|
package/es/LoaderApp/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import _useUpdateEffect from "ahooks/es/useUpdateEffect";
|
|
1
2
|
import _uuid from "@cloud-app-dev/utils/es/uuid";
|
|
2
3
|
|
|
3
4
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
@@ -98,7 +99,8 @@ function LoaderApp(_ref) {
|
|
|
98
99
|
}
|
|
99
100
|
};
|
|
100
101
|
}, []);
|
|
101
|
-
|
|
102
|
+
|
|
103
|
+
_useUpdateEffect(function () {
|
|
102
104
|
var currentId = appProps.currentId,
|
|
103
105
|
tabId = appProps.tabId;
|
|
104
106
|
|
|
@@ -110,6 +112,7 @@ function LoaderApp(_ref) {
|
|
|
110
112
|
loadedAppRef.current.update && loadedAppRef.current.update(props);
|
|
111
113
|
}
|
|
112
114
|
}, [appProps.currentId, appProps.tabId, appProps.updateTime]);
|
|
115
|
+
|
|
113
116
|
return /*#__PURE__*/React.createElement("main", {
|
|
114
117
|
ref: domRef,
|
|
115
118
|
className: "loaded-app-layout ".concat(appConfig.routerPrefix, "-").concat(id),
|