@react-fabric/data 1.0.0-beta.62 → 1.0.0-beta.63
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 +1 -1
- package/dist/cjs/histogram/Histogram.js +1 -1
- package/dist/cjs/json/JsonViewer.js +8 -8
- package/dist/cjs/pagination/Pagination.js +1 -1
- package/dist/cjs/table/BodyCell.js +2 -2
- package/dist/cjs/table/EmptyCell.js +2 -2
- package/dist/cjs/table/HeaderCell.js +6 -6
- package/dist/cjs/table/{Context.js → Provider.js} +2 -6
- package/dist/cjs/table/Table.js +4 -4
- package/dist/cjs/table/context.js +34 -0
- package/dist/cjs/table/useResizer.js +6 -4
- package/dist/cjs/tree/utils.js +13 -15
- package/dist/cjs/virtual/Gallery.js +2 -2
- package/dist/cjs/virtual/List.js +3 -3
- package/dist/esm/checklist/CheckList.js +1 -1
- package/dist/esm/histogram/Histogram.js +1 -1
- package/dist/esm/json/JsonViewer.js +8 -8
- package/dist/esm/pagination/Pagination.js +1 -1
- package/dist/esm/table/BodyCell.js +1 -1
- package/dist/esm/table/EmptyCell.js +1 -1
- package/dist/esm/table/HeaderCell.js +5 -5
- package/dist/esm/table/{Context.js → Provider.js} +3 -6
- package/dist/esm/table/Table.js +3 -3
- package/dist/esm/table/context.js +33 -0
- package/dist/esm/table/useResizer.js +6 -4
- package/dist/esm/tree/useTree.js +12 -12
- package/dist/esm/tree/utils.js +11 -13
- package/dist/esm/virtual/Gallery.js +2 -2
- package/dist/esm/virtual/List.js +3 -3
- package/dist/types/checklist/CheckList.d.ts +1 -1
- package/dist/types/histogram/Histogram.d.ts +3 -3
- package/dist/types/json/JsonViewer.d.ts +2 -2
- package/dist/types/pagination/Pagination.d.ts +1 -1
- package/dist/types/table/BodyCell.d.ts +1 -1
- package/dist/types/table/EmptyCell.d.ts +1 -1
- package/dist/types/table/{Context.d.ts → Provider.d.ts} +0 -6
- package/dist/types/table/Table.d.ts +1 -1
- package/dist/types/table/context.d.ts +7 -0
- package/dist/types/table/useVirtualTable.d.ts +1 -1
- package/dist/types/tree/TreePanel.d.ts +1 -1
- package/dist/types/tree/types.d.ts +6 -6
- package/dist/types/virtual/Gallery.d.ts +1 -1
- package/dist/types/virtual/List.d.ts +1 -1
- package/package.json +13 -14
- package/src/checklist/CheckList.tsx +1 -1
- package/src/histogram/Histogram.tsx +3 -3
- package/src/json/JsonViewer.tsx +2 -2
- package/src/pagination/Pagination.tsx +1 -1
- package/src/table/BodyCell.tsx +6 -31
- package/src/table/EmptyCell.tsx +4 -17
- package/src/table/HeaderCell.tsx +9 -41
- package/src/table/{Context.tsx → Provider.tsx} +3 -20
- package/src/table/Table.tsx +4 -4
- package/src/table/context.ts +33 -0
- package/src/table/useResizer.ts +6 -4
- package/src/tree/TreePanel.tsx +1 -1
- package/src/tree/types.ts +6 -6
- package/src/virtual/Gallery.tsx +2 -2
- package/src/virtual/List.tsx +3 -3
package/src/table/BodyCell.tsx
CHANGED
|
@@ -22,38 +22,16 @@
|
|
|
22
22
|
*/
|
|
23
23
|
|
|
24
24
|
import { DateDisplay } from "@react-fabric/date";
|
|
25
|
-
import {
|
|
26
|
-
Format,
|
|
27
|
-
getByPath,
|
|
28
|
-
isArray,
|
|
29
|
-
isObject,
|
|
30
|
-
isTrue,
|
|
31
|
-
} from "@react-fabric/utilities";
|
|
25
|
+
import { Format, getByPath, isArray, isObject, isTrue } from "@react-fabric/utilities";
|
|
32
26
|
import classNames from "classnames";
|
|
33
27
|
import { useMemo } from "react";
|
|
34
|
-
import { useTableContext } from "./
|
|
35
|
-
import {
|
|
36
|
-
COL_DEFAULT_WIDTH,
|
|
37
|
-
COL_MAX_WIDTH,
|
|
38
|
-
COL_MIN_WIDTH,
|
|
39
|
-
type TableColumn,
|
|
40
|
-
} from "./types";
|
|
28
|
+
import { useTableContext } from "./context";
|
|
29
|
+
import { COL_DEFAULT_WIDTH, COL_MAX_WIDTH, COL_MIN_WIDTH, type TableColumn } from "./types";
|
|
41
30
|
|
|
42
|
-
export const BodyCell = ({
|
|
43
|
-
column,
|
|
44
|
-
item,
|
|
45
|
-
index,
|
|
46
|
-
}: {
|
|
47
|
-
column: TableColumn;
|
|
48
|
-
item: KeyValue;
|
|
49
|
-
index: number;
|
|
50
|
-
}) => {
|
|
31
|
+
export const BodyCell = ({ column, item, index }: { column: TableColumn; item: KeyValue; index: number }) => {
|
|
51
32
|
const { widths } = useTableContext();
|
|
52
33
|
|
|
53
|
-
const width = useMemo(
|
|
54
|
-
() => widths.get(column.id.toString()) ?? column.width,
|
|
55
|
-
[widths, column],
|
|
56
|
-
);
|
|
34
|
+
const width = useMemo(() => widths.get(column.id.toString()) ?? column.width, [widths, column]);
|
|
57
35
|
|
|
58
36
|
const content = useMemo(() => {
|
|
59
37
|
const value = getByPath(item, column.id.toString());
|
|
@@ -65,10 +43,7 @@ export const BodyCell = ({
|
|
|
65
43
|
return map[`${isTrue(value) ? "true" : "false"}`];
|
|
66
44
|
}
|
|
67
45
|
if (column.valueMap != null) {
|
|
68
|
-
if (
|
|
69
|
-
["number", "string"].includes(column.dataType ?? "string") &&
|
|
70
|
-
value in column.valueMap
|
|
71
|
-
) {
|
|
46
|
+
if (["number", "string"].includes(column.dataType ?? "string") && value in column.valueMap) {
|
|
72
47
|
return column.valueMap[value];
|
|
73
48
|
}
|
|
74
49
|
}
|
package/src/table/EmptyCell.tsx
CHANGED
|
@@ -22,26 +22,13 @@
|
|
|
22
22
|
*/
|
|
23
23
|
|
|
24
24
|
import { useMemo } from "react";
|
|
25
|
-
import { useTableContext } from "./
|
|
26
|
-
import {
|
|
27
|
-
COL_DEFAULT_WIDTH,
|
|
28
|
-
COL_MAX_WIDTH,
|
|
29
|
-
COL_MIN_WIDTH,
|
|
30
|
-
type TableColumn,
|
|
31
|
-
} from "./types";
|
|
25
|
+
import { useTableContext } from "./context";
|
|
26
|
+
import { COL_DEFAULT_WIDTH, COL_MAX_WIDTH, COL_MIN_WIDTH, type TableColumn } from "./types";
|
|
32
27
|
|
|
33
|
-
export const EmptyCell = ({
|
|
34
|
-
id,
|
|
35
|
-
width: _width,
|
|
36
|
-
maxWidth,
|
|
37
|
-
minWidth,
|
|
38
|
-
}: TableColumn) => {
|
|
28
|
+
export const EmptyCell = ({ id, width: _width, maxWidth, minWidth }: TableColumn) => {
|
|
39
29
|
const { widths } = useTableContext();
|
|
40
30
|
|
|
41
|
-
const width = useMemo(
|
|
42
|
-
() => widths.get(id.toString()) ?? _width,
|
|
43
|
-
[widths, id, _width],
|
|
44
|
-
);
|
|
31
|
+
const width = useMemo(() => widths.get(id.toString()) ?? _width, [widths, id, _width]);
|
|
45
32
|
|
|
46
33
|
return (
|
|
47
34
|
<div
|
package/src/table/HeaderCell.tsx
CHANGED
|
@@ -21,27 +21,12 @@
|
|
|
21
21
|
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
22
22
|
*/
|
|
23
23
|
|
|
24
|
-
import {
|
|
25
|
-
Button,
|
|
26
|
-
Divider,
|
|
27
|
-
DropdownTool,
|
|
28
|
-
getIconProps,
|
|
29
|
-
Icon,
|
|
30
|
-
Menu,
|
|
31
|
-
MenuItem,
|
|
32
|
-
Tooltip,
|
|
33
|
-
} from "@react-fabric/core";
|
|
24
|
+
import { Button, Divider, DropdownTool, getIconProps, Icon, Menu, MenuItem, Tooltip } from "@react-fabric/core";
|
|
34
25
|
import { isEmpty } from "@react-fabric/utilities";
|
|
35
26
|
import { useCallback, useMemo } from "react";
|
|
36
27
|
import { ColumnFilters } from "./ColumnFilters";
|
|
37
|
-
import { useTableContext } from "./
|
|
38
|
-
import {
|
|
39
|
-
COL_DEFAULT_WIDTH,
|
|
40
|
-
COL_MAX_WIDTH,
|
|
41
|
-
COL_MIN_WIDTH,
|
|
42
|
-
type TableColumn,
|
|
43
|
-
type TableProps,
|
|
44
|
-
} from "./types";
|
|
28
|
+
import { useTableContext } from "./context";
|
|
29
|
+
import { COL_DEFAULT_WIDTH, COL_MAX_WIDTH, COL_MIN_WIDTH, type TableColumn, type TableProps } from "./types";
|
|
45
30
|
|
|
46
31
|
export const HeaderCell = ({
|
|
47
32
|
id,
|
|
@@ -66,18 +51,14 @@ export const HeaderCell = ({
|
|
|
66
51
|
}: TableColumn & Pick<TableProps, "sort" | "onSort" | "onFilter">) => {
|
|
67
52
|
const { startResize, widths } = useTableContext();
|
|
68
53
|
|
|
69
|
-
const width = useMemo(
|
|
70
|
-
() => widths.get(id.toString()) ?? _width,
|
|
71
|
-
[widths, _width, id],
|
|
72
|
-
);
|
|
54
|
+
const width = useMemo(() => widths.get(id.toString()) ?? _width, [widths, _width, id]);
|
|
73
55
|
|
|
74
56
|
const handleSort = useCallback(
|
|
75
57
|
(order?: "asc" | "desc") => {
|
|
76
58
|
sortable &&
|
|
77
59
|
onSort?.({
|
|
78
60
|
id: id.toString(),
|
|
79
|
-
order:
|
|
80
|
-
order ?? (sort?.id === id && sort.order === "asc" ? "desc" : "asc"),
|
|
61
|
+
order: order ?? (sort?.id === id && sort.order === "asc" ? "desc" : "asc"),
|
|
81
62
|
});
|
|
82
63
|
},
|
|
83
64
|
[onSort, sort, sortable],
|
|
@@ -87,12 +68,7 @@ export const HeaderCell = ({
|
|
|
87
68
|
let ret = [];
|
|
88
69
|
if (filterable && (dataType ?? filterOptions)) {
|
|
89
70
|
ret.push(
|
|
90
|
-
<Menu
|
|
91
|
-
key="filters"
|
|
92
|
-
label="Filter"
|
|
93
|
-
icon={filter ? "icon-[mdi--check]" : ""}
|
|
94
|
-
trigger="click"
|
|
95
|
-
>
|
|
71
|
+
<Menu key="filters" label="Filter" icon={filter ? "icon-[mdi--check]" : ""} trigger="click">
|
|
96
72
|
<ColumnFilters
|
|
97
73
|
type={dataType}
|
|
98
74
|
list={filterOptions}
|
|
@@ -104,12 +80,7 @@ export const HeaderCell = ({
|
|
|
104
80
|
}
|
|
105
81
|
if (sortable) {
|
|
106
82
|
ret.push(
|
|
107
|
-
<MenuItem
|
|
108
|
-
key="sort-asc"
|
|
109
|
-
label="Sort ascending"
|
|
110
|
-
icon="icon-[mdi--sort-ascending]"
|
|
111
|
-
onClick={() => handleSort("asc")}
|
|
112
|
-
/>,
|
|
83
|
+
<MenuItem key="sort-asc" label="Sort ascending" icon="icon-[mdi--sort-ascending]" onClick={() => handleSort("asc")} />,
|
|
113
84
|
<MenuItem
|
|
114
85
|
key="sort-desc"
|
|
115
86
|
label="Sort descending"
|
|
@@ -149,7 +120,7 @@ export const HeaderCell = ({
|
|
|
149
120
|
}}
|
|
150
121
|
>
|
|
151
122
|
<Tooltip content={tooltip ?? label} disabled={!(tooltip ?? label)}>
|
|
152
|
-
<div className="flex-initial px-2 py-1 text-sm truncate sticky
|
|
123
|
+
<div className="flex-initial px-2 py-1 text-sm truncate sticky inset-s-0">
|
|
153
124
|
{icon && <Icon {...getIconProps(icon)} />}
|
|
154
125
|
<span>{label ?? " "}</span>
|
|
155
126
|
</div>
|
|
@@ -180,10 +151,7 @@ export const HeaderCell = ({
|
|
|
180
151
|
<div
|
|
181
152
|
role="none"
|
|
182
153
|
className="cursor-col-resize border-e bg-transparent border-tint-200 w-[5px] self-stretch"
|
|
183
|
-
onMouseDown={(e) =>
|
|
184
|
-
e.currentTarget.parentElement &&
|
|
185
|
-
startResize(e.currentTarget.parentElement)
|
|
186
|
-
}
|
|
154
|
+
onMouseDown={(e) => e.currentTarget.parentElement && startResize(e.currentTarget.parentElement)}
|
|
187
155
|
/>
|
|
188
156
|
)}
|
|
189
157
|
</div>
|
|
@@ -22,22 +22,10 @@
|
|
|
22
22
|
*/
|
|
23
23
|
|
|
24
24
|
import { type ChildrenProp } from "@react-fabric/core/dist/types/types";
|
|
25
|
-
import {
|
|
26
|
-
|
|
27
|
-
useCallback,
|
|
28
|
-
useContext,
|
|
29
|
-
useRef,
|
|
30
|
-
useState,
|
|
31
|
-
} from "react";
|
|
25
|
+
import { useCallback, useRef, useState } from "react";
|
|
26
|
+
import { TableContext } from "./context";
|
|
32
27
|
import { useResizer } from "./useResizer";
|
|
33
28
|
|
|
34
|
-
interface Context {
|
|
35
|
-
widths: Map<string, number>;
|
|
36
|
-
startResize: (col: HTMLElement) => void;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
const TableContext = createContext<Context>({} as Context);
|
|
40
|
-
|
|
41
29
|
export const TableProvider = ({ children }: ChildrenProp) => {
|
|
42
30
|
const ghostRef = useRef<HTMLDivElement>(null);
|
|
43
31
|
const [widths, setWidths] = useState<Map<string, number>>(new Map());
|
|
@@ -57,14 +45,9 @@ export const TableProvider = ({ children }: ChildrenProp) => {
|
|
|
57
45
|
<TableContext.Provider value={{ startResize, widths }}>
|
|
58
46
|
{children}
|
|
59
47
|
|
|
60
|
-
<div
|
|
61
|
-
className="absolute inset-0 hidden z-20 cursor-col-resize"
|
|
62
|
-
ref={ghostRef}
|
|
63
|
-
>
|
|
48
|
+
<div className="absolute inset-0 hidden z-20 cursor-col-resize" ref={ghostRef}>
|
|
64
49
|
<div className="absolute inset-y-0 bg-muted opacity-50 border-primary border-e-2" />
|
|
65
50
|
</div>
|
|
66
51
|
</TableContext.Provider>
|
|
67
52
|
);
|
|
68
53
|
};
|
|
69
|
-
|
|
70
|
-
export const useTableContext = () => useContext(TableContext);
|
package/src/table/Table.tsx
CHANGED
|
@@ -40,7 +40,7 @@ import { useTranslation } from "react-i18next";
|
|
|
40
40
|
import { AddColumn } from "./AddColumn";
|
|
41
41
|
import { BodyRow } from "./BodyRow";
|
|
42
42
|
import { CheckboxCell } from "./CheckboxCell";
|
|
43
|
-
import { TableProvider } from "./
|
|
43
|
+
import { TableProvider } from "./Provider";
|
|
44
44
|
import { EmptyCell } from "./EmptyCell";
|
|
45
45
|
import { HeaderCell } from "./HeaderCell";
|
|
46
46
|
import { type TableProps } from "./types";
|
|
@@ -55,7 +55,7 @@ import { useVirtualTable } from "./useVirtualTable";
|
|
|
55
55
|
* Uses TanStack's `useVirtual` for virtualization and React's `useMemo` for performance optimization.
|
|
56
56
|
*
|
|
57
57
|
* @param {TableProps<T>} props - The properties for the Table component.
|
|
58
|
-
* @returns {
|
|
58
|
+
* @returns {React.ReactElement} The rendered Table component.
|
|
59
59
|
*
|
|
60
60
|
* @see {@link https://adarshpastakia.github.io/react-fabric/?path=/story/data-table--table}
|
|
61
61
|
* @see {@link https://tanstack.com/table/v8/docs/api/virtual}
|
|
@@ -183,7 +183,7 @@ export const Table = <T extends KeyValue = KeyValue>({
|
|
|
183
183
|
>
|
|
184
184
|
<div
|
|
185
185
|
data-ref="tableHeader"
|
|
186
|
-
className="bg-
|
|
186
|
+
className="bg-default font-medium sticky top-0 h-8 area-head border-b select-none flex flex-nowrap z-3"
|
|
187
187
|
>
|
|
188
188
|
<div className={wrapperStart}>
|
|
189
189
|
{canExpand && <div className="w-6" />}
|
|
@@ -251,7 +251,7 @@ export const Table = <T extends KeyValue = KeyValue>({
|
|
|
251
251
|
ref={measureElement}
|
|
252
252
|
data-index={index}
|
|
253
253
|
className={classNames(
|
|
254
|
-
"text-md bg-
|
|
254
|
+
"text-md bg-default border-y border-tint-100 border-t-0 cursor-pointer flex items-center justify-start gap-1 z-2",
|
|
255
255
|
isActiveSticky(index) && "sticky top-8",
|
|
256
256
|
)}
|
|
257
257
|
role="none"
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* React Fabric
|
|
3
|
+
* @version: 1.0.0
|
|
4
|
+
*
|
|
5
|
+
*
|
|
6
|
+
* The MIT License (MIT)
|
|
7
|
+
* Copyright (c) 2026 Adarsh Pastakia
|
|
8
|
+
*
|
|
9
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software
|
|
10
|
+
* and associated documentation files (the "Software"), to deal in the Software without restriction,
|
|
11
|
+
* including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
12
|
+
* and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
|
|
13
|
+
* subject to the following conditions:
|
|
14
|
+
*
|
|
15
|
+
* The above copyright notice and this permission notice shall be included in all copies or substantial
|
|
16
|
+
* portions of the Software.
|
|
17
|
+
*
|
|
18
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
|
|
19
|
+
* TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
20
|
+
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
21
|
+
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
import { createContext, useContext } from "react";
|
|
25
|
+
|
|
26
|
+
interface Context {
|
|
27
|
+
widths: Map<string, number>;
|
|
28
|
+
startResize: (col: HTMLElement) => void;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export const TableContext = createContext<Context>({} as Context);
|
|
32
|
+
|
|
33
|
+
export const useTableContext = () => useContext(TableContext);
|
package/src/table/useResizer.ts
CHANGED
|
@@ -21,6 +21,8 @@
|
|
|
21
21
|
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
22
22
|
*/
|
|
23
23
|
|
|
24
|
+
import { useCallback } from "react";
|
|
25
|
+
|
|
24
26
|
export const useResizer = (
|
|
25
27
|
colEl: HTMLElement,
|
|
26
28
|
ghostEl: HTMLElement,
|
|
@@ -29,20 +31,20 @@ export const useResizer = (
|
|
|
29
31
|
const placeholder = ghostEl.firstElementChild as HTMLElement;
|
|
30
32
|
const isRtl = getComputedStyle(colEl).direction === "rtl";
|
|
31
33
|
|
|
32
|
-
const onResize = (evt: MouseEvent) => {
|
|
34
|
+
const onResize = useCallback((evt: MouseEvent) => {
|
|
33
35
|
/** ***************** check if reverse enabled of RTL *******************/
|
|
34
36
|
const box = colEl.getBoundingClientRect();
|
|
35
37
|
const x = isRtl ? box.left - evt.clientX : evt.clientX - box.right;
|
|
36
38
|
placeholder.style.width = `${colEl.offsetWidth + x}px`;
|
|
37
|
-
};
|
|
39
|
+
}, [colEl, isRtl, placeholder]);
|
|
38
40
|
|
|
39
41
|
/** ***************** dettach handlers on mouseup *******************/
|
|
40
|
-
const onResizeEnd = () => {
|
|
42
|
+
const onResizeEnd = useCallback(() => {
|
|
41
43
|
callback(placeholder.offsetWidth);
|
|
42
44
|
ghostEl.style.display = "none";
|
|
43
45
|
document.removeEventListener("mousemove", onResize);
|
|
44
46
|
document.removeEventListener("mouseup", onResizeEnd);
|
|
45
|
-
};
|
|
47
|
+
}, [callback, placeholder, ghostEl]);
|
|
46
48
|
|
|
47
49
|
/** ***************** attach handlers *******************/
|
|
48
50
|
const box = colEl.getBoundingClientRect();
|
package/src/tree/TreePanel.tsx
CHANGED
|
@@ -37,7 +37,7 @@ import { useTree } from "./useTree";
|
|
|
37
37
|
* nodes and supports checkable nodes.
|
|
38
38
|
*
|
|
39
39
|
* @param {TreePanelProps<T>} props - The properties for the TreePanel component.
|
|
40
|
-
* @returns {
|
|
40
|
+
* @returns {React.ReactElement} The rendered TreePanel component.
|
|
41
41
|
* @template T - The type of items in the tree, extending KeyValue.
|
|
42
42
|
*
|
|
43
43
|
* @example
|
package/src/tree/types.ts
CHANGED
|
@@ -36,7 +36,7 @@ interface TreeBaseNode<T> extends CssProp, TestProps {
|
|
|
36
36
|
/**
|
|
37
37
|
* display label
|
|
38
38
|
*/
|
|
39
|
-
label: Elements<
|
|
39
|
+
label: Elements<React.ReactElement>;
|
|
40
40
|
/**
|
|
41
41
|
* icon path or props
|
|
42
42
|
*/
|
|
@@ -73,7 +73,7 @@ export type TreeNodeType<T extends KeyValue = KeyValue> = TreeBaseNode<T> &
|
|
|
73
73
|
|
|
74
74
|
export interface InternalNode extends CssProp, TestProps {
|
|
75
75
|
id: string;
|
|
76
|
-
label: Elements<
|
|
76
|
+
label: Elements<React.ReactElement>;
|
|
77
77
|
queryable?: string;
|
|
78
78
|
badge?: string | number | BadgeType;
|
|
79
79
|
disabled?: boolean;
|
|
@@ -101,8 +101,8 @@ export interface InternalNode extends CssProp, TestProps {
|
|
|
101
101
|
export interface TreeNodeProps extends ChildProp {
|
|
102
102
|
node: InternalNode;
|
|
103
103
|
expanders: [string, string];
|
|
104
|
-
defaultNodeIcon?: Elements<
|
|
105
|
-
defaultLeafIcon?: Elements<
|
|
104
|
+
defaultNodeIcon?: Elements<React.ReactElement>;
|
|
105
|
+
defaultLeafIcon?: Elements<React.ReactElement>;
|
|
106
106
|
noLines?: boolean;
|
|
107
107
|
selectable?: true | "leafOnly";
|
|
108
108
|
checkable?: true | "leafOnly";
|
|
@@ -227,8 +227,8 @@ interface BaseTreePanelProps<T extends KeyValue = KeyValue>
|
|
|
227
227
|
matcher?: (data: T, query: string) => boolean;
|
|
228
228
|
|
|
229
229
|
sorter?: false | ((a: T, b: T) => number);
|
|
230
|
-
makeLabel?: (node: T) => Elements<
|
|
231
|
-
makeIcon?: (node: T) => Elements<
|
|
230
|
+
makeLabel?: (node: T) => Elements<React.ReactElement>;
|
|
231
|
+
makeIcon?: (node: T) => Elements<React.ReactElement>;
|
|
232
232
|
|
|
233
233
|
defaultExpanded?: string[];
|
|
234
234
|
onExpandToggle?: (id: string[]) => void;
|
package/src/virtual/Gallery.tsx
CHANGED
|
@@ -293,7 +293,7 @@ const _VirtualGallery = <T extends AnyObject>({
|
|
|
293
293
|
<div
|
|
294
294
|
ref={scrollerRef}
|
|
295
295
|
onScroll={handleScroll}
|
|
296
|
-
className={classNames("area-content bg-
|
|
296
|
+
className={classNames("area-content bg-default overflow-auto")}
|
|
297
297
|
{...aria}
|
|
298
298
|
>
|
|
299
299
|
<div
|
|
@@ -388,7 +388,7 @@ const GenericMemo: <T>(c: T) => T = memo;
|
|
|
388
388
|
* It also provides a scroller for easy navigation through the items.
|
|
389
389
|
*
|
|
390
390
|
* @param {VirtualGalleryProps<T>} props - The properties for the VirtualGallery component.
|
|
391
|
-
* @returns {
|
|
391
|
+
* @returns {React.ReactElement} The rendered VirtualGallery component.
|
|
392
392
|
*
|
|
393
393
|
* @example
|
|
394
394
|
* ```jsx
|
package/src/virtual/List.tsx
CHANGED
|
@@ -270,7 +270,7 @@ const _VirtualList = <T extends AnyObject>({
|
|
|
270
270
|
<div
|
|
271
271
|
ref={scrollerRef}
|
|
272
272
|
onScroll={handleScroll}
|
|
273
|
-
className={classNames("area-content bg-
|
|
273
|
+
className={classNames("area-content bg-default overflow-auto")}
|
|
274
274
|
{...aria}
|
|
275
275
|
>
|
|
276
276
|
<div
|
|
@@ -340,7 +340,7 @@ const _VirtualList = <T extends AnyObject>({
|
|
|
340
340
|
<div
|
|
341
341
|
className={classNames(
|
|
342
342
|
orientation === "vertical" && "self-end sticky bottom-2",
|
|
343
|
-
orientation === "horizontal" && "self-end sticky
|
|
343
|
+
orientation === "horizontal" && "self-end sticky inset-e-2",
|
|
344
344
|
)}
|
|
345
345
|
>
|
|
346
346
|
<Scroller
|
|
@@ -383,7 +383,7 @@ const GenericMemo: <T>(c: T) => T = memo;
|
|
|
383
383
|
* It can be used with a ref to control scrolling and hilighting of items.
|
|
384
384
|
*
|
|
385
385
|
* @param {VirtualListProps<T>} props - The properties for the VirtualList component.
|
|
386
|
-
* @returns {
|
|
386
|
+
* @returns {React.ReactElement} The rendered VirtualList component.
|
|
387
387
|
* @template T - The type of items in the list, extending AnyObject.
|
|
388
388
|
*
|
|
389
389
|
* @example
|