nntc-ui 0.0.64 → 0.0.66

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.
Files changed (3) hide show
  1. package/index.d.ts +8 -2
  2. package/index.js +19 -4
  3. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -299,6 +299,10 @@ interface TableColumn {
299
299
  toFixed?: number;
300
300
  }
301
301
 
302
+ interface VirtualTableRef {
303
+ resetFilters: () => void;
304
+ }
305
+
302
306
  type Size$1 = 'medium' | 'small';
303
307
  type Borders = 'all' | 'horizontal' | 'vertical' | 'none';
304
308
  interface Props$8 {
@@ -331,7 +335,9 @@ interface Props$8 {
331
335
  additionalHeaderContent?: (headerName: string) => ReactNode;
332
336
  showRowsNumbers?: boolean;
333
337
  }
334
- declare function VirtualTable(props: UiProps<Props$8>): react_jsx_runtime.JSX.Element;
338
+ declare const VirtualTable: React.ForwardRefExoticComponent<Props$8 & {
339
+ classes?: PropsObject;
340
+ } & React.RefAttributes<VirtualTableRef>>;
335
341
 
336
342
  interface Item {
337
343
  id: string;
@@ -426,4 +432,4 @@ interface Props {
426
432
  }
427
433
  declare const Chip: (props: PropsWithChildren<UiProps<Props>>) => react_jsx_runtime.JSX.Element;
428
434
 
429
- export { type AdditionalButton, Button, ButtonsGroup, Card, Checkbox, Checklist, type Item$3 as ChecklistItem, type SelectedItems as ChecklistSelectedItems, Chip, ColorPicker, type ColumnAlign, DateTime, type FilterBy, Input, Layout, Menu, type Divider as MenuDivider, type Item$2 as MenuItem, Modal, MultiSelect, type Item$4 as MultiSelectItem, type TitleVariant as MultiSelectTitleVariant, type Pair, Pairs, Popover, SearchInput, Select, type Divider$1 as SelectDivider, type Item$5 as SelectItem, type SortBy, type SortType, Surface, type TableCell, type TableColumn, type TableRow, Tabs, type Item$1 as TabsItem, Tooltip, _default as TreeView, type Item as TreeViewItem, Typography, type VerticalAlign, VirtualTable, WrapForLabel };
435
+ export { type AdditionalButton, Button, ButtonsGroup, Card, Checkbox, Checklist, type Item$3 as ChecklistItem, type SelectedItems as ChecklistSelectedItems, Chip, ColorPicker, type ColumnAlign, DateTime, type FilterBy, Input, Layout, Menu, type Divider as MenuDivider, type Item$2 as MenuItem, Modal, MultiSelect, type Item$4 as MultiSelectItem, type TitleVariant as MultiSelectTitleVariant, type Pair, Pairs, Popover, SearchInput, Select, type Divider$1 as SelectDivider, type Item$5 as SelectItem, type SortBy, type SortType, Surface, type TableCell, type TableColumn, type TableRow, Tabs, type Item$1 as TabsItem, Tooltip, _default as TreeView, type Item as TreeViewItem, Typography, type VerticalAlign, VirtualTable, type VirtualTableRef, WrapForLabel };
package/index.js CHANGED
@@ -2535,7 +2535,16 @@ import { flexRender, getCoreRowModel, useReactTable } from "@tanstack/react-tabl
2535
2535
  import { defaultRangeExtractor, useVirtualizer } from "@tanstack/react-virtual";
2536
2536
  import classnames22 from "classnames";
2537
2537
  import dayjs4 from "dayjs";
2538
- import { Fragment as Fragment8, useCallback as useCallback9, useEffect as useEffect8, useMemo as useMemo8, useRef as useRef11, useState as useState15 } from "react";
2538
+ import {
2539
+ Fragment as Fragment8,
2540
+ forwardRef as forwardRef8,
2541
+ useCallback as useCallback9,
2542
+ useEffect as useEffect8,
2543
+ useImperativeHandle,
2544
+ useMemo as useMemo8,
2545
+ useRef as useRef11,
2546
+ useState as useState15
2547
+ } from "react";
2539
2548
  import { v4 as uuidv46 } from "uuid";
2540
2549
 
2541
2550
  // src/utils/toFirstLetterUpperCase.ts
@@ -3272,7 +3281,7 @@ var recursiveSort = (items2, sortBy) => {
3272
3281
 
3273
3282
  // src/components/view/VirtualTable/VirtualTable.tsx
3274
3283
  import { Fragment as Fragment9, jsx as jsx34, jsxs as jsxs19 } from "react/jsx-runtime";
3275
- function VirtualTable(props) {
3284
+ var VirtualTable = forwardRef8((props, ref) => {
3276
3285
  const {
3277
3286
  rows,
3278
3287
  columns,
@@ -3346,7 +3355,7 @@ function VirtualTable(props) {
3346
3355
  return result;
3347
3356
  }, [rows, sortBy, filterBy, rowNumberColumnId]);
3348
3357
  const columnsEstimateSize = useMemo8(
3349
- () => cellWidth ?? ((index) => rowNumberColumnId && index === 0 ? memoizedData.length.toString().length * 10 + 24 : memoizedColumns[index]?.meta?.width ?? 200),
3358
+ () => cellWidth ?? ((index) => rowNumberColumnId && index === 0 ? memoizedData.length.toString().length * 8 + 24 : memoizedColumns[index]?.meta?.width ?? 200),
3350
3359
  [cellWidth, memoizedColumns, memoizedData, rowNumberColumnId]
3351
3360
  );
3352
3361
  const table2 = useReactTable({
@@ -3415,6 +3424,12 @@ function VirtualTable(props) {
3415
3424
  );
3416
3425
  const rowsTotalSize = rowVirtualizer.getTotalSize();
3417
3426
  const columnsTotalSize = columnVirtualizer.getTotalSize();
3427
+ const resetFilters = () => {
3428
+ setFilterBy([]);
3429
+ };
3430
+ useImperativeHandle(ref, () => ({
3431
+ resetFilters
3432
+ }));
3418
3433
  useEffect8(() => {
3419
3434
  if (tableContainerRef?.current) {
3420
3435
  const container = tableContainerRef?.current;
@@ -3726,7 +3741,7 @@ function VirtualTable(props) {
3726
3741
  ] })
3727
3742
  }
3728
3743
  );
3729
- }
3744
+ });
3730
3745
 
3731
3746
  // src/components/view/TreeView/TreeView.tsx
3732
3747
  import { memo as memo2, useCallback as useCallback10, useMemo as useMemo9, useState as useState17 } from "react";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nntc-ui",
3
- "version": "0.0.64",
3
+ "version": "0.0.66",
4
4
  "author": "NNTC",
5
5
  "description": "React UI-kit for NNTC",
6
6
  "type": "module",