schummar-table 0.3.2 → 0.5.0-beta-1

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 (156) hide show
  1. package/dist/assets/tableTheme.0eb513b0.js +215 -0
  2. package/dist/assets/tableTheme.0eb513b0.js.map +1 -0
  3. package/dist/assets/tableTheme.65fea986.js +214 -0
  4. package/dist/assets/tableTheme.65fea986.js.map +1 -0
  5. package/dist/assets/vendor.a5ec605d.js +2475 -0
  6. package/dist/assets/vendor.a5ec605d.js.map +1 -0
  7. package/dist/assets/vendor.c9c3328b.js +2464 -0
  8. package/dist/assets/vendor.c9c3328b.js.map +1 -0
  9. package/dist/cjs/mui4Theme.js +7 -0
  10. package/dist/cjs/mui4Theme.js.map +1 -0
  11. package/dist/cjs/mui5Theme.js +7 -0
  12. package/dist/cjs/mui5Theme.js.map +1 -0
  13. package/dist/cjs/schummar-table.js +1042 -0
  14. package/dist/cjs/schummar-table.js.map +1 -0
  15. package/dist/esm/mui4Theme.js +6 -0
  16. package/dist/esm/mui4Theme.js.map +1 -0
  17. package/dist/esm/mui5Theme.js +6 -0
  18. package/dist/esm/mui5Theme.js.map +1 -0
  19. package/dist/esm/schummar-table.js +1041 -0
  20. package/dist/esm/schummar-table.js.map +1 -0
  21. package/dist/{cjs → types}/components/cell.d.ts +1 -1
  22. package/dist/types/components/columnHeader.d.ts +7 -0
  23. package/dist/{cjs → types}/components/columnSelection.d.ts +0 -0
  24. package/dist/types/components/dateFilter.d.ts +8 -0
  25. package/dist/types/components/datePicker.d.ts +16 -0
  26. package/dist/types/components/expandControl.d.ts +6 -0
  27. package/dist/{cjs → types}/components/export.d.ts +0 -0
  28. package/dist/types/components/filterControl.d.ts +2 -0
  29. package/dist/types/components/formControlLabel.d.ts +5 -0
  30. package/dist/types/components/resizeHandle.d.ts +1 -0
  31. package/dist/{cjs → types}/components/row.d.ts +1 -1
  32. package/dist/{cjs → types}/components/selectComponent.d.ts +0 -0
  33. package/dist/types/components/selectFilter.d.ts +8 -0
  34. package/dist/{cjs → types}/components/sortComponent.d.ts +0 -0
  35. package/dist/types/components/spinnner.d.ts +3 -0
  36. package/dist/{cjs → types/components}/table.d.ts +1 -1
  37. package/dist/types/components/textFilter.d.ts +5 -0
  38. package/dist/{cjs → types}/components/virtualized.d.ts +0 -0
  39. package/dist/types/hooks/useFilter.d.ts +5 -0
  40. package/dist/types/hooks/useTheme.d.ts +1 -0
  41. package/dist/types/index.d.ts +10 -0
  42. package/dist/{cjs → types}/internalState/calcItems.d.ts +0 -0
  43. package/dist/{cjs → types}/internalState/calcProps.d.ts +0 -0
  44. package/dist/{cjs → types}/internalState/cleanupState.d.ts +0 -0
  45. package/dist/{cjs → types}/internalState/filterColumns.d.ts +0 -0
  46. package/dist/{cjs → types}/internalState/syncSelections.d.ts +0 -0
  47. package/dist/types/internalState/tableStateStorage.d.ts +11 -0
  48. package/dist/{cjs → types}/internalState/useTableState.d.ts +0 -0
  49. package/dist/{cjs → types}/misc/csvExport.d.ts +0 -0
  50. package/dist/types/misc/debounce.d.ts +4 -0
  51. package/dist/types/misc/deepPartial.d.ts +3 -0
  52. package/dist/{cjs → types}/misc/helpers.d.ts +2 -1
  53. package/dist/types/misc/queue.d.ts +6 -0
  54. package/dist/{cjs → types}/misc/textMatch.d.ts +0 -0
  55. package/dist/types/misc/throttle.d.ts +4 -0
  56. package/dist/types/theme/defaultClasses.d.ts +15 -0
  57. package/dist/types/theme/defaultColors.d.ts +2 -0
  58. package/dist/types/theme/defaultIcons.d.ts +2 -0
  59. package/dist/types/theme/defaultTexts.d.ts +2 -0
  60. package/dist/types/theme/defaultTheme/badge.d.ts +2 -0
  61. package/dist/types/theme/defaultTheme/button.d.ts +2 -0
  62. package/dist/types/theme/defaultTheme/checkbox.d.ts +2 -0
  63. package/dist/types/theme/defaultTheme/iconButton.d.ts +2 -0
  64. package/dist/types/theme/defaultTheme/index.d.ts +2 -0
  65. package/dist/types/theme/defaultTheme/popover.d.ts +4 -0
  66. package/dist/types/theme/defaultTheme/textField.d.ts +2 -0
  67. package/dist/types/theme/mui4Theme/index.d.ts +8 -0
  68. package/dist/types/theme/mui5Theme/index.d.ts +8 -0
  69. package/dist/types/theme/tableTheme.d.ts +11 -0
  70. package/dist/types/theme/useCssVariables.d.ts +9 -0
  71. package/dist/types/types.d.ts +285 -0
  72. package/package.json +78 -38
  73. package/dist/cjs/components/cell.js +0 -31
  74. package/dist/cjs/components/columnSelection.js +0 -37
  75. package/dist/cjs/components/defaultFilterComponent.d.ts +0 -22
  76. package/dist/cjs/components/defaultFilterComponent.js +0 -91
  77. package/dist/cjs/components/expandComponent.d.ts +0 -5
  78. package/dist/cjs/components/expandComponent.js +0 -38
  79. package/dist/cjs/components/export.js +0 -48
  80. package/dist/cjs/components/filterComponent.d.ts +0 -5
  81. package/dist/cjs/components/filterComponent.js +0 -25
  82. package/dist/cjs/components/row.js +0 -48
  83. package/dist/cjs/components/selectComponent.js +0 -61
  84. package/dist/cjs/components/sortComponent.js +0 -52
  85. package/dist/cjs/components/textFilterComponent.d.ts +0 -11
  86. package/dist/cjs/components/textFilterComponent.js +0 -70
  87. package/dist/cjs/components/useCommonClasses.d.ts +0 -1
  88. package/dist/cjs/components/useCommonClasses.js +0 -49
  89. package/dist/cjs/components/virtualized.js +0 -98
  90. package/dist/cjs/index.d.ts +0 -6
  91. package/dist/cjs/index.js +0 -18
  92. package/dist/cjs/internalState/calcItems.js +0 -85
  93. package/dist/cjs/internalState/calcProps.js +0 -89
  94. package/dist/cjs/internalState/cleanupState.js +0 -43
  95. package/dist/cjs/internalState/filterColumns.js +0 -10
  96. package/dist/cjs/internalState/syncSelections.js +0 -22
  97. package/dist/cjs/internalState/useTableState.js +0 -62
  98. package/dist/cjs/misc/csvExport.js +0 -15
  99. package/dist/cjs/misc/helpers.js +0 -91
  100. package/dist/cjs/misc/textMatch.js +0 -23
  101. package/dist/cjs/misc/throttle.d.ts +0 -1
  102. package/dist/cjs/misc/throttle.js +0 -30
  103. package/dist/cjs/package.json +0 -1
  104. package/dist/cjs/table.js +0 -69
  105. package/dist/cjs/types.d.ts +0 -134
  106. package/dist/cjs/types.js +0 -2
  107. package/dist/esm/components/cell.d.ts +0 -6
  108. package/dist/esm/components/cell.js +0 -28
  109. package/dist/esm/components/columnSelection.d.ts +0 -2
  110. package/dist/esm/components/columnSelection.js +0 -33
  111. package/dist/esm/components/defaultFilterComponent.d.ts +0 -22
  112. package/dist/esm/components/defaultFilterComponent.js +0 -86
  113. package/dist/esm/components/expandComponent.d.ts +0 -5
  114. package/dist/esm/components/expandComponent.js +0 -34
  115. package/dist/esm/components/export.d.ts +0 -2
  116. package/dist/esm/components/export.js +0 -44
  117. package/dist/esm/components/filterComponent.d.ts +0 -5
  118. package/dist/esm/components/filterComponent.js +0 -21
  119. package/dist/esm/components/row.d.ts +0 -7
  120. package/dist/esm/components/row.js +0 -44
  121. package/dist/esm/components/selectComponent.d.ts +0 -5
  122. package/dist/esm/components/selectComponent.js +0 -57
  123. package/dist/esm/components/sortComponent.d.ts +0 -4
  124. package/dist/esm/components/sortComponent.js +0 -48
  125. package/dist/esm/components/textFilterComponent.d.ts +0 -11
  126. package/dist/esm/components/textFilterComponent.js +0 -65
  127. package/dist/esm/components/useCommonClasses.d.ts +0 -1
  128. package/dist/esm/components/useCommonClasses.js +0 -46
  129. package/dist/esm/components/virtualized.d.ts +0 -6
  130. package/dist/esm/components/virtualized.js +0 -94
  131. package/dist/esm/index.d.ts +0 -6
  132. package/dist/esm/index.js +0 -4
  133. package/dist/esm/internalState/calcItems.d.ts +0 -3
  134. package/dist/esm/internalState/calcItems.js +0 -81
  135. package/dist/esm/internalState/calcProps.d.ts +0 -2
  136. package/dist/esm/internalState/calcProps.js +0 -85
  137. package/dist/esm/internalState/cleanupState.d.ts +0 -3
  138. package/dist/esm/internalState/cleanupState.js +0 -39
  139. package/dist/esm/internalState/filterColumns.d.ts +0 -3
  140. package/dist/esm/internalState/filterColumns.js +0 -6
  141. package/dist/esm/internalState/syncSelections.d.ts +0 -3
  142. package/dist/esm/internalState/syncSelections.js +0 -18
  143. package/dist/esm/internalState/useTableState.d.ts +0 -3
  144. package/dist/esm/internalState/useTableState.js +0 -58
  145. package/dist/esm/misc/csvExport.d.ts +0 -7
  146. package/dist/esm/misc/csvExport.js +0 -11
  147. package/dist/esm/misc/helpers.d.ts +0 -14
  148. package/dist/esm/misc/helpers.js +0 -77
  149. package/dist/esm/misc/textMatch.d.ts +0 -2
  150. package/dist/esm/misc/textMatch.js +0 -18
  151. package/dist/esm/misc/throttle.d.ts +0 -1
  152. package/dist/esm/misc/throttle.js +0 -26
  153. package/dist/esm/table.d.ts +0 -8
  154. package/dist/esm/table.js +0 -63
  155. package/dist/esm/types.d.ts +0 -134
  156. package/dist/esm/types.js +0 -1
