@dtjoy/dt-design 1.0.6 → 1.0.7

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.
Files changed (188) hide show
  1. package/esm/_util/easings.js +9 -0
  2. package/esm/_util/extendsObject.js +17 -0
  3. package/esm/_util/getScroll.js +32 -0
  4. package/esm/_util/hooks/index.js +4 -1
  5. package/esm/_util/hooks/useForceUpdate.js +6 -0
  6. package/esm/_util/hooks/useProxyImperativeHandle.js +31 -0
  7. package/esm/_util/hooks/useSyncState.js +20 -0
  8. package/esm/_util/scrollTo.js +38 -0
  9. package/esm/_util/warning.js +5 -5
  10. package/esm/blockHeader/index.js +13 -15
  11. package/esm/blockHeader/style/index.less +143 -143
  12. package/esm/button/index.js +2 -2
  13. package/esm/collapsible/index.js +53 -55
  14. package/esm/collapsibleActionItems/index.js +2 -2
  15. package/esm/flex/index.js +1 -1
  16. package/esm/flex/style/index.less +76 -76
  17. package/esm/flex/utils.js +1 -1
  18. package/esm/formList/index.js +13 -11
  19. package/esm/formList/style/index.less +45 -45
  20. package/esm/index.js +3 -1
  21. package/esm/overflowList/index.js +4 -3
  22. package/esm/resize/index.js +1 -1
  23. package/esm/resizeObserver/index.js +3 -2
  24. package/esm/splitter/Panel.js +3 -3
  25. package/esm/splitter/SplitBar.js +8 -7
  26. package/esm/splitter/Splitter.js +5 -4
  27. package/esm/splitter/hooks/useItems.js +2 -2
  28. package/esm/splitter/hooks/useResize.js +5 -5
  29. package/esm/statusTag/index.js +8 -8
  30. package/esm/style/index.less +1 -1
  31. package/esm/style/themes/index.less +2 -2
  32. package/esm/style/themes/variable.less +4 -0
  33. package/esm/table/InternalTable.js +429 -0
  34. package/esm/table/RcTable/VirtualTable.js +9 -0
  35. package/esm/table/RcTable/index.js +9 -0
  36. package/esm/table/Table.js +28 -0
  37. package/esm/table/TableMeasureRowContext.js +3 -0
  38. package/esm/table/hooks/useContainerWidth.js +14 -0
  39. package/esm/table/index.js +2 -0
  40. package/esm/table/interface.js +4 -0
  41. package/esm/table/style/bordered.less +141 -0
  42. package/esm/table/style/fixed.less +88 -0
  43. package/esm/table/style/index.js +2 -0
  44. package/esm/table/style/index.less +150 -0
  45. package/esm/table/style/selection.less +90 -0
  46. package/esm/table/style/sticky.less +55 -0
  47. package/esm/table/style/virtual.less +65 -0
  48. package/esm/table/util.js +33 -0
  49. package/lib/_util/easings.js +15 -0
  50. package/lib/_util/extendsObject.js +20 -0
  51. package/lib/_util/getScroll.js +39 -0
  52. package/lib/_util/hooks/index.js +33 -0
  53. package/lib/_util/hooks/useForceUpdate.js +12 -0
  54. package/lib/_util/hooks/useProxyImperativeHandle.js +40 -0
  55. package/lib/_util/hooks/useSyncState.js +19 -0
  56. package/lib/_util/scrollTo.js +44 -0
  57. package/lib/_util/warning.js +7 -8
  58. package/lib/blockHeader/index.js +13 -12
  59. package/lib/blockHeader/style/index.less +143 -143
  60. package/lib/button/index.js +2 -2
  61. package/lib/collapsible/index.js +49 -49
  62. package/lib/collapsibleActionItems/index.js +2 -2
  63. package/lib/flex/index.js +2 -2
  64. package/lib/flex/style/index.less +76 -76
  65. package/lib/flex/utils.js +2 -2
  66. package/lib/formList/index.js +10 -10
  67. package/lib/formList/style/index.less +45 -45
  68. package/lib/index.js +21 -2
  69. package/lib/overflowList/index.js +4 -3
  70. package/lib/resize/index.js +1 -1
  71. package/lib/resizeObserver/index.js +3 -2
  72. package/lib/splitter/Panel.js +3 -3
  73. package/lib/splitter/SplitBar.js +8 -7
  74. package/lib/splitter/Splitter.js +5 -4
  75. package/lib/splitter/hooks/useItems.js +2 -2
  76. package/lib/splitter/hooks/useResize.js +5 -5
  77. package/lib/statusTag/index.js +8 -8
  78. package/lib/style/index.less +1 -1
  79. package/lib/style/themes/index.less +2 -2
  80. package/lib/style/themes/variable.less +4 -0
  81. package/lib/table/InternalTable.js +395 -0
  82. package/lib/table/RcTable/VirtualTable.js +17 -0
  83. package/lib/table/RcTable/index.js +17 -0
  84. package/lib/table/Table.js +37 -0
  85. package/lib/{_util/zindexContext.js → table/TableMeasureRowContext.js} +2 -5
  86. package/lib/table/hooks/useContainerWidth.js +20 -0
  87. package/lib/table/index.js +9 -0
  88. package/lib/table/interface.js +8 -0
  89. package/lib/table/style/bordered.less +141 -0
  90. package/lib/table/style/fixed.less +88 -0
  91. package/lib/table/style/index.js +4 -0
  92. package/lib/table/style/index.less +150 -0
  93. package/lib/table/style/selection.less +90 -0
  94. package/lib/table/style/sticky.less +55 -0
  95. package/lib/table/style/virtual.less +65 -0
  96. package/lib/table/util.js +44 -0
  97. package/package.json +82 -66
  98. package/esm/_util/convertToTooltipProps.d.ts +0 -4
  99. package/esm/_util/convertToTooltipProps.js +0 -15
  100. package/esm/_util/gapSize.d.ts +0 -3
  101. package/esm/_util/hooks/index.d.ts +0 -1
  102. package/esm/_util/hooks/useOrientation.d.ts +0 -2
  103. package/esm/_util/hooks/useZIndex.d.ts +0 -8
  104. package/esm/_util/hooks/useZIndex.js +0 -51
  105. package/esm/_util/index.d.ts +0 -3
  106. package/esm/_util/isNonNullable.d.ts +0 -2
  107. package/esm/_util/type.d.ts +0 -52
  108. package/esm/_util/warning.d.ts +0 -31
  109. package/esm/_util/zindexContext.d.ts +0 -3
  110. package/esm/_util/zindexContext.js +0 -6
  111. package/esm/blockHeader/index.d.ts +0 -48
  112. package/esm/blockHeader/style/index.d.ts +0 -2
  113. package/esm/button/index.d.ts +0 -10
  114. package/esm/button/style/index.d.ts +0 -2
  115. package/esm/collapsible/index.d.ts +0 -97
  116. package/esm/collapsible/style/index.d.ts +0 -1
  117. package/esm/collapsibleActionItems/index.d.ts +0 -24
  118. package/esm/collapsibleActionItems/style/index.d.ts +0 -2
  119. package/esm/flex/index.d.ts +0 -7
  120. package/esm/flex/interface.d.ts +0 -16
  121. package/esm/flex/style/index.d.ts +0 -2
  122. package/esm/flex/utils.d.ts +0 -7
  123. package/esm/formList/index.d.ts +0 -77
  124. package/esm/formList/style/index.d.ts +0 -2
  125. package/esm/index.d.ts +0 -14
  126. package/esm/overflowList/index.d.ts +0 -39
  127. package/esm/overflowList/style/index.d.ts +0 -2
  128. package/esm/resize/index.d.ts +0 -8
  129. package/esm/resizeObserver/index.d.ts +0 -45
  130. package/esm/splitter/Panel.d.ts +0 -7
  131. package/esm/splitter/SplitBar.d.ts +0 -24
  132. package/esm/splitter/Splitter.d.ts +0 -5
  133. package/esm/splitter/hooks/sizeUtil.d.ts +0 -3
  134. package/esm/splitter/hooks/useItems.d.ts +0 -14
  135. package/esm/splitter/hooks/useResizable.d.ts +0 -10
  136. package/esm/splitter/hooks/useResize.d.ts +0 -6
  137. package/esm/splitter/hooks/useSizes.d.ts +0 -4
  138. package/esm/splitter/index.d.ts +0 -8
  139. package/esm/splitter/interface.d.ts +0 -69
  140. package/esm/splitter/style/index.d.ts +0 -2
  141. package/esm/statusTag/index.d.ts +0 -28
  142. package/esm/statusTag/style/index.d.ts +0 -2
  143. package/esm/style/index.d.ts +0 -1
  144. package/lib/_util/convertToTooltipProps.d.ts +0 -4
  145. package/lib/_util/convertToTooltipProps.js +0 -21
  146. package/lib/_util/gapSize.d.ts +0 -3
  147. package/lib/_util/hooks/index.d.ts +0 -1
  148. package/lib/_util/hooks/useOrientation.d.ts +0 -2
  149. package/lib/_util/hooks/useZIndex.d.ts +0 -8
  150. package/lib/_util/hooks/useZIndex.js +0 -59
  151. package/lib/_util/index.d.ts +0 -3
  152. package/lib/_util/isNonNullable.d.ts +0 -2
  153. package/lib/_util/type.d.ts +0 -52
  154. package/lib/_util/warning.d.ts +0 -31
  155. package/lib/_util/zindexContext.d.ts +0 -3
  156. package/lib/blockHeader/index.d.ts +0 -48
  157. package/lib/blockHeader/style/index.d.ts +0 -2
  158. package/lib/button/index.d.ts +0 -10
  159. package/lib/button/style/index.d.ts +0 -2
  160. package/lib/collapsible/index.d.ts +0 -97
  161. package/lib/collapsible/style/index.d.ts +0 -1
  162. package/lib/collapsibleActionItems/index.d.ts +0 -24
  163. package/lib/collapsibleActionItems/style/index.d.ts +0 -2
  164. package/lib/flex/index.d.ts +0 -7
  165. package/lib/flex/interface.d.ts +0 -16
  166. package/lib/flex/style/index.d.ts +0 -2
  167. package/lib/flex/utils.d.ts +0 -7
  168. package/lib/formList/index.d.ts +0 -77
  169. package/lib/formList/style/index.d.ts +0 -2
  170. package/lib/index.d.ts +0 -14
  171. package/lib/overflowList/index.d.ts +0 -39
  172. package/lib/overflowList/style/index.d.ts +0 -2
  173. package/lib/resize/index.d.ts +0 -8
  174. package/lib/resizeObserver/index.d.ts +0 -45
  175. package/lib/splitter/Panel.d.ts +0 -7
  176. package/lib/splitter/SplitBar.d.ts +0 -24
  177. package/lib/splitter/Splitter.d.ts +0 -5
  178. package/lib/splitter/hooks/sizeUtil.d.ts +0 -3
  179. package/lib/splitter/hooks/useItems.d.ts +0 -14
  180. package/lib/splitter/hooks/useResizable.d.ts +0 -10
  181. package/lib/splitter/hooks/useResize.d.ts +0 -6
  182. package/lib/splitter/hooks/useSizes.d.ts +0 -4
  183. package/lib/splitter/index.d.ts +0 -8
  184. package/lib/splitter/interface.d.ts +0 -69
  185. package/lib/splitter/style/index.d.ts +0 -2
  186. package/lib/statusTag/index.d.ts +0 -28
  187. package/lib/statusTag/style/index.d.ts +0 -2
  188. package/lib/style/index.d.ts +0 -1
