@dtjoy/dt-design 1.0.7 → 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/extendsObject.d.ts +4 -0
- package/esm/_util/gapSize.d.ts +3 -0
- package/esm/_util/getScroll.d.ts +3 -0
- package/esm/_util/hooks/index.d.ts +4 -0
- package/esm/_util/hooks/useForceUpdate.d.ts +2 -0
- package/esm/_util/hooks/useOrientation.d.ts +2 -0
- package/esm/_util/hooks/useProxyImperativeHandle.d.ts +4 -0
- package/esm/_util/hooks/useSyncState.d.ts +3 -0
- package/esm/_util/index.d.ts +3 -0
- package/esm/_util/isNonNullable.d.ts +2 -0
- package/esm/_util/scrollTo.d.ts +10 -0
- package/esm/_util/type.d.ts +52 -0
- package/esm/_util/warning.d.ts +31 -0
- package/esm/blockHeader/index.d.ts +50 -0
- package/esm/blockHeader/style/index.d.ts +2 -0
- package/esm/button/index.d.ts +10 -0
- package/esm/button/style/index.d.ts +2 -0
- package/esm/collapsible/index.d.ts +102 -0
- package/esm/collapsible/style/index.d.ts +1 -0
- package/esm/collapsibleActionItems/index.d.ts +24 -0
- package/esm/collapsibleActionItems/style/index.d.ts +2 -0
- package/esm/flex/index.d.ts +7 -0
- package/esm/flex/interface.d.ts +16 -0
- package/esm/flex/style/index.d.ts +2 -0
- package/esm/flex/utils.d.ts +7 -0
- package/esm/formList/index.d.ts +78 -0
- package/esm/formList/style/index.d.ts +2 -0
- package/esm/index.d.ts +17 -0
- package/esm/overflowList/index.d.ts +40 -0
- package/esm/overflowList/style/index.d.ts +2 -0
- package/esm/resize/index.d.ts +9 -0
- package/esm/resizeObserver/index.d.ts +45 -0
- package/esm/splitter/Panel.d.ts +7 -0
- package/esm/splitter/SplitBar.d.ts +24 -0
- package/esm/splitter/Splitter.d.ts +5 -0
- package/esm/splitter/hooks/sizeUtil.d.ts +3 -0
- package/esm/splitter/hooks/useItems.d.ts +14 -0
- package/esm/splitter/hooks/useResizable.d.ts +10 -0
- package/esm/splitter/hooks/useResize.d.ts +6 -0
- package/esm/splitter/hooks/useSizes.d.ts +4 -0
- package/esm/splitter/index.d.ts +8 -0
- package/esm/splitter/interface.d.ts +69 -0
- package/esm/splitter/style/index.d.ts +2 -0
- package/esm/statusTag/index.d.ts +29 -0
- package/esm/statusTag/style/index.d.ts +2 -0
- package/esm/style/index.d.ts +1 -0
- package/esm/table/InternalTable.d.ts +32 -0
- package/esm/table/RcTable/VirtualTable.d.ts +2 -0
- package/esm/table/RcTable/index.d.ts +2 -0
- package/esm/table/Table.d.ts +17 -0
- package/esm/table/TableMeasureRowContext.d.ts +3 -0
- package/esm/table/hooks/useContainerWidth.d.ts +1 -0
- package/esm/table/index.d.ts +7 -0
- package/esm/table/interface.d.ts +196 -0
- package/esm/table/style/index.d.ts +2 -0
- package/esm/table/util.d.ts +14 -0
- package/lib/_util/easings.d.ts +1 -0
- package/lib/_util/extendsObject.d.ts +4 -0
- package/lib/_util/gapSize.d.ts +3 -0
- package/lib/_util/getScroll.d.ts +3 -0
- package/lib/_util/hooks/index.d.ts +4 -0
- package/lib/_util/hooks/useForceUpdate.d.ts +2 -0
- package/lib/_util/hooks/useOrientation.d.ts +2 -0
- package/lib/_util/hooks/useProxyImperativeHandle.d.ts +4 -0
- package/lib/_util/hooks/useSyncState.d.ts +3 -0
- package/lib/_util/index.d.ts +3 -0
- package/lib/_util/isNonNullable.d.ts +2 -0
- package/lib/_util/scrollTo.d.ts +10 -0
- package/lib/_util/type.d.ts +52 -0
- package/lib/_util/warning.d.ts +31 -0
- package/lib/blockHeader/index.d.ts +50 -0
- package/lib/blockHeader/style/index.d.ts +2 -0
- package/lib/button/index.d.ts +10 -0
- package/lib/button/style/index.d.ts +2 -0
- package/lib/collapsible/index.d.ts +102 -0
- package/lib/collapsible/style/index.d.ts +1 -0
- package/lib/collapsibleActionItems/index.d.ts +24 -0
- package/lib/collapsibleActionItems/style/index.d.ts +2 -0
- package/lib/flex/index.d.ts +7 -0
- package/lib/flex/interface.d.ts +16 -0
- package/lib/flex/style/index.d.ts +2 -0
- package/lib/flex/utils.d.ts +7 -0
- package/lib/formList/index.d.ts +78 -0
- package/lib/formList/style/index.d.ts +2 -0
- package/lib/index.d.ts +17 -0
- package/lib/overflowList/index.d.ts +40 -0
- package/lib/overflowList/style/index.d.ts +2 -0
- package/lib/resize/index.d.ts +9 -0
- package/lib/resizeObserver/index.d.ts +45 -0
- package/lib/splitter/Panel.d.ts +7 -0
- package/lib/splitter/SplitBar.d.ts +24 -0
- package/lib/splitter/Splitter.d.ts +5 -0
- package/lib/splitter/hooks/sizeUtil.d.ts +3 -0
- package/lib/splitter/hooks/useItems.d.ts +14 -0
- package/lib/splitter/hooks/useResizable.d.ts +10 -0
- package/lib/splitter/hooks/useResize.d.ts +6 -0
- package/lib/splitter/hooks/useSizes.d.ts +4 -0
- package/lib/splitter/index.d.ts +8 -0
- package/lib/splitter/interface.d.ts +69 -0
- package/lib/splitter/style/index.d.ts +2 -0
- package/lib/statusTag/index.d.ts +29 -0
- package/lib/statusTag/style/index.d.ts +2 -0
- package/lib/style/index.d.ts +1 -0
- package/lib/table/InternalTable.d.ts +32 -0
- package/lib/table/RcTable/VirtualTable.d.ts +2 -0
- package/lib/table/RcTable/index.d.ts +2 -0
- package/lib/table/Table.d.ts +17 -0
- package/lib/table/TableMeasureRowContext.d.ts +3 -0
- package/lib/table/hooks/useContainerWidth.d.ts +1 -0
- package/lib/table/index.d.ts +7 -0
- package/lib/table/interface.d.ts +196 -0
- package/lib/table/style/index.d.ts +2 -0
- package/lib/table/util.d.ts +14 -0
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function easeInOutCubic(t: number, b: number, c: number, d: number): number;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
interface ScrollToOptions {
|
|
2
|
+
/** Scroll container, default as window */
|
|
3
|
+
getContainer?: () => HTMLElement | Window | Document;
|
|
4
|
+
/** Scroll end callback */
|
|
5
|
+
callback?: () => void;
|
|
6
|
+
/** Animation duration, default as 450 */
|
|
7
|
+
duration?: number;
|
|
8
|
+
}
|
|
9
|
+
export default function scrollTo(y: number, options?: ScrollToOptions): () => void;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
export type Primitive = null | undefined | string | number | boolean | symbol | bigint;
|
|
3
|
+
/** https://github.com/Microsoft/TypeScript/issues/29729 */
|
|
4
|
+
export type LiteralUnion<T, U extends Primitive = string> = T | (U & Record<never, never>);
|
|
5
|
+
export type AnyObject = Record<PropertyKey, any>;
|
|
6
|
+
export type CustomComponent<P = AnyObject> = React.ComponentType<P> | string;
|
|
7
|
+
/**
|
|
8
|
+
* Get component props
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* import { Checkbox } from '@dtjoy/dt-design'
|
|
12
|
+
* import type { GetProps } from '@dtjoy/dt-design';
|
|
13
|
+
*
|
|
14
|
+
* type CheckboxGroupProps = GetProps<typeof Checkbox.Group>
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
export type GetProps<T extends React.ComponentType<any> | object> = T extends React.ComponentType<infer P> ? P : T extends object ? T : never;
|
|
18
|
+
/**
|
|
19
|
+
* Get component props by component name
|
|
20
|
+
* @example
|
|
21
|
+
* ```ts
|
|
22
|
+
* import { Select } from '@dtjoy/dt-design';
|
|
23
|
+
* import type { GetProp, SelectProps } from '@dtjoy/dt-design';
|
|
24
|
+
*
|
|
25
|
+
* type SelectOption1 = GetProp<SelectProps, 'options'>[number];
|
|
26
|
+
* // or
|
|
27
|
+
* type SelectOption2 = GetProp<typeof Select, 'options'>[number];
|
|
28
|
+
*
|
|
29
|
+
* const onChange: GetProp<typeof Select, 'onChange'> = (value, option) => {
|
|
30
|
+
* // Do something
|
|
31
|
+
* };
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
export type GetProp<T extends React.ComponentType<any> | object, PropName extends keyof GetProps<T>> = NonNullable<GetProps<T>[PropName]>;
|
|
35
|
+
type ReactRefComponent<Props extends {
|
|
36
|
+
ref?: React.Ref<any> | string;
|
|
37
|
+
}> = (props: Props) => React.ReactNode;
|
|
38
|
+
type ExtractRefAttributesRef<T> = T extends React.RefAttributes<infer P> ? P : never;
|
|
39
|
+
/**
|
|
40
|
+
* Get component ref
|
|
41
|
+
* @example
|
|
42
|
+
* ```ts
|
|
43
|
+
* import { Input } from '@dtjoy/dt-design';
|
|
44
|
+
* import type { GetRef } from '@dtjoy/dt-design';
|
|
45
|
+
*
|
|
46
|
+
* type InputRef = GetRef<typeof Input>;
|
|
47
|
+
* ```
|
|
48
|
+
*/
|
|
49
|
+
export type GetRef<T extends ReactRefComponent<any> | React.Component<any>> = T extends React.Component<any> ? T : T extends React.ComponentType<infer P> ? ExtractRefAttributesRef<P> : never;
|
|
50
|
+
export type GetContextProps<T> = T extends React.Context<infer P> ? P : never;
|
|
51
|
+
export type GetContextProp<T extends React.Context<any>, PropName extends keyof GetContextProps<T>> = NonNullable<GetContextProps<T>[PropName]>;
|
|
52
|
+
export {};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export declare function noop(): void;
|
|
3
|
+
export declare function resetWarned(): void;
|
|
4
|
+
type Warning = (valid: boolean, component: string, message?: string) => void;
|
|
5
|
+
declare const warning: Warning;
|
|
6
|
+
type BaseTypeWarning = (valid: boolean,
|
|
7
|
+
/**
|
|
8
|
+
* - deprecated: Some API will be removed in future but still support now.
|
|
9
|
+
* - usage: Some API usage is not correct.
|
|
10
|
+
* - breaking: Breaking change like API is removed.
|
|
11
|
+
*/
|
|
12
|
+
type: 'deprecated' | 'usage' | 'breaking', message?: string) => void;
|
|
13
|
+
type TypeWarning = BaseTypeWarning & {
|
|
14
|
+
deprecated: (valid: boolean, oldProp: string, newProp: string, message?: string) => void;
|
|
15
|
+
};
|
|
16
|
+
export interface WarningContextProps {
|
|
17
|
+
/**
|
|
18
|
+
* @descCN 设置警告等级,设置 `false` 时会将废弃相关信息聚合为单条信息。
|
|
19
|
+
* @descEN Set the warning level. When set to `false`, discard related information will be aggregated into a single message.
|
|
20
|
+
* @since 5.10.0
|
|
21
|
+
*/
|
|
22
|
+
strict?: boolean;
|
|
23
|
+
}
|
|
24
|
+
export declare const WarningContext: React.Context<WarningContextProps>;
|
|
25
|
+
/**
|
|
26
|
+
* This is a hook but we not named as `useWarning`
|
|
27
|
+
* since this is only used in development.
|
|
28
|
+
* We should always wrap this in `if (process.env.NODE_ENV !== 'production')` condition
|
|
29
|
+
*/
|
|
30
|
+
export declare const devUseWarning: (component: string) => TypeWarning;
|
|
31
|
+
export default warning;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import './style';
|
|
4
|
+
import type { SizeType } from 'antd/lib/config-provider/SizeContext';
|
|
5
|
+
import type { LabelTooltipType } from '../_util';
|
|
6
|
+
export interface IBlockHeaderProps {
|
|
7
|
+
/** id */
|
|
8
|
+
id?: string;
|
|
9
|
+
/** 标题 */
|
|
10
|
+
title: ReactNode;
|
|
11
|
+
/** 标题前的图标,默认是一个色块 */
|
|
12
|
+
addonBefore?: ReactNode;
|
|
13
|
+
/** 标题后的提示说明文字 */
|
|
14
|
+
description?: ReactNode;
|
|
15
|
+
/** 默认展示为问号的tooltip */
|
|
16
|
+
tooltip?: LabelTooltipType;
|
|
17
|
+
/** 后缀自定义内容块 */
|
|
18
|
+
addonAfter?: ReactNode;
|
|
19
|
+
/**
|
|
20
|
+
* 小标题 font-size: 12px; line-height: 32px
|
|
21
|
+
* 中标题 font-size: 14px; line-height: 40px
|
|
22
|
+
* 大标题 font-size: 16px; line-height: 40px
|
|
23
|
+
* 默认 中标题
|
|
24
|
+
*/
|
|
25
|
+
size?: SizeType;
|
|
26
|
+
/** 自定义 Bottom 值 */
|
|
27
|
+
spaceBottom?: number;
|
|
28
|
+
/** 标题一行的样式类名 */
|
|
29
|
+
className?: string;
|
|
30
|
+
/** 标题的样式类名 */
|
|
31
|
+
style?: React.CSSProperties;
|
|
32
|
+
/** 展示内容(children)的样式类名 */
|
|
33
|
+
contentClassName?: string;
|
|
34
|
+
/** 展示内容(children)的样式 */
|
|
35
|
+
contentStyle?: React.CSSProperties;
|
|
36
|
+
/** 是否显示背景, 默认 true */
|
|
37
|
+
background?: boolean;
|
|
38
|
+
/** 当前展开状态 */
|
|
39
|
+
expand?: boolean;
|
|
40
|
+
/** 是否默认展开内容, 默认为 undefined */
|
|
41
|
+
defaultExpand?: boolean;
|
|
42
|
+
/** 展开/收起的内容 */
|
|
43
|
+
children?: ReactNode;
|
|
44
|
+
/** 展开/收起时的回调 */
|
|
45
|
+
onExpand?: (expand: boolean) => void;
|
|
46
|
+
/** 标题的样式 */
|
|
47
|
+
titleStyle?: React.CSSProperties;
|
|
48
|
+
}
|
|
49
|
+
declare const BlockHeader: React.FC<IBlockHeaderProps>;
|
|
50
|
+
export default BlockHeader;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { ButtonProps as AntdButtonProps } from 'antd';
|
|
3
|
+
import type { ButtonType as AntdButtonType } from 'antd/es/button';
|
|
4
|
+
import './style';
|
|
5
|
+
type ButtonType = AntdButtonType | 'secondary' | 'tertiary';
|
|
6
|
+
export interface ButtonProps extends Omit<AntdButtonProps, 'type'> {
|
|
7
|
+
type?: ButtonType;
|
|
8
|
+
}
|
|
9
|
+
declare const _default: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<HTMLElement>>;
|
|
10
|
+
export default _default;
|
|
@@ -0,0 +1,102 @@
|
|
|
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;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import './index.less';
|
|
@@ -0,0 +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 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;
|
|
@@ -0,0 +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;
|
|
@@ -0,0 +1,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
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
import type { FlexProps } from './interface';
|
|
3
|
+
export declare const flexWrapValues: React.CSSProperties['flexWrap'][];
|
|
4
|
+
export declare const justifyContentValues: React.CSSProperties['justifyContent'][];
|
|
5
|
+
export declare const alignItemsValues: React.CSSProperties['alignItems'][];
|
|
6
|
+
declare const createFlexClassNames: (prefixCls: string, props: FlexProps) => string;
|
|
7
|
+
export default createFlexClassNames;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import type { FormListFieldData, TableProps } from 'antd';
|
|
4
|
+
import type { FormItemProps, FormListProps, RuleObject, RuleRender } from 'antd/lib/form';
|
|
5
|
+
import type { ColumnType as TableColumnType } from 'antd/lib/table';
|
|
6
|
+
import './style';
|
|
7
|
+
type NotNullRowSelection = NonNullable<TableProps<any>['rowSelection']>;
|
|
8
|
+
/**
|
|
9
|
+
* Override NamePath parameters type
|
|
10
|
+
*/
|
|
11
|
+
type OverrideParameters = (string | number)[];
|
|
12
|
+
type RcFormInstance = Parameters<RuleRender>[0];
|
|
13
|
+
type RawPanelRender = NonNullable<TableProps<any>['footer']>;
|
|
14
|
+
/**
|
|
15
|
+
* Override PanelRender type
|
|
16
|
+
*/
|
|
17
|
+
type PanelRenderFunc = (...args: Parameters<FormListProps['children']>) => ReturnType<RawPanelRender>;
|
|
18
|
+
/**
|
|
19
|
+
* Form.Table 组件类型
|
|
20
|
+
*/
|
|
21
|
+
export interface IFormTableProps
|
|
22
|
+
/**
|
|
23
|
+
* Support all FormListProps except children for which is re-defined in this component
|
|
24
|
+
* and prefixCls for which is not expected to be supported
|
|
25
|
+
*/
|
|
26
|
+
extends Pick<FormListProps, 'name' | 'rules' | 'initialValue'>,
|
|
27
|
+
/**
|
|
28
|
+
* Support all TableProps except
|
|
29
|
+
* - re-define columns and re-defined rowSelection
|
|
30
|
+
* - and pagination which is expect to be not supported in Form.Table
|
|
31
|
+
* - and className which is renamed to tableClassName
|
|
32
|
+
* - and rowKey, dataSource for which are defined and not allowed to be modified
|
|
33
|
+
* - and footer, title, summary for which are re-defined to pass form's operation
|
|
34
|
+
*/
|
|
35
|
+
Omit<TableProps<any>, 'columns' | 'rowSelection' | 'pagination' | 'className' | 'rowKey' | 'dataSource' | 'footer' | 'title' | 'summary'> {
|
|
36
|
+
/**
|
|
37
|
+
* 表格列的配置描述
|
|
38
|
+
*/
|
|
39
|
+
columns?: ColumnType[] | ((...args: Parameters<FormListProps['children']>) => ColumnType[]);
|
|
40
|
+
/**
|
|
41
|
+
* Table 的 className
|
|
42
|
+
*/
|
|
43
|
+
tableClassName?: TableProps<any>['className'];
|
|
44
|
+
/**
|
|
45
|
+
* 表格行是否可选择
|
|
46
|
+
*/
|
|
47
|
+
rowSelection?: Omit<NotNullRowSelection, 'getCheckboxProps'> & {
|
|
48
|
+
getCheckboxProps?: (field: FormListFieldData) => ReturnType<NonNullable<NotNullRowSelection['getCheckboxProps']>>;
|
|
49
|
+
};
|
|
50
|
+
title?: PanelRenderFunc;
|
|
51
|
+
footer?: PanelRenderFunc;
|
|
52
|
+
summary?: PanelRenderFunc;
|
|
53
|
+
}
|
|
54
|
+
export interface ColumnType
|
|
55
|
+
/**
|
|
56
|
+
* Support all FormItemProps, and re-defined `rules` and `dependencies`
|
|
57
|
+
*/
|
|
58
|
+
extends Omit<FormItemProps, 'rules' | 'dependencies' | 'prefixCls' | 'children'>,
|
|
59
|
+
/**
|
|
60
|
+
* Support all TableColumnType, and re-defined `render`
|
|
61
|
+
*/
|
|
62
|
+
Omit<TableColumnType<FormListFieldData>, 'render'> {
|
|
63
|
+
/**
|
|
64
|
+
* 设置依赖字段, 支持通过回调函数获取当前字段名
|
|
65
|
+
*/
|
|
66
|
+
dependencies?: ((namePath: OverrideParameters) => FormItemProps['dependencies']) | FormItemProps['dependencies'];
|
|
67
|
+
/**
|
|
68
|
+
* 校验规则,设置字段的校验逻辑,支持通过回调函数获取当前字段名
|
|
69
|
+
*/
|
|
70
|
+
rules?: (RuleObject | ((form: RcFormInstance, namePath: OverrideParameters) => RuleObject))[];
|
|
71
|
+
/**
|
|
72
|
+
* 渲染函数
|
|
73
|
+
* @param formInstance 只有在设置了 `dependencies` 的情况下才有该参数
|
|
74
|
+
*/
|
|
75
|
+
render?: (fieldData: FormListFieldData, namePath: OverrideParameters, formInstance?: RcFormInstance) => ReactNode;
|
|
76
|
+
}
|
|
77
|
+
export default function InternalTable({ name, rules, initialValue, ...tableProps }: IFormTableProps): React.JSX.Element;
|
|
78
|
+
export {};
|
package/esm/index.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export { default as BlockHeader } from './blockHeader';
|
|
2
|
+
export type { ButtonProps } from './button';
|
|
3
|
+
export { default as Button } from './button';
|
|
4
|
+
export { default as Collapsible } from './collapsible';
|
|
5
|
+
export { default as CollapsibleActionItems } from './collapsibleActionItems';
|
|
6
|
+
export { default as Flex } from './flex';
|
|
7
|
+
export type { FlexProps } from './flex/interface';
|
|
8
|
+
export { default as FormList } from './formList';
|
|
9
|
+
export * from './formList';
|
|
10
|
+
export { default as OverflowList } from './overflowList';
|
|
11
|
+
export { default as Resize } from './resize';
|
|
12
|
+
export { default as Splitter } from './splitter';
|
|
13
|
+
export * from './splitter';
|
|
14
|
+
export { default as StatusTag } from './statusTag';
|
|
15
|
+
export * from './statusTag';
|
|
16
|
+
export { default as Table } from './table';
|
|
17
|
+
export type { ColumnGroupType as TableColumnGroupType, ColumnProps as TableColumnProps, ColumnsType as TableColumnsType, ColumnType as TableColumnType, TablePaginationConfig, TableProps, } from './table';
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { ReactElement, ReactNode } from 'react';
|
|
2
|
+
import React, { Component } from 'react';
|
|
3
|
+
import './style';
|
|
4
|
+
export type OverflowItem<T = Record<string, any>> = T;
|
|
5
|
+
export interface OverflowListProps<T = Record<string, any>> {
|
|
6
|
+
items: OverflowItem<T>[];
|
|
7
|
+
visibleItemRenderer: (item: OverflowItem<T>, index: number) => ReactElement;
|
|
8
|
+
overflowRenderer: (overflowItems: OverflowItem<T>[]) => ReactNode | ReactNode[];
|
|
9
|
+
className?: string;
|
|
10
|
+
style?: React.CSSProperties;
|
|
11
|
+
renderMode?: 'collapse' | 'scroll';
|
|
12
|
+
collapseFrom?: 'start' | 'end';
|
|
13
|
+
minVisibleItems?: number;
|
|
14
|
+
onOverflow?: (overflowItems: OverflowItem<T>[]) => void;
|
|
15
|
+
}
|
|
16
|
+
interface OverflowListState {
|
|
17
|
+
visibleCount: number;
|
|
18
|
+
isMeasuring: boolean;
|
|
19
|
+
}
|
|
20
|
+
declare class OverflowList<T extends object> extends Component<OverflowListProps<T>, OverflowListState> {
|
|
21
|
+
static defaultProps: {
|
|
22
|
+
items: never[];
|
|
23
|
+
collapseFrom: string;
|
|
24
|
+
minVisibleItems: number;
|
|
25
|
+
renderMode: string;
|
|
26
|
+
};
|
|
27
|
+
static displayName: string;
|
|
28
|
+
private containerRef;
|
|
29
|
+
private overflowRef;
|
|
30
|
+
private itemRefs;
|
|
31
|
+
private prefixCls;
|
|
32
|
+
constructor(props: OverflowListProps<T>);
|
|
33
|
+
componentDidMount(): void;
|
|
34
|
+
componentUpdate(prevProps: OverflowListProps<T>): void;
|
|
35
|
+
private measureAndAdjust;
|
|
36
|
+
private getOverflowItems;
|
|
37
|
+
renderCollapse(): React.JSX.Element;
|
|
38
|
+
render(): React.JSX.Element;
|
|
39
|
+
}
|
|
40
|
+
export default OverflowList;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface BaseProps {
|
|
3
|
+
className?: string;
|
|
4
|
+
style?: React.CSSProperties;
|
|
5
|
+
[key: string]: any;
|
|
6
|
+
}
|
|
7
|
+
export interface ResizeEntry {
|
|
8
|
+
contentRect: DOMRectReadOnly;
|
|
9
|
+
target: Element;
|
|
10
|
+
}
|
|
11
|
+
export interface ReactResizeObserverProps extends BaseProps {
|
|
12
|
+
onResize?: (entries: ResizeEntry[]) => void;
|
|
13
|
+
observeParent?: boolean;
|
|
14
|
+
observerProperty?: ObserverProperty;
|
|
15
|
+
delayTick?: number;
|
|
16
|
+
children: React.ReactElement;
|
|
17
|
+
}
|
|
18
|
+
export declare enum ObserverProperty {
|
|
19
|
+
Width = "width",
|
|
20
|
+
Height = "height",
|
|
21
|
+
All = "all"
|
|
22
|
+
}
|
|
23
|
+
export default class ReactResizeObserver extends React.Component<ReactResizeObserverProps> {
|
|
24
|
+
static defaultProps: {
|
|
25
|
+
onResize: () => void;
|
|
26
|
+
observeParent: boolean;
|
|
27
|
+
observerProperty: ObserverProperty;
|
|
28
|
+
delayTick: number;
|
|
29
|
+
};
|
|
30
|
+
observer: ResizeObserver | null;
|
|
31
|
+
childNode: HTMLElement | null;
|
|
32
|
+
element: Element | null;
|
|
33
|
+
_parentNode: HTMLElement | null;
|
|
34
|
+
formerPropertyValue: Map<Element, number>;
|
|
35
|
+
constructor(props: ReactResizeObserverProps);
|
|
36
|
+
getElement: () => Element | null;
|
|
37
|
+
handleResizeEventTriggered: (entries: ResizeEntry[]) => void;
|
|
38
|
+
observeElement: (force?: boolean) => void;
|
|
39
|
+
mergeRef: (ref: React.Ref<any>, node: HTMLElement) => void;
|
|
40
|
+
componentDidMount(): void;
|
|
41
|
+
componentDidUpdate(prevProps: ReactResizeObserverProps): void;
|
|
42
|
+
componentWillUnmount(): void;
|
|
43
|
+
render(): React.ReactElement;
|
|
44
|
+
}
|
|
45
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { InternalPanelProps, PanelProps } from './interface';
|
|
3
|
+
export declare const InternalPanel: React.ForwardRefExoticComponent<InternalPanelProps & {
|
|
4
|
+
children?: React.ReactNode;
|
|
5
|
+
} & React.RefAttributes<HTMLDivElement>>;
|
|
6
|
+
declare const Panel: React.FC<React.PropsWithChildren<PanelProps>>;
|
|
7
|
+
export default Panel;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export type ShowCollapsibleIconMode = boolean | 'auto';
|
|
3
|
+
export interface SplitBarProps {
|
|
4
|
+
index: number;
|
|
5
|
+
active: boolean;
|
|
6
|
+
prefixCls: string;
|
|
7
|
+
resizable: boolean;
|
|
8
|
+
startCollapsible: boolean;
|
|
9
|
+
endCollapsible: boolean;
|
|
10
|
+
showStartCollapsibleIcon: ShowCollapsibleIconMode;
|
|
11
|
+
showEndCollapsibleIcon: ShowCollapsibleIconMode;
|
|
12
|
+
onOffsetStart: (index: number) => void;
|
|
13
|
+
onOffsetUpdate: (index: number, offsetX: number, offsetY: number, lazyEnd?: boolean) => void;
|
|
14
|
+
onOffsetEnd: (lazyEnd?: boolean) => void;
|
|
15
|
+
onCollapse: (index: number, type: 'start' | 'end') => void;
|
|
16
|
+
vertical: boolean;
|
|
17
|
+
ariaNow: number;
|
|
18
|
+
ariaMin: number;
|
|
19
|
+
ariaMax: number;
|
|
20
|
+
lazy?: boolean;
|
|
21
|
+
containerSize: number;
|
|
22
|
+
}
|
|
23
|
+
declare const SplitBar: React.FC<SplitBarProps>;
|
|
24
|
+
export default SplitBar;
|