@youp-grid/react 0.2.2 → 0.2.3

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Seungyoup Baek
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -10,3 +10,18 @@ npm install @youp-grid/core @youp-grid/react
10
10
  import { YoupGrid } from "@youp-grid/react";
11
11
  import "@youp-grid/react/styles.css";
12
12
  ```
13
+
14
+ ## What It Provides
15
+
16
+ - virtualized React grid UI
17
+ - keyboard navigation and inline editing
18
+ - built-in text, number, checkbox, and select editors
19
+ - clipboard paste, fill handle, delete, undo, and redo write paths
20
+ - column menus, resizing, pinning, visibility, density, and row selection UI
21
+ - loading, empty, error, validation, pending, warning, and read-only states
22
+
23
+ The adapter emits changes through callbacks. Applications keep ownership of row data.
24
+
25
+ ## License
26
+
27
+ MIT. See the repository license.
package/dist/YoupGrid.js CHANGED
@@ -34,8 +34,10 @@ export function YoupGrid(props) {
34
34
  const [editingCell, setEditingCell] = useState();
35
35
  const [columnChooserOpen, setColumnChooserOpen] = useState(false);
36
36
  const [columnMenuOpenId, setColumnMenuOpenId] = useState();
37
+ const [activeTooltipCellKey, setActiveTooltipCellKey] = useState();
37
38
  const showRowSelectionColumn = props.showRowSelectionColumn ?? false;
38
39
  const pinRowSelectionColumn = props.pinRowSelectionColumn ?? false;
40
+ const cellTooltipMode = props.cellTooltip?.mode ?? "native";
39
41
  const gridEditable = (props.editable ?? true) && !props.readOnly;
40
42
  const displayRows = rowModel.displayRows;
41
43
  const virtualRange = useMemo(() => {
@@ -133,7 +135,7 @@ export function YoupGrid(props) {
133
135
  };
134
136
  const getGridCellMeta = (row, rowIndex, column) => {
135
137
  return (props.getCellMeta?.(getCellEditContext(row, rowIndex, column)) ??
136
- props.cellMeta?.[`${row.id}:${column.id}`]);
138
+ props.cellMeta?.[getCellKey(row.id, column.id)]);
137
139
  };
138
140
  const createGridCellValueChange = (cell, value) => {
139
141
  if (!cell.editable) {
@@ -167,6 +169,25 @@ export function YoupGrid(props) {
167
169
  setColumnMenuOpenId(undefined);
168
170
  }
169
171
  }, [columnMenuOpenId, visibleColumns]);
172
+ useEffect(() => {
173
+ if (cellTooltipMode !== "rich") {
174
+ setActiveTooltipCellKey(undefined);
175
+ return;
176
+ }
177
+ const cellKey = props.cellTooltip?.autoOpenCellKey;
178
+ if (!cellKey) {
179
+ return;
180
+ }
181
+ setActiveTooltipCellKey(cellKey);
182
+ const duration = props.cellTooltip?.autoOpenDurationMs ?? 2000;
183
+ if (duration <= 0) {
184
+ return;
185
+ }
186
+ const timeout = window.setTimeout(() => {
187
+ setActiveTooltipCellKey((current) => current === cellKey ? undefined : current);
188
+ }, duration);
189
+ return () => window.clearTimeout(timeout);
190
+ }, [cellTooltipMode, props.cellTooltip?.autoOpenCellKey, props.cellTooltip?.autoOpenDurationMs]);
170
191
  useEffect(() => {
171
192
  if (!props.infiniteScroll || !props.onRowsEndReached || !infiniteScrollTrigger.shouldLoadMore) {
172
193
  return;
@@ -475,10 +496,12 @@ export function YoupGrid(props) {
475
496
  editingCell,
476
497
  editable: gridEditable,
477
498
  disabledReason: props.disabledReason,
499
+ treeData: props.treeData ?? false,
478
500
  canEditCell: canEditGridCell,
479
501
  getCellMeta: getGridCellMeta,
480
502
  setRowSelected: (selected) => controller.setRowSelected(row.id, selected),
481
503
  setFocusedCell,
504
+ toggleTreeRowExpanded: controller.toggleTreeRowExpanded,
482
505
  startFillHandle: (event) => {
483
506
  if (!gridEditable) {
484
507
  return;
@@ -524,6 +547,12 @@ export function YoupGrid(props) {
524
547
  },
525
548
  cancelEditing: cancelEditingCell,
526
549
  commitEditing: commitEditingValue,
550
+ cellTooltipMode,
551
+ activeTooltipCellKey,
552
+ openCellTooltip: setActiveTooltipCellKey,
553
+ closeCellTooltip: (cellKey) => {
554
+ setActiveTooltipCellKey((current) => current === cellKey ? undefined : current);
555
+ },
527
556
  onRowClick: props.onRowClick,
528
557
  onRowDoubleClick: props.onRowDoubleClick,
529
558
  onCellKeyDown: (event, cell) => {
@@ -906,8 +935,10 @@ function renderRow(context) {
906
935
  editingCell: context.editingCell,
907
936
  editable,
908
937
  disabledReason: context.disabledReason,
938
+ treeData: context.treeData,
909
939
  meta,
910
940
  setFocusedCell: context.setFocusedCell,
941
+ toggleTreeRowExpanded: context.toggleTreeRowExpanded,
911
942
  startFillHandle: context.startFillHandle,
912
943
  autoSizeColumn: context.autoSizeColumn,
913
944
  applyCellValue: context.applyCellValue,
@@ -916,6 +947,10 @@ function renderRow(context) {
916
947
  cancelEditing: context.cancelEditing,
917
948
  commitEditing: context.commitEditing,
918
949
  onKeyDown: context.onCellKeyDown,
950
+ cellTooltipMode: context.cellTooltipMode,
951
+ activeTooltipCellKey: context.activeTooltipCellKey,
952
+ openCellTooltip: context.openCellTooltip,
953
+ closeCellTooltip: context.closeCellTooltip,
919
954
  renderCell: context.renderCell,
920
955
  });
921
956
  }));
@@ -960,6 +995,12 @@ function renderCell(context) {
960
995
  const value = column.accessor(context.row.original);
961
996
  const editable = context.editable;
962
997
  const cellAlign = getColumnAlign(column);
998
+ const cellKey = getCellKey(context.row.id, column.id);
999
+ const showTreePrefix = context.treeData && context.columnIndex === 0;
1000
+ const hasRichTooltip = context.cellTooltipMode === "rich" && hasTooltipMessage(context.meta);
1001
+ const tooltipId = hasRichTooltip && context.activeTooltipCellKey === cellKey
1002
+ ? getCellTooltipId(cellKey)
1003
+ : undefined;
963
1004
  const cellContext = {
964
1005
  row: context.row,
965
1006
  column,
@@ -968,6 +1009,9 @@ function renderCell(context) {
968
1009
  focused: context.focused,
969
1010
  editable,
970
1011
  meta: context.meta,
1012
+ treeDepth: context.row.depth,
1013
+ hasChildren: context.row.hasChildren,
1014
+ expanded: context.row.expanded,
971
1015
  };
972
1016
  const cellState = {
973
1017
  row: context.row,
@@ -984,8 +1028,16 @@ function renderCell(context) {
984
1028
  cell: cellState,
985
1029
  row: context.row.original,
986
1030
  disabledReason: context.disabledReason,
1031
+ cellTooltipMode: context.cellTooltipMode,
987
1032
  applyCellValue: context.applyCellValue,
988
1033
  });
1034
+ const renderedContent = showTreePrefix && !context.editing
1035
+ ? renderTreeCellContent({
1036
+ row: context.row,
1037
+ content: cellContent,
1038
+ toggleExpanded: context.toggleTreeRowExpanded,
1039
+ })
1040
+ : cellContent;
989
1041
  return createElement("div", {
990
1042
  key: column.id,
991
1043
  className: getCellClassName([
@@ -996,11 +1048,14 @@ function renderCell(context) {
996
1048
  context.fillTargeted ? "youp-grid__cell--fill-target" : "",
997
1049
  context.editing ? "youp-grid__cell--editing" : "",
998
1050
  !editable ? "youp-grid__cell--disabled" : "",
1051
+ showTreePrefix ? "youp-grid__cell--tree" : "",
1052
+ tooltipId ? "youp-grid__cell--tooltip-open" : "",
999
1053
  context.meta ? `youp-grid__cell--status-${context.meta.status}` : "",
1000
1054
  ].filter(Boolean).join(" "), context.layout),
1001
1055
  role: "gridcell",
1002
1056
  tabIndex: context.focused && !context.editing ? 0 : -1,
1003
- title: getCellTitle(context.meta, context.disabledReason, editable),
1057
+ title: getCellTitle(context.meta, context.disabledReason, editable, context.cellTooltipMode),
1058
+ "aria-describedby": tooltipId,
1004
1059
  "aria-colindex": context.columnIndex + context.ariaColumnOffset + 1,
1005
1060
  "aria-readonly": !editable || undefined,
1006
1061
  "data-youp-row-index": context.rowIndex,
@@ -1026,6 +1081,31 @@ function renderCell(context) {
1026
1081
  }
1027
1082
  },
1028
1083
  onKeyDown: (event) => context.onKeyDown(event, cellState),
1084
+ onMouseEnter: () => {
1085
+ if (hasRichTooltip) {
1086
+ context.openCellTooltip(cellKey);
1087
+ }
1088
+ },
1089
+ onMouseLeave: () => {
1090
+ if (hasRichTooltip) {
1091
+ context.closeCellTooltip(cellKey);
1092
+ }
1093
+ },
1094
+ onFocus: () => {
1095
+ if (hasRichTooltip) {
1096
+ context.openCellTooltip(cellKey);
1097
+ }
1098
+ },
1099
+ onBlur: (event) => {
1100
+ if (!hasRichTooltip) {
1101
+ return;
1102
+ }
1103
+ const nextTarget = event.relatedTarget;
1104
+ if (nextTarget && event.currentTarget.contains(nextTarget)) {
1105
+ return;
1106
+ }
1107
+ context.closeCellTooltip(cellKey);
1108
+ },
1029
1109
  }, context.editing
1030
1110
  ? renderCellEditor({
1031
1111
  cell: cellState,
@@ -1034,7 +1114,7 @@ function renderCell(context) {
1034
1114
  commitEditing: context.commitEditing,
1035
1115
  onKeyDown: context.onKeyDown,
1036
1116
  })
1037
- : cellContent, renderCellStatus(context.meta), !context.editing && context.showFillHandle
1117
+ : renderedContent, renderCellStatus(context.meta, context.cellTooltipMode), renderCellTooltip(context.meta, tooltipId), !context.editing && context.showFillHandle
1038
1118
  ? createElement("span", {
1039
1119
  className: "youp-grid__fill-handle",
1040
1120
  role: "button",
@@ -1062,7 +1142,7 @@ function renderDefaultCellContent(context) {
1062
1142
  type: "checkbox",
1063
1143
  checked: Boolean(context.cell.value),
1064
1144
  disabled: !context.cell.editable,
1065
- title: getCellTitle(context.cell.meta, context.disabledReason, context.cell.editable),
1145
+ title: getCellTitle(context.cell.meta, context.disabledReason, context.cell.editable, context.cellTooltipMode),
1066
1146
  "aria-label": context.cell.column.headerName,
1067
1147
  onChange: (event) => {
1068
1148
  context.applyCellValue(context.cell, event.currentTarget.checked);
@@ -1078,7 +1158,37 @@ function renderDefaultCellContent(context) {
1078
1158
  const text = formatCellValue(context.cell.column, context.row, context.cell.value);
1079
1159
  const placeholder = context.cell.column.placeholder;
1080
1160
  const hasPlaceholder = text.length === 0 && Boolean(placeholder);
1081
- return createElement("span", { className: hasPlaceholder ? "youp-grid__cell-placeholder" : undefined }, hasPlaceholder ? placeholder : text);
1161
+ return createElement("span", {
1162
+ className: [
1163
+ "youp-grid__cell-text",
1164
+ hasPlaceholder ? "youp-grid__cell-placeholder" : "",
1165
+ ].filter(Boolean).join(" "),
1166
+ }, hasPlaceholder ? placeholder : text);
1167
+ }
1168
+ function renderTreeCellContent(context) {
1169
+ const depth = Math.max(0, context.row.depth ?? 0);
1170
+ const toggle = context.row.hasChildren
1171
+ ? createElement("button", {
1172
+ className: "youp-grid__tree-toggle",
1173
+ type: "button",
1174
+ "aria-label": context.row.expanded ? "Collapse row" : "Expand row",
1175
+ "aria-expanded": context.row.expanded,
1176
+ onClick: (event) => {
1177
+ event.stopPropagation();
1178
+ context.toggleExpanded(context.row.id);
1179
+ },
1180
+ onDoubleClick: (event) => {
1181
+ event.stopPropagation();
1182
+ },
1183
+ onKeyDown: (event) => {
1184
+ event.stopPropagation();
1185
+ },
1186
+ }, createElement("span", { className: "youp-grid__tree-caret", "aria-hidden": true }, context.row.expanded ? "v" : ">"))
1187
+ : createElement("span", { className: "youp-grid__tree-toggle-spacer", "aria-hidden": true });
1188
+ return createElement("span", {
1189
+ className: "youp-grid__cell-tree-content",
1190
+ style: { paddingLeft: depth * 18 },
1191
+ }, toggle, createElement("span", { className: "youp-grid__cell-tree-value" }, context.content));
1082
1192
  }
1083
1193
  function renderCellEditor(context) {
1084
1194
  if (context.cell.column.editor === "select") {
@@ -1121,16 +1231,26 @@ function renderCellEditor(context) {
1121
1231
  },
1122
1232
  });
1123
1233
  }
1124
- function renderCellStatus(meta) {
1234
+ function renderCellStatus(meta, tooltipMode) {
1125
1235
  if (!meta) {
1126
1236
  return undefined;
1127
1237
  }
1128
1238
  return createElement("span", {
1129
1239
  className: `youp-grid__cell-status youp-grid__cell-status--${meta.status}`,
1130
- title: typeof meta.message === "string" ? meta.message : undefined,
1240
+ title: tooltipMode === "native" && typeof meta.message === "string" ? meta.message : undefined,
1131
1241
  "aria-hidden": true,
1132
1242
  });
1133
1243
  }
1244
+ function renderCellTooltip(meta, tooltipId) {
1245
+ if (!tooltipId || !meta?.message) {
1246
+ return undefined;
1247
+ }
1248
+ return createElement("span", {
1249
+ id: tooltipId,
1250
+ className: "youp-grid__cell-tooltip",
1251
+ role: "tooltip",
1252
+ }, meta.message);
1253
+ }
1134
1254
  function renderColumnToolbar(context) {
1135
1255
  if (!context.showColumnChooser && !context.showCsvExport && !context.showDensityControl) {
1136
1256
  return undefined;
@@ -2020,8 +2140,8 @@ function normalizeEditorOptions(options) {
2020
2140
  function getEditorOptionValue(option) {
2021
2141
  return typeof option === "object" ? option.value : option;
2022
2142
  }
2023
- function getCellTitle(meta, disabledReason, editable) {
2024
- if (typeof meta?.message === "string") {
2143
+ function getCellTitle(meta, disabledReason, editable, tooltipMode) {
2144
+ if (tooltipMode === "native" && typeof meta?.message === "string") {
2025
2145
  return meta.message;
2026
2146
  }
2027
2147
  if (!editable && typeof disabledReason === "string") {
@@ -2029,6 +2149,15 @@ function getCellTitle(meta, disabledReason, editable) {
2029
2149
  }
2030
2150
  return undefined;
2031
2151
  }
2152
+ function hasTooltipMessage(meta) {
2153
+ return Boolean(meta?.message);
2154
+ }
2155
+ function getCellKey(rowId, columnId) {
2156
+ return `${String(rowId)}:${columnId}`;
2157
+ }
2158
+ function getCellTooltipId(cellKey) {
2159
+ return `youp-grid-cell-tooltip-${cellKey.replace(/[^a-zA-Z0-9_-]/g, "_")}`;
2160
+ }
2032
2161
  function isTextEditingKey(event) {
2033
2162
  if (event.metaKey || event.ctrlKey || event.altKey) {
2034
2163
  return false;
package/dist/index.d.ts CHANGED
@@ -1,3 +1,3 @@
1
1
  export { YoupGrid } from "./YoupGrid.ts";
2
2
  export { useYoupGrid } from "./useYoupGrid.ts";
3
- export type { YoupGridCanEditCellContext, YoupGridCellEditCommit, YoupGridCellEditCommitReason, YoupGridCellContext, YoupGridCellMeta, YoupGridCellMetaStatus, YoupGridCellsValueChange, YoupGridCellsValueChangeSource, YoupGridController, YoupGridDensity, YoupGridHeaderContext, YoupGridOptions, YoupGridProps, YoupGridRowEvent, YoupGridRowsEndReachedEvent, YoupGridStateChange, } from "./types.ts";
3
+ export type { YoupGridCanEditCellContext, YoupGridCellEditCommit, YoupGridCellEditCommitReason, YoupGridCellContext, YoupGridCellMeta, YoupGridCellMetaStatus, YoupGridCellTooltipMode, YoupGridCellTooltipOptions, YoupGridCellsValueChange, YoupGridCellsValueChangeSource, YoupGridController, YoupGridDensity, YoupGridHeaderContext, YoupGridOptions, YoupGridProps, YoupGridRowEvent, YoupGridRowsEndReachedEvent, YoupGridStateChange, } from "./types.ts";
package/dist/styles.css CHANGED
@@ -355,6 +355,89 @@
355
355
  color: #94a3b8;
356
356
  }
357
357
 
358
+ .youp-grid__cell-text {
359
+ display: block;
360
+ min-width: 0;
361
+ overflow: hidden;
362
+ text-overflow: ellipsis;
363
+ }
364
+
365
+ .youp-grid__cell--tree {
366
+ display: flex;
367
+ align-items: center;
368
+ }
369
+
370
+ .youp-grid__cell-tree-content {
371
+ display: inline-flex;
372
+ min-width: 0;
373
+ align-items: center;
374
+ gap: 4px;
375
+ overflow: hidden;
376
+ text-overflow: ellipsis;
377
+ }
378
+
379
+ .youp-grid__cell-tree-value {
380
+ min-width: 0;
381
+ overflow: hidden;
382
+ text-overflow: ellipsis;
383
+ }
384
+
385
+ .youp-grid__tree-toggle,
386
+ .youp-grid__tree-toggle-spacer {
387
+ display: inline-flex;
388
+ flex: 0 0 auto;
389
+ align-items: center;
390
+ justify-content: center;
391
+ width: 18px;
392
+ height: 18px;
393
+ }
394
+
395
+ .youp-grid__tree-toggle {
396
+ padding: 0;
397
+ border: 0;
398
+ color: var(--youp-grid-muted);
399
+ font: inherit;
400
+ cursor: pointer;
401
+ background: transparent;
402
+ }
403
+
404
+ .youp-grid__tree-toggle:focus-visible {
405
+ outline: 2px solid #2563eb;
406
+ outline-offset: 1px;
407
+ }
408
+
409
+ .youp-grid__tree-caret {
410
+ width: 12px;
411
+ line-height: 1;
412
+ text-align: center;
413
+ }
414
+
415
+ .youp-grid__cell--tooltip-open {
416
+ z-index: 8;
417
+ overflow: visible;
418
+ }
419
+
420
+ .youp-grid__cell-tooltip {
421
+ position: absolute;
422
+ top: calc(100% + 6px);
423
+ left: var(--youp-grid-cell-inline-padding);
424
+ z-index: 20;
425
+ width: max-content;
426
+ min-width: 120px;
427
+ max-width: 260px;
428
+ padding: 6px 8px;
429
+ border: 1px solid #0f172a;
430
+ border-radius: 6px;
431
+ color: #fff;
432
+ font-size: 12px;
433
+ line-height: 1.4;
434
+ text-align: left;
435
+ white-space: normal;
436
+ pointer-events: none;
437
+ background: #0f172a;
438
+ box-shadow: 0 8px 24px rgb(15 23 42 / 18%);
439
+ }
440
+
358
441
  .youp-grid__cell-checkbox {
359
442
  width: 16px;
360
443
  height: 16px;
package/dist/types.d.ts CHANGED
@@ -29,6 +29,12 @@ export type YoupGridCellMeta = {
29
29
  status: YoupGridCellMetaStatus;
30
30
  message?: ReactNode;
31
31
  };
32
+ export type YoupGridCellTooltipMode = "native" | "rich" | "none";
33
+ export type YoupGridCellTooltipOptions = {
34
+ mode?: YoupGridCellTooltipMode;
35
+ autoOpenCellKey?: string | null;
36
+ autoOpenDurationMs?: number;
37
+ };
32
38
  export type YoupGridCanEditCellContext<TRow> = {
33
39
  row: TRow;
34
40
  rowNode: RowNode<TRow>;
@@ -61,6 +67,8 @@ export type YoupGridOptions<TRow> = {
61
67
  defaultState?: GridState;
62
68
  onStateChange?: (change: YoupGridStateChange<TRow>) => void;
63
69
  getRowId?: (row: TRow, index: number) => GridRowId;
70
+ treeData?: boolean;
71
+ getParentRowId?: (row: TRow, index: number) => GridRowId | null | undefined;
64
72
  rowModelType?: GridRowModelType;
65
73
  serverRowCount?: number;
66
74
  serverFilteredRowCount?: number;
@@ -101,6 +109,8 @@ export type YoupGridController<TRow> = {
101
109
  setRowSelected: (rowId: GridRowId, selected: boolean) => void;
102
110
  setSelectedRows: (rowIds: readonly GridRowId[]) => void;
103
111
  toggleRowSelected: (rowId: GridRowId) => void;
112
+ setTreeExpandedRows: (rowIds: readonly GridRowId[]) => void;
113
+ toggleTreeRowExpanded: (rowId: GridRowId) => void;
104
114
  };
105
115
  export type YoupGridProps<TRow> = YoupGridOptions<TRow> & {
106
116
  className?: string;
@@ -129,6 +139,7 @@ export type YoupGridProps<TRow> = YoupGridOptions<TRow> & {
129
139
  errorContent?: ReactNode;
130
140
  cellMeta?: Record<string, YoupGridCellMeta | undefined>;
131
141
  getCellMeta?: (context: YoupGridCanEditCellContext<TRow>) => YoupGridCellMeta | undefined;
142
+ cellTooltip?: YoupGridCellTooltipOptions;
132
143
  renderCell?: (context: YoupGridCellContext<TRow>) => ReactNode;
133
144
  renderHeader?: (context: YoupGridHeaderContext<TRow>) => ReactNode;
134
145
  onCellValueChange?: (change: YoupGridCellValueChange<TRow>) => void;
@@ -147,6 +158,9 @@ export type YoupGridCellContext<TRow> = {
147
158
  focused: boolean;
148
159
  editable: boolean;
149
160
  meta?: YoupGridCellMeta;
161
+ treeDepth?: number;
162
+ hasChildren?: boolean;
163
+ expanded?: boolean;
150
164
  };
151
165
  export type YoupGridHeaderContext<TRow> = {
152
166
  column: ResolvedColumnDef<TRow>;
@@ -1,4 +1,4 @@
1
- import { acknowledgeRemoteCache as acknowledgeCoreRemoteCache, buildRowModel, cancelRemoteRequest as cancelCoreRemoteRequest, clearFilter as clearCoreFilter, clearSort as clearCoreSort, createGridState, failRemoteRequest as failCoreRemoteRequest, finishRemoteRequest as finishCoreRemoteRequest, invalidateRemoteCache as invalidateCoreRemoteCache, setColumnHidden as setCoreColumnHidden, setColumnPinned as setCoreColumnPinned, setColumnWidth as setCoreColumnWidth, setCursorPage as setCoreCursorPage, setCursorPageSize as setCoreCursorPageSize, setCursorPagination as setCoreCursorPagination, setAggregation as setCoreAggregation, setFilter as setCoreFilter, setPagination, setRemoteCache as setCoreRemoteCache, setRowGrouping as setCoreRowGrouping, setRowSelected as setCoreRowSelected, setSelectedRows as setCoreSelectedRows, setSort as setCoreSort, startRemoteRequest as startCoreRemoteRequest, toggleRowGroupExpanded as toggleCoreRowGroupExpanded, toggleRowSelected as toggleCoreRowSelected, toggleSort as toggleCoreSort, } from "@youp-grid/core";
1
+ import { acknowledgeRemoteCache as acknowledgeCoreRemoteCache, buildRowModel, cancelRemoteRequest as cancelCoreRemoteRequest, clearFilter as clearCoreFilter, clearSort as clearCoreSort, createGridState, failRemoteRequest as failCoreRemoteRequest, finishRemoteRequest as finishCoreRemoteRequest, invalidateRemoteCache as invalidateCoreRemoteCache, setColumnHidden as setCoreColumnHidden, setColumnPinned as setCoreColumnPinned, setColumnWidth as setCoreColumnWidth, setCursorPage as setCoreCursorPage, setCursorPageSize as setCoreCursorPageSize, setCursorPagination as setCoreCursorPagination, setAggregation as setCoreAggregation, setFilter as setCoreFilter, setPagination, setRemoteCache as setCoreRemoteCache, setRowGrouping as setCoreRowGrouping, setRowSelected as setCoreRowSelected, setSelectedRows as setCoreSelectedRows, setSort as setCoreSort, setTreeExpandedRows as setCoreTreeExpandedRows, startRemoteRequest as startCoreRemoteRequest, toggleRowGroupExpanded as toggleCoreRowGroupExpanded, toggleRowSelected as toggleCoreRowSelected, toggleSort as toggleCoreSort, toggleTreeRowExpanded as toggleCoreTreeRowExpanded, } from "@youp-grid/core";
2
2
  import { useCallback, useMemo, useState } from "react";
3
3
  export function useYoupGrid(options) {
4
4
  const isControlled = options.state !== undefined;
@@ -12,6 +12,8 @@ export function useYoupGrid(options) {
12
12
  columns: options.columns,
13
13
  state,
14
14
  getRowId: options.getRowId,
15
+ treeData: options.treeData,
16
+ getParentRowId: options.getParentRowId,
15
17
  rowModelType: options.rowModelType,
16
18
  serverRowCount: options.serverRowCount,
17
19
  serverFilteredRowCount: options.serverFilteredRowCount,
@@ -20,6 +22,8 @@ export function useYoupGrid(options) {
20
22
  options.rows,
21
23
  options.columns,
22
24
  options.getRowId,
25
+ options.treeData,
26
+ options.getParentRowId,
23
27
  options.rowModelType,
24
28
  options.serverRowCount,
25
29
  options.serverFilteredRowCount,
@@ -31,6 +35,8 @@ export function useYoupGrid(options) {
31
35
  columns: options.columns,
32
36
  state: nextState,
33
37
  getRowId: options.getRowId,
38
+ treeData: options.treeData,
39
+ getParentRowId: options.getParentRowId,
34
40
  rowModelType: options.rowModelType,
35
41
  serverRowCount: options.serverRowCount,
36
42
  serverFilteredRowCount: options.serverFilteredRowCount,
@@ -93,5 +99,7 @@ export function useYoupGrid(options) {
93
99
  setRowSelected: (rowId, selected) => commitState(setCoreRowSelected(state, rowId, selected)),
94
100
  setSelectedRows: (rowIds) => commitState(setCoreSelectedRows(state, rowIds)),
95
101
  toggleRowSelected: (rowId) => commitState(toggleCoreRowSelected(state, rowId)),
102
+ setTreeExpandedRows: (rowIds) => commitState(setCoreTreeExpandedRows(state, rowIds)),
103
+ toggleTreeRowExpanded: (rowId) => commitState(toggleCoreTreeRowExpanded(state, rowId)),
96
104
  };
97
105
  }
package/package.json CHANGED
@@ -1,8 +1,17 @@
1
1
  {
2
2
  "name": "@youp-grid/react",
3
- "version": "0.2.2",
3
+ "version": "0.2.3",
4
4
  "description": "React adapter for Youp Grid.",
5
+ "license": "MIT",
6
+ "author": "SeungyoupBaek",
5
7
  "type": "module",
8
+ "keywords": [
9
+ "data-grid",
10
+ "grid",
11
+ "react",
12
+ "typescript",
13
+ "table"
14
+ ],
6
15
  "main": "./dist/index.js",
7
16
  "types": "./dist/index.d.ts",
8
17
  "exports": {
@@ -14,13 +23,18 @@
14
23
  },
15
24
  "files": [
16
25
  "dist",
17
- "README.md"
26
+ "README.md",
27
+ "LICENSE"
18
28
  ],
19
29
  "repository": {
20
30
  "type": "git",
21
31
  "url": "git+ssh://git@github.com/SeungyoupBaek/youp-grid.git",
22
32
  "directory": "packages/react"
23
33
  },
34
+ "bugs": {
35
+ "url": "https://github.com/SeungyoupBaek/youp-grid/issues"
36
+ },
37
+ "homepage": "https://github.com/SeungyoupBaek/youp-grid/tree/main/packages/react#readme",
24
38
  "publishConfig": {
25
39
  "access": "public"
26
40
  },
@@ -28,7 +42,7 @@
28
42
  "build": "tsc -p tsconfig.build.json && cp src/styles.css dist/styles.css"
29
43
  },
30
44
  "dependencies": {
31
- "@youp-grid/core": "0.2.2"
45
+ "@youp-grid/core": "0.2.3"
32
46
  },
33
47
  "peerDependencies": {
34
48
  "react": ">=18.2.0"