@@ -1,16 +0,0 @@
1
- import type React from 'react';
2
- import { SizeType } from 'antd/es/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 +0,0 @@
1
- import '../../style/index.less';
2
- import './index.less';
@@ -1,7 +0,0 @@
1
- import 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;
@@ -1,77 +0,0 @@
1
- import React, { ReactNode } from 'react';
2
- import { type FormListFieldData, type TableProps } from 'antd';
3
- import type { FormItemProps, FormListProps, RuleObject, RuleRender } from 'antd/lib/form';
4
- import type { ColumnType as TableColumnType } from 'antd/lib/table';
5
- import './style';
6
- declare type NotNullRowSelection = NonNullable<TableProps<any>['rowSelection']>;
7
- /**
8
- * Override NamePath parameters type
9
- */
10
- declare type OverrideParameters = (string | number)[];
11
- declare type RcFormInstance = Parameters<RuleRender>[0];
12
- declare type RawPanelRender = NonNullable<TableProps<any>['footer']>;
13
- /**
14
- * Override PanelRender type
15
- */
16
- declare type PanelRenderFunc = (...args: Parameters<FormListProps['children']>) => ReturnType<RawPanelRender>;
17
- /**
18
- * Form.Table 组件类型
19
- */
20
- export interface IFormTableProps
21
- /**
22
- * Support all FormListProps except children for which is re-defined in this component
23
- * and prefixCls for which is not expected to be supported
24
- */
25
- extends Pick<FormListProps, 'name' | 'rules' | 'initialValue'>,
26
- /**
27
- * Support all TableProps except
28
- * - re-define columns and re-defined rowSelection
29
- * - and pagination which is expect to be not supported in Form.Table
30
- * - and className which is renamed to tableClassName
31
- * - and rowKey, dataSource for which are defined and not allowed to be modified
32
- * - and footer, title, summary for which are re-defined to pass form's operation
33
- */
34
- Omit<TableProps<any>, 'columns' | 'rowSelection' | 'pagination' | 'className' | 'rowKey' | 'dataSource' | 'footer' | 'title' | 'summary'> {
35
- /**
36
- * 表格列的配置描述
37
- */
38
- columns?: ColumnType[] | ((...args: Parameters<FormListProps['children']>) => ColumnType[]);
39
- /**
40
- * Table 的 className
41
- */
42
- tableClassName?: TableProps<any>['className'];
43
- /**
44
- * 表格行是否可选择
45
- */
46
- rowSelection?: Omit<NotNullRowSelection, 'getCheckboxProps'> & {
47
- getCheckboxProps?: (field: FormListFieldData) => ReturnType<NonNullable<NotNullRowSelection['getCheckboxProps']>>;
48
- };
49
- title?: PanelRenderFunc;
50
- footer?: PanelRenderFunc;
51
- summary?: PanelRenderFunc;
52
- }
53
- export interface ColumnType
54
- /**
55
- * Support all FormItemProps, and re-defined `rules` and `dependencies`
56
- */
57
- extends Omit<FormItemProps, 'rules' | 'dependencies' | 'prefixCls' | 'children'>,
58
- /**
59
- * Support all TableColumnType, and re-defined `render`
60
- */
61
- Omit<TableColumnType<FormListFieldData>, 'render'> {
62
- /**
63
- * 设置依赖字段, 支持通过回调函数获取当前字段名
64
- */
65
- dependencies?: ((namePath: OverrideParameters) => FormItemProps['dependencies']) | FormItemProps['dependencies'];
66
- /**
67
- * 校验规则,设置字段的校验逻辑,支持通过回调函数获取当前字段名
68
- */
69
- rules?: (RuleObject | ((form: RcFormInstance, namePath: OverrideParameters) => RuleObject))[];
70
- /**
71
- * 渲染函数
72
- * @param formInstance 只有在设置了 `dependencies` 的情况下才有该参数
73
- */
74
- render?: (fieldData: FormListFieldData, namePath: OverrideParameters, formInstance?: RcFormInstance) => ReactNode;
75
- }
76
- export default function InternalTable({ name, rules, initialValue, ...tableProps }: IFormTableProps): React.JSX.Element;
77
- export {};
@@ -1,2 +0,0 @@
1
- import '../../style/index.less';
2
- import './index.less';
package/esm/index.d.ts DELETED
@@ -1,14 +0,0 @@
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';
@@ -1,39 +0,0 @@
1
- import React, { Component, ReactElement, ReactNode } from 'react';
2
- import './style';
3
- export declare type OverflowItem<T = Record<string, any>> = T;
4
- export interface OverflowListProps<T = Record<string, any>> {
5
- items: OverflowItem<T>[];
6
- visibleItemRenderer: (item: OverflowItem<T>, index: number) => ReactElement;
7
- overflowRenderer: (overflowItems: OverflowItem<T>[]) => ReactNode | ReactNode[];
8
- className?: string;
9
- style?: React.CSSProperties;
10
- renderMode?: 'collapse' | 'scroll';
11
- collapseFrom?: 'start' | 'end';
12
- minVisibleItems?: number;
13
- onOverflow?: (overflowItems: OverflowItem<T>[]) => void;
14
- }
15
- interface OverflowListState {
16
- visibleCount: number;
17
- isMeasuring: boolean;
18
- }
19
- declare class OverflowList<T extends object> extends Component<OverflowListProps<T>, OverflowListState> {
20
- static defaultProps: {
21
- items: never[];
22
- collapseFrom: string;
23
- minVisibleItems: number;
24
- renderMode: string;
25
- };
26
- static displayName: string;
27
- private containerRef;
28
- private overflowRef;
29
- private itemRefs;
30
- private prefixCls;
31
- constructor(props: OverflowListProps<T>);
32
- componentDidMount(): void;
33
- componentUpdate(prevProps: OverflowListProps<T>): void;
34
- private measureAndAdjust;
35
- private getOverflowItems;
36
- renderCollapse(): React.JSX.Element;
37
- render(): React.JSX.Element;
38
- }
39
- export default OverflowList;
@@ -1,2 +0,0 @@
1
- import '../../style/index.less';
2
- import './index.less';
@@ -1,8 +0,0 @@
1
- import React, { ReactNode } from 'react';
2
- export interface ResizeProps {
3
- observerEle?: HTMLElement | null;
4
- children?: ReactNode;
5
- onResize?: () => void;
6
- }
7
- declare const Resize: React.FC<ResizeProps>;
8
- export default Resize;
@@ -1,45 +0,0 @@
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 {};
@@ -1,7 +0,0 @@
1
- import React from 'react';
2
- import { 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;
@@ -1,24 +0,0 @@
1
- import React from 'react';
2
- export declare 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;
@@ -1,5 +0,0 @@
1
- import React from 'react';
2
- import type { SplitterProps } from './interface';
3
- import './style/index.less';
4
- declare const Splitter: React.FC<React.PropsWithChildren<SplitterProps>>;
5
- export default Splitter;
@@ -1,3 +0,0 @@
1
- declare type SizeUnit = number | undefined;
2
- export declare function autoPtgSizes(ptgSizes: SizeUnit[], minPtgSizes: SizeUnit[], maxPtgSizes: SizeUnit[]): number[];
3
- export {};
@@ -1,14 +0,0 @@
1
- import * as React from 'react';
2
- import type { PanelProps } from '../interface';
3
- export declare 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;
@@ -1,10 +0,0 @@
1
- import type { ShowCollapsibleIconMode } from '../SplitBar';
2
- import type { ItemType } from './useItems';
3
- export declare 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[];
@@ -1,6 +0,0 @@
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];
@@ -1,4 +0,0 @@
1
- import React from 'react';
2
- import { 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)[]>>];
@@ -1,8 +0,0 @@
1
- import Panel from './Panel';
2
- import SplitterComp from './Splitter';
3
- export type { SplitterProps } from './interface';
4
- declare type CompoundedComponent = typeof SplitterComp & {
5
- Panel: typeof Panel;
6
- };
7
- declare const Splitter: CompoundedComponent;
8
- export default Splitter;
@@ -1,69 +0,0 @@
1
- /// <reference types="react" />
2
- import { 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
- }
@@ -1,2 +0,0 @@
1
- import '../../style';
2
- import './index.less';
@@ -1,28 +0,0 @@
1
- import React, { CSSProperties, HTMLAttributes, ReactNode } from 'react';
2
- import './style';
3
- export declare const PRESET_COLOR_TYPES: readonly ["blue", "yellow", "green", "gray", "red", "purple", "cyan", "pink"];
4
- export declare const STATUS_TAG_TYPES: readonly ["default", "outline", "fill"];
5
- export declare type PresetColorType = (typeof PRESET_COLOR_TYPES)[number] | (string & {});
6
- export declare type StatusTagType = (typeof STATUS_TAG_TYPES)[number];
7
- export interface IStatusTagProps extends HTMLAttributes<HTMLDivElement> {
8
- /** 状态类型 */
9
- type?: StatusTagType;
10
- /** 是否圆角 */
11
- rounded?: boolean;
12
- /** 状态颜色(支持预设值/自定义十六进制/RGB) */
13
- color?: PresetColorType;
14
- /** 是否加载中 */
15
- loading?: boolean;
16
- /** 自定义图标 */
17
- icon?: ReactNode;
18
- /** 背景颜色(仅fill类型生效),未设置时使用color的0.15透明度 */
19
- background?: string;
20
- /** 类名 */
21
- className?: string;
22
- /** 子节点 */
23
- children?: ReactNode;
24
- /** 自定义样式 */
25
- style?: CSSProperties;
26
- }
27
- declare const StatusTag: React.FC<IStatusTagProps>;
28
- export default StatusTag;
@@ -1,2 +0,0 @@
1
- import '../../style/index.less';
2
- import './index.less';
@@ -1 +0,0 @@
1
- import './index.less';
@@ -1,4 +0,0 @@
1
- import type { ReactNode } from 'react';
2
- import { TooltipProps } from 'antd';
3
- declare const convertToTooltipProps: <P extends TooltipProps>(tooltip: P | ReactNode) => P | null;
4
- export default convertToTooltipProps;
@@ -1,21 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- var _react = require("react");
8
- var _isNonNullable = _interopRequireDefault(require("./isNonNullable"));
9
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10
- const convertToTooltipProps = tooltip => {
11
- if (!(0, _isNonNullable.default)(tooltip)) {
12
- return null;
13
- }
14
- if (typeof tooltip === 'object' && ! /*#__PURE__*/(0, _react.isValidElement)(tooltip)) {
15
- return tooltip;
16
- }
17
- return {
18
- title: tooltip
19
- };
20
- };
21
- var _default = exports.default = convertToTooltipProps;
@@ -1,3 +0,0 @@
1
- import { SizeType } from 'antd/es/config-provider/SizeContext';
2
- export declare function isPresetSize(size?: SizeType | string | number): size is SizeType;
3
- export declare function isValidGapNumber(size?: SizeType | string | number): size is number;
@@ -1 +0,0 @@
1
- export * from './useOrientation';
@@ -1,2 +0,0 @@
1
- export declare type Orientation = 'horizontal' | 'vertical';
2
- export declare const useOrientation: (orientation?: Orientation, vertical?: boolean, legacyDirection?: Orientation) => [Orientation, boolean];
@@ -1,8 +0,0 @@
1
- export declare type ZIndexContainer = 'Modal' | 'Drawer' | 'Popover' | 'Popconfirm' | 'Tooltip' | 'Tour' | 'FloatButton';
2
- export declare type ZIndexConsumer = 'SelectLike' | 'Dropdown' | 'DatePicker' | 'Menu' | 'ImagePreview';
3
- export declare const CONTAINER_MAX_OFFSET: number;
4
- export declare const containerBaseZIndexOffset: Record<ZIndexContainer, number>;
5
- export declare const consumerBaseZIndexOffset: Record<ZIndexConsumer, number>;
6
- declare type ReturnResult = [zIndex: number | undefined, contextZIndex: number];
7
- export declare const useZIndex: (componentType: ZIndexContainer | ZIndexConsumer, customZIndex?: number) => ReturnResult;
8
- export {};
@@ -1,59 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.useZIndex = exports.containerBaseZIndexOffset = exports.consumerBaseZIndexOffset = exports.CONTAINER_MAX_OFFSET = void 0;
7
- var _react = _interopRequireDefault(require("react"));
8
- var _warning = require("../warning");
9
- var _zindexContext = _interopRequireDefault(require("../zindexContext"));
10
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
- const DEFAULT_Z_INDEX_POPUP_BASE = 1000;
12
- const CONTAINER_OFFSET = 100;
13
- const CONTAINER_OFFSET_MAX_COUNT = 10;
14
- const CONTAINER_MAX_OFFSET = exports.CONTAINER_MAX_OFFSET = CONTAINER_OFFSET * CONTAINER_OFFSET_MAX_COUNT;
15
- const CONTAINER_MAX_OFFSET_WITH_CHILDREN = CONTAINER_MAX_OFFSET + CONTAINER_OFFSET;
16
- const containerBaseZIndexOffset = exports.containerBaseZIndexOffset = {
17
- Modal: CONTAINER_OFFSET,
18
- Drawer: CONTAINER_OFFSET,
19
- Popover: CONTAINER_OFFSET,
20
- Popconfirm: CONTAINER_OFFSET,
21
- Tooltip: CONTAINER_OFFSET,
22
- Tour: CONTAINER_OFFSET,
23
- FloatButton: CONTAINER_OFFSET
24
- };
25
- const consumerBaseZIndexOffset = exports.consumerBaseZIndexOffset = {
26
- SelectLike: 50,
27
- Dropdown: 50,
28
- DatePicker: 50,
29
- Menu: 50,
30
- ImagePreview: 1
31
- };
32
- const isContainerType = type => {
33
- return type in containerBaseZIndexOffset;
34
- };
35
- const useZIndex = (componentType, customZIndex) => {
36
- const zIndexPopupBase = DEFAULT_Z_INDEX_POPUP_BASE;
37
- const parentZIndex = _react.default.useContext(_zindexContext.default);
38
- const isContainer = isContainerType(componentType);
39
- let result;
40
- if (customZIndex !== undefined) {
41
- result = [customZIndex, customZIndex];
42
- } else {
43
- let zIndex = parentZIndex ?? 0;
44
- if (isContainer) {
45
- zIndex += (parentZIndex ? 0 : zIndexPopupBase) + containerBaseZIndexOffset[componentType];
46
- } else {
47
- zIndex += consumerBaseZIndexOffset[componentType];
48
- }
49
- result = [customZIndex ?? zIndex, zIndex];
50
- }
51
- if (process.env.NODE_ENV !== 'production') {
52
- const warning = (0, _warning.devUseWarning)(componentType);
53
- const maxZIndex = zIndexPopupBase + CONTAINER_MAX_OFFSET_WITH_CHILDREN;
54
- const currentZIndex = result[0] || 0;
55
- warning(customZIndex !== undefined || currentZIndex <= maxZIndex, 'usage', '`zIndex` is over design token `zIndexPopupBase` too much. It may cause unexpected override.');
56
- }
57
- return result;
58
- };
59
- exports.useZIndex = useZIndex;
@@ -1,3 +0,0 @@
1
- import { TooltipProps } from 'antd';
2
- export declare type LabelTooltipType = TooltipProps | TooltipProps['title'];
3
- export declare function toTooltipProps(tooltip: LabelTooltipType): TooltipProps | null;
@@ -1,2 +0,0 @@
1
- declare const isNonNullable: <T>(val: T) => val is NonNullable<T>;
2
- export default isNonNullable;
@@ -1,52 +0,0 @@
1
- import type React from 'react';
2
- export declare type Primitive = null | undefined | string | number | boolean | symbol | bigint;
3
- /** https://github.com/Microsoft/TypeScript/issues/29729 */
4
- export declare type LiteralUnion<T, U extends Primitive = string> = T | (U & Record<never, never>);
5
- export declare type AnyObject = Record<string, any>;
6
- export declare 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 declare 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 declare type GetProp<T extends React.ComponentType<any> | object, PropName extends keyof GetProps<T>> = NonNullable<GetProps<T>[PropName]>;
35
- declare type ReactRefComponent<Props extends {
36
- ref?: React.Ref<any> | string;
37
- }> = (props: Props) => React.ReactNode;
38
- declare 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 declare 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 declare type GetContextProps<T> = T extends React.Context<infer P> ? P : never;
51
- export declare type GetContextProp<T extends React.Context<any>, PropName extends keyof GetContextProps<T>> = NonNullable<GetContextProps<T>[PropName]>;
52
- export {};
@@ -1,31 +0,0 @@
1
- import * as React from 'react';
2
- export declare function noop(): void;
3
- export declare function resetWarned(): void;
4
- declare type Warning = (valid: boolean, component: string, message?: string) => void;
5
- declare const warning: Warning;
6
- declare 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
- declare 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;
@@ -1,3 +0,0 @@
1
- import React from 'react';
2
- declare const zIndexContext: React.Context<number | undefined>;
3
- export default zIndexContext;