schummar-table 0.5.5 → 0.6.0
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/dist/cjs/index.js +1277 -799
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/mui4Theme.js +1 -1
- package/dist/cjs/mui4Theme.js.map +1 -1
- package/dist/cjs/mui5Theme.js +1 -1
- package/dist/cjs/mui5Theme.js.map +1 -1
- package/dist/cjs/tableTheme.js +9 -458
- package/dist/cjs/tableTheme.js.map +1 -1
- package/dist/es/index.js +2054 -1576
- package/dist/es/index.js.map +1 -1
- package/dist/es/mui4Theme.js +2 -2
- package/dist/es/mui4Theme.js.map +1 -1
- package/dist/es/mui5Theme.js +2 -2
- package/dist/es/mui5Theme.js.map +1 -1
- package/dist/es/tableTheme.js +8 -458
- package/dist/es/tableTheme.js.map +1 -1
- package/dist/types/components/dateFilter.d.ts +0 -2
- package/dist/types/components/dateInput.d.ts +5 -0
- package/dist/types/components/datePicker.d.ts +2 -0
- package/dist/types/hooks/useTheme.d.ts +2 -1
- package/dist/types/theme/mui4Theme/index.d.ts +2 -2
- package/dist/types/theme/mui5Theme/index.d.ts +2 -2
- package/dist/types/theme/tableTheme.d.ts +2 -2
- package/dist/types/types.d.ts +1 -2
- package/package.json +1 -1
package/dist/cjs/index.js
CHANGED
|
@@ -33,461 +33,165 @@ var __objRest = (source, exclude) => {
|
|
|
33
33
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
34
34
|
exports[Symbol.toStringTag] = "Module";
|
|
35
35
|
var react = require("react");
|
|
36
|
+
var react$1 = require("schummar-state/react");
|
|
36
37
|
var tableTheme = require("./tableTheme.js");
|
|
37
38
|
var jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
38
39
|
var dayzed = require("dayzed");
|
|
39
40
|
var immer = require("immer");
|
|
40
|
-
var react$
|
|
41
|
-
require("@emotion/react");
|
|
41
|
+
var react$2 = require("@emotion/react");
|
|
42
42
|
require("react-dom");
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
43
|
+
class Queue {
|
|
44
|
+
constructor() {
|
|
45
|
+
this.q = new Array();
|
|
46
|
+
this.isRunning = false;
|
|
47
|
+
}
|
|
48
|
+
run(job, replace) {
|
|
49
|
+
return new Promise((resolve, reject) => {
|
|
50
|
+
if (replace) {
|
|
51
|
+
this.q = [];
|
|
52
|
+
}
|
|
53
|
+
this.q.push({ job, resolve, reject });
|
|
54
|
+
if (!this.isRunning)
|
|
55
|
+
this.start();
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
async start() {
|
|
59
|
+
this.isRunning = true;
|
|
60
|
+
let next;
|
|
61
|
+
while (next = this.q.shift()) {
|
|
62
|
+
try {
|
|
63
|
+
const result = await next.job();
|
|
64
|
+
next.resolve(result);
|
|
65
|
+
} catch (e) {
|
|
66
|
+
next.reject(e);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
this.isRunning = false;
|
|
70
|
+
}
|
|
46
71
|
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
72
|
+
const KEYS = ["sort", "selection", "expanded", "hiddenColumns", "filterValues", "columnWidths", "columnOrder"];
|
|
73
|
+
const storageName = (id) => `schummar-table_state-v1_${id}`;
|
|
74
|
+
function stringify(value) {
|
|
75
|
+
function prepare(value2) {
|
|
76
|
+
if (value2 instanceof Date) {
|
|
77
|
+
return { __date: value2.toJSON() };
|
|
51
78
|
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
const {
|
|
55
|
-
visible
|
|
56
|
-
} = react.useContext(tableTheme.PopoverContext);
|
|
57
|
-
react.useLayoutEffect(() => {
|
|
58
|
-
if (visible && ref.current) {
|
|
59
|
-
ref.current.focus();
|
|
79
|
+
if (value2 instanceof Set) {
|
|
80
|
+
return { __set: Array.from(value2).map(prepare) };
|
|
60
81
|
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
"--primaryLight": state.theme.colors.primary.light,
|
|
72
|
-
"--primaryContrastText": state.theme.colors.primary.contrastText,
|
|
73
|
-
"--secondaryMain": state.theme.colors.secondary.main,
|
|
74
|
-
"--secondaryLight": state.theme.colors.secondary.light,
|
|
75
|
-
"--secondaryContrastText": state.theme.colors.secondary.contrastText
|
|
76
|
-
}));
|
|
77
|
-
}
|
|
78
|
-
const weekDays = [0, 1, 2, 3, 4, 5, 6];
|
|
79
|
-
const months = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11];
|
|
80
|
-
const startOfDay = (d) => new Date(d.getFullYear(), d.getMonth(), d.getDate());
|
|
81
|
-
const endOfDay = (d) => new Date(d.getFullYear(), d.getMonth(), d.getDate() + 1, 0, 0, 0, -1);
|
|
82
|
-
function dateIntersect(a, b) {
|
|
83
|
-
if (a instanceof Date) {
|
|
84
|
-
a = {
|
|
85
|
-
min: a,
|
|
86
|
-
max: a
|
|
87
|
-
};
|
|
88
|
-
}
|
|
89
|
-
if (b instanceof Date) {
|
|
90
|
-
b = {
|
|
91
|
-
min: b,
|
|
92
|
-
max: b
|
|
93
|
-
};
|
|
94
|
-
}
|
|
95
|
-
if (!(a == null ? void 0 : a.min) || !a.max || !(b == null ? void 0 : b.min) || !b.max) {
|
|
96
|
-
return false;
|
|
82
|
+
if (value2 instanceof Map) {
|
|
83
|
+
return { __map: Array.from(value2.entries()).map((entry) => entry.map(prepare)) };
|
|
84
|
+
}
|
|
85
|
+
if (value2 instanceof Array) {
|
|
86
|
+
return value2.map(prepare);
|
|
87
|
+
}
|
|
88
|
+
if (value2 instanceof Object) {
|
|
89
|
+
return Object.fromEntries(Object.entries(value2).map(([k, v]) => [k, prepare(v)]));
|
|
90
|
+
}
|
|
91
|
+
return value2;
|
|
97
92
|
}
|
|
98
|
-
return
|
|
93
|
+
return JSON.stringify(prepare(value));
|
|
99
94
|
}
|
|
100
|
-
function
|
|
101
|
-
value,
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
locale,
|
|
105
|
-
firstDayOfWeek = 0
|
|
106
|
-
}) {
|
|
107
|
-
const {
|
|
108
|
-
components: {
|
|
109
|
-
IconButton
|
|
110
|
-
},
|
|
111
|
-
icons: {
|
|
112
|
-
ChevronRight
|
|
95
|
+
function parse(value) {
|
|
96
|
+
return JSON.parse(value, (_key, value2) => {
|
|
97
|
+
if (value2 instanceof Object && "__date" in value2) {
|
|
98
|
+
return new Date(value2.__date);
|
|
113
99
|
}
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
const {
|
|
122
|
-
calendars,
|
|
123
|
-
getBackProps,
|
|
124
|
-
getForwardProps,
|
|
125
|
-
getDateProps
|
|
126
|
-
} = dayzed.useDayzed({
|
|
127
|
-
onDateSelected: () => void 0,
|
|
128
|
-
firstDayOfWeek,
|
|
129
|
-
showOutsideDays: true,
|
|
130
|
-
date: dateInView,
|
|
131
|
-
onOffsetChanged: (offset) => setDateInView(new Date(dateInView.getFullYear(), dateInView.getMonth() + offset)),
|
|
132
|
-
offset: 0
|
|
100
|
+
if (value2 instanceof Object && "__set" in value2) {
|
|
101
|
+
return new Set(value2.__set);
|
|
102
|
+
}
|
|
103
|
+
if (value2 instanceof Object && "__map" in value2) {
|
|
104
|
+
return new Map(value2.__map);
|
|
105
|
+
}
|
|
106
|
+
return value2;
|
|
133
107
|
});
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
});
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
}
|
|
164
|
-
})
|
|
165
|
-
})), jsxRuntime.jsxs("div", {
|
|
166
|
-
css: {
|
|
167
|
-
display: "flex"
|
|
168
|
-
},
|
|
169
|
-
children: [jsxRuntime.jsx(MonthSelector, {
|
|
170
|
-
value: month,
|
|
171
|
-
onChange: (month2) => setDateInView(new Date(year, month2)),
|
|
172
|
-
locale
|
|
173
|
-
}), jsxRuntime.jsx(YearSelector, {
|
|
174
|
-
value: year,
|
|
175
|
-
onChange: (year2) => setDateInView(new Date(year2, month))
|
|
176
|
-
})]
|
|
177
|
-
}), jsxRuntime.jsx(IconButton, __spreadProps(__spreadValues({}, getForwardProps({
|
|
178
|
-
calendars
|
|
179
|
-
})), {
|
|
180
|
-
children: jsxRuntime.jsx(ChevronRight, {})
|
|
181
|
-
}))]
|
|
182
|
-
}), jsxRuntime.jsxs("div", {
|
|
183
|
-
css: {
|
|
184
|
-
display: "grid",
|
|
185
|
-
gridTemplateColumns: "repeat(7, max-content)",
|
|
186
|
-
fontWeight: "bold"
|
|
187
|
-
},
|
|
188
|
-
children: [weekDays.map((_v, weekDay) => jsxRuntime.jsx("div", {
|
|
189
|
-
css: {
|
|
190
|
-
justifySelf: "center",
|
|
191
|
-
marginBottom: "var(--spacing)"
|
|
192
|
-
},
|
|
193
|
-
children: formatWeekday(weekDay)
|
|
194
|
-
}, weekDay)), weeks.map((week, index) => week.map((dateObj, dayIndex) => {
|
|
195
|
-
if (!dateObj) {
|
|
196
|
-
return jsxRuntime.jsx("div", {});
|
|
197
|
-
}
|
|
198
|
-
const {
|
|
199
|
-
prevMonth,
|
|
200
|
-
nextMonth,
|
|
201
|
-
date,
|
|
202
|
-
today: today2
|
|
203
|
-
} = dateObj;
|
|
204
|
-
const selected = date.getTime() === (min == null ? void 0 : min.getTime()) || min && max && dateIntersect(date, {
|
|
205
|
-
min,
|
|
206
|
-
max
|
|
207
|
-
});
|
|
208
|
-
const preSelected = !selected && (date.getTime() === (hovered == null ? void 0 : hovered.getTime()) || min && !max && hovered && dateIntersect(date, min <= hovered ? {
|
|
209
|
-
min,
|
|
210
|
-
max: hovered
|
|
211
|
-
} : {
|
|
212
|
-
min: hovered,
|
|
213
|
-
max: min
|
|
214
|
-
}));
|
|
215
|
-
return jsxRuntime.jsx("button", __spreadProps(__spreadValues({
|
|
216
|
-
css: [{
|
|
217
|
-
padding: 10,
|
|
218
|
-
border: "1px solid transparent",
|
|
219
|
-
background: "transparent",
|
|
220
|
-
cursor: "pointer"
|
|
221
|
-
}, (prevMonth || nextMonth) && {
|
|
222
|
-
color: tableTheme.gray
|
|
223
|
-
}, today2 && {
|
|
224
|
-
border: "1px solid var(--secondaryMain)"
|
|
225
|
-
}, selected && {
|
|
226
|
-
background: "var(--primaryMain)",
|
|
227
|
-
color: "var(--primaryContrastText)"
|
|
228
|
-
}, preSelected && {
|
|
229
|
-
background: "var(--primaryLight)",
|
|
230
|
-
color: "var(--primaryContrastText)"
|
|
231
|
-
}]
|
|
232
|
-
}, getDateProps({
|
|
233
|
-
dateObj
|
|
234
|
-
})), {
|
|
235
|
-
onClick: () => {
|
|
236
|
-
if (!rangeSelect) {
|
|
237
|
-
setCurrentMin(void 0);
|
|
238
|
-
onChange(date);
|
|
239
|
-
} else if (min && !max) {
|
|
240
|
-
setCurrentMin(void 0);
|
|
241
|
-
if (date > min) {
|
|
242
|
-
onChange({
|
|
243
|
-
min,
|
|
244
|
-
max: date
|
|
245
|
-
});
|
|
246
|
-
} else {
|
|
247
|
-
onChange({
|
|
248
|
-
min: date,
|
|
249
|
-
max: min
|
|
250
|
-
});
|
|
108
|
+
}
|
|
109
|
+
function useTableStateStorage() {
|
|
110
|
+
const table = useTableContext();
|
|
111
|
+
const [isHydrated, setIsHydrated] = react.useState(false);
|
|
112
|
+
react.useEffect(() => {
|
|
113
|
+
const { persist } = table.getState().props;
|
|
114
|
+
if (!persist) {
|
|
115
|
+
setIsHydrated(true);
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
let isCanceled = false;
|
|
119
|
+
(async () => {
|
|
120
|
+
var _a, _b;
|
|
121
|
+
try {
|
|
122
|
+
const { storage, id, include, exclude } = persist;
|
|
123
|
+
const json = await storage.getItem(storageName(id));
|
|
124
|
+
if (isCanceled || !json)
|
|
125
|
+
return;
|
|
126
|
+
const data = parse(json);
|
|
127
|
+
(_b = (_a = table.getState().props).debug) == null ? void 0 : _b.call(_a, "load", json, data);
|
|
128
|
+
table.update((state) => {
|
|
129
|
+
var _a2, _b2, _c, _d;
|
|
130
|
+
for (const key of KEYS) {
|
|
131
|
+
if ((!include || include.includes(key)) && !(exclude == null ? void 0 : exclude.includes(key)) && key in data) {
|
|
132
|
+
if (key === "filterValues") {
|
|
133
|
+
for (const [id2, value] of data[key]) {
|
|
134
|
+
if ((_b2 = (_a2 = state.filters.get(id2)) == null ? void 0 : _a2.persist) != null ? _b2 : true) {
|
|
135
|
+
state.filterValues.set(id2, value);
|
|
136
|
+
}
|
|
251
137
|
}
|
|
252
138
|
} else {
|
|
253
|
-
|
|
139
|
+
state[key] = data[key];
|
|
140
|
+
if (key === "expanded" || key === "hiddenColumns" || key === "selection" || key === "sort") {
|
|
141
|
+
(_d = (_c = state.props)[`on${key.slice(0, 1).toUpperCase() + key.slice(1)}Change`]) == null ? void 0 : _d.call(_c, data[key]);
|
|
142
|
+
}
|
|
254
143
|
}
|
|
255
|
-
},
|
|
256
|
-
onPointerOver: () => setHovered(date),
|
|
257
|
-
onPointerOut: () => setHovered(void 0),
|
|
258
|
-
children: date.getDate()
|
|
259
|
-
}), `${index}-${dayIndex}`);
|
|
260
|
-
}))]
|
|
261
|
-
})]
|
|
262
|
-
}, `${month}${year}`))
|
|
263
|
-
});
|
|
264
|
-
}
|
|
265
|
-
function MonthSelector({
|
|
266
|
-
value,
|
|
267
|
-
onChange,
|
|
268
|
-
locale
|
|
269
|
-
}) {
|
|
270
|
-
const {
|
|
271
|
-
components: {
|
|
272
|
-
Popover
|
|
273
|
-
}
|
|
274
|
-
} = useTheme();
|
|
275
|
-
const cssVariables = useCssVariables();
|
|
276
|
-
const [anchor, setAnchor] = react.useState();
|
|
277
|
-
const formatMonth = react.useMemo(() => {
|
|
278
|
-
const {
|
|
279
|
-
format
|
|
280
|
-
} = new Intl.DateTimeFormat(locale, {
|
|
281
|
-
month: "long"
|
|
282
|
-
});
|
|
283
|
-
return (month) => format(new Date(2021, month));
|
|
284
|
-
}, [locale]);
|
|
285
|
-
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
286
|
-
children: [jsxRuntime.jsx("button", {
|
|
287
|
-
css: {
|
|
288
|
-
border: "none",
|
|
289
|
-
background: "transparent",
|
|
290
|
-
fontSize: "inherit",
|
|
291
|
-
cursor: "pointer"
|
|
292
|
-
},
|
|
293
|
-
onClick: (e) => setAnchor(e.currentTarget),
|
|
294
|
-
children: formatMonth(value)
|
|
295
|
-
}), jsxRuntime.jsx(Popover, {
|
|
296
|
-
open: !!anchor,
|
|
297
|
-
anchorEl: anchor != null ? anchor : null,
|
|
298
|
-
onClose: () => setAnchor(void 0),
|
|
299
|
-
align: "center",
|
|
300
|
-
css: cssVariables,
|
|
301
|
-
children: jsxRuntime.jsx("div", {
|
|
302
|
-
css: {
|
|
303
|
-
display: "grid"
|
|
304
|
-
},
|
|
305
|
-
children: months.map((month) => jsxRuntime.jsx("button", {
|
|
306
|
-
css: [{
|
|
307
|
-
padding: "var(--spacing)",
|
|
308
|
-
border: "none",
|
|
309
|
-
background: "transparent",
|
|
310
|
-
"&:hover": {
|
|
311
|
-
background: "var(--primaryLight)"
|
|
312
144
|
}
|
|
313
|
-
}
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
})
|
|
320
|
-
})]
|
|
321
|
-
});
|
|
322
|
-
}
|
|
323
|
-
function YearSelector({
|
|
324
|
-
value,
|
|
325
|
-
onChange,
|
|
326
|
-
locale
|
|
327
|
-
}) {
|
|
328
|
-
const [input, setInput] = react.useState();
|
|
329
|
-
const ref = react.useRef(null);
|
|
330
|
-
function apply() {
|
|
331
|
-
onChange(Number(input));
|
|
332
|
-
setInput(void 0);
|
|
333
|
-
}
|
|
334
|
-
const formatYear = react.useMemo(() => {
|
|
335
|
-
const {
|
|
336
|
-
format
|
|
337
|
-
} = new Intl.DateTimeFormat(locale, {
|
|
338
|
-
year: "numeric"
|
|
339
|
-
});
|
|
340
|
-
return (year) => format(new Date(year, 0, 1));
|
|
341
|
-
}, [locale]);
|
|
342
|
-
react.useLayoutEffect(() => {
|
|
343
|
-
var _a;
|
|
344
|
-
return (_a = ref.current) == null ? void 0 : _a.focus();
|
|
345
|
-
}, [ref.current]);
|
|
346
|
-
if (input === void 0) {
|
|
347
|
-
return jsxRuntime.jsx("div", {
|
|
348
|
-
onClick: () => setInput(String(value)),
|
|
349
|
-
children: formatYear(value)
|
|
350
|
-
});
|
|
351
|
-
}
|
|
352
|
-
return jsxRuntime.jsx("input", {
|
|
353
|
-
ref,
|
|
354
|
-
css: {
|
|
355
|
-
width: "4ch"
|
|
356
|
-
},
|
|
357
|
-
value: input,
|
|
358
|
-
onChange: (e) => {
|
|
359
|
-
if (e.target.value.match(/^\d{0,4}$/)) {
|
|
360
|
-
setInput(e.target.value);
|
|
145
|
+
}
|
|
146
|
+
});
|
|
147
|
+
} catch (e) {
|
|
148
|
+
console.error("Failed to load table state:", e);
|
|
149
|
+
} finally {
|
|
150
|
+
setIsHydrated(true);
|
|
361
151
|
}
|
|
362
|
-
}
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
});
|
|
366
|
-
}
|
|
367
|
-
function convertDate(x) {
|
|
368
|
-
if (x instanceof Date)
|
|
369
|
-
return x;
|
|
370
|
-
if (typeof x === "number" || typeof x === "string")
|
|
371
|
-
return new Date(x);
|
|
372
|
-
return null;
|
|
373
|
-
}
|
|
374
|
-
function convertDateOrRange(x) {
|
|
375
|
-
if (x instanceof Object && "min" in x && "max" in x) {
|
|
376
|
-
const range = {
|
|
377
|
-
min: convertDate(x.min),
|
|
378
|
-
max: convertDate(x.max)
|
|
152
|
+
})();
|
|
153
|
+
return () => {
|
|
154
|
+
isCanceled = true;
|
|
379
155
|
};
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
},
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
}
|
|
419
|
-
}));
|
|
420
|
-
const formatDate = react.useMemo(() => {
|
|
421
|
-
const {
|
|
422
|
-
format
|
|
423
|
-
} = new Intl.DateTimeFormat(locale, {
|
|
424
|
-
dateStyle: "medium"
|
|
425
|
-
});
|
|
426
|
-
return format;
|
|
427
|
-
}, [locale]);
|
|
428
|
-
return jsxRuntime.jsxs("div", {
|
|
429
|
-
css: {
|
|
430
|
-
padding: "calc(var(--spacing) * 2)",
|
|
431
|
-
display: "grid"
|
|
432
|
-
},
|
|
433
|
-
children: [!singleSelect && jsxRuntime.jsxs("div", {
|
|
434
|
-
css: {
|
|
435
|
-
marginBottom: "var(--spacing)",
|
|
436
|
-
display: "flex",
|
|
437
|
-
justifyContent: "center"
|
|
438
|
-
},
|
|
439
|
-
children: [value ? formatDate(value instanceof Date ? value : value.min) : "", " -", " ", value ? formatDate(value instanceof Date ? value : value.max) : ""]
|
|
440
|
-
}), jsxRuntime.jsx(DatePicker, {
|
|
441
|
-
rangeSelect: !singleSelect,
|
|
442
|
-
value,
|
|
443
|
-
onChange,
|
|
444
|
-
locale,
|
|
445
|
-
firstDayOfWeek
|
|
446
|
-
}), jsxRuntime.jsxs("div", {
|
|
447
|
-
css: {
|
|
448
|
-
marginTop: "var(--spacing)",
|
|
449
|
-
display: "grid",
|
|
450
|
-
gridAutoFlow: "column",
|
|
451
|
-
justifyContent: "center"
|
|
452
|
-
},
|
|
453
|
-
children: [jsxRuntime.jsx(Button, {
|
|
454
|
-
variant: "text",
|
|
455
|
-
onClick: () => onChange(today()),
|
|
456
|
-
children: text.today
|
|
457
|
-
}), jsxRuntime.jsx(Button, {
|
|
458
|
-
variant: "text",
|
|
459
|
-
onClick: () => onChange(thisWeek(firstDayOfWeek)),
|
|
460
|
-
children: text.thisWeek
|
|
461
|
-
}), jsxRuntime.jsx(Button, {
|
|
462
|
-
variant: "text",
|
|
463
|
-
onClick: () => onChange(null),
|
|
464
|
-
children: text.reset
|
|
465
|
-
})]
|
|
466
|
-
})]
|
|
467
|
-
});
|
|
156
|
+
}, []);
|
|
157
|
+
react.useEffect(() => {
|
|
158
|
+
if (!isHydrated)
|
|
159
|
+
return;
|
|
160
|
+
const q = new Queue();
|
|
161
|
+
return table.subscribe((state) => {
|
|
162
|
+
var _a, _b;
|
|
163
|
+
if (!state.props.persist)
|
|
164
|
+
return;
|
|
165
|
+
const { storage, id, include, exclude } = state.props.persist;
|
|
166
|
+
const data = {};
|
|
167
|
+
for (const key of KEYS) {
|
|
168
|
+
if ((!include || include.includes(key)) && !(exclude == null ? void 0 : exclude.includes(key))) {
|
|
169
|
+
if (key === "filterValues") {
|
|
170
|
+
data[key] = /* @__PURE__ */ new Map();
|
|
171
|
+
for (const [id2, value] of state.filterValues) {
|
|
172
|
+
if ((_b = (_a = state.filters.get(id2)) == null ? void 0 : _a.persist) != null ? _b : true) {
|
|
173
|
+
data.filterValues.set(id2, value);
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
} else {
|
|
177
|
+
data[key] = state[key];
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
return { storage, id, data };
|
|
182
|
+
}, (props) => {
|
|
183
|
+
var _a, _b;
|
|
184
|
+
if (!props)
|
|
185
|
+
return;
|
|
186
|
+
const { storage, id, data } = props;
|
|
187
|
+
(_b = (_a = table.getState().props).debug) == null ? void 0 : _b.call(_a, "save", data, stringify(data));
|
|
188
|
+
q.run(async () => {
|
|
189
|
+
await storage.setItem(storageName(id), stringify(data));
|
|
190
|
+
}, true);
|
|
191
|
+
}, { throttle: 1e3 });
|
|
192
|
+
}, [isHydrated]);
|
|
193
|
+
return isHydrated;
|
|
468
194
|
}
|
|
469
|
-
const today = () => {
|
|
470
|
-
const today2 = startOfDay(new Date());
|
|
471
|
-
return {
|
|
472
|
-
min: today2,
|
|
473
|
-
max: today2
|
|
474
|
-
};
|
|
475
|
-
};
|
|
476
|
-
const thisWeek = (firstDayOfWeek = 0) => {
|
|
477
|
-
const now = new Date();
|
|
478
|
-
const min = new Date(now);
|
|
479
|
-
let diff = min.getDay() - firstDayOfWeek;
|
|
480
|
-
if (diff < 0) {
|
|
481
|
-
diff += 7;
|
|
482
|
-
}
|
|
483
|
-
min.setDate(min.getDate() - diff);
|
|
484
|
-
const max = new Date(min);
|
|
485
|
-
max.setDate(max.getDate() + 6);
|
|
486
|
-
return {
|
|
487
|
-
min: startOfDay(min),
|
|
488
|
-
max: endOfDay(max)
|
|
489
|
-
};
|
|
490
|
-
};
|
|
491
195
|
const flatMap = (arr, flatMap2) => {
|
|
492
196
|
return [...arr].reduce((out, cur) => out.concat(flatMap2(cur)), []);
|
|
493
197
|
};
|
|
@@ -564,185 +268,8 @@ const cx = (...classNames) => classNames.flatMap((entry) => {
|
|
|
564
268
|
return [];
|
|
565
269
|
if (typeof entry === "string")
|
|
566
270
|
return [entry];
|
|
567
|
-
return Object.entries(entry).filter(([, predicate]) => predicate).map(([
|
|
271
|
+
return Object.entries(entry).filter(([, predicate]) => predicate).map(([className2]) => className2);
|
|
568
272
|
}).join(" ");
|
|
569
|
-
function FormControlLabel({
|
|
570
|
-
control,
|
|
571
|
-
label,
|
|
572
|
-
disabled
|
|
573
|
-
}) {
|
|
574
|
-
return jsxRuntime.jsxs("label", {
|
|
575
|
-
css: [{
|
|
576
|
-
display: "flex",
|
|
577
|
-
alignItems: "center",
|
|
578
|
-
cursor: "pointer",
|
|
579
|
-
userSelect: "none",
|
|
580
|
-
"& > *": {
|
|
581
|
-
cursor: "pointer"
|
|
582
|
-
}
|
|
583
|
-
}, disabled && {
|
|
584
|
-
color: "rgba(0, 0, 0, 0.26)"
|
|
585
|
-
}],
|
|
586
|
-
children: [control, jsxRuntime.jsx("span", {
|
|
587
|
-
css: {
|
|
588
|
-
marginLeft: "var(--spacing)"
|
|
589
|
-
},
|
|
590
|
-
children: label
|
|
591
|
-
})]
|
|
592
|
-
});
|
|
593
|
-
}
|
|
594
|
-
class Queue {
|
|
595
|
-
constructor() {
|
|
596
|
-
this.q = new Array();
|
|
597
|
-
this.isRunning = false;
|
|
598
|
-
}
|
|
599
|
-
run(job, replace) {
|
|
600
|
-
return new Promise((resolve, reject) => {
|
|
601
|
-
if (replace) {
|
|
602
|
-
this.q = [];
|
|
603
|
-
}
|
|
604
|
-
this.q.push({ job, resolve, reject });
|
|
605
|
-
if (!this.isRunning)
|
|
606
|
-
this.start();
|
|
607
|
-
});
|
|
608
|
-
}
|
|
609
|
-
async start() {
|
|
610
|
-
this.isRunning = true;
|
|
611
|
-
let next;
|
|
612
|
-
while (next = this.q.shift()) {
|
|
613
|
-
try {
|
|
614
|
-
const result = await next.job();
|
|
615
|
-
next.resolve(result);
|
|
616
|
-
} catch (e) {
|
|
617
|
-
next.reject(e);
|
|
618
|
-
}
|
|
619
|
-
}
|
|
620
|
-
this.isRunning = false;
|
|
621
|
-
}
|
|
622
|
-
}
|
|
623
|
-
const KEYS = ["sort", "selection", "expanded", "hiddenColumns", "filterValues", "columnWidths", "columnOrder"];
|
|
624
|
-
const storageName = (id) => `schummar-table_state-v1_${id}`;
|
|
625
|
-
function stringify(value) {
|
|
626
|
-
function prepare(value2) {
|
|
627
|
-
if (value2 instanceof Date) {
|
|
628
|
-
return { __date: value2.toJSON() };
|
|
629
|
-
}
|
|
630
|
-
if (value2 instanceof Set) {
|
|
631
|
-
return { __set: Array.from(value2).map(prepare) };
|
|
632
|
-
}
|
|
633
|
-
if (value2 instanceof Map) {
|
|
634
|
-
return { __map: Array.from(value2.entries()).map((entry) => entry.map(prepare)) };
|
|
635
|
-
}
|
|
636
|
-
if (value2 instanceof Array) {
|
|
637
|
-
return value2.map(prepare);
|
|
638
|
-
}
|
|
639
|
-
if (value2 instanceof Object) {
|
|
640
|
-
return Object.fromEntries(Object.entries(value2).map(([k, v]) => [k, prepare(v)]));
|
|
641
|
-
}
|
|
642
|
-
return value2;
|
|
643
|
-
}
|
|
644
|
-
return JSON.stringify(prepare(value));
|
|
645
|
-
}
|
|
646
|
-
function parse(value) {
|
|
647
|
-
return JSON.parse(value, (_key, value2) => {
|
|
648
|
-
if (value2 instanceof Object && "__date" in value2) {
|
|
649
|
-
return new Date(value2.__date);
|
|
650
|
-
}
|
|
651
|
-
if (value2 instanceof Object && "__set" in value2) {
|
|
652
|
-
return new Set(value2.__set);
|
|
653
|
-
}
|
|
654
|
-
if (value2 instanceof Object && "__map" in value2) {
|
|
655
|
-
return new Map(value2.__map);
|
|
656
|
-
}
|
|
657
|
-
return value2;
|
|
658
|
-
});
|
|
659
|
-
}
|
|
660
|
-
function useTableStateStorage() {
|
|
661
|
-
const table = useTableContext();
|
|
662
|
-
const [isHydrated, setIsHydrated] = react.useState(false);
|
|
663
|
-
react.useEffect(() => {
|
|
664
|
-
const { persist } = table.getState().props;
|
|
665
|
-
if (!persist) {
|
|
666
|
-
setIsHydrated(true);
|
|
667
|
-
return;
|
|
668
|
-
}
|
|
669
|
-
let isCanceled = false;
|
|
670
|
-
(async () => {
|
|
671
|
-
var _a, _b;
|
|
672
|
-
try {
|
|
673
|
-
const { storage, id, include, exclude } = persist;
|
|
674
|
-
const json = await storage.getItem(storageName(id));
|
|
675
|
-
if (isCanceled || !json)
|
|
676
|
-
return;
|
|
677
|
-
const data = parse(json);
|
|
678
|
-
(_b = (_a = table.getState().props).debug) == null ? void 0 : _b.call(_a, "load", json, data);
|
|
679
|
-
table.update((state) => {
|
|
680
|
-
var _a2, _b2, _c, _d;
|
|
681
|
-
for (const key of KEYS) {
|
|
682
|
-
if ((!include || include.includes(key)) && !(exclude == null ? void 0 : exclude.includes(key)) && key in data) {
|
|
683
|
-
if (key === "filterValues") {
|
|
684
|
-
for (const [id2, value] of data[key]) {
|
|
685
|
-
if ((_b2 = (_a2 = state.filters.get(id2)) == null ? void 0 : _a2.persist) != null ? _b2 : true) {
|
|
686
|
-
state.filterValues.set(id2, value);
|
|
687
|
-
}
|
|
688
|
-
}
|
|
689
|
-
} else {
|
|
690
|
-
state[key] = data[key];
|
|
691
|
-
if (key === "expanded" || key === "hiddenColumns" || key === "selection" || key === "sort") {
|
|
692
|
-
(_d = (_c = state.props)[`on${key.slice(0, 1).toUpperCase() + key.slice(1)}Change`]) == null ? void 0 : _d.call(_c, data[key]);
|
|
693
|
-
}
|
|
694
|
-
}
|
|
695
|
-
}
|
|
696
|
-
}
|
|
697
|
-
});
|
|
698
|
-
} catch (e) {
|
|
699
|
-
console.error("Failed to load table state:", e);
|
|
700
|
-
} finally {
|
|
701
|
-
setIsHydrated(true);
|
|
702
|
-
}
|
|
703
|
-
})();
|
|
704
|
-
return () => {
|
|
705
|
-
isCanceled = true;
|
|
706
|
-
};
|
|
707
|
-
}, []);
|
|
708
|
-
react.useEffect(() => {
|
|
709
|
-
if (!isHydrated)
|
|
710
|
-
return;
|
|
711
|
-
const q = new Queue();
|
|
712
|
-
return table.subscribe((state) => {
|
|
713
|
-
var _a, _b;
|
|
714
|
-
if (!state.props.persist)
|
|
715
|
-
return;
|
|
716
|
-
const { storage, id, include, exclude } = state.props.persist;
|
|
717
|
-
const data = {};
|
|
718
|
-
for (const key of KEYS) {
|
|
719
|
-
if ((!include || include.includes(key)) && !(exclude == null ? void 0 : exclude.includes(key))) {
|
|
720
|
-
if (key === "filterValues") {
|
|
721
|
-
data[key] = /* @__PURE__ */ new Map();
|
|
722
|
-
for (const [id2, value] of state.filterValues) {
|
|
723
|
-
if ((_b = (_a = state.filters.get(id2)) == null ? void 0 : _a.persist) != null ? _b : true) {
|
|
724
|
-
data.filterValues.set(id2, value);
|
|
725
|
-
}
|
|
726
|
-
}
|
|
727
|
-
} else {
|
|
728
|
-
data[key] = state[key];
|
|
729
|
-
}
|
|
730
|
-
}
|
|
731
|
-
}
|
|
732
|
-
return { storage, id, data };
|
|
733
|
-
}, (props) => {
|
|
734
|
-
var _a, _b;
|
|
735
|
-
if (!props)
|
|
736
|
-
return;
|
|
737
|
-
const { storage, id, data } = props;
|
|
738
|
-
(_b = (_a = table.getState().props).debug) == null ? void 0 : _b.call(_a, "save", data, stringify(data));
|
|
739
|
-
q.run(async () => {
|
|
740
|
-
await storage.setItem(storageName(id), stringify(data));
|
|
741
|
-
}, true);
|
|
742
|
-
}, { throttle: 1e3 });
|
|
743
|
-
}, [isHydrated]);
|
|
744
|
-
return isHydrated;
|
|
745
|
-
}
|
|
746
273
|
function calcItems(state) {
|
|
747
274
|
react.useEffect(() => state.addReaction((state2) => [
|
|
748
275
|
state2.props.items,
|
|
@@ -1005,12 +532,10 @@ function syncSelections(table) {
|
|
|
1005
532
|
}
|
|
1006
533
|
function useTableState(_props) {
|
|
1007
534
|
const props = calcProps(_props);
|
|
1008
|
-
const theme = tableTheme.useTableTheme(props);
|
|
1009
535
|
const state = react.useMemo(() => {
|
|
1010
536
|
var _a, _b, _c, _d;
|
|
1011
537
|
return new react$1.Store({
|
|
1012
538
|
props,
|
|
1013
|
-
theme,
|
|
1014
539
|
sort: (_a = props.defaultSort) != null ? _a : [],
|
|
1015
540
|
selection: (_b = props.defaultSelection) != null ? _b : /* @__PURE__ */ new Set(),
|
|
1016
541
|
expanded: (_c = props.defaultExpanded) != null ? _c : /* @__PURE__ */ new Set(),
|
|
@@ -1050,11 +575,22 @@ function useTableState(_props) {
|
|
|
1050
575
|
state2.columnOrder.splice(index, 0, column.id);
|
|
1051
576
|
}
|
|
1052
577
|
}
|
|
1053
|
-
state2.theme = theme;
|
|
1054
578
|
});
|
|
1055
579
|
}, [state, props]);
|
|
1056
580
|
return state;
|
|
1057
581
|
}
|
|
582
|
+
function useCssVariables() {
|
|
583
|
+
const theme = useTheme();
|
|
584
|
+
return {
|
|
585
|
+
"--spacing": theme.spacing,
|
|
586
|
+
"--primaryMain": theme.colors.primary.main,
|
|
587
|
+
"--primaryLight": theme.colors.primary.light,
|
|
588
|
+
"--primaryContrastText": theme.colors.primary.contrastText,
|
|
589
|
+
"--secondaryMain": theme.colors.secondary.main,
|
|
590
|
+
"--secondaryLight": theme.colors.secondary.light,
|
|
591
|
+
"--secondaryContrastText": theme.colors.secondary.contrastText
|
|
592
|
+
};
|
|
593
|
+
}
|
|
1058
594
|
const ColumnHeaderContext = new react$1.StoreScope({
|
|
1059
595
|
items: /* @__PURE__ */ new Map()
|
|
1060
596
|
});
|
|
@@ -1193,15 +729,40 @@ function ColumnHeader(props) {
|
|
|
1193
729
|
children: props.children
|
|
1194
730
|
}));
|
|
1195
731
|
}
|
|
732
|
+
function FormControlLabel({
|
|
733
|
+
control,
|
|
734
|
+
label,
|
|
735
|
+
disabled
|
|
736
|
+
}) {
|
|
737
|
+
return jsxRuntime.jsxs("label", {
|
|
738
|
+
css: [{
|
|
739
|
+
display: "flex",
|
|
740
|
+
alignItems: "center",
|
|
741
|
+
cursor: "pointer",
|
|
742
|
+
userSelect: "none",
|
|
743
|
+
"& > *": {
|
|
744
|
+
cursor: "pointer"
|
|
745
|
+
}
|
|
746
|
+
}, disabled && {
|
|
747
|
+
color: "rgba(0, 0, 0, 0.26)"
|
|
748
|
+
}],
|
|
749
|
+
children: [control, jsxRuntime.jsx("span", {
|
|
750
|
+
css: {
|
|
751
|
+
marginLeft: "var(--spacing)"
|
|
752
|
+
},
|
|
753
|
+
children: label
|
|
754
|
+
})]
|
|
755
|
+
});
|
|
756
|
+
}
|
|
1196
757
|
function ColumnSelection() {
|
|
1197
758
|
const {
|
|
1198
759
|
components: {
|
|
1199
|
-
IconButton,
|
|
760
|
+
IconButton: IconButton2,
|
|
1200
761
|
Popover,
|
|
1201
|
-
Checkbox
|
|
762
|
+
Checkbox: Checkbox2
|
|
1202
763
|
},
|
|
1203
764
|
icons: {
|
|
1204
|
-
Settings
|
|
765
|
+
Settings: Settings2
|
|
1205
766
|
},
|
|
1206
767
|
text
|
|
1207
768
|
} = useTheme();
|
|
@@ -1230,9 +791,9 @@ function ColumnSelection() {
|
|
|
1230
791
|
onHiddenColumnsChange == null ? void 0 : onHiddenColumnsChange(newValue);
|
|
1231
792
|
};
|
|
1232
793
|
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
1233
|
-
children: [jsxRuntime.jsx(
|
|
794
|
+
children: [jsxRuntime.jsx(IconButton2, {
|
|
1234
795
|
onClick: (e) => setAnchorEl(anchorEl ? null : e.currentTarget),
|
|
1235
|
-
children: jsxRuntime.jsx(
|
|
796
|
+
children: jsxRuntime.jsx(Settings2, {})
|
|
1236
797
|
}), jsxRuntime.jsx(Popover, {
|
|
1237
798
|
anchorEl,
|
|
1238
799
|
open: !!anchorEl,
|
|
@@ -1249,7 +810,7 @@ function ColumnSelection() {
|
|
|
1249
810
|
},
|
|
1250
811
|
children: text.selectColumns
|
|
1251
812
|
}), columns.map((column) => jsxRuntime.jsx(FormControlLabel, {
|
|
1252
|
-
control: jsxRuntime.jsx(
|
|
813
|
+
control: jsxRuntime.jsx(Checkbox2, {
|
|
1253
814
|
checked: !hiddenColumns.has(column.id),
|
|
1254
815
|
onChange: () => toggle2(column),
|
|
1255
816
|
disabled: column.cannotHide
|
|
@@ -1272,17 +833,17 @@ function csvExport(data, { sepPrefix, separator = ",", quote = '"', eol = "\n" }
|
|
|
1272
833
|
return (sepPrefix ? `SEP=${separator}
|
|
1273
834
|
` : "") + cells.map((line) => line.join(separator)).join(eol);
|
|
1274
835
|
}
|
|
1275
|
-
function Export() {
|
|
836
|
+
function Export$1() {
|
|
1276
837
|
const table = useTableContext();
|
|
1277
838
|
const {
|
|
1278
839
|
components: {
|
|
1279
|
-
Button,
|
|
1280
|
-
IconButton,
|
|
840
|
+
Button: Button2,
|
|
841
|
+
IconButton: IconButton2,
|
|
1281
842
|
Popover
|
|
1282
843
|
},
|
|
1283
844
|
icons: {
|
|
1284
845
|
Export: Export2,
|
|
1285
|
-
Clipboard
|
|
846
|
+
Clipboard: Clipboard2
|
|
1286
847
|
},
|
|
1287
848
|
text
|
|
1288
849
|
} = useTheme();
|
|
@@ -1308,7 +869,7 @@ function Export() {
|
|
|
1308
869
|
document.body.removeChild(a);
|
|
1309
870
|
};
|
|
1310
871
|
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
1311
|
-
children: [jsxRuntime.jsx(
|
|
872
|
+
children: [jsxRuntime.jsx(IconButton2, {
|
|
1312
873
|
onClick: (e) => setAnchor(anchor ? null : e.currentTarget),
|
|
1313
874
|
children: jsxRuntime.jsx(Export2, {
|
|
1314
875
|
css: !!anchor && {
|
|
@@ -1335,11 +896,11 @@ function Export() {
|
|
|
1335
896
|
marginBottom: "var(--spacing)"
|
|
1336
897
|
},
|
|
1337
898
|
children: text.exportTitle
|
|
1338
|
-
}), jsxRuntime.jsx(
|
|
1339
|
-
startIcon: jsxRuntime.jsx(
|
|
899
|
+
}), jsxRuntime.jsx(Button2, {
|
|
900
|
+
startIcon: jsxRuntime.jsx(Clipboard2, {}),
|
|
1340
901
|
onClick: copy,
|
|
1341
902
|
children: text.exportCopy
|
|
1342
|
-
}), jsxRuntime.jsx(
|
|
903
|
+
}), jsxRuntime.jsx(Button2, {
|
|
1343
904
|
startIcon: jsxRuntime.jsx(Export2, {}),
|
|
1344
905
|
onClick: download,
|
|
1345
906
|
children: text.exportDownload
|
|
@@ -1354,12 +915,12 @@ function FilterControl() {
|
|
|
1354
915
|
const columnId = useColumnContext();
|
|
1355
916
|
const {
|
|
1356
917
|
components: {
|
|
1357
|
-
IconButton,
|
|
918
|
+
IconButton: IconButton2,
|
|
1358
919
|
Popover
|
|
1359
920
|
},
|
|
1360
921
|
icons: {
|
|
1361
|
-
FilterList,
|
|
1362
|
-
ArrowDropDown
|
|
922
|
+
FilterList: FilterList2,
|
|
923
|
+
ArrowDropDown: ArrowDropDown2
|
|
1363
924
|
}
|
|
1364
925
|
} = useTheme();
|
|
1365
926
|
const cssVariables = useCssVariables();
|
|
@@ -1392,13 +953,13 @@ function FilterControl() {
|
|
|
1392
953
|
e.preventDefault();
|
|
1393
954
|
return false;
|
|
1394
955
|
},
|
|
1395
|
-
children: jsxRuntime.jsx(
|
|
956
|
+
children: jsxRuntime.jsx(IconButton2, {
|
|
1396
957
|
css: [{
|
|
1397
958
|
color: "#b0bac9"
|
|
1398
959
|
}, isActive && {
|
|
1399
960
|
color: "var(--primaryMain) !important"
|
|
1400
961
|
}],
|
|
1401
|
-
children: isActive ? jsxRuntime.jsx(
|
|
962
|
+
children: isActive ? jsxRuntime.jsx(FilterList2, {}) : jsxRuntime.jsx(ArrowDropDown2, {})
|
|
1402
963
|
})
|
|
1403
964
|
}), jsxRuntime.jsx("div", {
|
|
1404
965
|
onPointerDown: (e) => {
|
|
@@ -1460,10 +1021,10 @@ function ResizeHandle() {
|
|
|
1460
1021
|
onDoubleClick: enabled ? onDoubleClick : void 0
|
|
1461
1022
|
});
|
|
1462
1023
|
}
|
|
1463
|
-
function ResizeHandleView(
|
|
1464
|
-
var
|
|
1024
|
+
function ResizeHandleView(_a) {
|
|
1025
|
+
var _b = _a, {
|
|
1465
1026
|
enabled
|
|
1466
|
-
} =
|
|
1027
|
+
} = _b, props = __objRest(_b, [
|
|
1467
1028
|
"enabled"
|
|
1468
1029
|
]);
|
|
1469
1030
|
return jsxRuntime.jsx("div", __spreadValues({
|
|
@@ -1519,11 +1080,11 @@ function ExpandControl({
|
|
|
1519
1080
|
}) {
|
|
1520
1081
|
const {
|
|
1521
1082
|
components: {
|
|
1522
|
-
IconButton,
|
|
1523
|
-
Spinner
|
|
1083
|
+
IconButton: IconButton2,
|
|
1084
|
+
Spinner: Spinner2
|
|
1524
1085
|
},
|
|
1525
1086
|
icons: {
|
|
1526
|
-
ChevronRight
|
|
1087
|
+
ChevronRight: ChevronRight2
|
|
1527
1088
|
}
|
|
1528
1089
|
} = useTheme();
|
|
1529
1090
|
const table = useTableContext();
|
|
@@ -1562,13 +1123,13 @@ function ExpandControl({
|
|
|
1562
1123
|
}
|
|
1563
1124
|
}
|
|
1564
1125
|
if (isExpanded && hasDeferredChildren && !hasChildren) {
|
|
1565
|
-
return jsxRuntime.jsx(
|
|
1126
|
+
return jsxRuntime.jsx(Spinner2, {
|
|
1566
1127
|
css: {
|
|
1567
1128
|
margin: "0 var(--spacing)"
|
|
1568
1129
|
}
|
|
1569
1130
|
});
|
|
1570
1131
|
}
|
|
1571
|
-
return jsxRuntime.jsx(
|
|
1132
|
+
return jsxRuntime.jsx(IconButton2, {
|
|
1572
1133
|
onClick: toggle2,
|
|
1573
1134
|
children: jsxRuntime.jsx("span", {
|
|
1574
1135
|
css: {
|
|
@@ -1576,7 +1137,7 @@ function ExpandControl({
|
|
|
1576
1137
|
transition: "all 300ms",
|
|
1577
1138
|
transform: isExpanded ? "rotate3d(0, 0, 1, 90deg)" : "rotate3d(0, 0, 1, 0deg)"
|
|
1578
1139
|
},
|
|
1579
|
-
children: jsxRuntime.jsx(
|
|
1140
|
+
children: jsxRuntime.jsx(ChevronRight2, {})
|
|
1580
1141
|
})
|
|
1581
1142
|
});
|
|
1582
1143
|
}
|
|
@@ -1586,7 +1147,7 @@ function SelectComponent({
|
|
|
1586
1147
|
const table = useTableContext();
|
|
1587
1148
|
const {
|
|
1588
1149
|
components: {
|
|
1589
|
-
Checkbox
|
|
1150
|
+
Checkbox: Checkbox2
|
|
1590
1151
|
}
|
|
1591
1152
|
} = useTheme();
|
|
1592
1153
|
const isSelected = table.useState((state) => {
|
|
@@ -1640,7 +1201,7 @@ function SelectComponent({
|
|
|
1640
1201
|
state.lastSelectedId = itemId;
|
|
1641
1202
|
});
|
|
1642
1203
|
}
|
|
1643
|
-
return jsxRuntime.jsx(
|
|
1204
|
+
return jsxRuntime.jsx(Checkbox2, {
|
|
1644
1205
|
css: {
|
|
1645
1206
|
justifySelf: "start",
|
|
1646
1207
|
color: "#c9cfda"
|
|
@@ -1660,7 +1221,7 @@ const Row = react.memo(function Row2({
|
|
|
1660
1221
|
const table = useTableContext();
|
|
1661
1222
|
const divRef = react.useRef(null);
|
|
1662
1223
|
const {
|
|
1663
|
-
className,
|
|
1224
|
+
className: className2,
|
|
1664
1225
|
indent,
|
|
1665
1226
|
hasChildren,
|
|
1666
1227
|
hasDeferredChildren,
|
|
@@ -1698,11 +1259,11 @@ const Row = react.memo(function Row2({
|
|
|
1698
1259
|
(_b = (_a = table.getState().props).debugRender) == null ? void 0 : _b.call(_a, "render row", itemId);
|
|
1699
1260
|
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
1700
1261
|
children: [jsxRuntime.jsx("div", {
|
|
1701
|
-
className,
|
|
1262
|
+
className: className2,
|
|
1702
1263
|
css: [tableTheme.defaultClasses.cellFill],
|
|
1703
1264
|
ref: divRef
|
|
1704
1265
|
}), jsxRuntime.jsxs("div", {
|
|
1705
|
-
className,
|
|
1266
|
+
className: className2,
|
|
1706
1267
|
css: [tableTheme.defaultClasses.cell, tableTheme.defaultClasses.firstCell],
|
|
1707
1268
|
children: [jsxRuntime.jsx("div", {
|
|
1708
1269
|
css: {
|
|
@@ -1721,7 +1282,7 @@ const Row = react.memo(function Row2({
|
|
|
1721
1282
|
rowIndex
|
|
1722
1283
|
})
|
|
1723
1284
|
}, columnId)), jsxRuntime.jsx("div", {
|
|
1724
|
-
className,
|
|
1285
|
+
className: className2,
|
|
1725
1286
|
css: [tableTheme.defaultClasses.cellFill]
|
|
1726
1287
|
})]
|
|
1727
1288
|
});
|
|
@@ -1733,10 +1294,10 @@ function SortComponent({
|
|
|
1733
1294
|
const columnId = useColumnContext();
|
|
1734
1295
|
const {
|
|
1735
1296
|
components: {
|
|
1736
|
-
Badge
|
|
1297
|
+
Badge: Badge2
|
|
1737
1298
|
},
|
|
1738
1299
|
icons: {
|
|
1739
|
-
ArrowUpward
|
|
1300
|
+
ArrowUpward: ArrowUpward2
|
|
1740
1301
|
}
|
|
1741
1302
|
} = useTheme();
|
|
1742
1303
|
const {
|
|
@@ -1790,7 +1351,7 @@ function SortComponent({
|
|
|
1790
1351
|
onContextMenu: (e) => toggle2(e, true),
|
|
1791
1352
|
children: [jsxRuntime.jsx("div", {
|
|
1792
1353
|
children
|
|
1793
|
-
}), jsxRuntime.jsx(
|
|
1354
|
+
}), jsxRuntime.jsx(Badge2, {
|
|
1794
1355
|
badgeContent: index,
|
|
1795
1356
|
children: jsxRuntime.jsx("span", {
|
|
1796
1357
|
css: [{
|
|
@@ -1801,7 +1362,7 @@ function SortComponent({
|
|
|
1801
1362
|
}, direction === "desc" && {
|
|
1802
1363
|
transform: "rotate3d(0, 0, 1, 180deg)"
|
|
1803
1364
|
}],
|
|
1804
|
-
children: jsxRuntime.jsx(
|
|
1365
|
+
children: jsxRuntime.jsx(ArrowUpward2, {})
|
|
1805
1366
|
})
|
|
1806
1367
|
})]
|
|
1807
1368
|
});
|
|
@@ -1850,15 +1411,15 @@ const relativeOffset = (x, y) => {
|
|
|
1850
1411
|
return relativeOffset(x.offsetParent, y) + x.offsetTop;
|
|
1851
1412
|
return 0;
|
|
1852
1413
|
};
|
|
1853
|
-
function Virtualized(
|
|
1854
|
-
var
|
|
1414
|
+
function Virtualized(_c) {
|
|
1415
|
+
var _d = _c, {
|
|
1855
1416
|
header,
|
|
1856
1417
|
children
|
|
1857
|
-
} =
|
|
1418
|
+
} = _d, props = __objRest(_d, [
|
|
1858
1419
|
"header",
|
|
1859
1420
|
"children"
|
|
1860
1421
|
]);
|
|
1861
|
-
var _a, _b,
|
|
1422
|
+
var _a, _b, _c2, _d2;
|
|
1862
1423
|
const table = useTableContext();
|
|
1863
1424
|
const virtual = table.useState("props.virtual");
|
|
1864
1425
|
const probeRef = react.useRef(null);
|
|
@@ -1932,141 +1493,1058 @@ function Virtualized(_e) {
|
|
|
1932
1493
|
window.removeEventListener("resize", incCounter, true);
|
|
1933
1494
|
};
|
|
1934
1495
|
}, [probeRef.current, incCounter]);
|
|
1935
|
-
(
|
|
1496
|
+
(_d2 = (_c2 = table.getState().props).debugRender) == null ? void 0 : _d2.call(_c2, `Virtualalized render ${from} to ${to}`);
|
|
1936
1497
|
return jsxRuntime.jsxs("div", __spreadProps(__spreadValues({}, props), {
|
|
1937
1498
|
children: [header, virtual && jsxRuntime.jsx("div", {
|
|
1938
1499
|
style: {
|
|
1939
1500
|
gridColumn: "1 / -1",
|
|
1940
1501
|
height: before
|
|
1941
1502
|
},
|
|
1942
|
-
ref: probeRef
|
|
1943
|
-
}), children(itemIds, from), virtual && jsxRuntime.jsx("div", {
|
|
1944
|
-
style: {
|
|
1945
|
-
gridColumn: "1 / -1",
|
|
1946
|
-
height: after
|
|
1947
|
-
}
|
|
1503
|
+
ref: probeRef
|
|
1504
|
+
}), children(itemIds, from), virtual && jsxRuntime.jsx("div", {
|
|
1505
|
+
style: {
|
|
1506
|
+
gridColumn: "1 / -1",
|
|
1507
|
+
height: after
|
|
1508
|
+
}
|
|
1509
|
+
})]
|
|
1510
|
+
}));
|
|
1511
|
+
}
|
|
1512
|
+
const TableContext = react.createContext(null);
|
|
1513
|
+
const ColumnContext = react.createContext(null);
|
|
1514
|
+
function useTableContext() {
|
|
1515
|
+
const value = react.useContext(TableContext);
|
|
1516
|
+
if (!value)
|
|
1517
|
+
throw Error("No table context available");
|
|
1518
|
+
return value;
|
|
1519
|
+
}
|
|
1520
|
+
function useColumnContext() {
|
|
1521
|
+
const value = react.useContext(ColumnContext);
|
|
1522
|
+
if (value === null)
|
|
1523
|
+
throw Error("No column context available");
|
|
1524
|
+
return value;
|
|
1525
|
+
}
|
|
1526
|
+
function Table(props) {
|
|
1527
|
+
var _a, _b;
|
|
1528
|
+
const table = useTableState(props);
|
|
1529
|
+
(_b = (_a = table.getState().props).debugRender) == null ? void 0 : _b.call(_a, "render table");
|
|
1530
|
+
return jsxRuntime.jsx(TableContext.Provider, {
|
|
1531
|
+
value: table,
|
|
1532
|
+
children: jsxRuntime.jsx(TableLoadingState, {})
|
|
1533
|
+
});
|
|
1534
|
+
}
|
|
1535
|
+
function TableLoadingState() {
|
|
1536
|
+
const {
|
|
1537
|
+
text
|
|
1538
|
+
} = useTheme();
|
|
1539
|
+
const isHydrated = useTableStateStorage();
|
|
1540
|
+
const [showLoading, setShowLoading] = react.useState(false);
|
|
1541
|
+
react.useEffect(() => {
|
|
1542
|
+
const handle = setTimeout(() => setShowLoading(true), 500);
|
|
1543
|
+
return () => clearTimeout(handle);
|
|
1544
|
+
});
|
|
1545
|
+
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
1546
|
+
children: [!isHydrated && showLoading && jsxRuntime.jsx("div", {
|
|
1547
|
+
children: text.loading
|
|
1548
|
+
}), jsxRuntime.jsx(TableInner, {
|
|
1549
|
+
hidden: !isHydrated
|
|
1550
|
+
})]
|
|
1551
|
+
});
|
|
1552
|
+
}
|
|
1553
|
+
const TableInner = react.memo(function TableInner2({
|
|
1554
|
+
hidden
|
|
1555
|
+
}) {
|
|
1556
|
+
var _a, _b;
|
|
1557
|
+
const table = useTableContext();
|
|
1558
|
+
const fullWidth = table.useState("props.fullWidth");
|
|
1559
|
+
const activeColumns = table.useState((state) => state.activeColumns.map((column) => ({
|
|
1560
|
+
id: column.id,
|
|
1561
|
+
width: column.width,
|
|
1562
|
+
classes: column.classes,
|
|
1563
|
+
header: column.header
|
|
1564
|
+
})));
|
|
1565
|
+
const columnWidths = table.useState("columnWidths", {
|
|
1566
|
+
throttle: 16
|
|
1567
|
+
});
|
|
1568
|
+
const columnStyleOverride = table.useState("columnStyleOverride", {
|
|
1569
|
+
throttle: 16
|
|
1570
|
+
});
|
|
1571
|
+
const defaultWidth = table.useState("props.defaultWidth");
|
|
1572
|
+
const classes = table.useState("props.classes");
|
|
1573
|
+
const stickyHeader = table.useState("props.stickyHeader");
|
|
1574
|
+
const enableSelection = table.useState("props.enableSelection");
|
|
1575
|
+
const enableColumnSelection = table.useState("props.enableColumnSelection");
|
|
1576
|
+
const enableExport = table.useState((state) => !!state.props.enableExport.copy || !!state.props.enableExport.download);
|
|
1577
|
+
const cssVariables = useCssVariables();
|
|
1578
|
+
(_b = (_a = table.getState().props).debugRender) == null ? void 0 : _b.call(_a, "render table inner");
|
|
1579
|
+
return jsxRuntime.jsx(Virtualized, {
|
|
1580
|
+
className: classes == null ? void 0 : classes.table,
|
|
1581
|
+
css: [cssVariables, tableTheme.defaultClasses.table, {
|
|
1582
|
+
gridTemplateColumns: [
|
|
1583
|
+
fullWidth === "right" || fullWidth === true ? "auto" : "0",
|
|
1584
|
+
"max-content",
|
|
1585
|
+
...activeColumns.map((column) => {
|
|
1586
|
+
var _a2, _b2, _c;
|
|
1587
|
+
return (_c = (_b2 = (_a2 = columnWidths.get(column.id)) != null ? _a2 : column.width) != null ? _b2 : defaultWidth) != null ? _c : "max-content";
|
|
1588
|
+
}),
|
|
1589
|
+
fullWidth === "left" || fullWidth === true ? "auto" : "0"
|
|
1590
|
+
].join(" ")
|
|
1591
|
+
}, hidden && {
|
|
1592
|
+
visibility: "hidden"
|
|
1593
|
+
}],
|
|
1594
|
+
header: jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
1595
|
+
children: [jsxRuntime.jsx("div", {
|
|
1596
|
+
className: classes == null ? void 0 : classes.headerCell,
|
|
1597
|
+
css: [tableTheme.defaultClasses.headerFill, stickyHeader && tableTheme.defaultClasses.sticky, stickyHeader instanceof Object && stickyHeader]
|
|
1598
|
+
}), jsxRuntime.jsxs("div", {
|
|
1599
|
+
className: classes == null ? void 0 : classes.headerCell,
|
|
1600
|
+
css: [tableTheme.defaultClasses.headerCell, stickyHeader && tableTheme.defaultClasses.sticky, stickyHeader instanceof Object && stickyHeader],
|
|
1601
|
+
children: [enableSelection && jsxRuntime.jsx(SelectComponent, {}), enableColumnSelection && jsxRuntime.jsx(ColumnSelection, {}), enableExport && jsxRuntime.jsx(Export$1, {}), jsxRuntime.jsx(ResizeHandleView, {})]
|
|
1602
|
+
}), jsxRuntime.jsx(ColumnHeaderContext.Provider, {
|
|
1603
|
+
children: activeColumns.map((column) => {
|
|
1604
|
+
var _a2;
|
|
1605
|
+
return jsxRuntime.jsx(ColumnContext.Provider, {
|
|
1606
|
+
value: column.id,
|
|
1607
|
+
children: jsxRuntime.jsxs(ColumnHeader, {
|
|
1608
|
+
className: cx(classes == null ? void 0 : classes.headerCell, (_a2 = column.classes) == null ? void 0 : _a2.headerCell),
|
|
1609
|
+
css: [tableTheme.defaultClasses.headerCell, columnStyleOverride.get(column.id), stickyHeader && tableTheme.defaultClasses.sticky, stickyHeader instanceof Object && stickyHeader],
|
|
1610
|
+
children: [jsxRuntime.jsx(SortComponent, {
|
|
1611
|
+
children: column.header
|
|
1612
|
+
}), jsxRuntime.jsx("div", {
|
|
1613
|
+
css: {
|
|
1614
|
+
flex: 1
|
|
1615
|
+
}
|
|
1616
|
+
}), jsxRuntime.jsx(FilterControl, {}), jsxRuntime.jsx(ResizeHandle, {})]
|
|
1617
|
+
}, column.id)
|
|
1618
|
+
}, column.id);
|
|
1619
|
+
})
|
|
1620
|
+
}), jsxRuntime.jsx("div", {
|
|
1621
|
+
className: classes == null ? void 0 : classes.headerCell,
|
|
1622
|
+
css: [tableTheme.defaultClasses.headerFill, stickyHeader && tableTheme.defaultClasses.sticky, stickyHeader instanceof Object && stickyHeader]
|
|
1623
|
+
})]
|
|
1624
|
+
}),
|
|
1625
|
+
children: (itemIds, startIndex) => itemIds.map((itemId, index) => jsxRuntime.jsx(Row, {
|
|
1626
|
+
itemId,
|
|
1627
|
+
rowIndex: startIndex + index
|
|
1628
|
+
}, itemId))
|
|
1629
|
+
});
|
|
1630
|
+
});
|
|
1631
|
+
const defaultColors = {
|
|
1632
|
+
primary: { main: "#1976d2", light: "#42a5f5", contrastText: "#fff" },
|
|
1633
|
+
secondary: { main: "#9c27b0", light: "#ba68c8", contrastText: "#fff" }
|
|
1634
|
+
};
|
|
1635
|
+
function Spinner({
|
|
1636
|
+
className: className2
|
|
1637
|
+
}) {
|
|
1638
|
+
return jsxRuntime.jsxs("div", {
|
|
1639
|
+
className: className2,
|
|
1640
|
+
css: react$2.css`
|
|
1641
|
+
display: inline-block;
|
|
1642
|
+
position: relative;
|
|
1643
|
+
width: 1em;
|
|
1644
|
+
height: 1em;
|
|
1645
|
+
|
|
1646
|
+
div {
|
|
1647
|
+
box-sizing: border-box;
|
|
1648
|
+
display: block;
|
|
1649
|
+
position: absolute;
|
|
1650
|
+
width: 0.8em;
|
|
1651
|
+
height: 0.8em;
|
|
1652
|
+
margin: 0.1em;
|
|
1653
|
+
border: 0.1em solid #fff;
|
|
1654
|
+
border-radius: 50%;
|
|
1655
|
+
animation: lds-ring 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite;
|
|
1656
|
+
border-color: currentColor transparent transparent transparent;
|
|
1657
|
+
}
|
|
1658
|
+
div:nth-of-type(1) {
|
|
1659
|
+
animation-delay: -0.45s;
|
|
1660
|
+
}
|
|
1661
|
+
div:nth-of-type(2) {
|
|
1662
|
+
animation-delay: -0.3s;
|
|
1663
|
+
}
|
|
1664
|
+
div:nth-of-type(3) {
|
|
1665
|
+
animation-delay: -0.15s;
|
|
1666
|
+
}
|
|
1667
|
+
@keyframes lds-ring {
|
|
1668
|
+
0% {
|
|
1669
|
+
transform: rotate(0deg);
|
|
1670
|
+
}
|
|
1671
|
+
100% {
|
|
1672
|
+
transform: rotate(360deg);
|
|
1673
|
+
}
|
|
1674
|
+
}
|
|
1675
|
+
`,
|
|
1676
|
+
children: [jsxRuntime.jsx("div", {}), jsxRuntime.jsx("div", {}), jsxRuntime.jsx("div", {})]
|
|
1677
|
+
});
|
|
1678
|
+
}
|
|
1679
|
+
const Badge = ({
|
|
1680
|
+
badgeContent,
|
|
1681
|
+
children
|
|
1682
|
+
}) => {
|
|
1683
|
+
if (!open)
|
|
1684
|
+
return null;
|
|
1685
|
+
return jsxRuntime.jsxs("span", {
|
|
1686
|
+
css: {
|
|
1687
|
+
display: "inline-flex",
|
|
1688
|
+
position: "relative",
|
|
1689
|
+
flexShrink: 0,
|
|
1690
|
+
verticalAlign: "middle"
|
|
1691
|
+
},
|
|
1692
|
+
children: [children, jsxRuntime.jsx("span", {
|
|
1693
|
+
css: [{
|
|
1694
|
+
top: 0,
|
|
1695
|
+
right: 0,
|
|
1696
|
+
transform: "scale(1) translate(50%, -50%)",
|
|
1697
|
+
transformOrigin: "100% 0%",
|
|
1698
|
+
height: 20,
|
|
1699
|
+
display: "flex",
|
|
1700
|
+
padding: "0 6px",
|
|
1701
|
+
zIndex: 1,
|
|
1702
|
+
position: "absolute",
|
|
1703
|
+
flexWrap: "wrap",
|
|
1704
|
+
minWidth: 20,
|
|
1705
|
+
transition: "transform 225ms cubic-bezier(0.4, 0, 0.2, 1) 0ms",
|
|
1706
|
+
alignItems: "center",
|
|
1707
|
+
lineHeight: 1,
|
|
1708
|
+
alignContent: "center",
|
|
1709
|
+
borderRadius: 10,
|
|
1710
|
+
justifyContent: "center",
|
|
1711
|
+
fontSize: "0.8em"
|
|
1712
|
+
}, !badgeContent && {
|
|
1713
|
+
transform: "scale(0) translate(50%, -50%)",
|
|
1714
|
+
transition: "transform 195ms cubic-bezier(0.4, 0, 0.2, 1) 0ms"
|
|
1715
|
+
}],
|
|
1716
|
+
children: badgeContent
|
|
1717
|
+
})]
|
|
1718
|
+
});
|
|
1719
|
+
};
|
|
1720
|
+
const Button = (_e) => {
|
|
1721
|
+
var _f = _e, {
|
|
1722
|
+
startIcon,
|
|
1723
|
+
children,
|
|
1724
|
+
variant = "text"
|
|
1725
|
+
} = _f, props = __objRest(_f, [
|
|
1726
|
+
"startIcon",
|
|
1727
|
+
"children",
|
|
1728
|
+
"variant"
|
|
1729
|
+
]);
|
|
1730
|
+
return jsxRuntime.jsxs("button", __spreadProps(__spreadValues({
|
|
1731
|
+
css: [{
|
|
1732
|
+
padding: `var(--spacing) calc(var(--spacing) * 2)`,
|
|
1733
|
+
display: "inline-flex",
|
|
1734
|
+
alignItems: "center",
|
|
1735
|
+
transition: "background-color 150ms",
|
|
1736
|
+
border: "none",
|
|
1737
|
+
cursor: "pointer",
|
|
1738
|
+
background: "transparent",
|
|
1739
|
+
borderRadius: 4,
|
|
1740
|
+
"&:active:not(:disabled)": {
|
|
1741
|
+
transform: "scale3d(0.95, 0.95, 1)"
|
|
1742
|
+
}
|
|
1743
|
+
}, variant === "text" && {
|
|
1744
|
+
"&:hover": {
|
|
1745
|
+
background: "rgba(0, 0, 0, 0.1)"
|
|
1746
|
+
}
|
|
1747
|
+
}, variant === "outlined" && {
|
|
1748
|
+
border: `1px solid ${tableTheme.darkGray}`,
|
|
1749
|
+
"&:disabled": {
|
|
1750
|
+
borderColor: tableTheme.lightGray
|
|
1751
|
+
}
|
|
1752
|
+
}, variant === "contained" && {
|
|
1753
|
+
color: "var(--primaryContrastText)",
|
|
1754
|
+
backgroundColor: "var(--primaryMain)",
|
|
1755
|
+
boxShadow: "0px 3px 1px -2px rgb(0 0 0 / 20%), 0px 2px 2px 0px rgb(0 0 0 / 14%), 0px 1px 5px 0px rgb(0 0 0 / 12%)",
|
|
1756
|
+
"&:hover": {
|
|
1757
|
+
filter: "brightness(0.9)"
|
|
1758
|
+
},
|
|
1759
|
+
"&:disabled": {
|
|
1760
|
+
filter: "grayscale()",
|
|
1761
|
+
opacity: 0.5
|
|
1762
|
+
}
|
|
1763
|
+
}]
|
|
1764
|
+
}, props), {
|
|
1765
|
+
children: [startIcon && jsxRuntime.jsx("span", {
|
|
1766
|
+
css: {
|
|
1767
|
+
marginRight: `calc(var(--spacing) * 2)`
|
|
1768
|
+
},
|
|
1769
|
+
children: startIcon
|
|
1770
|
+
}), jsxRuntime.jsx("span", {
|
|
1771
|
+
children
|
|
1772
|
+
})]
|
|
1773
|
+
}));
|
|
1774
|
+
};
|
|
1775
|
+
const Checkbox = (_g) => {
|
|
1776
|
+
var _h = _g, {
|
|
1777
|
+
className: className2
|
|
1778
|
+
} = _h, props = __objRest(_h, [
|
|
1779
|
+
"className"
|
|
1780
|
+
]);
|
|
1781
|
+
return jsxRuntime.jsxs("label", {
|
|
1782
|
+
css: [{
|
|
1783
|
+
padding: "calc(var(--spacing) * 1.8)",
|
|
1784
|
+
display: "flex",
|
|
1785
|
+
color: "currentcolor",
|
|
1786
|
+
userSelect: "none",
|
|
1787
|
+
"& input": {
|
|
1788
|
+
appearance: "none",
|
|
1789
|
+
margin: 0
|
|
1790
|
+
}
|
|
1791
|
+
}, props.disabled && {
|
|
1792
|
+
color: "rgba(0, 0, 0, 0.26)"
|
|
1793
|
+
}],
|
|
1794
|
+
className: className2,
|
|
1795
|
+
children: [jsxRuntime.jsx("input", __spreadValues({
|
|
1796
|
+
type: "checkbox"
|
|
1797
|
+
}, props)), props.checked ? jsxRuntime.jsx("svg", {
|
|
1798
|
+
css: {
|
|
1799
|
+
fontSize: "1.25rem",
|
|
1800
|
+
width: "1em",
|
|
1801
|
+
height: "1em",
|
|
1802
|
+
fill: "var(--primaryMain)"
|
|
1803
|
+
},
|
|
1804
|
+
focusable: "false",
|
|
1805
|
+
viewBox: "0 0 24 24",
|
|
1806
|
+
"aria-hidden": "true",
|
|
1807
|
+
children: jsxRuntime.jsx("path", {
|
|
1808
|
+
d: "M19 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.11 0 2-.9 2-2V5c0-1.1-.89-2-2-2zm-9 14l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z"
|
|
1809
|
+
})
|
|
1810
|
+
}) : jsxRuntime.jsx("svg", {
|
|
1811
|
+
css: {
|
|
1812
|
+
fontSize: "1.25rem",
|
|
1813
|
+
width: "1em",
|
|
1814
|
+
height: "1em",
|
|
1815
|
+
fill: "currentColor"
|
|
1816
|
+
},
|
|
1817
|
+
focusable: "false",
|
|
1818
|
+
viewBox: "0 0 24 24",
|
|
1819
|
+
"aria-hidden": "true",
|
|
1820
|
+
children: jsxRuntime.jsx("path", {
|
|
1821
|
+
d: "M19 5v14H5V5h14m0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2z"
|
|
1822
|
+
})
|
|
1823
|
+
})]
|
|
1824
|
+
});
|
|
1825
|
+
};
|
|
1826
|
+
const IconButton = (props) => {
|
|
1827
|
+
return jsxRuntime.jsx("button", __spreadValues({
|
|
1828
|
+
css: {
|
|
1829
|
+
padding: "var(--spacing)",
|
|
1830
|
+
borderRadius: "50%",
|
|
1831
|
+
display: "inline-flex",
|
|
1832
|
+
justifyContent: "center",
|
|
1833
|
+
alignItems: "center",
|
|
1834
|
+
transition: "background-color 150ms",
|
|
1835
|
+
border: "none",
|
|
1836
|
+
cursor: "pointer",
|
|
1837
|
+
color: "inherit",
|
|
1838
|
+
background: "transparent",
|
|
1839
|
+
"&:hover": {
|
|
1840
|
+
backgroundColor: "rgba(0, 0, 0, 0.04)"
|
|
1841
|
+
},
|
|
1842
|
+
"&:active": {
|
|
1843
|
+
transformColor: "scale3d(0.95, 0.95, 1)"
|
|
1844
|
+
}
|
|
1845
|
+
}
|
|
1846
|
+
}, props));
|
|
1847
|
+
};
|
|
1848
|
+
const TextField = (_i) => {
|
|
1849
|
+
var _j = _i, {
|
|
1850
|
+
endIcon,
|
|
1851
|
+
className: className2,
|
|
1852
|
+
inputRef
|
|
1853
|
+
} = _j, props = __objRest(_j, [
|
|
1854
|
+
"endIcon",
|
|
1855
|
+
"className",
|
|
1856
|
+
"inputRef"
|
|
1857
|
+
]);
|
|
1858
|
+
var _a;
|
|
1859
|
+
const [focus, setFocus] = react.useState(false);
|
|
1860
|
+
return jsxRuntime.jsx("div", {
|
|
1861
|
+
className: className2,
|
|
1862
|
+
css: {
|
|
1863
|
+
display: "flex"
|
|
1864
|
+
},
|
|
1865
|
+
children: jsxRuntime.jsxs("span", {
|
|
1866
|
+
css: [{
|
|
1867
|
+
flex: 1,
|
|
1868
|
+
display: "flex",
|
|
1869
|
+
alignItems: "center",
|
|
1870
|
+
border: `1px solid ${tableTheme.darkGray}`,
|
|
1871
|
+
borderRadius: 4
|
|
1872
|
+
}, focus && {
|
|
1873
|
+
border: "2px solid var(--primaryMain)",
|
|
1874
|
+
margin: -1
|
|
1875
|
+
}],
|
|
1876
|
+
children: [jsxRuntime.jsx("input", __spreadProps(__spreadValues({
|
|
1877
|
+
ref: inputRef
|
|
1878
|
+
}, props), {
|
|
1879
|
+
value: (_a = props.value) != null ? _a : "",
|
|
1880
|
+
onFocus: () => setFocus(true),
|
|
1881
|
+
onBlur: () => setFocus(false),
|
|
1882
|
+
css: {
|
|
1883
|
+
flex: 1,
|
|
1884
|
+
border: "none",
|
|
1885
|
+
outline: "none",
|
|
1886
|
+
borderRadius: 4,
|
|
1887
|
+
padding: "calc(var(--spacing) * 2)",
|
|
1888
|
+
paddingRight: 0,
|
|
1889
|
+
transition: "outline 500ms"
|
|
1890
|
+
}
|
|
1891
|
+
})), endIcon]
|
|
1892
|
+
})
|
|
1893
|
+
});
|
|
1894
|
+
};
|
|
1895
|
+
const defaultComponents = {
|
|
1896
|
+
IconButton,
|
|
1897
|
+
Checkbox,
|
|
1898
|
+
Popover: tableTheme.Popover,
|
|
1899
|
+
Button,
|
|
1900
|
+
Badge,
|
|
1901
|
+
TextField,
|
|
1902
|
+
Spinner
|
|
1903
|
+
};
|
|
1904
|
+
const IconDefaultStyle = react$2.css({
|
|
1905
|
+
width: "1.5em",
|
|
1906
|
+
height: "1.5em",
|
|
1907
|
+
color: "inherit"
|
|
1908
|
+
});
|
|
1909
|
+
function Icon(svg) {
|
|
1910
|
+
return (props) => jsxRuntime.jsx(react$2.ClassNames, {
|
|
1911
|
+
children: ({
|
|
1912
|
+
css: css2
|
|
1913
|
+
}) => react.cloneElement(svg, __spreadProps(__spreadValues({}, props), {
|
|
1914
|
+
className: css2(IconDefaultStyle, props.className)
|
|
1915
|
+
}))
|
|
1916
|
+
});
|
|
1917
|
+
}
|
|
1918
|
+
const Settings = Icon(jsxRuntime.jsxs("svg", {
|
|
1919
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1920
|
+
height: "24px",
|
|
1921
|
+
viewBox: "0 0 24 24",
|
|
1922
|
+
width: "24px",
|
|
1923
|
+
fill: "currentColor",
|
|
1924
|
+
children: [jsxRuntime.jsx("path", {
|
|
1925
|
+
d: "M0 0h24v24H0V0z",
|
|
1926
|
+
fill: "none"
|
|
1927
|
+
}), jsxRuntime.jsx("path", {
|
|
1928
|
+
d: "M3 17v2h6v-2H3zM3 5v2h10V5H3zm10 16v-2h8v-2h-8v-2h-2v6h2zM7 9v2H3v2h4v2h2V9H7zm14 4v-2H11v2h10zm-6-4h2V7h4V5h-4V3h-2v6z"
|
|
1929
|
+
})]
|
|
1930
|
+
}));
|
|
1931
|
+
const Export = Icon(jsxRuntime.jsxs("svg", {
|
|
1932
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1933
|
+
enableBackground: "new 0 0 24 24",
|
|
1934
|
+
height: "24px",
|
|
1935
|
+
viewBox: "0 0 24 24",
|
|
1936
|
+
width: "24px",
|
|
1937
|
+
fill: "currentColor",
|
|
1938
|
+
children: [jsxRuntime.jsx("g", {
|
|
1939
|
+
children: jsxRuntime.jsx("rect", {
|
|
1940
|
+
fill: "none",
|
|
1941
|
+
height: "24",
|
|
1942
|
+
width: "24"
|
|
1943
|
+
})
|
|
1944
|
+
}), jsxRuntime.jsx("g", {
|
|
1945
|
+
children: jsxRuntime.jsx("path", {
|
|
1946
|
+
d: "M18,15v3H6v-3H4v3c0,1.1,0.9,2,2,2h12c1.1,0,2-0.9,2-2v-3H18z M17,11l-1.41-1.41L13,12.17V4h-2v8.17L8.41,9.59L7,11l5,5 L17,11z"
|
|
1947
|
+
})
|
|
1948
|
+
})]
|
|
1949
|
+
}));
|
|
1950
|
+
const Clipboard = Icon(jsxRuntime.jsxs("svg", {
|
|
1951
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1952
|
+
height: "24px",
|
|
1953
|
+
viewBox: "0 0 24 24",
|
|
1954
|
+
width: "24px",
|
|
1955
|
+
fill: "currentColor",
|
|
1956
|
+
children: [jsxRuntime.jsx("path", {
|
|
1957
|
+
d: "M0 0h24v24H0V0z",
|
|
1958
|
+
fill: "none"
|
|
1959
|
+
}), jsxRuntime.jsx("path", {
|
|
1960
|
+
d: "M19 2h-4.18C14.4.84 13.3 0 12 0S9.6.84 9.18 2H5c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm-7 0c.55 0 1 .45 1 1s-.45 1-1 1-1-.45-1-1 .45-1 1-1zm7 18H5V4h2v3h10V4h2v16z"
|
|
1961
|
+
})]
|
|
1962
|
+
}));
|
|
1963
|
+
const ChevronRight = Icon(jsxRuntime.jsxs("svg", {
|
|
1964
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1965
|
+
height: "24px",
|
|
1966
|
+
viewBox: "0 0 24 24",
|
|
1967
|
+
width: "24px",
|
|
1968
|
+
fill: "currentColor",
|
|
1969
|
+
children: [jsxRuntime.jsx("path", {
|
|
1970
|
+
d: "M0 0h24v24H0V0z",
|
|
1971
|
+
fill: "none"
|
|
1972
|
+
}), jsxRuntime.jsx("path", {
|
|
1973
|
+
d: "M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6-6-6z"
|
|
1974
|
+
})]
|
|
1975
|
+
}));
|
|
1976
|
+
const Search = Icon(jsxRuntime.jsxs("svg", {
|
|
1977
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1978
|
+
height: "24px",
|
|
1979
|
+
viewBox: "0 0 24 24",
|
|
1980
|
+
width: "24px",
|
|
1981
|
+
fill: "currentColor",
|
|
1982
|
+
children: [jsxRuntime.jsx("path", {
|
|
1983
|
+
d: "M0 0h24v24H0V0z",
|
|
1984
|
+
fill: "none"
|
|
1985
|
+
}), jsxRuntime.jsx("path", {
|
|
1986
|
+
d: "M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"
|
|
1987
|
+
})]
|
|
1988
|
+
}));
|
|
1989
|
+
const Clear = Icon(jsxRuntime.jsxs("svg", {
|
|
1990
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1991
|
+
height: "24px",
|
|
1992
|
+
viewBox: "0 0 24 24",
|
|
1993
|
+
width: "24px",
|
|
1994
|
+
fill: "currentColor",
|
|
1995
|
+
children: [jsxRuntime.jsx("path", {
|
|
1996
|
+
d: "M0 0h24v24H0V0z",
|
|
1997
|
+
fill: "none"
|
|
1998
|
+
}), jsxRuntime.jsx("path", {
|
|
1999
|
+
d: "M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"
|
|
2000
|
+
})]
|
|
2001
|
+
}));
|
|
2002
|
+
const ArrowDropDown = Icon(jsxRuntime.jsxs("svg", {
|
|
2003
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2004
|
+
height: "24px",
|
|
2005
|
+
viewBox: "0 0 24 24",
|
|
2006
|
+
width: "24px",
|
|
2007
|
+
fill: "currentColor",
|
|
2008
|
+
children: [jsxRuntime.jsx("path", {
|
|
2009
|
+
d: "M0 0h24v24H0V0z",
|
|
2010
|
+
fill: "none"
|
|
2011
|
+
}), jsxRuntime.jsx("path", {
|
|
2012
|
+
d: "M7 10l5 5 5-5H7z"
|
|
2013
|
+
})]
|
|
2014
|
+
}));
|
|
2015
|
+
const FilterList = Icon(jsxRuntime.jsx("svg", {
|
|
2016
|
+
viewBox: "0 0 24 24",
|
|
2017
|
+
children: jsxRuntime.jsx("path", {
|
|
2018
|
+
fill: "currentColor",
|
|
2019
|
+
d: "M14,12V19.88C14.04,20.18 13.94,20.5 13.71,20.71C13.32,21.1 12.69,21.1 12.3,20.71L10.29,18.7C10.06,18.47 9.96,18.16 10,17.87V12H9.97L4.21,4.62C3.87,4.19 3.95,3.56 4.38,3.22C4.57,3.08 4.78,3 5,3V3H19V3C19.22,3 19.43,3.08 19.62,3.22C20.05,3.56 20.13,4.19 19.79,4.62L14.03,12H14Z"
|
|
2020
|
+
})
|
|
2021
|
+
}));
|
|
2022
|
+
const ArrowUpward = Icon(jsxRuntime.jsxs("svg", {
|
|
2023
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2024
|
+
height: "24px",
|
|
2025
|
+
viewBox: "0 0 24 24",
|
|
2026
|
+
width: "24px",
|
|
2027
|
+
fill: "currentColor",
|
|
2028
|
+
children: [jsxRuntime.jsx("path", {
|
|
2029
|
+
d: "M0 0h24v24H0V0z",
|
|
2030
|
+
fill: "none"
|
|
2031
|
+
}), jsxRuntime.jsx("path", {
|
|
2032
|
+
d: "M4 12l1.41 1.41L11 7.83V20h2V7.83l5.58 5.59L20 12l-8-8-8 8z"
|
|
2033
|
+
})]
|
|
2034
|
+
}));
|
|
2035
|
+
const defaultIcons = {
|
|
2036
|
+
Settings,
|
|
2037
|
+
Export,
|
|
2038
|
+
Clipboard,
|
|
2039
|
+
ChevronRight,
|
|
2040
|
+
Search,
|
|
2041
|
+
Clear,
|
|
2042
|
+
ArrowDropDown,
|
|
2043
|
+
FilterList,
|
|
2044
|
+
ArrowUpward
|
|
2045
|
+
};
|
|
2046
|
+
const defaultTexts = {
|
|
2047
|
+
selectColumns: "Select visible columns",
|
|
2048
|
+
noResults: "No results",
|
|
2049
|
+
exportTitle: "Export",
|
|
2050
|
+
exportCopy: "To clipboard",
|
|
2051
|
+
exportDownload: "Download",
|
|
2052
|
+
today: "Today",
|
|
2053
|
+
thisWeek: "This week",
|
|
2054
|
+
reset: "Reset",
|
|
2055
|
+
loading: "Loading",
|
|
2056
|
+
selected: (count) => `${count} selected`
|
|
2057
|
+
};
|
|
2058
|
+
const defaultTableTheme = {
|
|
2059
|
+
text: defaultTexts,
|
|
2060
|
+
components: defaultComponents,
|
|
2061
|
+
icons: defaultIcons,
|
|
2062
|
+
colors: defaultColors,
|
|
2063
|
+
spacing: "5px"
|
|
2064
|
+
};
|
|
2065
|
+
const emptyStore = new react$1.Store(void 0);
|
|
2066
|
+
function useTheme() {
|
|
2067
|
+
var _a, _b;
|
|
2068
|
+
const table = react.useContext(TableContext);
|
|
2069
|
+
const localTheme = (_b = (_a = table == null ? void 0 : table.useState((state) => ({
|
|
2070
|
+
text: state.props.text,
|
|
2071
|
+
classes: state.props.classes,
|
|
2072
|
+
components: state.props.components,
|
|
2073
|
+
icons: state.props.icons,
|
|
2074
|
+
colors: state.props.colors,
|
|
2075
|
+
spacing: state.props.spacing
|
|
2076
|
+
}))) != null ? _a : emptyStore.useState()) != null ? _b : {};
|
|
2077
|
+
const contextTableTheme = react.useContext(tableTheme.TableThemeContext);
|
|
2078
|
+
return tableTheme.mergeThemes(defaultTableTheme, tableTheme.globalTableTheme, contextTableTheme, localTheme);
|
|
2079
|
+
}
|
|
2080
|
+
function AutoFocusTextField(props) {
|
|
2081
|
+
const {
|
|
2082
|
+
components: {
|
|
2083
|
+
TextField: TextField2
|
|
2084
|
+
}
|
|
2085
|
+
} = useTheme();
|
|
2086
|
+
const ref = react.useRef(null);
|
|
2087
|
+
const {
|
|
2088
|
+
visible
|
|
2089
|
+
} = react.useContext(tableTheme.PopoverContext);
|
|
2090
|
+
react.useLayoutEffect(() => {
|
|
2091
|
+
if (visible && ref.current) {
|
|
2092
|
+
ref.current.focus();
|
|
2093
|
+
}
|
|
2094
|
+
}, [visible]);
|
|
2095
|
+
return jsxRuntime.jsx(TextField2, __spreadProps(__spreadValues({}, props), {
|
|
2096
|
+
inputRef: ref
|
|
2097
|
+
}));
|
|
2098
|
+
}
|
|
2099
|
+
const className = "schummar-table-date-input";
|
|
2100
|
+
const defaultDate = new Date(1970, 0, 1);
|
|
2101
|
+
const isIncludedType = (type) => type === "day" || type === "month" || type === "year";
|
|
2102
|
+
const defaultLengths = {
|
|
2103
|
+
day: 2,
|
|
2104
|
+
month: 2,
|
|
2105
|
+
year: 4
|
|
2106
|
+
};
|
|
2107
|
+
const maxLengths = {
|
|
2108
|
+
day: 2,
|
|
2109
|
+
month: 2,
|
|
2110
|
+
year: Infinity
|
|
2111
|
+
};
|
|
2112
|
+
const length = (type, value) => Math.max(value.length, defaultLengths[type]);
|
|
2113
|
+
const tabNext = (e) => {
|
|
2114
|
+
const all = Array.from(document.querySelectorAll(`.${className}`));
|
|
2115
|
+
const index = all.indexOf(e);
|
|
2116
|
+
const next = all[(index + 1) % all.length];
|
|
2117
|
+
if (next instanceof HTMLElement) {
|
|
2118
|
+
next.focus();
|
|
2119
|
+
}
|
|
2120
|
+
};
|
|
2121
|
+
function DateInput({
|
|
2122
|
+
value,
|
|
2123
|
+
onChange,
|
|
2124
|
+
locale
|
|
2125
|
+
}) {
|
|
2126
|
+
const [override, setOverride] = react.useState();
|
|
2127
|
+
const commit = () => {
|
|
2128
|
+
if (!override) {
|
|
2129
|
+
return;
|
|
2130
|
+
}
|
|
2131
|
+
setOverride(void 0);
|
|
2132
|
+
if (!override.value) {
|
|
2133
|
+
onChange(null);
|
|
2134
|
+
return;
|
|
2135
|
+
}
|
|
2136
|
+
const newValue = value ? new Date(value) : new Date();
|
|
2137
|
+
if (override.type === "day") {
|
|
2138
|
+
newValue.setDate(Number(override.value));
|
|
2139
|
+
} else if (override.type === "month") {
|
|
2140
|
+
newValue.setMonth(Number(override.value) - 1);
|
|
2141
|
+
} else if (override.type === "year") {
|
|
2142
|
+
newValue.setFullYear(Number(override.value));
|
|
2143
|
+
}
|
|
2144
|
+
onChange(newValue);
|
|
2145
|
+
};
|
|
2146
|
+
const format = react.useMemo(() => new Intl.DateTimeFormat(locale, {
|
|
2147
|
+
day: "2-digit",
|
|
2148
|
+
month: "2-digit",
|
|
2149
|
+
year: "numeric"
|
|
2150
|
+
}), [locale]);
|
|
2151
|
+
const parts = format.formatToParts(value != null ? value : defaultDate);
|
|
2152
|
+
const isEmpty = !value;
|
|
2153
|
+
return jsxRuntime.jsx("div", {
|
|
2154
|
+
css: {
|
|
2155
|
+
display: "flex",
|
|
2156
|
+
alignItems: "baseline"
|
|
2157
|
+
},
|
|
2158
|
+
children: parts.map(({
|
|
2159
|
+
type,
|
|
2160
|
+
value: value2
|
|
2161
|
+
}, index) => jsxRuntime.jsx(react.Fragment, {
|
|
2162
|
+
children: isIncludedType(type) ? jsxRuntime.jsx("input", {
|
|
2163
|
+
className,
|
|
2164
|
+
css: {
|
|
2165
|
+
width: `${length(type, value2)}ch`,
|
|
2166
|
+
boxSizing: "content-box",
|
|
2167
|
+
overflow: "visible",
|
|
2168
|
+
border: "none",
|
|
2169
|
+
borderBottom: "2px solid transparent",
|
|
2170
|
+
outline: "none",
|
|
2171
|
+
fontSize: "inherit",
|
|
2172
|
+
"&:focus": {
|
|
2173
|
+
borderBottom: "2px solid var(--primaryMain)"
|
|
2174
|
+
}
|
|
2175
|
+
},
|
|
2176
|
+
placeholder: "".padEnd(length(type, value2), "0"),
|
|
2177
|
+
value: (override == null ? void 0 : override.type) === type ? override.value : !isEmpty ? value2 : "",
|
|
2178
|
+
onChange: (e) => {
|
|
2179
|
+
setOverride({
|
|
2180
|
+
type,
|
|
2181
|
+
value: e.target.value
|
|
2182
|
+
});
|
|
2183
|
+
if (e.target.value.length >= maxLengths[type]) {
|
|
2184
|
+
setTimeout(() => tabNext(e.target));
|
|
2185
|
+
}
|
|
2186
|
+
},
|
|
2187
|
+
onFocus: (e) => e.target.select(),
|
|
2188
|
+
onBlur: commit
|
|
2189
|
+
}) : type === "literal" ? jsxRuntime.jsx("span", {
|
|
2190
|
+
children: value2
|
|
2191
|
+
}) : null
|
|
2192
|
+
}, index))
|
|
2193
|
+
});
|
|
2194
|
+
}
|
|
2195
|
+
const weekDays = [0, 1, 2, 3, 4, 5, 6];
|
|
2196
|
+
const startOfDay = (d) => new Date(d.getFullYear(), d.getMonth(), d.getDate());
|
|
2197
|
+
const endOfDay = (d) => new Date(d.getFullYear(), d.getMonth(), d.getDate() + 1, 0, 0, 0, -1);
|
|
2198
|
+
const today = () => {
|
|
2199
|
+
const today2 = startOfDay(new Date());
|
|
2200
|
+
return {
|
|
2201
|
+
min: today2,
|
|
2202
|
+
max: today2
|
|
2203
|
+
};
|
|
2204
|
+
};
|
|
2205
|
+
const thisWeek = (firstDayOfWeek = 0) => {
|
|
2206
|
+
const now = new Date();
|
|
2207
|
+
const min = new Date(now);
|
|
2208
|
+
let diff = min.getDay() - firstDayOfWeek;
|
|
2209
|
+
if (diff < 0) {
|
|
2210
|
+
diff += 7;
|
|
2211
|
+
}
|
|
2212
|
+
min.setDate(min.getDate() - diff);
|
|
2213
|
+
const max = new Date(min);
|
|
2214
|
+
max.setDate(max.getDate() + 6);
|
|
2215
|
+
return {
|
|
2216
|
+
min: startOfDay(min),
|
|
2217
|
+
max: endOfDay(max)
|
|
2218
|
+
};
|
|
2219
|
+
};
|
|
2220
|
+
function dateIntersect(a, b) {
|
|
2221
|
+
if (a instanceof Date) {
|
|
2222
|
+
a = {
|
|
2223
|
+
min: a,
|
|
2224
|
+
max: a
|
|
2225
|
+
};
|
|
2226
|
+
}
|
|
2227
|
+
if (b instanceof Date) {
|
|
2228
|
+
b = {
|
|
2229
|
+
min: b,
|
|
2230
|
+
max: b
|
|
2231
|
+
};
|
|
2232
|
+
}
|
|
2233
|
+
if (!(a == null ? void 0 : a.min) || !a.max || !(b == null ? void 0 : b.min) || !b.max) {
|
|
2234
|
+
return false;
|
|
2235
|
+
}
|
|
2236
|
+
return !(endOfDay(a.max) < startOfDay(b.min) || startOfDay(a.min) > endOfDay(b.max));
|
|
2237
|
+
}
|
|
2238
|
+
function DatePicker({
|
|
2239
|
+
value,
|
|
2240
|
+
onChange,
|
|
2241
|
+
rangeSelect,
|
|
2242
|
+
locale,
|
|
2243
|
+
firstDayOfWeek = 0
|
|
2244
|
+
}) {
|
|
2245
|
+
const {
|
|
2246
|
+
components: {
|
|
2247
|
+
Button: Button2,
|
|
2248
|
+
IconButton: IconButton2
|
|
2249
|
+
},
|
|
2250
|
+
icons: {
|
|
2251
|
+
ChevronRight: ChevronRight2
|
|
2252
|
+
},
|
|
2253
|
+
text
|
|
2254
|
+
} = useTheme();
|
|
2255
|
+
const [baseDate] = react.useState(new Date());
|
|
2256
|
+
const [dateInView, setDateInView] = react.useState(baseDate);
|
|
2257
|
+
const [dirty, setDirty] = react.useState();
|
|
2258
|
+
const [hovered, setHovered] = react.useState();
|
|
2259
|
+
const min = dirty ? dirty.min : value instanceof Date ? value : value == null ? void 0 : value.min;
|
|
2260
|
+
const max = dirty ? dirty.max : value instanceof Date ? value : value == null ? void 0 : value.max;
|
|
2261
|
+
const {
|
|
2262
|
+
calendars,
|
|
2263
|
+
getBackProps,
|
|
2264
|
+
getForwardProps,
|
|
2265
|
+
getDateProps
|
|
2266
|
+
} = dayzed.useDayzed({
|
|
2267
|
+
onDateSelected: () => void 0,
|
|
2268
|
+
firstDayOfWeek,
|
|
2269
|
+
showOutsideDays: true,
|
|
2270
|
+
date: dateInView,
|
|
2271
|
+
onOffsetChanged: (offset) => setDateInView(new Date(dateInView.getFullYear(), dateInView.getMonth() + offset)),
|
|
2272
|
+
offset: 0
|
|
2273
|
+
});
|
|
2274
|
+
const formatWeekday = react.useMemo(() => {
|
|
2275
|
+
const {
|
|
2276
|
+
format
|
|
2277
|
+
} = new Intl.DateTimeFormat(locale, {
|
|
2278
|
+
weekday: "short"
|
|
2279
|
+
});
|
|
2280
|
+
return (weekDay) => format(new Date(Date.UTC(2021, 5, weekDay)));
|
|
2281
|
+
}, [locale]);
|
|
2282
|
+
react.useEffect(() => setDateInView(value === null ? new Date() : value instanceof Date ? value : value.max), [value]);
|
|
2283
|
+
react.useEffect(() => {
|
|
2284
|
+
if (!rangeSelect) {
|
|
2285
|
+
setDirty(void 0);
|
|
2286
|
+
}
|
|
2287
|
+
}, [rangeSelect]);
|
|
2288
|
+
function set(min2, max2, edit) {
|
|
2289
|
+
if (!rangeSelect) {
|
|
2290
|
+
onChange(min2 != null ? min2 : null);
|
|
2291
|
+
return;
|
|
2292
|
+
}
|
|
2293
|
+
if (min2 && max2 && min2 > max2) {
|
|
2294
|
+
if (edit === "min") {
|
|
2295
|
+
max2 = min2;
|
|
2296
|
+
} else if (edit === "max") {
|
|
2297
|
+
min2 = max2;
|
|
2298
|
+
} else {
|
|
2299
|
+
[min2, max2] = [max2, min2];
|
|
2300
|
+
}
|
|
2301
|
+
}
|
|
2302
|
+
if (!min2 === !max2) {
|
|
2303
|
+
setDirty(void 0);
|
|
2304
|
+
onChange(min2 && max2 ? {
|
|
2305
|
+
min: min2,
|
|
2306
|
+
max: max2
|
|
2307
|
+
} : null);
|
|
2308
|
+
} else {
|
|
2309
|
+
setDirty({
|
|
2310
|
+
min: min2,
|
|
2311
|
+
max: max2
|
|
2312
|
+
});
|
|
2313
|
+
}
|
|
2314
|
+
}
|
|
2315
|
+
const formatMonth = react.useMemo(() => {
|
|
2316
|
+
const {
|
|
2317
|
+
format
|
|
2318
|
+
} = new Intl.DateTimeFormat(locale, {
|
|
2319
|
+
month: "long"
|
|
2320
|
+
});
|
|
2321
|
+
return (month) => format(new Date(2021, month));
|
|
2322
|
+
}, [locale]);
|
|
2323
|
+
const formatYear = react.useMemo(() => {
|
|
2324
|
+
const {
|
|
2325
|
+
format
|
|
2326
|
+
} = new Intl.DateTimeFormat(locale, {
|
|
2327
|
+
year: "numeric"
|
|
2328
|
+
});
|
|
2329
|
+
return (year) => format(new Date(year, 0, 1));
|
|
2330
|
+
}, [locale]);
|
|
2331
|
+
return jsxRuntime.jsxs("div", {
|
|
2332
|
+
children: [jsxRuntime.jsxs("div", {
|
|
2333
|
+
css: {
|
|
2334
|
+
display: "grid",
|
|
2335
|
+
gridAutoFlow: "column",
|
|
2336
|
+
justifyContent: "center",
|
|
2337
|
+
alignItems: "baseline",
|
|
2338
|
+
gap: "var(--spacing)"
|
|
2339
|
+
},
|
|
2340
|
+
children: [jsxRuntime.jsx(DateInput, {
|
|
2341
|
+
value: min != null ? min : null,
|
|
2342
|
+
onChange: (date) => set(date != null ? date : void 0, max, "min"),
|
|
2343
|
+
locale
|
|
2344
|
+
}), rangeSelect && jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
2345
|
+
children: [" - ", jsxRuntime.jsx(DateInput, {
|
|
2346
|
+
value: max != null ? max : null,
|
|
2347
|
+
onChange: (date) => set(min, date != null ? date : void 0, "max"),
|
|
2348
|
+
locale
|
|
2349
|
+
})]
|
|
2350
|
+
})]
|
|
2351
|
+
}), calendars.map(({
|
|
2352
|
+
month,
|
|
2353
|
+
year,
|
|
2354
|
+
weeks
|
|
2355
|
+
}) => jsxRuntime.jsxs("div", {
|
|
2356
|
+
css: {
|
|
2357
|
+
display: "grid"
|
|
2358
|
+
},
|
|
2359
|
+
children: [jsxRuntime.jsxs("div", {
|
|
2360
|
+
css: {
|
|
2361
|
+
margin: "calc(var(--spacing) * 4) 0",
|
|
2362
|
+
display: "grid",
|
|
2363
|
+
gridAutoFlow: "column",
|
|
2364
|
+
justifyContent: "space-between",
|
|
2365
|
+
alignItems: "center"
|
|
2366
|
+
},
|
|
2367
|
+
children: [jsxRuntime.jsx(IconButton2, __spreadProps(__spreadValues({}, getBackProps({
|
|
2368
|
+
calendars
|
|
2369
|
+
})), {
|
|
2370
|
+
children: jsxRuntime.jsx(ChevronRight2, {
|
|
2371
|
+
css: {
|
|
2372
|
+
transform: "rotate3d(0, 0, 1, 180deg)"
|
|
2373
|
+
}
|
|
2374
|
+
})
|
|
2375
|
+
})), jsxRuntime.jsxs("div", {
|
|
2376
|
+
css: {
|
|
2377
|
+
display: "flex"
|
|
2378
|
+
},
|
|
2379
|
+
children: [formatMonth(month), " ", formatYear(year)]
|
|
2380
|
+
}), jsxRuntime.jsx(IconButton2, __spreadProps(__spreadValues({}, getForwardProps({
|
|
2381
|
+
calendars
|
|
2382
|
+
})), {
|
|
2383
|
+
children: jsxRuntime.jsx(ChevronRight2, {})
|
|
2384
|
+
}))]
|
|
2385
|
+
}), jsxRuntime.jsxs("div", {
|
|
2386
|
+
css: {
|
|
2387
|
+
justifySelf: "center",
|
|
2388
|
+
display: "grid",
|
|
2389
|
+
gridTemplateColumns: "repeat(7, max-content)",
|
|
2390
|
+
fontWeight: "bold"
|
|
2391
|
+
},
|
|
2392
|
+
children: [weekDays.map((_v, weekDay) => jsxRuntime.jsx("div", {
|
|
2393
|
+
css: {
|
|
2394
|
+
justifySelf: "center",
|
|
2395
|
+
marginBottom: "var(--spacing)"
|
|
2396
|
+
},
|
|
2397
|
+
children: formatWeekday(weekDay)
|
|
2398
|
+
}, weekDay)), weeks.map((week, index) => week.map((dateObj, dayIndex) => {
|
|
2399
|
+
if (!dateObj) {
|
|
2400
|
+
return jsxRuntime.jsx("div", {});
|
|
2401
|
+
}
|
|
2402
|
+
const {
|
|
2403
|
+
prevMonth,
|
|
2404
|
+
nextMonth,
|
|
2405
|
+
date,
|
|
2406
|
+
today: today2
|
|
2407
|
+
} = dateObj;
|
|
2408
|
+
const selected = date.getTime() === (min == null ? void 0 : min.getTime()) || min && max && dateIntersect(date, {
|
|
2409
|
+
min,
|
|
2410
|
+
max
|
|
2411
|
+
});
|
|
2412
|
+
const preSelected = !selected && (date.getTime() === (hovered == null ? void 0 : hovered.getTime()) || min && !max && hovered && dateIntersect(date, min <= hovered ? {
|
|
2413
|
+
min,
|
|
2414
|
+
max: hovered
|
|
2415
|
+
} : {
|
|
2416
|
+
min: hovered,
|
|
2417
|
+
max: min
|
|
2418
|
+
}));
|
|
2419
|
+
return jsxRuntime.jsx("button", __spreadProps(__spreadValues({
|
|
2420
|
+
css: [{
|
|
2421
|
+
padding: 10,
|
|
2422
|
+
border: "1px solid transparent",
|
|
2423
|
+
background: "transparent",
|
|
2424
|
+
cursor: "pointer"
|
|
2425
|
+
}, (prevMonth || nextMonth) && {
|
|
2426
|
+
color: tableTheme.gray
|
|
2427
|
+
}, today2 && {
|
|
2428
|
+
border: "1px solid var(--secondaryMain)"
|
|
2429
|
+
}, selected && {
|
|
2430
|
+
background: "var(--primaryMain)",
|
|
2431
|
+
color: "var(--primaryContrastText)"
|
|
2432
|
+
}, preSelected && {
|
|
2433
|
+
background: "var(--primaryLight)",
|
|
2434
|
+
color: "var(--primaryContrastText)"
|
|
2435
|
+
}]
|
|
2436
|
+
}, getDateProps({
|
|
2437
|
+
dateObj
|
|
2438
|
+
})), {
|
|
2439
|
+
onClick: () => {
|
|
2440
|
+
if (dirty) {
|
|
2441
|
+
if (min)
|
|
2442
|
+
set(min, date);
|
|
2443
|
+
else
|
|
2444
|
+
set(date, max);
|
|
2445
|
+
} else {
|
|
2446
|
+
set(date);
|
|
2447
|
+
}
|
|
2448
|
+
},
|
|
2449
|
+
onPointerOver: () => setHovered(date),
|
|
2450
|
+
onPointerOut: () => setHovered(void 0),
|
|
2451
|
+
children: date.getDate()
|
|
2452
|
+
}), `${index}-${dayIndex}`);
|
|
2453
|
+
}))]
|
|
2454
|
+
})]
|
|
2455
|
+
}, `${month}${year}`)), jsxRuntime.jsxs("div", {
|
|
2456
|
+
css: {
|
|
2457
|
+
marginTop: "var(--spacing)",
|
|
2458
|
+
display: "grid",
|
|
2459
|
+
gridAutoFlow: "column",
|
|
2460
|
+
justifyContent: "center"
|
|
2461
|
+
},
|
|
2462
|
+
children: [jsxRuntime.jsx(Button2, {
|
|
2463
|
+
variant: "text",
|
|
2464
|
+
onClick: () => {
|
|
2465
|
+
setDirty(void 0);
|
|
2466
|
+
onChange(today());
|
|
2467
|
+
},
|
|
2468
|
+
children: text.today
|
|
2469
|
+
}), jsxRuntime.jsx(Button2, {
|
|
2470
|
+
variant: "text",
|
|
2471
|
+
onClick: () => {
|
|
2472
|
+
setDirty(void 0);
|
|
2473
|
+
onChange(thisWeek(firstDayOfWeek));
|
|
2474
|
+
},
|
|
2475
|
+
children: text.thisWeek
|
|
2476
|
+
}), jsxRuntime.jsx(Button2, {
|
|
2477
|
+
variant: "text",
|
|
2478
|
+
onClick: () => {
|
|
2479
|
+
setDirty(void 0);
|
|
2480
|
+
onChange(null);
|
|
2481
|
+
},
|
|
2482
|
+
children: text.reset
|
|
2483
|
+
})]
|
|
1948
2484
|
})]
|
|
1949
|
-
})
|
|
2485
|
+
});
|
|
1950
2486
|
}
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
return value;
|
|
2487
|
+
function convertDate(x) {
|
|
2488
|
+
if (x instanceof Date)
|
|
2489
|
+
return x;
|
|
2490
|
+
if (typeof x === "number" || typeof x === "string")
|
|
2491
|
+
return new Date(x);
|
|
2492
|
+
return null;
|
|
1958
2493
|
}
|
|
1959
|
-
function
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
2494
|
+
function convertDateOrRange(x) {
|
|
2495
|
+
if (x instanceof Object && "min" in x && "max" in x) {
|
|
2496
|
+
const range = {
|
|
2497
|
+
min: convertDate(x.min),
|
|
2498
|
+
max: convertDate(x.max)
|
|
2499
|
+
};
|
|
2500
|
+
return range.min && range.max ? range : null;
|
|
2501
|
+
}
|
|
2502
|
+
return convertDate(x);
|
|
1964
2503
|
}
|
|
1965
|
-
function
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
return jsxRuntime.jsx(TableContext.Provider, {
|
|
1970
|
-
value: table,
|
|
1971
|
-
children: jsxRuntime.jsx(TableLoadingState, {})
|
|
1972
|
-
});
|
|
2504
|
+
function convertDateOrArray(x) {
|
|
2505
|
+
if (x instanceof Array)
|
|
2506
|
+
return x.map(convertDateOrRange).filter(Boolean);
|
|
2507
|
+
return convertDateOrRange(x);
|
|
1973
2508
|
}
|
|
1974
|
-
function
|
|
2509
|
+
function DateFilter(_k) {
|
|
2510
|
+
var _l = _k, {
|
|
2511
|
+
locale,
|
|
2512
|
+
firstDayOfWeek,
|
|
2513
|
+
singleSelect,
|
|
2514
|
+
filterBy = convertDateOrArray
|
|
2515
|
+
} = _l, props = __objRest(_l, [
|
|
2516
|
+
"locale",
|
|
2517
|
+
"firstDayOfWeek",
|
|
2518
|
+
"singleSelect",
|
|
2519
|
+
"filterBy"
|
|
2520
|
+
]);
|
|
1975
2521
|
const {
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
2522
|
+
value = null,
|
|
2523
|
+
onChange
|
|
2524
|
+
} = useFilter(__spreadProps(__spreadValues({}, props), {
|
|
2525
|
+
filterBy,
|
|
2526
|
+
id: "dateFilter",
|
|
2527
|
+
isActive(filterValue) {
|
|
2528
|
+
return !!filterValue;
|
|
2529
|
+
},
|
|
2530
|
+
test(filterValue, value2) {
|
|
2531
|
+
return dateIntersect(filterValue, value2);
|
|
2532
|
+
}
|
|
2533
|
+
}));
|
|
2534
|
+
return jsxRuntime.jsx("div", {
|
|
2535
|
+
css: {
|
|
2536
|
+
padding: "calc(var(--spacing) * 2)",
|
|
2537
|
+
display: "grid"
|
|
2538
|
+
},
|
|
2539
|
+
children: jsxRuntime.jsx(DatePicker, {
|
|
2540
|
+
rangeSelect: !singleSelect,
|
|
2541
|
+
value,
|
|
2542
|
+
onChange,
|
|
2543
|
+
locale,
|
|
2544
|
+
firstDayOfWeek
|
|
2545
|
+
})
|
|
1990
2546
|
});
|
|
1991
2547
|
}
|
|
1992
|
-
const TableInner = react.memo(function TableInner2({
|
|
1993
|
-
hidden
|
|
1994
|
-
}) {
|
|
1995
|
-
var _a, _b;
|
|
1996
|
-
const table = useTableContext();
|
|
1997
|
-
const fullWidth = table.useState("props.fullWidth");
|
|
1998
|
-
const activeColumns = table.useState((state) => state.activeColumns.map((column) => ({
|
|
1999
|
-
id: column.id,
|
|
2000
|
-
width: column.width,
|
|
2001
|
-
classes: column.classes,
|
|
2002
|
-
header: column.header
|
|
2003
|
-
})));
|
|
2004
|
-
const columnWidths = table.useState("columnWidths", {
|
|
2005
|
-
throttle: 16
|
|
2006
|
-
});
|
|
2007
|
-
const columnStyleOverride = table.useState("columnStyleOverride", {
|
|
2008
|
-
throttle: 16
|
|
2009
|
-
});
|
|
2010
|
-
const defaultWidth = table.useState("props.defaultWidth");
|
|
2011
|
-
const classes = table.useState("props.classes");
|
|
2012
|
-
const stickyHeader = table.useState("props.stickyHeader");
|
|
2013
|
-
const enableSelection = table.useState("props.enableSelection");
|
|
2014
|
-
const enableColumnSelection = table.useState("props.enableColumnSelection");
|
|
2015
|
-
const enableExport = table.useState((state) => !!state.props.enableExport.copy || !!state.props.enableExport.download);
|
|
2016
|
-
const cssVariables = useCssVariables();
|
|
2017
|
-
(_b = (_a = table.getState().props).debugRender) == null ? void 0 : _b.call(_a, "render table inner");
|
|
2018
|
-
return jsxRuntime.jsx(Virtualized, {
|
|
2019
|
-
className: classes == null ? void 0 : classes.table,
|
|
2020
|
-
css: [cssVariables, tableTheme.defaultClasses.table, {
|
|
2021
|
-
gridTemplateColumns: [
|
|
2022
|
-
fullWidth === "right" || fullWidth === true ? "auto" : "0",
|
|
2023
|
-
"max-content",
|
|
2024
|
-
...activeColumns.map((column) => {
|
|
2025
|
-
var _a2, _b2, _c;
|
|
2026
|
-
return (_c = (_b2 = (_a2 = columnWidths.get(column.id)) != null ? _a2 : column.width) != null ? _b2 : defaultWidth) != null ? _c : "max-content";
|
|
2027
|
-
}),
|
|
2028
|
-
fullWidth === "left" || fullWidth === true ? "auto" : "0"
|
|
2029
|
-
].join(" ")
|
|
2030
|
-
}, hidden && {
|
|
2031
|
-
visibility: "hidden"
|
|
2032
|
-
}],
|
|
2033
|
-
header: jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
2034
|
-
children: [jsxRuntime.jsx("div", {
|
|
2035
|
-
className: classes == null ? void 0 : classes.headerCell,
|
|
2036
|
-
css: [tableTheme.defaultClasses.headerFill, stickyHeader && tableTheme.defaultClasses.sticky, stickyHeader instanceof Object && stickyHeader]
|
|
2037
|
-
}), jsxRuntime.jsxs("div", {
|
|
2038
|
-
className: classes == null ? void 0 : classes.headerCell,
|
|
2039
|
-
css: [tableTheme.defaultClasses.headerCell, stickyHeader && tableTheme.defaultClasses.sticky, stickyHeader instanceof Object && stickyHeader],
|
|
2040
|
-
children: [enableSelection && jsxRuntime.jsx(SelectComponent, {}), enableColumnSelection && jsxRuntime.jsx(ColumnSelection, {}), enableExport && jsxRuntime.jsx(Export, {}), jsxRuntime.jsx(ResizeHandleView, {})]
|
|
2041
|
-
}), jsxRuntime.jsx(ColumnHeaderContext.Provider, {
|
|
2042
|
-
children: activeColumns.map((column) => {
|
|
2043
|
-
var _a2;
|
|
2044
|
-
return jsxRuntime.jsx(ColumnContext.Provider, {
|
|
2045
|
-
value: column.id,
|
|
2046
|
-
children: jsxRuntime.jsxs(ColumnHeader, {
|
|
2047
|
-
className: cx(classes == null ? void 0 : classes.headerCell, (_a2 = column.classes) == null ? void 0 : _a2.headerCell),
|
|
2048
|
-
css: [tableTheme.defaultClasses.headerCell, columnStyleOverride.get(column.id), stickyHeader && tableTheme.defaultClasses.sticky, stickyHeader instanceof Object && stickyHeader],
|
|
2049
|
-
children: [jsxRuntime.jsx(SortComponent, {
|
|
2050
|
-
children: column.header
|
|
2051
|
-
}), jsxRuntime.jsx("div", {
|
|
2052
|
-
css: {
|
|
2053
|
-
flex: 1
|
|
2054
|
-
}
|
|
2055
|
-
}), jsxRuntime.jsx(FilterControl, {}), jsxRuntime.jsx(ResizeHandle, {})]
|
|
2056
|
-
}, column.id)
|
|
2057
|
-
}, column.id);
|
|
2058
|
-
})
|
|
2059
|
-
}), jsxRuntime.jsx("div", {
|
|
2060
|
-
className: classes == null ? void 0 : classes.headerCell,
|
|
2061
|
-
css: [tableTheme.defaultClasses.headerFill, stickyHeader && tableTheme.defaultClasses.sticky, stickyHeader instanceof Object && stickyHeader]
|
|
2062
|
-
})]
|
|
2063
|
-
}),
|
|
2064
|
-
children: (itemIds, startIndex) => itemIds.map((itemId, index) => jsxRuntime.jsx(Row, {
|
|
2065
|
-
itemId,
|
|
2066
|
-
rowIndex: startIndex + index
|
|
2067
|
-
}, itemId))
|
|
2068
|
-
});
|
|
2069
|
-
});
|
|
2070
2548
|
function toggle(set, value, singleSelect) {
|
|
2071
2549
|
const newSet = new Set(singleSelect ? [] : set);
|
|
2072
2550
|
if (set.has(value)) {
|
|
@@ -2076,13 +2554,13 @@ function toggle(set, value, singleSelect) {
|
|
|
2076
2554
|
}
|
|
2077
2555
|
return newSet;
|
|
2078
2556
|
}
|
|
2079
|
-
function SelectFilter(
|
|
2080
|
-
var
|
|
2557
|
+
function SelectFilter(_m) {
|
|
2558
|
+
var _n = _m, {
|
|
2081
2559
|
options: providedOptions,
|
|
2082
2560
|
stringValue = asString,
|
|
2083
2561
|
render = stringValue,
|
|
2084
2562
|
singleSelect
|
|
2085
|
-
} =
|
|
2563
|
+
} = _n, props = __objRest(_n, [
|
|
2086
2564
|
"options",
|
|
2087
2565
|
"stringValue",
|
|
2088
2566
|
"render",
|
|
@@ -2090,12 +2568,12 @@ function SelectFilter(_g) {
|
|
|
2090
2568
|
]);
|
|
2091
2569
|
const {
|
|
2092
2570
|
components: {
|
|
2093
|
-
IconButton,
|
|
2094
|
-
Checkbox
|
|
2571
|
+
IconButton: IconButton2,
|
|
2572
|
+
Checkbox: Checkbox2
|
|
2095
2573
|
},
|
|
2096
2574
|
icons: {
|
|
2097
|
-
Search,
|
|
2098
|
-
Clear
|
|
2575
|
+
Search: Search2,
|
|
2576
|
+
Clear: Clear2
|
|
2099
2577
|
},
|
|
2100
2578
|
text
|
|
2101
2579
|
} = useTheme();
|
|
@@ -2134,9 +2612,9 @@ function SelectFilter(_g) {
|
|
|
2134
2612
|
children: [jsxRuntime.jsx(AutoFocusTextField, {
|
|
2135
2613
|
value: query,
|
|
2136
2614
|
onChange: (e) => setQuery(e.target.value),
|
|
2137
|
-
endIcon: jsxRuntime.jsx(
|
|
2615
|
+
endIcon: jsxRuntime.jsx(IconButton2, {
|
|
2138
2616
|
onClick: () => setQuery(""),
|
|
2139
|
-
children: !query ? jsxRuntime.jsx(
|
|
2617
|
+
children: !query ? jsxRuntime.jsx(Search2, {}) : jsxRuntime.jsx(Clear2, {})
|
|
2140
2618
|
}),
|
|
2141
2619
|
css: {
|
|
2142
2620
|
marginBottom: "var(--spacing)"
|
|
@@ -2148,7 +2626,7 @@ function SelectFilter(_g) {
|
|
|
2148
2626
|
},
|
|
2149
2627
|
children: [jsxRuntime.jsx(FormControlLabel, {
|
|
2150
2628
|
disabled: value.size === 0,
|
|
2151
|
-
control: jsxRuntime.jsx(
|
|
2629
|
+
control: jsxRuntime.jsx(Checkbox2, {
|
|
2152
2630
|
disabled: value.size === 0,
|
|
2153
2631
|
checked: value.size > 0,
|
|
2154
2632
|
onChange: () => onChange(/* @__PURE__ */ new Set())
|
|
@@ -2157,7 +2635,7 @@ function SelectFilter(_g) {
|
|
|
2157
2635
|
children: ["<", text.selected(value.size), ">"]
|
|
2158
2636
|
})
|
|
2159
2637
|
}), filtered.map((option, index) => jsxRuntime.jsx(FormControlLabel, {
|
|
2160
|
-
control: jsxRuntime.jsx(
|
|
2638
|
+
control: jsxRuntime.jsx(Checkbox2, {
|
|
2161
2639
|
checked: value.has(option),
|
|
2162
2640
|
onChange: () => onChange(toggle(value, option, singleSelect))
|
|
2163
2641
|
}),
|
|
@@ -2264,21 +2742,21 @@ const termMatch = (text, query) => {
|
|
|
2264
2742
|
}
|
|
2265
2743
|
return true;
|
|
2266
2744
|
};
|
|
2267
|
-
function TextFilter(
|
|
2268
|
-
var
|
|
2745
|
+
function TextFilter(_o) {
|
|
2746
|
+
var _p = _o, {
|
|
2269
2747
|
compare = textMatch,
|
|
2270
2748
|
filterBy = asStringOrArray
|
|
2271
|
-
} =
|
|
2749
|
+
} = _p, props = __objRest(_p, [
|
|
2272
2750
|
"compare",
|
|
2273
2751
|
"filterBy"
|
|
2274
2752
|
]);
|
|
2275
2753
|
const {
|
|
2276
2754
|
components: {
|
|
2277
|
-
IconButton
|
|
2755
|
+
IconButton: IconButton2
|
|
2278
2756
|
},
|
|
2279
2757
|
icons: {
|
|
2280
|
-
Search,
|
|
2281
|
-
Clear
|
|
2758
|
+
Search: Search2,
|
|
2759
|
+
Clear: Clear2
|
|
2282
2760
|
}
|
|
2283
2761
|
} = useTheme();
|
|
2284
2762
|
const {
|
|
@@ -2302,9 +2780,9 @@ function TextFilter(_i) {
|
|
|
2302
2780
|
children: jsxRuntime.jsx(AutoFocusTextField, {
|
|
2303
2781
|
value,
|
|
2304
2782
|
onChange: (e) => onChange(e.target.value),
|
|
2305
|
-
endIcon: jsxRuntime.jsx(
|
|
2783
|
+
endIcon: jsxRuntime.jsx(IconButton2, {
|
|
2306
2784
|
onClick: () => onChange(""),
|
|
2307
|
-
children: !value ? jsxRuntime.jsx(
|
|
2785
|
+
children: !value ? jsxRuntime.jsx(Search2, {}) : jsxRuntime.jsx(Clear2, {})
|
|
2308
2786
|
})
|
|
2309
2787
|
})
|
|
2310
2788
|
});
|