@@ -0,0 +1,1041 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __defProps = Object.defineProperties;
3
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
+ var __spreadValues = (a, b) => {
9
+ for (var prop in b || (b = {}))
10
+ if (__hasOwnProp.call(b, prop))
11
+ __defNormalProp(a, prop, b[prop]);
12
+ if (__getOwnPropSymbols)
13
+ for (var prop of __getOwnPropSymbols(b)) {
14
+ if (__propIsEnum.call(b, prop))
15
+ __defNormalProp(a, prop, b[prop]);
16
+ }
17
+ return a;
18
+ };
19
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
+ var __objRest = (source, exclude) => {
21
+ var target = {};
22
+ for (var prop in source)
23
+ if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
24
+ target[prop] = source[prop];
25
+ if (source != null && __getOwnPropSymbols)
26
+ for (var prop of __getOwnPropSymbols(source)) {
27
+ if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
28
+ target[prop] = source[prop];
29
+ }
30
+ return target;
31
+ };
32
+ import { useRef, useEffect, useState, memo, useMemo, createContext, useContext } from "react";
33
+ import { j as jsxs, a as jsx, S as StoreScope, K, F as Fragment } from "../assets/vendor.c9c3328b.js";
34
+ import { d as defaultClasses } from "../assets/tableTheme.65fea986.js";
35
+ import "react-dom";
36
+ function useCssVariables() {
37
+ const table = useTableContext();
38
+ return table.useState((state) => ({
39
+ "--spacing": state.theme.spacing,
40
+ "--primaryMain": state.theme.colors.primary.main,
41
+ "--primaryLight": state.theme.colors.primary.light,
42
+ "--primaryContrastText": state.theme.colors.primary.contrastText,
43
+ "--secondaryMain": state.theme.colors.secondary.main,
44
+ "--secondaryLight": state.theme.colors.secondary.light,
45
+ "--secondaryContrastText": state.theme.colors.secondary.contrastText
46
+ }));
47
+ }
48
+ const getAncestors = (activeItemsById, ...items) => {
49
+ const result = /* @__PURE__ */ new Set();
50
+ const find = ({ parentId }) => {
51
+ const parent = parentId ? activeItemsById.get(parentId) : void 0;
52
+ if (parent && !result.has(parent.id)) {
53
+ result.add(parent.id);
54
+ find(parent);
55
+ }
56
+ };
57
+ items.forEach(find);
58
+ return result;
59
+ };
60
+ const getDescendants = (...items) => {
61
+ const result = /* @__PURE__ */ new Set();
62
+ const find = (item) => {
63
+ for (const child of item.children) {
64
+ if (!result.has(child.id)) {
65
+ result.add(child.id);
66
+ find(child);
67
+ }
68
+ }
69
+ };
70
+ items.forEach(find);
71
+ return result;
72
+ };
73
+ function FormControlLabel({
74
+ control,
75
+ label
76
+ }) {
77
+ return jsxs("label", {
78
+ css: {
79
+ display: "flex",
80
+ alignItems: "center",
81
+ cursor: "pointer",
82
+ userSelect: "none",
83
+ "& > *": {
84
+ cursor: "pointer"
85
+ }
86
+ },
87
+ children: [control, jsx("span", {
88
+ css: {
89
+ marginLeft: "var(--spacing)"
90
+ },
91
+ children: label
92
+ })]
93
+ });
94
+ }
95
+ const ColumnHeaderContext = new StoreScope({
96
+ items: /* @__PURE__ */ new Map()
97
+ });
98
+ function ColumnHeader(props) {
99
+ const ref = useRef(null);
100
+ const columnId = useColumnContext();
101
+ const table = useTableContext();
102
+ const enabled = table.useState("props.enableColumnReorder");
103
+ const store = ColumnHeaderContext.useStore();
104
+ const draggingStart = useRef();
105
+ const clone = useRef();
106
+ useEffect(() => {
107
+ const div = ref.current;
108
+ if (!div)
109
+ return;
110
+ store.update((state) => {
111
+ state.items.set(columnId, K(div));
112
+ });
113
+ return () => {
114
+ store.update((state) => {
115
+ state.items.delete(columnId);
116
+ });
117
+ };
118
+ }, [ref.current, store, columnId]);
119
+ function calcTargetIndex(offsetLeft) {
120
+ var _a, _b, _c;
121
+ const cols = table.getState().columnOrder.map((id) => ({
122
+ id,
123
+ div: store.getState().items.get(id)
124
+ }));
125
+ const otherCols = cols.filter((col) => col.id !== columnId);
126
+ const firstOffsetleft = (_c = (_b = (_a = cols.find((col) => col.div)) == null ? void 0 : _a.div) == null ? void 0 : _b.offsetLeft) != null ? _c : 0;
127
+ let sum = 0;
128
+ const targetIndex = otherCols.findIndex((col) => {
129
+ var _a2, _b2;
130
+ const width = (_b2 = (_a2 = col.div) == null ? void 0 : _a2.offsetWidth) != null ? _b2 : 0;
131
+ if (sum + width / 2 > offsetLeft - firstOffsetleft)
132
+ return true;
133
+ sum += width;
134
+ return false;
135
+ });
136
+ return targetIndex === -1 ? otherCols.length : targetIndex;
137
+ }
138
+ function onPointerDown(e) {
139
+ const div = ref.current;
140
+ if (!div)
141
+ return;
142
+ draggingStart.current = {
143
+ mouseX: e.clientX,
144
+ bounds: div.getBoundingClientRect()
145
+ };
146
+ }
147
+ function onPointerMove(e) {
148
+ table.update((state) => {
149
+ const div = ref.current;
150
+ if (!div || draggingStart.current === void 0 || Math.abs(e.clientX - draggingStart.current.mouseX) < 5)
151
+ return;
152
+ e.stopPropagation();
153
+ div.setPointerCapture(e.pointerId);
154
+ if (!clone.current) {
155
+ clone.current = div.cloneNode(true);
156
+ document.body.append(clone.current);
157
+ for (const [key, value] of Object.entries(getComputedStyle(div))) {
158
+ try {
159
+ clone.current.style[key] = value;
160
+ } catch {
161
+ }
162
+ }
163
+ Object.assign(clone.current.style, {
164
+ pointerEvents: "none",
165
+ position: "fixed",
166
+ boxShadow: "0px 5px 5px -3px rgb(0 0 0 / 20%), 0px 8px 10px 1px rgb(0 0 0 / 14%), 0px 3px 14px 2px rgb(0 0 0 / 12%)",
167
+ left: `${draggingStart.current.bounds.left}px`,
168
+ top: `${draggingStart.current.bounds.top}px`
169
+ });
170
+ div.style.color = "rgba(0, 0, 0, 0.2)";
171
+ }
172
+ clone.current.style.left = `${draggingStart.current.bounds.left + e.clientX - draggingStart.current.mouseX}px`;
173
+ const index = state.columnOrder.indexOf(columnId);
174
+ const targetIndex = calcTargetIndex(div.offsetLeft + e.clientX - draggingStart.current.mouseX);
175
+ const columns = table.getState().columnOrder.map((id, index2) => {
176
+ var _a, _b;
177
+ return {
178
+ id,
179
+ index: index2,
180
+ width: (_b = (_a = store.getState().items.get(id)) == null ? void 0 : _a.offsetWidth) != null ? _b : 0
181
+ };
182
+ });
183
+ state.columnOrder.forEach((id, i) => {
184
+ let offset = 0;
185
+ if (i === index) {
186
+ if (targetIndex > index) {
187
+ offset = columns.slice(index + 1, targetIndex + 1).reduce((sum, col) => sum + col.width, 0);
188
+ } else if (targetIndex < index) {
189
+ offset = -columns.slice(targetIndex, index).reduce((sum, col) => sum + col.width, 0);
190
+ }
191
+ } else if (i >= targetIndex && i < index) {
192
+ offset = div.offsetWidth;
193
+ } else if (i > index && i <= targetIndex) {
194
+ offset = -div.offsetWidth;
195
+ }
196
+ state.columnStyleOverride.set(id, {
197
+ transition: "transform 500ms",
198
+ transform: `translate3d(${offset}px, 0, 0)`,
199
+ zIndex: i === index ? 1 : void 0
200
+ });
201
+ });
202
+ });
203
+ }
204
+ function onPointerUp(e) {
205
+ table.update((state) => {
206
+ var _a;
207
+ const div = ref.current;
208
+ if (!div || draggingStart.current === void 0)
209
+ return;
210
+ const index = state.columnOrder.indexOf(columnId);
211
+ const targetIndex = calcTargetIndex(div.offsetLeft + e.clientX - draggingStart.current.mouseX);
212
+ state.columnOrder.splice(index, 1);
213
+ state.columnOrder.splice(targetIndex, 0, columnId);
214
+ (_a = clone.current) == null ? void 0 : _a.remove();
215
+ div.style.color = "";
216
+ state.columnStyleOverride.clear();
217
+ draggingStart.current = void 0;
218
+ clone.current = void 0;
219
+ });
220
+ }
221
+ return jsx("div", __spreadProps(__spreadValues({}, props), {
222
+ css: {
223
+ position: "relative",
224
+ userSelect: "none"
225
+ },
226
+ ref,
227
+ onPointerDown: enabled ? onPointerDown : void 0,
228
+ onPointerMove: enabled ? onPointerMove : void 0,
229
+ onPointerUp: enabled ? onPointerUp : void 0,
230
+ children: props.children
231
+ }));
232
+ }
233
+ function ColumnSelection() {
234
+ const {
235
+ components: {
236
+ IconButton,
237
+ Popover,
238
+ Checkbox
239
+ },
240
+ icons: {
241
+ Settings
242
+ },
243
+ text
244
+ } = useTheme();
245
+ const cssVariables = useCssVariables();
246
+ const table = useTableContext();
247
+ const columns = table.useState("props.columns");
248
+ const hiddenColumns = table.useState("hiddenColumns");
249
+ const [anchorEl, setAnchorEl] = useState(null);
250
+ const toggle = (column) => {
251
+ const {
252
+ props: {
253
+ hiddenColumns: controlledHiddenColumns,
254
+ onHiddenColumnsChange
255
+ }
256
+ } = table.getState();
257
+ const newValue = new Set(hiddenColumns);
258
+ if (hiddenColumns.has(column.id))
259
+ newValue.delete(column.id);
260
+ else
261
+ newValue.add(column.id);
262
+ if (!controlledHiddenColumns) {
263
+ table.update((state) => {
264
+ state.hiddenColumns = newValue;
265
+ });
266
+ }
267
+ onHiddenColumnsChange == null ? void 0 : onHiddenColumnsChange(newValue);
268
+ };
269
+ return jsxs(Fragment, {
270
+ children: [jsx(IconButton, {
271
+ onClick: (e) => setAnchorEl(anchorEl ? null : e.currentTarget),
272
+ children: jsx(Settings, {})
273
+ }), jsx(Popover, {
274
+ anchorEl,
275
+ open: !!anchorEl,
276
+ onClose: () => setAnchorEl(null),
277
+ css: cssVariables,
278
+ children: jsxs("div", {
279
+ css: {
280
+ padding: `calc(var(--spacing) * 2)`,
281
+ display: "grid"
282
+ },
283
+ children: [jsx("div", {
284
+ css: {
285
+ marginBottom: "var(--spacing)"
286
+ },
287
+ children: text.selectColumns
288
+ }), columns.map((column) => jsx(FormControlLabel, {
289
+ control: jsx(Checkbox, {
290
+ checked: !hiddenColumns.has(column.id),
291
+ onChange: () => toggle(column),
292
+ disabled: column.cannotHide
293
+ }),
294
+ label: column.header
295
+ }, column.id))]
296
+ })
297
+ })]
298
+ });
299
+ }
300
+ function csvExport(data, { sepPrefix, separator = ",", quote = '"', eol = "\n" } = {}) {
301
+ const cells = data.map((line) => line.map((value) => {
302
+ if (typeof value === "number")
303
+ return String(value);
304
+ if (![separator, quote, eol].some((c) => value.includes(c)))
305
+ return value;
306
+ const clean = value.replace(new RegExp(quote, "g"), `${quote}${quote}`);
307
+ return `${quote}${clean}${quote}`;
308
+ }));
309
+ return (sepPrefix ? `SEP=${separator}
310
+ ` : "") + cells.map((line) => line.join(separator)).join(eol);
311
+ }
312
+ function Export() {
313
+ const table = useTableContext();
314
+ const {
315
+ components: {
316
+ Button,
317
+ IconButton,
318
+ Popover
319
+ },
320
+ icons: {
321
+ Export: Export2,
322
+ Clipboard
323
+ },
324
+ text
325
+ } = useTheme();
326
+ const cssVariables = useCssVariables();
327
+ const [anchor, setAnchor] = useState(null);
328
+ const generate = (options) => {
329
+ const {
330
+ activeColumns,
331
+ activeItems
332
+ } = table.getState();
333
+ const data = [activeColumns.map((column) => String(column.id)), ...activeItems.map((item) => activeColumns.map((column) => column.exportCell(column.value(item), item)))];
334
+ return csvExport(data, options);
335
+ };
336
+ const copy = () => {
337
+ navigator.clipboard.writeText(generate(table.getState().props.enableExport.copy));
338
+ };
339
+ const download = () => {
340
+ const a = document.createElement("a");
341
+ a.href = "data:text/csv;charset=utf-8," + encodeURIComponent(generate(table.getState().props.enableExport.download));
342
+ a.download = "export.csv";
343
+ document.body.appendChild(a);
344
+ a.click();
345
+ document.body.removeChild(a);
346
+ };
347
+ return jsxs(Fragment, {
348
+ children: [jsx(IconButton, {
349
+ onClick: (e) => setAnchor(anchor ? null : e.currentTarget),
350
+ children: jsx(Export2, {})
351
+ }), jsx(Popover, {
352
+ open: !!anchor,
353
+ onClose: () => setAnchor(null),
354
+ anchorEl: anchor,
355
+ css: cssVariables,
356
+ children: jsxs("div", {
357
+ css: {
358
+ padding: `calc(var(--spacing) * 2)`,
359
+ display: "grid",
360
+ justifyItems: "stretch",
361
+ gap: "var(--spacing)",
362
+ "& > *": {
363
+ justifyContent: "start"
364
+ }
365
+ },
366
+ children: [jsx("div", {
367
+ css: {
368
+ marginBottom: "var(--spacing)"
369
+ },
370
+ children: text.exportTitle
371
+ }), jsx(Button, {
372
+ startIcon: jsx(Clipboard, {}),
373
+ onClick: copy,
374
+ children: text.exportCopy
375
+ }), jsx(Button, {
376
+ startIcon: jsx(Export2, {}),
377
+ onClick: download,
378
+ children: text.exportDownload
379
+ })]
380
+ })
381
+ })]
382
+ });
383
+ }
384
+ function useTheme() {
385
+ const table = useTableContext();
386
+ return table.useState("theme");
387
+ }
388
+ function FilterControl() {
389
+ const table = useTableContext();
390
+ const columnId = useColumnContext();
391
+ const {
392
+ components: {
393
+ IconButton,
394
+ Popover
395
+ },
396
+ icons: {
397
+ FilterList,
398
+ ArrowDropDown
399
+ }
400
+ } = useTheme();
401
+ const cssVariables = useCssVariables();
402
+ const [anchor, setAnchor] = useState(null);
403
+ const isActive = table.useState((state) => {
404
+ const filter2 = state.filters.get(columnId);
405
+ const filterValue = state.filterValues.get(columnId);
406
+ return filter2 !== void 0 && filterValue !== void 0 && filter2.isActive(filterValue);
407
+ });
408
+ const filter = table.useState((state) => {
409
+ var _a;
410
+ return (_a = state.activeColumns.find((column) => column.id === columnId)) == null ? void 0 : _a.filter;
411
+ });
412
+ if (!filter)
413
+ return null;
414
+ return jsxs(Fragment, {
415
+ children: [jsx(IconButton, {
416
+ onClick: (e) => setAnchor(e.currentTarget),
417
+ css: [isActive && {
418
+ color: "white !important",
419
+ backgroundColor: "var(--primaryMain) !important"
420
+ }],
421
+ children: isActive ? jsx(FilterList, {}) : jsx(ArrowDropDown, {})
422
+ }), jsx("div", {
423
+ onPointerDown: (e) => {
424
+ e.stopPropagation();
425
+ },
426
+ onPointerMove: (e) => {
427
+ e.stopPropagation();
428
+ },
429
+ children: jsx(Popover, {
430
+ open: true,
431
+ hidden: !anchor,
432
+ onClose: () => setAnchor(null),
433
+ anchorEl: anchor != null ? anchor : document.body,
434
+ css: cssVariables,
435
+ children: filter
436
+ })
437
+ })]
438
+ });
439
+ }
440
+ function ResizeHandle() {
441
+ const table = useTableContext();
442
+ const columnId = useColumnContext();
443
+ const enabled = table.useState("props.enableColumnResize");
444
+ function onPointerDown(e) {
445
+ e.stopPropagation();
446
+ const div = e.target;
447
+ div.setPointerCapture(e.pointerId);
448
+ }
449
+ function onPointerMove(e) {
450
+ e.stopPropagation();
451
+ const div = e.target;
452
+ if (!div.hasPointerCapture(e.pointerId))
453
+ return;
454
+ const parent = div.parentElement;
455
+ const width = Math.max(e.clientX - parent.getBoundingClientRect().left + 5, 50);
456
+ table.update((state) => {
457
+ state.columnWidths.set(columnId, `${width}px`);
458
+ });
459
+ }
460
+ function onPointerUp(e) {
461
+ e.stopPropagation();
462
+ const div = e.target;
463
+ div.releasePointerCapture(e.pointerId);
464
+ }
465
+ function onDoubleClick(e) {
466
+ table.update((state) => {
467
+ if (e.getModifierState("Control")) {
468
+ state.columnWidths.delete(columnId);
469
+ } else {
470
+ state.columnWidths.set(columnId, "max-content");
471
+ }
472
+ });
473
+ }
474
+ return jsx("div", {
475
+ css: {
476
+ alignSelf: "stretch",
477
+ padding: "0 5px",
478
+ cursor: enabled ? "col-resize" : "initial",
479
+ display: "flex",
480
+ alignItems: "center",
481
+ "&:after": {
482
+ content: '""',
483
+ width: 1,
484
+ height: "1.2em",
485
+ background: "currentColor",
486
+ transition: "transform 300ms"
487
+ }
488
+ },
489
+ onPointerDown: enabled ? onPointerDown : void 0,
490
+ onPointerMove: enabled ? onPointerMove : void 0,
491
+ onPointerUp: enabled ? onPointerUp : void 0,
492
+ onDoubleClick: enabled ? onDoubleClick : void 0
493
+ });
494
+ }
495
+ const Cell = memo(function Cell2({
496
+ itemId,
497
+ rowIndex
498
+ }) {
499
+ var _a, _b;
500
+ const table = useTableContext();
501
+ const columnId = useColumnContext();
502
+ const {
503
+ css
504
+ } = useTheme();
505
+ const column = table.useState((state) => state.activeColumns.find((column2) => column2.id === columnId));
506
+ const item = table.useState((state) => state.activeItemsById.get(itemId));
507
+ const columnStyleOverride = table.useState((state) => state.columnStyleOverride.get(columnId), {
508
+ throttle: 16
509
+ });
510
+ if (!column || !item)
511
+ return null;
512
+ (_b = (_a = table.getState().props).debugRender) == null ? void 0 : _b.call(_a, "render cell", itemId, columnId);
513
+ const classNames = [...calcClassNames(css, item, rowIndex), ...calcClassNames(column == null ? void 0 : column.css, item, rowIndex)];
514
+ const content = column.renderCell(column.value(item), item);
515
+ return jsx("div", {
516
+ css: [defaultClasses.cell, classNames, columnStyleOverride],
517
+ children: typeof content === "string" ? jsx("span", {
518
+ css: defaultClasses.text,
519
+ children: content
520
+ }) : content
521
+ });
522
+ });
523
+ function ExpandControl({
524
+ itemId,
525
+ hasDeferredChildren
526
+ }) {
527
+ const {
528
+ components: {
529
+ IconButton,
530
+ Spinner
531
+ },
532
+ icons: {
533
+ ChevronRight
534
+ }
535
+ } = useTheme();
536
+ const table = useTableContext();
537
+ const isExpanded = table.useState((state) => state.expanded.has(itemId));
538
+ const hasChildren = table.useState((state) => {
539
+ var _a;
540
+ return !!((_a = state.activeItemsById.get(itemId)) == null ? void 0 : _a.children.length);
541
+ });
542
+ function toggle() {
543
+ const {
544
+ props: {
545
+ expanded: controlledExpanded,
546
+ expandOnlyOne,
547
+ onExpandedChange
548
+ },
549
+ expanded,
550
+ activeItemsById
551
+ } = table.getState();
552
+ const newExpanded = new Set(expanded);
553
+ if (expandOnlyOne)
554
+ newExpanded.clear();
555
+ if (isExpanded)
556
+ newExpanded.delete(itemId);
557
+ else {
558
+ newExpanded.add(itemId);
559
+ const item = activeItemsById.get(itemId);
560
+ for (const ancestor of item ? getAncestors(activeItemsById, item) : []) {
561
+ newExpanded.add(ancestor);
562
+ }
563
+ }
564
+ onExpandedChange == null ? void 0 : onExpandedChange(newExpanded);
565
+ if (!controlledExpanded) {
566
+ table.update((state) => {
567
+ state.expanded = newExpanded;
568
+ });
569
+ }
570
+ }
571
+ if (isExpanded && hasDeferredChildren && !hasChildren) {
572
+ return jsx(Spinner, {
573
+ css: {
574
+ margin: "0 var(--spacing)"
575
+ }
576
+ });
577
+ }
578
+ return jsx(IconButton, {
579
+ onClick: toggle,
580
+ children: jsx("span", {
581
+ css: {
582
+ display: "inline-flex",
583
+ transition: "all 300ms",
584
+ transform: isExpanded ? "rotate3d(0, 0, 1, 90deg)" : "rotate3d(0, 0, 1, 0deg)"
585
+ },
586
+ children: jsx(ChevronRight, {})
587
+ })
588
+ });
589
+ }
590
+ function SelectComponent({
591
+ itemId
592
+ }) {
593
+ const table = useTableContext();
594
+ const {
595
+ components: {
596
+ Checkbox
597
+ }
598
+ } = useTheme();
599
+ const isSelected = table.useState((state) => {
600
+ const itemIds = itemId ? [itemId] : [...state.activeItemsById.keys()];
601
+ return state.activeItemsById.size > 0 && itemIds.every((itemId2) => state.selection.has(itemId2));
602
+ });
603
+ function toggle(e) {
604
+ const mouseEvent = e.nativeEvent;
605
+ const {
606
+ activeItems,
607
+ activeItemsById,
608
+ lastSelectedId,
609
+ selection,
610
+ props: {
611
+ selectSyncChildren,
612
+ selection: controlledSelection,
613
+ onSelectionChange
614
+ }
615
+ } = table.getState();
616
+ let range;
617
+ if (mouseEvent.shiftKey && itemId) {
618
+ const a = lastSelectedId ? activeItems.findIndex((i) => lastSelectedId === i.id) : 0;
619
+ const b = activeItems.findIndex((item) => item.id === itemId);
620
+ range = activeItems.slice(Math.min(a, b), Math.max(a, b) + 1);
621
+ } else {
622
+ const item = itemId ? activeItemsById.get(itemId) : void 0;
623
+ range = item ? [item] : activeItems;
624
+ }
625
+ const newSelection = new Set(selection);
626
+ for (const item of range) {
627
+ if (isSelected)
628
+ newSelection.delete(item.id);
629
+ else
630
+ newSelection.add(item.id);
631
+ }
632
+ if (selectSyncChildren && isSelected) {
633
+ for (const ancestor of getAncestors(activeItemsById, ...range)) {
634
+ newSelection.delete(ancestor);
635
+ }
636
+ for (const descendant of getDescendants(...range)) {
637
+ newSelection.delete(descendant);
638
+ }
639
+ }
640
+ onSelectionChange == null ? void 0 : onSelectionChange(newSelection);
641
+ if (!controlledSelection) {
642
+ table.update((state) => {
643
+ state.selection = newSelection;
644
+ });
645
+ }
646
+ table.update((state) => {
647
+ state.lastSelectedId = itemId;
648
+ });
649
+ }
650
+ return jsx(Checkbox, {
651
+ css: {
652
+ justifySelf: "start",
653
+ color: "inherit"
654
+ },
655
+ checked: isSelected,
656
+ onChange: toggle
657
+ });
658
+ }
659
+ function calcClassNames(css, item, index) {
660
+ return [(css == null ? void 0 : css.cell) instanceof Function ? css.cell(item, index) : css == null ? void 0 : css.cell, index % 2 === 0 && (css == null ? void 0 : css.evenCell), index % 2 === 1 && (css == null ? void 0 : css.oddCell)];
661
+ }
662
+ const Row = memo(function Row2({
663
+ itemId,
664
+ rowIndex
665
+ }) {
666
+ var _a, _b;
667
+ const table = useTableContext();
668
+ const divRef = useRef(null);
669
+ const {
670
+ className,
671
+ indent,
672
+ hasChildren,
673
+ hasDeferredChildren,
674
+ columnIds,
675
+ enableSelection,
676
+ rowAction
677
+ } = table.useState((state) => {
678
+ var _a2, _b2;
679
+ const item = state.activeItemsById.get(itemId);
680
+ const index = !item ? -1 : state.activeItems.indexOf(item);
681
+ return {
682
+ className: calcClassNames(state.props.css, item, index),
683
+ indent: item ? getAncestors(state.activeItemsById, item).size : 0,
684
+ hasChildren: !!(item == null ? void 0 : item.children.length),
685
+ hasDeferredChildren: item && ((_b2 = (_a2 = state.props).hasDeferredChildren) == null ? void 0 : _b2.call(_a2, item)),
686
+ columnIds: state.activeColumns.map((column) => column.id),
687
+ enableSelection: state.props.enableSelection,
688
+ rowAction: state.props.rowAction instanceof Function ? item ? state.props.rowAction(item, index) : null : state.props.rowAction
689
+ };
690
+ });
691
+ useEffect(() => {
692
+ const div = divRef.current;
693
+ if (!div)
694
+ return;
695
+ const o = new ResizeObserver(() => {
696
+ if (!document.contains(div))
697
+ return;
698
+ table.update((state) => {
699
+ state.rowHeights.set(itemId, div.offsetHeight);
700
+ });
701
+ });
702
+ o.observe(div);
703
+ return () => o.disconnect();
704
+ }, [divRef.current]);
705
+ (_b = (_a = table.getState().props).debugRender) == null ? void 0 : _b.call(_a, "render row", itemId);
706
+ return jsxs(Fragment, {
707
+ children: [jsx("div", {
708
+ css: [defaultClasses.cellFill, className],
709
+ ref: divRef
710
+ }), jsxs("div", {
711
+ css: [defaultClasses.cell, defaultClasses.firstCell, className],
712
+ children: [jsx("div", {
713
+ css: {
714
+ width: indent * 20
715
+ }
716
+ }), enableSelection && jsx(SelectComponent, {
717
+ itemId
718
+ }), (hasChildren || hasDeferredChildren) && jsx(ExpandControl, {
719
+ itemId,
720
+ hasDeferredChildren
721
+ }), rowAction]
722
+ }), columnIds.map((columnId) => jsx(ColumnContext.Provider, {
723
+ value: columnId,
724
+ children: jsx(Cell, {
725
+ itemId,
726
+ rowIndex
727
+ })
728
+ }, columnId)), jsx("div", {
729
+ css: [defaultClasses.cellFill, className]
730
+ })]
731
+ });
732
+ });
733
+ function SortComponent({
734
+ children
735
+ }) {
736
+ const table = useTableContext();
737
+ const columnId = useColumnContext();
738
+ const {
739
+ components: {
740
+ Badge
741
+ },
742
+ icons: {
743
+ ArrowUpward
744
+ }
745
+ } = useTheme();
746
+ const {
747
+ direction,
748
+ index
749
+ } = table.useState((state) => {
750
+ var _a, _b;
751
+ const index2 = (_a = state.sort.findIndex((s) => s.columnId === columnId)) != null ? _a : -1;
752
+ return {
753
+ direction: (_b = state.sort[index2]) == null ? void 0 : _b.direction,
754
+ index: index2 >= 0 && state.sort.length > 1 ? index2 + 1 : void 0
755
+ };
756
+ });
757
+ function toggle(e) {
758
+ const {
759
+ props: {
760
+ sort: controlledSort,
761
+ onSortChange
762
+ }
763
+ } = table.getState();
764
+ const newDirection = direction === "asc" ? "desc" : "asc";
765
+ const newSort = (e.getModifierState("Control") ? table.getState().sort.filter((s) => s.columnId !== columnId) : []).concat({
766
+ columnId,
767
+ direction: newDirection
768
+ });
769
+ onSortChange == null ? void 0 : onSortChange(newSort);
770
+ if (!controlledSort) {
771
+ table.update((state) => {
772
+ state.sort = newSort;
773
+ });
774
+ }
775
+ }
776
+ return jsxs("div", {
777
+ css: {
778
+ userSelect: "none",
779
+ display: "grid",
780
+ gridTemplateColumns: "minmax(0, 1fr) max-content",
781
+ alignItems: "center",
782
+ cursor: "pointer",
783
+ "& > div": {
784
+ overflow: "hidden",
785
+ textOverflow: "ellipsis"
786
+ }
787
+ },
788
+ onClick: toggle,
789
+ children: [jsx("div", {
790
+ children
791
+ }), jsx(Badge, {
792
+ badgeContent: index,
793
+ children: jsx("span", {
794
+ css: [{
795
+ transition: "all 300ms",
796
+ fontSize: "0.8em"
797
+ }, !direction && {
798
+ opacity: 0
799
+ }, direction === "desc" && {
800
+ transform: "rotate3d(0, 0, 1, 180deg)"
801
+ }],
802
+ children: jsx(ArrowUpward, {})
803
+ })
804
+ })]
805
+ });
806
+ }
807
+ function throttle(fn, ms) {
808
+ let last = 0;
809
+ let lastArgs;
810
+ let timeout;
811
+ function run() {
812
+ const args = lastArgs;
813
+ last = Date.now();
814
+ lastArgs = void 0;
815
+ timeout = void 0;
816
+ fn(...args);
817
+ }
818
+ return Object.assign(function(...args) {
819
+ const now = Date.now();
820
+ lastArgs = args;
821
+ if (timeout)
822
+ ;
823
+ else if (now < last + ms) {
824
+ timeout = setTimeout(run, last + ms - now);
825
+ } else {
826
+ run();
827
+ }
828
+ }, {
829
+ flush() {
830
+ if (lastArgs) {
831
+ run();
832
+ }
833
+ }
834
+ });
835
+ }
836
+ const onAncestorScroll = (x, onScroll) => {
837
+ const find = (x2) => x2.parentElement ? [x2.parentElement, ...find(x2.parentElement)] : [document];
838
+ const ancestors = find(x);
839
+ for (const ancestor of ancestors) {
840
+ ancestor.addEventListener("scroll", onScroll);
841
+ }
842
+ return () => {
843
+ for (const ancestor of ancestors) {
844
+ ancestor.removeEventListener("scroll", onScroll);
845
+ }
846
+ };
847
+ };
848
+ const findScrollRoot = (x) => {
849
+ const parent = x.parentElement;
850
+ if (!parent)
851
+ return document.documentElement;
852
+ if (parent.scrollHeight > parent.clientHeight)
853
+ return parent;
854
+ return findScrollRoot(parent);
855
+ };
856
+ const relativeOffset = (x, y) => {
857
+ if (x.offsetParent === y.offsetParent || !x.offsetParent)
858
+ return x.offsetTop - y.offsetTop;
859
+ if (x.offsetParent instanceof HTMLElement)
860
+ return relativeOffset(x.offsetParent, y) + x.offsetTop;
861
+ return 0;
862
+ };
863
+ function Virtualized(_a) {
864
+ var _b = _a, {
865
+ header,
866
+ children
867
+ } = _b, props = __objRest(_b, [
868
+ "header",
869
+ "children"
870
+ ]);
871
+ var _a2, _b2, _c, _d;
872
+ const table = useTableContext();
873
+ const virtual = table.useState("props.virtual");
874
+ const probeRef = useRef(null);
875
+ const [, setCounter] = useState(0);
876
+ const {
877
+ itemIds = [],
878
+ from = 0,
879
+ to,
880
+ before = 0,
881
+ after = 0
882
+ } = table.useState((state) => {
883
+ var _a3;
884
+ const itemIds2 = state.activeItems.map((item) => item.id);
885
+ const root = probeRef.current && findScrollRoot(probeRef.current);
886
+ if (!state.props.virtual)
887
+ return {
888
+ itemIds: itemIds2
889
+ };
890
+ if (!probeRef.current || !root || !document.contains(root))
891
+ return {};
892
+ const {
893
+ rowHeight,
894
+ initalRowHeight,
895
+ overscan = 200,
896
+ overscanTop,
897
+ overscanBottom
898
+ } = (_a3 = state.props.virtual instanceof Object ? state.props.virtual : void 0) != null ? _a3 : {};
899
+ let totalHeight = 0;
900
+ const rowHeights = itemIds2.map((itemId, index) => {
901
+ var _a4, _b3;
902
+ const h = (_b3 = (_a4 = rowHeight != null ? rowHeight : state.rowHeights.get(itemId)) != null ? _a4 : initalRowHeight) != null ? _b3 : index === 0 ? 100 : totalHeight / index;
903
+ totalHeight += h;
904
+ return h;
905
+ });
906
+ const probeOffset = relativeOffset(probeRef.current, root);
907
+ const headerHeight = probeRef.current.offsetTop;
908
+ const topOfTable = root.scrollTop - probeOffset + headerHeight;
909
+ const bottomOfTable = topOfTable + root.clientHeight - headerHeight;
910
+ let from2 = 0, to2 = itemIds2.length, before2 = 0, after2 = 0;
911
+ for (const h of rowHeights) {
912
+ if (before2 + h > topOfTable - (overscanTop != null ? overscanTop : overscan))
913
+ break;
914
+ from2++;
915
+ before2 += h;
916
+ }
917
+ for (const h of rowHeights.reverse()) {
918
+ if (after2 + h > totalHeight - bottomOfTable - (overscanBottom != null ? overscanBottom : overscan))
919
+ break;
920
+ to2--;
921
+ after2 += h;
922
+ }
923
+ return {
924
+ itemIds: itemIds2.slice(from2, to2),
925
+ from: from2,
926
+ to: to2,
927
+ before: before2,
928
+ after: after2
929
+ };
930
+ });
931
+ const throttleScroll = (_b2 = (_a2 = typeof virtual === "boolean" ? void 0 : virtual) == null ? void 0 : _a2.throttleScroll) != null ? _b2 : 500;
932
+ const incCounter = useMemo(() => throttle(() => setCounter((c) => c + 1), throttleScroll), [throttleScroll]);
933
+ useEffect(() => {
934
+ if (!virtual || !probeRef.current)
935
+ return;
936
+ return onAncestorScroll(probeRef.current, incCounter);
937
+ }, [probeRef.current, incCounter]);
938
+ (_d = (_c = table.getState().props).debugRender) == null ? void 0 : _d.call(_c, `Virtualalized render ${from} to ${to}`);
939
+ return jsxs("div", __spreadProps(__spreadValues({}, props), {
940
+ children: [header, virtual && jsx("div", {
941
+ style: {
942
+ gridColumn: "1 / -1",
943
+ height: before
944
+ },
945
+ ref: probeRef
946
+ }), children(itemIds, from), virtual && jsx("div", {
947
+ style: {
948
+ gridColumn: "1 / -1",
949
+ height: after
950
+ }
951
+ })]
952
+ }));
953
+ }
954
+ const TableContext = createContext(null);
955
+ const ColumnContext = createContext(null);
956
+ function useTableContext() {
957
+ const value = useContext(TableContext);
958
+ if (!value)
959
+ throw Error("No table context available");
960
+ return value;
961
+ }
962
+ function useColumnContext() {
963
+ const value = useContext(ColumnContext);
964
+ if (value === null)
965
+ throw Error("No column context available");
966
+ return value;
967
+ }
968
+ memo(function TableInner2({
969
+ hidden
970
+ }) {
971
+ var _a, _b;
972
+ const table = useTableContext();
973
+ const fullWidth = table.useState("props.fullWidth");
974
+ const activeColumns = table.useState((state) => state.activeColumns.map((column) => ({
975
+ id: column.id,
976
+ width: column.width,
977
+ css: column.css,
978
+ header: column.header
979
+ })));
980
+ const columnWidths = table.useState("columnWidths", {
981
+ throttle: 16
982
+ });
983
+ const columnStyleOverride = table.useState("columnStyleOverride", {
984
+ throttle: 16
985
+ });
986
+ const defaultWidth = table.useState("props.defaultWidth");
987
+ const css = table.useState("props.css");
988
+ const stickyHeader = table.useState("props.stickyHeader");
989
+ const enableSelection = table.useState("props.enableSelection");
990
+ const enableColumnSelection = table.useState("props.enableColumnSelection");
991
+ const enableExport = table.useState((state) => !!state.props.enableExport.copy || !!state.props.enableExport.download);
992
+ const cssVariables = useCssVariables();
993
+ (_b = (_a = table.getState().props).debugRender) == null ? void 0 : _b.call(_a, "render table inner");
994
+ return jsx(Virtualized, {
995
+ css: [cssVariables, defaultClasses.table, css == null ? void 0 : css.table, {
996
+ gridTemplateColumns: [
997
+ fullWidth === "right" || fullWidth === true ? "auto" : "0",
998
+ "max-content",
999
+ ...activeColumns.map((column) => {
1000
+ var _a2, _b2, _c;
1001
+ return (_c = (_b2 = (_a2 = columnWidths.get(column.id)) != null ? _a2 : column.width) != null ? _b2 : defaultWidth) != null ? _c : "max-content";
1002
+ }),
1003
+ fullWidth === "left" || fullWidth === true ? "auto" : "0"
1004
+ ].join(" ")
1005
+ }, hidden && {
1006
+ visibility: "hidden"
1007
+ }],
1008
+ header: jsxs(Fragment, {
1009
+ children: [jsx("div", {
1010
+ css: [defaultClasses.headerFill, stickyHeader && defaultClasses.sticky, css == null ? void 0 : css.headerCell]
1011
+ }), jsxs("div", {
1012
+ css: [defaultClasses.headerCell, stickyHeader && defaultClasses.sticky, css == null ? void 0 : css.headerCell],
1013
+ children: [enableSelection && jsx(SelectComponent, {}), enableColumnSelection && jsx(ColumnSelection, {}), enableExport && jsx(Export, {})]
1014
+ }), jsx(ColumnHeaderContext.Provider, {
1015
+ children: activeColumns.map((column) => {
1016
+ var _a2;
1017
+ return jsx(ColumnContext.Provider, {
1018
+ value: column.id,
1019
+ children: jsxs(ColumnHeader, {
1020
+ css: [defaultClasses.headerCell, css == null ? void 0 : css.headerCell, (_a2 = column.css) == null ? void 0 : _a2.headerCell, columnStyleOverride.get(column.id), stickyHeader && defaultClasses.sticky],
1021
+ children: [jsx(FilterControl, {}), jsx(SortComponent, {
1022
+ children: column.header
1023
+ }), jsx("div", {
1024
+ css: {
1025
+ flex: 1
1026
+ }
1027
+ }), jsx(ResizeHandle, {})]
1028
+ }, column.id)
1029
+ }, column.id);
1030
+ })
1031
+ }), jsx("div", {
1032
+ css: [defaultClasses.headerFill, stickyHeader && defaultClasses.sticky, css == null ? void 0 : css.headerCell]
1033
+ })]
1034
+ }),
1035
+ children: (itemIds, startIndex) => itemIds.map((itemId, index) => jsx(Row, {
1036
+ itemId,
1037
+ rowIndex: startIndex + index
1038
+ }, itemId))
1039
+ });
1040
+ });
1041
+ //# sourceMappingURL=schummar-table.js.map