@tint-ui/data-table 0.3.5

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 (122) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +9 -0
  3. package/adapters/boolean.d.ts +10 -0
  4. package/adapters/boolean.js +38 -0
  5. package/adapters/index.d.ts +6 -0
  6. package/adapters/index.js +18 -0
  7. package/adapters/number-format.d.ts +1 -0
  8. package/adapters/number-format.js +42 -0
  9. package/adapters/number.d.ts +12 -0
  10. package/adapters/number.js +51 -0
  11. package/adapters/text.d.ts +4 -0
  12. package/adapters/text.js +9 -0
  13. package/cell-adapter-type.d.ts +43 -0
  14. package/cell-adapter-type.js +306 -0
  15. package/cjs/adapters/boolean.js +43 -0
  16. package/cjs/adapters/index.js +21 -0
  17. package/cjs/adapters/number-format.js +46 -0
  18. package/cjs/adapters/number.js +56 -0
  19. package/cjs/adapters/text.js +13 -0
  20. package/cjs/cell-adapter-type.js +312 -0
  21. package/cjs/classes.js +27 -0
  22. package/cjs/context.js +14 -0
  23. package/cjs/data-table-content.js +105 -0
  24. package/cjs/data-table-pagination.js +38 -0
  25. package/cjs/data-table-text-filter.js +83 -0
  26. package/cjs/data-table-toolbar.js +103 -0
  27. package/cjs/data-table-views-options.js +137 -0
  28. package/cjs/data-table.js +63 -0
  29. package/cjs/filter-adapter-type.js +162 -0
  30. package/cjs/filter-adapters/index.js +10 -0
  31. package/cjs/filter-adapters/option.js +152 -0
  32. package/cjs/filter-adapters/use-option-filter.js +195 -0
  33. package/cjs/filter-classes.js +26 -0
  34. package/cjs/filter-fn.js +84 -0
  35. package/cjs/index.js +99 -0
  36. package/cjs/package.json +3 -0
  37. package/cjs/pagination-arrow.js +93 -0
  38. package/cjs/pagination-classes.js +20 -0
  39. package/cjs/pagination-number.js +66 -0
  40. package/cjs/pagination-size-options.js +48 -0
  41. package/cjs/row-button-menu.js +49 -0
  42. package/cjs/row-popover-menu.js +52 -0
  43. package/cjs/toolbar-classes.js +24 -0
  44. package/cjs/types.js +3 -0
  45. package/cjs/use-data-table.js +768 -0
  46. package/cjs/use-lexicon.js +155 -0
  47. package/cjs/use-row-menu.js +60 -0
  48. package/cjs/use-visibility-column.js +105 -0
  49. package/cjs/use-visibility-filter.js +149 -0
  50. package/cjs/utils.js +136 -0
  51. package/classes.d.ts +34 -0
  52. package/classes.js +23 -0
  53. package/context.d.ts +5 -0
  54. package/context.js +9 -0
  55. package/data-table-content.d.ts +9 -0
  56. package/data-table-content.js +98 -0
  57. package/data-table-pagination.d.ts +5 -0
  58. package/data-table-pagination.js +31 -0
  59. package/data-table-text-filter.d.ts +7 -0
  60. package/data-table-text-filter.js +76 -0
  61. package/data-table-toolbar.d.ts +5 -0
  62. package/data-table-toolbar.js +95 -0
  63. package/data-table-views-options.d.ts +2 -0
  64. package/data-table-views-options.js +133 -0
  65. package/data-table.d.ts +18 -0
  66. package/data-table.js +56 -0
  67. package/filter-adapter-type.d.ts +9 -0
  68. package/filter-adapter-type.js +155 -0
  69. package/filter-adapters/index.d.ts +5 -0
  70. package/filter-adapters/index.js +7 -0
  71. package/filter-adapters/option.d.ts +3 -0
  72. package/filter-adapters/option.js +147 -0
  73. package/filter-adapters/use-option-filter.d.ts +27 -0
  74. package/filter-adapters/use-option-filter.js +192 -0
  75. package/filter-classes.d.ts +32 -0
  76. package/filter-classes.js +22 -0
  77. package/filter-fn.d.ts +7 -0
  78. package/filter-fn.js +76 -0
  79. package/index.d.ts +16 -0
  80. package/index.js +16 -0
  81. package/package.json +97 -0
  82. package/pagination-arrow.d.ts +5 -0
  83. package/pagination-arrow.js +86 -0
  84. package/pagination-classes.d.ts +20 -0
  85. package/pagination-classes.js +16 -0
  86. package/pagination-number.d.ts +5 -0
  87. package/pagination-number.js +59 -0
  88. package/pagination-size-options.d.ts +3 -0
  89. package/pagination-size-options.js +44 -0
  90. package/row-button-menu.d.ts +5 -0
  91. package/row-button-menu.js +45 -0
  92. package/row-popover-menu.d.ts +5 -0
  93. package/row-popover-menu.js +48 -0
  94. package/styles-filter.css +1 -0
  95. package/styles-filter.module.css +64 -0
  96. package/styles-filter.module.scss +65 -0
  97. package/styles-pagination.css +1 -0
  98. package/styles-pagination.module.css +28 -0
  99. package/styles-pagination.module.scss +31 -0
  100. package/styles-toolbar.css +1 -0
  101. package/styles-toolbar.module.css +70 -0
  102. package/styles-toolbar.module.scss +67 -0
  103. package/styles.css +1 -0
  104. package/styles.json +8 -0
  105. package/styles.module.css +39 -0
  106. package/styles.module.scss +38 -0
  107. package/toolbar-classes.d.ts +26 -0
  108. package/toolbar-classes.js +20 -0
  109. package/types.d.ts +226 -0
  110. package/types.js +2 -0
  111. package/use-data-table.d.ts +3 -0
  112. package/use-data-table.js +768 -0
  113. package/use-lexicon.d.ts +12 -0
  114. package/use-lexicon.js +151 -0
  115. package/use-row-menu.d.ts +7 -0
  116. package/use-row-menu.js +58 -0
  117. package/use-visibility-column.d.ts +7 -0
  118. package/use-visibility-column.js +101 -0
  119. package/use-visibility-filter.d.ts +7 -0
  120. package/use-visibility-filter.js +145 -0
  121. package/utils.d.ts +14 -0
  122. package/utils.js +128 -0
