@bmsuisse/datagrid 0.32.1 → 0.32.2

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/index.d.ts CHANGED
@@ -1744,6 +1744,17 @@ interface TreeDataGridProps<TRow> extends TreeAccessors<TRow> {
1744
1744
  columns: ColumnDef<TRow>[];
1745
1745
  /** Root-level rows. */
1746
1746
  data: TRow[];
1747
+ /**
1748
+ * Whether the root `data` set is still being fetched. Purely cosmetic —
1749
+ * unlike `<DataGrid>`'s `loading` (a full-overlay spinner over the whole
1750
+ * body), `<TreeDataGrid>` has no existing rows to obscure while `data` is
1751
+ * empty, so this only swaps the empty-state row from "No results." to a
1752
+ * spinner + "Loading..." for as long as `data.length === 0`. Once real
1753
+ * rows arrive, this stops mattering — a background refetch never re-shows
1754
+ * the empty state, so there's nothing for a full overlay to add here.
1755
+ * Defaults to `false`.
1756
+ */
1757
+ loading?: boolean;
1747
1758
  /**
1748
1759
  * The column whose cell gets the depth indentation + expand/collapse
1749
1760
  * chevron prepended. Defaults to the first column in `columns`.
@@ -1959,7 +1970,7 @@ interface TreeDataGridProps<TRow> extends TreeAccessors<TRow> {
1959
1970
  * column's cell matches `treeColumnId` (defaults to `columns[0]`); every
1960
1971
  * other column renders exactly like it would in `<DataGrid>`.
1961
1972
  */
1962
- declare function TreeDataGrid<TRow>({ columns, data, treeColumnId, columnVisibility, getRowId, getChildren, hasChildren, onLoadChildren, initialExpandedLevel, expanded: controlledExpanded, onExpandedChange, childrenMap: controlledChildrenMap, onChildrenMapChange, indentSize, getRowProps, getRowTestId, rowActions, virtualizeThreshold, estimatedRowHeight, maxBodyHeight, testId, selectedIds: controlledSelectedIds, onSelectedIdsChange, getRowSelectionState, isRowSelectionDisabled, groupBy, renderGroupHeader, defaultGroupsExpanded, expandedGroups: controlledExpandedGroups, onExpandedGroupsChange, zebra, editing, }: TreeDataGridProps<TRow>): ReactElement;
1973
+ declare function TreeDataGrid<TRow>({ columns, data, loading, treeColumnId, columnVisibility, getRowId, getChildren, hasChildren, onLoadChildren, initialExpandedLevel, expanded: controlledExpanded, onExpandedChange, childrenMap: controlledChildrenMap, onChildrenMapChange, indentSize, getRowProps, getRowTestId, rowActions, virtualizeThreshold, estimatedRowHeight, maxBodyHeight, testId, selectedIds: controlledSelectedIds, onSelectedIdsChange, getRowSelectionState, isRowSelectionDisabled, groupBy, renderGroupHeader, defaultGroupsExpanded, expandedGroups: controlledExpandedGroups, onExpandedGroupsChange, zebra, editing, }: TreeDataGridProps<TRow>): ReactElement;
1963
1974
 
1964
1975
  interface FlatTreeRow<TRow> {
1965
1976
  row: TRow;
package/dist/index.js CHANGED
@@ -4397,6 +4397,7 @@ function TreeCell({
4397
4397
  function TreeDataGrid({
4398
4398
  columns,
4399
4399
  data,
4400
+ loading = false,
4400
4401
  treeColumnId,
4401
4402
  columnVisibility,
4402
4403
  getRowId,
@@ -4638,7 +4639,10 @@ function TreeDataGrid({
4638
4639
  )),
4639
4640
  showRowActionsColumn && /* @__PURE__ */ jsx34("th", { className: "sticky top-0 z-20 border-b border-border bg-muted p-2", "aria-label": "Row actions" })
4640
4641
  ] }) }),
4641
- /* @__PURE__ */ jsx34("tbody", { children: data.length === 0 ? /* @__PURE__ */ jsx34("tr", { children: /* @__PURE__ */ jsx34("td", { colSpan: totalColumnCount, className: "p-4 text-center text-muted-foreground", children: "No results." }) }) : groupedBuckets ? groupedBuckets.map((bucket) => {
4642
+ /* @__PURE__ */ jsx34("tbody", { children: data.length === 0 ? /* @__PURE__ */ jsx34("tr", { children: /* @__PURE__ */ jsx34("td", { colSpan: totalColumnCount, className: "p-4 text-center text-muted-foreground", children: loading ? /* @__PURE__ */ jsxs21("span", { className: "inline-flex items-center gap-2", children: [
4643
+ /* @__PURE__ */ jsx34(Loader22, { className: "h-4 w-4 animate-spin", "aria-hidden": "true" }),
4644
+ "Loading..."
4645
+ ] }) : "No results." }) }) : groupedBuckets ? groupedBuckets.map((bucket) => {
4642
4646
  const groupExpanded = isGroupExpanded(bucket.key);
4643
4647
  return /* @__PURE__ */ jsxs21(Fragment5, { children: [
4644
4648
  /* @__PURE__ */ jsx34("tr", { "data-testid": `group-header-${bucket.key}`, children: /* @__PURE__ */ jsx34(