@cloud-app-dev/vidc 2.0.0-alpha.1 → 2.0.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.
- package/.umirc.ts +1 -2
- package/es/Api/index.d.ts +3 -4
- package/es/Api/index.js +7 -8
- package/es/AppRedirect/index.css +0 -0
- package/es/AppRedirect/index.d.ts +16 -0
- package/es/AppRedirect/index.js +38 -0
- package/es/AppRoute/Render.d.ts +23 -0
- package/es/AppRoute/Render.js +111 -0
- package/es/AppRoute/Rendered.d.ts +4 -0
- package/es/AppRoute/Rendered.js +11 -0
- package/es/AppRoute/index.css +0 -0
- package/es/AppRoute/index.d.ts +14 -0
- package/es/AppRoute/index.js +106 -0
- package/es/AppRoute/interface.d.ts +18 -0
- package/es/AppRoute/utils.d.ts +1 -0
- package/es/AppRoute/utils.js +28 -0
- package/es/Auth/index.d.ts +8 -0
- package/es/Auth/index.js +17 -0
- package/es/AutoExit/index.js +8 -5
- package/es/CheckGroupFixed/index.css +49 -0
- package/es/CheckGroupFixed/index.d.ts +17 -0
- package/es/CheckGroupFixed/index.js +146 -0
- package/es/Config/index.js +24 -3
- package/es/Config/interface.d.ts +9 -1
- package/es/Config/utils.d.ts +6 -1
- package/es/ConfigContext/index.d.ts +3 -0
- package/es/ContentBox/BetweenBox/index.css +5 -0
- package/es/ContentBox/BetweenBox/index.d.ts +12 -0
- package/es/ContentBox/BetweenBox/index.js +24 -0
- package/es/ContentBox/InfoBox/index.css +23 -0
- package/es/ContentBox/InfoBox/index.d.ts +12 -0
- package/es/ContentBox/InfoBox/index.js +26 -0
- package/es/ContentBox/TwoColumnBox/index.css +77 -0
- package/es/ContentBox/TwoColumnBox/index.d.ts +10 -0
- package/es/ContentBox/TwoColumnBox/index.js +50 -0
- package/es/ContentBox/deps/content-grid.d.ts +9 -0
- package/es/ContentBox/deps/content-grid.js +9 -0
- package/es/ContentBox/deps/grid-factory.d.ts +10 -0
- package/es/ContentBox/deps/grid-factory.js +72 -0
- package/es/ContentBox/deps/simple-grid.d.ts +9 -0
- package/es/ContentBox/deps/simple-grid.js +8 -0
- package/es/ContentBox/index.css +9 -0
- package/es/ContentBox/index.d.ts +14 -0
- package/es/ContentBox/index.js +28 -0
- package/es/DeviceIcon/icon.js +5 -5
- package/es/DeviceIcon/index.js +2 -2
- package/es/DeviceList/index.d.ts +1 -1
- package/es/DeviceList/index.js +4 -4
- package/es/DeviceSelect/index.js +2 -2
- package/es/Dict/cache.d.ts +3 -0
- package/es/Dict/cache.js +21 -0
- package/es/Dict/desc.d.ts +64 -0
- package/es/Dict/desc.js +162 -0
- package/es/Dict/device.d.ts +28 -0
- package/es/Dict/device.js +117 -0
- package/es/Dict/hook.d.ts +4 -0
- package/es/Dict/hook.js +114 -0
- package/es/Dict/index.d.ts +13 -0
- package/es/Dict/index.js +14 -0
- package/es/Dict/interface.d.ts +16 -0
- package/es/Dict/utils.d.ts +11 -0
- package/es/Dict/utils.js +51 -0
- package/es/Drag/DragAndDropItem.d.ts +4 -0
- package/es/Drag/DragAndDropItem.js +145 -0
- package/es/Drag/DropItem.d.ts +4 -0
- package/es/Drag/DropItem.js +54 -0
- package/es/Drag/index.css +0 -0
- package/es/Drag/index.d.ts +7 -0
- package/es/Drag/index.js +7 -0
- package/es/Drag/interface.d.ts +16 -0
- package/es/Drawer/Demo.d.ts +3 -0
- package/es/Drawer/Demo.js +52 -0
- package/es/Drawer/Footer.d.ts +4 -0
- package/es/Drawer/Footer.js +26 -0
- package/es/Drawer/index.css +39 -0
- package/es/Drawer/index.d.ts +12 -0
- package/es/Drawer/index.js +41 -0
- package/es/Drawer/interface.d.ts +191 -0
- package/es/DynamicDeviceList/CheckExt.js +3 -3
- package/es/DynamicDeviceList/index.js +2 -2
- package/es/DynamicDeviceList/utils.js +2 -2
- package/es/DynamicList/demo.d.ts +2 -0
- package/es/DynamicList/demo.js +71 -0
- package/es/DynamicList/index.css +7 -0
- package/es/DynamicList/index.d.ts +31 -0
- package/es/DynamicList/index.js +132 -0
- package/es/FullScreen/index.css +16 -0
- package/es/FullScreen/index.d.ts +10 -0
- package/es/FullScreen/index.js +68 -0
- package/es/HightLevel/index.css +3 -0
- package/es/HightLevel/index.d.ts +9 -0
- package/es/HightLevel/index.js +22 -0
- package/es/IconFont/index.css +0 -0
- package/es/IconFont/index.d.ts +13 -0
- package/es/IconFont/index.js +58 -0
- package/es/ImageView/index.css +6 -0
- package/es/ImageView/index.d.ts +17 -0
- package/es/ImageView/index.js +58 -0
- package/es/InitialConfig/index.js +5 -9
- package/es/InitialRequest/index.js +2 -2
- package/es/InitialRequest/utils.js +1 -1
- package/es/Input/index.css +8 -0
- package/es/Input/index.d.ts +18 -0
- package/es/Input/index.js +75 -0
- package/es/LabelValue/index.css +18 -0
- package/es/LabelValue/index.d.ts +23 -0
- package/es/LabelValue/index.js +32 -0
- package/es/List/CheckExt.d.ts +10 -0
- package/es/List/CheckExt.js +28 -0
- package/es/List/index.css +62 -6
- package/es/List/index.d.ts +73 -11
- package/es/List/index.js +162 -36
- package/es/List/renderItem.d.ts +20 -0
- package/es/List/renderItem.js +68 -0
- package/es/List/utils.d.ts +5 -0
- package/es/List/utils.js +18 -0
- package/es/ListExt/index.css +9 -0
- package/es/ListExt/index.d.ts +19 -0
- package/es/ListExt/index.js +44 -0
- package/es/LoaderScript/index.d.ts +26 -0
- package/es/LoaderScript/index.js +127 -0
- package/es/LoaderScript/interface.d.ts +26 -0
- package/es/LoaderScript/utils.d.ts +12 -0
- package/es/LoaderScript/utils.js +110 -0
- package/es/Modal/index.css +43 -0
- package/es/Modal/index.d.ts +17 -0
- package/es/Modal/index.js +34 -0
- package/es/Modal/interface.d.ts +339 -0
- package/es/Picture/component/DefaultRects/RectInfo.d.ts +7 -0
- package/es/Picture/component/DefaultRects/RectInfo.js +94 -0
- package/es/Picture/component/DefaultRects/index.css +247 -0
- package/es/Picture/component/DefaultRects/index.d.ts +12 -0
- package/es/Picture/component/DefaultRects/index.js +47 -0
- package/es/Picture/component/DefaultRects/utils.d.ts +2 -0
- package/es/Picture/component/DefaultRects/utils.js +11 -0
- package/es/Picture/component/DrawRect/index.css +8 -0
- package/es/Picture/component/DrawRect/index.d.ts +14 -0
- package/es/Picture/component/DrawRect/index.js +41 -0
- package/es/Picture/component/MoveContent/index.css +0 -0
- package/es/Picture/component/MoveContent/index.d.ts +39 -0
- package/es/Picture/component/MoveContent/index.js +240 -0
- package/es/Picture/component/MoveContent/utils.d.ts +4 -0
- package/es/Picture/component/MoveContent/utils.js +19 -0
- package/es/Picture/component/RectMenu/index.css +31 -0
- package/es/Picture/component/RectMenu/index.d.ts +13 -0
- package/es/Picture/component/RectMenu/index.js +81 -0
- package/es/Picture/component/RectMenu/utils.d.ts +12 -0
- package/es/Picture/component/RectMenu/utils.js +22 -0
- package/es/Picture/component/Tools/index.css +42 -0
- package/es/Picture/component/Tools/index.d.ts +13 -0
- package/es/Picture/component/Tools/index.js +83 -0
- package/es/Picture/component/WheelScale/index.d.ts +6 -0
- package/es/Picture/component/WheelScale/index.js +29 -0
- package/es/Picture/dragBound.d.ts +5 -0
- package/es/Picture/dragBound.js +77 -0
- package/es/Picture/index.css +12 -0
- package/es/Picture/index.d.ts +16 -0
- package/es/Picture/index.js +344 -0
- package/es/Picture/interface.d.ts +67 -0
- package/es/Picture/loadCaptureRectImage.d.ts +8 -0
- package/es/Picture/loadCaptureRectImage.js +119 -0
- package/es/Picture/useDraw.d.ts +1 -0
- package/es/Picture/useDraw.js +136 -0
- package/es/Picture/utils.d.ts +22 -0
- package/es/Picture/utils.js +90 -0
- package/es/Progress/index.css +20 -0
- package/es/Progress/index.d.ts +11 -0
- package/es/Progress/index.js +68 -0
- package/es/RefDrawer/index.js +4 -5
- package/es/RefModal/index.js +4 -5
- package/es/ScrollList/index.css +73 -0
- package/es/ScrollList/index.d.ts +24 -0
- package/es/ScrollList/index.js +261 -0
- package/es/ScrollList/utils.js +84 -0
- package/es/Service/http.js +0 -17
- package/es/TableLayout/index.css +4 -0
- package/es/TableLayout/index.d.ts +10 -0
- package/es/TableLayout/index.js +64 -0
- package/es/ThemeAntd/index.css +501 -0
- package/es/ThemeAntd/index.d.ts +7 -0
- package/es/ThemeAntd/index.js +6 -0
- package/es/ThemeAntd/style/button.css +46 -0
- package/es/ThemeAntd/style/checkbox.css +64 -0
- package/es/ThemeAntd/style/form.css +10 -0
- package/es/ThemeAntd/style/input.css +58 -0
- package/es/ThemeAntd/style/pagination.css +44 -0
- package/es/ThemeAntd/style/picker.css +86 -0
- package/es/ThemeAntd/style/popover.css +3 -0
- package/es/ThemeAntd/style/radio.css +71 -0
- package/es/ThemeAntd/style/scrollbar.css +19 -0
- package/es/ThemeAntd/style/select.css +57 -0
- package/es/ThemeAntd/style/table.css +36 -0
- package/es/ThemeAntd/style/tree.css +4 -0
- package/es/Tree/demo.d.ts +2 -0
- package/es/Tree/demo.js +69 -0
- package/es/Tree/index.css +64 -0
- package/es/Tree/index.d.ts +24 -0
- package/es/Tree/index.js +83 -0
- package/es/TreeMode/index.d.ts +1 -1
- package/es/TreeMode/index.js +6 -6
- package/es/TreeTitle/index.js +2 -2
- package/es/UserSelect/index.d.ts +3 -3
- package/es/UserSelect/index.js +13 -15
- package/es/VList/index.css +4 -0
- package/es/VList/index.d.ts +16 -0
- package/es/VList/index.js +56 -0
- package/es/VList/utils.d.ts +10 -0
- package/es/VList/utils.js +17 -0
- package/es/WorkerFlow/Form/Condition.js +6 -6
- package/es/WorkerFlow/Form/EmptyUserSet.js +2 -2
- package/es/WorkerFlow/Form/FormAuth.js +2 -2
- package/es/WorkerFlow/Form/GroupSelect.js +2 -2
- package/es/WorkerFlow/Form/GroupSelectModalContent.js +5 -5
- package/es/WorkerFlow/Form/LevelGroupSelect.js +3 -3
- package/es/WorkerFlow/Form/UserAndGroupSelect.js +2 -2
- package/es/WorkerFlow/Form/UserSelect.js +2 -2
- package/es/WorkerFlow/Form/UserSelectModalContent.js +3 -4
- package/es/WorkerFlow/Form/UserSet.js +2 -2
- package/es/WorkerFlow/Nodes/Add.js +2 -3
- package/es/WorkerFlow/Nodes/AddOption.js +2 -2
- package/es/WorkerFlow/Nodes/Approver.js +2 -2
- package/es/WorkerFlow/Nodes/Condition.js +2 -2
- package/es/WorkerFlow/Nodes/Handle.js +2 -2
- package/es/WorkerFlow/Nodes/Notifier.js +2 -2
- package/es/WorkerFlow/Nodes/TitleElement.js +5 -8
- package/es/WorkerFlow/index.js +2 -3
- package/es/core.d.ts +27 -0
- package/es/index.d.ts +30 -0
- package/es/index.js +30 -0
- package/es/useChangeEffect/index.d.ts +3 -0
- package/es/useChangeEffect/index.js +32 -0
- package/es/useDrawer/index.d.ts +14 -0
- package/es/useDrawer/index.js +90 -0
- package/es/useHistory/index.css +0 -0
- package/es/useHistory/index.d.ts +3 -0
- package/es/useHistory/index.js +14 -0
- package/es/useHttp/index.d.ts +8 -0
- package/es/useHttp/index.js +78 -0
- package/es/useModal/index.d.ts +14 -0
- package/es/useModal/index.js +92 -0
- package/es/utils.d.ts +2 -0
- package/es/utils.js +32 -0
- package/package.json +11 -5
package/es/List/index.js
CHANGED
|
@@ -1,44 +1,170 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import _isEqual from "@cloud-app-dev/utils/es/isEqual";
|
|
2
|
+
|
|
3
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
4
|
+
|
|
5
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
6
|
+
|
|
7
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
8
|
+
|
|
9
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
10
|
+
|
|
11
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
12
|
+
|
|
13
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
14
|
+
|
|
15
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
16
|
+
|
|
17
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
18
|
+
|
|
19
|
+
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
20
|
+
|
|
21
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
22
|
+
|
|
23
|
+
import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
|
24
|
+
import { difference, uniq } from 'lodash';
|
|
25
|
+
import VList from '../VList';
|
|
26
|
+
import { RenderItem } from './renderItem';
|
|
27
|
+
import { computedCheckStatus } from './utils';
|
|
28
|
+
import CheckExt from './CheckExt';
|
|
5
29
|
import "./index.css";
|
|
6
30
|
|
|
7
|
-
function List(
|
|
8
|
-
var
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}
|
|
31
|
+
function List(props) {
|
|
32
|
+
var className = props.className,
|
|
33
|
+
style = props.style,
|
|
34
|
+
CustomRender = props.CustomRender,
|
|
35
|
+
itemNameKey = props.itemNameKey,
|
|
36
|
+
activeKey = props.activeKey,
|
|
37
|
+
checkExt = props.checkExt,
|
|
38
|
+
onChecked = props.onChecked,
|
|
39
|
+
list = props.list,
|
|
40
|
+
checkedKeys = props.checkedKeys,
|
|
41
|
+
itemKey = props.itemKey,
|
|
42
|
+
defaultCheckedIds = props.defaultCheckedIds,
|
|
43
|
+
rowHeight = props.rowHeight,
|
|
44
|
+
renderHeader = props.renderHeader;
|
|
45
|
+
|
|
46
|
+
var _useState = useState({
|
|
47
|
+
checkedKeys: defaultCheckedIds || checkedKeys || []
|
|
48
|
+
}),
|
|
49
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
50
|
+
state = _useState2[0],
|
|
51
|
+
setState = _useState2[1];
|
|
52
|
+
|
|
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
|
+
var checkable = useMemo(function () {
|
|
61
|
+
return !!onChecked;
|
|
62
|
+
}, []);
|
|
63
|
+
/**
|
|
64
|
+
* 列表选中处理
|
|
65
|
+
*/
|
|
66
|
+
|
|
67
|
+
var onCheckedAction = useCallback(function (e) {
|
|
68
|
+
var ids = state.checkedKeys || [];
|
|
69
|
+
var id = e.target.value;
|
|
70
|
+
var flag = e.target.checked;
|
|
71
|
+
|
|
72
|
+
if (flag) {
|
|
73
|
+
ids.push(id);
|
|
74
|
+
} else {
|
|
75
|
+
ids = ids.filter(function (v) {
|
|
76
|
+
return v !== id;
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
setState(function (old) {
|
|
81
|
+
return Object.assign(Object.assign({}, old), {
|
|
82
|
+
checkedKeys: _toConsumableArray(ids)
|
|
83
|
+
});
|
|
84
|
+
});
|
|
85
|
+
onChecked && onChecked(ids);
|
|
86
|
+
}, // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
87
|
+
[listKey, state.checkedKeys]);
|
|
88
|
+
/**
|
|
89
|
+
* 列表渲染
|
|
90
|
+
*/
|
|
91
|
+
|
|
92
|
+
var renderRow = useCallback(function (_ref) {
|
|
93
|
+
var key = _ref.key,
|
|
94
|
+
index = _ref.index,
|
|
95
|
+
style = _ref.style;
|
|
96
|
+
var options = Object.assign(Object.assign({}, state), {
|
|
97
|
+
item: list[index],
|
|
98
|
+
onChecked: onCheckedAction,
|
|
99
|
+
checkable: !!onChecked,
|
|
100
|
+
index: index,
|
|
101
|
+
style: style,
|
|
102
|
+
keywords: props.keywords,
|
|
103
|
+
whatIcon: props.whatIcon,
|
|
104
|
+
renderItemExt: props.renderItemExt,
|
|
105
|
+
onClickItem: props.onClickItem,
|
|
106
|
+
onMouseOutItem: props.onMouseOutItem,
|
|
107
|
+
onMouseOverItem: props.onMouseOverItem,
|
|
108
|
+
itemKey: itemKey,
|
|
109
|
+
itemNameKey: itemNameKey,
|
|
110
|
+
activeKey: activeKey
|
|
111
|
+
});
|
|
112
|
+
var ItemRender = CustomRender ? CustomRender : RenderItem;
|
|
113
|
+
return /*#__PURE__*/React.createElement(ItemRender, Object.assign({
|
|
114
|
+
key: key
|
|
115
|
+
}, options));
|
|
116
|
+
}, // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
117
|
+
[list, state, onChecked, CustomRender, activeKey]);
|
|
118
|
+
/**
|
|
119
|
+
* 列表全选处理
|
|
120
|
+
*/
|
|
121
|
+
|
|
122
|
+
var onChangeCheckAll = useCallback(function () {
|
|
123
|
+
var ids = checkAllStatus ? difference(state.checkedKeys, listKey) : uniq([].concat(state.checkedKeys, listKey));
|
|
124
|
+
setState(function (old) {
|
|
125
|
+
return Object.assign(Object.assign({}, old), {
|
|
126
|
+
checkedKeys: _toConsumableArray(ids)
|
|
127
|
+
});
|
|
128
|
+
});
|
|
129
|
+
props.onChecked && props.onChecked(ids); // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
130
|
+
}, [checkAllStatus, state.checkedKeys, listKey]);
|
|
131
|
+
/**
|
|
132
|
+
* 同步选中更新
|
|
133
|
+
*/
|
|
134
|
+
|
|
135
|
+
useEffect(function () {
|
|
136
|
+
if (props.checkedKeys && !_isEqual(props.checkedKeys, state.checkedKeys)) {
|
|
137
|
+
setState(function (old) {
|
|
138
|
+
return Object.assign(Object.assign({}, old), {
|
|
139
|
+
checkedKeys: props.checkedKeys
|
|
140
|
+
});
|
|
141
|
+
});
|
|
142
|
+
} // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
25
143
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
onChange:
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
144
|
+
}, [props.checkedKeys]);
|
|
145
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
146
|
+
className: "lm-c-check-list-wrapper ".concat(className),
|
|
147
|
+
style: style
|
|
148
|
+
}, renderHeader && renderHeader(), checkExt, checkable && /*#__PURE__*/React.createElement(CheckExt, {
|
|
149
|
+
checkHalfStatus: checkHalfStatus,
|
|
150
|
+
selectCount: state.checkedKeys.length,
|
|
151
|
+
count: list.length,
|
|
152
|
+
onChange: onChangeCheckAll,
|
|
153
|
+
checkAllStatus: checkAllStatus
|
|
154
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
155
|
+
className: "lm-c-base-list-layout"
|
|
156
|
+
}, /*#__PURE__*/React.createElement(VList, {
|
|
157
|
+
className: "lm-c-virtual-layout",
|
|
158
|
+
data: list,
|
|
159
|
+
rowHeight: rowHeight || 30,
|
|
160
|
+
rowRenderer: renderRow
|
|
161
|
+
})));
|
|
38
162
|
}
|
|
39
163
|
|
|
40
164
|
List.defaultProps = {
|
|
41
|
-
|
|
42
|
-
|
|
165
|
+
className: '',
|
|
166
|
+
list: [],
|
|
167
|
+
itemKey: 'id',
|
|
168
|
+
itemNameKey: 'name'
|
|
43
169
|
};
|
|
44
170
|
export default List;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { CheckboxChangeEvent } from 'antd/lib/checkbox';
|
|
3
|
+
interface IRenderItempProps<T> {
|
|
4
|
+
item: T;
|
|
5
|
+
checkedKeys: any[];
|
|
6
|
+
activeKey: any;
|
|
7
|
+
style?: React.CSSProperties;
|
|
8
|
+
itemNameKey: string;
|
|
9
|
+
renderItemExt?: (item: T) => JSX.Element;
|
|
10
|
+
whatIcon?: (item: T) => JSX.Element;
|
|
11
|
+
itemKey?: string;
|
|
12
|
+
checkable?: boolean;
|
|
13
|
+
keywords?: string;
|
|
14
|
+
onChecked?: (e: CheckboxChangeEvent) => void;
|
|
15
|
+
onClickItem?: (item: T) => void;
|
|
16
|
+
onMouseOverItem?: (item: T) => void;
|
|
17
|
+
onMouseOutItem?: (item: T) => void;
|
|
18
|
+
}
|
|
19
|
+
export declare function RenderItem(props: IRenderItempProps<any>): JSX.Element;
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import "antd/lib/checkbox/style";
|
|
2
|
+
import _Checkbox from "antd/lib/checkbox";
|
|
3
|
+
import React, { useCallback, useMemo } from 'react';
|
|
4
|
+
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,
|
|
12
|
+
whatIcon = props.whatIcon,
|
|
13
|
+
itemKey = props.itemKey,
|
|
14
|
+
checkable = props.checkable,
|
|
15
|
+
keywords = props.keywords,
|
|
16
|
+
onChecked = props.onChecked,
|
|
17
|
+
onClickItem = props.onClickItem,
|
|
18
|
+
onMouseOverItem = props.onMouseOverItem,
|
|
19
|
+
onMouseOutItem = props.onMouseOutItem;
|
|
20
|
+
var checked = checkedKeys ? checkedKeys.includes(item[itemKey]) : false;
|
|
21
|
+
var active = !activeKey ? false : Array.isArray(activeKey) ? activeKey.includes(item[itemKey]) : activeKey === item[itemKey];
|
|
22
|
+
var itemIcon = whatIcon ? whatIcon(item) : null;
|
|
23
|
+
var itemClick = useCallback(function (e) {
|
|
24
|
+
return e.stopPropagation();
|
|
25
|
+
}, []);
|
|
26
|
+
|
|
27
|
+
var _onMouseOver = useCallback(function (item) {
|
|
28
|
+
return onMouseOverItem && onMouseOverItem(item);
|
|
29
|
+
}, []);
|
|
30
|
+
|
|
31
|
+
var _onMouseOut = useCallback(function (item) {
|
|
32
|
+
return onMouseOutItem && onMouseOutItem(item);
|
|
33
|
+
}, []);
|
|
34
|
+
|
|
35
|
+
var _onClick = useCallback(function (item) {
|
|
36
|
+
return onClickItem && onClickItem(item);
|
|
37
|
+
}, []);
|
|
38
|
+
|
|
39
|
+
var className = useMemo(function () {
|
|
40
|
+
return "list-item ".concat(checkable ? 'has-check-box' : '', " ").concat(active ? 'list-item-active' : '');
|
|
41
|
+
}, [checkable, active]);
|
|
42
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
43
|
+
style: style,
|
|
44
|
+
className: className,
|
|
45
|
+
onClick: function onClick() {
|
|
46
|
+
return _onClick(item);
|
|
47
|
+
},
|
|
48
|
+
onMouseOver: function onMouseOver() {
|
|
49
|
+
return _onMouseOver(item);
|
|
50
|
+
},
|
|
51
|
+
onMouseOut: function onMouseOut() {
|
|
52
|
+
return _onMouseOut(item);
|
|
53
|
+
}
|
|
54
|
+
}, /*#__PURE__*/React.createElement("label", null, checkable && /*#__PURE__*/React.createElement(_Checkbox, {
|
|
55
|
+
value: item[itemKey],
|
|
56
|
+
disabled: item.disabled,
|
|
57
|
+
onClick: itemClick,
|
|
58
|
+
checked: checked,
|
|
59
|
+
onChange: onChecked
|
|
60
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
61
|
+
className: "item-info"
|
|
62
|
+
}, itemIcon, keywords ? /*#__PURE__*/React.createElement(HightLevel, {
|
|
63
|
+
name: item[itemNameKey],
|
|
64
|
+
keyword: keywords
|
|
65
|
+
}) : /*#__PURE__*/React.createElement("span", {
|
|
66
|
+
title: item[itemNameKey]
|
|
67
|
+
}, item[itemNameKey])), renderItemExt && renderItemExt(item)));
|
|
68
|
+
}
|
package/es/List/utils.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { intersectionBy } from 'lodash'; // 计算全选半选状态
|
|
2
|
+
|
|
3
|
+
export function computedCheckStatus() {
|
|
4
|
+
var list = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
5
|
+
var checkedKeys = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
6
|
+
var key = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'id';
|
|
7
|
+
var listKey = list.map(function (v) {
|
|
8
|
+
return v[key];
|
|
9
|
+
});
|
|
10
|
+
var temp = intersectionBy(listKey, checkedKeys);
|
|
11
|
+
var checkHalfStatus = temp.length && temp.length < list.length;
|
|
12
|
+
var checkAllStatus = list.length && temp.length === list.length;
|
|
13
|
+
return {
|
|
14
|
+
checkHalfStatus: checkHalfStatus,
|
|
15
|
+
checkAllStatus: checkAllStatus,
|
|
16
|
+
listKey: listKey
|
|
17
|
+
};
|
|
18
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { CheckListProps } from '../List';
|
|
3
|
+
import './index.less';
|
|
4
|
+
export interface IListProps<T> extends CheckListProps<T>, IListExtProps {
|
|
5
|
+
}
|
|
6
|
+
export interface IListExtProps {
|
|
7
|
+
title?: string;
|
|
8
|
+
titleExt?: React.ReactNode;
|
|
9
|
+
inputPlaceholder?: string;
|
|
10
|
+
onKeywordChange?: (key: string) => void;
|
|
11
|
+
}
|
|
12
|
+
declare function ListExt<T>({ onKeywordChange, title, inputPlaceholder, titleExt, className, ...props }: IListProps<T>): JSX.Element;
|
|
13
|
+
declare namespace ListExt {
|
|
14
|
+
var defaultProps: {
|
|
15
|
+
inputPlaceholder: string;
|
|
16
|
+
title: string;
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
export default ListExt;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { __rest } from "tslib";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import List from '../List';
|
|
4
|
+
import TreeTitle from '../TreeTitle';
|
|
5
|
+
import "./index.css";
|
|
6
|
+
|
|
7
|
+
function ListExt(_a) {
|
|
8
|
+
var onKeywordChange = _a.onKeywordChange,
|
|
9
|
+
title = _a.title,
|
|
10
|
+
inputPlaceholder = _a.inputPlaceholder,
|
|
11
|
+
titleExt = _a.titleExt,
|
|
12
|
+
className = _a.className,
|
|
13
|
+
props = __rest(_a, ["onKeywordChange", "title", "inputPlaceholder", "titleExt", "className"]);
|
|
14
|
+
|
|
15
|
+
return /*#__PURE__*/React.createElement(List, Object.assign({}, props, {
|
|
16
|
+
className: "".concat(className, " vidc-list-component"),
|
|
17
|
+
checkExt: /*#__PURE__*/React.createElement(ListExtTitle, {
|
|
18
|
+
titleExt: titleExt,
|
|
19
|
+
onKeywordChange: onKeywordChange,
|
|
20
|
+
inputPlaceholder: inputPlaceholder,
|
|
21
|
+
title: title
|
|
22
|
+
})
|
|
23
|
+
}));
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function ListExtTitle(_ref) {
|
|
27
|
+
var title = _ref.title,
|
|
28
|
+
inputPlaceholder = _ref.inputPlaceholder,
|
|
29
|
+
onKeywordChange = _ref.onKeywordChange,
|
|
30
|
+
titleExt = _ref.titleExt;
|
|
31
|
+
return /*#__PURE__*/React.createElement(TreeTitle, {
|
|
32
|
+
title: title,
|
|
33
|
+
inputPlaceholder: inputPlaceholder,
|
|
34
|
+
onChange: onKeywordChange,
|
|
35
|
+
hasInput: !!onKeywordChange,
|
|
36
|
+
titleExt: titleExt
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
ListExt.defaultProps = {
|
|
41
|
+
inputPlaceholder: '请输入关键字搜索',
|
|
42
|
+
title: '列表'
|
|
43
|
+
};
|
|
44
|
+
export default ListExt;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { IOptionsLoader } from './interface';
|
|
3
|
+
export interface ILoaderProps {
|
|
4
|
+
/**
|
|
5
|
+
* @description 脚本加载数据源
|
|
6
|
+
* @default []
|
|
7
|
+
*/
|
|
8
|
+
options: IOptionsLoader[];
|
|
9
|
+
/**
|
|
10
|
+
* @description 加载后初始化组件
|
|
11
|
+
* @default null
|
|
12
|
+
*/
|
|
13
|
+
children?: React.ReactNode;
|
|
14
|
+
/**
|
|
15
|
+
* @description 加载后初始化组件
|
|
16
|
+
* @default null
|
|
17
|
+
*/
|
|
18
|
+
Spin?: React.ReactNode | null;
|
|
19
|
+
/**
|
|
20
|
+
* @description 加载完成触发事件
|
|
21
|
+
* @default -
|
|
22
|
+
*/
|
|
23
|
+
onLoadEnd?: () => Promise<null>;
|
|
24
|
+
}
|
|
25
|
+
declare function LoaderScripts({ options, children, Spin, onLoadEnd }: ILoaderProps): JSX.Element;
|
|
26
|
+
export default LoaderScripts;
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
|
+
|
|
3
|
+
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."); }
|
|
4
|
+
|
|
5
|
+
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); }
|
|
6
|
+
|
|
7
|
+
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; }
|
|
8
|
+
|
|
9
|
+
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; }
|
|
10
|
+
|
|
11
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
12
|
+
|
|
13
|
+
import { __asyncValues, __awaiter } from "tslib";
|
|
14
|
+
import React, { useEffect, useState } from 'react';
|
|
15
|
+
import { createAsyncIterable } from './utils';
|
|
16
|
+
import { nextTick, tryCatch } from '../utils';
|
|
17
|
+
|
|
18
|
+
function LoaderScripts(_ref) {
|
|
19
|
+
var _this = this;
|
|
20
|
+
|
|
21
|
+
var _ref$options = _ref.options,
|
|
22
|
+
options = _ref$options === void 0 ? [] : _ref$options,
|
|
23
|
+
children = _ref.children,
|
|
24
|
+
_ref$Spin = _ref.Spin,
|
|
25
|
+
Spin = _ref$Spin === void 0 ? null : _ref$Spin,
|
|
26
|
+
onLoadEnd = _ref.onLoadEnd;
|
|
27
|
+
|
|
28
|
+
var _useState = useState(false),
|
|
29
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
30
|
+
initStatus = _useState2[0],
|
|
31
|
+
setInitStatus = _useState2[1];
|
|
32
|
+
|
|
33
|
+
useEffect(function () {
|
|
34
|
+
if (options.length === 0) {
|
|
35
|
+
return setInitStatus(true);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
var asyncIter = createAsyncIterable(options);
|
|
39
|
+
tryCatch(function () {
|
|
40
|
+
return __awaiter(_this, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
|
|
41
|
+
var e_1, _a, asyncIter_1, asyncIter_1_1, x;
|
|
42
|
+
|
|
43
|
+
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
44
|
+
while (1) {
|
|
45
|
+
switch (_context.prev = _context.next) {
|
|
46
|
+
case 0:
|
|
47
|
+
_context.prev = 0;
|
|
48
|
+
asyncIter_1 = __asyncValues(asyncIter);
|
|
49
|
+
|
|
50
|
+
case 2:
|
|
51
|
+
_context.next = 4;
|
|
52
|
+
return asyncIter_1.next();
|
|
53
|
+
|
|
54
|
+
case 4:
|
|
55
|
+
asyncIter_1_1 = _context.sent;
|
|
56
|
+
|
|
57
|
+
if (asyncIter_1_1.done) {
|
|
58
|
+
_context.next = 10;
|
|
59
|
+
break;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
x = asyncIter_1_1.value;
|
|
63
|
+
console.log('加载完成!', options[x]);
|
|
64
|
+
|
|
65
|
+
case 8:
|
|
66
|
+
_context.next = 2;
|
|
67
|
+
break;
|
|
68
|
+
|
|
69
|
+
case 10:
|
|
70
|
+
_context.next = 15;
|
|
71
|
+
break;
|
|
72
|
+
|
|
73
|
+
case 12:
|
|
74
|
+
_context.prev = 12;
|
|
75
|
+
_context.t0 = _context["catch"](0);
|
|
76
|
+
e_1 = {
|
|
77
|
+
error: _context.t0
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
case 15:
|
|
81
|
+
_context.prev = 15;
|
|
82
|
+
_context.prev = 16;
|
|
83
|
+
|
|
84
|
+
if (!(asyncIter_1_1 && !asyncIter_1_1.done && (_a = asyncIter_1.return))) {
|
|
85
|
+
_context.next = 20;
|
|
86
|
+
break;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
_context.next = 20;
|
|
90
|
+
return _a.call(asyncIter_1);
|
|
91
|
+
|
|
92
|
+
case 20:
|
|
93
|
+
_context.prev = 20;
|
|
94
|
+
|
|
95
|
+
if (!e_1) {
|
|
96
|
+
_context.next = 23;
|
|
97
|
+
break;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
throw e_1.error;
|
|
101
|
+
|
|
102
|
+
case 23:
|
|
103
|
+
return _context.finish(20);
|
|
104
|
+
|
|
105
|
+
case 24:
|
|
106
|
+
return _context.finish(15);
|
|
107
|
+
|
|
108
|
+
case 25:
|
|
109
|
+
nextTick(function () {
|
|
110
|
+
return onLoadEnd ? onLoadEnd().then(function () {
|
|
111
|
+
return setInitStatus(true);
|
|
112
|
+
}) : setInitStatus(true);
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
case 26:
|
|
116
|
+
case "end":
|
|
117
|
+
return _context.stop();
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}, _callee, null, [[0, 12, 15, 25], [16,, 20, 24]]);
|
|
121
|
+
}));
|
|
122
|
+
});
|
|
123
|
+
}, [options]);
|
|
124
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, !initStatus ? Spin : children);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
export default LoaderScripts;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
export interface IOptionsLoader {
|
|
4
|
+
scripts?: string[];
|
|
5
|
+
styles?: string[];
|
|
6
|
+
}
|
|
7
|
+
export interface ILoaderProps {
|
|
8
|
+
/**
|
|
9
|
+
* @description 脚本加载数据源
|
|
10
|
+
* @default []
|
|
11
|
+
* @type {scripts?:string[],styles?:string[]}
|
|
12
|
+
*/
|
|
13
|
+
options: IOptionsLoader[];
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* @description 加载后初始化组件
|
|
17
|
+
* @default null
|
|
18
|
+
*/
|
|
19
|
+
children?: React.ReactNode;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* @description 加载后初始化组件
|
|
23
|
+
* @default null
|
|
24
|
+
*/
|
|
25
|
+
Spin?: React.ReactNode | null;
|
|
26
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { IOptionsLoader } from './interface';
|
|
2
|
+
export declare const loadScript: (url: string) => Promise<unknown>;
|
|
3
|
+
export declare const loaderCss: (href: string) => Promise<unknown>;
|
|
4
|
+
export declare function createAsyncIterable(options: IOptionsLoader[]): {
|
|
5
|
+
[Symbol.asyncIterator](): {
|
|
6
|
+
i: number;
|
|
7
|
+
next(): Promise<{
|
|
8
|
+
value: number;
|
|
9
|
+
done: boolean;
|
|
10
|
+
}>;
|
|
11
|
+
};
|
|
12
|
+
};
|