@dtjoy/dt-design 1.0.6 → 1.0.8
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/esm/_util/easings.d.ts +1 -0
- package/esm/_util/easings.js +9 -0
- package/esm/_util/extendsObject.d.ts +4 -0
- package/esm/_util/extendsObject.js +17 -0
- package/esm/_util/gapSize.d.ts +3 -3
- package/esm/_util/getScroll.d.ts +3 -0
- package/esm/_util/getScroll.js +32 -0
- package/esm/_util/hooks/index.d.ts +4 -1
- package/esm/_util/hooks/index.js +4 -1
- package/esm/_util/hooks/useForceUpdate.d.ts +2 -0
- package/esm/_util/hooks/useForceUpdate.js +6 -0
- package/esm/_util/hooks/useOrientation.d.ts +2 -2
- package/esm/_util/hooks/useProxyImperativeHandle.d.ts +4 -0
- package/esm/_util/hooks/useProxyImperativeHandle.js +31 -0
- package/esm/_util/hooks/useSyncState.d.ts +3 -0
- package/esm/_util/hooks/useSyncState.js +20 -0
- package/esm/_util/index.d.ts +3 -3
- package/esm/_util/isNonNullable.d.ts +2 -2
- package/esm/_util/scrollTo.d.ts +10 -0
- package/esm/_util/scrollTo.js +38 -0
- package/esm/_util/type.d.ts +52 -52
- package/esm/_util/warning.d.ts +31 -31
- package/esm/_util/warning.js +5 -5
- package/esm/blockHeader/index.d.ts +50 -48
- package/esm/blockHeader/index.js +13 -15
- package/esm/blockHeader/style/index.d.ts +2 -2
- package/esm/blockHeader/style/index.less +143 -143
- package/esm/button/index.d.ts +10 -10
- package/esm/button/index.js +2 -2
- package/esm/button/style/index.d.ts +2 -2
- package/esm/collapsible/index.d.ts +102 -97
- package/esm/collapsible/index.js +53 -55
- package/esm/collapsible/style/index.d.ts +1 -1
- package/esm/collapsibleActionItems/index.d.ts +24 -24
- package/esm/collapsibleActionItems/index.js +2 -2
- package/esm/collapsibleActionItems/style/index.d.ts +2 -2
- package/esm/flex/index.d.ts +7 -7
- package/esm/flex/index.js +1 -1
- package/esm/flex/interface.d.ts +16 -16
- package/esm/flex/style/index.d.ts +2 -2
- package/esm/flex/style/index.less +76 -76
- package/esm/flex/utils.d.ts +7 -7
- package/esm/flex/utils.js +1 -1
- package/esm/formList/index.d.ts +78 -77
- package/esm/formList/index.js +13 -11
- package/esm/formList/style/index.d.ts +2 -2
- package/esm/formList/style/index.less +45 -45
- package/esm/index.d.ts +17 -14
- package/esm/index.js +3 -1
- package/esm/overflowList/index.d.ts +40 -39
- package/esm/overflowList/index.js +4 -3
- package/esm/overflowList/style/index.d.ts +2 -2
- package/esm/resize/index.d.ts +9 -8
- package/esm/resize/index.js +1 -1
- package/esm/resizeObserver/index.d.ts +45 -45
- package/esm/resizeObserver/index.js +3 -2
- package/esm/splitter/Panel.d.ts +7 -7
- package/esm/splitter/Panel.js +3 -3
- package/esm/splitter/SplitBar.d.ts +24 -24
- package/esm/splitter/SplitBar.js +8 -7
- package/esm/splitter/Splitter.d.ts +5 -5
- package/esm/splitter/Splitter.js +5 -4
- package/esm/splitter/hooks/sizeUtil.d.ts +3 -3
- package/esm/splitter/hooks/useItems.d.ts +14 -14
- package/esm/splitter/hooks/useItems.js +2 -2
- package/esm/splitter/hooks/useResizable.d.ts +10 -10
- package/esm/splitter/hooks/useResize.d.ts +6 -6
- package/esm/splitter/hooks/useResize.js +5 -5
- package/esm/splitter/hooks/useSizes.d.ts +4 -4
- package/esm/splitter/index.d.ts +8 -8
- package/esm/splitter/interface.d.ts +69 -69
- package/esm/splitter/style/index.d.ts +2 -2
- package/esm/statusTag/index.d.ts +29 -28
- package/esm/statusTag/index.js +8 -8
- package/esm/statusTag/style/index.d.ts +2 -2
- package/esm/style/index.d.ts +1 -1
- package/esm/style/index.less +1 -1
- package/esm/style/themes/index.less +2 -2
- package/esm/style/themes/variable.less +4 -0
- package/esm/table/InternalTable.d.ts +32 -0
- package/esm/table/InternalTable.js +429 -0
- package/esm/table/RcTable/VirtualTable.d.ts +2 -0
- package/esm/table/RcTable/VirtualTable.js +9 -0
- package/esm/table/RcTable/index.d.ts +2 -0
- package/esm/table/RcTable/index.js +9 -0
- package/esm/table/Table.d.ts +17 -0
- package/esm/table/Table.js +28 -0
- package/esm/table/TableMeasureRowContext.d.ts +3 -0
- package/esm/table/TableMeasureRowContext.js +3 -0
- package/esm/table/hooks/useContainerWidth.d.ts +1 -0
- package/esm/table/hooks/useContainerWidth.js +14 -0
- package/esm/table/index.d.ts +7 -0
- package/esm/table/index.js +2 -0
- package/esm/table/interface.d.ts +196 -0
- package/esm/table/interface.js +4 -0
- package/esm/table/style/bordered.less +141 -0
- package/esm/table/style/fixed.less +88 -0
- package/esm/table/style/index.d.ts +2 -0
- package/esm/table/style/index.js +2 -0
- package/esm/table/style/index.less +150 -0
- package/esm/table/style/selection.less +90 -0
- package/esm/table/style/sticky.less +55 -0
- package/esm/table/style/virtual.less +65 -0
- package/esm/table/util.d.ts +14 -0
- package/esm/table/util.js +33 -0
- package/lib/_util/easings.d.ts +1 -0
- package/lib/_util/easings.js +15 -0
- package/lib/_util/extendsObject.d.ts +4 -0
- package/lib/_util/extendsObject.js +20 -0
- package/lib/_util/gapSize.d.ts +3 -3
- package/lib/_util/getScroll.d.ts +3 -0
- package/lib/_util/getScroll.js +39 -0
- package/lib/_util/hooks/index.d.ts +4 -1
- package/lib/_util/hooks/index.js +33 -0
- package/lib/_util/hooks/useForceUpdate.d.ts +2 -0
- package/lib/_util/hooks/useForceUpdate.js +12 -0
- package/lib/_util/hooks/useOrientation.d.ts +2 -2
- package/lib/_util/hooks/useProxyImperativeHandle.d.ts +4 -0
- package/lib/_util/hooks/useProxyImperativeHandle.js +40 -0
- package/lib/_util/hooks/useSyncState.d.ts +3 -0
- package/lib/_util/hooks/useSyncState.js +19 -0
- package/lib/_util/index.d.ts +3 -3
- package/lib/_util/isNonNullable.d.ts +2 -2
- package/lib/_util/scrollTo.d.ts +10 -0
- package/lib/_util/scrollTo.js +44 -0
- package/lib/_util/type.d.ts +52 -52
- package/lib/_util/warning.d.ts +31 -31
- package/lib/_util/warning.js +7 -8
- package/lib/blockHeader/index.d.ts +50 -48
- package/lib/blockHeader/index.js +13 -12
- package/lib/blockHeader/style/index.d.ts +2 -2
- package/lib/blockHeader/style/index.less +143 -143
- package/lib/button/index.d.ts +10 -10
- package/lib/button/index.js +2 -2
- package/lib/button/style/index.d.ts +2 -2
- package/lib/collapsible/index.d.ts +102 -97
- package/lib/collapsible/index.js +49 -49
- package/lib/collapsible/style/index.d.ts +1 -1
- package/lib/collapsibleActionItems/index.d.ts +24 -24
- package/lib/collapsibleActionItems/index.js +2 -2
- package/lib/collapsibleActionItems/style/index.d.ts +2 -2
- package/lib/flex/index.d.ts +7 -7
- package/lib/flex/index.js +2 -2
- package/lib/flex/interface.d.ts +16 -16
- package/lib/flex/style/index.d.ts +2 -2
- package/lib/flex/style/index.less +76 -76
- package/lib/flex/utils.d.ts +7 -7
- package/lib/flex/utils.js +2 -2
- package/lib/formList/index.d.ts +78 -77
- package/lib/formList/index.js +10 -10
- package/lib/formList/style/index.d.ts +2 -2
- package/lib/formList/style/index.less +45 -45
- package/lib/index.d.ts +17 -14
- package/lib/index.js +21 -2
- package/lib/overflowList/index.d.ts +40 -39
- package/lib/overflowList/index.js +4 -3
- package/lib/overflowList/style/index.d.ts +2 -2
- package/lib/resize/index.d.ts +9 -8
- package/lib/resize/index.js +1 -1
- package/lib/resizeObserver/index.d.ts +45 -45
- package/lib/resizeObserver/index.js +3 -2
- package/lib/splitter/Panel.d.ts +7 -7
- package/lib/splitter/Panel.js +3 -3
- package/lib/splitter/SplitBar.d.ts +24 -24
- package/lib/splitter/SplitBar.js +8 -7
- package/lib/splitter/Splitter.d.ts +5 -5
- package/lib/splitter/Splitter.js +5 -4
- package/lib/splitter/hooks/sizeUtil.d.ts +3 -3
- package/lib/splitter/hooks/useItems.d.ts +14 -14
- package/lib/splitter/hooks/useItems.js +2 -2
- package/lib/splitter/hooks/useResizable.d.ts +10 -10
- package/lib/splitter/hooks/useResize.d.ts +6 -6
- package/lib/splitter/hooks/useResize.js +5 -5
- package/lib/splitter/hooks/useSizes.d.ts +4 -4
- package/lib/splitter/index.d.ts +8 -8
- package/lib/splitter/interface.d.ts +69 -69
- package/lib/splitter/style/index.d.ts +2 -2
- package/lib/statusTag/index.d.ts +29 -28
- package/lib/statusTag/index.js +8 -8
- package/lib/statusTag/style/index.d.ts +2 -2
- package/lib/style/index.d.ts +1 -1
- package/lib/style/index.less +1 -1
- package/lib/style/themes/index.less +2 -2
- package/lib/style/themes/variable.less +4 -0
- package/lib/table/InternalTable.d.ts +32 -0
- package/lib/table/InternalTable.js +395 -0
- package/lib/table/RcTable/VirtualTable.d.ts +2 -0
- package/lib/table/RcTable/VirtualTable.js +17 -0
- package/lib/table/RcTable/index.d.ts +2 -0
- package/lib/table/RcTable/index.js +17 -0
- package/lib/table/Table.d.ts +17 -0
- package/lib/table/Table.js +37 -0
- package/lib/table/TableMeasureRowContext.d.ts +3 -0
- package/lib/{_util/zindexContext.js → table/TableMeasureRowContext.js} +2 -5
- package/lib/table/hooks/useContainerWidth.d.ts +1 -0
- package/lib/table/hooks/useContainerWidth.js +20 -0
- package/lib/table/index.d.ts +7 -0
- package/lib/table/index.js +9 -0
- package/lib/table/interface.d.ts +196 -0
- package/lib/table/interface.js +8 -0
- package/lib/table/style/bordered.less +141 -0
- package/lib/table/style/fixed.less +88 -0
- package/lib/table/style/index.d.ts +2 -0
- package/lib/table/style/index.js +4 -0
- package/lib/table/style/index.less +150 -0
- package/lib/table/style/selection.less +90 -0
- package/lib/table/style/sticky.less +55 -0
- package/lib/table/style/virtual.less +65 -0
- package/lib/table/util.d.ts +14 -0
- package/lib/table/util.js +44 -0
- package/package.json +82 -66
- package/esm/_util/convertToTooltipProps.d.ts +0 -4
- package/esm/_util/convertToTooltipProps.js +0 -15
- package/esm/_util/hooks/useZIndex.d.ts +0 -8
- package/esm/_util/hooks/useZIndex.js +0 -51
- package/esm/_util/zindexContext.d.ts +0 -3
- package/esm/_util/zindexContext.js +0 -6
- package/lib/_util/convertToTooltipProps.d.ts +0 -4
- package/lib/_util/convertToTooltipProps.js +0 -21
- package/lib/_util/hooks/useZIndex.d.ts +0 -8
- package/lib/_util/hooks/useZIndex.js +0 -59
- package/lib/_util/zindexContext.d.ts +0 -3
|
@@ -1,97 +1,102 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import './style';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
static displayName: string;
|
|
83
|
-
|
|
84
|
-
private
|
|
85
|
-
private
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
static getDerivedStateFromProps(props: CollapsibleProps, prevState: CollapsibleState): Partial<CollapsibleState>;
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
}
|
|
97
|
-
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import './style';
|
|
3
|
+
import type { ConfigConsumerProps } from 'antd/lib/config-provider';
|
|
4
|
+
interface BaseComponentProps {
|
|
5
|
+
/**
|
|
6
|
+
* 类名
|
|
7
|
+
*/
|
|
8
|
+
className?: string;
|
|
9
|
+
/**
|
|
10
|
+
* 样式
|
|
11
|
+
*/
|
|
12
|
+
style?: React.CSSProperties;
|
|
13
|
+
/**
|
|
14
|
+
* id
|
|
15
|
+
*/
|
|
16
|
+
id?: string;
|
|
17
|
+
'data-*'?: string;
|
|
18
|
+
}
|
|
19
|
+
export interface CollapsibleProps extends BaseComponentProps {
|
|
20
|
+
/**
|
|
21
|
+
* 是否开启动画
|
|
22
|
+
*/
|
|
23
|
+
motion?: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* 子元素
|
|
26
|
+
*/
|
|
27
|
+
children?: React.ReactNode;
|
|
28
|
+
/**
|
|
29
|
+
* 是否展开内容区域
|
|
30
|
+
*/
|
|
31
|
+
isOpen?: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* 动画执行的时间
|
|
34
|
+
*/
|
|
35
|
+
duration?: number;
|
|
36
|
+
/**
|
|
37
|
+
* 是否保留隐藏的面板 DOM 树,默认销毁
|
|
38
|
+
*/
|
|
39
|
+
keepDOM?: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* 配合 keepDOM 使用,为 true 时挂载时不会渲染组件
|
|
42
|
+
*/
|
|
43
|
+
lazyRender?: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* 折叠高度
|
|
46
|
+
*/
|
|
47
|
+
collapseHeight?: number;
|
|
48
|
+
/**
|
|
49
|
+
* 当 reCalcKey 改变时,将重新计算子节点的高度,用于优化动态渲染时的计算
|
|
50
|
+
*/
|
|
51
|
+
reCalcKey?: number | string;
|
|
52
|
+
/**
|
|
53
|
+
* 动画结束的回调
|
|
54
|
+
*/
|
|
55
|
+
onMotionEnd?: () => void;
|
|
56
|
+
/**
|
|
57
|
+
* 是否开启淡入淡出
|
|
58
|
+
*/
|
|
59
|
+
fade?: boolean;
|
|
60
|
+
/**
|
|
61
|
+
* 样式前缀
|
|
62
|
+
*/
|
|
63
|
+
prefixCls?: string;
|
|
64
|
+
}
|
|
65
|
+
interface CollapsibleState {
|
|
66
|
+
domInRenderTree: boolean;
|
|
67
|
+
domHeight: number;
|
|
68
|
+
visible: boolean;
|
|
69
|
+
isTransitioning: boolean;
|
|
70
|
+
cacheIsOpen: boolean;
|
|
71
|
+
}
|
|
72
|
+
declare class Collapsible extends React.Component<CollapsibleProps, CollapsibleState> {
|
|
73
|
+
static defaultProps: {
|
|
74
|
+
isOpen: boolean;
|
|
75
|
+
duration: number;
|
|
76
|
+
motion: boolean;
|
|
77
|
+
keepDOM: boolean;
|
|
78
|
+
lazyRender: boolean;
|
|
79
|
+
collapseHeight: number;
|
|
80
|
+
fade: boolean;
|
|
81
|
+
};
|
|
82
|
+
static displayName: string;
|
|
83
|
+
foundation: any;
|
|
84
|
+
private domRef;
|
|
85
|
+
private resizeObserver;
|
|
86
|
+
private hasBeenRendered;
|
|
87
|
+
constructor(props: CollapsibleProps);
|
|
88
|
+
static getEntryInfo: (entry: ResizeObserverEntry) => {
|
|
89
|
+
isShown: boolean;
|
|
90
|
+
height: number;
|
|
91
|
+
};
|
|
92
|
+
static getDerivedStateFromProps(props: CollapsibleProps, prevState: CollapsibleState): Partial<CollapsibleState>;
|
|
93
|
+
componentDidMount(): void;
|
|
94
|
+
componentDidUpdate(prevProps: Readonly<CollapsibleProps>, prevState: Readonly<CollapsibleState>): void;
|
|
95
|
+
componentWillUnmount(): void;
|
|
96
|
+
renderCollapsible: ({ getPrefixCls }: ConfigConsumerProps) => React.JSX.Element;
|
|
97
|
+
render(): React.JSX.Element;
|
|
98
|
+
private handleResize;
|
|
99
|
+
private isChildrenInRenderTree;
|
|
100
|
+
private getDataAttr;
|
|
101
|
+
}
|
|
102
|
+
export default Collapsible;
|
package/lib/collapsible/index.js
CHANGED
|
@@ -5,10 +5,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _react = _interopRequireDefault(require("react"));
|
|
8
|
-
var _configProvider = require("antd/es/config-provider");
|
|
9
|
-
var _classnames = _interopRequireDefault(require("classnames"));
|
|
10
8
|
var _lodashEs = require("lodash-es");
|
|
11
9
|
require("./style");
|
|
10
|
+
var _context = require("antd/lib/config-provider/context");
|
|
11
|
+
var _clsx = _interopRequireDefault(require("clsx"));
|
|
12
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
13
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
14
14
|
class Collapsible extends _react.default.Component {
|
|
@@ -21,18 +21,11 @@ class Collapsible extends _react.default.Component {
|
|
|
21
21
|
collapseHeight: 0,
|
|
22
22
|
fade: false
|
|
23
23
|
};
|
|
24
|
-
|
|
24
|
+
static displayName;
|
|
25
25
|
foundation;
|
|
26
26
|
domRef = /*#__PURE__*/_react.default.createRef();
|
|
27
27
|
resizeObserver = null;
|
|
28
28
|
hasBeenRendered = false;
|
|
29
|
-
static displayName;
|
|
30
|
-
// public cssClasses = {
|
|
31
|
-
// PREFIX: 'ant-collapsible',
|
|
32
|
-
// TRANSITION: 'ant-collapsible-transition',
|
|
33
|
-
// WRAPPER: 'ant-collapsible-wrapper',
|
|
34
|
-
// };
|
|
35
|
-
|
|
36
29
|
constructor(props) {
|
|
37
30
|
super(props);
|
|
38
31
|
this.state = {
|
|
@@ -42,7 +35,6 @@ class Collapsible extends _react.default.Component {
|
|
|
42
35
|
isTransitioning: false,
|
|
43
36
|
cacheIsOpen: this.props.isOpen || false
|
|
44
37
|
};
|
|
45
|
-
this.prefixCls = `${(0, _configProvider.globalConfig)().getPrefixCls(this.prefixCls)}`;
|
|
46
38
|
this.foundation = {
|
|
47
39
|
updateDOMInRenderTree: val => this.setState({
|
|
48
40
|
domInRenderTree: val
|
|
@@ -58,20 +50,6 @@ class Collapsible extends _react.default.Component {
|
|
|
58
50
|
})
|
|
59
51
|
};
|
|
60
52
|
}
|
|
61
|
-
handleResize = entryList => {
|
|
62
|
-
const entry = entryList[0];
|
|
63
|
-
if (entry) {
|
|
64
|
-
const entryInfo = Collapsible.getEntryInfo(entry);
|
|
65
|
-
this.foundation.updateDOMHeight(entryInfo.height);
|
|
66
|
-
this.foundation.updateDOMInRenderTree(entryInfo.isShown);
|
|
67
|
-
}
|
|
68
|
-
};
|
|
69
|
-
isChildrenInRenderTree = () => {
|
|
70
|
-
if (this.domRef.current) {
|
|
71
|
-
return this.domRef.current.offsetHeight > 0;
|
|
72
|
-
}
|
|
73
|
-
return false;
|
|
74
|
-
};
|
|
75
53
|
static getEntryInfo = entry => {
|
|
76
54
|
let inRenderTree;
|
|
77
55
|
if (entry.borderBoxSize) {
|
|
@@ -91,26 +69,6 @@ class Collapsible extends _react.default.Component {
|
|
|
91
69
|
height
|
|
92
70
|
};
|
|
93
71
|
};
|
|
94
|
-
getDataAttr = props => {
|
|
95
|
-
const dataAttrs = {};
|
|
96
|
-
Object.keys(props).forEach(key => {
|
|
97
|
-
if (key.startsWith('data-')) {
|
|
98
|
-
dataAttrs[key] = String(props[key]);
|
|
99
|
-
}
|
|
100
|
-
});
|
|
101
|
-
return dataAttrs;
|
|
102
|
-
};
|
|
103
|
-
componentDidMount() {
|
|
104
|
-
this.resizeObserver = new ResizeObserver(this.handleResize);
|
|
105
|
-
if (this.domRef.current) {
|
|
106
|
-
this.resizeObserver.observe(this.domRef.current);
|
|
107
|
-
}
|
|
108
|
-
const domInRenderTree = this.isChildrenInRenderTree();
|
|
109
|
-
this.foundation.updateDOMInRenderTree(domInRenderTree);
|
|
110
|
-
if (domInRenderTree && this.domRef.current) {
|
|
111
|
-
this.foundation.updateDOMHeight(this.domRef.current.scrollHeight);
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
72
|
static getDerivedStateFromProps(props, prevState) {
|
|
115
73
|
const newState = {};
|
|
116
74
|
const isOpenChanged = props.isOpen !== prevState.cacheIsOpen;
|
|
@@ -125,6 +83,18 @@ class Collapsible extends _react.default.Component {
|
|
|
125
83
|
newState.cacheIsOpen = props.isOpen;
|
|
126
84
|
return newState;
|
|
127
85
|
}
|
|
86
|
+
componentDidMount() {
|
|
87
|
+
// eslint-disable-next-line compat/compat
|
|
88
|
+
this.resizeObserver = new ResizeObserver(this.handleResize);
|
|
89
|
+
if (this.domRef.current) {
|
|
90
|
+
this.resizeObserver.observe(this.domRef.current);
|
|
91
|
+
}
|
|
92
|
+
const domInRenderTree = this.isChildrenInRenderTree();
|
|
93
|
+
this.foundation.updateDOMInRenderTree(domInRenderTree);
|
|
94
|
+
if (domInRenderTree && this.domRef.current) {
|
|
95
|
+
this.foundation.updateDOMHeight(this.domRef.current.scrollHeight);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
128
98
|
componentDidUpdate(prevProps, prevState) {
|
|
129
99
|
const changedPropKeys = Object.keys((0, _lodashEs.pick)(this.props, ['reCalcKey'])).filter(key => !(0, _lodashEs.isEqual)(this.props[key], prevProps[key]));
|
|
130
100
|
const changedStateKeys = Object.keys((0, _lodashEs.pick)(this.state, ['domInRenderTree'])).filter(key => !(0, _lodashEs.isEqual)(this.state[key], prevState[key]));
|
|
@@ -141,7 +111,9 @@ class Collapsible extends _react.default.Component {
|
|
|
141
111
|
this.resizeObserver = null;
|
|
142
112
|
}
|
|
143
113
|
}
|
|
144
|
-
|
|
114
|
+
renderCollapsible = ({
|
|
115
|
+
getPrefixCls
|
|
116
|
+
}) => {
|
|
145
117
|
const {
|
|
146
118
|
isOpen,
|
|
147
119
|
collapseHeight,
|
|
@@ -153,13 +125,15 @@ class Collapsible extends _react.default.Component {
|
|
|
153
125
|
id,
|
|
154
126
|
keepDOM,
|
|
155
127
|
lazyRender,
|
|
156
|
-
onMotionEnd
|
|
128
|
+
onMotionEnd,
|
|
129
|
+
prefixCls: customizePrefixCls
|
|
157
130
|
} = this.props;
|
|
158
131
|
const {
|
|
159
132
|
domHeight,
|
|
160
133
|
isTransitioning,
|
|
161
134
|
visible
|
|
162
135
|
} = this.state;
|
|
136
|
+
const prefixCls = getPrefixCls('splitter', customizePrefixCls);
|
|
163
137
|
const wrapperStyle = {
|
|
164
138
|
overflow: 'hidden',
|
|
165
139
|
height: isOpen ? domHeight : collapseHeight,
|
|
@@ -167,8 +141,8 @@ class Collapsible extends _react.default.Component {
|
|
|
167
141
|
transitionDuration: `${motion && isTransitioning ? duration : 0}ms`,
|
|
168
142
|
...style
|
|
169
143
|
};
|
|
170
|
-
const wrapperCls = (0,
|
|
171
|
-
[`${
|
|
144
|
+
const wrapperCls = (0, _clsx.default)(`${prefixCls}-wrapper`, {
|
|
145
|
+
[`${prefixCls}-transition`]: motion && isTransitioning
|
|
172
146
|
}, className);
|
|
173
147
|
const shouldRender = keepDOM && (lazyRender ? this.hasBeenRendered : true) || collapseHeight !== 0 || visible || isOpen;
|
|
174
148
|
if (shouldRender && !this.hasBeenRendered) {
|
|
@@ -191,7 +165,33 @@ class Collapsible extends _react.default.Component {
|
|
|
191
165
|
},
|
|
192
166
|
id: id
|
|
193
167
|
}, shouldRender && this.props.children));
|
|
168
|
+
};
|
|
169
|
+
render() {
|
|
170
|
+
return /*#__PURE__*/_react.default.createElement(_context.ConfigConsumer, null, this.renderCollapsible);
|
|
194
171
|
}
|
|
172
|
+
handleResize = entryList => {
|
|
173
|
+
const entry = entryList[0];
|
|
174
|
+
if (entry) {
|
|
175
|
+
const entryInfo = Collapsible.getEntryInfo(entry);
|
|
176
|
+
this.foundation.updateDOMHeight(entryInfo.height);
|
|
177
|
+
this.foundation.updateDOMInRenderTree(entryInfo.isShown);
|
|
178
|
+
}
|
|
179
|
+
};
|
|
180
|
+
isChildrenInRenderTree = () => {
|
|
181
|
+
if (this.domRef.current) {
|
|
182
|
+
return this.domRef.current.offsetHeight > 0;
|
|
183
|
+
}
|
|
184
|
+
return false;
|
|
185
|
+
};
|
|
186
|
+
getDataAttr = props => {
|
|
187
|
+
const dataAttrs = {};
|
|
188
|
+
Object.keys(props).forEach(key => {
|
|
189
|
+
if (key.startsWith('data-')) {
|
|
190
|
+
dataAttrs[key] = String(props[key]);
|
|
191
|
+
}
|
|
192
|
+
});
|
|
193
|
+
return dataAttrs;
|
|
194
|
+
};
|
|
195
195
|
}
|
|
196
196
|
if (process.env.NODE_ENV !== 'production') {
|
|
197
197
|
Collapsible.displayName = 'Collapsible';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import './index.less';
|
|
1
|
+
import './index.less';
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
import type { ReactNode } from 'react';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import type { ButtonProps } from "..";
|
|
4
|
-
import type { DropDownProps } from 'antd';
|
|
5
|
-
import './style';
|
|
6
|
-
export
|
|
7
|
-
key: React.Key;
|
|
8
|
-
name: ReactNode;
|
|
9
|
-
disabled?: boolean;
|
|
10
|
-
render?: () => ReactNode;
|
|
11
|
-
};
|
|
12
|
-
interface ICollapsibleActionItems {
|
|
13
|
-
maxCount?: number;
|
|
14
|
-
actionItems: ActionItem[];
|
|
15
|
-
className?: string;
|
|
16
|
-
divider?: ReactNode;
|
|
17
|
-
collapseIcon?: ReactNode;
|
|
18
|
-
dropdownProps?: Partial<DropDownProps>;
|
|
19
|
-
buttonProps?: Partial<ButtonProps>;
|
|
20
|
-
style?: React.CSSProperties;
|
|
21
|
-
onItemClick?: (key: React.Key) => void;
|
|
22
|
-
}
|
|
23
|
-
declare const CollapsibleActionItems: React.FC<ICollapsibleActionItems>;
|
|
24
|
-
export default CollapsibleActionItems;
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import type { ButtonProps } from "..";
|
|
4
|
+
import type { DropDownProps } from 'antd';
|
|
5
|
+
import './style';
|
|
6
|
+
export type ActionItem = {
|
|
7
|
+
key: React.Key;
|
|
8
|
+
name: ReactNode;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
render?: () => ReactNode;
|
|
11
|
+
};
|
|
12
|
+
interface ICollapsibleActionItems {
|
|
13
|
+
maxCount?: number;
|
|
14
|
+
actionItems: ActionItem[];
|
|
15
|
+
className?: string;
|
|
16
|
+
divider?: ReactNode;
|
|
17
|
+
collapseIcon?: ReactNode;
|
|
18
|
+
dropdownProps?: Partial<DropDownProps>;
|
|
19
|
+
buttonProps?: Partial<ButtonProps>;
|
|
20
|
+
style?: React.CSSProperties;
|
|
21
|
+
onItemClick?: (key: React.Key) => void;
|
|
22
|
+
}
|
|
23
|
+
declare const CollapsibleActionItems: React.FC<ICollapsibleActionItems>;
|
|
24
|
+
export default CollapsibleActionItems;
|
|
@@ -9,8 +9,8 @@ var _icons = require("@ant-design/icons");
|
|
|
9
9
|
var _ = require("./..");
|
|
10
10
|
var _antd = require("antd");
|
|
11
11
|
var _configProvider = require("antd/es/config-provider");
|
|
12
|
-
var _classnames = _interopRequireDefault(require("classnames"));
|
|
13
12
|
require("./style");
|
|
13
|
+
var _clsx = _interopRequireDefault(require("clsx"));
|
|
14
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
15
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
16
16
|
const CollapsibleActionItems = props => {
|
|
@@ -50,7 +50,7 @@ const CollapsibleActionItems = props => {
|
|
|
50
50
|
onClick: info => onItemClick?.(info.key)
|
|
51
51
|
}, actionItems.slice(maxCount - 1).map(item => getActionItemNode(item, true))) : null;
|
|
52
52
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
53
|
-
className: (0,
|
|
53
|
+
className: (0, _clsx.default)(prefixCls, className),
|
|
54
54
|
style: style
|
|
55
55
|
}, displayAction.map((actionItem, index) => {
|
|
56
56
|
const showDivider = index < actionItems.length - 1;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import '../../style/index.less';
|
|
2
|
-
import './index.less';
|
|
1
|
+
import '../../style/index.less';
|
|
2
|
+
import './index.less';
|
package/lib/flex/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import './style';
|
|
3
|
-
import type { FlexProps } from './interface';
|
|
4
|
-
declare const Flex: React.ForwardRefExoticComponent<FlexProps<import("../_util/type").AnyObject> & {
|
|
5
|
-
children?: React.ReactNode;
|
|
6
|
-
} & React.RefAttributes<HTMLElement>>;
|
|
7
|
-
export default Flex;
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import './style';
|
|
3
|
+
import type { FlexProps } from './interface';
|
|
4
|
+
declare const Flex: React.ForwardRefExoticComponent<FlexProps<import("../_util/type").AnyObject> & {
|
|
5
|
+
children?: React.ReactNode;
|
|
6
|
+
} & React.RefAttributes<HTMLElement>>;
|
|
7
|
+
export default Flex;
|
package/lib/flex/index.js
CHANGED
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _react = _interopRequireDefault(require("react"));
|
|
8
8
|
var _configProvider = require("antd/es/config-provider");
|
|
9
|
-
var
|
|
9
|
+
var _clsx = _interopRequireDefault(require("clsx"));
|
|
10
10
|
var _lodashEs = require("lodash-es");
|
|
11
11
|
require("./style");
|
|
12
12
|
var _gapSize = require("../_util/gapSize");
|
|
@@ -34,7 +34,7 @@ const Flex = /*#__PURE__*/_react.default.forwardRef((props, ref) => {
|
|
|
34
34
|
} = _react.default.useContext(_configProvider.ConfigContext);
|
|
35
35
|
const prefixCls = customizePrefixCls || (0, _configProvider.globalConfig)().getPrefixCls('flex');
|
|
36
36
|
const [mergedVertical] = (0, _hooks.useOrientation)(orientation, vertical);
|
|
37
|
-
const mergedCls = (0,
|
|
37
|
+
const mergedCls = (0, _clsx.default)(className, rootClassName, prefixCls, (0, _utils.default)(prefixCls, props), {
|
|
38
38
|
[`${prefixCls}-rtl`]: ctxDirection === 'rtl',
|
|
39
39
|
[`${prefixCls}-gap-${gap}`]: (0, _gapSize.isPresetSize)(gap),
|
|
40
40
|
[`${prefixCls}-vertical`]: mergedVertical === 'vertical'
|
package/lib/flex/interface.d.ts
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import type React from 'react';
|
|
2
|
-
import { SizeType } from 'antd/
|
|
3
|
-
import type { Orientation } from '../_util/hooks';
|
|
4
|
-
import type { AnyObject, CustomComponent, LiteralUnion } from '../_util/type';
|
|
5
|
-
export interface FlexProps<P = AnyObject> extends React.HTMLAttributes<HTMLElement> {
|
|
6
|
-
prefixCls?: string;
|
|
7
|
-
rootClassName?: string;
|
|
8
|
-
vertical?: boolean;
|
|
9
|
-
orientation?: Orientation;
|
|
10
|
-
wrap?: boolean | React.CSSProperties['flexWrap'];
|
|
11
|
-
justify?: React.CSSProperties['justifyContent'];
|
|
12
|
-
align?: React.CSSProperties['alignItems'];
|
|
13
|
-
flex?: React.CSSProperties['flex'];
|
|
14
|
-
gap?: LiteralUnion<SizeType, React.CSSProperties['gap']>;
|
|
15
|
-
component?: CustomComponent<P>;
|
|
16
|
-
}
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
import type { SizeType } from 'antd/lib/config-provider/SizeContext';
|
|
3
|
+
import type { Orientation } from '../_util/hooks';
|
|
4
|
+
import type { AnyObject, CustomComponent, LiteralUnion } from '../_util/type';
|
|
5
|
+
export interface FlexProps<P = AnyObject> extends React.HTMLAttributes<HTMLElement> {
|
|
6
|
+
prefixCls?: string;
|
|
7
|
+
rootClassName?: string;
|
|
8
|
+
vertical?: boolean;
|
|
9
|
+
orientation?: Orientation;
|
|
10
|
+
wrap?: boolean | React.CSSProperties['flexWrap'];
|
|
11
|
+
justify?: React.CSSProperties['justifyContent'];
|
|
12
|
+
align?: React.CSSProperties['alignItems'];
|
|
13
|
+
flex?: React.CSSProperties['flex'];
|
|
14
|
+
gap?: LiteralUnion<SizeType, React.CSSProperties['gap']>;
|
|
15
|
+
component?: CustomComponent<P>;
|
|
16
|
+
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import '../../style/index.less';
|
|
2
|
-
import './index.less';
|
|
1
|
+
import '../../style/index.less';
|
|
2
|
+
import './index.less';
|