schummar-table 0.45.3 → 0.46.0

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.cts CHANGED
@@ -1,8 +1,8 @@
1
1
  import * as _emotion_react_jsx_runtime from '@emotion/react/jsx-runtime';
2
2
  import * as React from 'react';
3
3
  import { ComponentType, ReactNode, HTMLProps } from 'react';
4
- import { T as TableTheme, C as CommonFilterProps, a as TableProps, F as FilterImplementation, M as MemoizedTableTheme, I as Id, b as TableItem, c as InternalTableState, P as PartialTableTheme } from './types-DKqBJ_4v.cjs';
5
- export { e as Column, f as FunctionWithDeps, g as InternalColumn, S as Sort, h as SortDirection, d as TableStateStorage } from './types-DKqBJ_4v.cjs';
4
+ import { T as TableTheme, C as CommonFilterProps, a as TableProps, b as TableRef, F as FilterImplementation, M as MemoizedTableTheme, I as Id, c as TableItem, d as InternalTableState, P as PartialTableTheme } from './types-rbNpaeJs.cjs';
5
+ export { f as Column, g as FunctionWithDeps, h as InternalColumn, S as Sort, i as SortDirection, e as TableStateStorage } from './types-rbNpaeJs.cjs';
6
6
  import { Store } from 'schummar-state/react';
7
7
  import { E as ExporterEntry } from './exporter-u6SatTo6.cjs';
8
8
  import '@emotion/react';
@@ -145,7 +145,7 @@ declare function SelectFilter<TItem, TColumnValue, TFilterBy>({ options: provide
145
145
  virtual?: VirtualListProps<unknown>['virtual'];
146
146
  } & CommonFilterProps<TItem, TColumnValue, TFilterBy, Set<TFilterBy>>): JSX.Element;
147
147
 
148
- declare function Table<T>(props: TableProps<T>): JSX.Element;
148
+ declare const Table: React.ForwardRefExoticComponent<TableProps<unknown> & React.RefAttributes<TableRef>>;
149
149
 
150
150
  declare function TextFilter<TItem, TColumnValue>({ compare, filterBy, placeholder, ...props }: {
151
151
  /** Custom comparison function. Should return true if an item value matches the current filter value.
package/dist/index.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  import * as _emotion_react_jsx_runtime from '@emotion/react/jsx-runtime';
2
2
  import * as React from 'react';
3
3
  import { ComponentType, ReactNode, HTMLProps } from 'react';
4
- import { T as TableTheme, C as CommonFilterProps, a as TableProps, F as FilterImplementation, M as MemoizedTableTheme, I as Id, b as TableItem, c as InternalTableState, P as PartialTableTheme } from './types-cAzUt-yT.js';
5
- export { e as Column, f as FunctionWithDeps, g as InternalColumn, S as Sort, h as SortDirection, d as TableStateStorage } from './types-cAzUt-yT.js';
4
+ import { T as TableTheme, C as CommonFilterProps, a as TableProps, b as TableRef, F as FilterImplementation, M as MemoizedTableTheme, I as Id, c as TableItem, d as InternalTableState, P as PartialTableTheme } from './types--1DhsKcT.js';
5
+ export { f as Column, g as FunctionWithDeps, h as InternalColumn, S as Sort, i as SortDirection, e as TableStateStorage } from './types--1DhsKcT.js';
6
6
  import { Store } from 'schummar-state/react';
7
7
  import { E as ExporterEntry } from './exporter-u6SatTo6.js';
8
8
  import '@emotion/react';
@@ -145,7 +145,7 @@ declare function SelectFilter<TItem, TColumnValue, TFilterBy>({ options: provide
145
145
  virtual?: VirtualListProps<unknown>['virtual'];
146
146
  } & CommonFilterProps<TItem, TColumnValue, TFilterBy, Set<TFilterBy>>): JSX.Element;
147
147
 
148
- declare function Table<T>(props: TableProps<T>): JSX.Element;
148
+ declare const Table: React.ForwardRefExoticComponent<TableProps<unknown> & React.RefAttributes<TableRef>>;
149
149
 
150
150
  declare function TextFilter<TItem, TColumnValue>({ compare, filterBy, placeholder, ...props }: {
151
151
  /** Custom comparison function. Should return true if an item value matches the current filter value.
package/dist/index.js CHANGED
@@ -2441,7 +2441,14 @@ function SelectFilter(_a) {
2441
2441
  }
2442
2442
 
2443
2443
  // src/components/table.tsx
2444
- import { memo as memo3, useEffect as useEffect15, useLayoutEffect as useLayoutEffect6, useState as useState15 } from "react";
2444
+ import {
2445
+ forwardRef as forwardRef2,
2446
+ memo as memo3,
2447
+ useEffect as useEffect15,
2448
+ useImperativeHandle,
2449
+ useLayoutEffect as useLayoutEffect6,
2450
+ useState as useState15
2451
+ } from "react";
2445
2452
 
2446
2453
  // src/internalState/tableStateStorage.ts
2447
2454
  import { useEffect as useEffect5, useState as useState10 } from "react";
@@ -4255,9 +4262,36 @@ function Virtualized(_a) {
4255
4262
 
4256
4263
  // src/components/table.tsx
4257
4264
  import { Fragment as Fragment9, jsx as jsx35, jsxs as jsxs19 } from "@emotion/react/jsx-runtime";
4258
- function Table(props) {
4265
+ var Table = forwardRef2(_Table);
4266
+ function _Table(props, ref) {
4259
4267
  const [table, resetState] = useTableState(props);
4260
4268
  const [isHydrated, clearStorage] = useTableStateStorage(table);
4269
+ useImperativeHandle(
4270
+ ref,
4271
+ () => ({
4272
+ setSort(sort) {
4273
+ table.update((state) => {
4274
+ state.sort = sort;
4275
+ });
4276
+ },
4277
+ setSelection(selection) {
4278
+ table.update((state) => {
4279
+ state.selection = selection;
4280
+ });
4281
+ },
4282
+ setExpanded(expanded) {
4283
+ table.update((state) => {
4284
+ state.expanded = expanded;
4285
+ });
4286
+ },
4287
+ setHiddenColumns(hidden) {
4288
+ table.update((state) => {
4289
+ state.hiddenColumns = hidden;
4290
+ });
4291
+ }
4292
+ }),
4293
+ [table]
4294
+ );
4261
4295
  function reset() {
4262
4296
  return __async(this, null, function* () {
4263
4297
  yield clearStorage();