@@ -0,0 +1,70 @@
1
+ .toolbar {
2
+ @apply flex items-center justify-between gap-3 mb-3 w-full max-w-full;
3
+ container-type: inline-size;
4
+ container-name: toolbar;
5
+ }
6
+
7
+ .heading {
8
+ @apply text-base leading-tight font-medium text-muted-foreground ml-5 self-center;
9
+ }
10
+ [data-size=sm] .heading {
11
+ @apply text-sm leading-tight;
12
+ }
13
+
14
+ .withFilter {
15
+ @apply grid gap-0;
16
+ grid-template-columns: min-content minmax(0, 1fr) min-content min-content;
17
+ }
18
+ .withFilter > .heading {
19
+ @apply invisible whitespace-nowrap w-0 ml-0;
20
+ }
21
+
22
+ .withFilterGroup {
23
+ @apply flex-col;
24
+ }
25
+
26
+ .search,
27
+ .filters,
28
+ .reset {
29
+ @apply mr-3;
30
+ }
31
+ .search:empty,
32
+ .filters:empty,
33
+ .reset:empty {
34
+ @apply mr-0 w-0 min-w-0;
35
+ }
36
+
37
+ .filters [data-type=slider-viewport] {
38
+ @apply -m-1;
39
+ }
40
+
41
+ .mobile {
42
+ @apply w-full max-w-full;
43
+ }
44
+ .mobile:nth-child(1) {
45
+ @apply grid;
46
+ grid-template-columns: minmax(0, 1fr) min-content min-content;
47
+ }
48
+
49
+ @container toolbar (max-width: 1023px) {
50
+ button[data-type=toolbar-button-options] {
51
+ @apply px-0;
52
+ }
53
+ button[data-type=toolbar-button-options] > span {
54
+ @apply sr-only;
55
+ }
56
+ button[data-type=toolbar-button-options] > svg {
57
+ @apply mx-0 !important;
58
+ }
59
+ }
60
+ @container toolbar (max-width: 767px) {
61
+ button[data-type=toolbar-button-reset] {
62
+ @apply px-0;
63
+ }
64
+ button[data-type=toolbar-button-reset] > span {
65
+ @apply sr-only;
66
+ }
67
+ button[data-type=toolbar-button-reset] > svg {
68
+ @apply mx-0 !important;
69
+ }
70
+ }
@@ -0,0 +1,67 @@
1
+ .toolbar {
2
+ @apply flex items-center justify-between gap-3 mb-3 w-full max-w-full;
3
+ container-type: inline-size;
4
+ container-name: toolbar;
5
+ }
6
+
7
+ .heading {
8
+ @apply text-base leading-tight font-medium text-muted-foreground ml-5 self-center;
9
+ [data-size="sm"] & {
10
+ @apply text-sm leading-tight;
11
+ }
12
+ }
13
+
14
+ .withFilter {
15
+ @apply grid gap-0;
16
+ grid-template-columns: min-content minmax(0, 1fr) min-content min-content;
17
+ > .heading {
18
+ @apply invisible whitespace-nowrap w-0 ml-0;
19
+ }
20
+ }
21
+
22
+ .withFilterGroup {
23
+ @apply flex-col;
24
+ }
25
+
26
+ .search,
27
+ .filters,
28
+ .reset {
29
+ @apply mr-3;
30
+ &:empty {
31
+ @apply mr-0 w-0 min-w-0;
32
+ }
33
+ }
34
+
35
+ .filters [data-type="slider-viewport"] {
36
+ @apply -m-1;
37
+ }
38
+
39
+ .mobile {
40
+ @apply w-full max-w-full;
41
+ &:nth-child(1) {
42
+ @apply grid;
43
+ grid-template-columns: minmax(0, 1fr) min-content min-content;
44
+ }
45
+ }
46
+
47
+ @mixin iconButton() {
48
+ @apply px-0;
49
+ > span {
50
+ @apply sr-only;
51
+ }
52
+ > svg {
53
+ @apply mx-0 #{!important};
54
+ }
55
+ }
56
+
57
+ @container toolbar (max-width: 1023px) {
58
+ button[data-type="toolbar-button-options"] {
59
+ @include iconButton();
60
+ }
61
+ }
62
+
63
+ @container toolbar (max-width: 767px) {
64
+ button[data-type="toolbar-button-reset"] {
65
+ @include iconButton();
66
+ }
67
+ }
package/styles.css ADDED
@@ -0,0 +1 @@
1
+ .tui-data-table{border-radius:var(--radius);border-width:1px;padding-left:.25rem;padding-right:.25rem;position:relative}.tui-data-table_cell-type--boolean{align-items:center;display:inline-flex;justify-content:center;vertical-align:top}.tui-data-table_icon--true{color:hsl(var(--primary))}.tui-data-table_icon--false{color:hsl(var(--destructive))}.tui-data-table_icon--null{--tw-text-opacity:1;color:rgb(107 114 128/var(--tw-text-opacity,1))}.tui-data-table_menu-group{align-items:center;display:flex}.tui-data-table_menu-group>button:not(:first-of-type){border-bottom-left-radius:0;border-top-left-radius:0}.tui-data-table_menu-group>button:not(:last-of-type){border-bottom-right-radius:0;border-top-right-radius:0}.tui-data-table_menu-group>button~button{margin-left:-1px}.tui-data-table_menu-item-destructive{color:hsl(var(--destructive))}.tui-data-table_menu-item-destructive:hover{background-color:hsl(var(--destructive-foreground));color:hsl(var(--destructive))}
package/styles.json ADDED
@@ -0,0 +1,8 @@
1
+ {
2
+ "styles": [
3
+ { "template": "data-table.module.scss", "name": "styles", "classes": "classes" },
4
+ { "template": "data-table-filter.module.scss", "name": "styles-filter", "classes": "filterClasses" },
5
+ { "template": "data-table-toolbar.module.scss", "name": "styles-toolbar", "classes": "toolbarClasses" },
6
+ { "template": "data-table-pagination.module.scss", "name": "styles-pagination", "classes": "paginationClasses" }
7
+ ]
8
+ }
@@ -0,0 +1,39 @@
1
+ .dataTable {
2
+ @apply relative border rounded-lg px-1;
3
+ }
4
+
5
+ .booleanCellType {
6
+ @apply inline-flex justify-center items-center align-top;
7
+ }
8
+
9
+ .iconTrue {
10
+ @apply text-primary;
11
+ }
12
+
13
+ .iconFalse {
14
+ @apply text-destructive;
15
+ }
16
+
17
+ .iconNull {
18
+ @apply text-gray-500;
19
+ }
20
+
21
+ .menuGroup {
22
+ @apply flex items-center;
23
+ }
24
+ .menuGroup > button:not(:first-of-type) {
25
+ @apply rounded-l-none;
26
+ }
27
+ .menuGroup > button:not(:last-of-type) {
28
+ @apply rounded-r-none;
29
+ }
30
+ .menuGroup > button ~ button {
31
+ @apply -ml-[1px];
32
+ }
33
+
34
+ .menuItemDestructive {
35
+ @apply text-destructive;
36
+ }
37
+ .menuItemDestructive:hover {
38
+ @apply bg-destructive-foreground text-destructive;
39
+ }
@@ -0,0 +1,38 @@
1
+ .dataTable {
2
+ @apply relative border rounded-lg px-1;
3
+ }
4
+
5
+ .booleanCellType {
6
+ @apply inline-flex justify-center items-center align-top;
7
+ }
8
+ .iconTrue {
9
+ @apply text-primary;
10
+ }
11
+ .iconFalse {
12
+ @apply text-destructive;
13
+ }
14
+ .iconNull {
15
+ @apply text-gray-500;
16
+ }
17
+
18
+ .menuGroup {
19
+ @apply flex items-center;
20
+ > button {
21
+ &:not(:first-of-type) {
22
+ @apply rounded-l-none;
23
+ }
24
+ &:not(:last-of-type) {
25
+ @apply rounded-r-none;
26
+ }
27
+ & ~ button {
28
+ @apply -ml-[1px];
29
+ }
30
+ }
31
+ }
32
+
33
+ .menuItemDestructive {
34
+ @apply text-destructive;
35
+ &:hover {
36
+ @apply bg-destructive-foreground text-destructive;
37
+ }
38
+ }
@@ -0,0 +1,26 @@
1
+ declare const toolbarClasses: {
2
+ toolbar: string;
3
+ withFilter: string;
4
+ withFilterGroup: string;
5
+ search: string;
6
+ filters: string;
7
+ reset: string;
8
+ options: string;
9
+ mobile: string;
10
+ heading: string;
11
+ };
12
+ declare const useDataTableToolbarClasses: () => {
13
+ toolbar: string;
14
+ withFilter: string;
15
+ withFilterGroup: string;
16
+ search: string;
17
+ filters: string;
18
+ reset: string;
19
+ options: string;
20
+ mobile: string;
21
+ heading: string;
22
+ };
23
+ type DataTableToolbarClassesType = keyof typeof toolbarClasses;
24
+ type DataTableToolbarClasses = Record<DataTableToolbarClassesType, string>;
25
+ export { toolbarClasses, useDataTableToolbarClasses };
26
+ export type { DataTableToolbarClassesType, DataTableToolbarClasses };
@@ -0,0 +1,20 @@
1
+ import { classGroup } from "@tint-ui/tools/class-group";
2
+ import { useClasses } from "@tint-ui/theme";
3
+ const {
4
+ base,
5
+ b,
6
+ a
7
+ } = classGroup("data-table-toolbar");
8
+ const toolbarClasses = {
9
+ toolbar: base,
10
+ withFilter: a("with-filter"),
11
+ withFilterGroup: a("with-filter-group"),
12
+ search: b("search"),
13
+ filters: b("filters"),
14
+ reset: b("reset"),
15
+ options: b("options"),
16
+ mobile: b("mobile"),
17
+ heading: b("heading")
18
+ };
19
+ const useDataTableToolbarClasses = () => useClasses("data-table-toolbar", toolbarClasses);
20
+ export { toolbarClasses, useDataTableToolbarClasses };
package/types.d.ts ADDED
@@ -0,0 +1,226 @@
1
+ import * as React from "react";
2
+ import type { Table } from "@tanstack/react-table";
3
+ import type { InputSelectOption } from "@tint-ui/tools";
4
+ import type { TriggerProp } from "@tint-ui/trigger";
5
+ interface FilterRangeType {
6
+ total?: number;
7
+ limit?: number;
8
+ offset?: number;
9
+ }
10
+ interface FilterType<TData> extends FilterRangeType {
11
+ filter?: Record<keyof TData, unknown>;
12
+ filterText?: string;
13
+ sortBy?: keyof TData | string | null;
14
+ sortDir?: "asc" | "desc";
15
+ }
16
+ interface OptionTrigger<TData> {
17
+ id: string;
18
+ trigger?: TriggerProp;
19
+ label: string;
20
+ enabledKey?: keyof TData | string;
21
+ icon?: string;
22
+ destructive?: boolean;
23
+ confirmation?: string | null;
24
+ }
25
+ export type RowMenuOption<TData> = OptionTrigger<TData> & {
26
+ onClick?: (data: TData) => void;
27
+ triggerKey?: keyof TData;
28
+ };
29
+ export type SelectedOption<TData> = OptionTrigger<TData> & {
30
+ separate?: boolean;
31
+ onClick?: (ids: unknown[]) => void;
32
+ };
33
+ export type DataTableToolbarSize = "sm" | "md" | "lg";
34
+ export type DataTableNavbarSize = "sm" | "md" | "lg";
35
+ export interface DataTableCoreProps<TData> extends FilterType<TData> {
36
+ table: DataTableType<TData>;
37
+ data: TData[] | DataTableCallbackType<TData>;
38
+ initialData?: TData[];
39
+ lexicon?: Partial<DataTableLexicon>;
40
+ header?: "top" | "bottom" | "both" | "none";
41
+ onRowClick?: (data: TData) => void;
42
+ toolbar?: {
43
+ size?: DataTableToolbarSize;
44
+ viewIconOnly?: boolean;
45
+ resetIconOnly?: boolean;
46
+ } | null;
47
+ navbar?: Partial<Omit<NavbarConfig, "onPageSizeChange">> | null;
48
+ compact?: boolean;
49
+ cacheable?: boolean;
50
+ }
51
+ export type StringOrFn = string | (() => string);
52
+ export interface DataTableLexicon {
53
+ filterSearch: string | ((data: {
54
+ label: string;
55
+ }) => string);
56
+ filterSelected: string | ((data: {
57
+ selected: number;
58
+ }) => string);
59
+ filterClear: StringOrFn;
60
+ filterReset: StringOrFn;
61
+ filterNotFound: StringOrFn;
62
+ view: StringOrFn;
63
+ viewOptions: StringOrFn;
64
+ viewFilterText: StringOrFn;
65
+ viewFilter: StringOrFn;
66
+ viewSortBy: StringOrFn;
67
+ viewColumn: StringOrFn;
68
+ pageFirst: StringOrFn;
69
+ pageLast: StringOrFn;
70
+ pagePrevious: StringOrFn;
71
+ pageNext: StringOrFn;
72
+ notFound: StringOrFn;
73
+ notFoundFiltered: StringOrFn;
74
+ search: StringOrFn;
75
+ selected: string | ((data: {
76
+ selected: number;
77
+ size: number;
78
+ }) => string);
79
+ onePageTitle: string | ((data: {
80
+ size: number;
81
+ }) => string);
82
+ pageOf: string | ((data: {
83
+ pageNumber: number;
84
+ pageCount: number;
85
+ }) => string);
86
+ title: string | ((data: {
87
+ size: number;
88
+ total: number;
89
+ limit: number;
90
+ offset: number;
91
+ pageNumber: number;
92
+ pageCount: number;
93
+ }) => string);
94
+ }
95
+ export type DataTableResponse<TData> = {
96
+ data: TData[];
97
+ } & Omit<FilterType<TData>, keyof FilterRangeType> & Required<FilterRangeType>;
98
+ export type FilterData<TData> = Required<FilterType<TData>>;
99
+ export type DataTableCallbackType<TData> = (filter: FilterData<TData>) => DataTableResponse<TData> | Promise<DataTableResponse<TData>>;
100
+ export interface DataTableType<TData> {
101
+ name: string;
102
+ keyName?: string;
103
+ selectable?: SelectedOption<TData>[];
104
+ cells: DataTableCellType<keyof TData>[];
105
+ storage?: boolean | string;
106
+ ssr?: boolean;
107
+ rowMenu?: null | {
108
+ mode?: "button" | "popover";
109
+ align?: "start" | "end";
110
+ menu: RowMenuOption<TData>[];
111
+ } | RowMenuOption<TData>[];
112
+ requiredFilterText?: boolean;
113
+ }
114
+ export interface DataTableCellType<TValue = string, TConfig extends object = any> {
115
+ name: TValue extends string ? TValue : string;
116
+ label: string;
117
+ type?: "text" | "number" | "date" | "boolean" | string;
118
+ required?: boolean;
119
+ hidden?: boolean;
120
+ invisible?: boolean;
121
+ sortable?: boolean;
122
+ searchable?: boolean;
123
+ config?: TConfig;
124
+ defaultSortDir?: "asc" | "desc";
125
+ filter?: InputSelectOption[] | FilterOptionCallbackType | DataTableFilterType | null;
126
+ }
127
+ export interface DataTableFilterType<FConfig extends object = any> {
128
+ type?: "option" | string;
129
+ valueType?: "string" | "number" | "boolean";
130
+ label?: string;
131
+ multiple?: boolean;
132
+ config?: FConfig;
133
+ hidden?: boolean;
134
+ required?: boolean;
135
+ }
136
+ export interface DataTableFilterOptionConfig {
137
+ options: InputSelectOption[] | FilterOptionCallbackType;
138
+ type?: "string" | "number" | "boolean";
139
+ initialOptions?: InputSelectOption[];
140
+ icon?: string;
141
+ disableSearch?: boolean;
142
+ autoSelect?: boolean;
143
+ groupBy?: string;
144
+ }
145
+ export type DataTableDisplayCell<TValue = string, TConfig extends object = any> = Required<Omit<DataTableCellType<TValue, TConfig>, "filter">> & {
146
+ filter: boolean;
147
+ };
148
+ export type DataTableDisplayFilter<TName = string, FConfig extends object = any> = Required<DataTableFilterType<FConfig>> & {
149
+ name: TName extends string ? TName : string;
150
+ };
151
+ /**
152
+ * The mode of the option query.
153
+ */
154
+ export type FilterOptionQueryMode = "initial" | "lost" | "search";
155
+ /**
156
+ * The type of the option callback for dynamic options.
157
+ */
158
+ export type FilterOptionCallbackType<T = string> = (text: string, values: T[], mode: FilterOptionQueryMode, abortController: AbortController) => InputSelectOption[] | Promise<InputSelectOption[]>;
159
+ export type DataTableCellAdapter<TConfig extends object, TValue = string, TData = any> = (value: unknown, cell: DataTableDisplayCell<TValue, TConfig>, data: TData) => React.ReactNode;
160
+ export type DataTableCellAdapterOptions<TConfig extends object, TValue = string, TData = any> = {
161
+ nullable?: (cell: DataTableDisplayCell<TValue, TConfig>, data: TData) => React.ReactNode;
162
+ width?: string | number;
163
+ align?: "start" | "end" | "center";
164
+ };
165
+ export type DataTableFilterAdapter<TName = string, FConfig extends object = any> = (filter: DataTableDisplayFilter<TName, FConfig>) => React.ReactNode;
166
+ export type FilterVisibility<TData> = {
167
+ filterText: boolean;
168
+ getVisibleFilters(): DataTableDisplayFilter<keyof TData>[];
169
+ getFilters(): DataTableDisplayFilter<keyof TData>[];
170
+ hasFilterVisible(name: keyof TData | string): boolean;
171
+ onFilterVisibleChange(name: keyof TData | string, visible: boolean): void;
172
+ onFilterTextVisibleChange(visible: boolean): void;
173
+ };
174
+ export type LexiconType = {
175
+ readonly [key in keyof Omit<DataTableLexicon, "filterSearch" | "filterSelected">]: string;
176
+ } & {
177
+ filterSearch(label: string): string;
178
+ filterSelected(selected: number): string;
179
+ };
180
+ export type ToolbarConfig = {
181
+ size: DataTableToolbarSize;
182
+ viewIconOnly: boolean;
183
+ resetIconOnly: boolean;
184
+ onFilterReset(): void;
185
+ };
186
+ export type NavbarConfig = {
187
+ size: DataTableNavbarSize;
188
+ pageSize: number;
189
+ numberSize: number;
190
+ pageSizeOptions: number[];
191
+ mode: "arrow" | "number";
192
+ onPageSizeChange(value: number): void;
193
+ };
194
+ export type DynamicConfig = {
195
+ column: boolean;
196
+ sort: boolean;
197
+ filter: boolean;
198
+ filterText: boolean;
199
+ };
200
+ export type HeaderConfig = {
201
+ top: boolean;
202
+ bottom: boolean;
203
+ };
204
+ export type DataTableContextType<TData> = {
205
+ hash: string;
206
+ data: TData[];
207
+ table: Table<TData>;
208
+ cells: DataTableDisplayCell<keyof TData>[];
209
+ filters: DataTableDisplayFilter<keyof TData>[];
210
+ dynamic: DynamicConfig;
211
+ loading: boolean;
212
+ loadingTarget: string | null;
213
+ error: string | null;
214
+ invisible: {
215
+ [key: string]: boolean | undefined;
216
+ };
217
+ totalCount: number;
218
+ lexicon: LexiconType;
219
+ header: HeaderConfig;
220
+ toolbar: ToolbarConfig;
221
+ navbar: NavbarConfig;
222
+ filterVisible: FilterVisibility<TData>;
223
+ manual: boolean;
224
+ getRowClickHandler(data: TData): ((event: React.MouseEvent) => void) | undefined;
225
+ };
226
+ export {};
package/types.js ADDED
@@ -0,0 +1,2 @@
1
+ export {};
2
+ export {};
@@ -0,0 +1,3 @@
1
+ import { DataTableCoreProps, DataTableContextType } from "./types";
2
+ declare const useDataTable: <TData extends object>(props: DataTableCoreProps<TData>) => DataTableContextType<TData>;
3
+ export { useDataTable };