@react-fabric/data 1.0.0-beta.60 → 1.0.0-beta.61
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/json/JsonViewer.js +3 -3
- package/dist/cjs/pagination/Pagination.js +4 -4
- 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/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/json/JsonViewer.js +4 -4
- package/dist/esm/pagination/Pagination.js +5 -5
- 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/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/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/json/JsonViewer.tsx +7 -4
- package/src/pagination/Pagination.tsx +5 -5
- 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/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
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
+
import { Icon } from '@react-fabric/core';
|
|
3
4
|
import classNames from 'classnames';
|
|
4
5
|
import { BodyCell } from './BodyCell.js';
|
|
5
6
|
import { CheckboxCell } from './CheckboxCell.js';
|
|
6
|
-
import { Icon, CoreIcons } from '@react-fabric/core';
|
|
7
7
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
8
8
|
|
|
9
9
|
/*
|
|
@@ -65,7 +65,7 @@ var BodyRow = function BodyRow(_ref) {
|
|
|
65
65
|
className: classNames("group font-medium w-6 flex flex-nowrap text-start py-1", !canExpand(data) && "pointer-events-none opacity-35"),
|
|
66
66
|
children: /*#__PURE__*/jsx(Icon, {
|
|
67
67
|
className: "p-1 text-tint-700 hover:text-primary-600",
|
|
68
|
-
icon: expanded ?
|
|
68
|
+
icon: expanded ? "icon-[mdi--minus-box]" : "icon-[mdi--plus-box]",
|
|
69
69
|
onClick: function onClick(e) {
|
|
70
70
|
return [keyProperty && toggleExpand(data[keyProperty]), e.stopPropagation()];
|
|
71
71
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import { Icon
|
|
3
|
+
import { Icon } from '@react-fabric/core';
|
|
4
4
|
import { jsx } from 'react/jsx-runtime';
|
|
5
5
|
|
|
6
6
|
/*
|
|
@@ -32,7 +32,7 @@ var CheckboxCell = function CheckboxCell(_ref) {
|
|
|
32
32
|
return /*#__PURE__*/jsx("div", {
|
|
33
33
|
className: "group font-medium border-e w-6 flex flex-nowrap text-start py-1",
|
|
34
34
|
children: /*#__PURE__*/jsx(Icon, {
|
|
35
|
-
icon: state === 2 ?
|
|
35
|
+
icon: state === 2 ? "icon-[mdi--checkbox-intermediate]" : state === 1 ? "icon-[mdi--checkbox-marked]" : "icon-[mdi--checkbox-blank-outline]",
|
|
36
36
|
className: "p-1 text-tint-700 hover:text-primary-600",
|
|
37
37
|
onClick: function onClick(e) {
|
|
38
38
|
return [_onClick === null || _onClick === void 0 ? void 0 : _onClick(), e.stopPropagation()];
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
4
4
|
import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
|
|
5
|
-
import { Menu,
|
|
5
|
+
import { Menu, MenuItem, Divider, Tooltip, Icon, getIconProps, DropdownTool, Button } from '@react-fabric/core';
|
|
6
6
|
import { isEmpty } from '@react-fabric/utilities';
|
|
7
7
|
import { useMemo, useCallback } from 'react';
|
|
8
8
|
import { ColumnFilters } from './ColumnFilters.js';
|
|
@@ -50,7 +50,7 @@ var HeaderCell = function HeaderCell(_ref) {
|
|
|
50
50
|
if (filterable && (dataType !== null && dataType !== void 0 ? dataType : filterOptions)) {
|
|
51
51
|
ret.push( /*#__PURE__*/jsx(Menu, {
|
|
52
52
|
label: "Filter",
|
|
53
|
-
icon: filter ?
|
|
53
|
+
icon: filter ? "icon-[mdi--check]" : "",
|
|
54
54
|
trigger: "click",
|
|
55
55
|
children: /*#__PURE__*/jsx(ColumnFilters, {
|
|
56
56
|
type: dataType,
|
|
@@ -65,13 +65,13 @@ var HeaderCell = function HeaderCell(_ref) {
|
|
|
65
65
|
if (sortable) {
|
|
66
66
|
ret.push( /*#__PURE__*/jsx(MenuItem, {
|
|
67
67
|
label: "Sort ascending",
|
|
68
|
-
icon:
|
|
68
|
+
icon: "icon-[mdi--sort-ascending]",
|
|
69
69
|
onClick: function onClick() {
|
|
70
70
|
return handleSort("asc");
|
|
71
71
|
}
|
|
72
72
|
}, "sort-asc"), /*#__PURE__*/jsx(MenuItem, {
|
|
73
73
|
label: "Sort descending",
|
|
74
|
-
icon:
|
|
74
|
+
icon: "icon-[mdi--sort-descending]",
|
|
75
75
|
onClick: function onClick() {
|
|
76
76
|
return handleSort("desc");
|
|
77
77
|
}
|
|
@@ -136,7 +136,7 @@ var HeaderCell = function HeaderCell(_ref) {
|
|
|
136
136
|
variant: "link",
|
|
137
137
|
"aria-label": "clear filter",
|
|
138
138
|
stopPropagation: true,
|
|
139
|
-
icon:
|
|
139
|
+
icon: "icon-[mdi--filter-remove]",
|
|
140
140
|
onClick: function onClick() {
|
|
141
141
|
return _onFilter === null || _onFilter === void 0 ? void 0 : _onFilter(id);
|
|
142
142
|
}
|
package/dist/esm/table/Table.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
4
|
-
import { useDebounce,
|
|
4
|
+
import { useDebounce, LoadingLine, Icon, EmptyContent } from '@react-fabric/core';
|
|
5
5
|
import { debounce } from '@react-fabric/utilities';
|
|
6
6
|
import classNames from 'classnames';
|
|
7
7
|
import { useRef, useMemo, useLayoutEffect, useImperativeHandle, useEffect } from 'react';
|
|
@@ -168,7 +168,7 @@ var Table = function Table(_ref) {
|
|
|
168
168
|
})
|
|
169
169
|
})]
|
|
170
170
|
})]
|
|
171
|
-
}), loading && /*#__PURE__*/jsx(
|
|
171
|
+
}), loading && /*#__PURE__*/jsx(LoadingLine, {}), data.length > 0 && /*#__PURE__*/jsxs("div", {
|
|
172
172
|
className: "area-content flex flex-col flex-nowrap min-h-full",
|
|
173
173
|
style: {
|
|
174
174
|
height: totalSize()
|
|
@@ -183,26 +183,29 @@ var Table = function Table(_ref) {
|
|
|
183
183
|
var index = _ref2.index,
|
|
184
184
|
key = _ref2.key;
|
|
185
185
|
var data = getData(index);
|
|
186
|
-
return "__GROUP__" in data ? /*#__PURE__*/
|
|
186
|
+
return "__GROUP__" in data ? /*#__PURE__*/jsx("div", {
|
|
187
187
|
ref: measureElement,
|
|
188
188
|
"data-index": index,
|
|
189
|
-
className: classNames("
|
|
189
|
+
className: classNames("text-md bg-base border-y border-tint-100 border-t-0 cursor-pointer flex items-center justify-start gap-1 z-2", isActiveSticky(index) && "sticky top-8"),
|
|
190
190
|
role: "none",
|
|
191
191
|
onClick: function onClick() {
|
|
192
192
|
return toggleGroupExpand(data.key);
|
|
193
193
|
},
|
|
194
|
-
children:
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
194
|
+
children: /*#__PURE__*/jsxs("div", {
|
|
195
|
+
className: classNames("px-2 py-1 flex items-center gap-1 z-2 sticky start-0"),
|
|
196
|
+
children: [/*#__PURE__*/jsx(Icon, {
|
|
197
|
+
rtlFlip: true,
|
|
198
|
+
icon: data.open ? "icon-[mdi--chevron-down]" : "icon-[mdi--chevron-right]"
|
|
199
|
+
}), (_groupRenderer = groupRenderer === null || groupRenderer === void 0 ? void 0 : groupRenderer(data)) !== null && _groupRenderer !== void 0 ? _groupRenderer : /*#__PURE__*/jsxs("div", {
|
|
200
|
+
className: "flex gap-1 items-center",
|
|
201
|
+
children: [/*#__PURE__*/jsx("span", {
|
|
202
|
+
children: data.key
|
|
203
|
+
}), /*#__PURE__*/jsxs("span", {
|
|
204
|
+
className: "text-sm",
|
|
205
|
+
children: ["(", data.itemCount, ")"]
|
|
206
|
+
})]
|
|
204
207
|
})]
|
|
205
|
-
})
|
|
208
|
+
})
|
|
206
209
|
}, key) : /*#__PURE__*/jsx(BodyRow, {
|
|
207
210
|
rowKey: key.toString(),
|
|
208
211
|
index: index,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
4
|
-
import { getBadgeProps, Icon,
|
|
5
|
-
import { isString, isEmpty } from '@react-fabric/utilities';
|
|
4
|
+
import { getBadgeProps, Icon, getIconProps, Badge } from '@react-fabric/core';
|
|
5
|
+
import { isTrue, isString, isEmpty } from '@react-fabric/utilities';
|
|
6
6
|
import classNames from 'classnames';
|
|
7
7
|
import { useMemo, isValidElement } from 'react';
|
|
8
8
|
import { useTranslation } from 'react-i18next';
|
|
@@ -57,7 +57,7 @@ var TreeNode = function TreeNode(_ref) {
|
|
|
57
57
|
};
|
|
58
58
|
}, [defaultLeafIcon, defaultNodeIcon, node.icon]);
|
|
59
59
|
var canCheck = useMemo(function () {
|
|
60
|
-
return checkable
|
|
60
|
+
return isTrue(checkable) || checkable === "leafOnly" && node.leaf;
|
|
61
61
|
}, [node.leaf, checkable]);
|
|
62
62
|
var canSelect = useMemo(function () {
|
|
63
63
|
return !node.disabled && (selectable === true || selectable === "leafOnly" && node.leaf);
|
|
@@ -72,8 +72,8 @@ var TreeNode = function TreeNode(_ref) {
|
|
|
72
72
|
children: [filler, node.loading && /*#__PURE__*/jsx("div", {
|
|
73
73
|
className: "flex-initial w-6",
|
|
74
74
|
children: /*#__PURE__*/jsx(Icon, {
|
|
75
|
-
icon:
|
|
76
|
-
className: "
|
|
75
|
+
icon: "icon-[svg-spinners--eclipse]",
|
|
76
|
+
className: "text-muted"
|
|
77
77
|
})
|
|
78
78
|
}), !node.leaf && !node.childFiltered && !node.loading && /*#__PURE__*/jsx("div", {
|
|
79
79
|
className: "flex-initial w-6",
|
|
@@ -91,7 +91,7 @@ var TreeNode = function TreeNode(_ref) {
|
|
|
91
91
|
onClick: function onClick() {
|
|
92
92
|
return !node.disabled && onChecked(node.id);
|
|
93
93
|
},
|
|
94
|
-
icon: node.checked === 2 ?
|
|
94
|
+
icon: node.checked === 2 ? "icon-[mdi--checkbox-intermediate]" : node.checked === 1 ? "icon-[mdi--checkbox-marked]" : "icon-[mdi--checkbox-blank-outline]",
|
|
95
95
|
className: classNames(node.disabled ? "text-muted" : "text-primary-500 hover:text-primary-600")
|
|
96
96
|
})
|
|
97
97
|
}), !node.empty && /*#__PURE__*/jsxs("div", {
|
|
@@ -2,12 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
4
4
|
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
5
|
-
import {
|
|
5
|
+
import { Section, Header, Icon, ButtonGroup, Button } from '@react-fabric/core';
|
|
6
6
|
import { Search } from '@react-fabric/form';
|
|
7
7
|
import { useVirtualizer } from '@tanstack/react-virtual';
|
|
8
8
|
import { useRef, useMemo, useImperativeHandle, useEffect } from 'react';
|
|
9
9
|
import { TreeNode } from './TreeNode.js';
|
|
10
|
-
import { iconExpandAll, iconCollapseAll } from './types.js';
|
|
11
10
|
import { useTree } from './useTree.js';
|
|
12
11
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
13
12
|
|
|
@@ -81,10 +80,10 @@ var TreePanel = function TreePanel(_ref) {
|
|
|
81
80
|
});
|
|
82
81
|
var virtualItems = virtualizer.getVirtualItems();
|
|
83
82
|
var expanders = useMemo(function () {
|
|
84
|
-
if (expander === "caret") return [
|
|
85
|
-
if (expander === "chevron") return [
|
|
86
|
-
if (expander === "folder") return [
|
|
87
|
-
return [
|
|
83
|
+
if (expander === "caret") return ["icon-[mdi--menu-right]", "icon-[mdi--menu-down]"];
|
|
84
|
+
if (expander === "chevron") return ["icon-[mdi--chevron-right]", "icon-[mdi--chevron-down]"];
|
|
85
|
+
if (expander === "folder") return ["icon-[mdi--folder-outline]", "icon-[mdi--folder-open-outline]"];
|
|
86
|
+
return ["icon-[mdi--plus-box-outline]", "icon-[mdi--minus-box-outline]"];
|
|
88
87
|
}, [expander]);
|
|
89
88
|
useImperativeHandle(ref, function () {
|
|
90
89
|
return {
|
|
@@ -118,7 +117,7 @@ var TreePanel = function TreePanel(_ref) {
|
|
|
118
117
|
placeholder: filterPlaceholder,
|
|
119
118
|
noBorder: true,
|
|
120
119
|
decorateStart: /*#__PURE__*/jsx(Icon, {
|
|
121
|
-
icon:
|
|
120
|
+
icon: "icon-[mdi--filter-variant]",
|
|
122
121
|
className: "p-1"
|
|
123
122
|
})
|
|
124
123
|
}), /*#__PURE__*/jsxs(ButtonGroup, {
|
|
@@ -127,12 +126,12 @@ var TreePanel = function TreePanel(_ref) {
|
|
|
127
126
|
children: [/*#__PURE__*/jsx(Button, {
|
|
128
127
|
size: "sm",
|
|
129
128
|
"aria-label": "expand all",
|
|
130
|
-
icon:
|
|
129
|
+
icon: "icon-[mdi--arrow-expand-vertical]",
|
|
131
130
|
onClick: expandAll
|
|
132
131
|
}), /*#__PURE__*/jsx(Button, {
|
|
133
132
|
size: "sm",
|
|
134
133
|
"aria-label": "collapse all",
|
|
135
|
-
icon:
|
|
134
|
+
icon: "icon-[mdi--arrow-collapse-vertical]",
|
|
136
135
|
onClick: collapseAll
|
|
137
136
|
})]
|
|
138
137
|
})]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import { ButtonGroup, Button
|
|
3
|
+
import { ButtonGroup, Button } from '@react-fabric/core';
|
|
4
4
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
5
5
|
|
|
6
6
|
/*
|
|
@@ -43,7 +43,7 @@ var Scroller = function Scroller(_ref) {
|
|
|
43
43
|
variant: "link",
|
|
44
44
|
"aria-label": "scroll to top",
|
|
45
45
|
icon: {
|
|
46
|
-
icon: vertical ?
|
|
46
|
+
icon: vertical ? "icon-[mdi--chevron-double-up]" : "icon-[mdi--chevron-double-left]",
|
|
47
47
|
rtlFlip: true
|
|
48
48
|
},
|
|
49
49
|
disabled: (scrollActive & 2) === 0,
|
|
@@ -53,7 +53,7 @@ var Scroller = function Scroller(_ref) {
|
|
|
53
53
|
variant: "link",
|
|
54
54
|
"aria-label": "scroll up",
|
|
55
55
|
icon: {
|
|
56
|
-
icon: vertical ?
|
|
56
|
+
icon: vertical ? "icon-[mdi--chevron-up]" : "icon-[mdi--chevron-left]",
|
|
57
57
|
rtlFlip: true
|
|
58
58
|
},
|
|
59
59
|
disabled: (scrollActive & 2) === 0,
|
|
@@ -63,7 +63,7 @@ var Scroller = function Scroller(_ref) {
|
|
|
63
63
|
variant: "link",
|
|
64
64
|
"aria-label": "scroll down",
|
|
65
65
|
icon: {
|
|
66
|
-
icon: vertical ?
|
|
66
|
+
icon: vertical ? "icon-[mdi--chevron-down]" : "icon-[mdi--chevron-right]",
|
|
67
67
|
rtlFlip: true
|
|
68
68
|
},
|
|
69
69
|
disabled: scrollActive % 2 === 0,
|
|
@@ -73,7 +73,7 @@ var Scroller = function Scroller(_ref) {
|
|
|
73
73
|
variant: "link",
|
|
74
74
|
"aria-label": "scroll to bottom",
|
|
75
75
|
icon: {
|
|
76
|
-
icon: vertical ?
|
|
76
|
+
icon: vertical ? "icon-[mdi--chevron-double-down]" : "icon-[mdi--chevron-double-right]",
|
|
77
77
|
rtlFlip: true
|
|
78
78
|
},
|
|
79
79
|
disabled: scrollActive % 2 === 0,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type IconProps } from "@react-fabric/core/dist/types/components/icon/Icon";
|
|
2
|
-
import { type CssProp, type Elements, type RefProp, type TestProps } from "@react-fabric/core/dist/types/types";
|
|
2
|
+
import { type CssProp, type Elements, type NestedKeys, type RefProp, type TestProps } from "@react-fabric/core/dist/types/types";
|
|
3
3
|
import { type ReactElement } from "react";
|
|
4
4
|
export declare const COL_MIN_WIDTH = "3rem";
|
|
5
5
|
export declare const COL_MAX_WIDTH = "64rem";
|
|
@@ -33,7 +33,7 @@ export declare const COL_DEFAULT_WIDTH = "12rem";
|
|
|
33
33
|
* @property {(value: AnyObject, data: T, index: number) => Elements<AnyObject>} [renderer] - Custom renderer function for the column values.
|
|
34
34
|
*/
|
|
35
35
|
export interface TableColumn<T = KeyValue> extends CssProp, TestProps {
|
|
36
|
-
id:
|
|
36
|
+
id: NestedKeys<T>;
|
|
37
37
|
field?: string;
|
|
38
38
|
label?: string;
|
|
39
39
|
tooltip?: string;
|
|
@@ -65,8 +65,8 @@ export interface TableRef {
|
|
|
65
65
|
export interface TableProps<T = KeyValue> extends RefProp<TableRef> {
|
|
66
66
|
columns: Array<TableColumn<T>>;
|
|
67
67
|
data: T[];
|
|
68
|
-
keyProperty?:
|
|
69
|
-
groupProperty?:
|
|
68
|
+
keyProperty?: NestedKeys<T>;
|
|
69
|
+
groupProperty?: NestedKeys<T>;
|
|
70
70
|
groupRenderer?: (key: AnyObject) => ReactElement;
|
|
71
71
|
emptyDisplay?: ReactElement;
|
|
72
72
|
/**
|
|
@@ -93,7 +93,7 @@ export interface TableProps<T = KeyValue> extends RefProp<TableRef> {
|
|
|
93
93
|
onScroll?: (firstItem: number) => void;
|
|
94
94
|
canExpand?: (record: T) => boolean;
|
|
95
95
|
children?: (record: T) => Elements<AnyObject>;
|
|
96
|
-
onFilter?: (id:
|
|
96
|
+
onFilter?: (id: NestedKeys<T> | string, value?: AnyObject) => void;
|
|
97
97
|
total?: number;
|
|
98
98
|
onLoadMore?: (lastIndex?: number) => void;
|
|
99
99
|
}
|
|
@@ -20,8 +20,8 @@ import { type TreePanelProps } from "./types";
|
|
|
20
20
|
* selectable={true}
|
|
21
21
|
* matcher={(item, query) => item.name.toLowerCase().includes(query.toLowerCase())}
|
|
22
22
|
* filterPlaceholder="Search..."
|
|
23
|
-
* defaultLeafIcon={<Icon icon=
|
|
24
|
-
* defaultNodeIcon={<Icon icon=
|
|
23
|
+
* defaultLeafIcon={<Icon icon="icon-[mdi--file]" />}
|
|
24
|
+
* defaultNodeIcon={<Icon icon="icon-[mdi--folder]" />}
|
|
25
25
|
* expander="caret"
|
|
26
26
|
* onChecked={(checkedItems) => console.log(checkedItems)}
|
|
27
27
|
* onLoad={(id) => console.log(`Load children for ${id}`)}
|
|
@@ -183,6 +183,4 @@ interface BaseTreePanelProps<T extends KeyValue = KeyValue> extends TestProps, R
|
|
|
183
183
|
leafClassName?: string;
|
|
184
184
|
nodeClassName?: string;
|
|
185
185
|
}
|
|
186
|
-
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";
|
|
187
|
-
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";
|
|
188
186
|
export {};
|
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.61",
|
|
4
4
|
"description": "RUF: Data package",
|
|
5
5
|
"author": "Adarsh Pastakia <adarshpastakia@outlook.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -35,10 +35,10 @@
|
|
|
35
35
|
"watch": "npm-run-all -p watch:rollup watch:dts"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@react-fabric/core": "^1.0.0-beta.
|
|
39
|
-
"@react-fabric/date": "^1.0.0-beta.
|
|
40
|
-
"@react-fabric/form": "^1.0.0-beta.
|
|
41
|
-
"@react-fabric/utilities": "^1.0.0-beta.
|
|
38
|
+
"@react-fabric/core": "^1.0.0-beta.61",
|
|
39
|
+
"@react-fabric/date": "^1.0.0-beta.61",
|
|
40
|
+
"@react-fabric/form": "^1.0.0-beta.61",
|
|
41
|
+
"@react-fabric/utilities": "^1.0.0-beta.61",
|
|
42
42
|
"@tanstack/react-virtual": "~3.13.12",
|
|
43
43
|
"classnames": "~2.5.1",
|
|
44
44
|
"color": "~5.0.2",
|
|
@@ -54,5 +54,5 @@
|
|
|
54
54
|
"node": ">=18.12.0",
|
|
55
55
|
"npm": ">=8.19.0"
|
|
56
56
|
},
|
|
57
|
-
"gitHead": "
|
|
57
|
+
"gitHead": "a0b0c571bf9c189fa3355bbc3b896ecc4b9d6a04"
|
|
58
58
|
}
|
|
@@ -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 { Badge,
|
|
24
|
+
import { Badge, EmptyContent, Icon } from "@react-fabric/core";
|
|
25
25
|
import {
|
|
26
26
|
type BadgeType,
|
|
27
27
|
type TestProps,
|
|
@@ -106,7 +106,11 @@ const CheckItem: FC<
|
|
|
106
106
|
data-type="checkbox"
|
|
107
107
|
className="ax-checkList__checkbox"
|
|
108
108
|
data-selected={selected === 1}
|
|
109
|
-
icon={
|
|
109
|
+
icon={
|
|
110
|
+
selected
|
|
111
|
+
? "icon-[mdi--checkbox-marked]"
|
|
112
|
+
: "icon-[mdi--checkbox-blank-outline]"
|
|
113
|
+
}
|
|
110
114
|
/>
|
|
111
115
|
)}
|
|
112
116
|
{allowNegative && (
|
|
@@ -116,10 +120,10 @@ const CheckItem: FC<
|
|
|
116
120
|
className="ax-checkList__checkbox"
|
|
117
121
|
icon={
|
|
118
122
|
selected === 1
|
|
119
|
-
?
|
|
123
|
+
? "icon-[mdi--plus-box-outline]"
|
|
120
124
|
: selected === -1
|
|
121
|
-
?
|
|
122
|
-
:
|
|
125
|
+
? "icon-[mdi--minus-box-outline]"
|
|
126
|
+
: "icon-[mdi--checkbox-blank-outline]"
|
|
123
127
|
}
|
|
124
128
|
data-selected={selected}
|
|
125
129
|
/>
|
|
@@ -127,14 +131,20 @@ const CheckItem: FC<
|
|
|
127
131
|
<Icon
|
|
128
132
|
data-type="positive"
|
|
129
133
|
onClick={(e) => [(onClick(id, false), e.stopPropagation())]}
|
|
130
|
-
icon={
|
|
134
|
+
icon={
|
|
135
|
+
selected === 1
|
|
136
|
+
? "icon-[mdi--plus-box]"
|
|
137
|
+
: "icon-[mdi--plus-box-outline]"
|
|
138
|
+
}
|
|
131
139
|
data-selected={selected === 1}
|
|
132
140
|
/>
|
|
133
141
|
<Icon
|
|
134
142
|
data-type="negative"
|
|
135
143
|
onClick={(e) => [(onClick(id, true), e.stopPropagation())]}
|
|
136
144
|
icon={
|
|
137
|
-
selected === -1
|
|
145
|
+
selected === -1
|
|
146
|
+
? "icon-[mdi--minus-box]"
|
|
147
|
+
: "icon-[mdi--minus-box-outline]"
|
|
138
148
|
}
|
|
139
149
|
data-selected={selected === -1}
|
|
140
150
|
/>
|
|
@@ -21,13 +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 {
|
|
25
|
-
ActionLabel,
|
|
26
|
-
Button,
|
|
27
|
-
CoreIcons,
|
|
28
|
-
EmptyContent,
|
|
29
|
-
Icon,
|
|
30
|
-
} from "@react-fabric/core";
|
|
24
|
+
import { ActionLabel, Button, EmptyContent, Icon } from "@react-fabric/core";
|
|
31
25
|
import {
|
|
32
26
|
type ColorType,
|
|
33
27
|
type PaletteType,
|
|
@@ -178,7 +172,7 @@ export const Histogram = ({
|
|
|
178
172
|
color="danger"
|
|
179
173
|
size="sm"
|
|
180
174
|
stopPropagation
|
|
181
|
-
icon=
|
|
175
|
+
icon="icon-[mdi--filter-minus]"
|
|
182
176
|
aria-label="Filter Negative"
|
|
183
177
|
onClick={() => onClick?.(item.id, true)}
|
|
184
178
|
/>,
|
|
@@ -187,7 +181,7 @@ export const Histogram = ({
|
|
|
187
181
|
color="primary"
|
|
188
182
|
size="sm"
|
|
189
183
|
stopPropagation
|
|
190
|
-
icon=
|
|
184
|
+
icon="icon-[mdi--filter-plus]"
|
|
191
185
|
aria-label="Filter"
|
|
192
186
|
onClick={() => onClick?.(item.id)}
|
|
193
187
|
/>,
|
package/src/json/JsonViewer.tsx
CHANGED
|
@@ -24,7 +24,6 @@
|
|
|
24
24
|
import {
|
|
25
25
|
Button,
|
|
26
26
|
Copy,
|
|
27
|
-
CoreIcons,
|
|
28
27
|
EmptyContent,
|
|
29
28
|
Icon,
|
|
30
29
|
Meter,
|
|
@@ -230,7 +229,7 @@ const JsonEntry = ({
|
|
|
230
229
|
color="danger"
|
|
231
230
|
size="xs"
|
|
232
231
|
variant="link"
|
|
233
|
-
icon=
|
|
232
|
+
icon="icon-[mdi--filter-minus]"
|
|
234
233
|
aria-label="Filter Negative"
|
|
235
234
|
onClick={() => onFilter?.(pathWithoutOrdinal, actualValue, true)}
|
|
236
235
|
/>
|
|
@@ -239,7 +238,7 @@ const JsonEntry = ({
|
|
|
239
238
|
color="primary"
|
|
240
239
|
size="xs"
|
|
241
240
|
variant="link"
|
|
242
|
-
icon=
|
|
241
|
+
icon="icon-[mdi--filter-plus]"
|
|
243
242
|
aria-label="Filter"
|
|
244
243
|
onClick={() => onFilter?.(pathWithoutOrdinal, actualValue)}
|
|
245
244
|
/>
|
|
@@ -277,7 +276,11 @@ const JsonEntry = ({
|
|
|
277
276
|
{canExpand && (
|
|
278
277
|
<Icon
|
|
279
278
|
rtlFlip
|
|
280
|
-
icon={
|
|
279
|
+
icon={
|
|
280
|
+
expanded
|
|
281
|
+
? "icon-[mdi--chevron-down]"
|
|
282
|
+
: "icon-[mdi--chevron-right]"
|
|
283
|
+
}
|
|
281
284
|
/>
|
|
282
285
|
)}
|
|
283
286
|
{labelDisplay}
|
|
@@ -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 {
|
|
24
|
+
import { Icon } from "@react-fabric/core";
|
|
25
25
|
import classNames from "classnames";
|
|
26
26
|
import { Fragment, memo, useMemo } from "react";
|
|
27
27
|
|
|
@@ -125,7 +125,7 @@ export const Pagination = memo(
|
|
|
125
125
|
page === 0 && "pointer-events-none text-tint-300",
|
|
126
126
|
)}
|
|
127
127
|
>
|
|
128
|
-
<Icon icon=
|
|
128
|
+
<Icon icon="icon-[mdi--chevron-double-left]" rtlFlip />
|
|
129
129
|
</button>
|
|
130
130
|
<button
|
|
131
131
|
onClick={() => onPageChange(page - 1)}
|
|
@@ -134,7 +134,7 @@ export const Pagination = memo(
|
|
|
134
134
|
page === 0 && "pointer-events-none text-tint-300",
|
|
135
135
|
)}
|
|
136
136
|
>
|
|
137
|
-
<Icon icon=
|
|
137
|
+
<Icon icon="icon-[mdi--chevron-left]" rtlFlip />
|
|
138
138
|
</button>
|
|
139
139
|
{!minimal && pageBody}
|
|
140
140
|
{minimal && (
|
|
@@ -149,7 +149,7 @@ export const Pagination = memo(
|
|
|
149
149
|
page + 1 >= totalPages && "pointer-events-none text-tint-300",
|
|
150
150
|
)}
|
|
151
151
|
>
|
|
152
|
-
<Icon icon=
|
|
152
|
+
<Icon icon="icon-[mdi--chevron-right]" rtlFlip />
|
|
153
153
|
</button>
|
|
154
154
|
<button
|
|
155
155
|
onClick={() => onPageChange(totalPages - 1)}
|
|
@@ -158,7 +158,7 @@ export const Pagination = memo(
|
|
|
158
158
|
page + 1 >= totalPages && "pointer-events-none text-tint-300",
|
|
159
159
|
)}
|
|
160
160
|
>
|
|
161
|
-
<Icon icon=
|
|
161
|
+
<Icon icon="icon-[mdi--chevron-double-right]" rtlFlip />
|
|
162
162
|
</button>
|
|
163
163
|
</div>
|
|
164
164
|
);
|
package/src/table/AddColumn.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 {
|
|
24
|
+
import { Dropdown, Icon, Menu, MenuItem } from "@react-fabric/core";
|
|
25
25
|
import { type TableColumn } from "./types";
|
|
26
26
|
|
|
27
27
|
export const AddColumn = ({
|
|
@@ -35,7 +35,7 @@ export const AddColumn = ({
|
|
|
35
35
|
<div className="group font-medium w-6 flex flex-nowrap text-start items-center">
|
|
36
36
|
<Dropdown placement="bottom-end">
|
|
37
37
|
<Icon
|
|
38
|
-
icon=
|
|
38
|
+
icon="icon-[mdi--plus-circle-outline]"
|
|
39
39
|
className="p-1 rounded-t rounded-b-none hover:outline"
|
|
40
40
|
/>
|
|
41
41
|
<Menu className="text-sm" onClick={onClick}>
|
|
@@ -45,7 +45,7 @@ export const AddColumn = ({
|
|
|
45
45
|
id={String(col.id)}
|
|
46
46
|
data-dropdown-dismiss="false"
|
|
47
47
|
label={`${col.label ?? String(col.id)}`}
|
|
48
|
-
icon={!col.hidden ?
|
|
48
|
+
icon={!col.hidden ? "icon-[mdi--check]" : ""}
|
|
49
49
|
/>
|
|
50
50
|
))}
|
|
51
51
|
</Menu>
|
package/src/table/BodyCell.tsx
CHANGED
|
@@ -22,7 +22,13 @@
|
|
|
22
22
|
*/
|
|
23
23
|
|
|
24
24
|
import { DateDisplay } from "@react-fabric/date";
|
|
25
|
-
import {
|
|
25
|
+
import {
|
|
26
|
+
Format,
|
|
27
|
+
getByPath,
|
|
28
|
+
isArray,
|
|
29
|
+
isObject,
|
|
30
|
+
isTrue,
|
|
31
|
+
} from "@react-fabric/utilities";
|
|
26
32
|
import classNames from "classnames";
|
|
27
33
|
import { useMemo } from "react";
|
|
28
34
|
import { useTableContext } from "./Context";
|
|
@@ -55,11 +61,14 @@ export const BodyCell = ({
|
|
|
55
61
|
return column.renderer(value, item, index);
|
|
56
62
|
}
|
|
57
63
|
if (column.dataType === "boolean") {
|
|
58
|
-
const map = column.valueMap ?? { true: "Yes", false: "
|
|
64
|
+
const map = column.valueMap ?? { true: "Yes", false: "No" };
|
|
59
65
|
return map[`${isTrue(value) ? "true" : "false"}`];
|
|
60
66
|
}
|
|
61
67
|
if (column.valueMap != null) {
|
|
62
|
-
if (
|
|
68
|
+
if (
|
|
69
|
+
["number", "string"].includes(column.dataType ?? "string") &&
|
|
70
|
+
value in column.valueMap
|
|
71
|
+
) {
|
|
63
72
|
return column.valueMap[value];
|
|
64
73
|
}
|
|
65
74
|
}
|
|
@@ -69,6 +78,12 @@ export const BodyCell = ({
|
|
|
69
78
|
if (column.dataType === "number") {
|
|
70
79
|
return Format.number(value, column.format);
|
|
71
80
|
}
|
|
81
|
+
if (isObject(value)) {
|
|
82
|
+
return JSON.stringify(value);
|
|
83
|
+
}
|
|
84
|
+
if (isArray(value)) {
|
|
85
|
+
return value.join(", ");
|
|
86
|
+
}
|
|
72
87
|
return value ?? "";
|
|
73
88
|
}, [item, column]);
|
|
74
89
|
|
package/src/table/BodyRow.tsx
CHANGED
|
@@ -21,11 +21,11 @@
|
|
|
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 { Icon } from "@react-fabric/core";
|
|
24
25
|
import classNames from "classnames";
|
|
25
26
|
import { BodyCell } from "./BodyCell";
|
|
26
27
|
import { CheckboxCell } from "./CheckboxCell";
|
|
27
28
|
import { type TableColumn } from "./types";
|
|
28
|
-
import { CoreIcons, Icon } from "@react-fabric/core";
|
|
29
29
|
|
|
30
30
|
export const BodyRow = ({
|
|
31
31
|
rowKey,
|
|
@@ -94,7 +94,9 @@ export const BodyRow = ({
|
|
|
94
94
|
>
|
|
95
95
|
<Icon
|
|
96
96
|
className="p-1 text-tint-700 hover:text-primary-600"
|
|
97
|
-
icon={
|
|
97
|
+
icon={
|
|
98
|
+
expanded ? "icon-[mdi--minus-box]" : "icon-[mdi--plus-box]"
|
|
99
|
+
}
|
|
98
100
|
onClick={(e) => [
|
|
99
101
|
keyProperty && toggleExpand(data[keyProperty]),
|
|
100
102
|
e.stopPropagation(),
|