@react-fabric/data 1.0.0-beta.3 → 1.0.0-beta.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/checklist/CheckList.js +143 -0
- package/dist/cjs/histogram/Histogram.js +16 -5
- package/dist/cjs/hooks/usePagination.js +7 -4
- package/dist/cjs/hooks/useSelectableList.js +54 -0
- package/dist/cjs/index.js +2 -0
- package/dist/cjs/table/BodyCell.js +38 -5
- package/dist/cjs/table/BodyRow.js +107 -0
- package/dist/cjs/table/CheckboxCell.js +1 -1
- package/dist/cjs/table/HeaderCell.js +29 -36
- package/dist/cjs/table/Table.js +104 -66
- package/dist/cjs/table/useResizer.js +4 -4
- package/dist/cjs/table/useVirtualTable.js +118 -17
- package/dist/cjs/tree/TreeNode.js +44 -24
- package/dist/cjs/tree/TreePanel.js +28 -10
- package/dist/cjs/tree/useTree.js +96 -14
- package/dist/cjs/tree/utils.js +20 -5
- package/dist/cjs/virtual/Gallery.js +41 -27
- package/dist/cjs/virtual/List.js +41 -29
- package/dist/esm/checklist/CheckList.js +143 -0
- package/dist/esm/histogram/Histogram.js +16 -5
- package/dist/esm/hooks/usePagination.js +7 -4
- package/dist/esm/hooks/useSelectableList.js +54 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/table/BodyCell.js +38 -5
- package/dist/esm/table/BodyRow.js +107 -0
- package/dist/esm/table/CheckboxCell.js +1 -1
- package/dist/esm/table/HeaderCell.js +30 -37
- package/dist/esm/table/Table.js +106 -68
- package/dist/esm/table/useResizer.js +4 -4
- package/dist/esm/table/useVirtualTable.js +120 -19
- package/dist/esm/tree/TreeNode.js +46 -26
- package/dist/esm/tree/TreePanel.js +28 -10
- package/dist/esm/tree/useTree.js +98 -16
- package/dist/esm/tree/utils.js +20 -5
- package/dist/esm/virtual/Gallery.js +41 -27
- package/dist/esm/virtual/List.js +41 -29
- package/dist/types/checklist/CheckList.d.ts +30 -0
- package/dist/types/histogram/Histogram.d.ts +3 -3
- package/dist/types/hooks/useSelectableList.d.ts +28 -0
- package/dist/types/index.d.ts +2 -1
- package/dist/types/table/AddColumn.d.ts +2 -2
- package/dist/types/table/BodyCell.d.ts +4 -3
- package/dist/types/table/BodyRow.d.ts +20 -0
- package/dist/types/table/EmptyCell.d.ts +2 -2
- package/dist/types/table/HeaderCell.d.ts +2 -2
- package/dist/types/table/Table.d.ts +1 -1
- package/dist/types/table/types.d.ts +19 -8
- package/dist/types/table/useTableColumns.d.ts +6 -6
- package/dist/types/table/useVirtualTable.d.ts +20 -5
- package/dist/types/tree/TreeNode.d.ts +1 -1
- package/dist/types/tree/TreePanel.d.ts +1 -1
- package/dist/types/tree/types.d.ts +25 -5
- package/dist/types/tree/useTree.d.ts +2 -9
- package/dist/types/tree/utils.d.ts +4 -1
- package/dist/types/virtual/Gallery.d.ts +11 -3
- package/dist/types/virtual/List.d.ts +7 -3
- package/package.json +8 -7
- package/src/checklist/CheckList.tsx +222 -0
- package/src/histogram/Histogram.tsx +9 -2
- package/src/hooks/usePagination.tsx +13 -7
- package/src/hooks/useSelectableList.ts +94 -0
- package/src/index.ts +2 -1
- package/src/table/AddColumn.tsx +2 -2
- package/src/table/BodyCell.tsx +34 -5
- package/src/table/BodyRow.tsx +143 -0
- package/src/table/CheckboxCell.tsx +1 -1
- package/src/table/EmptyCell.tsx +2 -2
- package/src/table/HeaderCell.tsx +27 -13
- package/src/table/Table.tsx +141 -73
- package/src/table/types.ts +22 -7
- package/src/table/useResizer.ts +5 -3
- package/src/table/useTableColumns.ts +7 -7
- package/src/table/useVirtualTable.ts +142 -27
- package/src/tree/TreeNode.tsx +90 -56
- package/src/tree/TreePanel.tsx +23 -3
- package/src/tree/types.ts +32 -4
- package/src/tree/useTree.ts +102 -23
- package/src/tree/utils.ts +23 -8
- package/src/virtual/Gallery.tsx +43 -32
- package/src/virtual/List.tsx +38 -25
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { type ColorType, type PaletteType } from "@react-fabric/core/dist/types/types";
|
|
2
|
+
import { type ColorType, type PaletteType, type TestProps } from "@react-fabric/core/dist/types/types";
|
|
3
3
|
interface HistogramItem {
|
|
4
4
|
id: string;
|
|
5
5
|
label: string;
|
|
@@ -7,7 +7,7 @@ interface HistogramItem {
|
|
|
7
7
|
total?: number;
|
|
8
8
|
disabled?: boolean;
|
|
9
9
|
}
|
|
10
|
-
export interface HistogramProps {
|
|
10
|
+
export interface HistogramProps extends TestProps {
|
|
11
11
|
/**
|
|
12
12
|
* histogram items list
|
|
13
13
|
*/
|
|
@@ -37,5 +37,5 @@ export interface HistogramProps {
|
|
|
37
37
|
*/
|
|
38
38
|
onClick?: (id: string, negative?: true) => void;
|
|
39
39
|
}
|
|
40
|
-
export declare const Histogram: ({ items, total, color, sortBy, emptyTitle, emptyMessage, onClick, }: HistogramProps) => import("react/jsx-runtime").JSX.Element;
|
|
40
|
+
export declare const Histogram: ({ items, total, color, sortBy, emptyTitle, emptyMessage, onClick, ...aria }: HistogramProps) => import("react/jsx-runtime").JSX.Element;
|
|
41
41
|
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export interface SelectableProps {
|
|
2
|
+
/**
|
|
3
|
+
* list items
|
|
4
|
+
*/
|
|
5
|
+
items: Array<{
|
|
6
|
+
label: string;
|
|
7
|
+
} & KeyValue>;
|
|
8
|
+
/**
|
|
9
|
+
* selected item ids
|
|
10
|
+
*/
|
|
11
|
+
selected?: string[];
|
|
12
|
+
/**
|
|
13
|
+
* selected negative item ids
|
|
14
|
+
*/
|
|
15
|
+
nonselected?: string[];
|
|
16
|
+
/**
|
|
17
|
+
* change callback
|
|
18
|
+
*/
|
|
19
|
+
onChange?: (ids: string[], nonIds?: string[]) => void;
|
|
20
|
+
/**
|
|
21
|
+
* item click callback
|
|
22
|
+
*/
|
|
23
|
+
onClick?: (id: string, isNegative: boolean) => void;
|
|
24
|
+
}
|
|
25
|
+
export declare const useSelectableList: ({ items, selected, nonselected, onChange, onClick, }: SelectableProps) => {
|
|
26
|
+
selection: KeyValue<number>;
|
|
27
|
+
toggleSelection: (id: string, isNegative?: boolean) => void;
|
|
28
|
+
};
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import "./i18n";
|
|
2
|
+
export { CheckList } from "./checklist/CheckList";
|
|
2
3
|
export { Histogram } from "./histogram/Histogram";
|
|
3
4
|
export { JsonViewer } from "./json/JsonViewer";
|
|
4
5
|
export { Pagination } from "./pagination/Pagination";
|
|
5
6
|
export { Table } from "./table/Table";
|
|
6
|
-
export { type TableRef } from "./table/types";
|
|
7
|
+
export { type TableColumn, type TableRef } from "./table/types";
|
|
7
8
|
export { TreePanel } from "./tree/TreePanel";
|
|
8
9
|
export { type TreeNodeType as TreeNode } from "./tree/types";
|
|
9
10
|
export { VirtualGallery, type VirtualGalleryRef } from "./virtual/Gallery";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type TableColumn } from "./types";
|
|
2
2
|
export declare const AddColumn: ({ columns, onClick, }: {
|
|
3
|
-
columns:
|
|
3
|
+
columns: TableColumn[];
|
|
4
4
|
onClick: (id: string) => void;
|
|
5
5
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
export declare const BodyCell: ({ column, item, }: {
|
|
3
|
-
column:
|
|
1
|
+
import { type TableColumn } from "./types";
|
|
2
|
+
export declare const BodyCell: ({ column, item, index, }: {
|
|
3
|
+
column: TableColumn;
|
|
4
4
|
item: KeyValue;
|
|
5
|
+
index: number;
|
|
5
6
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { type TableColumn } from "./types";
|
|
2
|
+
export declare const BodyRow: ({ rowKey, index, data, keyProperty, measureElement, state, hideableColumns, wrapperStart, wrapperEnd, onRowClick, checkableRows, checked, toggleChecked, canExpand, expanded, toggleExpand, expandRow, }: {
|
|
3
|
+
rowKey: Key;
|
|
4
|
+
index: number;
|
|
5
|
+
data: KeyValue;
|
|
6
|
+
keyProperty?: Key;
|
|
7
|
+
measureElement: AnyObject;
|
|
8
|
+
state: KeyValue<TableColumn[]>;
|
|
9
|
+
hideableColumns?: boolean;
|
|
10
|
+
wrapperStart: string;
|
|
11
|
+
wrapperEnd: string;
|
|
12
|
+
checkableRows?: boolean;
|
|
13
|
+
checked: 0 | 1;
|
|
14
|
+
onRowClick?: AnyObject;
|
|
15
|
+
canExpand?: AnyObject;
|
|
16
|
+
expandRow?: AnyObject;
|
|
17
|
+
expanded: boolean;
|
|
18
|
+
toggleExpand: (key: Key) => void;
|
|
19
|
+
toggleChecked: (key: Key) => void;
|
|
20
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
export declare const EmptyCell: ({ id, width: _width, maxWidth, minWidth, }:
|
|
1
|
+
import { type TableColumn } from "./types";
|
|
2
|
+
export declare const EmptyCell: ({ id, width: _width, maxWidth, minWidth, }: TableColumn) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
export declare const HeaderCell: ({ id, label, icon, iconBg, iconColor, rtlFlip, actions, locked, sortable, resizable, width: _width, maxWidth, minWidth, sort, onSort, }:
|
|
1
|
+
import { type TableColumn, type TableProps } from "./types";
|
|
2
|
+
export declare const HeaderCell: ({ id, label, icon, iconBg, iconColor, rtlFlip, actions, locked, tooltip, sortable, resizable, width: _width, maxWidth, minWidth, sort, onSort, }: TableColumn & Pick<TableProps, "sort" | "onSort">) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { type TableProps } from "./types";
|
|
2
|
-
export declare const Table: <T extends KeyValue<any> = KeyValue<any>>({ ref, data, columns, keyProperty, checkableRows, hideableColumns, sort, loading, onSort, onRowClick, onCheckedChanged, }: TableProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export declare const Table: <T extends KeyValue<any> = KeyValue<any>>({ ref, data, columns, keyProperty, groupProperty, checkableRows, initialScroll, hideableColumns, sort, loading, checked, emptyDisplay, groupRenderer, canExpand, children, onSort, onScroll, onRowClick, onCheckedChanged, }: TableProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,15 +1,17 @@
|
|
|
1
|
-
import { type CssProp, type IconProps, type RefProp, type TestProps } from "@react-fabric/core/dist/types/types";
|
|
1
|
+
import { type CssProp, type Elements, type IconProps, type RefProp, type TestProps } from "@react-fabric/core/dist/types/types";
|
|
2
2
|
import { type ReactElement } from "react";
|
|
3
3
|
export declare const COL_MIN_WIDTH = "3rem";
|
|
4
4
|
export declare const COL_MAX_WIDTH = "64rem";
|
|
5
5
|
export declare const COL_DEFAULT_WIDTH = "12rem";
|
|
6
|
-
export interface
|
|
7
|
-
id: keyof T;
|
|
6
|
+
export interface TableColumn<T = KeyValue> extends CssProp, IconProps, TestProps {
|
|
7
|
+
id: keyof T | string;
|
|
8
8
|
label?: string;
|
|
9
|
-
|
|
9
|
+
tooltip?: string;
|
|
10
|
+
actions?: ReactElement[];
|
|
10
11
|
align?: "start" | "center" | "end";
|
|
11
12
|
locked?: "start" | "end";
|
|
12
13
|
hidden?: boolean;
|
|
14
|
+
truncate?: boolean;
|
|
13
15
|
hideable?: boolean;
|
|
14
16
|
resizable?: boolean;
|
|
15
17
|
sortable?: boolean;
|
|
@@ -20,7 +22,8 @@ export interface ColumnType<T = KeyValue> extends CssProp, IconProps, TestProps
|
|
|
20
22
|
maxWidth?: string | number;
|
|
21
23
|
dataType?: "string" | "number" | "boolean" | "datetime" | "date" | "time" | "unknown";
|
|
22
24
|
format?: string;
|
|
23
|
-
|
|
25
|
+
valueMap?: KeyValue;
|
|
26
|
+
renderer?: (value: AnyObject, data: T, index: number) => Elements<AnyObject>;
|
|
24
27
|
}
|
|
25
28
|
export interface TableRef {
|
|
26
29
|
hilight: (row: number) => void;
|
|
@@ -28,14 +31,18 @@ export interface TableRef {
|
|
|
28
31
|
scrollTo: (row: number) => void;
|
|
29
32
|
}
|
|
30
33
|
export interface TableProps<T = KeyValue> extends RefProp<TableRef> {
|
|
31
|
-
columns: Array<
|
|
34
|
+
columns: Array<TableColumn<T>>;
|
|
32
35
|
data: T[];
|
|
33
|
-
keyProperty
|
|
36
|
+
keyProperty?: keyof T;
|
|
37
|
+
groupProperty?: keyof T;
|
|
38
|
+
groupRenderer?: (key: AnyObject) => ReactElement;
|
|
39
|
+
emptyDisplay?: ReactElement;
|
|
34
40
|
/**
|
|
35
41
|
* checkable rows
|
|
36
42
|
*/
|
|
43
|
+
checked?: AnyObject[];
|
|
37
44
|
checkableRows?: boolean;
|
|
38
|
-
onCheckedChanged?: (rows:
|
|
45
|
+
onCheckedChanged?: (rows: AnyObject[]) => void;
|
|
39
46
|
/**
|
|
40
47
|
* sorting
|
|
41
48
|
*/
|
|
@@ -50,4 +57,8 @@ export interface TableProps<T = KeyValue> extends RefProp<TableRef> {
|
|
|
50
57
|
loading?: boolean;
|
|
51
58
|
hideableColumns?: boolean;
|
|
52
59
|
onRowClick?: (data: T) => void;
|
|
60
|
+
initialScroll?: number;
|
|
61
|
+
onScroll?: (firstItem: number) => void;
|
|
62
|
+
canExpand?: (record: T) => boolean;
|
|
63
|
+
children?: (record: T) => Elements<AnyObject>;
|
|
53
64
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
export declare const useTableColumns: (columns:
|
|
1
|
+
import { type TableColumn } from "./types";
|
|
2
|
+
export declare const useTableColumns: (columns: TableColumn[]) => {
|
|
3
3
|
state: {
|
|
4
|
-
start:
|
|
5
|
-
end:
|
|
6
|
-
cols:
|
|
7
|
-
columns:
|
|
4
|
+
start: TableColumn<KeyValue<any>>[];
|
|
5
|
+
end: TableColumn<KeyValue<any>>[];
|
|
6
|
+
cols: TableColumn<KeyValue<any>>[];
|
|
7
|
+
columns: TableColumn[];
|
|
8
8
|
};
|
|
9
9
|
onHide: (id: string) => void;
|
|
10
10
|
};
|
|
@@ -1,15 +1,30 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
interface DataState {
|
|
3
|
-
|
|
2
|
+
interface DataState<T = KeyValue> {
|
|
3
|
+
items: T[];
|
|
4
|
+
grouped: KeyValue<T[]>;
|
|
5
|
+
groups: AnyObject[];
|
|
6
|
+
expanded: AnyObject[];
|
|
7
|
+
checked: AnyObject[];
|
|
4
8
|
allChecked: 0 | 1 | 2;
|
|
5
9
|
}
|
|
6
|
-
export declare const useVirtualTable:
|
|
10
|
+
export declare const useVirtualTable: <T extends KeyValue<any> = KeyValue<any>>(data: T[], options: {
|
|
11
|
+
checked?: AnyObject[];
|
|
12
|
+
keyProperty: keyof T;
|
|
13
|
+
groupProperty?: keyof T;
|
|
14
|
+
onCheckChanged?: (checked: AnyObject[]) => void;
|
|
15
|
+
}) => {
|
|
7
16
|
scrollerRef: import("react").RefObject<HTMLDivElement>;
|
|
8
17
|
items: import("@tanstack/virtual-core").VirtualItem<Element>[];
|
|
9
|
-
checkState: DataState
|
|
10
|
-
getData: (index: number) =>
|
|
18
|
+
checkState: DataState<T>;
|
|
19
|
+
getData: (index: number) => T;
|
|
20
|
+
virtualizer: import("@tanstack/virtual-core").Virtualizer<HTMLDivElement, Element>;
|
|
21
|
+
hasActiveSticky: boolean;
|
|
22
|
+
isActiveSticky: (index: number) => boolean;
|
|
23
|
+
top: number | undefined;
|
|
11
24
|
totalSize: () => number;
|
|
12
25
|
measureElement: (node: Element | null | undefined) => void;
|
|
26
|
+
toggleGroupExpand: (key: Key) => void;
|
|
27
|
+
toggleExpand: (key: Key) => void;
|
|
13
28
|
toggleChecked: (key: Key) => void;
|
|
14
29
|
toggleAllChecked: () => void;
|
|
15
30
|
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { type TreeNodeProps } from "./types";
|
|
2
|
-
export declare const TreeNode: ({ node, noLines, expanders, checkable, selectable, defaultLeafIcon, defaultNodeIcon, onToggle, onSelect, onChecked, children, }: TreeNodeProps) => import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export declare const TreeNode: ({ node, noLines, expanders, checkable, selectable, defaultLeafIcon, defaultNodeIcon, onToggle, onClick, onSelect, onChecked, children, leafClassName, nodeClassName, }: TreeNodeProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { type TreePanelProps } from "./types";
|
|
2
|
-
export declare const TreePanel: <T extends KeyValue<any>>({ ref, items, selected, checked, checkable, noLines, renderer, searchable, selectable, matcher, filterPlaceholder, defaultLeafIcon, defaultNodeIcon, expander, onChecked, onLoad, onSelect, ...aria }: TreePanelProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export declare const TreePanel: <T extends KeyValue<any>>({ ref, items, selected, checked, checkable, noLines, renderer, searchable, selectable, matcher, filterPlaceholder, defaultLeafIcon, defaultNodeIcon, expander, onChecked, onLoad, onQuery, onSelect, onClick, sorter, makeLabel, makeIcon, defaultExpanded, onExpandToggle, leafClassName, nodeClassName, ...aria }: TreePanelProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { type BadgeType, type ChildProp, type CssProp, type Elements, type IconProps, type RefProp, type TestProps } from "@react-fabric/core/dist/types/types";
|
|
3
|
-
|
|
2
|
+
import { type ElementType } from "react";
|
|
3
|
+
interface TreeBaseNode<T> extends Omit<IconProps, "icon">, CssProp, TestProps {
|
|
4
4
|
id: string;
|
|
5
5
|
/**
|
|
6
6
|
* display label
|
|
@@ -23,17 +23,18 @@ interface TreeBaseNode<T> extends IconProps, CssProp, TestProps {
|
|
|
23
23
|
*/
|
|
24
24
|
disabled?: boolean;
|
|
25
25
|
data?: T;
|
|
26
|
+
icon?: ElementType<IconProps> | string;
|
|
26
27
|
}
|
|
27
28
|
export type TreeNodeType<T extends KeyValue = KeyValue> = TreeBaseNode<T> & ({
|
|
28
29
|
leaf: true;
|
|
29
30
|
children?: never;
|
|
30
31
|
} | {
|
|
31
|
-
leaf?:
|
|
32
|
+
leaf?: boolean;
|
|
32
33
|
children?: Array<TreeNodeType<T>>;
|
|
33
34
|
open?: boolean;
|
|
34
35
|
iconOpen?: string;
|
|
35
36
|
});
|
|
36
|
-
export interface InternalNode extends IconProps, CssProp, TestProps {
|
|
37
|
+
export interface InternalNode extends Omit<IconProps, "icon">, CssProp, TestProps {
|
|
37
38
|
id: string;
|
|
38
39
|
label: Elements<JSX.Element>;
|
|
39
40
|
queryable?: string;
|
|
@@ -50,6 +51,7 @@ export interface InternalNode extends IconProps, CssProp, TestProps {
|
|
|
50
51
|
loaded: boolean;
|
|
51
52
|
parent?: string;
|
|
52
53
|
empty?: boolean;
|
|
54
|
+
icon?: ElementType<IconProps> | string;
|
|
53
55
|
errored?: string;
|
|
54
56
|
selected?: true;
|
|
55
57
|
childSelected?: true;
|
|
@@ -66,9 +68,12 @@ export interface TreeNodeProps extends ChildProp {
|
|
|
66
68
|
noLines?: boolean;
|
|
67
69
|
selectable?: true | "leafOnly";
|
|
68
70
|
checkable?: true | "leafOnly";
|
|
71
|
+
leafClassName?: string;
|
|
72
|
+
nodeClassName?: string;
|
|
69
73
|
onToggle: (id: string) => void;
|
|
70
74
|
onSelect: (id: string) => void;
|
|
71
75
|
onChecked: (id: string) => void;
|
|
76
|
+
onClick?: (id: string, node: any) => void;
|
|
72
77
|
}
|
|
73
78
|
export interface TreeRef {
|
|
74
79
|
select: (id: string) => void;
|
|
@@ -120,10 +125,18 @@ export interface TreePanelProps<T extends KeyValue = KeyValue> extends TestProps
|
|
|
120
125
|
* callback for lazy loading tree items
|
|
121
126
|
*/
|
|
122
127
|
onLoad?: (id: string) => Promise<Array<TreeNodeType<T>> | undefined> | Array<TreeNodeType<T>> | undefined;
|
|
128
|
+
/**
|
|
129
|
+
* callback to load tree using search query
|
|
130
|
+
*/
|
|
131
|
+
onQuery?: (query: string) => void;
|
|
132
|
+
/**
|
|
133
|
+
* callback on click of tree node
|
|
134
|
+
*/
|
|
135
|
+
onClick?: (id: string, data: T) => void;
|
|
123
136
|
/**
|
|
124
137
|
* callback on selection of tree node
|
|
125
138
|
*/
|
|
126
|
-
onSelect?: (id: string) => void;
|
|
139
|
+
onSelect?: (id: string, data: T) => void;
|
|
127
140
|
/**
|
|
128
141
|
* callback on change of checked list
|
|
129
142
|
*/
|
|
@@ -136,6 +149,13 @@ export interface TreePanelProps<T extends KeyValue = KeyValue> extends TestProps
|
|
|
136
149
|
* item filter matcher
|
|
137
150
|
*/
|
|
138
151
|
matcher?: (data: T, query: string) => boolean;
|
|
152
|
+
sorter?: false | ((a: T, b: T) => number);
|
|
153
|
+
makeLabel?: (node: T) => string;
|
|
154
|
+
makeIcon?: (node: T) => string;
|
|
155
|
+
defaultExpanded?: string[];
|
|
156
|
+
onExpandToggle?: (id: string[]) => void;
|
|
157
|
+
leafClassName?: string;
|
|
158
|
+
nodeClassName?: string;
|
|
139
159
|
}
|
|
140
160
|
export declare const iconExpandAll = "M12.984 9v6h3l-3.984 3.984-3.984-3.984h3v-6h-3l3.984-3.984 3.984 3.984h-3zM3.984 2.016h16.031v1.969h-16.031v-1.969zM3.984 20.016h16.031v1.969h-16.031v-1.969z";
|
|
141
161
|
export declare const iconCollapseAll = "M3.984 11.016h16.031v1.969h-16.031v-1.969zM15.984 5.016l-3.984 3.984-3.984-3.984h3v-4.031h1.969v4.031h3zM8.016 18.984l3.984-3.984 3.984 3.984h-3v4.031h-1.969v-4.031h-3z";
|
|
@@ -1,12 +1,5 @@
|
|
|
1
|
-
import { type InternalNode, type
|
|
2
|
-
export declare const useTree: <T extends KeyValue<any>>({ items, checked, selected, matcher, onSelect, onChecked, }: {
|
|
3
|
-
items?: Array<TreeNodeType<T>>;
|
|
4
|
-
selected?: string;
|
|
5
|
-
checked?: string[];
|
|
6
|
-
onSelect?: (id: string) => void;
|
|
7
|
-
onChecked?: (leafs: string[], nodes: string[]) => void;
|
|
8
|
-
matcher?: (data: T, query: string) => boolean;
|
|
9
|
-
}) => {
|
|
1
|
+
import { type InternalNode, type TreePanelProps } from "./types";
|
|
2
|
+
export declare const useTree: <T extends KeyValue<any>>({ items, checked, selected, sorter, matcher, onLoad, onQuery, onSelect, onChecked, defaultExpanded, onExpandToggle, }: Partial<TreePanelProps<T>>) => {
|
|
10
3
|
tree: InternalNode[];
|
|
11
4
|
toggleExpand: (id: string) => void;
|
|
12
5
|
expandAll: () => void;
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { type InternalNode, type TreeNodeType } from "./types";
|
|
2
|
-
export declare const refactorTree: (nodes: TreeNodeType[],
|
|
2
|
+
export declare const refactorTree: (nodes: TreeNodeType[], { sorter, defaultExpanded, }: {
|
|
3
|
+
sorter?: any;
|
|
4
|
+
defaultExpanded?: string[];
|
|
5
|
+
}, options?: {
|
|
3
6
|
level: number;
|
|
4
7
|
parent?: string;
|
|
5
8
|
}) => InternalNode[];
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
+
import { type TestProps } from "@react-fabric/core/dist/types/types";
|
|
1
2
|
import { type ReactElement, type Ref } from "react";
|
|
2
3
|
export interface VirtualGalleryRef {
|
|
3
4
|
scrollToItem: (index: number) => void;
|
|
4
5
|
hilight: (index: number) => void;
|
|
5
6
|
unhilight: () => void;
|
|
6
7
|
}
|
|
7
|
-
export interface VirtualGalleryProps<T> {
|
|
8
|
+
export interface VirtualGalleryProps<T> extends TestProps {
|
|
8
9
|
children: (props: {
|
|
9
|
-
|
|
10
|
+
item: T;
|
|
10
11
|
index: number;
|
|
11
12
|
isLast: boolean;
|
|
12
13
|
}) => ReactElement;
|
|
@@ -23,6 +24,12 @@ export interface VirtualGalleryProps<T> {
|
|
|
23
24
|
* default item width
|
|
24
25
|
*/
|
|
25
26
|
defaultWidth?: number;
|
|
27
|
+
/**
|
|
28
|
+
* full width list
|
|
29
|
+
*/
|
|
30
|
+
fullWidth?: boolean;
|
|
31
|
+
maxWidth?: string | number;
|
|
32
|
+
minWidth?: string | number;
|
|
26
33
|
/**
|
|
27
34
|
* padding
|
|
28
35
|
*/
|
|
@@ -31,6 +38,7 @@ export interface VirtualGalleryProps<T> {
|
|
|
31
38
|
* data list
|
|
32
39
|
*/
|
|
33
40
|
items: T[];
|
|
41
|
+
total?: number;
|
|
34
42
|
/**
|
|
35
43
|
* loading state
|
|
36
44
|
*/
|
|
@@ -50,6 +58,6 @@ export interface VirtualGalleryProps<T> {
|
|
|
50
58
|
onScroll?: (top: number) => void;
|
|
51
59
|
}
|
|
52
60
|
export declare const VirtualGallery: {
|
|
53
|
-
<T extends KeyValue<any>>({ items, children, columns, padding, defaultHeight: height, defaultWidth: width, hideScroller, initialScroll, loading, onLoadMore, onScroll, galleryRef, }: VirtualGalleryProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
61
|
+
<T extends KeyValue<any>>({ items, children, columns, fullWidth, maxWidth, minWidth, total, padding, defaultHeight: height, defaultWidth: width, hideScroller, initialScroll, loading, onLoadMore, onScroll, galleryRef, ...aria }: VirtualGalleryProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
54
62
|
displayName: string;
|
|
55
63
|
};
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
+
import { type TestProps } from "@react-fabric/core/dist/types/types";
|
|
1
2
|
import { type ReactElement, type Ref } from "react";
|
|
2
3
|
export interface VirtualListRef {
|
|
3
4
|
scrollToItem: (index: number) => void;
|
|
4
5
|
hilight: (index: number) => void;
|
|
5
6
|
unhilight: () => void;
|
|
6
7
|
}
|
|
7
|
-
export interface VirtualListProps<T> {
|
|
8
|
+
export interface VirtualListProps<T> extends TestProps {
|
|
8
9
|
children: (props: {
|
|
9
|
-
|
|
10
|
+
item: T;
|
|
10
11
|
index: number;
|
|
11
12
|
isLast: boolean;
|
|
12
13
|
}) => ReactElement;
|
|
@@ -23,6 +24,8 @@ export interface VirtualListProps<T> {
|
|
|
23
24
|
* full width list
|
|
24
25
|
*/
|
|
25
26
|
fullWidth?: boolean;
|
|
27
|
+
maxWidth?: string | number;
|
|
28
|
+
minWidth?: string | number;
|
|
26
29
|
/**
|
|
27
30
|
* padding
|
|
28
31
|
*/
|
|
@@ -35,6 +38,7 @@ export interface VirtualListProps<T> {
|
|
|
35
38
|
* data list
|
|
36
39
|
*/
|
|
37
40
|
items: T[];
|
|
41
|
+
total?: number;
|
|
38
42
|
initialScroll?: number;
|
|
39
43
|
/**
|
|
40
44
|
* loading state
|
|
@@ -54,6 +58,6 @@ export interface VirtualListProps<T> {
|
|
|
54
58
|
onScroll?: (top: number) => void;
|
|
55
59
|
}
|
|
56
60
|
export declare const VirtualList: {
|
|
57
|
-
<T extends KeyValue<any>>({ items, children, fullWidth, padding, orientation, defaultHeight: height, defaultWidth: width, hideScroller, initialScroll, loading, onLoadMore, onScroll, listRef, }: VirtualListProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
61
|
+
<T extends KeyValue<any>>({ items, total, children, fullWidth, maxWidth, minWidth, padding, orientation, defaultHeight: height, defaultWidth: width, hideScroller, initialScroll, loading, onLoadMore, onScroll, listRef, ...aria }: VirtualListProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
58
62
|
displayName: string;
|
|
59
63
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-fabric/data",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.30",
|
|
4
4
|
"description": "RUF: Data package",
|
|
5
5
|
"author": "Adarsh Pastakia <adarshpastakia@outlook.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -33,9 +33,10 @@
|
|
|
33
33
|
"watch": "npm-run-all -p watch:rollup watch:dts"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@react-fabric/core": "^1.0.0-beta.
|
|
37
|
-
"@react-fabric/
|
|
38
|
-
"@react-fabric/
|
|
36
|
+
"@react-fabric/core": "^1.0.0-beta.30",
|
|
37
|
+
"@react-fabric/date": "^1.0.0-beta.30",
|
|
38
|
+
"@react-fabric/form": "^1.0.0-beta.30",
|
|
39
|
+
"@react-fabric/utilities": "^1.0.0-beta.30",
|
|
39
40
|
"@tanstack/react-virtual": "^3.8.6",
|
|
40
41
|
"classnames": "^2.5.1",
|
|
41
42
|
"color": "^4.2.3",
|
|
@@ -43,13 +44,13 @@
|
|
|
43
44
|
},
|
|
44
45
|
"peerDependencies": {
|
|
45
46
|
"i18next": "^23.15.1",
|
|
46
|
-
"react": "
|
|
47
|
-
"react-dom": "
|
|
47
|
+
"react": "^19.0.0",
|
|
48
|
+
"react-dom": "^19.0.0",
|
|
48
49
|
"react-i18next": "^15.0.2"
|
|
49
50
|
},
|
|
50
51
|
"engines": {
|
|
51
52
|
"node": ">=18.12.0",
|
|
52
53
|
"npm": ">=8.19.0"
|
|
53
54
|
},
|
|
54
|
-
"gitHead": "
|
|
55
|
+
"gitHead": "5b10298b7627c2e56bcccf18100b6d85a02c9b06"
|
|
55
56
|
}
|