@trackunit/react-table 1.7.77 → 1.7.79

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/index.cjs.js CHANGED
@@ -375,7 +375,13 @@ const ColumnFilter = ({ columns, setColumnOrder, defaultColumnOrder = [], column
375
375
  if (column.columnDef.size) {
376
376
  sizes[column.id] = column.columnDef.size;
377
377
  }
378
- column.toggleVisibility(!column.columnDef.meta?.hiddenByDefault);
378
+ if (column.columnDef.meta?.hiddenByDefault === true && column.getIsVisible()) {
379
+ column.toggleVisibility(false);
380
+ }
381
+ else if ((column.columnDef.meta?.hiddenByDefault === false || column.columnDef.meta?.hiddenByDefault === undefined) &&
382
+ !column.getIsVisible()) {
383
+ column.toggleVisibility(true);
384
+ }
379
385
  column.pin(column.columnDef.meta?.pinned ?? false);
380
386
  });
381
387
  setColumnOrder(defaultColumnOrder);
package/index.esm.js CHANGED
@@ -374,7 +374,13 @@ const ColumnFilter = ({ columns, setColumnOrder, defaultColumnOrder = [], column
374
374
  if (column.columnDef.size) {
375
375
  sizes[column.id] = column.columnDef.size;
376
376
  }
377
- column.toggleVisibility(!column.columnDef.meta?.hiddenByDefault);
377
+ if (column.columnDef.meta?.hiddenByDefault === true && column.getIsVisible()) {
378
+ column.toggleVisibility(false);
379
+ }
380
+ else if ((column.columnDef.meta?.hiddenByDefault === false || column.columnDef.meta?.hiddenByDefault === undefined) &&
381
+ !column.getIsVisible()) {
382
+ column.toggleVisibility(true);
383
+ }
378
384
  column.pin(column.columnDef.meta?.pinned ?? false);
379
385
  });
380
386
  setColumnOrder(defaultColumnOrder);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trackunit/react-table",
3
- "version": "1.7.77",
3
+ "version": "1.7.79",
4
4
  "repository": "https://github.com/Trackunit/manager",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "engines": {
@@ -15,15 +15,16 @@
15
15
  "jest-fetch-mock": "^3.0.3",
16
16
  "@tanstack/react-router": "1.114.29",
17
17
  "tailwind-merge": "^2.0.0",
18
- "@trackunit/react-components": "1.10.11",
19
- "@trackunit/shared-utils": "1.9.46",
20
- "@trackunit/css-class-variance-utilities": "1.7.46",
21
- "@trackunit/ui-icons": "1.7.47",
22
- "@trackunit/react-table-base-components": "1.7.76",
23
- "@trackunit/react-form-components": "1.8.74",
24
- "@trackunit/i18n-library-translation": "1.7.57",
25
- "@trackunit/react-core-contexts-api": "1.8.50",
26
- "@trackunit/react-test-setup": "1.4.46"
18
+ "@trackunit/react-components": "1.10.13",
19
+ "@trackunit/shared-utils": "1.9.47",
20
+ "@trackunit/css-class-variance-utilities": "1.7.47",
21
+ "@trackunit/ui-icons": "1.7.48",
22
+ "@trackunit/react-table-base-components": "1.7.78",
23
+ "@trackunit/react-form-components": "1.8.76",
24
+ "@trackunit/i18n-library-translation": "1.7.59",
25
+ "@trackunit/react-core-contexts-api": "1.8.52",
26
+ "@trackunit/react-test-setup": "1.4.47",
27
+ "graphql": "^16.10.0"
27
28
  },
28
29
  "module": "./index.esm.js",
29
30
  "main": "./index.cjs.js",
package/src/types.d.ts CHANGED
@@ -1,12 +1,38 @@
1
1
  import { RowData } from "@tanstack/react-table";
2
+ import { DateTimeFormatType, Maybe } from "@trackunit/shared-utils";
3
+ import type { DocumentNode } from "graphql";
2
4
  export { createColumnHelper, type ColumnDef, type VisibilityState } from "@tanstack/react-table";
5
+ type ValuePathType = {
6
+ [key: string]: string;
7
+ };
8
+ export interface BaseExportable {
9
+ accessor: string | Array<string>;
10
+ transformer?: {
11
+ type: "customFields";
12
+ id: string;
13
+ } | {
14
+ type: "date";
15
+ format: DateTimeFormatType;
16
+ };
17
+ prefix?: string;
18
+ postfix?: string;
19
+ translationMap?: Maybe<ValuePathType>;
20
+ }
21
+ export interface BaseExportableArray extends BaseExportable {
22
+ header: string;
23
+ id: string;
24
+ }
3
25
  declare module "@tanstack/react-table" {
4
26
  interface ColumnMeta<TData extends RowData, TValue> {
5
27
  alignment?: Alignment;
6
28
  exportable?: boolean;
29
+ export?: BaseExportable | Array<BaseExportableArray>;
30
+ fragment?: DocumentNode | Array<DocumentNode>;
7
31
  subHeader?: string;
8
32
  hiddenByDefault?: boolean;
9
- isCustomField?: boolean;
33
+ isCustomField?: {
34
+ definitionId: string;
35
+ };
10
36
  tootipLabel?: string;
11
37
  /**
12
38
  * Allowing the column to grow, expanding to fill the remaining space. If all columns have shouldGrow set to true, the columns will share the remaining space equally.