@react-fabric/data 1.0.0-beta.60 → 1.0.0-beta.62
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 +4 -4
- package/dist/cjs/histogram/Histogram.js +2 -2
- package/dist/cjs/i18n/index.js +4 -4
- package/dist/cjs/index.js +2 -0
- package/dist/cjs/json/JsonViewer.js +3 -3
- package/dist/cjs/pagination/Pagination.js +11 -11
- package/dist/cjs/table/AddColumn.js +2 -2
- package/dist/cjs/table/BodyCell.js +11 -4
- package/dist/cjs/table/BodyRow.js +2 -2
- package/dist/cjs/table/CheckboxCell.js +1 -1
- package/dist/cjs/table/HeaderCell.js +4 -4
- package/dist/cjs/table/HtmlTable.js +78 -0
- package/dist/cjs/table/Table.js +17 -14
- package/dist/cjs/tree/TreeNode.js +4 -4
- package/dist/cjs/tree/TreePanel.js +7 -8
- package/dist/cjs/virtual/Scroller.js +4 -4
- package/dist/esm/checklist/CheckList.js +5 -5
- package/dist/esm/histogram/Histogram.js +3 -3
- package/dist/esm/i18n/index.js +2 -2
- package/dist/esm/index.js +1 -0
- package/dist/esm/json/JsonViewer.js +4 -4
- package/dist/esm/pagination/Pagination.js +12 -12
- package/dist/esm/table/AddColumn.js +3 -3
- package/dist/esm/table/BodyCell.js +12 -5
- package/dist/esm/table/BodyRow.js +2 -2
- package/dist/esm/table/CheckboxCell.js +2 -2
- package/dist/esm/table/HeaderCell.js +5 -5
- package/dist/esm/table/HtmlTable.js +78 -0
- package/dist/esm/table/Table.js +18 -15
- package/dist/esm/tree/TreeNode.js +6 -6
- package/dist/esm/tree/TreePanel.js +8 -9
- package/dist/esm/virtual/Scroller.js +5 -5
- package/dist/types/index.d.ts +1 -0
- package/dist/types/table/HtmlTable.d.ts +21 -0
- package/dist/types/table/types.d.ts +5 -5
- package/dist/types/tree/TreePanel.d.ts +2 -2
- package/dist/types/tree/types.d.ts +0 -2
- package/package.json +6 -6
- package/src/checklist/CheckList.tsx +17 -7
- package/src/histogram/Histogram.tsx +3 -9
- package/src/i18n/index.ts +2 -2
- package/src/index.ts +1 -0
- package/src/json/JsonViewer.tsx +7 -4
- package/src/pagination/Pagination.tsx +12 -12
- package/src/table/AddColumn.tsx +3 -3
- package/src/table/BodyCell.tsx +18 -3
- package/src/table/BodyRow.tsx +4 -2
- package/src/table/CheckboxCell.tsx +4 -4
- package/src/table/HeaderCell.tsx +4 -5
- package/src/table/HtmlTable.tsx +128 -0
- package/src/table/Table.tsx +24 -17
- package/src/table/types.ts +5 -4
- package/src/tree/TreeNode.tsx +7 -13
- package/src/tree/TreePanel.tsx +13 -18
- package/src/tree/types.ts +0 -5
- package/src/virtual/Scroller.tsx +13 -5
- package/dist/cjs/tree/types.js +0 -30
- package/dist/esm/tree/types.js +0 -29
- /package/dist/cjs/i18n/{ar.json.js → ar/data.json.js} +0 -0
- /package/dist/cjs/i18n/{en.json.js → en/data.json.js} +0 -0
- /package/dist/esm/i18n/{ar.json.js → ar/data.json.js} +0 -0
- /package/dist/esm/i18n/{en.json.js → en/data.json.js} +0 -0
- /package/src/i18n/{ar.json → ar/data.json} +0 -0
- /package/src/i18n/{en.json → en/data.json} +0 -0
package/src/table/types.ts
CHANGED
|
@@ -25,6 +25,7 @@ import { type IconProps } from "@react-fabric/core/dist/types/components/icon/Ic
|
|
|
25
25
|
import {
|
|
26
26
|
type CssProp,
|
|
27
27
|
type Elements,
|
|
28
|
+
type NestedKeys,
|
|
28
29
|
type RefProp,
|
|
29
30
|
type TestProps,
|
|
30
31
|
} from "@react-fabric/core/dist/types/types";
|
|
@@ -63,7 +64,7 @@ export const COL_DEFAULT_WIDTH = "12rem";
|
|
|
63
64
|
* @property {(value: AnyObject, data: T, index: number) => Elements<AnyObject>} [renderer] - Custom renderer function for the column values.
|
|
64
65
|
*/
|
|
65
66
|
export interface TableColumn<T = KeyValue> extends CssProp, TestProps {
|
|
66
|
-
id:
|
|
67
|
+
id: NestedKeys<T>;
|
|
67
68
|
field?: string;
|
|
68
69
|
label?: string;
|
|
69
70
|
tooltip?: string;
|
|
@@ -104,8 +105,8 @@ export interface TableRef {
|
|
|
104
105
|
export interface TableProps<T = KeyValue> extends RefProp<TableRef> {
|
|
105
106
|
columns: Array<TableColumn<T>>;
|
|
106
107
|
data: T[];
|
|
107
|
-
keyProperty?:
|
|
108
|
-
groupProperty?:
|
|
108
|
+
keyProperty?: NestedKeys<T>;
|
|
109
|
+
groupProperty?: NestedKeys<T>;
|
|
109
110
|
groupRenderer?: (key: AnyObject) => ReactElement;
|
|
110
111
|
emptyDisplay?: ReactElement;
|
|
111
112
|
|
|
@@ -132,7 +133,7 @@ export interface TableProps<T = KeyValue> extends RefProp<TableRef> {
|
|
|
132
133
|
canExpand?: (record: T) => boolean;
|
|
133
134
|
children?: (record: T) => Elements<AnyObject>;
|
|
134
135
|
|
|
135
|
-
onFilter?: (id:
|
|
136
|
+
onFilter?: (id: NestedKeys<T> | string, value?: AnyObject) => void;
|
|
136
137
|
|
|
137
138
|
total?: number;
|
|
138
139
|
onLoadMore?: (lastIndex?: number) => void;
|
package/src/tree/TreeNode.tsx
CHANGED
|
@@ -21,14 +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 {
|
|
25
|
-
|
|
26
|
-
CoreIcons,
|
|
27
|
-
getBadgeProps,
|
|
28
|
-
getIconProps,
|
|
29
|
-
Icon,
|
|
30
|
-
} from "@react-fabric/core";
|
|
31
|
-
import { isEmpty, isString } from "@react-fabric/utilities";
|
|
24
|
+
import { Badge, getBadgeProps, getIconProps, Icon } from "@react-fabric/core";
|
|
25
|
+
import { isEmpty, isString, isTrue } from "@react-fabric/utilities";
|
|
32
26
|
import classNames from "classnames";
|
|
33
27
|
import { isValidElement, useMemo } from "react";
|
|
34
28
|
import { useTranslation } from "react-i18next";
|
|
@@ -89,7 +83,7 @@ export const TreeNode = ({
|
|
|
89
83
|
}, [defaultLeafIcon, defaultNodeIcon, node.icon]);
|
|
90
84
|
|
|
91
85
|
const canCheck = useMemo(() => {
|
|
92
|
-
return checkable
|
|
86
|
+
return isTrue(checkable) || (checkable === "leafOnly" && node.leaf);
|
|
93
87
|
}, [node.leaf, checkable]);
|
|
94
88
|
|
|
95
89
|
const canSelect = useMemo(() => {
|
|
@@ -111,7 +105,7 @@ export const TreeNode = ({
|
|
|
111
105
|
{filler}
|
|
112
106
|
{node.loading && (
|
|
113
107
|
<div className="flex-initial w-6">
|
|
114
|
-
<Icon icon=
|
|
108
|
+
<Icon icon="icon-[svg-spinners--eclipse]" className="text-muted" />
|
|
115
109
|
</div>
|
|
116
110
|
)}
|
|
117
111
|
{!node.leaf && !node.childFiltered && !node.loading && (
|
|
@@ -130,10 +124,10 @@ export const TreeNode = ({
|
|
|
130
124
|
onClick={() => !node.disabled && onChecked(node.id)}
|
|
131
125
|
icon={
|
|
132
126
|
node.checked === 2
|
|
133
|
-
?
|
|
127
|
+
? "icon-[mdi--checkbox-intermediate]"
|
|
134
128
|
: node.checked === 1
|
|
135
|
-
?
|
|
136
|
-
:
|
|
129
|
+
? "icon-[mdi--checkbox-marked]"
|
|
130
|
+
: "icon-[mdi--checkbox-blank-outline]"
|
|
137
131
|
}
|
|
138
132
|
className={classNames(
|
|
139
133
|
node.disabled
|
package/src/tree/TreePanel.tsx
CHANGED
|
@@ -21,19 +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
|
-
ButtonGroup,
|
|
27
|
-
CoreIcons,
|
|
28
|
-
Header,
|
|
29
|
-
Icon,
|
|
30
|
-
Section,
|
|
31
|
-
} from "@react-fabric/core";
|
|
24
|
+
import { Button, ButtonGroup, Header, Icon, Section } from "@react-fabric/core";
|
|
32
25
|
import { Search } from "@react-fabric/form";
|
|
33
26
|
import { useVirtualizer } from "@tanstack/react-virtual";
|
|
34
27
|
import { useEffect, useImperativeHandle, useMemo, useRef } from "react";
|
|
35
28
|
import { TreeNode } from "./TreeNode";
|
|
36
|
-
import {
|
|
29
|
+
import { type TreePanelProps } from "./types";
|
|
37
30
|
import { useTree } from "./useTree";
|
|
38
31
|
|
|
39
32
|
// TODO: implement keyboard handler for navigating tree
|
|
@@ -59,8 +52,8 @@ import { useTree } from "./useTree";
|
|
|
59
52
|
* selectable={true}
|
|
60
53
|
* matcher={(item, query) => item.name.toLowerCase().includes(query.toLowerCase())}
|
|
61
54
|
* filterPlaceholder="Search..."
|
|
62
|
-
* defaultLeafIcon={<Icon icon=
|
|
63
|
-
* defaultNodeIcon={<Icon icon=
|
|
55
|
+
* defaultLeafIcon={<Icon icon="icon-[mdi--file]" />}
|
|
56
|
+
* defaultNodeIcon={<Icon icon="icon-[mdi--folder]" />}
|
|
64
57
|
* expander="caret"
|
|
65
58
|
* onChecked={(checkedItems) => console.log(checkedItems)}
|
|
66
59
|
* onLoad={(id) => console.log(`Load children for ${id}`)}
|
|
@@ -146,12 +139,12 @@ export const TreePanel = <T extends KeyValue>({
|
|
|
146
139
|
|
|
147
140
|
const expanders = useMemo<[string, string]>(() => {
|
|
148
141
|
if (expander === "caret")
|
|
149
|
-
return [
|
|
142
|
+
return ["icon-[mdi--menu-right]", "icon-[mdi--menu-down]"];
|
|
150
143
|
if (expander === "chevron")
|
|
151
|
-
return [
|
|
144
|
+
return ["icon-[mdi--chevron-right]", "icon-[mdi--chevron-down]"];
|
|
152
145
|
if (expander === "folder")
|
|
153
|
-
return [
|
|
154
|
-
return [
|
|
146
|
+
return ["icon-[mdi--folder-outline]", "icon-[mdi--folder-open-outline]"];
|
|
147
|
+
return ["icon-[mdi--plus-box-outline]", "icon-[mdi--minus-box-outline]"];
|
|
155
148
|
}, [expander]);
|
|
156
149
|
|
|
157
150
|
useImperativeHandle(
|
|
@@ -182,20 +175,22 @@ export const TreePanel = <T extends KeyValue>({
|
|
|
182
175
|
allowClear
|
|
183
176
|
placeholder={filterPlaceholder}
|
|
184
177
|
{...{ noBorder: true }}
|
|
185
|
-
decorateStart={
|
|
178
|
+
decorateStart={
|
|
179
|
+
<Icon icon="icon-[mdi--filter-variant]" className="p-1" />
|
|
180
|
+
}
|
|
186
181
|
/>
|
|
187
182
|
)}
|
|
188
183
|
<ButtonGroup variant="link" className="m-0">
|
|
189
184
|
<Button
|
|
190
185
|
size="sm"
|
|
191
186
|
aria-label="expand all"
|
|
192
|
-
icon=
|
|
187
|
+
icon="icon-[mdi--arrow-expand-vertical]"
|
|
193
188
|
onClick={expandAll}
|
|
194
189
|
/>
|
|
195
190
|
<Button
|
|
196
191
|
size="sm"
|
|
197
192
|
aria-label="collapse all"
|
|
198
|
-
icon=
|
|
193
|
+
icon="icon-[mdi--arrow-collapse-vertical]"
|
|
199
194
|
onClick={collapseAll}
|
|
200
195
|
/>
|
|
201
196
|
</ButtonGroup>
|
package/src/tree/types.ts
CHANGED
|
@@ -236,8 +236,3 @@ interface BaseTreePanelProps<T extends KeyValue = KeyValue>
|
|
|
236
236
|
leafClassName?: string;
|
|
237
237
|
nodeClassName?: string;
|
|
238
238
|
}
|
|
239
|
-
|
|
240
|
-
export const iconExpandAll =
|
|
241
|
-
"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";
|
|
242
|
-
export const iconCollapseAll =
|
|
243
|
-
"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";
|
package/src/virtual/Scroller.tsx
CHANGED
|
@@ -21,7 +21,7 @@
|
|
|
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 { Button, ButtonGroup
|
|
24
|
+
import { Button, ButtonGroup } from "@react-fabric/core";
|
|
25
25
|
|
|
26
26
|
export const Scroller = ({
|
|
27
27
|
vertical = true,
|
|
@@ -45,7 +45,9 @@ export const Scroller = ({
|
|
|
45
45
|
variant="link"
|
|
46
46
|
aria-label="scroll to top"
|
|
47
47
|
icon={{
|
|
48
|
-
icon: vertical
|
|
48
|
+
icon: vertical
|
|
49
|
+
? "icon-[mdi--chevron-double-up]"
|
|
50
|
+
: "icon-[mdi--chevron-double-left]",
|
|
49
51
|
rtlFlip: true,
|
|
50
52
|
}}
|
|
51
53
|
disabled={(scrollActive & 2) === 0}
|
|
@@ -56,7 +58,9 @@ export const Scroller = ({
|
|
|
56
58
|
variant="link"
|
|
57
59
|
aria-label="scroll up"
|
|
58
60
|
icon={{
|
|
59
|
-
icon: vertical
|
|
61
|
+
icon: vertical
|
|
62
|
+
? "icon-[mdi--chevron-up]"
|
|
63
|
+
: "icon-[mdi--chevron-left]",
|
|
60
64
|
rtlFlip: true,
|
|
61
65
|
}}
|
|
62
66
|
disabled={(scrollActive & 2) === 0}
|
|
@@ -67,7 +71,9 @@ export const Scroller = ({
|
|
|
67
71
|
variant="link"
|
|
68
72
|
aria-label="scroll down"
|
|
69
73
|
icon={{
|
|
70
|
-
icon: vertical
|
|
74
|
+
icon: vertical
|
|
75
|
+
? "icon-[mdi--chevron-down]"
|
|
76
|
+
: "icon-[mdi--chevron-right]",
|
|
71
77
|
rtlFlip: true,
|
|
72
78
|
}}
|
|
73
79
|
disabled={scrollActive % 2 === 0}
|
|
@@ -78,7 +84,9 @@ export const Scroller = ({
|
|
|
78
84
|
variant="link"
|
|
79
85
|
aria-label="scroll to bottom"
|
|
80
86
|
icon={{
|
|
81
|
-
icon: vertical
|
|
87
|
+
icon: vertical
|
|
88
|
+
? "icon-[mdi--chevron-double-down]"
|
|
89
|
+
: "icon-[mdi--chevron-double-right]",
|
|
82
90
|
rtlFlip: true,
|
|
83
91
|
}}
|
|
84
92
|
disabled={scrollActive % 2 === 0}
|
package/dist/cjs/tree/types.js
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
/*
|
|
4
|
-
* React Fabric
|
|
5
|
-
* @version: 1.0.0
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* The MIT License (MIT)
|
|
9
|
-
* Copyright (c) 2024 Adarsh Pastakia
|
|
10
|
-
*
|
|
11
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software
|
|
12
|
-
* and associated documentation files (the "Software"), to deal in the Software without restriction,
|
|
13
|
-
* including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
14
|
-
* and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
|
|
15
|
-
* subject to the following conditions:
|
|
16
|
-
*
|
|
17
|
-
* The above copyright notice and this permission notice shall be included in all copies or substantial
|
|
18
|
-
* portions of the Software.
|
|
19
|
-
*
|
|
20
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
|
|
21
|
-
* TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
22
|
-
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
23
|
-
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
24
|
-
*/
|
|
25
|
-
|
|
26
|
-
var 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";
|
|
27
|
-
var 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";
|
|
28
|
-
|
|
29
|
-
exports.iconCollapseAll = iconCollapseAll;
|
|
30
|
-
exports.iconExpandAll = iconExpandAll;
|
package/dist/esm/tree/types.js
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
/*
|
|
4
|
-
* React Fabric
|
|
5
|
-
* @version: 1.0.0
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* The MIT License (MIT)
|
|
9
|
-
* Copyright (c) 2024 Adarsh Pastakia
|
|
10
|
-
*
|
|
11
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software
|
|
12
|
-
* and associated documentation files (the "Software"), to deal in the Software without restriction,
|
|
13
|
-
* including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
14
|
-
* and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
|
|
15
|
-
* subject to the following conditions:
|
|
16
|
-
*
|
|
17
|
-
* The above copyright notice and this permission notice shall be included in all copies or substantial
|
|
18
|
-
* portions of the Software.
|
|
19
|
-
*
|
|
20
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
|
|
21
|
-
* TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
22
|
-
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
23
|
-
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
24
|
-
*/
|
|
25
|
-
|
|
26
|
-
var 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";
|
|
27
|
-
var 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";
|
|
28
|
-
|
|
29
|
-
export { iconCollapseAll, iconExpandAll };
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|