@dtjoy/dt-design 1.0.7 → 1.0.9
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 +54 -0
- package/esm/blockHeader/index.js +6 -2
- 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 +54 -0
- package/lib/blockHeader/index.js +6 -2
- 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,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;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { PanelProps } from '../interface';
|
|
3
|
+
export type ItemType = Omit<PanelProps, 'collapsible'> & {
|
|
4
|
+
collapsible: {
|
|
5
|
+
start?: boolean;
|
|
6
|
+
end?: boolean;
|
|
7
|
+
showCollapsibleIcon: 'auto' | boolean;
|
|
8
|
+
};
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Convert `children` into `items`.
|
|
12
|
+
*/
|
|
13
|
+
declare function useItems(children: React.ReactNode): ItemType[];
|
|
14
|
+
export default useItems;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ShowCollapsibleIconMode } from '../SplitBar';
|
|
2
|
+
import type { ItemType } from './useItems';
|
|
3
|
+
export type ResizableInfo = {
|
|
4
|
+
resizable: boolean;
|
|
5
|
+
startCollapsible: boolean;
|
|
6
|
+
endCollapsible: boolean;
|
|
7
|
+
showStartCollapsibleIcon: ShowCollapsibleIconMode;
|
|
8
|
+
showEndCollapsibleIcon: ShowCollapsibleIconMode;
|
|
9
|
+
};
|
|
10
|
+
export default function useResizable(items: ItemType[], pxSizes: number[], isRTL: boolean): ResizableInfo[];
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { ItemType } from './useItems';
|
|
2
|
+
import type { ResizableInfo } from './useResizable';
|
|
3
|
+
/**
|
|
4
|
+
* Handle user drag resize logic.
|
|
5
|
+
*/
|
|
6
|
+
export default function useResize(items: ItemType[], resizableInfos: ResizableInfo[], percentSizes: number[], containerSize: number | undefined, updateSizes: (sizes: number[]) => void, isRTL: boolean): readonly [(index: number) => void, (index: number, offset: number) => number[], () => void, (index: number, type: 'start' | 'end') => number[], number | undefined];
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { PanelProps } from '../interface';
|
|
3
|
+
export declare function getPtg(str: string): number;
|
|
4
|
+
export default function useSizes(items: PanelProps[], containerSize?: number): readonly [(string | number | undefined)[], number[], number[], number[], number[], React.Dispatch<React.SetStateAction<(string | number | undefined)[]>>];
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import Panel from './Panel';
|
|
2
|
+
import SplitterComp from './Splitter';
|
|
3
|
+
export type { SplitterProps } from './interface';
|
|
4
|
+
type CompoundedComponent = typeof SplitterComp & {
|
|
5
|
+
Panel: typeof Panel;
|
|
6
|
+
};
|
|
7
|
+
declare const Splitter: CompoundedComponent;
|
|
8
|
+
export default Splitter;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { ShowCollapsibleIconMode } from './SplitBar';
|
|
3
|
+
export interface SplitterProps {
|
|
4
|
+
prefixCls?: string;
|
|
5
|
+
className?: string;
|
|
6
|
+
style?: React.CSSProperties;
|
|
7
|
+
rootClassName?: string;
|
|
8
|
+
layout?: 'horizontal' | 'vertical';
|
|
9
|
+
onResizeStart?: (sizes: number[]) => void;
|
|
10
|
+
onResize?: (sizes: number[]) => void;
|
|
11
|
+
onResizeEnd?: (sizes: number[]) => void;
|
|
12
|
+
onCollapse?: (collapsed: boolean[], sizes: number[]) => void;
|
|
13
|
+
lazy?: boolean;
|
|
14
|
+
}
|
|
15
|
+
export interface PanelProps {
|
|
16
|
+
className?: string;
|
|
17
|
+
style?: React.CSSProperties;
|
|
18
|
+
min?: number | string;
|
|
19
|
+
max?: number | string;
|
|
20
|
+
size?: number | string;
|
|
21
|
+
collapsible?: boolean | {
|
|
22
|
+
start?: boolean;
|
|
23
|
+
end?: boolean;
|
|
24
|
+
showCollapsibleIcon?: ShowCollapsibleIconMode;
|
|
25
|
+
};
|
|
26
|
+
resizable?: boolean;
|
|
27
|
+
defaultSize?: number | string;
|
|
28
|
+
}
|
|
29
|
+
export interface InternalPanelProps extends PanelProps {
|
|
30
|
+
className?: string;
|
|
31
|
+
prefixCls?: string;
|
|
32
|
+
}
|
|
33
|
+
export interface UseResizeProps extends Pick<SplitterProps, 'onResize'> {
|
|
34
|
+
basicsState: number[];
|
|
35
|
+
items: PanelProps[];
|
|
36
|
+
panelsRef: React.RefObject<(HTMLDivElement | null)[]>;
|
|
37
|
+
reverse: boolean;
|
|
38
|
+
setBasicsState: React.Dispatch<React.SetStateAction<number[]>>;
|
|
39
|
+
}
|
|
40
|
+
export interface UseResize {
|
|
41
|
+
setSize: (data: {
|
|
42
|
+
size: number;
|
|
43
|
+
index: number;
|
|
44
|
+
}[]) => void;
|
|
45
|
+
setOffset: (offset: number, containerSize: number, index: number) => void;
|
|
46
|
+
}
|
|
47
|
+
export interface UseHandleProps extends Pick<SplitterProps, 'layout' | 'onResizeStart' | 'onResizeEnd'> {
|
|
48
|
+
basicsState: number[];
|
|
49
|
+
containerRef?: React.RefObject<HTMLDivElement | null>;
|
|
50
|
+
setOffset: UseResize['setOffset'];
|
|
51
|
+
setResizing: React.Dispatch<React.SetStateAction<boolean>>;
|
|
52
|
+
}
|
|
53
|
+
export interface UseHandle {
|
|
54
|
+
onStart: (x: number, y: number, index: number) => void;
|
|
55
|
+
}
|
|
56
|
+
export interface UseCollapsibleProps {
|
|
57
|
+
basicsState: number[];
|
|
58
|
+
collapsible?: PanelProps['collapsible'];
|
|
59
|
+
index: number;
|
|
60
|
+
reverse: boolean;
|
|
61
|
+
setSize?: UseResize['setSize'];
|
|
62
|
+
}
|
|
63
|
+
export interface UseCollapsible {
|
|
64
|
+
nextIcon: boolean;
|
|
65
|
+
overlap: boolean;
|
|
66
|
+
previousIcon: boolean;
|
|
67
|
+
onFold: (type: 'previous' | 'next') => void;
|
|
68
|
+
setOldBasics: () => void;
|
|
69
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { CSSProperties, HTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import './style';
|
|
4
|
+
export declare const PRESET_COLOR_TYPES: readonly ["blue", "yellow", "green", "gray", "red", "purple", "cyan", "pink"];
|
|
5
|
+
export declare const STATUS_TAG_TYPES: readonly ["default", "outline", "fill"];
|
|
6
|
+
export type PresetColorType = (typeof PRESET_COLOR_TYPES)[number] | (string & {});
|
|
7
|
+
export type StatusTagType = (typeof STATUS_TAG_TYPES)[number];
|
|
8
|
+
export interface IStatusTagProps extends HTMLAttributes<HTMLDivElement> {
|
|
9
|
+
/** 状态类型 */
|
|
10
|
+
type?: StatusTagType;
|
|
11
|
+
/** 是否圆角 */
|
|
12
|
+
rounded?: boolean;
|
|
13
|
+
/** 状态颜色(支持预设值/自定义十六进制/RGB) */
|
|
14
|
+
color?: PresetColorType;
|
|
15
|
+
/** 是否加载中 */
|
|
16
|
+
loading?: boolean;
|
|
17
|
+
/** 自定义图标 */
|
|
18
|
+
icon?: ReactNode;
|
|
19
|
+
/** 背景颜色(仅fill类型生效),未设置时使用color的0.15透明度 */
|
|
20
|
+
background?: string;
|
|
21
|
+
/** 类名 */
|
|
22
|
+
className?: string;
|
|
23
|
+
/** 子节点 */
|
|
24
|
+
children?: ReactNode;
|
|
25
|
+
/** 自定义样式 */
|
|
26
|
+
style?: CSSProperties;
|
|
27
|
+
}
|
|
28
|
+
declare const StatusTag: React.FC<IStatusTagProps>;
|
|
29
|
+
export default StatusTag;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import './index.less';
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { TableProps as RcTableProps } from '@rc-component/table';
|
|
2
|
+
import type { SpinProps, TooltipProps } from 'antd';
|
|
3
|
+
import type { SizeType } from 'antd/lib/config-provider/SizeContext';
|
|
4
|
+
import type { FilterValue } from 'antd/lib/table/interface';
|
|
5
|
+
import './style';
|
|
6
|
+
import type { AnyObject } from '../_util/type';
|
|
7
|
+
import type { ColumnsType, GetPopupContainer, RefInternalTable, SorterResult, SortOrder, TableCurrentDataSource, TableLocale, TablePaginationConfig, TableRowSelection } from './interface';
|
|
8
|
+
export type { ColumnsType, TablePaginationConfig };
|
|
9
|
+
export interface TableProps<RecordType> extends Omit<RcTableProps<RecordType>, 'transformColumns' | 'internalHooks' | 'internalRefs' | 'data' | 'columns' | 'scroll' | 'emptyText'> {
|
|
10
|
+
dropdownPrefixCls?: string;
|
|
11
|
+
dataSource?: RcTableProps<RecordType>['data'];
|
|
12
|
+
columns?: ColumnsType<RecordType>;
|
|
13
|
+
pagination?: false | TablePaginationConfig;
|
|
14
|
+
loading?: boolean | SpinProps;
|
|
15
|
+
size?: SizeType;
|
|
16
|
+
bordered?: boolean;
|
|
17
|
+
locale?: TableLocale;
|
|
18
|
+
virtual?: boolean;
|
|
19
|
+
onChange?: (pagination: TablePaginationConfig, filters: Record<string, FilterValue | null>, sorter: SorterResult<RecordType> | SorterResult<RecordType>[], extra: TableCurrentDataSource<RecordType>) => void;
|
|
20
|
+
rowSelection?: TableRowSelection<RecordType>;
|
|
21
|
+
getPopupContainer?: GetPopupContainer;
|
|
22
|
+
scroll?: RcTableProps<RecordType>['scroll'] & {
|
|
23
|
+
scrollToFirstRowOnChange?: boolean;
|
|
24
|
+
};
|
|
25
|
+
sortDirections?: SortOrder[];
|
|
26
|
+
showSorterTooltip?: boolean | TooltipProps;
|
|
27
|
+
}
|
|
28
|
+
export interface InternalTableProps<RecordType = AnyObject> extends TableProps<RecordType> {
|
|
29
|
+
_renderTimes: number;
|
|
30
|
+
}
|
|
31
|
+
declare const _default: RefInternalTable;
|
|
32
|
+
export default _default;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { EXPAND_COLUMN, Summary } from '@rc-component/table';
|
|
2
|
+
import Column from 'antd/lib/table/Column';
|
|
3
|
+
import ColumnGroup from 'antd/lib/table/ColumnGroup';
|
|
4
|
+
import { SELECTION_ALL, SELECTION_COLUMN, SELECTION_INVERT, SELECTION_NONE } from 'antd/lib/table/hooks/useSelection';
|
|
5
|
+
import type { RefTable } from './interface';
|
|
6
|
+
declare const ForwardTable: RefTable & {
|
|
7
|
+
displayName?: string | undefined;
|
|
8
|
+
SELECTION_COLUMN: typeof SELECTION_COLUMN;
|
|
9
|
+
EXPAND_COLUMN: typeof EXPAND_COLUMN;
|
|
10
|
+
SELECTION_ALL: typeof SELECTION_ALL;
|
|
11
|
+
SELECTION_INVERT: typeof SELECTION_INVERT;
|
|
12
|
+
SELECTION_NONE: typeof SELECTION_NONE;
|
|
13
|
+
Column: typeof Column;
|
|
14
|
+
ColumnGroup: typeof ColumnGroup;
|
|
15
|
+
Summary: typeof Summary;
|
|
16
|
+
};
|
|
17
|
+
export default ForwardTable;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function useContainerWidth(prefixCls: string): (ele: HTMLElement, width: number) => number;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { TablePaginationConfig, TableProps } from './InternalTable';
|
|
2
|
+
import Table from './Table';
|
|
3
|
+
export type { ColumnGroupType, ColumnsType, ColumnType } from './interface';
|
|
4
|
+
export type { Reference as TableRef } from '@rc-component/table';
|
|
5
|
+
export type { ColumnProps } from 'antd/lib/table/Column';
|
|
6
|
+
export type { TablePaginationConfig, TableProps };
|
|
7
|
+
export default Table;
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
import type * as React from 'react';
|
|
2
|
+
import type { Reference } from '@rc-component/table';
|
|
3
|
+
import type { ExpandableConfig, FixedType, GetComponentProps, GetRowKey, ColumnType as RcColumnType, RenderedCell as RcRenderedCell } from '@rc-component/table/lib/interface';
|
|
4
|
+
import type { CheckboxProps, DropdownProps, PaginationProps, TooltipProps } from 'antd';
|
|
5
|
+
import type { Breakpoint } from 'antd/lib/_util/responsiveObserve';
|
|
6
|
+
import type { INTERNAL_SELECTION_ITEM } from 'antd/lib/table/hooks/useSelection';
|
|
7
|
+
import type { AnyObject } from '../_util/type';
|
|
8
|
+
import type { InternalTableProps, TableProps } from './InternalTable';
|
|
9
|
+
export type RefTable = <RecordType = AnyObject>(props: React.PropsWithChildren<TableProps<RecordType>> & React.RefAttributes<Reference>) => React.ReactElement;
|
|
10
|
+
export type RefInternalTable = <RecordType = AnyObject>(props: React.PropsWithChildren<InternalTableProps<RecordType>> & React.RefAttributes<Reference>) => React.ReactElement;
|
|
11
|
+
export type { ExpandableConfig, GetRowKey };
|
|
12
|
+
export type Key = React.Key;
|
|
13
|
+
export type SafeKey = Exclude<Key, bigint>;
|
|
14
|
+
export type RowSelectionType = 'checkbox' | 'radio';
|
|
15
|
+
export type SelectionItemSelectFn = (currentRowKeys: Key[]) => void;
|
|
16
|
+
export type ExpandType = null | 'row' | 'nest';
|
|
17
|
+
export interface TableLocale {
|
|
18
|
+
filterTitle?: string;
|
|
19
|
+
filterConfirm?: React.ReactNode;
|
|
20
|
+
filterReset?: React.ReactNode;
|
|
21
|
+
filterEmptyText?: React.ReactNode;
|
|
22
|
+
/**
|
|
23
|
+
* @deprecated Please use `filterCheckAll` instead.
|
|
24
|
+
*/
|
|
25
|
+
filterCheckall?: React.ReactNode;
|
|
26
|
+
filterCheckAll?: React.ReactNode;
|
|
27
|
+
filterSearchPlaceholder?: string;
|
|
28
|
+
emptyText?: React.ReactNode | (() => React.ReactNode);
|
|
29
|
+
selectAll?: React.ReactNode;
|
|
30
|
+
selectNone?: React.ReactNode;
|
|
31
|
+
selectInvert?: React.ReactNode;
|
|
32
|
+
selectionAll?: React.ReactNode;
|
|
33
|
+
sortTitle?: string;
|
|
34
|
+
expand?: string;
|
|
35
|
+
collapse?: string;
|
|
36
|
+
triggerDesc?: string;
|
|
37
|
+
triggerAsc?: string;
|
|
38
|
+
cancelSort?: string;
|
|
39
|
+
}
|
|
40
|
+
export type SortOrder = 'descend' | 'ascend' | null;
|
|
41
|
+
export type SorterTooltipTarget = 'full-header' | 'sorter-icon';
|
|
42
|
+
export type SorterTooltipProps = TooltipProps & {
|
|
43
|
+
target?: SorterTooltipTarget;
|
|
44
|
+
};
|
|
45
|
+
declare const _TableActions: readonly ["paginate", "sort", "filter"];
|
|
46
|
+
export type TableAction = (typeof _TableActions)[number];
|
|
47
|
+
export type CompareFn<T = AnyObject> = (a: T, b: T, sortOrder?: SortOrder) => number;
|
|
48
|
+
export interface ColumnFilterItem {
|
|
49
|
+
text: React.ReactNode;
|
|
50
|
+
value: React.Key | boolean;
|
|
51
|
+
children?: ColumnFilterItem[];
|
|
52
|
+
}
|
|
53
|
+
export interface ColumnTitleProps<RecordType = AnyObject> {
|
|
54
|
+
/** @deprecated Will be remove in v7, Please use `sorterColumns` instead. */
|
|
55
|
+
sortOrder?: SortOrder;
|
|
56
|
+
/** @deprecated Will be remove in v7, Please use `sorterColumns` instead. */
|
|
57
|
+
sortColumn?: ColumnType<RecordType>;
|
|
58
|
+
sortColumns?: {
|
|
59
|
+
column: ColumnType<RecordType>;
|
|
60
|
+
order: SortOrder;
|
|
61
|
+
}[];
|
|
62
|
+
filters?: Record<string, FilterValue>;
|
|
63
|
+
}
|
|
64
|
+
export type ColumnTitle<RecordType = AnyObject> = React.ReactNode | ((props: ColumnTitleProps<RecordType>) => React.ReactNode);
|
|
65
|
+
export type FilterValue = (Key | boolean)[];
|
|
66
|
+
export type FilterKey = (string | number)[] | null;
|
|
67
|
+
export type FilterSearchType<RecordType = AnyObject> = boolean | ((input: string, record: RecordType) => boolean);
|
|
68
|
+
export interface FilterConfirmProps {
|
|
69
|
+
closeDropdown: boolean;
|
|
70
|
+
}
|
|
71
|
+
export interface FilterRestProps {
|
|
72
|
+
confirm?: boolean;
|
|
73
|
+
closeDropdown?: boolean;
|
|
74
|
+
}
|
|
75
|
+
export interface FilterDropdownProps {
|
|
76
|
+
prefixCls: string;
|
|
77
|
+
setSelectedKeys: (selectedKeys: React.Key[]) => void;
|
|
78
|
+
selectedKeys: React.Key[];
|
|
79
|
+
/**
|
|
80
|
+
* Confirm filter value, if you want to close dropdown before commit, you can call with
|
|
81
|
+
* {closeDropdown: true}
|
|
82
|
+
*/
|
|
83
|
+
confirm: (param?: FilterConfirmProps) => void;
|
|
84
|
+
clearFilters?: (param?: FilterRestProps) => void;
|
|
85
|
+
filters?: ColumnFilterItem[];
|
|
86
|
+
/** Only close filterDropdown */
|
|
87
|
+
close: () => void;
|
|
88
|
+
visible: boolean;
|
|
89
|
+
}
|
|
90
|
+
interface CoverableDropdownProps extends Omit<DropdownProps, 'onOpenChange' | 'overlay' | 'visible' | 'onVisibleChange'> {
|
|
91
|
+
onOpenChange?: (open: boolean) => void;
|
|
92
|
+
}
|
|
93
|
+
export interface ColumnType<RecordType = AnyObject> extends Omit<RcColumnType<RecordType>, 'title'> {
|
|
94
|
+
title?: ColumnTitle<RecordType>;
|
|
95
|
+
sorter?: boolean | CompareFn<RecordType> | {
|
|
96
|
+
compare?: CompareFn<RecordType>;
|
|
97
|
+
/** Config multiple sorter order priority */
|
|
98
|
+
multiple?: number;
|
|
99
|
+
};
|
|
100
|
+
sortOrder?: SortOrder;
|
|
101
|
+
defaultSortOrder?: SortOrder;
|
|
102
|
+
sortDirections?: SortOrder[];
|
|
103
|
+
sortIcon?: (props: {
|
|
104
|
+
sortOrder: SortOrder;
|
|
105
|
+
}) => React.ReactNode;
|
|
106
|
+
showSorterTooltip?: boolean | SorterTooltipProps;
|
|
107
|
+
filtered?: boolean;
|
|
108
|
+
filters?: ColumnFilterItem[];
|
|
109
|
+
filterDropdown?: React.ReactNode | ((props: FilterDropdownProps) => React.ReactNode);
|
|
110
|
+
filterOnClose?: boolean;
|
|
111
|
+
filterMultiple?: boolean;
|
|
112
|
+
filteredValue?: FilterValue | null;
|
|
113
|
+
defaultFilteredValue?: FilterValue | null;
|
|
114
|
+
filterIcon?: React.ReactNode | ((filtered: boolean) => React.ReactNode);
|
|
115
|
+
filterMode?: 'menu' | 'tree';
|
|
116
|
+
filterSearch?: FilterSearchType<ColumnFilterItem>;
|
|
117
|
+
onFilter?: (value: React.Key | boolean, record: RecordType) => boolean;
|
|
118
|
+
/**
|
|
119
|
+
* Can cover `<Dropdown>` props
|
|
120
|
+
* @since 5.22.0
|
|
121
|
+
*/
|
|
122
|
+
filterDropdownProps?: CoverableDropdownProps;
|
|
123
|
+
filterResetToDefaultFilteredValue?: boolean;
|
|
124
|
+
responsive?: Breakpoint[];
|
|
125
|
+
/**
|
|
126
|
+
* @deprecated Please use `filterDropdownProps.open` instead.
|
|
127
|
+
* @since 4.23.0
|
|
128
|
+
*/
|
|
129
|
+
filterDropdownOpen?: boolean;
|
|
130
|
+
/**
|
|
131
|
+
* @deprecated Please use `filterDropdownProps.onOpenChange` instead.
|
|
132
|
+
* @since 4.23.0
|
|
133
|
+
*/
|
|
134
|
+
onFilterDropdownOpenChange?: (visible: boolean) => void;
|
|
135
|
+
}
|
|
136
|
+
export interface ColumnGroupType<RecordType = AnyObject> extends Omit<ColumnType<RecordType>, 'dataIndex'> {
|
|
137
|
+
children: ColumnsType<RecordType>;
|
|
138
|
+
}
|
|
139
|
+
export type ColumnsType<RecordType = AnyObject> = (ColumnGroupType<RecordType> | ColumnType<RecordType>)[];
|
|
140
|
+
export interface SelectionItem {
|
|
141
|
+
key: string;
|
|
142
|
+
text: React.ReactNode;
|
|
143
|
+
onSelect?: SelectionItemSelectFn;
|
|
144
|
+
}
|
|
145
|
+
export type SelectionSelectFn<T = AnyObject> = (record: T, selected: boolean, selectedRows: T[], nativeEvent: Event) => void;
|
|
146
|
+
export type RowSelectMethod = 'all' | 'none' | 'invert' | 'single' | 'multiple';
|
|
147
|
+
export interface TableRowSelection<T = AnyObject> {
|
|
148
|
+
/** Keep the selection keys in list even the key not exist in `dataSource` anymore */
|
|
149
|
+
preserveSelectedRowKeys?: boolean;
|
|
150
|
+
type?: RowSelectionType;
|
|
151
|
+
selectedRowKeys?: Key[];
|
|
152
|
+
defaultSelectedRowKeys?: Key[];
|
|
153
|
+
onChange?: (selectedRowKeys: Key[], selectedRows: T[], info: {
|
|
154
|
+
type: RowSelectMethod;
|
|
155
|
+
}) => void;
|
|
156
|
+
getCheckboxProps?: (record: T) => Partial<Omit<CheckboxProps, 'checked' | 'defaultChecked'>>;
|
|
157
|
+
onSelect?: SelectionSelectFn<T>;
|
|
158
|
+
/** @deprecated This function will be remove in v7 and should use `onChange` instead */
|
|
159
|
+
onSelectMultiple?: (selected: boolean, selectedRows: T[], changeRows: T[]) => void;
|
|
160
|
+
/** @deprecated This function will be remove in v7 and should use `onChange` instead */
|
|
161
|
+
onSelectAll?: (selected: boolean, selectedRows: T[], changeRows: T[]) => void;
|
|
162
|
+
/** @deprecated This function will be remove in v7 and should use `onChange` instead */
|
|
163
|
+
onSelectInvert?: (selectedRowKeys: Key[]) => void;
|
|
164
|
+
/** @deprecated This function will be remove in v7 and should use `onChange` instead */
|
|
165
|
+
onSelectNone?: () => void;
|
|
166
|
+
selections?: INTERNAL_SELECTION_ITEM[] | boolean;
|
|
167
|
+
hideSelectAll?: boolean;
|
|
168
|
+
fixed?: FixedType;
|
|
169
|
+
columnWidth?: string | number;
|
|
170
|
+
columnTitle?: React.ReactNode | ((checkboxNode: React.ReactNode) => React.ReactNode);
|
|
171
|
+
checkStrictly?: boolean;
|
|
172
|
+
/** Set the alignment of the selection column */
|
|
173
|
+
align?: 'left' | 'center' | 'right';
|
|
174
|
+
renderCell?: (value: boolean, record: T, index: number, originNode: React.ReactNode) => React.ReactNode | RcRenderedCell<T>;
|
|
175
|
+
onCell?: GetComponentProps<T>;
|
|
176
|
+
getTitleCheckboxProps?: () => Partial<Omit<CheckboxProps, 'checked' | 'defaultChecked'>> & React.AriaAttributes;
|
|
177
|
+
}
|
|
178
|
+
export type TransformColumns<RecordType = AnyObject> = (columns: ColumnsType<RecordType>) => ColumnsType<RecordType>;
|
|
179
|
+
export interface TableCurrentDataSource<RecordType = AnyObject> {
|
|
180
|
+
currentDataSource: RecordType[];
|
|
181
|
+
action: TableAction;
|
|
182
|
+
}
|
|
183
|
+
export interface SorterResult<RecordType = AnyObject> {
|
|
184
|
+
column?: ColumnType<RecordType>;
|
|
185
|
+
order?: SortOrder;
|
|
186
|
+
field?: Key | readonly Key[];
|
|
187
|
+
columnKey?: Key;
|
|
188
|
+
}
|
|
189
|
+
export type GetPopupContainer = (triggerNode: HTMLElement) => HTMLElement;
|
|
190
|
+
export type TablePaginationPlacement = 'topStart' | 'topCenter' | 'topEnd' | 'bottomStart' | 'bottomCenter' | 'bottomEnd' | 'none';
|
|
191
|
+
export type TablePaginationPosition = 'topLeft' | 'topCenter' | 'topRight' | 'bottomLeft' | 'bottomCenter' | 'bottomRight' | 'none';
|
|
192
|
+
export interface TablePaginationConfig extends PaginationProps {
|
|
193
|
+
placement?: TablePaginationPlacement[];
|
|
194
|
+
/** @deprecated please use `placement` instead */
|
|
195
|
+
position?: TablePaginationPosition[];
|
|
196
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { AnyObject } from '../_util/type';
|
|
3
|
+
import type { ColumnTitle, ColumnTitleProps, ColumnType, Key } from './interface';
|
|
4
|
+
export declare const getColumnKey: <RecordType extends AnyObject = AnyObject>(column: ColumnType<RecordType>, defaultKey: string) => Key;
|
|
5
|
+
export declare function getColumnPos(index: number, pos?: string): string;
|
|
6
|
+
export declare const renderColumnTitle: <RecordType extends AnyObject = AnyObject>(title: ColumnTitle<RecordType>, props: ColumnTitleProps<RecordType>) => import("react").ReactNode;
|
|
7
|
+
/**
|
|
8
|
+
* Safe get column title
|
|
9
|
+
*
|
|
10
|
+
* Should filter [object Object]
|
|
11
|
+
*
|
|
12
|
+
* @param title
|
|
13
|
+
*/
|
|
14
|
+
export declare const safeColumnTitle: <RecordType extends AnyObject = AnyObject>(title: ColumnTitle<RecordType>, props: ColumnTitleProps<RecordType>) => import("react").ReactNode;
|
|
@@ -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;
|