@teamix/pro 1.3.4 → 1.3.5
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/dist/pro.css +1 -1
- package/dist/pro.js +58917 -51090
- package/dist/pro.min.css +1 -1
- package/dist/pro.min.js +1 -1
- package/dist/pro.min.js.LICENSE.txt +9 -0
- package/es/form/docs/ActionResponse.d.ts +7 -0
- package/es/form/docs/ActionResponse.js +11 -0
- package/es/form/docs/ActionResponse.less +25 -0
- package/es/form/index.d.ts +1 -1
- package/es/index.d.ts +4 -2
- package/es/index.js +5 -5
- package/es/info/components/ProInfoItem/index.js +6 -2
- package/es/info/components/ProInfoItem/index.scss +3 -0
- package/es/info/components/baseInfo/index.js +2 -1
- package/es/info/components/baseInfo/index.scss +0 -3
- package/es/info/typing.d.ts +2 -0
- package/es/info/utils/index.d.ts +8 -0
- package/es/info/utils/index.js +28 -1
- package/es/sidebar/components/sidebar-container/index.js +114 -9
- package/es/sidebar/components/sidebar-container/index.scss +53 -5
- package/es/sidebar/components/tree/index.d.ts +2 -0
- package/es/sidebar/components/tree/index.js +222 -76
- package/es/sidebar/components/tree/index.scss +10 -0
- package/es/sidebar/components/tree-node/componnets/HoverTooltip/index.d.ts +15 -0
- package/es/sidebar/components/tree-node/componnets/HoverTooltip/index.js +62 -0
- package/es/sidebar/components/tree-node/componnets/HoverTooltip/index.scss +7 -0
- package/es/sidebar/components/tree-node/componnets/IconAction/index.d.ts +12 -0
- package/es/sidebar/components/tree-node/componnets/IconAction/index.js +105 -0
- package/es/sidebar/components/tree-node/componnets/IconAction/index.scss +7 -0
- package/es/sidebar/components/tree-node/componnets/IconSwitch/index.d.ts +23 -0
- package/es/sidebar/components/tree-node/componnets/IconSwitch/index.js +73 -0
- package/es/sidebar/components/tree-node/componnets/IconSwitch/index.scss +7 -0
- package/es/sidebar/components/tree-node/index.d.ts +7 -0
- package/es/sidebar/components/tree-node/index.js +225 -0
- package/es/sidebar/components/tree-node/index.scss +58 -0
- package/es/sidebar/index.d.ts +2 -0
- package/es/sidebar/index.js +147 -12
- package/es/sidebar/index.scss +24 -1
- package/es/sidebar/typing.d.ts +83 -13
- package/es/sidebar/utils/action-ref.d.ts +3 -0
- package/es/sidebar/utils/action-ref.js +15 -0
- package/es/sidebar/utils/index.d.ts +71 -0
- package/es/sidebar/utils/index.js +228 -0
- package/lib/form/docs/ActionResponse.d.ts +7 -0
- package/lib/form/docs/ActionResponse.js +24 -0
- package/lib/form/docs/ActionResponse.less +25 -0
- package/lib/form/index.d.ts +1 -1
- package/lib/index.d.ts +4 -2
- package/lib/index.js +22 -2
- package/lib/info/components/ProInfoItem/index.js +6 -2
- package/lib/info/components/ProInfoItem/index.scss +3 -0
- package/lib/info/components/baseInfo/index.js +1 -0
- package/lib/info/components/baseInfo/index.scss +0 -3
- package/lib/info/typing.d.ts +2 -0
- package/lib/info/utils/index.d.ts +8 -0
- package/lib/info/utils/index.js +32 -1
- package/lib/sidebar/components/sidebar-container/index.js +120 -8
- package/lib/sidebar/components/sidebar-container/index.scss +53 -5
- package/lib/sidebar/components/tree/index.d.ts +2 -0
- package/lib/sidebar/components/tree/index.js +230 -76
- package/lib/sidebar/components/tree/index.scss +10 -0
- package/lib/sidebar/components/tree-node/componnets/HoverTooltip/index.d.ts +15 -0
- package/lib/sidebar/components/tree-node/componnets/HoverTooltip/index.js +80 -0
- package/lib/sidebar/components/tree-node/componnets/HoverTooltip/index.scss +7 -0
- package/lib/sidebar/components/tree-node/componnets/IconAction/index.d.ts +12 -0
- package/lib/sidebar/components/tree-node/componnets/IconAction/index.js +127 -0
- package/lib/sidebar/components/tree-node/componnets/IconAction/index.scss +7 -0
- package/lib/sidebar/components/tree-node/componnets/IconSwitch/index.d.ts +23 -0
- package/lib/sidebar/components/tree-node/componnets/IconSwitch/index.js +94 -0
- package/lib/sidebar/components/tree-node/componnets/IconSwitch/index.scss +7 -0
- package/lib/sidebar/components/tree-node/index.d.ts +7 -0
- package/lib/sidebar/components/tree-node/index.js +252 -0
- package/lib/sidebar/components/tree-node/index.scss +58 -0
- package/lib/sidebar/index.d.ts +2 -0
- package/lib/sidebar/index.js +173 -10
- package/lib/sidebar/index.scss +24 -1
- package/lib/sidebar/typing.d.ts +83 -13
- package/lib/sidebar/utils/action-ref.d.ts +3 -0
- package/lib/sidebar/utils/action-ref.js +22 -0
- package/lib/sidebar/utils/index.d.ts +71 -0
- package/lib/sidebar/utils/index.js +247 -0
- package/package.json +1 -1
@@ -26,6 +26,15 @@ object-assign
|
|
26
26
|
|
27
27
|
/*! js-cookie v3.0.1 | MIT */
|
28
28
|
|
29
|
+
/**
|
30
|
+
* @license
|
31
|
+
* Lodash <https://lodash.com/>
|
32
|
+
* Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
|
33
|
+
* Released under MIT license <https://lodash.com/license>
|
34
|
+
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
35
|
+
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
36
|
+
*/
|
37
|
+
|
29
38
|
/** @license React v16.13.1
|
30
39
|
* react-is.production.min.js
|
31
40
|
*
|
@@ -0,0 +1,11 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import './ActionResponse.less';
|
3
|
+
export var ActionResponse = function ActionResponse(props) {
|
4
|
+
return /*#__PURE__*/React.createElement("div", {
|
5
|
+
className: "as-wrapper"
|
6
|
+
}, /*#__PURE__*/React.createElement("div", {
|
7
|
+
className: "as-actions"
|
8
|
+
}, props.children), props.response && /*#__PURE__*/React.createElement("div", {
|
9
|
+
className: "as-response"
|
10
|
+
}, "Response\uFF1A", props.response));
|
11
|
+
};
|
@@ -0,0 +1,25 @@
|
|
1
|
+
.as-wrapper {
|
2
|
+
.as-actions {
|
3
|
+
& button {
|
4
|
+
margin-right: 5px;
|
5
|
+
background-color: #fff;
|
6
|
+
border: 2px solid #d4bbbb;
|
7
|
+
border-radius: 6px;
|
8
|
+
outline: none;
|
9
|
+
padding: 8px 20px;
|
10
|
+
cursor: pointer;
|
11
|
+
transition: all 0.15s ease-in-out;
|
12
|
+
&:hover {
|
13
|
+
border: 2px solid #9db8f3;
|
14
|
+
}
|
15
|
+
}
|
16
|
+
}
|
17
|
+
|
18
|
+
.as-response {
|
19
|
+
border: 2px dashed #f0bdbd;
|
20
|
+
font-size: 14px;
|
21
|
+
border-radius: 6px;
|
22
|
+
padding: 8px 20px;
|
23
|
+
margin-top: 10px;
|
24
|
+
}
|
25
|
+
}
|
package/es/form/index.d.ts
CHANGED
@@ -91,7 +91,7 @@ declare const formilyReact: {
|
|
91
91
|
}>>;
|
92
92
|
connect<T_2 extends originalFormilyReact.JSXComponent>(target: T_2, ...args: originalFormilyReact.IComponentMapper<T_2>[]): import("react").ForwardRefExoticComponent<import("react").PropsWithoutRef<Partial<import("react").ComponentProps<T_2>>> & import("react").RefAttributes<unknown>>;
|
93
93
|
observer: typeof originalFormilyReact.observer;
|
94
|
-
Observer: import("react").MemoExoticComponent<import("react").FunctionComponent<import("
|
94
|
+
Observer: import("react").MemoExoticComponent<import("react").FunctionComponent<import("@formily/reactive-react").IObserverProps>>;
|
95
95
|
useForm: <T_3 extends object = any>() => import("@formily/core").Form<T_3>;
|
96
96
|
useField: <T_4 = import("@formily/core").GeneralField>() => T_4;
|
97
97
|
useParentForm: () => import("@formily/core").Form<any> | import("@formily/core").ObjectField<any, any>;
|
package/es/index.d.ts
CHANGED
@@ -9,6 +9,7 @@ import ProPageHeader from './page-header';
|
|
9
9
|
import ProTable from './table';
|
10
10
|
import ProSkeleton from './skeleton';
|
11
11
|
import utils from './utils';
|
12
|
+
import ProSidebar from './sidebar';
|
12
13
|
import { ProTimeline } from './timeline';
|
13
14
|
import * as nocode from './nocode';
|
14
15
|
import * as templates from './templates';
|
@@ -22,7 +23,8 @@ export * from './page-container';
|
|
22
23
|
export * from './page-header';
|
23
24
|
export * from './skeleton';
|
24
25
|
export * from './table';
|
26
|
+
export * from './sidebar';
|
25
27
|
export * from './utils';
|
26
28
|
export * from './timeline';
|
27
|
-
declare const version = "1.3.
|
28
|
-
export { version, ProAction, ProCard, ProField, ProForm, ProInfo, ProPageContainer, ProPageHeader, ProSkeleton, ProTable, ProTimeline, hooks, nocode, templates, utils, };
|
29
|
+
declare const version = "1.3.5";
|
30
|
+
export { version, ProAction, ProCard, ProField, ProForm, ProInfo, ProPageContainer, ProPageHeader, ProSkeleton, ProTable, ProSidebar, ProTimeline, hooks, nocode, templates, utils, };
|
package/es/index.js
CHANGED
@@ -9,8 +9,8 @@ import ProPageContainer from './page-container';
|
|
9
9
|
import ProPageHeader from './page-header';
|
10
10
|
import ProTable from './table';
|
11
11
|
import ProSkeleton from './skeleton';
|
12
|
-
import utils from './utils';
|
13
|
-
|
12
|
+
import utils from './utils';
|
13
|
+
import ProSidebar from './sidebar';
|
14
14
|
import { ProTimeline } from './timeline';
|
15
15
|
import * as nocode from './nocode';
|
16
16
|
import * as templates from './templates';
|
@@ -27,10 +27,10 @@ export * from './page-container';
|
|
27
27
|
export * from './page-header';
|
28
28
|
export * from './skeleton';
|
29
29
|
export * from './table';
|
30
|
+
export * from './sidebar';
|
30
31
|
export * from './utils'; // export * from './sidebar';
|
31
32
|
|
32
33
|
export * from './timeline';
|
33
|
-
var version = '1.3.
|
34
|
+
var version = '1.3.5';
|
34
35
|
export { version, ProAction, ProCard, ProField, ProForm, ProInfo, // ProLayout,
|
35
|
-
ProPageContainer, ProPageHeader, ProSkeleton, ProTable,
|
36
|
-
ProTimeline, hooks, nocode, templates, utils };
|
36
|
+
ProPageContainer, ProPageHeader, ProSkeleton, ProTable, ProSidebar, ProTimeline, hooks, nocode, templates, utils };
|
@@ -14,13 +14,17 @@ var ProInfoItem = function ProInfoItem(prop) {
|
|
14
14
|
headerInfoLayout = prop.headerInfoLayout,
|
15
15
|
loading = prop.loading,
|
16
16
|
tooltip = prop.tooltip,
|
17
|
-
tooltipIcon = prop.tooltipIcon
|
17
|
+
tooltipIcon = prop.tooltipIcon,
|
18
|
+
_isLastRow = prop._isLastRow;
|
18
19
|
|
19
20
|
if (baseInfoLayout) {
|
20
21
|
var labelCol = baseInfoLayout.labelCol,
|
21
22
|
wrapperCol = baseInfoLayout.wrapperCol;
|
22
23
|
return /*#__PURE__*/React.createElement("div", {
|
23
|
-
className: cls(
|
24
|
+
className: cls({
|
25
|
+
'': true,
|
26
|
+
isLastRow: _isLastRow
|
27
|
+
})
|
24
28
|
}, /*#__PURE__*/React.createElement(Row, {
|
25
29
|
gutter: 10,
|
26
30
|
className: cls('base-row')
|
@@ -5,7 +5,7 @@ import './index.scss';
|
|
5
5
|
import { getLayout } from '../../utils/utils';
|
6
6
|
import defaultLayoutMap from '../../utils/layout';
|
7
7
|
import InfoValueItem from '../InfoValueItem';
|
8
|
-
import { getDataIndexValue } from '../../utils';
|
8
|
+
import { getDataIndexValue, isLastRow } from '../../utils';
|
9
9
|
var Row = Grid.Row,
|
10
10
|
Col = Grid.Col;
|
11
11
|
|
@@ -65,6 +65,7 @@ var ProBaseInfo = function ProBaseInfo(props) {
|
|
65
65
|
}, /*#__PURE__*/React.createElement(ProInfoItem, {
|
66
66
|
label: (_item$title = item === null || item === void 0 ? void 0 : item.title) !== null && _item$title !== void 0 ? _item$title : '',
|
67
67
|
loading: loading,
|
68
|
+
_isLastRow: !!isLastRow(columns.length, layoutSpan, index),
|
68
69
|
value: /*#__PURE__*/React.createElement(InfoValueItem, {
|
69
70
|
type: (_item$valueType = item === null || item === void 0 ? void 0 : item.valueType) !== null && _item$valueType !== void 0 ? _item$valueType : 'text',
|
70
71
|
value: getDataIndexValue(item.dataIndex, (_ref = dataSource !== null && dataSource !== void 0 ? dataSource : result) !== null && _ref !== void 0 ? _ref : {}),
|
package/es/info/typing.d.ts
CHANGED
@@ -113,6 +113,8 @@ export declare type IProProInfoItem = {
|
|
113
113
|
headerInfoLayout?: ProHeaderInfoLayoutProps;
|
114
114
|
/** loading 状态 */
|
115
115
|
loading?: boolean;
|
116
|
+
/** isLastRow 是否是最后一行的元素 */
|
117
|
+
_isLastRow?: boolean;
|
116
118
|
} & Pick<ProInfoColumnsProps, 'tooltip' | 'tooltipIcon'>;
|
117
119
|
/** header info 定义 */
|
118
120
|
export declare type IProHeaderInfo = {
|
package/es/info/utils/index.d.ts
CHANGED
@@ -10,3 +10,11 @@ export declare const ProInfoGroupContext: React.Context<ProInfoGroupContextProps
|
|
10
10
|
* @returns
|
11
11
|
*/
|
12
12
|
export declare function getDataIndexValue(dataIndex: ProInfoColumnsProps['dataIndex'], dataSource: object): any;
|
13
|
+
/**
|
14
|
+
* 是否是最后一样的元素
|
15
|
+
* @param columnsLength
|
16
|
+
* @param layoutSpan
|
17
|
+
* @params itemIndex
|
18
|
+
* @returns
|
19
|
+
*/
|
20
|
+
export declare const isLastRow: (columnsLength: number, layoutSpan: number, itemIndex: number) => boolean | undefined;
|
package/es/info/utils/index.js
CHANGED
@@ -30,4 +30,31 @@ export function getDataIndexValue(dataIndex, dataSource) {
|
|
30
30
|
}
|
31
31
|
|
32
32
|
return getDeepValue(dataIndex !== null && dataIndex !== void 0 ? dataIndex : '', dataSource);
|
33
|
-
}
|
33
|
+
}
|
34
|
+
/**
|
35
|
+
* 是否是最后一样的元素
|
36
|
+
* @param columnsLength
|
37
|
+
* @param layoutSpan
|
38
|
+
* @params itemIndex
|
39
|
+
* @returns
|
40
|
+
*/
|
41
|
+
|
42
|
+
export var isLastRow = function isLastRow(columnsLength, layoutSpan, itemIndex) {
|
43
|
+
if (!columnsLength || !layoutSpan) return;
|
44
|
+
var lastRowColumnsIndexList = [];
|
45
|
+
var rowCount = 24 / layoutSpan;
|
46
|
+
|
47
|
+
if (columnsLength % rowCount === 0) {
|
48
|
+
while (rowCount--) {
|
49
|
+
lastRowColumnsIndexList.push(columnsLength--);
|
50
|
+
}
|
51
|
+
} else {
|
52
|
+
var lastRowCount = columnsLength % rowCount;
|
53
|
+
|
54
|
+
while (lastRowCount--) {
|
55
|
+
lastRowColumnsIndexList.push(columnsLength--);
|
56
|
+
}
|
57
|
+
}
|
58
|
+
|
59
|
+
return lastRowColumnsIndexList.includes(itemIndex + 1);
|
60
|
+
};
|
@@ -1,4 +1,12 @@
|
|
1
|
-
var _excluded = ["children", "searchPlaceholder", "showSearch", "searchProps", "customSearch", "searchOnChange", "message", "messageProps", "customMessage"];
|
1
|
+
var _excluded = ["children", "searchPlaceholder", "showSearch", "searchProps", "customSearch", "searchOnChange", "message", "messageProps", "customMessage", "scrollArea", "showExpandAll", "showExpandLevel", "onExpandAllChange", "onExpandLevelChange", "expandLevel", "isTree"];
|
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); }
|
2
10
|
|
3
11
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
4
12
|
|
@@ -6,16 +14,29 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
6
14
|
|
7
15
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
8
16
|
|
17
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
18
|
+
|
19
|
+
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."); }
|
20
|
+
|
21
|
+
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); }
|
22
|
+
|
23
|
+
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; }
|
24
|
+
|
25
|
+
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; }
|
26
|
+
|
27
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
28
|
+
|
9
29
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
10
30
|
|
11
31
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
12
32
|
|
13
|
-
import { Message } from '@alicloudfe/components';
|
33
|
+
import { Button, MenuButton, Message } from '@alicloudfe/components';
|
14
34
|
import { ProCard } from '../../../card';
|
15
35
|
import ProField from '@teamix/pro-field';
|
16
36
|
import { baseClass } from '@teamix/utils';
|
17
|
-
import React from 'react';
|
37
|
+
import React, { useEffect, useRef, useState } from 'react';
|
18
38
|
import './index.scss';
|
39
|
+
import TeamixIcon from '@teamix/icon';
|
19
40
|
var cls = baseClass('teamix-pro-sidebar-container');
|
20
41
|
|
21
42
|
var ProSidebarContainer = function ProSidebarContainer(props) {
|
@@ -31,8 +52,47 @@ var ProSidebarContainer = function ProSidebarContainer(props) {
|
|
31
52
|
_props$messageProps = props.messageProps,
|
32
53
|
messageProps = _props$messageProps === void 0 ? {} : _props$messageProps,
|
33
54
|
customMessage = props.customMessage,
|
34
|
-
|
55
|
+
scrollArea = props.scrollArea,
|
56
|
+
showExpandAll = props.showExpandAll,
|
57
|
+
showExpandLevel = props.showExpandLevel,
|
58
|
+
onExpandAllChange = props.onExpandAllChange,
|
59
|
+
onExpandLevelChange = props.onExpandLevelChange,
|
60
|
+
_props$expandLevel = props.expandLevel,
|
61
|
+
expandLevel = _props$expandLevel === void 0 ? 1 : _props$expandLevel,
|
62
|
+
isTree = props.isTree,
|
63
|
+
others = _objectWithoutProperties(props, _excluded);
|
64
|
+
|
65
|
+
var ref = useRef();
|
66
|
+
|
67
|
+
var _useState = useState('auto'),
|
68
|
+
_useState2 = _slicedToArray(_useState, 2),
|
69
|
+
treeHeight = _useState2[0],
|
70
|
+
setTreeHeight = _useState2[1]; // 展开全部状态
|
71
|
+
|
35
72
|
|
73
|
+
var _useState3 = useState(false),
|
74
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
75
|
+
expandAllState = _useState4[0],
|
76
|
+
setExpandAllState = _useState4[1]; // 展开层级状态
|
77
|
+
|
78
|
+
|
79
|
+
var _useState5 = useState(1),
|
80
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
81
|
+
expandLevelState = _useState6[0],
|
82
|
+
setExpandLevelState = _useState6[1];
|
83
|
+
|
84
|
+
useEffect(function () {
|
85
|
+
// 设置滚动区域
|
86
|
+
if (scrollArea === 'tree') {
|
87
|
+
var _ref$current$offsetTo, _ref$current;
|
88
|
+
|
89
|
+
var remainHeight = (_ref$current$offsetTo = ref === null || ref === void 0 ? void 0 : (_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.offsetTop) !== null && _ref$current$offsetTo !== void 0 ? _ref$current$offsetTo : 0 + 40;
|
90
|
+
|
91
|
+
if (remainHeight > 0) {
|
92
|
+
setTreeHeight("calc(100% - ".concat(remainHeight, "px + 16px)"));
|
93
|
+
}
|
94
|
+
}
|
95
|
+
}, []); // 渲染搜索区域
|
36
96
|
|
37
97
|
var renderSearch = function renderSearch() {
|
38
98
|
if (customSearch || showSearch) {
|
@@ -55,22 +115,67 @@ var ProSidebarContainer = function ProSidebarContainer(props) {
|
|
55
115
|
if (message || customMessage) {
|
56
116
|
return /*#__PURE__*/React.createElement("div", {
|
57
117
|
className: cls('notice')
|
58
|
-
}, message && /*#__PURE__*/React.createElement(Message, _objectSpread({
|
118
|
+
}, message && /*#__PURE__*/React.createElement(Message, _objectSpread(_objectSpread({
|
59
119
|
type: "notice",
|
60
120
|
closeable: true
|
61
|
-
}, messageProps),
|
121
|
+
}, messageProps), {}, {
|
122
|
+
onClose: function onClose() {
|
123
|
+
var _ref$current$offsetTo2, _ref$current2;
|
124
|
+
|
125
|
+
var remainHeight = (_ref$current$offsetTo2 = ref === null || ref === void 0 ? void 0 : (_ref$current2 = ref.current) === null || _ref$current2 === void 0 ? void 0 : _ref$current2.offsetTop) !== null && _ref$current$offsetTo2 !== void 0 ? _ref$current$offsetTo2 : 0 + 40;
|
126
|
+
setTreeHeight("calc(100% - ".concat(remainHeight, "px + 56px)"));
|
127
|
+
}
|
128
|
+
}), message), !!customMessage && customMessage);
|
62
129
|
}
|
63
130
|
|
64
131
|
return null;
|
132
|
+
}; // 渲染折叠区
|
133
|
+
|
134
|
+
|
135
|
+
var renderFold = function renderFold() {
|
136
|
+
if (showExpandAll || showExpandLevel) {
|
137
|
+
return /*#__PURE__*/React.createElement("div", {
|
138
|
+
className: cls('fold')
|
139
|
+
}, showExpandAll && /*#__PURE__*/React.createElement(Button, {
|
140
|
+
type: "primary",
|
141
|
+
text: true,
|
142
|
+
onClick: function onClick() {
|
143
|
+
var visible = !expandAllState;
|
144
|
+
setExpandAllState(visible);
|
145
|
+
onExpandAllChange === null || onExpandAllChange === void 0 ? void 0 : onExpandAllChange(visible);
|
146
|
+
}
|
147
|
+
}, /*#__PURE__*/React.createElement(TeamixIcon, {
|
148
|
+
type: expandAllState ? 'menu-unfold-line' : 'menu-fold-line'
|
149
|
+
}), expandAllState ? '全部收起' : '全部展开'), showExpandLevel && /*#__PURE__*/React.createElement(MenuButton, {
|
150
|
+
text: true,
|
151
|
+
type: "secondary",
|
152
|
+
label: "\u5C55\u793A".concat(expandLevelState, "\u7EA7"),
|
153
|
+
onItemClick: function onItemClick(key) {
|
154
|
+
setExpandLevelState(key);
|
155
|
+
onExpandLevelChange === null || onExpandLevelChange === void 0 ? void 0 : onExpandLevelChange(key);
|
156
|
+
}
|
157
|
+
}, _toConsumableArray(new Array(expandLevel)).fill(1).map(function (item, index) {
|
158
|
+
return /*#__PURE__*/React.createElement(MenuButton.Item, {
|
159
|
+
key: index + 1
|
160
|
+
}, "\u5C55\u793A", index + 1, "\u7EA7");
|
161
|
+
})));
|
162
|
+
}
|
65
163
|
};
|
66
164
|
|
67
165
|
return /*#__PURE__*/React.createElement("div", {
|
68
|
-
className: cls(
|
166
|
+
className: cls({
|
167
|
+
'': true,
|
168
|
+
'not-is-tree': !isTree
|
169
|
+
})
|
69
170
|
}, /*#__PURE__*/React.createElement(ProCard, _objectSpread({
|
70
171
|
bordered: false,
|
71
172
|
compacted: true
|
72
|
-
}, others), renderSearch(), renderNotice(), /*#__PURE__*/React.createElement("div", {
|
73
|
-
className: cls('context')
|
173
|
+
}, others), renderSearch(), renderNotice(), renderFold(), /*#__PURE__*/React.createElement("div", {
|
174
|
+
className: cls('context'),
|
175
|
+
ref: ref,
|
176
|
+
style: {
|
177
|
+
height: treeHeight
|
178
|
+
}
|
74
179
|
}, children)));
|
75
180
|
};
|
76
181
|
|
@@ -1,18 +1,66 @@
|
|
1
1
|
.teamix-pro-sidebar-container {
|
2
2
|
min-width: 180px;
|
3
|
+
.teamix-pro-card.compacted >.next-card-header{
|
4
|
+
padding: 16px 0px;
|
5
|
+
margin: 0;
|
6
|
+
|
7
|
+
}
|
8
|
+
|
9
|
+
.next-card .next-card-header-extra{
|
10
|
+
margin-top: 2px;
|
11
|
+
}
|
3
12
|
|
4
13
|
&-search {
|
5
|
-
margin-bottom:
|
14
|
+
margin-bottom: var(--s-2);
|
6
15
|
}
|
7
16
|
|
8
17
|
&-search-has-message {
|
9
|
-
margin-bottom:
|
18
|
+
margin-bottom: var(--s-1);
|
10
19
|
}
|
11
20
|
|
12
21
|
&-notice {
|
13
|
-
margin-bottom:
|
22
|
+
margin-bottom: var(--s-1);
|
23
|
+
}
|
24
|
+
|
25
|
+
&-fold {
|
26
|
+
margin-bottom: var(--s-1);
|
27
|
+
}
|
28
|
+
|
29
|
+
|
30
|
+
&.teamix-pro-sidebar-container &-context{
|
31
|
+
overflow-y: hidden;
|
32
|
+
|
33
|
+
&:hover{
|
34
|
+
overflow-y: auto;
|
35
|
+
}
|
14
36
|
}
|
15
37
|
|
16
|
-
|
38
|
+
|
39
|
+
&-not-is-tree{
|
40
|
+
|
41
|
+
.teamix-pro-card.compacted >.next-card-header{
|
42
|
+
padding: 16px 8px;
|
43
|
+
margin: 0;
|
44
|
+
}
|
45
|
+
.teamix-pro-sidebar-container-context{
|
46
|
+
padding: 0;
|
47
|
+
}
|
48
|
+
|
49
|
+
.teamix-pro-sidebar-container-search{
|
50
|
+
padding: 0 8px;
|
51
|
+
}
|
52
|
+
|
53
|
+
.teamix-pro-sidebar-container-search-has-message{
|
54
|
+
padding: 0 8px;
|
55
|
+
}
|
56
|
+
|
57
|
+
.teamix-pro-sidebar-container-notice{
|
58
|
+
padding: 0 8px;
|
59
|
+
}
|
60
|
+
|
61
|
+
.teamix-pro-sidebar-container-fold{
|
62
|
+
padding: 0 8px;
|
63
|
+
}
|
64
|
+
|
17
65
|
}
|
18
|
-
}
|
66
|
+
}
|