@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/dist/esm/table/Table.js
CHANGED
|
@@ -9,7 +9,7 @@ import { useTranslation } from 'react-i18next';
|
|
|
9
9
|
import { AddColumn } from './AddColumn.js';
|
|
10
10
|
import { BodyRow } from './BodyRow.js';
|
|
11
11
|
import { CheckboxCell } from './CheckboxCell.js';
|
|
12
|
-
import { TableProvider } from './
|
|
12
|
+
import { TableProvider } from './Provider.js';
|
|
13
13
|
import { EmptyCell } from './EmptyCell.js';
|
|
14
14
|
import { HeaderCell } from './HeaderCell.js';
|
|
15
15
|
import { useTableColumns } from './useTableColumns.js';
|
|
@@ -132,7 +132,7 @@ var Table = function Table(_ref) {
|
|
|
132
132
|
ref: scrollerRef,
|
|
133
133
|
children: [/*#__PURE__*/jsxs("div", {
|
|
134
134
|
"data-ref": "tableHeader",
|
|
135
|
-
className: "bg-
|
|
135
|
+
className: "bg-default font-medium sticky top-0 h-8 area-head border-b select-none flex flex-nowrap z-3",
|
|
136
136
|
children: [/*#__PURE__*/jsxs("div", {
|
|
137
137
|
className: wrapperStart,
|
|
138
138
|
children: [canExpand && /*#__PURE__*/jsx("div", {
|
|
@@ -186,7 +186,7 @@ var Table = function Table(_ref) {
|
|
|
186
186
|
return "__GROUP__" in data ? /*#__PURE__*/jsx("div", {
|
|
187
187
|
ref: measureElement,
|
|
188
188
|
"data-index": index,
|
|
189
|
-
className: classNames("text-md bg-
|
|
189
|
+
className: classNames("text-md bg-default 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);
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { createContext, useContext } from 'react';
|
|
4
|
+
|
|
5
|
+
/*
|
|
6
|
+
* React Fabric
|
|
7
|
+
* @version: 1.0.0
|
|
8
|
+
*
|
|
9
|
+
*
|
|
10
|
+
* The MIT License (MIT)
|
|
11
|
+
* Copyright (c) 2026 Adarsh Pastakia
|
|
12
|
+
*
|
|
13
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software
|
|
14
|
+
* and associated documentation files (the "Software"), to deal in the Software without restriction,
|
|
15
|
+
* including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
16
|
+
* and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
|
|
17
|
+
* subject to the following conditions:
|
|
18
|
+
*
|
|
19
|
+
* The above copyright notice and this permission notice shall be included in all copies or substantial
|
|
20
|
+
* portions of the Software.
|
|
21
|
+
*
|
|
22
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
|
|
23
|
+
* TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
24
|
+
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
25
|
+
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
var TableContext = /*#__PURE__*/createContext({});
|
|
29
|
+
var useTableContext = function useTableContext() {
|
|
30
|
+
return useContext(TableContext);
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export { TableContext, useTableContext };
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
+
import { useCallback } from 'react';
|
|
4
|
+
|
|
3
5
|
/*
|
|
4
6
|
* React Fabric
|
|
5
7
|
* @version: 1.0.0
|
|
@@ -26,20 +28,20 @@
|
|
|
26
28
|
var useResizer = function useResizer(colEl, ghostEl, callback) {
|
|
27
29
|
var placeholder = ghostEl.firstElementChild;
|
|
28
30
|
var isRtl = getComputedStyle(colEl).direction === "rtl";
|
|
29
|
-
var onResize = function
|
|
31
|
+
var onResize = useCallback(function (evt) {
|
|
30
32
|
/** ***************** check if reverse enabled of RTL *******************/
|
|
31
33
|
var box = colEl.getBoundingClientRect();
|
|
32
34
|
var x = isRtl ? box.left - evt.clientX : evt.clientX - box.right;
|
|
33
35
|
placeholder.style.width = "".concat(colEl.offsetWidth + x, "px");
|
|
34
|
-
};
|
|
36
|
+
}, [colEl, isRtl, placeholder]);
|
|
35
37
|
|
|
36
38
|
/** ***************** dettach handlers on mouseup *******************/
|
|
37
|
-
var onResizeEnd = function
|
|
39
|
+
var onResizeEnd = useCallback(function () {
|
|
38
40
|
callback(placeholder.offsetWidth);
|
|
39
41
|
ghostEl.style.display = "none";
|
|
40
42
|
document.removeEventListener("mousemove", onResize);
|
|
41
43
|
document.removeEventListener("mouseup", onResizeEnd);
|
|
42
|
-
};
|
|
44
|
+
}, [callback, placeholder, ghostEl]);
|
|
43
45
|
|
|
44
46
|
/** ***************** attach handlers *******************/
|
|
45
47
|
var box = colEl.getBoundingClientRect();
|
package/dist/esm/tree/useTree.js
CHANGED
|
@@ -7,7 +7,7 @@ import { useDebounce } from '@react-fabric/core';
|
|
|
7
7
|
import { EMPTY_ARRAY, isEmpty } from '@react-fabric/utilities';
|
|
8
8
|
import memoizeOne from 'memoize-one';
|
|
9
9
|
import { useEffectEvent, useRef, useCallback, useReducer, useEffect } from 'react';
|
|
10
|
-
import { refactorTree, makeTreeMap, flattenTree, updateSelection, updateChecked, filterTree } from './utils.js';
|
|
10
|
+
import { refactorTree as _refactorTree, makeTreeMap as _makeTreeMap, flattenTree as _flattenTree, updateSelection, updateChecked, filterTree } from './utils.js';
|
|
11
11
|
|
|
12
12
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
13
13
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
@@ -55,7 +55,7 @@ var useTree = function useTree(_ref) {
|
|
|
55
55
|
setTimeout(function () {
|
|
56
56
|
void Promise.resolve(onLoad === null || onLoad === void 0 ? void 0 : onLoad(node.id)).then(function () {
|
|
57
57
|
var resp = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : EMPTY_ARRAY;
|
|
58
|
-
node.children =
|
|
58
|
+
node.children = _refactorTree(resp, {
|
|
59
59
|
sorter: sorter,
|
|
60
60
|
defaultExpanded: defaultExpanded
|
|
61
61
|
}, {
|
|
@@ -96,12 +96,12 @@ var useTree = function useTree(_ref) {
|
|
|
96
96
|
}, [onQuery]);
|
|
97
97
|
var _useReducer = useReducer(function (state, action) {
|
|
98
98
|
if (action.type === "load") {
|
|
99
|
-
state.items =
|
|
99
|
+
state.items = _refactorTree(action.items, {
|
|
100
100
|
sorter: sorter,
|
|
101
101
|
defaultExpanded: defaultExpanded
|
|
102
102
|
});
|
|
103
|
-
state.itemMap =
|
|
104
|
-
state.tree =
|
|
103
|
+
state.itemMap = _makeTreeMap(state.items);
|
|
104
|
+
state.tree = _flattenTree(state.items);
|
|
105
105
|
state.selected = undefined;
|
|
106
106
|
state.checked = undefined;
|
|
107
107
|
state.query = "";
|
|
@@ -117,9 +117,9 @@ var useTree = function useTree(_ref) {
|
|
|
117
117
|
}
|
|
118
118
|
if (action.type === "loaded") {
|
|
119
119
|
var _state$checked;
|
|
120
|
-
state.itemMap =
|
|
120
|
+
state.itemMap = _makeTreeMap(state.items);
|
|
121
121
|
fireExpandToggle(Array.from(state.itemMap.values()));
|
|
122
|
-
state.tree =
|
|
122
|
+
state.tree = _flattenTree(state.items);
|
|
123
123
|
state.selected = selected;
|
|
124
124
|
updateSelection({
|
|
125
125
|
nodes: state.itemMap,
|
|
@@ -151,7 +151,7 @@ var useTree = function useTree(_ref) {
|
|
|
151
151
|
!node.leaf && ((_node$children2 = node.children) === null || _node$children2 === void 0 ? void 0 : _node$children2.length) && (node.open = true);
|
|
152
152
|
});
|
|
153
153
|
fireExpandToggle(Array.from(state.itemMap.values()));
|
|
154
|
-
state.tree =
|
|
154
|
+
state.tree = _flattenTree(state.items);
|
|
155
155
|
return _objectSpread({}, state);
|
|
156
156
|
}
|
|
157
157
|
if (action.type === "collapseAll") {
|
|
@@ -159,7 +159,7 @@ var useTree = function useTree(_ref) {
|
|
|
159
159
|
!node.leaf && (node.open = false);
|
|
160
160
|
});
|
|
161
161
|
fireExpandToggle([]);
|
|
162
|
-
state.tree =
|
|
162
|
+
state.tree = _flattenTree(state.items);
|
|
163
163
|
return _objectSpread({}, state);
|
|
164
164
|
}
|
|
165
165
|
if (action.type === "filter") {
|
|
@@ -173,7 +173,7 @@ var useTree = function useTree(_ref) {
|
|
|
173
173
|
}
|
|
174
174
|
} else {
|
|
175
175
|
filterTree(state.itemMap, action.query, matcher);
|
|
176
|
-
state.tree =
|
|
176
|
+
state.tree = _flattenTree(state.items);
|
|
177
177
|
}
|
|
178
178
|
return _objectSpread(_objectSpread({}, state), {}, {
|
|
179
179
|
query: action.query
|
|
@@ -195,7 +195,7 @@ var useTree = function useTree(_ref) {
|
|
|
195
195
|
selected: state.selected,
|
|
196
196
|
multiple: multiple
|
|
197
197
|
});
|
|
198
|
-
state.tree =
|
|
198
|
+
state.tree = _flattenTree(state.items);
|
|
199
199
|
fireSelected(state.selected, (_state$itemMap$get = state.itemMap.get(action.id)) === null || _state$itemMap$get === void 0 ? void 0 : _state$itemMap$get.data);
|
|
200
200
|
return _objectSpread({}, state);
|
|
201
201
|
}
|
|
@@ -206,7 +206,7 @@ var useTree = function useTree(_ref) {
|
|
|
206
206
|
multiple: multiple,
|
|
207
207
|
selected: action.id
|
|
208
208
|
});
|
|
209
|
-
state.tree =
|
|
209
|
+
state.tree = _flattenTree(state.items);
|
|
210
210
|
return _objectSpread({}, state);
|
|
211
211
|
}
|
|
212
212
|
if (action.type === "toggleCheck") {
|
package/dist/esm/tree/utils.js
CHANGED
|
@@ -10,10 +10,10 @@ var defaultSorter = function defaultSorter(a, b) {
|
|
|
10
10
|
if (!!a.leaf !== !!b.leaf) return a.leaf ? 1 : -1;
|
|
11
11
|
return compareValues()(a.label, b.label);
|
|
12
12
|
};
|
|
13
|
-
var
|
|
13
|
+
var _getChildren = function getChildren() {
|
|
14
14
|
var list = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
15
15
|
return list.map(function (item) {
|
|
16
|
-
return [item].concat(_toConsumableArray(
|
|
16
|
+
return [item].concat(_toConsumableArray(_getChildren(item.children)));
|
|
17
17
|
}).flat(99).filter(Boolean);
|
|
18
18
|
};
|
|
19
19
|
var getIntermediate = function getIntermediate() {
|
|
@@ -28,7 +28,7 @@ var getIntermediate = function getIntermediate() {
|
|
|
28
28
|
};
|
|
29
29
|
|
|
30
30
|
// convert node item to internal node used by the tree
|
|
31
|
-
var
|
|
31
|
+
var _refactorTree = function refactorTree(nodes, _ref) {
|
|
32
32
|
var _ref$sorter = _ref.sorter,
|
|
33
33
|
sorter = _ref$sorter === void 0 ? defaultSorter : _ref$sorter,
|
|
34
34
|
_ref$defaultExpanded = _ref.defaultExpanded,
|
|
@@ -52,7 +52,7 @@ var refactorTree = function refactorTree(nodes, _ref) {
|
|
|
52
52
|
lines: []
|
|
53
53
|
}, node), {}, {
|
|
54
54
|
leaf: !!node.leaf,
|
|
55
|
-
children: node.children &&
|
|
55
|
+
children: node.children && _refactorTree(node.children, {
|
|
56
56
|
sorter: sorter,
|
|
57
57
|
defaultExpanded: defaultExpanded
|
|
58
58
|
}, {
|
|
@@ -63,18 +63,16 @@ var refactorTree = function refactorTree(nodes, _ref) {
|
|
|
63
63
|
});
|
|
64
64
|
return list;
|
|
65
65
|
};
|
|
66
|
-
var
|
|
66
|
+
var _makeTreeMap = function makeTreeMap(nodes) {
|
|
67
67
|
var map = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : new Map();
|
|
68
68
|
nodes.forEach(function (node) {
|
|
69
69
|
if (map.has(node.id)) throw new Error("Node with id [".concat(node.id, "] already exists, please make sure all ids are unique"));
|
|
70
70
|
map.set(node.id, node);
|
|
71
|
-
node.children &&
|
|
71
|
+
node.children && _makeTreeMap(node.children, map);
|
|
72
72
|
});
|
|
73
73
|
return map;
|
|
74
74
|
};
|
|
75
|
-
|
|
76
|
-
// make flat list to be rendered by virtual list
|
|
77
|
-
var flattenTree = function flattenTree(nodes) {
|
|
75
|
+
var _flattenTree = function flattenTree(nodes) {
|
|
78
76
|
var lines = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
79
77
|
var list = [];
|
|
80
78
|
var filtered = nodes.filter(function (node) {
|
|
@@ -84,7 +82,7 @@ var flattenTree = function flattenTree(nodes) {
|
|
|
84
82
|
var _node$children2;
|
|
85
83
|
node.lines = [].concat(_toConsumableArray(lines), [idx === filtered.length - 1 ? 2 : 3]);
|
|
86
84
|
list.push(node);
|
|
87
|
-
(node.open || node.childFiltered) && node.children && list.push.apply(list, _toConsumableArray(
|
|
85
|
+
(node.open || node.childFiltered) && node.children && list.push.apply(list, _toConsumableArray(_flattenTree(node.children.filter(function (child) {
|
|
88
86
|
return !child.filtered;
|
|
89
87
|
}), [].concat(_toConsumableArray(lines), [idx === filtered.length - 1 ? 0 : 1]))));
|
|
90
88
|
node.open && ((_node$children2 = node.children) === null || _node$children2 === void 0 ? void 0 : _node$children2.length) === 0 && list.push({
|
|
@@ -127,7 +125,7 @@ var updateChecked = function updateChecked(list, id, checked) {
|
|
|
127
125
|
if (node) {
|
|
128
126
|
node.checked = (checked !== null && checked !== void 0 ? checked : node.checked === 0) ? 1 : 0;
|
|
129
127
|
// check all children
|
|
130
|
-
node.children &&
|
|
128
|
+
node.children && _getChildren(node.children).forEach(function (child) {
|
|
131
129
|
return child.checked = node.checked;
|
|
132
130
|
});
|
|
133
131
|
var parent = node.parent;
|
|
@@ -151,7 +149,7 @@ var filterTree = function filterTree(nodes, query, matcher) {
|
|
|
151
149
|
parentNode && (parentNode.childFiltered = true);
|
|
152
150
|
parent = parentNode === null || parentNode === void 0 ? void 0 : parentNode.parent;
|
|
153
151
|
}
|
|
154
|
-
node.children &&
|
|
152
|
+
node.children && _getChildren(node.children).forEach(function (child) {
|
|
155
153
|
child.parentFiltered = true;
|
|
156
154
|
child.filtered = false;
|
|
157
155
|
});
|
|
@@ -164,4 +162,4 @@ var filterTree = function filterTree(nodes, query, matcher) {
|
|
|
164
162
|
});
|
|
165
163
|
};
|
|
166
164
|
|
|
167
|
-
export { filterTree, flattenTree, makeTreeMap, refactorTree, updateChecked, updateSelection };
|
|
165
|
+
export { filterTree, _flattenTree as flattenTree, _makeTreeMap as makeTreeMap, _refactorTree as refactorTree, updateChecked, updateSelection };
|
|
@@ -182,7 +182,7 @@ var _VirtualGallery = function _VirtualGallery(_ref) {
|
|
|
182
182
|
return /*#__PURE__*/jsx("div", _objectSpread(_objectSpread({
|
|
183
183
|
ref: scrollerRef,
|
|
184
184
|
onScroll: handleScroll,
|
|
185
|
-
className: classNames("area-content bg-
|
|
185
|
+
className: classNames("area-content bg-default overflow-auto")
|
|
186
186
|
}, aria), {}, {
|
|
187
187
|
children: /*#__PURE__*/jsxs("div", {
|
|
188
188
|
className: classNames("flex flex-nowrap justify-center gap-2 min-h-full"),
|
|
@@ -258,7 +258,7 @@ var GenericMemo = memo;
|
|
|
258
258
|
* It also provides a scroller for easy navigation through the items.
|
|
259
259
|
*
|
|
260
260
|
* @param {VirtualGalleryProps<T>} props - The properties for the VirtualGallery component.
|
|
261
|
-
* @returns {
|
|
261
|
+
* @returns {React.ReactElement} The rendered VirtualGallery component.
|
|
262
262
|
*
|
|
263
263
|
* @example
|
|
264
264
|
* ```jsx
|
package/dist/esm/virtual/List.js
CHANGED
|
@@ -169,7 +169,7 @@ var _VirtualList = function _VirtualList(_ref) {
|
|
|
169
169
|
return /*#__PURE__*/jsx("div", _objectSpread(_objectSpread({
|
|
170
170
|
ref: scrollerRef,
|
|
171
171
|
onScroll: handleScroll,
|
|
172
|
-
className: classNames("area-content bg-
|
|
172
|
+
className: classNames("area-content bg-default overflow-auto")
|
|
173
173
|
}, aria), {}, {
|
|
174
174
|
children: /*#__PURE__*/jsxs("div", {
|
|
175
175
|
className: classNames("flex flex-nowrap gap-2 justify-center min-h-full min-w-full", orientation === "horizontal" && "flex-col"),
|
|
@@ -214,7 +214,7 @@ var _VirtualList = function _VirtualList(_ref) {
|
|
|
214
214
|
children: /*#__PURE__*/jsx(Skeleton, {})
|
|
215
215
|
})]
|
|
216
216
|
}), !hideScroller && /*#__PURE__*/jsx("div", {
|
|
217
|
-
className: classNames(orientation === "vertical" && "self-end sticky bottom-2", orientation === "horizontal" && "self-end sticky
|
|
217
|
+
className: classNames(orientation === "vertical" && "self-end sticky bottom-2", orientation === "horizontal" && "self-end sticky inset-e-2"),
|
|
218
218
|
children: /*#__PURE__*/jsx(Scroller, {
|
|
219
219
|
vertical: orientation === "vertical",
|
|
220
220
|
scrollActive: scrollActive,
|
|
@@ -246,7 +246,7 @@ var GenericMemo = memo;
|
|
|
246
246
|
* It can be used with a ref to control scrolling and hilighting of items.
|
|
247
247
|
*
|
|
248
248
|
* @param {VirtualListProps<T>} props - The properties for the VirtualList component.
|
|
249
|
-
* @returns {
|
|
249
|
+
* @returns {React.ReactElement} The rendered VirtualList component.
|
|
250
250
|
* @template T - The type of items in the list, extending AnyObject.
|
|
251
251
|
*
|
|
252
252
|
* @example
|
|
@@ -32,7 +32,7 @@ export interface CheckListProps extends SelectableProps, TestProps {
|
|
|
32
32
|
* It supports selection, deselection, and allows for negative selections.
|
|
33
33
|
*
|
|
34
34
|
* @param {CheckListProps} props - The properties for the CheckList component.
|
|
35
|
-
* @returns {
|
|
35
|
+
* @returns {React.ReactElement} The rendered CheckList component.
|
|
36
36
|
*
|
|
37
37
|
* @example
|
|
38
38
|
* ```jsx
|
|
@@ -26,11 +26,11 @@ export interface HistogramProps extends TestProps {
|
|
|
26
26
|
/**
|
|
27
27
|
* title when histo list is empty
|
|
28
28
|
*/
|
|
29
|
-
emptyTitle?: string |
|
|
29
|
+
emptyTitle?: string | React.ReactElement;
|
|
30
30
|
/**
|
|
31
31
|
* message when histo list is empty
|
|
32
32
|
*/
|
|
33
|
-
emptyMessage?: string |
|
|
33
|
+
emptyMessage?: string | React.ReactElement;
|
|
34
34
|
/**
|
|
35
35
|
* handle histo click
|
|
36
36
|
*/
|
|
@@ -43,7 +43,7 @@ export interface HistogramProps extends TestProps {
|
|
|
43
43
|
* It also provides an empty state when there are no items to display.
|
|
44
44
|
*
|
|
45
45
|
* @param {HistogramProps} props - The properties for the Histogram component.
|
|
46
|
-
* @returns {
|
|
46
|
+
* @returns {React.ReactElement} - The rendered Histogram component.
|
|
47
47
|
*
|
|
48
48
|
* @example
|
|
49
49
|
* ```jsx
|
|
@@ -53,7 +53,7 @@ export interface JsonViewProps<T> extends CssProp {
|
|
|
53
53
|
/**
|
|
54
54
|
* render function for custom value display
|
|
55
55
|
*/
|
|
56
|
-
formatter?: (path?: string, value?: AnyObject) => string |
|
|
56
|
+
formatter?: (path?: string, value?: AnyObject) => string | React.ReactElement | undefined;
|
|
57
57
|
}
|
|
58
58
|
/**
|
|
59
59
|
* JsonViewer component to display JSON data in a structured format.
|
|
@@ -62,7 +62,7 @@ export interface JsonViewProps<T> extends CssProp {
|
|
|
62
62
|
* It also provides options for copying values and filtering properties.
|
|
63
63
|
*
|
|
64
64
|
* @param {JsonViewProps<T>} props - The properties for the JsonViewer component.
|
|
65
|
-
* @returns {
|
|
65
|
+
* @returns {React.ReactElement} The rendered JsonViewer component.
|
|
66
66
|
*
|
|
67
67
|
* @example
|
|
68
68
|
* ```jsx
|
|
@@ -28,6 +28,6 @@ export interface PaginationProps {
|
|
|
28
28
|
* It uses memoization to optimize rendering performance.
|
|
29
29
|
*
|
|
30
30
|
* @param {PaginationProps} props - The properties for the Pagination component.
|
|
31
|
-
* @returns {
|
|
31
|
+
* @returns {React.ReactElement} The rendered Pagination component.
|
|
32
32
|
*/
|
|
33
33
|
export declare const Pagination: import("react").MemoExoticComponent<({ page, ranges, totalPages, minimal, onPageChange }: PaginationProps) => import("react/jsx-runtime").JSX.Element>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { type TableColumn } from "./types";
|
|
2
|
-
export declare const EmptyCell: ({ id, width: _width, maxWidth, minWidth
|
|
2
|
+
export declare const EmptyCell: ({ id, width: _width, maxWidth, minWidth }: TableColumn) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,8 +1,2 @@
|
|
|
1
1
|
import { type ChildrenProp } from "@react-fabric/core/dist/types/types";
|
|
2
|
-
interface Context {
|
|
3
|
-
widths: Map<string, number>;
|
|
4
|
-
startResize: (col: HTMLElement) => void;
|
|
5
|
-
}
|
|
6
2
|
export declare const TableProvider: ({ children }: ChildrenProp) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
-
export declare const useTableContext: () => Context;
|
|
8
|
-
export {};
|
|
@@ -7,7 +7,7 @@ import { type TableProps } from "./types";
|
|
|
7
7
|
* Uses TanStack's `useVirtual` for virtualization and React's `useMemo` for performance optimization.
|
|
8
8
|
*
|
|
9
9
|
* @param {TableProps<T>} props - The properties for the Table component.
|
|
10
|
-
* @returns {
|
|
10
|
+
* @returns {React.ReactElement} The rendered Table component.
|
|
11
11
|
*
|
|
12
12
|
* @see {@link https://adarshpastakia.github.io/react-fabric/?path=/story/data-table--table}
|
|
13
13
|
* @see {@link https://tanstack.com/table/v8/docs/api/virtual}
|
|
@@ -25,7 +25,7 @@ export declare const useVirtualTable: <T extends KeyValue = KeyValue>(data: T[],
|
|
|
25
25
|
isActiveSticky: (index: number) => boolean;
|
|
26
26
|
top: number | undefined;
|
|
27
27
|
totalSize: () => number;
|
|
28
|
-
measureElement: (node: Element | null
|
|
28
|
+
measureElement: (node: Element | null) => void;
|
|
29
29
|
toggleGroupExpand: (key: Key) => void;
|
|
30
30
|
toggleExpand: (key: Key) => void;
|
|
31
31
|
toggleChecked: (key: Key) => void;
|
|
@@ -5,7 +5,7 @@ import { type TreePanelProps } from "./types";
|
|
|
5
5
|
* nodes and supports checkable nodes.
|
|
6
6
|
*
|
|
7
7
|
* @param {TreePanelProps<T>} props - The properties for the TreePanel component.
|
|
8
|
-
* @returns {
|
|
8
|
+
* @returns {React.ReactElement} The rendered TreePanel component.
|
|
9
9
|
* @template T - The type of items in the tree, extending KeyValue.
|
|
10
10
|
*
|
|
11
11
|
* @example
|
|
@@ -5,7 +5,7 @@ interface TreeBaseNode<T> extends CssProp, TestProps {
|
|
|
5
5
|
/**
|
|
6
6
|
* display label
|
|
7
7
|
*/
|
|
8
|
-
label: Elements<
|
|
8
|
+
label: Elements<React.ReactElement>;
|
|
9
9
|
/**
|
|
10
10
|
* icon path or props
|
|
11
11
|
*/
|
|
@@ -39,7 +39,7 @@ export type TreeNodeType<T extends KeyValue = KeyValue> = TreeBaseNode<T> & ({
|
|
|
39
39
|
});
|
|
40
40
|
export interface InternalNode extends CssProp, TestProps {
|
|
41
41
|
id: string;
|
|
42
|
-
label: Elements<
|
|
42
|
+
label: Elements<React.ReactElement>;
|
|
43
43
|
queryable?: string;
|
|
44
44
|
badge?: string | number | BadgeType;
|
|
45
45
|
disabled?: boolean;
|
|
@@ -66,8 +66,8 @@ export interface InternalNode extends CssProp, TestProps {
|
|
|
66
66
|
export interface TreeNodeProps extends ChildProp {
|
|
67
67
|
node: InternalNode;
|
|
68
68
|
expanders: [string, string];
|
|
69
|
-
defaultNodeIcon?: Elements<
|
|
70
|
-
defaultLeafIcon?: Elements<
|
|
69
|
+
defaultNodeIcon?: Elements<React.ReactElement>;
|
|
70
|
+
defaultLeafIcon?: Elements<React.ReactElement>;
|
|
71
71
|
noLines?: boolean;
|
|
72
72
|
selectable?: true | "leafOnly";
|
|
73
73
|
checkable?: true | "leafOnly";
|
|
@@ -176,8 +176,8 @@ interface BaseTreePanelProps<T extends KeyValue = KeyValue> extends TestProps, R
|
|
|
176
176
|
*/
|
|
177
177
|
matcher?: (data: T, query: string) => boolean;
|
|
178
178
|
sorter?: false | ((a: T, b: T) => number);
|
|
179
|
-
makeLabel?: (node: T) => Elements<
|
|
180
|
-
makeIcon?: (node: T) => Elements<
|
|
179
|
+
makeLabel?: (node: T) => Elements<React.ReactElement>;
|
|
180
|
+
makeIcon?: (node: T) => Elements<React.ReactElement>;
|
|
181
181
|
defaultExpanded?: string[];
|
|
182
182
|
onExpandToggle?: (id: string[]) => void;
|
|
183
183
|
leafClassName?: string;
|
|
@@ -64,7 +64,7 @@ export interface VirtualGalleryProps<T> extends TestProps {
|
|
|
64
64
|
* It also provides a scroller for easy navigation through the items.
|
|
65
65
|
*
|
|
66
66
|
* @param {VirtualGalleryProps<T>} props - The properties for the VirtualGallery component.
|
|
67
|
-
* @returns {
|
|
67
|
+
* @returns {React.ReactElement} The rendered VirtualGallery component.
|
|
68
68
|
*
|
|
69
69
|
* @example
|
|
70
70
|
* ```jsx
|
|
@@ -65,7 +65,7 @@ export interface VirtualListProps<T> extends TestProps {
|
|
|
65
65
|
* It can be used with a ref to control scrolling and hilighting of items.
|
|
66
66
|
*
|
|
67
67
|
* @param {VirtualListProps<T>} props - The properties for the VirtualList component.
|
|
68
|
-
* @returns {
|
|
68
|
+
* @returns {React.ReactElement} The rendered VirtualList component.
|
|
69
69
|
* @template T - The type of items in the list, extending AnyObject.
|
|
70
70
|
*
|
|
71
71
|
* @example
|
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.63",
|
|
4
4
|
"description": "RUF: Data package",
|
|
5
5
|
"author": "Adarsh Pastakia <adarshpastakia@outlook.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -35,24 +35,23 @@
|
|
|
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.
|
|
42
|
-
"@tanstack/react-virtual": "~3.13.
|
|
38
|
+
"@react-fabric/core": "^1.0.0-beta.63",
|
|
39
|
+
"@react-fabric/date": "^1.0.0-beta.63",
|
|
40
|
+
"@react-fabric/form": "^1.0.0-beta.63",
|
|
41
|
+
"@react-fabric/utilities": "^1.0.0-beta.63",
|
|
42
|
+
"@tanstack/react-virtual": "~3.13.22",
|
|
43
43
|
"classnames": "~2.5.1",
|
|
44
|
-
"color": "~5.0.2",
|
|
45
44
|
"memoize-one": "~6.0.0"
|
|
46
45
|
},
|
|
47
46
|
"peerDependencies": {
|
|
48
|
-
"i18next": "~25.
|
|
49
|
-
"react": "~19.2.
|
|
50
|
-
"react-dom": "~19.2.
|
|
51
|
-
"react-i18next": "~16.
|
|
47
|
+
"i18next": "~25.8.18",
|
|
48
|
+
"react": "~19.2.4",
|
|
49
|
+
"react-dom": "~19.2.4",
|
|
50
|
+
"react-i18next": "~16.5.8"
|
|
52
51
|
},
|
|
53
52
|
"engines": {
|
|
54
|
-
"node": ">=18.
|
|
55
|
-
"npm": ">=8.
|
|
53
|
+
"node": ">=22.18.0",
|
|
54
|
+
"npm": ">=10.8.0"
|
|
56
55
|
},
|
|
57
|
-
"gitHead": "
|
|
56
|
+
"gitHead": "6e0652b15c6384fbc316842862572e21299a5466"
|
|
58
57
|
}
|
|
@@ -164,7 +164,7 @@ const CheckItem: FC<
|
|
|
164
164
|
* It supports selection, deselection, and allows for negative selections.
|
|
165
165
|
*
|
|
166
166
|
* @param {CheckListProps} props - The properties for the CheckList component.
|
|
167
|
-
* @returns {
|
|
167
|
+
* @returns {React.ReactElement} The rendered CheckList component.
|
|
168
168
|
*
|
|
169
169
|
* @example
|
|
170
170
|
* ```jsx
|
|
@@ -63,11 +63,11 @@ export interface HistogramProps extends TestProps {
|
|
|
63
63
|
/**
|
|
64
64
|
* title when histo list is empty
|
|
65
65
|
*/
|
|
66
|
-
emptyTitle?: string |
|
|
66
|
+
emptyTitle?: string | React.ReactElement;
|
|
67
67
|
/**
|
|
68
68
|
* message when histo list is empty
|
|
69
69
|
*/
|
|
70
|
-
emptyMessage?: string |
|
|
70
|
+
emptyMessage?: string | React.ReactElement;
|
|
71
71
|
/**
|
|
72
72
|
* handle histo click
|
|
73
73
|
*/
|
|
@@ -81,7 +81,7 @@ export interface HistogramProps extends TestProps {
|
|
|
81
81
|
* It also provides an empty state when there are no items to display.
|
|
82
82
|
*
|
|
83
83
|
* @param {HistogramProps} props - The properties for the Histogram component.
|
|
84
|
-
* @returns {
|
|
84
|
+
* @returns {React.ReactElement} - The rendered Histogram component.
|
|
85
85
|
*
|
|
86
86
|
* @example
|
|
87
87
|
* ```jsx
|
package/src/json/JsonViewer.tsx
CHANGED
|
@@ -100,7 +100,7 @@ export interface JsonViewProps<T> extends CssProp {
|
|
|
100
100
|
formatter?: (
|
|
101
101
|
path?: string,
|
|
102
102
|
value?: AnyObject,
|
|
103
|
-
) => string |
|
|
103
|
+
) => string | React.ReactElement | undefined;
|
|
104
104
|
}
|
|
105
105
|
|
|
106
106
|
const reduceObject = (json: AnyObject, keys: string[] = [], prefix = "") => {
|
|
@@ -356,7 +356,7 @@ const JsonEntry = ({
|
|
|
356
356
|
* It also provides options for copying values and filtering properties.
|
|
357
357
|
*
|
|
358
358
|
* @param {JsonViewProps<T>} props - The properties for the JsonViewer component.
|
|
359
|
-
* @returns {
|
|
359
|
+
* @returns {React.ReactElement} The rendered JsonViewer component.
|
|
360
360
|
*
|
|
361
361
|
* @example
|
|
362
362
|
* ```jsx
|
|
@@ -56,7 +56,7 @@ export interface PaginationProps {
|
|
|
56
56
|
* It uses memoization to optimize rendering performance.
|
|
57
57
|
*
|
|
58
58
|
* @param {PaginationProps} props - The properties for the Pagination component.
|
|
59
|
-
* @returns {
|
|
59
|
+
* @returns {React.ReactElement} The rendered Pagination component.
|
|
60
60
|
*/
|
|
61
61
|
export const Pagination = memo(
|
|
62
62
|
({ page, ranges, totalPages, minimal, onPageChange }: PaginationProps) => {
|