@cloud-app-dev/vidc 1.0.32 → 1.0.36
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 +2 -2
- package/es/{WorkerFlow/api.d.ts → Api/index.d.ts} +4 -1
- package/es/{WorkerFlow/api.js → Api/index.js} +90 -0
- package/es/DeviceList/index.css +3 -0
- package/es/DeviceList/index.d.ts +12 -11
- package/es/DeviceList/index.js +54 -110
- package/es/DeviceSelect/demo.d.ts +2 -0
- package/es/DeviceSelect/demo.js +22 -0
- package/es/DeviceSelect/index.css +6 -0
- package/es/DeviceSelect/index.d.ts +7 -0
- package/es/DeviceSelect/index.js +222 -0
- package/es/DynamicDeviceList/CheckExt.d.ts +8 -0
- package/es/DynamicDeviceList/CheckExt.js +36 -0
- package/es/DynamicDeviceList/Demo.js +1 -5
- package/es/DynamicDeviceList/index.css +20 -0
- package/es/DynamicDeviceList/index.d.ts +7 -4
- package/es/DynamicDeviceList/index.js +100 -49
- package/es/DynamicDeviceList/utils.d.ts +1 -2
- package/es/List/index.css +2 -2
- package/es/OrgTree/index.js +5 -5
- package/es/OrgUserTree/demo.d.ts +2 -0
- package/es/OrgUserTree/demo.js +20 -0
- package/es/OrgUserTree/index.css +31 -0
- package/es/OrgUserTree/index.d.ts +22 -0
- package/es/OrgUserTree/index.js +128 -0
- package/es/PlaceTree/demo.d.ts +2 -0
- package/es/PlaceTree/demo.js +20 -0
- package/es/PlaceTree/index.css +1 -0
- package/es/PlaceTree/index.d.ts +2 -2
- package/es/PlaceTree/index.js +27 -22
- package/es/RefDrawer/index.d.ts +15 -0
- package/es/RefDrawer/index.js +72 -0
- package/es/RefModal/index.d.ts +15 -0
- package/es/RefModal/index.js +74 -0
- package/es/TreeMode/demo.d.ts +2 -0
- package/es/TreeMode/demo.js +30 -0
- package/es/TreeMode/index.css +36 -0
- package/es/TreeMode/index.d.ts +21 -0
- package/es/TreeMode/index.js +190 -0
- package/es/TreeTitle/index.css +1 -0
- package/es/TreeTitle/index.d.ts +3 -2
- package/es/TreeTitle/index.js +4 -2
- package/es/UserSelect/index.css +16 -0
- package/es/UserSelect/index.d.ts +10 -0
- package/es/UserSelect/index.js +168 -0
- package/es/WorkerFlow/Form/Condition.js +7 -5
- package/es/WorkerFlow/Form/EmptyUserSet.js +6 -4
- package/es/WorkerFlow/Form/GroupList.d.ts +1 -1
- package/es/WorkerFlow/Form/GroupList.js +3 -1
- package/es/WorkerFlow/Form/GroupSelect.js +6 -4
- package/es/WorkerFlow/Form/GroupSelectModalContent.js +12 -11
- package/es/WorkerFlow/Form/LevelGroupSelect.js +6 -4
- package/es/WorkerFlow/Form/Notifier.js +2 -1
- package/es/WorkerFlow/Form/UserAndGroupSelect.js +6 -4
- package/es/WorkerFlow/Form/UserSelect.js +6 -4
- package/es/WorkerFlow/Form/UserSelectModalContent.js +26 -25
- package/es/WorkerFlow/index.css +1 -1
- package/es/WorkerFlow/index.js +8 -5
- package/es/WorkerFlow/utils.js +6 -2
- package/es/core.d.ts +91 -0
- package/es/index.d.ts +7 -0
- package/es/index.js +7 -0
- package/es/utils.d.ts +10 -0
- package/es/utils.js +54 -1
- package/package.json +5 -5
- package/tsconfig.json +0 -1
- package/es/DynamicDeviceList/interface.d.ts +0 -75
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface IUseDrawerHookState {
|
|
3
|
+
content?: React.ReactNode;
|
|
4
|
+
visible?: boolean;
|
|
5
|
+
title?: React.ReactNode;
|
|
6
|
+
onOk?: () => void;
|
|
7
|
+
width?: number | string;
|
|
8
|
+
className?: string;
|
|
9
|
+
}
|
|
10
|
+
export interface IDrawerMethodsProps {
|
|
11
|
+
open: (options: IUseDrawerHookState) => void;
|
|
12
|
+
close: () => void;
|
|
13
|
+
}
|
|
14
|
+
declare const _default: React.ForwardRefExoticComponent<Pick<any, string | number | symbol> & React.RefAttributes<IDrawerMethodsProps>>;
|
|
15
|
+
export default _default;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import _Drawer from "@cloud-app-dev/basic-components/es/Drawer";
|
|
2
|
+
import _ConfigContext from "@cloud-app-dev/basic-components/es/ConfigContext";
|
|
3
|
+
|
|
4
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
5
|
+
|
|
6
|
+
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."); }
|
|
7
|
+
|
|
8
|
+
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); }
|
|
9
|
+
|
|
10
|
+
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; }
|
|
11
|
+
|
|
12
|
+
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; }
|
|
13
|
+
|
|
14
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
15
|
+
|
|
16
|
+
import React, { useContext, useImperativeHandle, useMemo, useState } from 'react';
|
|
17
|
+
|
|
18
|
+
function RefDrawer(_, ref) {
|
|
19
|
+
var context = useContext(_ConfigContext);
|
|
20
|
+
var root = useMemo(function () {
|
|
21
|
+
return (context === null || context === void 0 ? void 0 : context.root) || document.body;
|
|
22
|
+
}, [context === null || context === void 0 ? void 0 : context.root]);
|
|
23
|
+
|
|
24
|
+
var _useState = useState({
|
|
25
|
+
content: null,
|
|
26
|
+
visible: false,
|
|
27
|
+
title: '',
|
|
28
|
+
onOk: undefined,
|
|
29
|
+
width: undefined,
|
|
30
|
+
className: undefined
|
|
31
|
+
}),
|
|
32
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
33
|
+
state = _useState2[0],
|
|
34
|
+
setState = _useState2[1];
|
|
35
|
+
|
|
36
|
+
var open = function open(options) {
|
|
37
|
+
setState(function (old) {
|
|
38
|
+
return Object.assign(Object.assign(Object.assign({}, old), options), {
|
|
39
|
+
visible: true
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
var close = function close() {
|
|
45
|
+
setState(function (old) {
|
|
46
|
+
return Object.assign(Object.assign({}, old), {
|
|
47
|
+
visible: false
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
useImperativeHandle(ref, function () {
|
|
53
|
+
return {
|
|
54
|
+
open: open,
|
|
55
|
+
close: close
|
|
56
|
+
};
|
|
57
|
+
}, [state]);
|
|
58
|
+
return /*#__PURE__*/React.createElement(_Drawer, {
|
|
59
|
+
visible: state.visible,
|
|
60
|
+
onOk: state.onOk,
|
|
61
|
+
onClose: close,
|
|
62
|
+
destroyOnClose: true,
|
|
63
|
+
title: state.title,
|
|
64
|
+
width: state.width,
|
|
65
|
+
className: state.className,
|
|
66
|
+
getContainer: function getContainer() {
|
|
67
|
+
return root;
|
|
68
|
+
}
|
|
69
|
+
}, state.content);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export default /*#__PURE__*/React.forwardRef(RefDrawer);
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface IUseModalHookState {
|
|
3
|
+
content?: React.ReactNode;
|
|
4
|
+
visible?: boolean;
|
|
5
|
+
title?: React.ReactNode;
|
|
6
|
+
onOk?: () => void;
|
|
7
|
+
width?: number | string;
|
|
8
|
+
className?: string;
|
|
9
|
+
}
|
|
10
|
+
export interface IModalMethodsProps {
|
|
11
|
+
open: (options: IUseModalHookState) => void;
|
|
12
|
+
close: () => void;
|
|
13
|
+
}
|
|
14
|
+
declare const _default: React.ForwardRefExoticComponent<Pick<any, string | number | symbol> & React.RefAttributes<IModalMethodsProps>>;
|
|
15
|
+
export default _default;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import _Modal from "@cloud-app-dev/basic-components/es/Modal";
|
|
2
|
+
import _ConfigContext from "@cloud-app-dev/basic-components/es/ConfigContext";
|
|
3
|
+
|
|
4
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
5
|
+
|
|
6
|
+
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."); }
|
|
7
|
+
|
|
8
|
+
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); }
|
|
9
|
+
|
|
10
|
+
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; }
|
|
11
|
+
|
|
12
|
+
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; }
|
|
13
|
+
|
|
14
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
15
|
+
|
|
16
|
+
import React, { useContext, useImperativeHandle, useMemo, useState } from 'react';
|
|
17
|
+
|
|
18
|
+
function RefModal(_, ref) {
|
|
19
|
+
var context = useContext(_ConfigContext);
|
|
20
|
+
var root = useMemo(function () {
|
|
21
|
+
return (context === null || context === void 0 ? void 0 : context.root) || document.body;
|
|
22
|
+
}, [context === null || context === void 0 ? void 0 : context.root]);
|
|
23
|
+
|
|
24
|
+
var _useState = useState({
|
|
25
|
+
content: null,
|
|
26
|
+
visible: false,
|
|
27
|
+
title: '',
|
|
28
|
+
onOk: undefined,
|
|
29
|
+
width: undefined,
|
|
30
|
+
className: undefined
|
|
31
|
+
}),
|
|
32
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
33
|
+
state = _useState2[0],
|
|
34
|
+
setState = _useState2[1];
|
|
35
|
+
|
|
36
|
+
var open = function open(options) {
|
|
37
|
+
setState(function (old) {
|
|
38
|
+
return Object.assign(Object.assign(Object.assign({}, old), options), {
|
|
39
|
+
visible: true
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
var close = function close() {
|
|
45
|
+
setState(function (old) {
|
|
46
|
+
return Object.assign(Object.assign({}, old), {
|
|
47
|
+
visible: false
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
useImperativeHandle(ref, function () {
|
|
53
|
+
return {
|
|
54
|
+
open: open,
|
|
55
|
+
close: close
|
|
56
|
+
};
|
|
57
|
+
}, [state]);
|
|
58
|
+
return /*#__PURE__*/React.createElement(_Modal, {
|
|
59
|
+
okText: "\u786E\u5B9A",
|
|
60
|
+
cancelText: "\u53D6\u6D88",
|
|
61
|
+
visible: state.visible,
|
|
62
|
+
onOk: state.onOk,
|
|
63
|
+
onCancel: close,
|
|
64
|
+
destroyOnClose: true,
|
|
65
|
+
title: state.title,
|
|
66
|
+
width: state.width,
|
|
67
|
+
className: state.className,
|
|
68
|
+
getContainer: function getContainer() {
|
|
69
|
+
return root;
|
|
70
|
+
}
|
|
71
|
+
}, state.content);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export default /*#__PURE__*/React.forwardRef(RefModal);
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import "antd/lib/config-provider/style";
|
|
2
|
+
import _ConfigProvider from "antd/lib/config-provider";
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import BsTree from './index';
|
|
5
|
+
|
|
6
|
+
function App() {
|
|
7
|
+
return /*#__PURE__*/React.createElement(_ConfigProvider, {
|
|
8
|
+
prefixCls: "cloudapp"
|
|
9
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
10
|
+
style: {
|
|
11
|
+
padding: 20,
|
|
12
|
+
height: 400,
|
|
13
|
+
display: 'flex'
|
|
14
|
+
}
|
|
15
|
+
}, /*#__PURE__*/React.createElement(BsTree, {
|
|
16
|
+
title: "\u8BBE\u5907\u4E1A\u52A1\u6811",
|
|
17
|
+
mode: "Bz"
|
|
18
|
+
}), /*#__PURE__*/React.createElement(BsTree, {
|
|
19
|
+
title: "\u81EA\u5B9A\u4E49\u5206\u7EC4",
|
|
20
|
+
mode: "Custom"
|
|
21
|
+
}), /*#__PURE__*/React.createElement(BsTree, {
|
|
22
|
+
title: "\u884C\u653F\u533A\u5212",
|
|
23
|
+
mode: "Place"
|
|
24
|
+
}), /*#__PURE__*/React.createElement(BsTree, {
|
|
25
|
+
title: "\u7EC4\u7EC7\u673A\u6784",
|
|
26
|
+
mode: "Org"
|
|
27
|
+
})));
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export default App;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
.bc-type-tree-layout {
|
|
2
|
+
height: 100%;
|
|
3
|
+
display: flex;
|
|
4
|
+
flex-direction: column;
|
|
5
|
+
border: 1px solid var(--bd-color);
|
|
6
|
+
margin-left: -1px;
|
|
7
|
+
}
|
|
8
|
+
.bc-type-tree-layout .lm-c-tree-title-part {
|
|
9
|
+
border-bottom: 1px solid var(--bd-color);
|
|
10
|
+
background-color: var(--form-bg-light);
|
|
11
|
+
}
|
|
12
|
+
.bc-type-tree-layout > .lm-base-tree-component {
|
|
13
|
+
flex: 1;
|
|
14
|
+
overflow: auto;
|
|
15
|
+
}
|
|
16
|
+
.bc-type-tree-layout .lm-base-tree-component .cloudapp-tree-treenode span.cloudapp-tree-node-content-wrapper:hover:after,
|
|
17
|
+
.bc-type-tree-layout .lm-base-tree-component .cloudapp-tree-treenode span.cloudapp-tree-node-content-wrapper.cloudapp-tree-node-selected:after {
|
|
18
|
+
left: 10px;
|
|
19
|
+
width: calc(100% - 10px);
|
|
20
|
+
}
|
|
21
|
+
.bc-type-tree-layout .cloudapp-tree {
|
|
22
|
+
height: 100%;
|
|
23
|
+
overflow: auto;
|
|
24
|
+
}
|
|
25
|
+
.bc-type-tree-layout .anticon {
|
|
26
|
+
font-size: var(--fs);
|
|
27
|
+
}
|
|
28
|
+
.bc-type-tree-layout .cloudapp-tree-title {
|
|
29
|
+
font-size: var(--fs-small);
|
|
30
|
+
flex: 1;
|
|
31
|
+
}
|
|
32
|
+
.bc-type-tree-layout .cloudapp-tree-title > span {
|
|
33
|
+
min-width: 100%;
|
|
34
|
+
display: inline-flex;
|
|
35
|
+
justify-content: space-between;
|
|
36
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { BaseTreeProps } from '@cloud-app-dev/basic-components/es/Tree';
|
|
3
|
+
import './index.less';
|
|
4
|
+
interface IBsTreeProps extends BaseTreeProps {
|
|
5
|
+
title?: React.ReactNode;
|
|
6
|
+
inputPlaceholder?: string;
|
|
7
|
+
renderHeader?: () => JSX.Element;
|
|
8
|
+
/**
|
|
9
|
+
* @description 需要默认选中时触发 事件
|
|
10
|
+
*/
|
|
11
|
+
onDefailtSelect?: (id?: string) => void;
|
|
12
|
+
mode?: 'Bz' | 'Custom' | 'Place' | 'Org';
|
|
13
|
+
}
|
|
14
|
+
declare function TreeMode({ title, className, renderHeader, inputPlaceholder, treeNodeProps, onDefailtSelect, mode, ...props }: IBsTreeProps): JSX.Element;
|
|
15
|
+
declare namespace TreeMode {
|
|
16
|
+
var defaultProps: {
|
|
17
|
+
mode: string;
|
|
18
|
+
className: string;
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
export default TreeMode;
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
import _IconFont from "@cloud-app-dev/basic-components/es/IconFont";
|
|
2
|
+
import _Tree from "@cloud-app-dev/basic-components/es/Tree";
|
|
3
|
+
import _CBox from "@cloud-app-dev/basic-components/es/CBox";
|
|
4
|
+
import _useHttp2 from "@cloud-app-dev/basic-components/es/useHttp";
|
|
5
|
+
|
|
6
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
7
|
+
|
|
8
|
+
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."); }
|
|
9
|
+
|
|
10
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
11
|
+
|
|
12
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
13
|
+
|
|
14
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
15
|
+
|
|
16
|
+
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."); }
|
|
17
|
+
|
|
18
|
+
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); }
|
|
19
|
+
|
|
20
|
+
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; }
|
|
21
|
+
|
|
22
|
+
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; }
|
|
23
|
+
|
|
24
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
25
|
+
|
|
26
|
+
import { __rest } from "tslib";
|
|
27
|
+
import React, { useEffect, useMemo, useState } from 'react';
|
|
28
|
+
import api from '../Api';
|
|
29
|
+
import TreeTitle from '../TreeTitle';
|
|
30
|
+
import { treeHelper } from '@cloud-app-dev/utils';
|
|
31
|
+
import { getParentListById, getPlaceCodesWithParent } from '../utils';
|
|
32
|
+
import "./index.css";
|
|
33
|
+
var defaultList = [];
|
|
34
|
+
|
|
35
|
+
function TreeMode(_a) {
|
|
36
|
+
var title = _a.title,
|
|
37
|
+
className = _a.className,
|
|
38
|
+
renderHeader = _a.renderHeader,
|
|
39
|
+
inputPlaceholder = _a.inputPlaceholder,
|
|
40
|
+
treeNodeProps = _a.treeNodeProps,
|
|
41
|
+
onDefailtSelect = _a.onDefailtSelect,
|
|
42
|
+
mode = _a.mode,
|
|
43
|
+
props = __rest(_a, ["title", "className", "renderHeader", "inputPlaceholder", "treeNodeProps", "onDefailtSelect", "mode"]);
|
|
44
|
+
|
|
45
|
+
var _useState = useState({
|
|
46
|
+
keyword: undefined,
|
|
47
|
+
expandedKeys: undefined,
|
|
48
|
+
focusKey: Date.now()
|
|
49
|
+
}),
|
|
50
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
51
|
+
state = _useState2[0],
|
|
52
|
+
setState = _useState2[1];
|
|
53
|
+
/**
|
|
54
|
+
* @description 根据mode获取树的数据
|
|
55
|
+
*/
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
var _useHttp = _useHttp2(['TreeMode', mode], function (_ref) {
|
|
59
|
+
var _ref2 = _slicedToArray(_ref, 2),
|
|
60
|
+
_ = _ref2[0],
|
|
61
|
+
mode = _ref2[1];
|
|
62
|
+
|
|
63
|
+
return mode === 'Bz' ? api.getDeviceBzTree() : mode === 'Custom' ? api.getCustomDeviceGroup() : mode === 'Org' ? api.getOrgs() : api.getPlacesByHasDevice();
|
|
64
|
+
}),
|
|
65
|
+
_useHttp$data = _useHttp.data,
|
|
66
|
+
list = _useHttp$data === void 0 ? defaultList : _useHttp$data;
|
|
67
|
+
|
|
68
|
+
var treeData = useMemo(function () {
|
|
69
|
+
return mode === 'Place' ? treeHelper.computPlaceTree(list) : treeHelper.computTreeList(list);
|
|
70
|
+
}, [list, mode]);
|
|
71
|
+
useEffect(function () {
|
|
72
|
+
var _a, _b;
|
|
73
|
+
|
|
74
|
+
var keys = [];
|
|
75
|
+
var defaultKeys = mode === 'Place' ? [] : ((_a = treeData[0]) === null || _a === void 0 ? void 0 : _a.id) ? [(_b = treeData[0]) === null || _b === void 0 ? void 0 : _b.id] : [];
|
|
76
|
+
|
|
77
|
+
if (!state.keyword) {
|
|
78
|
+
setState(function (old) {
|
|
79
|
+
return Object.assign(Object.assign({}, old), {
|
|
80
|
+
expandedKeys: defaultKeys,
|
|
81
|
+
focusKey: Date.now()
|
|
82
|
+
});
|
|
83
|
+
});
|
|
84
|
+
return null;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
switch (mode) {
|
|
88
|
+
case 'Place':
|
|
89
|
+
var places = list.filter(function (v) {
|
|
90
|
+
return v.areaName.includes(state.keyword);
|
|
91
|
+
});
|
|
92
|
+
places.forEach(function (v) {
|
|
93
|
+
var codes = getPlaceCodesWithParent(v.areaCode, list);
|
|
94
|
+
keys = [].concat(keys, codes);
|
|
95
|
+
});
|
|
96
|
+
break;
|
|
97
|
+
|
|
98
|
+
case 'Bz':
|
|
99
|
+
case 'Custom':
|
|
100
|
+
var trees = list.filter(function (v) {
|
|
101
|
+
return v.groupName.includes(state.keyword);
|
|
102
|
+
});
|
|
103
|
+
trees.forEach(function (v) {
|
|
104
|
+
var ids = getParentListById(v.id, list).map(function (v) {
|
|
105
|
+
return v.id;
|
|
106
|
+
});
|
|
107
|
+
keys = [].concat(keys, ids);
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
case 'Org':
|
|
111
|
+
var orgs = list.filter(function (v) {
|
|
112
|
+
return v.organizationName.includes(state.keyword);
|
|
113
|
+
});
|
|
114
|
+
orgs.forEach(function (v) {
|
|
115
|
+
var ids = getParentListById(v.id, list).map(function (v) {
|
|
116
|
+
return v.id;
|
|
117
|
+
});
|
|
118
|
+
keys = [].concat(keys, ids);
|
|
119
|
+
});
|
|
120
|
+
break;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
var expandedKeys = _toConsumableArray(new Set(_toConsumableArray(keys)));
|
|
124
|
+
|
|
125
|
+
setState(function (old) {
|
|
126
|
+
var _a;
|
|
127
|
+
|
|
128
|
+
return Object.assign(Object.assign({}, old), {
|
|
129
|
+
expandedKeys: expandedKeys.length > 0 ? expandedKeys : [(_a = treeData[0]) === null || _a === void 0 ? void 0 : _a.id],
|
|
130
|
+
focusKey: Date.now()
|
|
131
|
+
});
|
|
132
|
+
});
|
|
133
|
+
}, [state.keyword, list, treeData, mode]);
|
|
134
|
+
var treeKey = useMemo(function () {
|
|
135
|
+
return mode === 'Place' ? 'areaCode' : 'id';
|
|
136
|
+
}, [mode]);
|
|
137
|
+
var treeName = useMemo(function () {
|
|
138
|
+
return mode === 'Place' ? 'areaName' : mode === 'Org' ? 'organizationName' : 'groupName';
|
|
139
|
+
}, [mode]);
|
|
140
|
+
useEffect(function () {
|
|
141
|
+
var id = treeData[0] ? treeData[0][treeKey] : undefined;
|
|
142
|
+
|
|
143
|
+
if (id && onDefailtSelect) {
|
|
144
|
+
onDefailtSelect(id);
|
|
145
|
+
}
|
|
146
|
+
}, [treeData, treeKey]);
|
|
147
|
+
return /*#__PURE__*/React.createElement(_CBox, {
|
|
148
|
+
className: "bc-type-tree-layout ".concat(className)
|
|
149
|
+
}, /*#__PURE__*/React.createElement(TreeTitle, {
|
|
150
|
+
title: title,
|
|
151
|
+
value: state.keyword,
|
|
152
|
+
inputPlaceholder: inputPlaceholder,
|
|
153
|
+
onChange: function onChange(val) {
|
|
154
|
+
return setState(function (old) {
|
|
155
|
+
return Object.assign(Object.assign({}, old), {
|
|
156
|
+
keyword: val
|
|
157
|
+
});
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
}), renderHeader && renderHeader(), list.length > 0 && /*#__PURE__*/React.createElement(_Tree, Object.assign({}, props, {
|
|
161
|
+
treeData: treeData,
|
|
162
|
+
key: state.focusKey,
|
|
163
|
+
onExpand: function onExpand(keys) {
|
|
164
|
+
return setState(function (old) {
|
|
165
|
+
return Object.assign(Object.assign({}, old), {
|
|
166
|
+
expandedKeys: keys
|
|
167
|
+
});
|
|
168
|
+
});
|
|
169
|
+
},
|
|
170
|
+
expandedKeys: state.expandedKeys,
|
|
171
|
+
defaultExpandedKeys: treeData[0] ? [treeData[0].id] : undefined,
|
|
172
|
+
treeNodeProps: {
|
|
173
|
+
keyword: state.keyword,
|
|
174
|
+
suffix: treeNodeProps === null || treeNodeProps === void 0 ? void 0 : treeNodeProps.suffix,
|
|
175
|
+
nameKey: treeName,
|
|
176
|
+
key: treeKey
|
|
177
|
+
},
|
|
178
|
+
icon: function icon(node) {
|
|
179
|
+
return /*#__PURE__*/React.createElement(_IconFont, {
|
|
180
|
+
type: "".concat(treeData.length > 0 && node.id === treeData[0].id ? 'icon-S_Bar_Home' : mode === 'Place' && node.level > 4 ? 'icon-S_Place_Place' : 'icon-S_Photo_ListTree')
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
})));
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
TreeMode.defaultProps = {
|
|
187
|
+
mode: 'Bz',
|
|
188
|
+
className: ''
|
|
189
|
+
};
|
|
190
|
+
export default TreeMode;
|
package/es/TreeTitle/index.css
CHANGED
package/es/TreeTitle/index.d.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import './index.less';
|
|
3
3
|
interface ITreeTitleProps {
|
|
4
|
-
title?:
|
|
4
|
+
title?: React.ReactNode;
|
|
5
5
|
inputPlaceholder?: string;
|
|
6
6
|
onChange?: (val: string) => void;
|
|
7
7
|
hasInput?: boolean;
|
|
8
8
|
titleExt?: React.ReactNode;
|
|
9
|
+
value?: string;
|
|
9
10
|
}
|
|
10
|
-
export default function TreeTitle({ title, inputPlaceholder, onChange, hasInput, titleExt }: ITreeTitleProps): JSX.Element;
|
|
11
|
+
export default function TreeTitle({ title, inputPlaceholder, onChange, hasInput, titleExt, value }: ITreeTitleProps): JSX.Element;
|
|
11
12
|
export {};
|
package/es/TreeTitle/index.js
CHANGED
|
@@ -7,7 +7,8 @@ export default function TreeTitle(_ref) {
|
|
|
7
7
|
onChange = _ref.onChange,
|
|
8
8
|
_ref$hasInput = _ref.hasInput,
|
|
9
9
|
hasInput = _ref$hasInput === void 0 ? true : _ref$hasInput,
|
|
10
|
-
titleExt = _ref.titleExt
|
|
10
|
+
titleExt = _ref.titleExt,
|
|
11
|
+
value = _ref.value;
|
|
11
12
|
|
|
12
13
|
if (!title) {
|
|
13
14
|
return null;
|
|
@@ -20,6 +21,7 @@ export default function TreeTitle(_ref) {
|
|
|
20
21
|
}, title), hasInput && /*#__PURE__*/React.createElement(_Input, {
|
|
21
22
|
className: "input-keword",
|
|
22
23
|
placeholder: inputPlaceholder,
|
|
23
|
-
onChange: onChange
|
|
24
|
+
onChange: onChange,
|
|
25
|
+
value: value
|
|
24
26
|
}), titleExt);
|
|
25
27
|
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
.user-select-layout {
|
|
2
|
+
display: flex;
|
|
3
|
+
height: 480px;
|
|
4
|
+
}
|
|
5
|
+
.user-select-layout > div {
|
|
6
|
+
flex: 1;
|
|
7
|
+
}
|
|
8
|
+
.user-select-layout .lm-organization-tree {
|
|
9
|
+
border-right: none;
|
|
10
|
+
}
|
|
11
|
+
.user-select-layout .user-source-list {
|
|
12
|
+
border-right: none;
|
|
13
|
+
}
|
|
14
|
+
.user-select-layout .lm-c-check-list-wrapper {
|
|
15
|
+
background-color: #fff;
|
|
16
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { UserInfo } from '@cloud-app-dev/basic-components/es/Store/app';
|
|
3
|
+
import './index.less';
|
|
4
|
+
interface IUserSelectProps {
|
|
5
|
+
selectUsers: UserInfo[];
|
|
6
|
+
onChange?: (users: UserInfo[]) => void;
|
|
7
|
+
className?: string;
|
|
8
|
+
}
|
|
9
|
+
declare const _default: React.ForwardRefExoticComponent<IUserSelectProps & React.RefAttributes<any>>;
|
|
10
|
+
export default _default;
|