@trackunit/react-table 1.9.14 → 1.9.17

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
@@ -869,7 +869,84 @@ const ColumnSorting = ({ canSort, sortingState = false }) => {
869
869
  * @returns {ReactElement} Table component
870
870
  */
871
871
  /**
872
+ * Table component for displaying large sets of data in tables with infinite scroll, sorting, filtering and others.
873
+ * Table is extending the `@tanstack/react-table` Table component.
874
+ * For more information about the `@tanstack/react-table` Table component, visit [https://tanstack.com/table/v8/docs/guide/introduction](https://tanstack.com/table/v8/docs/guide/introduction).
875
+ *
876
+ * @example
877
+ * ```tsx
878
+ * import { createColumnHelper, Table, useTable } from "@trackunit/react-table";
879
+ * import { TextCell } from "@trackunit/react-table-base-components";
880
+ * import { useMemo } from "react";
881
+ *
882
+ * interface DataType {
883
+ * id: string;
884
+ * name: string;
885
+ * assetType: string;
886
+ * brand: string;
887
+ * }
888
+ *
889
+ * const MyTable = () => {
890
+ * const defaultData: DataType[] = useMemo(
891
+ * () => [
892
+ * { id: "1", name: "SM Smoketest Asset 1", assetType: "machine", brand: "Manitou" },
893
+ * { id: "2", name: "3219", assetType: "machine", brand: "Skyjack" },
894
+ * { id: "3", name: "3226", assetType: "machine", brand: "Skyjack" },
895
+ * ],
896
+ * []
897
+ * );
898
+ *
899
+ * const columns = useMemo(() => {
900
+ * const columnHelper = createColumnHelper<Partial<DataType>>();
901
+ *
902
+ * return [
903
+ * columnHelper.accessor(row => row?.name, {
904
+ * cell: ({ row: { original } }: { row: { original: Partial<DataType> } }) => (
905
+ * <TextCell content={original?.name} />
906
+ * ),
907
+ * header: "Name",
908
+ * id: "name",
909
+ * size: 250,
910
+ * }),
911
+ * columnHelper.accessor(row => row?.assetType, {
912
+ * cell: ({ row: { original } }: { row: { original: Partial<DataType> } }) => (
913
+ * <TextCell content={original?.assetType} />
914
+ * ),
915
+ * header: "Asset Type",
916
+ * id: "assetType",
917
+ * }),
918
+ * columnHelper.accessor(row => row?.brand, {
919
+ * cell: ({ row: { original } }: { row: { original: Partial<DataType> } }) => (
920
+ * <TextCell content={original?.brand} />
921
+ * ),
922
+ * header: "Brand",
923
+ * id: "brand",
924
+ * }),
925
+ * ];
926
+ * }, []);
927
+ *
928
+ * const pagination = useMemo(
929
+ * () => ({
930
+ * nextPage: () => {}, // Handle next page
931
+ * previousPage: () => {}, // Handle previous page
932
+ * isLoading: false,
933
+ * pageInfo: {
934
+ * count: defaultData.length,
935
+ * },
936
+ * }),
937
+ * [defaultData.length]
938
+ * );
939
+ *
940
+ * const { table } = useTable<Partial<DataType>>({
941
+ * data: defaultData,
942
+ * columns,
943
+ * enableSorting: false,
944
+ * });
945
+ *
946
+ * return <Table<Partial<DataType>> {...table} pagination={pagination} />;
947
+ * };
872
948
  *
949
+ * ```
873
950
  */
874
951
  const Table = ({ rowHeight = 50, ...props }) => {
875
952
  //we need a reference to the scrolling element for logic down below
package/index.esm.js CHANGED
@@ -868,7 +868,84 @@ const ColumnSorting = ({ canSort, sortingState = false }) => {
868
868
  * @returns {ReactElement} Table component
869
869
  */
870
870
  /**
871
+ * Table component for displaying large sets of data in tables with infinite scroll, sorting, filtering and others.
872
+ * Table is extending the `@tanstack/react-table` Table component.
873
+ * For more information about the `@tanstack/react-table` Table component, visit [https://tanstack.com/table/v8/docs/guide/introduction](https://tanstack.com/table/v8/docs/guide/introduction).
874
+ *
875
+ * @example
876
+ * ```tsx
877
+ * import { createColumnHelper, Table, useTable } from "@trackunit/react-table";
878
+ * import { TextCell } from "@trackunit/react-table-base-components";
879
+ * import { useMemo } from "react";
880
+ *
881
+ * interface DataType {
882
+ * id: string;
883
+ * name: string;
884
+ * assetType: string;
885
+ * brand: string;
886
+ * }
887
+ *
888
+ * const MyTable = () => {
889
+ * const defaultData: DataType[] = useMemo(
890
+ * () => [
891
+ * { id: "1", name: "SM Smoketest Asset 1", assetType: "machine", brand: "Manitou" },
892
+ * { id: "2", name: "3219", assetType: "machine", brand: "Skyjack" },
893
+ * { id: "3", name: "3226", assetType: "machine", brand: "Skyjack" },
894
+ * ],
895
+ * []
896
+ * );
897
+ *
898
+ * const columns = useMemo(() => {
899
+ * const columnHelper = createColumnHelper<Partial<DataType>>();
900
+ *
901
+ * return [
902
+ * columnHelper.accessor(row => row?.name, {
903
+ * cell: ({ row: { original } }: { row: { original: Partial<DataType> } }) => (
904
+ * <TextCell content={original?.name} />
905
+ * ),
906
+ * header: "Name",
907
+ * id: "name",
908
+ * size: 250,
909
+ * }),
910
+ * columnHelper.accessor(row => row?.assetType, {
911
+ * cell: ({ row: { original } }: { row: { original: Partial<DataType> } }) => (
912
+ * <TextCell content={original?.assetType} />
913
+ * ),
914
+ * header: "Asset Type",
915
+ * id: "assetType",
916
+ * }),
917
+ * columnHelper.accessor(row => row?.brand, {
918
+ * cell: ({ row: { original } }: { row: { original: Partial<DataType> } }) => (
919
+ * <TextCell content={original?.brand} />
920
+ * ),
921
+ * header: "Brand",
922
+ * id: "brand",
923
+ * }),
924
+ * ];
925
+ * }, []);
926
+ *
927
+ * const pagination = useMemo(
928
+ * () => ({
929
+ * nextPage: () => {}, // Handle next page
930
+ * previousPage: () => {}, // Handle previous page
931
+ * isLoading: false,
932
+ * pageInfo: {
933
+ * count: defaultData.length,
934
+ * },
935
+ * }),
936
+ * [defaultData.length]
937
+ * );
938
+ *
939
+ * const { table } = useTable<Partial<DataType>>({
940
+ * data: defaultData,
941
+ * columns,
942
+ * enableSorting: false,
943
+ * });
944
+ *
945
+ * return <Table<Partial<DataType>> {...table} pagination={pagination} />;
946
+ * };
871
947
  *
948
+ * ```
872
949
  */
873
950
  const Table = ({ rowHeight = 50, ...props }) => {
874
951
  //we need a reference to the scrolling element for logic down below
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trackunit/react-table",
3
- "version": "1.9.14",
3
+ "version": "1.9.17",
4
4
  "repository": "https://github.com/Trackunit/manager",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "engines": {
@@ -14,14 +14,14 @@
14
14
  "react-dnd-html5-backend": "16.0.1",
15
15
  "@tanstack/react-router": "1.114.29",
16
16
  "tailwind-merge": "^2.0.0",
17
- "@trackunit/react-components": "1.12.13",
18
- "@trackunit/shared-utils": "1.11.9",
19
- "@trackunit/css-class-variance-utilities": "1.9.9",
20
- "@trackunit/ui-icons": "1.9.9",
21
- "@trackunit/react-table-base-components": "1.9.13",
22
- "@trackunit/react-form-components": "1.10.13",
23
- "@trackunit/i18n-library-translation": "1.9.12",
24
- "@trackunit/iris-app-runtime-core-api": "1.9.12",
17
+ "@trackunit/react-components": "1.13.2",
18
+ "@trackunit/shared-utils": "1.11.12",
19
+ "@trackunit/css-class-variance-utilities": "1.9.12",
20
+ "@trackunit/ui-icons": "1.9.12",
21
+ "@trackunit/react-table-base-components": "1.9.16",
22
+ "@trackunit/react-form-components": "1.10.16",
23
+ "@trackunit/i18n-library-translation": "1.9.15",
24
+ "@trackunit/iris-app-runtime-core-api": "1.9.15",
25
25
  "graphql": "^16.10.0"
26
26
  },
27
27
  "module": "./index.esm.js",
package/src/Table.d.ts CHANGED
@@ -24,6 +24,83 @@ export interface TableProps<TData extends object> extends ReactTable<TData>, Com
24
24
  * @returns {ReactElement} Table component
25
25
  */
26
26
  /**
27
+ * Table component for displaying large sets of data in tables with infinite scroll, sorting, filtering and others.
28
+ * Table is extending the `@tanstack/react-table` Table component.
29
+ * For more information about the `@tanstack/react-table` Table component, visit [https://tanstack.com/table/v8/docs/guide/introduction](https://tanstack.com/table/v8/docs/guide/introduction).
30
+ *
31
+ * @example
32
+ * ```tsx
33
+ * import { createColumnHelper, Table, useTable } from "@trackunit/react-table";
34
+ * import { TextCell } from "@trackunit/react-table-base-components";
35
+ * import { useMemo } from "react";
36
+ *
37
+ * interface DataType {
38
+ * id: string;
39
+ * name: string;
40
+ * assetType: string;
41
+ * brand: string;
42
+ * }
43
+ *
44
+ * const MyTable = () => {
45
+ * const defaultData: DataType[] = useMemo(
46
+ * () => [
47
+ * { id: "1", name: "SM Smoketest Asset 1", assetType: "machine", brand: "Manitou" },
48
+ * { id: "2", name: "3219", assetType: "machine", brand: "Skyjack" },
49
+ * { id: "3", name: "3226", assetType: "machine", brand: "Skyjack" },
50
+ * ],
51
+ * []
52
+ * );
53
+ *
54
+ * const columns = useMemo(() => {
55
+ * const columnHelper = createColumnHelper<Partial<DataType>>();
56
+ *
57
+ * return [
58
+ * columnHelper.accessor(row => row?.name, {
59
+ * cell: ({ row: { original } }: { row: { original: Partial<DataType> } }) => (
60
+ * <TextCell content={original?.name} />
61
+ * ),
62
+ * header: "Name",
63
+ * id: "name",
64
+ * size: 250,
65
+ * }),
66
+ * columnHelper.accessor(row => row?.assetType, {
67
+ * cell: ({ row: { original } }: { row: { original: Partial<DataType> } }) => (
68
+ * <TextCell content={original?.assetType} />
69
+ * ),
70
+ * header: "Asset Type",
71
+ * id: "assetType",
72
+ * }),
73
+ * columnHelper.accessor(row => row?.brand, {
74
+ * cell: ({ row: { original } }: { row: { original: Partial<DataType> } }) => (
75
+ * <TextCell content={original?.brand} />
76
+ * ),
77
+ * header: "Brand",
78
+ * id: "brand",
79
+ * }),
80
+ * ];
81
+ * }, []);
82
+ *
83
+ * const pagination = useMemo(
84
+ * () => ({
85
+ * nextPage: () => {}, // Handle next page
86
+ * previousPage: () => {}, // Handle previous page
87
+ * isLoading: false,
88
+ * pageInfo: {
89
+ * count: defaultData.length,
90
+ * },
91
+ * }),
92
+ * [defaultData.length]
93
+ * );
94
+ *
95
+ * const { table } = useTable<Partial<DataType>>({
96
+ * data: defaultData,
97
+ * columns,
98
+ * enableSorting: false,
99
+ * });
100
+ *
101
+ * return <Table<Partial<DataType>> {...table} pagination={pagination} />;
102
+ * };
27
103
  *
104
+ * ```
28
105
  */
29
106
  export declare const Table: <TData extends object>({ rowHeight, ...props }: TableProps<TData>) => ReactElement;