schummar-table 0.44.0 → 0.45.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/index.cjs +503 -287
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +10 -1
- package/dist/index.d.ts +10 -1
- package/dist/index.js +421 -206
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -54,11 +54,11 @@ var defaultColors = {
|
|
|
54
54
|
// src/components/spinnner.tsx
|
|
55
55
|
import { css } from "@emotion/react";
|
|
56
56
|
import { jsx, jsxs } from "@emotion/react/jsx-runtime";
|
|
57
|
-
function Spinner({ className:
|
|
57
|
+
function Spinner({ className: className3 }) {
|
|
58
58
|
return /* @__PURE__ */ jsxs(
|
|
59
59
|
"div",
|
|
60
60
|
{
|
|
61
|
-
className:
|
|
61
|
+
className: className3,
|
|
62
62
|
css: css`
|
|
63
63
|
display: inline-block;
|
|
64
64
|
position: relative;
|
|
@@ -220,7 +220,7 @@ var Button = (_a) => {
|
|
|
220
220
|
// src/theme/defaultTheme/checkbox.tsx
|
|
221
221
|
import { jsx as jsx4, jsxs as jsxs4 } from "@emotion/react/jsx-runtime";
|
|
222
222
|
var Checkbox = (_a) => {
|
|
223
|
-
var _b = _a, { className:
|
|
223
|
+
var _b = _a, { className: className3 } = _b, props = __objRest(_b, ["className"]);
|
|
224
224
|
return /* @__PURE__ */ jsxs4(
|
|
225
225
|
"label",
|
|
226
226
|
{
|
|
@@ -237,7 +237,7 @@ var Checkbox = (_a) => {
|
|
|
237
237
|
},
|
|
238
238
|
props.disabled && { color: "rgba(0, 0, 0, 0.26)" }
|
|
239
239
|
],
|
|
240
|
-
className:
|
|
240
|
+
className: className3,
|
|
241
241
|
children: [
|
|
242
242
|
/* @__PURE__ */ jsx4("input", __spreadValues({ type: "checkbox" }, props)),
|
|
243
243
|
props.checked ? /* @__PURE__ */ jsx4(
|
|
@@ -299,7 +299,7 @@ var TextField = (_a) => {
|
|
|
299
299
|
var _b = _a, {
|
|
300
300
|
startIcon,
|
|
301
301
|
endIcon,
|
|
302
|
-
className:
|
|
302
|
+
className: className3,
|
|
303
303
|
inputRef,
|
|
304
304
|
onBlur
|
|
305
305
|
} = _b, props = __objRest(_b, [
|
|
@@ -314,7 +314,7 @@ var TextField = (_a) => {
|
|
|
314
314
|
return /* @__PURE__ */ jsxs5(
|
|
315
315
|
"div",
|
|
316
316
|
{
|
|
317
|
-
className:
|
|
317
|
+
className: className3,
|
|
318
318
|
css: [
|
|
319
319
|
{
|
|
320
320
|
flex: 1,
|
|
@@ -757,7 +757,7 @@ var castArray = (a) => Array.isArray(a) ? a : [a];
|
|
|
757
757
|
var cx = (...classNames) => classNames.flatMap((entry) => {
|
|
758
758
|
if (!entry) return [];
|
|
759
759
|
if (typeof entry === "string") return [entry];
|
|
760
|
-
return Object.entries(entry).filter(([, predicate]) => predicate).map(([
|
|
760
|
+
return Object.entries(entry).filter(([, predicate]) => predicate).map(([className3]) => className3);
|
|
761
761
|
}).join(" ");
|
|
762
762
|
function isTruthy(x) {
|
|
763
763
|
return !!x;
|
|
@@ -1021,15 +1021,92 @@ function useFilter(impl) {
|
|
|
1021
1021
|
}, context);
|
|
1022
1022
|
}
|
|
1023
1023
|
|
|
1024
|
+
// src/components/combinedFilter.tsx
|
|
1025
|
+
import { jsx as jsx11 } from "@emotion/react/jsx-runtime";
|
|
1026
|
+
function CombinedFilter(_a) {
|
|
1027
|
+
var _b = _a, {
|
|
1028
|
+
columnIds: inputColumnIds
|
|
1029
|
+
} = _b, props = __objRest(_b, [
|
|
1030
|
+
"columnIds"
|
|
1031
|
+
]);
|
|
1032
|
+
const table = useTableContext();
|
|
1033
|
+
const columnIds = table.useState((state) => {
|
|
1034
|
+
return inputColumnIds != null ? inputColumnIds : state.activeColumns.filter(
|
|
1035
|
+
(column) => column.filter !== void 0 && !state.visibleColumns.some((c) => c.id === column.id)
|
|
1036
|
+
).map((column) => column.id);
|
|
1037
|
+
});
|
|
1038
|
+
const isActive = table.useState((state) => {
|
|
1039
|
+
return columnIds.some((columnId) => {
|
|
1040
|
+
const filter = state.filters.get(columnId);
|
|
1041
|
+
const filterValue = state.filterValues.get(columnId);
|
|
1042
|
+
return filter !== void 0 && filterValue !== void 0 && filter.isActive(filterValue);
|
|
1043
|
+
});
|
|
1044
|
+
});
|
|
1045
|
+
useFilter(__spreadProps(__spreadValues({}, props), {
|
|
1046
|
+
id: "combinedFilter",
|
|
1047
|
+
value: isActive,
|
|
1048
|
+
isActive(filterValue) {
|
|
1049
|
+
return filterValue;
|
|
1050
|
+
},
|
|
1051
|
+
test() {
|
|
1052
|
+
return true;
|
|
1053
|
+
},
|
|
1054
|
+
onChange(value) {
|
|
1055
|
+
var _a2;
|
|
1056
|
+
if (value === void 0) {
|
|
1057
|
+
for (const columnId of columnIds) {
|
|
1058
|
+
const impl = table.getState().filters.get(columnId);
|
|
1059
|
+
(_a2 = impl == null ? void 0 : impl.onChange) == null ? void 0 : _a2.call(impl, void 0);
|
|
1060
|
+
if ((impl == null ? void 0 : impl.value) === void 0) {
|
|
1061
|
+
table.update((state) => {
|
|
1062
|
+
state.filterValues.delete(columnId);
|
|
1063
|
+
});
|
|
1064
|
+
}
|
|
1065
|
+
}
|
|
1066
|
+
}
|
|
1067
|
+
}
|
|
1068
|
+
}));
|
|
1069
|
+
return /* @__PURE__ */ jsx11("div", { children: columnIds.map((columnId) => /* @__PURE__ */ jsx11(ColumnContext.Provider, { value: columnId, children: /* @__PURE__ */ jsx11(FilterControl, { component: Filter }) }, columnId)) });
|
|
1070
|
+
}
|
|
1071
|
+
function Filter(_a) {
|
|
1072
|
+
var _b = _a, { isActive } = _b, props = __objRest(_b, ["isActive"]);
|
|
1073
|
+
const table = useTableContext();
|
|
1074
|
+
const columnId = useColumnContext();
|
|
1075
|
+
const FilterList2 = useTheme((t) => t.icons.FilterList);
|
|
1076
|
+
const label = table.useState((state) => {
|
|
1077
|
+
var _a2, _b2;
|
|
1078
|
+
return (_b2 = (_a2 = state.activeColumns.find((column) => column.id === columnId)) == null ? void 0 : _a2.header) != null ? _b2 : null;
|
|
1079
|
+
});
|
|
1080
|
+
const Button2 = useTheme((t) => t.components.Button);
|
|
1081
|
+
return /* @__PURE__ */ jsx11(
|
|
1082
|
+
Button2,
|
|
1083
|
+
__spreadProps(__spreadValues({}, props), {
|
|
1084
|
+
startIcon: /* @__PURE__ */ jsx11(
|
|
1085
|
+
FilterList2,
|
|
1086
|
+
{
|
|
1087
|
+
css: {
|
|
1088
|
+
color: isActive ? "var(--primaryMain)" : "#b0bac9"
|
|
1089
|
+
}
|
|
1090
|
+
}
|
|
1091
|
+
),
|
|
1092
|
+
css: {
|
|
1093
|
+
width: "100%",
|
|
1094
|
+
color: isActive ? "var(--primaryMain)" : "var(--color-text)"
|
|
1095
|
+
},
|
|
1096
|
+
children: label
|
|
1097
|
+
})
|
|
1098
|
+
);
|
|
1099
|
+
}
|
|
1100
|
+
|
|
1024
1101
|
// src/components/datePicker.tsx
|
|
1025
1102
|
import { useDayzed } from "dayzed";
|
|
1026
1103
|
import {
|
|
1027
|
-
Fragment as
|
|
1104
|
+
Fragment as Fragment4,
|
|
1028
1105
|
createContext as createContext4,
|
|
1029
1106
|
useContext as useContext6,
|
|
1030
1107
|
useEffect as useEffect2,
|
|
1031
|
-
useMemo as
|
|
1032
|
-
useState as
|
|
1108
|
+
useMemo as useMemo6,
|
|
1109
|
+
useState as useState6
|
|
1033
1110
|
} from "react";
|
|
1034
1111
|
|
|
1035
1112
|
// src/misc/defaults.ts
|
|
@@ -1046,7 +1123,7 @@ function defaults(first, ...more) {
|
|
|
1046
1123
|
|
|
1047
1124
|
// src/components/dateInput.tsx
|
|
1048
1125
|
import { Fragment, useMemo as useMemo4, useState as useState4 } from "react";
|
|
1049
|
-
import { jsx as
|
|
1126
|
+
import { jsx as jsx12 } from "@emotion/react/jsx-runtime";
|
|
1050
1127
|
var className = "schummar-table-date-input";
|
|
1051
1128
|
var defaultDate = new Date(1970, 0, 1);
|
|
1052
1129
|
var isIncludedType = (type) => type === "day" || type === "month" || type === "year";
|
|
@@ -1069,11 +1146,7 @@ var tabNext = (event) => {
|
|
|
1069
1146
|
next.focus();
|
|
1070
1147
|
}
|
|
1071
1148
|
};
|
|
1072
|
-
function DateInput({
|
|
1073
|
-
value,
|
|
1074
|
-
onChange,
|
|
1075
|
-
locale
|
|
1076
|
-
}) {
|
|
1149
|
+
function DateInput({ value, onChange, locale }) {
|
|
1077
1150
|
const [override, setOverride] = useState4();
|
|
1078
1151
|
const commit = () => {
|
|
1079
1152
|
if (!override) {
|
|
@@ -1114,14 +1187,14 @@ function DateInput({
|
|
|
1114
1187
|
);
|
|
1115
1188
|
const parts = format.formatToParts(value != null ? value : defaultDate);
|
|
1116
1189
|
const isEmpty = !value;
|
|
1117
|
-
return /* @__PURE__ */
|
|
1190
|
+
return /* @__PURE__ */ jsx12(
|
|
1118
1191
|
"div",
|
|
1119
1192
|
{
|
|
1120
1193
|
css: {
|
|
1121
1194
|
display: "flex",
|
|
1122
1195
|
alignItems: "baseline"
|
|
1123
1196
|
},
|
|
1124
|
-
children: parts.map(({ type, value: value2 }, index) => /* @__PURE__ */
|
|
1197
|
+
children: parts.map(({ type, value: value2 }, index) => /* @__PURE__ */ jsx12(Fragment, { children: isIncludedType(type) ? /* @__PURE__ */ jsx12(
|
|
1125
1198
|
"input",
|
|
1126
1199
|
{
|
|
1127
1200
|
className,
|
|
@@ -1156,20 +1229,133 @@ function DateInput({
|
|
|
1156
1229
|
onFocus: (event) => event.target.select(),
|
|
1157
1230
|
onBlur: commit
|
|
1158
1231
|
}
|
|
1159
|
-
) : type === "literal" ? /* @__PURE__ */
|
|
1232
|
+
) : type === "literal" ? /* @__PURE__ */ jsx12("span", { children: value2 }) : null }, index))
|
|
1160
1233
|
}
|
|
1161
1234
|
);
|
|
1162
1235
|
}
|
|
1163
1236
|
|
|
1164
1237
|
// src/components/text.tsx
|
|
1165
|
-
import { Fragment as Fragment2, jsx as
|
|
1238
|
+
import { Fragment as Fragment2, jsx as jsx13 } from "@emotion/react/jsx-runtime";
|
|
1166
1239
|
function Text({ id }) {
|
|
1167
1240
|
const text = useTheme((t) => t.text[id]);
|
|
1168
|
-
return /* @__PURE__ */
|
|
1241
|
+
return /* @__PURE__ */ jsx13(Fragment2, { children: text });
|
|
1242
|
+
}
|
|
1243
|
+
|
|
1244
|
+
// src/components/timeInput.tsx
|
|
1245
|
+
import { Fragment as Fragment3, useMemo as useMemo5, useState as useState5 } from "react";
|
|
1246
|
+
import { jsx as jsx14 } from "@emotion/react/jsx-runtime";
|
|
1247
|
+
var className2 = "schummar-table-time-input";
|
|
1248
|
+
var defaultDate2 = new Date(1970, 0, 1);
|
|
1249
|
+
var isIncludedType2 = (type) => type === "hour" || type === "minute" || type === "second";
|
|
1250
|
+
var defaultLengths2 = {
|
|
1251
|
+
hour: 2,
|
|
1252
|
+
minute: 2,
|
|
1253
|
+
second: 2
|
|
1254
|
+
};
|
|
1255
|
+
var maxLengths2 = {
|
|
1256
|
+
hour: 2,
|
|
1257
|
+
minute: 2,
|
|
1258
|
+
second: 2
|
|
1259
|
+
};
|
|
1260
|
+
var length2 = (type, value) => Math.max(value.length, defaultLengths2[type]);
|
|
1261
|
+
var tabNext2 = (event) => {
|
|
1262
|
+
const all = Array.from(document.querySelectorAll(`.${className2}`));
|
|
1263
|
+
const index = all.indexOf(event);
|
|
1264
|
+
const next = all[(index + 1) % all.length];
|
|
1265
|
+
if (next instanceof HTMLElement) {
|
|
1266
|
+
next.focus();
|
|
1267
|
+
}
|
|
1268
|
+
};
|
|
1269
|
+
function TimeInput({ value, onChange, locale, showSeconds = true }) {
|
|
1270
|
+
const [override, setOverride] = useState5();
|
|
1271
|
+
const commit = () => {
|
|
1272
|
+
if (!override) {
|
|
1273
|
+
return;
|
|
1274
|
+
}
|
|
1275
|
+
setOverride(void 0);
|
|
1276
|
+
if (!override.value) {
|
|
1277
|
+
onChange(null);
|
|
1278
|
+
return;
|
|
1279
|
+
}
|
|
1280
|
+
const newValue = value ? new Date(value) : /* @__PURE__ */ new Date();
|
|
1281
|
+
switch (override.type) {
|
|
1282
|
+
case "hour": {
|
|
1283
|
+
newValue.setHours(Number(override.value));
|
|
1284
|
+
break;
|
|
1285
|
+
}
|
|
1286
|
+
case "minute": {
|
|
1287
|
+
newValue.setMinutes(Number(override.value));
|
|
1288
|
+
break;
|
|
1289
|
+
}
|
|
1290
|
+
case "second": {
|
|
1291
|
+
newValue.setSeconds(Number(override.value));
|
|
1292
|
+
break;
|
|
1293
|
+
}
|
|
1294
|
+
default: {
|
|
1295
|
+
break;
|
|
1296
|
+
}
|
|
1297
|
+
}
|
|
1298
|
+
onChange(newValue);
|
|
1299
|
+
};
|
|
1300
|
+
const format = useMemo5(
|
|
1301
|
+
() => new Intl.DateTimeFormat(locale, {
|
|
1302
|
+
hour: "2-digit",
|
|
1303
|
+
minute: "2-digit",
|
|
1304
|
+
second: showSeconds ? "2-digit" : void 0
|
|
1305
|
+
}),
|
|
1306
|
+
[locale]
|
|
1307
|
+
);
|
|
1308
|
+
const parts = format.formatToParts(value != null ? value : defaultDate2);
|
|
1309
|
+
const isEmpty = !value;
|
|
1310
|
+
return /* @__PURE__ */ jsx14(
|
|
1311
|
+
"div",
|
|
1312
|
+
{
|
|
1313
|
+
css: {
|
|
1314
|
+
display: "flex",
|
|
1315
|
+
alignItems: "baseline"
|
|
1316
|
+
},
|
|
1317
|
+
children: parts.map(({ type, value: value2 }, index) => /* @__PURE__ */ jsx14(Fragment3, { children: isIncludedType2(type) ? /* @__PURE__ */ jsx14(
|
|
1318
|
+
"input",
|
|
1319
|
+
{
|
|
1320
|
+
className: className2,
|
|
1321
|
+
css: {
|
|
1322
|
+
boxSizing: "content-box",
|
|
1323
|
+
overflow: "visible",
|
|
1324
|
+
border: "none",
|
|
1325
|
+
borderBottom: "2px solid transparent",
|
|
1326
|
+
outline: "none",
|
|
1327
|
+
fontSize: "inherit",
|
|
1328
|
+
backgroundColor: "inherit",
|
|
1329
|
+
color: "inherit",
|
|
1330
|
+
"::placeholder": {
|
|
1331
|
+
color: "inherit",
|
|
1332
|
+
opacity: 0.5
|
|
1333
|
+
},
|
|
1334
|
+
"&:focus": {
|
|
1335
|
+
borderBottom: "2px solid var(--primaryMain)"
|
|
1336
|
+
}
|
|
1337
|
+
},
|
|
1338
|
+
style: {
|
|
1339
|
+
width: `${length2(type, value2)}ch`
|
|
1340
|
+
},
|
|
1341
|
+
placeholder: "".padEnd(length2(type, value2), "0"),
|
|
1342
|
+
value: (override == null ? void 0 : override.type) === type ? override.value : !isEmpty ? value2 : "",
|
|
1343
|
+
onChange: (event) => {
|
|
1344
|
+
setOverride({ type, value: event.target.value });
|
|
1345
|
+
if (event.target.value.length >= maxLengths2[type]) {
|
|
1346
|
+
setTimeout(() => tabNext2(event.target));
|
|
1347
|
+
}
|
|
1348
|
+
},
|
|
1349
|
+
onFocus: (event) => event.target.select(),
|
|
1350
|
+
onBlur: commit
|
|
1351
|
+
}
|
|
1352
|
+
) : type === "literal" ? /* @__PURE__ */ jsx14("span", { children: value2 }) : null }, index))
|
|
1353
|
+
}
|
|
1354
|
+
);
|
|
1169
1355
|
}
|
|
1170
1356
|
|
|
1171
1357
|
// src/components/datePicker.tsx
|
|
1172
|
-
import { Fragment as
|
|
1358
|
+
import { Fragment as Fragment5, jsx as jsx15, jsxs as jsxs8 } from "@emotion/react/jsx-runtime";
|
|
1173
1359
|
var DatePickerContext = createContext4({});
|
|
1174
1360
|
function DatePickerProvider(_a) {
|
|
1175
1361
|
var _b = _a, {
|
|
@@ -1177,8 +1363,8 @@ function DatePickerProvider(_a) {
|
|
|
1177
1363
|
} = _b, props = __objRest(_b, [
|
|
1178
1364
|
"children"
|
|
1179
1365
|
]);
|
|
1180
|
-
const value =
|
|
1181
|
-
return /* @__PURE__ */
|
|
1366
|
+
const value = useMemo6(() => props, [JSON.stringify(props)]);
|
|
1367
|
+
return /* @__PURE__ */ jsx15(DatePickerContext.Provider, { value, children });
|
|
1182
1368
|
}
|
|
1183
1369
|
var weekDays = [0, 1, 2, 3, 4, 5, 6];
|
|
1184
1370
|
var startOfDay = (d) => new Date(d.getFullYear(), d.getMonth(), d.getDate());
|
|
@@ -1256,12 +1442,12 @@ var getCalendarWeek = (date) => {
|
|
|
1256
1442
|
return weekOfYear;
|
|
1257
1443
|
};
|
|
1258
1444
|
var commonQuickOptions = {
|
|
1259
|
-
today: { label: /* @__PURE__ */
|
|
1260
|
-
thisWeek: { label: /* @__PURE__ */
|
|
1261
|
-
thisMonth: { label: /* @__PURE__ */
|
|
1262
|
-
thisYear: { label: /* @__PURE__ */
|
|
1263
|
-
lastSevenDays: { label: /* @__PURE__ */
|
|
1264
|
-
lastThirtyDays: { label: /* @__PURE__ */
|
|
1445
|
+
today: { label: /* @__PURE__ */ jsx15(Text, { id: "today" }), value: today },
|
|
1446
|
+
thisWeek: { label: /* @__PURE__ */ jsx15(Text, { id: "thisWeek" }), value: (props) => thisWeek(0, props.firstDayOfWeek) },
|
|
1447
|
+
thisMonth: { label: /* @__PURE__ */ jsx15(Text, { id: "thisMonth" }), value: () => thisMonth() },
|
|
1448
|
+
thisYear: { label: /* @__PURE__ */ jsx15(Text, { id: "thisYear" }), value: () => thisYear() },
|
|
1449
|
+
lastSevenDays: { label: /* @__PURE__ */ jsx15(Text, { id: "lastSevenDays" }), value: () => lastDays(7) },
|
|
1450
|
+
lastThirtyDays: { label: /* @__PURE__ */ jsx15(Text, { id: "lastThirtyDays" }), value: () => lastDays(30) }
|
|
1265
1451
|
};
|
|
1266
1452
|
function dateIntersect(a, b) {
|
|
1267
1453
|
if (a instanceof Date) {
|
|
@@ -1308,7 +1494,8 @@ function DatePicker(props) {
|
|
|
1308
1494
|
minDate,
|
|
1309
1495
|
maxDate,
|
|
1310
1496
|
showCalendarWeek,
|
|
1311
|
-
blockedRanges = []
|
|
1497
|
+
blockedRanges = [],
|
|
1498
|
+
showTime
|
|
1312
1499
|
} = defaults(props, context);
|
|
1313
1500
|
function onChange(value2, source) {
|
|
1314
1501
|
if (value2 instanceof Date) {
|
|
@@ -1376,10 +1563,10 @@ function DatePicker(props) {
|
|
|
1376
1563
|
}
|
|
1377
1564
|
];
|
|
1378
1565
|
}
|
|
1379
|
-
const mountTime =
|
|
1380
|
-
const [dirty, setDirty] =
|
|
1381
|
-
const [hovered, setHovered] =
|
|
1382
|
-
const [dateInViewLocal, setDateInViewLocal] =
|
|
1566
|
+
const mountTime = useMemo6(() => /* @__PURE__ */ new Date(), []);
|
|
1567
|
+
const [dirty, setDirty] = useState6();
|
|
1568
|
+
const [hovered, setHovered] = useState6();
|
|
1569
|
+
const [dateInViewLocal, setDateInViewLocal] = useState6(defaultDateInView != null ? defaultDateInView : mountTime);
|
|
1383
1570
|
const dateInView = (_a = props.dateInView) != null ? _a : dateInViewLocal;
|
|
1384
1571
|
function setDateInView(date) {
|
|
1385
1572
|
var _a2;
|
|
@@ -1390,7 +1577,7 @@ function DatePicker(props) {
|
|
|
1390
1577
|
const max = dirty ? dirty.max : value instanceof Date ? value : value == null ? void 0 : value.max;
|
|
1391
1578
|
const resolvedQuickOptions = [
|
|
1392
1579
|
...quickOptions,
|
|
1393
|
-
...noReset ? [] : [{ label: /* @__PURE__ */
|
|
1580
|
+
...noReset ? [] : [{ label: /* @__PURE__ */ jsx15(Text, { id: "reset" }), value: null }]
|
|
1394
1581
|
].map((option, index) => {
|
|
1395
1582
|
if (option instanceof Function) {
|
|
1396
1583
|
return option((value3) => {
|
|
@@ -1399,7 +1586,7 @@ function DatePicker(props) {
|
|
|
1399
1586
|
});
|
|
1400
1587
|
}
|
|
1401
1588
|
const { label, value: value2 } = typeof option === "string" ? commonQuickOptions[option] : option;
|
|
1402
|
-
return /* @__PURE__ */
|
|
1589
|
+
return /* @__PURE__ */ jsx15(
|
|
1403
1590
|
Button2,
|
|
1404
1591
|
{
|
|
1405
1592
|
variant: "text",
|
|
@@ -1430,8 +1617,8 @@ function DatePicker(props) {
|
|
|
1430
1617
|
minDate,
|
|
1431
1618
|
maxDate
|
|
1432
1619
|
});
|
|
1433
|
-
const now =
|
|
1434
|
-
const formatWeekday =
|
|
1620
|
+
const now = useMemo6(() => startOfDay(/* @__PURE__ */ new Date()), []);
|
|
1621
|
+
const formatWeekday = useMemo6(() => {
|
|
1435
1622
|
const { format } = new Intl.DateTimeFormat(locale, { weekday: "short" });
|
|
1436
1623
|
return (weekDay) => format(new Date(Date.UTC(2021, 7, (weekDay + firstDayOfWeek) % 7 + 1)));
|
|
1437
1624
|
}, [locale, firstDayOfWeek]);
|
|
@@ -1467,11 +1654,11 @@ function DatePicker(props) {
|
|
|
1467
1654
|
setDirty({ min: min2, max: max2 });
|
|
1468
1655
|
}
|
|
1469
1656
|
}
|
|
1470
|
-
const formatMonth =
|
|
1657
|
+
const formatMonth = useMemo6(() => {
|
|
1471
1658
|
const { format } = new Intl.DateTimeFormat(locale, { month: "long" });
|
|
1472
1659
|
return (month) => format(new Date(2021, month));
|
|
1473
1660
|
}, [locale]);
|
|
1474
|
-
const formatYear =
|
|
1661
|
+
const formatYear = useMemo6(() => {
|
|
1475
1662
|
const { format } = new Intl.DateTimeFormat(locale, { year: "numeric" });
|
|
1476
1663
|
return (year) => format(new Date(year, 0, 1));
|
|
1477
1664
|
}, [locale]);
|
|
@@ -1492,28 +1679,55 @@ function DatePicker(props) {
|
|
|
1492
1679
|
display: "grid",
|
|
1493
1680
|
gridAutoFlow: "column",
|
|
1494
1681
|
justifyContent: "center",
|
|
1495
|
-
alignItems: "
|
|
1496
|
-
gap: "var(--spacing)"
|
|
1682
|
+
alignItems: "center",
|
|
1683
|
+
gap: "calc(var(--spacing) * 4)",
|
|
1684
|
+
"& > div": {
|
|
1685
|
+
display: "flex",
|
|
1686
|
+
flexDirection: "column",
|
|
1687
|
+
alignItems: "center"
|
|
1688
|
+
}
|
|
1497
1689
|
},
|
|
1498
1690
|
children: [
|
|
1499
|
-
/* @__PURE__ */
|
|
1500
|
-
|
|
1501
|
-
{
|
|
1502
|
-
value: min != null ? min : null,
|
|
1503
|
-
onChange: (date) => set("input", date != null ? date : void 0, max, "min"),
|
|
1504
|
-
locale
|
|
1505
|
-
}
|
|
1506
|
-
),
|
|
1507
|
-
rangeSelect && /* @__PURE__ */ jsxs8(Fragment4, { children: [
|
|
1508
|
-
" - ",
|
|
1509
|
-
/* @__PURE__ */ jsx13(
|
|
1691
|
+
/* @__PURE__ */ jsxs8("div", { children: [
|
|
1692
|
+
/* @__PURE__ */ jsx15(
|
|
1510
1693
|
DateInput,
|
|
1511
1694
|
{
|
|
1512
|
-
value:
|
|
1513
|
-
onChange: (date) => set("input",
|
|
1695
|
+
value: min != null ? min : null,
|
|
1696
|
+
onChange: (date) => set("input", date != null ? date : void 0, max, "min"),
|
|
1514
1697
|
locale
|
|
1515
1698
|
}
|
|
1699
|
+
),
|
|
1700
|
+
showTime && /* @__PURE__ */ jsx15(
|
|
1701
|
+
TimeInput,
|
|
1702
|
+
{
|
|
1703
|
+
value: min != null ? min : null,
|
|
1704
|
+
onChange: (date) => set("input", date != null ? date : void 0, max, "min"),
|
|
1705
|
+
locale,
|
|
1706
|
+
showSeconds: typeof showTime === "boolean" ? true : showTime.showSeconds
|
|
1707
|
+
}
|
|
1516
1708
|
)
|
|
1709
|
+
] }),
|
|
1710
|
+
rangeSelect && /* @__PURE__ */ jsxs8(Fragment5, { children: [
|
|
1711
|
+
" - ",
|
|
1712
|
+
/* @__PURE__ */ jsxs8("div", { children: [
|
|
1713
|
+
/* @__PURE__ */ jsx15(
|
|
1714
|
+
DateInput,
|
|
1715
|
+
{
|
|
1716
|
+
value: max != null ? max : null,
|
|
1717
|
+
onChange: (date) => set("input", min, date != null ? date : void 0, "max"),
|
|
1718
|
+
locale
|
|
1719
|
+
}
|
|
1720
|
+
),
|
|
1721
|
+
showTime && /* @__PURE__ */ jsx15(
|
|
1722
|
+
TimeInput,
|
|
1723
|
+
{
|
|
1724
|
+
value: max != null ? max : null,
|
|
1725
|
+
onChange: (date) => set("input", min, date != null ? date : void 0, "max"),
|
|
1726
|
+
locale,
|
|
1727
|
+
showSeconds: typeof showTime === "boolean" ? true : showTime.showSeconds
|
|
1728
|
+
}
|
|
1729
|
+
)
|
|
1730
|
+
] })
|
|
1517
1731
|
] })
|
|
1518
1732
|
]
|
|
1519
1733
|
}
|
|
@@ -1530,13 +1744,13 @@ function DatePicker(props) {
|
|
|
1530
1744
|
alignItems: "center"
|
|
1531
1745
|
},
|
|
1532
1746
|
children: [
|
|
1533
|
-
/* @__PURE__ */
|
|
1747
|
+
/* @__PURE__ */ jsx15(IconButton2, __spreadProps(__spreadValues({ type: "button" }, getBackProps({ calendars })), { children: /* @__PURE__ */ jsx15(ChevronRight2, { css: { transform: "rotate3d(0, 0, 1, 180deg)" } }) })),
|
|
1534
1748
|
/* @__PURE__ */ jsxs8("div", { css: { display: "flex" }, children: [
|
|
1535
1749
|
formatMonth(month),
|
|
1536
1750
|
" ",
|
|
1537
1751
|
formatYear(year)
|
|
1538
1752
|
] }),
|
|
1539
|
-
/* @__PURE__ */
|
|
1753
|
+
/* @__PURE__ */ jsx15(IconButton2, __spreadProps(__spreadValues({ type: "button" }, getForwardProps({ calendars })), { children: /* @__PURE__ */ jsx15(ChevronRight2, {}) }))
|
|
1540
1754
|
]
|
|
1541
1755
|
}
|
|
1542
1756
|
),
|
|
@@ -1549,7 +1763,7 @@ function DatePicker(props) {
|
|
|
1549
1763
|
gridTemplateColumns: "repeat(8, max-content)"
|
|
1550
1764
|
},
|
|
1551
1765
|
children: [
|
|
1552
|
-
showCalendarWeek ? /* @__PURE__ */
|
|
1766
|
+
showCalendarWeek ? /* @__PURE__ */ jsx15(
|
|
1553
1767
|
"div",
|
|
1554
1768
|
{
|
|
1555
1769
|
css: {
|
|
@@ -1557,10 +1771,10 @@ function DatePicker(props) {
|
|
|
1557
1771
|
padding: 10,
|
|
1558
1772
|
borderRight: "1px solid var(--date-picker-separator, var(--table-border, #bdbdbd))"
|
|
1559
1773
|
},
|
|
1560
|
-
children: /* @__PURE__ */
|
|
1774
|
+
children: /* @__PURE__ */ jsx15(Text, { id: "calendarWeek" })
|
|
1561
1775
|
}
|
|
1562
|
-
) : /* @__PURE__ */
|
|
1563
|
-
weekDays.map((_v, weekDay) => /* @__PURE__ */
|
|
1776
|
+
) : /* @__PURE__ */ jsx15("div", {}),
|
|
1777
|
+
weekDays.map((_v, weekDay) => /* @__PURE__ */ jsx15(
|
|
1564
1778
|
"div",
|
|
1565
1779
|
{
|
|
1566
1780
|
css: {
|
|
@@ -1575,8 +1789,8 @@ function DatePicker(props) {
|
|
|
1575
1789
|
const weekStart = week[0];
|
|
1576
1790
|
const weekEnd = week[6];
|
|
1577
1791
|
const weekDisabled = !rangeSelect || minDate && weekEnd.date < minDate || maxDate && weekStart.date > maxDate;
|
|
1578
|
-
return /* @__PURE__ */ jsxs8(
|
|
1579
|
-
showCalendarWeek ? /* @__PURE__ */
|
|
1792
|
+
return /* @__PURE__ */ jsxs8(Fragment4, { children: [
|
|
1793
|
+
showCalendarWeek ? /* @__PURE__ */ jsx15(
|
|
1580
1794
|
"button",
|
|
1581
1795
|
{
|
|
1582
1796
|
type: "button",
|
|
@@ -1601,10 +1815,10 @@ function DatePicker(props) {
|
|
|
1601
1815
|
onPointerOut: () => !weekDisabled && setHovered(void 0),
|
|
1602
1816
|
children: getCalendarWeek(weekEnd.date)
|
|
1603
1817
|
}
|
|
1604
|
-
) : /* @__PURE__ */
|
|
1818
|
+
) : /* @__PURE__ */ jsx15("div", {}),
|
|
1605
1819
|
week.map((dateObject, dayIndex) => {
|
|
1606
1820
|
if (!dateObject) {
|
|
1607
|
-
return /* @__PURE__ */
|
|
1821
|
+
return /* @__PURE__ */ jsx15("div", {}, dayIndex);
|
|
1608
1822
|
}
|
|
1609
1823
|
const { prevMonth, nextMonth, date } = dateObject;
|
|
1610
1824
|
const today2 = startOfDay(date).getTime() === now.getTime();
|
|
@@ -1615,7 +1829,7 @@ function DatePicker(props) {
|
|
|
1615
1829
|
min <= hovered.min ? { min, max: hovered.min } : { min: hovered.max, max: min }
|
|
1616
1830
|
));
|
|
1617
1831
|
const blocked = blockedRanges.some((range) => dateIntersect(date, range));
|
|
1618
|
-
return /* @__PURE__ */
|
|
1832
|
+
return /* @__PURE__ */ jsx15(
|
|
1619
1833
|
"button",
|
|
1620
1834
|
__spreadProps(__spreadValues({
|
|
1621
1835
|
type: "button",
|
|
@@ -1651,7 +1865,7 @@ function DatePicker(props) {
|
|
|
1651
1865
|
}
|
|
1652
1866
|
)
|
|
1653
1867
|
] }, `${month}${year}`)),
|
|
1654
|
-
/* @__PURE__ */
|
|
1868
|
+
/* @__PURE__ */ jsx15(
|
|
1655
1869
|
"div",
|
|
1656
1870
|
{
|
|
1657
1871
|
css: {
|
|
@@ -1669,7 +1883,7 @@ function DatePicker(props) {
|
|
|
1669
1883
|
}
|
|
1670
1884
|
|
|
1671
1885
|
// src/components/dateFilter.tsx
|
|
1672
|
-
import { jsx as
|
|
1886
|
+
import { jsx as jsx16 } from "@emotion/react/jsx-runtime";
|
|
1673
1887
|
function convertDate(x) {
|
|
1674
1888
|
if (x instanceof Date) return x;
|
|
1675
1889
|
if (typeof x === "number" || typeof x === "string") return new Date(x);
|
|
@@ -1721,14 +1935,14 @@ function DateFilter(_a) {
|
|
|
1721
1935
|
return dateIntersect(filterValue, value2);
|
|
1722
1936
|
}
|
|
1723
1937
|
}));
|
|
1724
|
-
return /* @__PURE__ */
|
|
1938
|
+
return /* @__PURE__ */ jsx16(
|
|
1725
1939
|
"div",
|
|
1726
1940
|
{
|
|
1727
1941
|
css: {
|
|
1728
1942
|
padding: "calc(var(--spacing) * 2)",
|
|
1729
1943
|
display: "grid"
|
|
1730
1944
|
},
|
|
1731
|
-
children: /* @__PURE__ */
|
|
1945
|
+
children: /* @__PURE__ */ jsx16(
|
|
1732
1946
|
DatePicker,
|
|
1733
1947
|
{
|
|
1734
1948
|
rangeSelect: !singleSelect,
|
|
@@ -1748,8 +1962,8 @@ function DateFilter(_a) {
|
|
|
1748
1962
|
}
|
|
1749
1963
|
|
|
1750
1964
|
// src/components/numberField.tsx
|
|
1751
|
-
import { useState as
|
|
1752
|
-
import { jsx as
|
|
1965
|
+
import { useState as useState7 } from "react";
|
|
1966
|
+
import { jsx as jsx17 } from "@emotion/react/jsx-runtime";
|
|
1753
1967
|
var Pattern = /^-?\d*(?:[.,]\d*)?$/;
|
|
1754
1968
|
var printNumber = (value, locale) => {
|
|
1755
1969
|
if (value === null) {
|
|
@@ -1774,8 +1988,8 @@ function NumberField(_a) {
|
|
|
1774
1988
|
]);
|
|
1775
1989
|
const locale = useTheme((t) => t.locale);
|
|
1776
1990
|
const TextField2 = useTheme((t) => t.components.TextField);
|
|
1777
|
-
const [value = printNumber(commitedValue, locale), setValue] =
|
|
1778
|
-
return /* @__PURE__ */
|
|
1991
|
+
const [value = printNumber(commitedValue, locale), setValue] = useState7();
|
|
1992
|
+
return /* @__PURE__ */ jsx17(
|
|
1779
1993
|
TextField2,
|
|
1780
1994
|
__spreadProps(__spreadValues({
|
|
1781
1995
|
value,
|
|
@@ -1800,7 +2014,7 @@ function NumberField(_a) {
|
|
|
1800
2014
|
}
|
|
1801
2015
|
|
|
1802
2016
|
// src/components/rangeFilter.tsx
|
|
1803
|
-
import { jsx as
|
|
2017
|
+
import { jsx as jsx18, jsxs as jsxs9 } from "@emotion/react/jsx-runtime";
|
|
1804
2018
|
function RangeFilter(_a) {
|
|
1805
2019
|
var _b = _a, {
|
|
1806
2020
|
min,
|
|
@@ -1854,7 +2068,7 @@ function RangeFilter(_a) {
|
|
|
1854
2068
|
return value2 !== null && value2 >= min2 && value2 <= max2;
|
|
1855
2069
|
}
|
|
1856
2070
|
}));
|
|
1857
|
-
return /* @__PURE__ */
|
|
2071
|
+
return /* @__PURE__ */ jsx18(
|
|
1858
2072
|
"div",
|
|
1859
2073
|
{
|
|
1860
2074
|
css: {
|
|
@@ -1874,12 +2088,12 @@ function RangeFilter(_a) {
|
|
|
1874
2088
|
}
|
|
1875
2089
|
},
|
|
1876
2090
|
children: [
|
|
1877
|
-
/* @__PURE__ */
|
|
2091
|
+
/* @__PURE__ */ jsx18(
|
|
1878
2092
|
NumberField,
|
|
1879
2093
|
{
|
|
1880
2094
|
value: value == null ? void 0 : value[0],
|
|
1881
2095
|
onChange: (newMin) => onChange(normalize(newMin, value == null ? void 0 : value[1], "min", { min, max })),
|
|
1882
|
-
startIcon: /* @__PURE__ */
|
|
2096
|
+
startIcon: /* @__PURE__ */ jsx18("span", { css: { margin: "0 calc(var(--spacing) * 2)" }, children: rangeMinText }),
|
|
1883
2097
|
placeholder: String(minValue != null ? minValue : ""),
|
|
1884
2098
|
css: {
|
|
1885
2099
|
alignItems: "baseline"
|
|
@@ -1887,12 +2101,12 @@ function RangeFilter(_a) {
|
|
|
1887
2101
|
}
|
|
1888
2102
|
),
|
|
1889
2103
|
"-",
|
|
1890
|
-
/* @__PURE__ */
|
|
2104
|
+
/* @__PURE__ */ jsx18(
|
|
1891
2105
|
NumberField,
|
|
1892
2106
|
{
|
|
1893
2107
|
value: value == null ? void 0 : value[1],
|
|
1894
2108
|
onChange: (newMax) => onChange(normalize(value == null ? void 0 : value[0], newMax, "max", { min, max })),
|
|
1895
|
-
startIcon: /* @__PURE__ */
|
|
2109
|
+
startIcon: /* @__PURE__ */ jsx18("span", { css: { margin: "0 calc(var(--spacing) * 2)" }, children: rangeMaxText }),
|
|
1896
2110
|
placeholder: String(maxValue != null ? maxValue : ""),
|
|
1897
2111
|
css: {
|
|
1898
2112
|
alignItems: "baseline"
|
|
@@ -1922,10 +2136,10 @@ function clamp(value, min = Number.NEGATIVE_INFINITY, max = Number.POSITIVE_INFI
|
|
|
1922
2136
|
}
|
|
1923
2137
|
|
|
1924
2138
|
// src/components/selectFilter.tsx
|
|
1925
|
-
import { useEffect as useEffect4, useMemo as
|
|
2139
|
+
import { useEffect as useEffect4, useMemo as useMemo8, useState as useState9 } from "react";
|
|
1926
2140
|
|
|
1927
2141
|
// src/components/formControlLabel.tsx
|
|
1928
|
-
import { jsx as
|
|
2142
|
+
import { jsx as jsx19, jsxs as jsxs10 } from "@emotion/react/jsx-runtime";
|
|
1929
2143
|
function FormControlLabel({
|
|
1930
2144
|
control,
|
|
1931
2145
|
label,
|
|
@@ -1948,14 +2162,14 @@ function FormControlLabel({
|
|
|
1948
2162
|
],
|
|
1949
2163
|
children: [
|
|
1950
2164
|
control,
|
|
1951
|
-
/* @__PURE__ */
|
|
2165
|
+
/* @__PURE__ */ jsx19("span", { css: { marginLeft: "var(--spacing)" }, children: label })
|
|
1952
2166
|
]
|
|
1953
2167
|
}
|
|
1954
2168
|
);
|
|
1955
2169
|
}
|
|
1956
2170
|
|
|
1957
2171
|
// src/components/virtualList.tsx
|
|
1958
|
-
import { useEffect as useEffect3, useMemo as
|
|
2172
|
+
import { useEffect as useEffect3, useMemo as useMemo7, useRef as useRef3, useState as useState8 } from "react";
|
|
1959
2173
|
|
|
1960
2174
|
// src/misc/throttle.ts
|
|
1961
2175
|
function throttle(function_, ms) {
|
|
@@ -1996,7 +2210,7 @@ function throttle(function_, ms) {
|
|
|
1996
2210
|
}
|
|
1997
2211
|
|
|
1998
2212
|
// src/components/virtualList.tsx
|
|
1999
|
-
import { jsx as
|
|
2213
|
+
import { jsx as jsx20, jsxs as jsxs11 } from "@emotion/react/jsx-runtime";
|
|
2000
2214
|
function VirtualList(_a) {
|
|
2001
2215
|
var _b = _a, {
|
|
2002
2216
|
virtual = true,
|
|
@@ -2009,9 +2223,9 @@ function VirtualList(_a) {
|
|
|
2009
2223
|
]);
|
|
2010
2224
|
var _a2, _b2, _c, _d, _e;
|
|
2011
2225
|
const container = useRef3(null);
|
|
2012
|
-
const [, setId] =
|
|
2226
|
+
const [, setId] = useState8({});
|
|
2013
2227
|
const throttleScroll = (_b2 = (_a2 = typeof virtual === "boolean" ? void 0 : virtual) == null ? void 0 : _a2.throttleScroll) != null ? _b2 : 16;
|
|
2014
|
-
const update =
|
|
2228
|
+
const update = useMemo7(() => throttle(() => setId({}), throttleScroll), [throttleScroll]);
|
|
2015
2229
|
useEffect3(() => {
|
|
2016
2230
|
if (!virtual) return;
|
|
2017
2231
|
const ro = new ResizeObserver(update);
|
|
@@ -2026,7 +2240,7 @@ function VirtualList(_a) {
|
|
|
2026
2240
|
};
|
|
2027
2241
|
}, [update, virtual, throttleScroll]);
|
|
2028
2242
|
if (!virtual) {
|
|
2029
|
-
return /* @__PURE__ */
|
|
2243
|
+
return /* @__PURE__ */ jsx20(
|
|
2030
2244
|
"div",
|
|
2031
2245
|
__spreadProps(__spreadValues({}, props), {
|
|
2032
2246
|
css: {
|
|
@@ -2071,9 +2285,9 @@ function VirtualList(_a) {
|
|
|
2071
2285
|
display: "grid"
|
|
2072
2286
|
},
|
|
2073
2287
|
children: [
|
|
2074
|
-
/* @__PURE__ */
|
|
2288
|
+
/* @__PURE__ */ jsx20("div", { "data-virtual-before": true, style: { height: before } }),
|
|
2075
2289
|
items.slice(from, to).map((item, index) => children(item, index + from)),
|
|
2076
|
-
/* @__PURE__ */
|
|
2290
|
+
/* @__PURE__ */ jsx20("div", { "data-virtual-after": true, style: { height: after } })
|
|
2077
2291
|
]
|
|
2078
2292
|
})
|
|
2079
2293
|
);
|
|
@@ -2087,7 +2301,7 @@ function averageItemHeight(container) {
|
|
|
2087
2301
|
}
|
|
2088
2302
|
|
|
2089
2303
|
// src/components/selectFilter.tsx
|
|
2090
|
-
import { jsx as
|
|
2304
|
+
import { jsx as jsx21, jsxs as jsxs12 } from "@emotion/react/jsx-runtime";
|
|
2091
2305
|
function toggle(set, value, singleSelect) {
|
|
2092
2306
|
const newSet = new Set(singleSelect ? [] : set);
|
|
2093
2307
|
if (set.has(value)) {
|
|
@@ -2145,11 +2359,11 @@ function SelectFilter(_a) {
|
|
|
2145
2359
|
)
|
|
2146
2360
|
);
|
|
2147
2361
|
});
|
|
2148
|
-
const [query, setQuery] =
|
|
2362
|
+
const [query, setQuery] = useState9("");
|
|
2149
2363
|
const filtered = options.filter(
|
|
2150
2364
|
(option) => !query || stringValue(option).toLowerCase().includes(query.toLowerCase())
|
|
2151
2365
|
);
|
|
2152
|
-
const delayedValue =
|
|
2366
|
+
const delayedValue = useMemo8(() => value, [isActive]);
|
|
2153
2367
|
const ordered = filtered.filter((option) => delayedValue.has(option)).concat(filtered.filter((option) => !delayedValue.has(option)));
|
|
2154
2368
|
const Button2 = useTheme((t) => t.components.Button);
|
|
2155
2369
|
useEffect4(() => {
|
|
@@ -2165,16 +2379,16 @@ function SelectFilter(_a) {
|
|
|
2165
2379
|
gap: "var(--spacing)"
|
|
2166
2380
|
},
|
|
2167
2381
|
children: [
|
|
2168
|
-
!hideSearchField && /* @__PURE__ */
|
|
2382
|
+
!hideSearchField && /* @__PURE__ */ jsx21(
|
|
2169
2383
|
AutoFocusTextField,
|
|
2170
2384
|
{
|
|
2171
2385
|
value: query,
|
|
2172
2386
|
onChange: (event) => setQuery(event.target.value),
|
|
2173
|
-
endIcon: /* @__PURE__ */
|
|
2387
|
+
endIcon: /* @__PURE__ */ jsx21(IconButton2, { onClick: () => setQuery(""), children: !query ? /* @__PURE__ */ jsx21(Search2, {}) : /* @__PURE__ */ jsx21(Clear2, {}) }),
|
|
2174
2388
|
css: { marginBottom: "var(--spacing)" }
|
|
2175
2389
|
}
|
|
2176
2390
|
),
|
|
2177
|
-
!hideResetButton && /* @__PURE__ */
|
|
2391
|
+
!hideResetButton && /* @__PURE__ */ jsx21(
|
|
2178
2392
|
Button2,
|
|
2179
2393
|
{
|
|
2180
2394
|
disabled: value.size === 0,
|
|
@@ -2189,7 +2403,7 @@ function SelectFilter(_a) {
|
|
|
2189
2403
|
children: deselectAll
|
|
2190
2404
|
}
|
|
2191
2405
|
),
|
|
2192
|
-
/* @__PURE__ */
|
|
2406
|
+
/* @__PURE__ */ jsx21(
|
|
2193
2407
|
VirtualList,
|
|
2194
2408
|
{
|
|
2195
2409
|
items: ordered,
|
|
@@ -2201,10 +2415,10 @@ function SelectFilter(_a) {
|
|
|
2201
2415
|
display: "grid",
|
|
2202
2416
|
gridTemplateColumns: "minmax(0, 1fr)"
|
|
2203
2417
|
},
|
|
2204
|
-
children: (option, index) => /* @__PURE__ */
|
|
2418
|
+
children: (option, index) => /* @__PURE__ */ jsx21(
|
|
2205
2419
|
FormControlLabel,
|
|
2206
2420
|
{
|
|
2207
|
-
control: /* @__PURE__ */
|
|
2421
|
+
control: /* @__PURE__ */ jsx21(
|
|
2208
2422
|
Checkbox2,
|
|
2209
2423
|
{
|
|
2210
2424
|
checked: value.has(option),
|
|
@@ -2217,17 +2431,17 @@ function SelectFilter(_a) {
|
|
|
2217
2431
|
)
|
|
2218
2432
|
}
|
|
2219
2433
|
),
|
|
2220
|
-
ordered.length === 0 && /* @__PURE__ */
|
|
2434
|
+
ordered.length === 0 && /* @__PURE__ */ jsx21("span", { css: { textAlign: "center" }, children: noResults })
|
|
2221
2435
|
]
|
|
2222
2436
|
}
|
|
2223
2437
|
);
|
|
2224
2438
|
}
|
|
2225
2439
|
|
|
2226
2440
|
// src/components/table.tsx
|
|
2227
|
-
import { memo as memo3, useEffect as useEffect15, useLayoutEffect as useLayoutEffect6, useState as
|
|
2441
|
+
import { memo as memo3, useEffect as useEffect15, useLayoutEffect as useLayoutEffect6, useState as useState15 } from "react";
|
|
2228
2442
|
|
|
2229
2443
|
// src/internalState/tableStateStorage.ts
|
|
2230
|
-
import { useEffect as useEffect5, useState as
|
|
2444
|
+
import { useEffect as useEffect5, useState as useState10 } from "react";
|
|
2231
2445
|
|
|
2232
2446
|
// src/misc/queue.ts
|
|
2233
2447
|
var Queue = class {
|
|
@@ -2311,8 +2525,8 @@ function parse(value) {
|
|
|
2311
2525
|
});
|
|
2312
2526
|
}
|
|
2313
2527
|
function useTableStateStorage(table) {
|
|
2314
|
-
const [isHydrated, setIsHydrated] =
|
|
2315
|
-
const [q] =
|
|
2528
|
+
const [isHydrated, setIsHydrated] = useState10(false);
|
|
2529
|
+
const [q] = useState10(() => new Queue());
|
|
2316
2530
|
useEffect5(() => {
|
|
2317
2531
|
const { persist } = table.getState().props;
|
|
2318
2532
|
if (!persist) {
|
|
@@ -2434,7 +2648,7 @@ function useTableStateStorage(table) {
|
|
|
2434
2648
|
|
|
2435
2649
|
// src/internalState/useTableState.ts
|
|
2436
2650
|
import { castDraft as castDraft4 } from "immer";
|
|
2437
|
-
import { useEffect as useEffect12, useMemo as
|
|
2651
|
+
import { useEffect as useEffect12, useMemo as useMemo10, useState as useState11 } from "react";
|
|
2438
2652
|
|
|
2439
2653
|
// src/internalState/calcItems.ts
|
|
2440
2654
|
import { castDraft as castDraft2 } from "immer";
|
|
@@ -2559,7 +2773,7 @@ function calcItems(state) {
|
|
|
2559
2773
|
}
|
|
2560
2774
|
|
|
2561
2775
|
// src/internalState/calcProps.ts
|
|
2562
|
-
import { useMemo as
|
|
2776
|
+
import { useMemo as useMemo9 } from "react";
|
|
2563
2777
|
|
|
2564
2778
|
// src/exporters/serializer.ts
|
|
2565
2779
|
function defaultSerializer(x) {
|
|
@@ -2608,7 +2822,7 @@ var defaultProps = {
|
|
|
2608
2822
|
};
|
|
2609
2823
|
function calcProps(props) {
|
|
2610
2824
|
const cache = useTableMemo();
|
|
2611
|
-
return
|
|
2825
|
+
return useMemo9(
|
|
2612
2826
|
() => overrides(defaultProps, calc(props, cache)),
|
|
2613
2827
|
[props]
|
|
2614
2828
|
);
|
|
@@ -2930,7 +3144,7 @@ function watchDisplaySize(state) {
|
|
|
2930
3144
|
|
|
2931
3145
|
// src/internalState/useTableState.ts
|
|
2932
3146
|
function useTableState(_props) {
|
|
2933
|
-
const [key, setKey] =
|
|
3147
|
+
const [key, setKey] = useState11({});
|
|
2934
3148
|
const props = calcProps(_props);
|
|
2935
3149
|
function reset() {
|
|
2936
3150
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
@@ -2949,7 +3163,7 @@ function useTableState(_props) {
|
|
|
2949
3163
|
}
|
|
2950
3164
|
(_i = props.onReset) == null ? void 0 : _i.call(props, "table");
|
|
2951
3165
|
}
|
|
2952
|
-
const state =
|
|
3166
|
+
const state = useMemo10(
|
|
2953
3167
|
() => {
|
|
2954
3168
|
var _a, _b, _c, _d;
|
|
2955
3169
|
return new Store({
|
|
@@ -3004,12 +3218,12 @@ function useTableState(_props) {
|
|
|
3004
3218
|
}
|
|
3005
3219
|
|
|
3006
3220
|
// src/components/clearFiltersButton.tsx
|
|
3007
|
-
import { jsx as
|
|
3221
|
+
import { jsx as jsx22 } from "@emotion/react/jsx-runtime";
|
|
3008
3222
|
function ClearFiltersButton() {
|
|
3009
3223
|
const Button2 = useTheme((t) => t.components.Button);
|
|
3010
3224
|
const textClearFilters = useTheme((t) => t.text.clearFilters);
|
|
3011
3225
|
const table = useTableContext();
|
|
3012
|
-
return /* @__PURE__ */
|
|
3226
|
+
return /* @__PURE__ */ jsx22("div", { css: defaultClasses.clearFiltersButton, children: /* @__PURE__ */ jsx22(
|
|
3013
3227
|
Button2,
|
|
3014
3228
|
{
|
|
3015
3229
|
variant: "outlined",
|
|
@@ -3028,7 +3242,7 @@ function ClearFiltersButton() {
|
|
|
3028
3242
|
}
|
|
3029
3243
|
|
|
3030
3244
|
// src/components/columnFooter.tsx
|
|
3031
|
-
import { jsx as
|
|
3245
|
+
import { jsx as jsx23 } from "@emotion/react/jsx-runtime";
|
|
3032
3246
|
function ColumnFooter() {
|
|
3033
3247
|
const table = useTableContext();
|
|
3034
3248
|
const columnId = useColumnContext();
|
|
@@ -3060,7 +3274,7 @@ function ColumnFooter() {
|
|
|
3060
3274
|
const column = state.activeColumns.find((column2) => column2.id === columnId);
|
|
3061
3275
|
return column == null ? void 0 : column.footer;
|
|
3062
3276
|
});
|
|
3063
|
-
return /* @__PURE__ */
|
|
3277
|
+
return /* @__PURE__ */ jsx23(
|
|
3064
3278
|
"div",
|
|
3065
3279
|
{
|
|
3066
3280
|
className: cx(classes, columnClasses),
|
|
@@ -3082,7 +3296,7 @@ import { castDraft as castDraft5 } from "immer";
|
|
|
3082
3296
|
import { useEffect as useEffect13, useRef as useRef4 } from "react";
|
|
3083
3297
|
|
|
3084
3298
|
// src/components/resizeHandle.tsx
|
|
3085
|
-
import { jsx as
|
|
3299
|
+
import { jsx as jsx24 } from "@emotion/react/jsx-runtime";
|
|
3086
3300
|
function ResizeHandle() {
|
|
3087
3301
|
const table = useTableContext();
|
|
3088
3302
|
const columnId = useColumnContext();
|
|
@@ -3119,7 +3333,7 @@ function ResizeHandle() {
|
|
|
3119
3333
|
if (!enabled) {
|
|
3120
3334
|
return null;
|
|
3121
3335
|
}
|
|
3122
|
-
return /* @__PURE__ */
|
|
3336
|
+
return /* @__PURE__ */ jsx24(
|
|
3123
3337
|
ResizeHandleView,
|
|
3124
3338
|
{
|
|
3125
3339
|
enabled,
|
|
@@ -3136,7 +3350,7 @@ function ResizeHandleView(_a) {
|
|
|
3136
3350
|
} = _b, props = __objRest(_b, [
|
|
3137
3351
|
"enabled"
|
|
3138
3352
|
]);
|
|
3139
|
-
const
|
|
3353
|
+
const className3 = useTheme((theme) => {
|
|
3140
3354
|
var _a2;
|
|
3141
3355
|
return (_a2 = theme.classes) == null ? void 0 : _a2.columnDivider;
|
|
3142
3356
|
});
|
|
@@ -3144,10 +3358,10 @@ function ResizeHandleView(_a) {
|
|
|
3144
3358
|
var _a2;
|
|
3145
3359
|
return (_a2 = theme.styles) == null ? void 0 : _a2.columnDivider;
|
|
3146
3360
|
});
|
|
3147
|
-
return /* @__PURE__ */
|
|
3361
|
+
return /* @__PURE__ */ jsx24(
|
|
3148
3362
|
"div",
|
|
3149
3363
|
__spreadValues({
|
|
3150
|
-
className:
|
|
3364
|
+
className: className3,
|
|
3151
3365
|
css: [
|
|
3152
3366
|
{
|
|
3153
3367
|
alignSelf: "stretch",
|
|
@@ -3173,7 +3387,7 @@ function ResizeHandleView(_a) {
|
|
|
3173
3387
|
}
|
|
3174
3388
|
|
|
3175
3389
|
// src/components/sortComponent.tsx
|
|
3176
|
-
import { jsx as
|
|
3390
|
+
import { jsx as jsx25, jsxs as jsxs13 } from "@emotion/react/jsx-runtime";
|
|
3177
3391
|
function SortComponent({ children }) {
|
|
3178
3392
|
const table = useTableContext();
|
|
3179
3393
|
const columnId = useColumnContext();
|
|
@@ -3230,8 +3444,8 @@ function SortComponent({ children }) {
|
|
|
3230
3444
|
onClick: (event) => toggle2(event),
|
|
3231
3445
|
onContextMenu: (event) => toggle2(event, true),
|
|
3232
3446
|
children: [
|
|
3233
|
-
/* @__PURE__ */
|
|
3234
|
-
/* @__PURE__ */
|
|
3447
|
+
/* @__PURE__ */ jsx25("div", { children }),
|
|
3448
|
+
/* @__PURE__ */ jsx25(Badge2, { badgeContent: sortDisabled ? 0 : index, children: /* @__PURE__ */ jsx25(
|
|
3235
3449
|
"span",
|
|
3236
3450
|
{
|
|
3237
3451
|
css: [
|
|
@@ -3239,7 +3453,7 @@ function SortComponent({ children }) {
|
|
|
3239
3453
|
!direction && { opacity: 0 },
|
|
3240
3454
|
direction === "desc" && { transform: "rotate3d(0, 0, 1, 180deg)" }
|
|
3241
3455
|
],
|
|
3242
|
-
children: /* @__PURE__ */
|
|
3456
|
+
children: /* @__PURE__ */ jsx25(ArrowUpward2, {})
|
|
3243
3457
|
}
|
|
3244
3458
|
) })
|
|
3245
3459
|
]
|
|
@@ -3248,7 +3462,7 @@ function SortComponent({ children }) {
|
|
|
3248
3462
|
}
|
|
3249
3463
|
|
|
3250
3464
|
// src/components/columnHeader.tsx
|
|
3251
|
-
import { jsx as
|
|
3465
|
+
import { jsx as jsx26, jsxs as jsxs14 } from "@emotion/react/jsx-runtime";
|
|
3252
3466
|
var ColumnHeaderContext = new StoreScope({
|
|
3253
3467
|
items: /* @__PURE__ */ new Map()
|
|
3254
3468
|
});
|
|
@@ -3411,18 +3625,18 @@ function ColumnHeader() {
|
|
|
3411
3625
|
onPointerMove: enabled ? onPointerMove : void 0,
|
|
3412
3626
|
onPointerUp: enabled ? onPointerUp : void 0,
|
|
3413
3627
|
children: [
|
|
3414
|
-
/* @__PURE__ */
|
|
3415
|
-
/* @__PURE__ */
|
|
3416
|
-
/* @__PURE__ */
|
|
3417
|
-
/* @__PURE__ */
|
|
3628
|
+
/* @__PURE__ */ jsx26(SortComponent, { children: header }),
|
|
3629
|
+
/* @__PURE__ */ jsx26("div", { css: { flex: 1 } }),
|
|
3630
|
+
/* @__PURE__ */ jsx26(FilterControl, {}),
|
|
3631
|
+
/* @__PURE__ */ jsx26(ResizeHandle, {})
|
|
3418
3632
|
]
|
|
3419
3633
|
}
|
|
3420
3634
|
);
|
|
3421
3635
|
}
|
|
3422
3636
|
|
|
3423
3637
|
// src/components/columnSelection.tsx
|
|
3424
|
-
import { useContext as useContext7, useState as
|
|
3425
|
-
import { Fragment as
|
|
3638
|
+
import { useContext as useContext7, useState as useState12 } from "react";
|
|
3639
|
+
import { Fragment as Fragment6, jsx as jsx27, jsxs as jsxs15 } from "@emotion/react/jsx-runtime";
|
|
3426
3640
|
function ColumnSelection() {
|
|
3427
3641
|
const IconButton2 = useTheme((t) => t.components.IconButton);
|
|
3428
3642
|
const Popover2 = useTheme((t) => t.components.Popover);
|
|
@@ -3439,7 +3653,7 @@ function ColumnSelection() {
|
|
|
3439
3653
|
const reset = useContext7(TableResetContext);
|
|
3440
3654
|
const columns = table.useState((state) => state.props.columns);
|
|
3441
3655
|
const hiddenColumns = table.useState((state) => state.hiddenColumns);
|
|
3442
|
-
const [anchorElement, setAnchorElement] =
|
|
3656
|
+
const [anchorElement, setAnchorElement] = useState12(null);
|
|
3443
3657
|
const toggle2 = (column, state) => {
|
|
3444
3658
|
const {
|
|
3445
3659
|
props: { hiddenColumns: controlledHiddenColumns, onHiddenColumnsChange }
|
|
@@ -3460,9 +3674,9 @@ function ColumnSelection() {
|
|
|
3460
3674
|
onHiddenColumnsChange == null ? void 0 : onHiddenColumnsChange(newValue);
|
|
3461
3675
|
};
|
|
3462
3676
|
const allVisible = columns.every((column) => !hiddenColumns.has(column.id));
|
|
3463
|
-
return /* @__PURE__ */ jsxs15(
|
|
3464
|
-
/* @__PURE__ */
|
|
3465
|
-
/* @__PURE__ */
|
|
3677
|
+
return /* @__PURE__ */ jsxs15(Fragment6, { children: [
|
|
3678
|
+
/* @__PURE__ */ jsx27(IconButton2, { onClick: (event) => setAnchorElement(anchorElement ? null : event.currentTarget), children: /* @__PURE__ */ jsx27(Settings2, {}) }),
|
|
3679
|
+
/* @__PURE__ */ jsx27(
|
|
3466
3680
|
Popover2,
|
|
3467
3681
|
{
|
|
3468
3682
|
anchorEl: anchorElement,
|
|
@@ -3472,17 +3686,17 @@ function ColumnSelection() {
|
|
|
3472
3686
|
className: classes == null ? void 0 : classes.popover,
|
|
3473
3687
|
backdropClassName: classes == null ? void 0 : classes.popoverBackdrop,
|
|
3474
3688
|
children: /* @__PURE__ */ jsxs15("div", { css: { padding: `calc(var(--spacing) * 2)`, display: "grid" }, children: [
|
|
3475
|
-
/* @__PURE__ */
|
|
3689
|
+
/* @__PURE__ */ jsx27("div", { css: { marginBottom: "var(--spacing)" }, children: selectColumns }),
|
|
3476
3690
|
/* @__PURE__ */ jsxs15("div", { css: { margin: "0.5em 0", display: "flex", gap: "0.5em" }, children: [
|
|
3477
|
-
/* @__PURE__ */
|
|
3478
|
-
/* @__PURE__ */
|
|
3691
|
+
/* @__PURE__ */ jsx27(Button2, { variant: "outlined", onClick: () => toggle2(void 0, !allVisible), children: allVisible ? hideAll : showAll }),
|
|
3692
|
+
/* @__PURE__ */ jsx27(Button2, { variant: "outlined", onClick: reset, children: resetAll })
|
|
3479
3693
|
] }),
|
|
3480
3694
|
columns.map((column) => {
|
|
3481
3695
|
var _a;
|
|
3482
|
-
return /* @__PURE__ */
|
|
3696
|
+
return /* @__PURE__ */ jsx27(
|
|
3483
3697
|
FormControlLabel,
|
|
3484
3698
|
{
|
|
3485
|
-
control: /* @__PURE__ */
|
|
3699
|
+
control: /* @__PURE__ */ jsx27(
|
|
3486
3700
|
Checkbox2,
|
|
3487
3701
|
{
|
|
3488
3702
|
checked: !((_a = column.hidden) != null ? _a : hiddenColumns.has(column.id)),
|
|
@@ -3502,8 +3716,8 @@ function ColumnSelection() {
|
|
|
3502
3716
|
}
|
|
3503
3717
|
|
|
3504
3718
|
// src/components/export.tsx
|
|
3505
|
-
import { useContext as useContext8, useState as
|
|
3506
|
-
import { Fragment as
|
|
3719
|
+
import { useContext as useContext8, useState as useState13 } from "react";
|
|
3720
|
+
import { Fragment as Fragment7, jsx as jsx28, jsxs as jsxs16 } from "@emotion/react/jsx-runtime";
|
|
3507
3721
|
function Export2() {
|
|
3508
3722
|
const { exporters: contextExporters } = useContext8(TableSettingsContext);
|
|
3509
3723
|
const table = useTableContext();
|
|
@@ -3526,7 +3740,7 @@ function Export2() {
|
|
|
3526
3740
|
}
|
|
3527
3741
|
return state.props.enableExport;
|
|
3528
3742
|
});
|
|
3529
|
-
const [anchor, setAnchor] =
|
|
3743
|
+
const [anchor, setAnchor] = useState13(null);
|
|
3530
3744
|
function execute({ action, exporter }) {
|
|
3531
3745
|
const { activeColumns, activeItems, items } = table.getState();
|
|
3532
3746
|
const columns = activeColumns.map((column) => column.exportHeader);
|
|
@@ -3548,9 +3762,9 @@ function Export2() {
|
|
|
3548
3762
|
URL.revokeObjectURL(url);
|
|
3549
3763
|
}
|
|
3550
3764
|
}
|
|
3551
|
-
return /* @__PURE__ */ jsxs16(
|
|
3552
|
-
/* @__PURE__ */
|
|
3553
|
-
/* @__PURE__ */
|
|
3765
|
+
return /* @__PURE__ */ jsxs16(Fragment7, { children: [
|
|
3766
|
+
/* @__PURE__ */ jsx28(IconButton2, { onClick: (event) => setAnchor(anchor ? null : event.currentTarget), children: /* @__PURE__ */ jsx28(ExportIcon, { css: !!anchor && { color: "var(--primaryMain)" } }) }),
|
|
3767
|
+
/* @__PURE__ */ jsx28(
|
|
3554
3768
|
Popover2,
|
|
3555
3769
|
{
|
|
3556
3770
|
open: !!anchor,
|
|
@@ -3572,11 +3786,11 @@ function Export2() {
|
|
|
3572
3786
|
}
|
|
3573
3787
|
},
|
|
3574
3788
|
children: [
|
|
3575
|
-
/* @__PURE__ */
|
|
3789
|
+
/* @__PURE__ */ jsx28("div", { css: { marginBottom: "var(--spacing)" }, children: exportTitle }),
|
|
3576
3790
|
exporters.map((entry, index) => /* @__PURE__ */ jsxs16(
|
|
3577
3791
|
Button2,
|
|
3578
3792
|
{
|
|
3579
|
-
startIcon: entry.action === "copy" ? /* @__PURE__ */
|
|
3793
|
+
startIcon: entry.action === "copy" ? /* @__PURE__ */ jsx28(Clipboard2, {}) : /* @__PURE__ */ jsx28(ExportIcon, {}),
|
|
3580
3794
|
onClick: () => execute(entry),
|
|
3581
3795
|
children: [
|
|
3582
3796
|
entry.action === "copy" ? exportCopy : exportDownload,
|
|
@@ -3617,10 +3831,10 @@ function calcCss(styles, item, index) {
|
|
|
3617
3831
|
|
|
3618
3832
|
// src/components/cell.tsx
|
|
3619
3833
|
import { memo, useLayoutEffect as useLayoutEffect3 } from "react";
|
|
3620
|
-
import { jsx as
|
|
3834
|
+
import { jsx as jsx29 } from "@emotion/react/jsx-runtime";
|
|
3621
3835
|
var defaultWrapCell = (content) => {
|
|
3622
3836
|
if (typeof content === "string") {
|
|
3623
|
-
return /* @__PURE__ */
|
|
3837
|
+
return /* @__PURE__ */ jsx29("span", { css: defaultClasses.text, title: content, children: content });
|
|
3624
3838
|
}
|
|
3625
3839
|
return content;
|
|
3626
3840
|
};
|
|
@@ -3644,21 +3858,21 @@ var Cell = memo(function Cell2({ itemId, rowIndex }) {
|
|
|
3644
3858
|
var _a2, _b;
|
|
3645
3859
|
return (_b = (_a2 = table.getState().props).debugRender) == null ? void 0 : _b.call(_a2, "render cell", itemId, columnId);
|
|
3646
3860
|
});
|
|
3647
|
-
const
|
|
3861
|
+
const className3 = useTheme((t) => cx(...calcClassNames(t.classes, item == null ? void 0 : item.value, rowIndex)));
|
|
3648
3862
|
const styles = useTheme((t) => calcCss(t.styles, item == null ? void 0 : item.value, rowIndex));
|
|
3649
3863
|
if (!column || !item) return null;
|
|
3650
3864
|
const content = column.renderCell(column.value(item.value), item.value);
|
|
3651
|
-
return /* @__PURE__ */
|
|
3865
|
+
return /* @__PURE__ */ jsx29("div", { className: className3, css: [defaultClasses.cell, styles], style: columnStyleOverride, children: wrapCell(content, column.value(item.value), item.value, rowIndex) });
|
|
3652
3866
|
});
|
|
3653
3867
|
|
|
3654
3868
|
// src/components/details.tsx
|
|
3655
3869
|
import { forwardRef } from "react";
|
|
3656
|
-
import { jsx as
|
|
3870
|
+
import { jsx as jsx30 } from "@emotion/react/jsx-runtime";
|
|
3657
3871
|
var Details = forwardRef(function Details2({ itemId, rowIndex }, ref) {
|
|
3658
3872
|
const table = useTableContext();
|
|
3659
3873
|
const classes = useTheme((t) => t.classes);
|
|
3660
3874
|
const styles = useTheme((t) => t.styles);
|
|
3661
|
-
const { details, className:
|
|
3875
|
+
const { details, className: className3, css: css3 } = table.useState((state) => {
|
|
3662
3876
|
const item = state.activeItemsById.get(itemId);
|
|
3663
3877
|
return {
|
|
3664
3878
|
details: state.expanded.has(itemId) ? state.props.rowDetails instanceof Function ? item ? state.props.rowDetails(item.value, rowIndex) : null : state.props.rowDetails : void 0,
|
|
@@ -3666,11 +3880,11 @@ var Details = forwardRef(function Details2({ itemId, rowIndex }, ref) {
|
|
|
3666
3880
|
css: (styles == null ? void 0 : styles.details) instanceof Function ? styles.details(item == null ? void 0 : item.value, rowIndex) : styles == null ? void 0 : styles.details
|
|
3667
3881
|
};
|
|
3668
3882
|
});
|
|
3669
|
-
return details ? /* @__PURE__ */
|
|
3883
|
+
return details ? /* @__PURE__ */ jsx30("div", { ref, className: className3, css: [defaultClasses.details, css3], children: details }) : null;
|
|
3670
3884
|
});
|
|
3671
3885
|
|
|
3672
3886
|
// src/components/expandControl.tsx
|
|
3673
|
-
import { jsx as
|
|
3887
|
+
import { jsx as jsx31 } from "@emotion/react/jsx-runtime";
|
|
3674
3888
|
function ExpandControl({
|
|
3675
3889
|
itemId,
|
|
3676
3890
|
hasDeferredChildren
|
|
@@ -3717,9 +3931,9 @@ function ExpandControl({
|
|
|
3717
3931
|
}
|
|
3718
3932
|
}
|
|
3719
3933
|
if (isExpanded && hasDeferredChildren && !hasChildren) {
|
|
3720
|
-
return /* @__PURE__ */
|
|
3934
|
+
return /* @__PURE__ */ jsx31(Spinner2, { css: { margin: "0 var(--spacing)" } });
|
|
3721
3935
|
}
|
|
3722
|
-
return /* @__PURE__ */
|
|
3936
|
+
return /* @__PURE__ */ jsx31(IconButton2, { onClick: toggle2, children: /* @__PURE__ */ jsx31(
|
|
3723
3937
|
"span",
|
|
3724
3938
|
{
|
|
3725
3939
|
css: {
|
|
@@ -3727,13 +3941,13 @@ function ExpandControl({
|
|
|
3727
3941
|
transition: "all 300ms",
|
|
3728
3942
|
transform: isExpanded ? "rotate3d(0, 0, 1, 90deg)" : "rotate3d(0, 0, 1, 0deg)"
|
|
3729
3943
|
},
|
|
3730
|
-
children: /* @__PURE__ */
|
|
3944
|
+
children: /* @__PURE__ */ jsx31(ChevronRight2, {})
|
|
3731
3945
|
}
|
|
3732
3946
|
) });
|
|
3733
3947
|
}
|
|
3734
3948
|
|
|
3735
3949
|
// src/components/selectComponent.tsx
|
|
3736
|
-
import { jsx as
|
|
3950
|
+
import { jsx as jsx32 } from "@emotion/react/jsx-runtime";
|
|
3737
3951
|
function SelectComponent({ itemId }) {
|
|
3738
3952
|
const table = useTableContext();
|
|
3739
3953
|
const Checkbox2 = useTheme((t) => t.components.Checkbox);
|
|
@@ -3782,7 +3996,7 @@ function SelectComponent({ itemId }) {
|
|
|
3782
3996
|
state.lastSelectedId = itemId;
|
|
3783
3997
|
});
|
|
3784
3998
|
}
|
|
3785
|
-
return /* @__PURE__ */
|
|
3999
|
+
return /* @__PURE__ */ jsx32(
|
|
3786
4000
|
Checkbox2,
|
|
3787
4001
|
{
|
|
3788
4002
|
css: {
|
|
@@ -3796,7 +4010,7 @@ function SelectComponent({ itemId }) {
|
|
|
3796
4010
|
}
|
|
3797
4011
|
|
|
3798
4012
|
// src/components/row.tsx
|
|
3799
|
-
import { Fragment as
|
|
4013
|
+
import { Fragment as Fragment8, jsx as jsx33, jsxs as jsxs17 } from "@emotion/react/jsx-runtime";
|
|
3800
4014
|
var Row = memo2(function Row2({
|
|
3801
4015
|
itemId,
|
|
3802
4016
|
rowIndex
|
|
@@ -3808,7 +4022,7 @@ var Row = memo2(function Row2({
|
|
|
3808
4022
|
const classes = useTheme((t) => t.classes);
|
|
3809
4023
|
const styles = useTheme((t) => t.styles);
|
|
3810
4024
|
const item = table.useState((state) => state.activeItemsById.get(itemId));
|
|
3811
|
-
const wrapRow = (_a = table.useState((state) => state.props.wrapRow)) != null ? _a : (props) => /* @__PURE__ */
|
|
4025
|
+
const wrapRow = (_a = table.useState((state) => state.props.wrapRow)) != null ? _a : (props) => /* @__PURE__ */ jsx33("div", __spreadValues({}, props));
|
|
3812
4026
|
const rowClassName = (classes == null ? void 0 : classes.row) instanceof Function ? classes.row(item == null ? void 0 : item.value, rowIndex) : classes == null ? void 0 : classes.row;
|
|
3813
4027
|
const rowStyles = (styles == null ? void 0 : styles.row) instanceof Function ? styles.row(item == null ? void 0 : item.value, rowIndex) : styles == null ? void 0 : styles.row;
|
|
3814
4028
|
const subgrid = table.useState((state) => state.props.subgrid);
|
|
@@ -3865,7 +4079,7 @@ var Row = memo2(function Row2({
|
|
|
3865
4079
|
if (!item) {
|
|
3866
4080
|
return null;
|
|
3867
4081
|
}
|
|
3868
|
-
return /* @__PURE__ */
|
|
4082
|
+
return /* @__PURE__ */ jsx33(ClassNames2, { children: ({ css: css3 }) => /* @__PURE__ */ jsx33(Fragment8, { children: wrapRow(
|
|
3869
4083
|
{
|
|
3870
4084
|
className: css3([
|
|
3871
4085
|
subgrid ? {
|
|
@@ -3878,8 +4092,8 @@ var Row = memo2(function Row2({
|
|
|
3878
4092
|
rowClassName,
|
|
3879
4093
|
rowStyles
|
|
3880
4094
|
]),
|
|
3881
|
-
children: /* @__PURE__ */ jsxs17(
|
|
3882
|
-
/* @__PURE__ */
|
|
4095
|
+
children: /* @__PURE__ */ jsxs17(Fragment8, { children: [
|
|
4096
|
+
/* @__PURE__ */ jsx33(
|
|
3883
4097
|
"div",
|
|
3884
4098
|
{
|
|
3885
4099
|
className: cellClassName,
|
|
@@ -3893,16 +4107,16 @@ var Row = memo2(function Row2({
|
|
|
3893
4107
|
className: cellClassName,
|
|
3894
4108
|
css: [defaultClasses.cell, defaultClasses.firstCell, css_],
|
|
3895
4109
|
children: [
|
|
3896
|
-
indent > 0 && /* @__PURE__ */
|
|
3897
|
-
enableSelection && /* @__PURE__ */
|
|
3898
|
-
(hasChildren || hasDeferredChildren || hasDetails) && /* @__PURE__ */
|
|
4110
|
+
indent > 0 && /* @__PURE__ */ jsx33("div", { css: { width: indent * 20 } }),
|
|
4111
|
+
enableSelection && /* @__PURE__ */ jsx33(SelectComponent, { itemId }),
|
|
4112
|
+
(hasChildren || hasDeferredChildren || hasDetails) && /* @__PURE__ */ jsx33(ExpandControl, { itemId, hasDeferredChildren }),
|
|
3899
4113
|
rowAction
|
|
3900
4114
|
]
|
|
3901
4115
|
}
|
|
3902
4116
|
),
|
|
3903
|
-
columnIds.map((columnId) => /* @__PURE__ */
|
|
3904
|
-
/* @__PURE__ */
|
|
3905
|
-
/* @__PURE__ */
|
|
4117
|
+
columnIds.map((columnId) => /* @__PURE__ */ jsx33(ColumnContext.Provider, { value: columnId, children: /* @__PURE__ */ jsx33(Cell, { itemId, rowIndex }) }, columnId)),
|
|
4118
|
+
/* @__PURE__ */ jsx33("div", { className: cellClassName, css: [defaultClasses.cellFill, css_] }),
|
|
4119
|
+
/* @__PURE__ */ jsx33(Details, { ref: detailsDivRef, itemId, rowIndex })
|
|
3906
4120
|
] })
|
|
3907
4121
|
},
|
|
3908
4122
|
item.value,
|
|
@@ -3911,8 +4125,8 @@ var Row = memo2(function Row2({
|
|
|
3911
4125
|
});
|
|
3912
4126
|
|
|
3913
4127
|
// src/components/virtualized.tsx
|
|
3914
|
-
import { useEffect as useEffect14, useLayoutEffect as useLayoutEffect5, useMemo as
|
|
3915
|
-
import { jsx as
|
|
4128
|
+
import { useEffect as useEffect14, useLayoutEffect as useLayoutEffect5, useMemo as useMemo11, useRef as useRef6, useState as useState14 } from "react";
|
|
4129
|
+
import { jsx as jsx34, jsxs as jsxs18 } from "@emotion/react/jsx-runtime";
|
|
3916
4130
|
var findScrollRoot = (x) => {
|
|
3917
4131
|
const parent = x.parentElement;
|
|
3918
4132
|
if (!parent) return document.documentElement;
|
|
@@ -3939,7 +4153,7 @@ function Virtualized(_a) {
|
|
|
3939
4153
|
const table = useTableContext();
|
|
3940
4154
|
const virtual = table.useState((state) => state.props.virtual);
|
|
3941
4155
|
const probeRef = useRef6(null);
|
|
3942
|
-
const [, setId] =
|
|
4156
|
+
const [, setId] = useState14({});
|
|
3943
4157
|
const {
|
|
3944
4158
|
itemIds = [],
|
|
3945
4159
|
from = 0,
|
|
@@ -3991,7 +4205,7 @@ function Virtualized(_a) {
|
|
|
3991
4205
|
{ throttle: 16 }
|
|
3992
4206
|
);
|
|
3993
4207
|
const throttleScroll = (_b2 = (_a2 = typeof virtual === "boolean" ? void 0 : virtual) == null ? void 0 : _a2.throttleScroll) != null ? _b2 : 16;
|
|
3994
|
-
const update =
|
|
4208
|
+
const update = useMemo11(() => throttle(() => setId({}), throttleScroll), [throttleScroll]);
|
|
3995
4209
|
useEffect14(() => {
|
|
3996
4210
|
var _a3;
|
|
3997
4211
|
const tableElem = (_a3 = probeRef.current) == null ? void 0 : _a3.parentElement;
|
|
@@ -4027,15 +4241,15 @@ function Virtualized(_a) {
|
|
|
4027
4241
|
);
|
|
4028
4242
|
return /* @__PURE__ */ jsxs18("div", __spreadProps(__spreadValues({}, props), { children: [
|
|
4029
4243
|
header,
|
|
4030
|
-
virtual && /* @__PURE__ */
|
|
4244
|
+
virtual && /* @__PURE__ */ jsx34("div", { style: { gridColumn: "1 / -1", height: before }, ref: probeRef }),
|
|
4031
4245
|
children(itemIds, from),
|
|
4032
|
-
virtual && /* @__PURE__ */
|
|
4246
|
+
virtual && /* @__PURE__ */ jsx34("div", { style: { gridColumn: "1 / -1", height: after } }),
|
|
4033
4247
|
footer
|
|
4034
4248
|
] }));
|
|
4035
4249
|
}
|
|
4036
4250
|
|
|
4037
4251
|
// src/components/table.tsx
|
|
4038
|
-
import { Fragment as
|
|
4252
|
+
import { Fragment as Fragment9, jsx as jsx35, jsxs as jsxs19 } from "@emotion/react/jsx-runtime";
|
|
4039
4253
|
function Table(props) {
|
|
4040
4254
|
const [table, resetState] = useTableState(props);
|
|
4041
4255
|
const [isHydrated, clearStorage] = useTableStateStorage(table);
|
|
@@ -4049,18 +4263,18 @@ function Table(props) {
|
|
|
4049
4263
|
var _a, _b;
|
|
4050
4264
|
return (_b = (_a = table.getState().props).debugRender) == null ? void 0 : _b.call(_a, "render table");
|
|
4051
4265
|
});
|
|
4052
|
-
return /* @__PURE__ */
|
|
4266
|
+
return /* @__PURE__ */ jsx35(TableContext.Provider, { value: table, children: /* @__PURE__ */ jsx35(TableResetContext.Provider, { value: reset, children: /* @__PURE__ */ jsx35(TableMemoContextProvider, { children: /* @__PURE__ */ jsx35(TableLoadingState, { isHydrated }) }) }) });
|
|
4053
4267
|
}
|
|
4054
4268
|
function TableLoadingState({ isHydrated }) {
|
|
4055
4269
|
const loadingText = useTheme((t) => t.text.loading);
|
|
4056
|
-
const [showLoading, setShowLoading] =
|
|
4270
|
+
const [showLoading, setShowLoading] = useState15(false);
|
|
4057
4271
|
useEffect15(() => {
|
|
4058
4272
|
const handle = setTimeout(() => setShowLoading(true), 500);
|
|
4059
4273
|
return () => clearTimeout(handle);
|
|
4060
4274
|
});
|
|
4061
|
-
return /* @__PURE__ */ jsxs19(
|
|
4062
|
-
!isHydrated && showLoading && /* @__PURE__ */
|
|
4063
|
-
/* @__PURE__ */
|
|
4275
|
+
return /* @__PURE__ */ jsxs19(Fragment9, { children: [
|
|
4276
|
+
!isHydrated && showLoading && /* @__PURE__ */ jsx35("div", { children: loadingText }),
|
|
4277
|
+
/* @__PURE__ */ jsx35(TableInner, { hidden: !isHydrated })
|
|
4064
4278
|
] });
|
|
4065
4279
|
}
|
|
4066
4280
|
var TableInner = memo3(function TableInner2({ hidden }) {
|
|
@@ -4101,7 +4315,7 @@ var TableInner = memo3(function TableInner2({ hidden }) {
|
|
|
4101
4315
|
var _a, _b;
|
|
4102
4316
|
return (_b = (_a = table.getState().props).debugRender) == null ? void 0 : _b.call(_a, "render table inner");
|
|
4103
4317
|
});
|
|
4104
|
-
return /* @__PURE__ */
|
|
4318
|
+
return /* @__PURE__ */ jsx35(
|
|
4105
4319
|
Virtualized,
|
|
4106
4320
|
{
|
|
4107
4321
|
className: classes == null ? void 0 : classes.table,
|
|
@@ -4120,8 +4334,8 @@ var TableInner = memo3(function TableInner2({ hidden }) {
|
|
|
4120
4334
|
fullWidth === "left" || fullWidth === true ? "auto" : "0"
|
|
4121
4335
|
].join(" ")
|
|
4122
4336
|
},
|
|
4123
|
-
header: /* @__PURE__ */ jsxs19(
|
|
4124
|
-
/* @__PURE__ */
|
|
4337
|
+
header: /* @__PURE__ */ jsxs19(Fragment9, { children: [
|
|
4338
|
+
/* @__PURE__ */ jsx35(
|
|
4125
4339
|
"div",
|
|
4126
4340
|
{
|
|
4127
4341
|
className: classes == null ? void 0 : classes.headerCell,
|
|
@@ -4146,18 +4360,18 @@ var TableInner = memo3(function TableInner2({ hidden }) {
|
|
|
4146
4360
|
styles == null ? void 0 : styles.headerCell
|
|
4147
4361
|
],
|
|
4148
4362
|
children: [
|
|
4149
|
-
enableSelection && /* @__PURE__ */
|
|
4150
|
-
enableColumnSelection && /* @__PURE__ */
|
|
4151
|
-
enableExport && /* @__PURE__ */
|
|
4152
|
-
(enableSelection || enableColumnSelection || enableExport) && /* @__PURE__ */ jsxs19(
|
|
4153
|
-
/* @__PURE__ */
|
|
4154
|
-
/* @__PURE__ */
|
|
4363
|
+
enableSelection && /* @__PURE__ */ jsx35(SelectComponent, {}),
|
|
4364
|
+
enableColumnSelection && /* @__PURE__ */ jsx35(ColumnSelection, {}),
|
|
4365
|
+
enableExport && /* @__PURE__ */ jsx35(Export2, {}),
|
|
4366
|
+
(enableSelection || enableColumnSelection || enableExport) && /* @__PURE__ */ jsxs19(Fragment9, { children: [
|
|
4367
|
+
/* @__PURE__ */ jsx35("div", { css: { flex: 1 } }),
|
|
4368
|
+
/* @__PURE__ */ jsx35(ResizeHandleView, {})
|
|
4155
4369
|
] })
|
|
4156
4370
|
]
|
|
4157
4371
|
}
|
|
4158
4372
|
),
|
|
4159
|
-
/* @__PURE__ */
|
|
4160
|
-
/* @__PURE__ */
|
|
4373
|
+
/* @__PURE__ */ jsx35(ColumnHeaderContext.Provider, { children: visibleColumns.map((column) => /* @__PURE__ */ jsx35(ColumnContext.Provider, { value: column.id, children: /* @__PURE__ */ jsx35(ColumnHeader, {}) }, column.id)) }),
|
|
4374
|
+
/* @__PURE__ */ jsx35(
|
|
4161
4375
|
"div",
|
|
4162
4376
|
{
|
|
4163
4377
|
className: classes == null ? void 0 : classes.headerCell,
|
|
@@ -4170,10 +4384,10 @@ var TableInner = memo3(function TableInner2({ hidden }) {
|
|
|
4170
4384
|
}
|
|
4171
4385
|
)
|
|
4172
4386
|
] }),
|
|
4173
|
-
footer: /* @__PURE__ */ jsxs19(
|
|
4174
|
-
enableClearFiltersButton && hasActiveFilters && /* @__PURE__ */
|
|
4175
|
-
hasFooter && /* @__PURE__ */ jsxs19(
|
|
4176
|
-
/* @__PURE__ */
|
|
4387
|
+
footer: /* @__PURE__ */ jsxs19(Fragment9, { children: [
|
|
4388
|
+
enableClearFiltersButton && hasActiveFilters && /* @__PURE__ */ jsx35(ClearFiltersButton, {}),
|
|
4389
|
+
hasFooter && /* @__PURE__ */ jsxs19(Fragment9, { children: [
|
|
4390
|
+
/* @__PURE__ */ jsx35(
|
|
4177
4391
|
"div",
|
|
4178
4392
|
{
|
|
4179
4393
|
className: classes == null ? void 0 : classes.footerCell,
|
|
@@ -4186,7 +4400,7 @@ var TableInner = memo3(function TableInner2({ hidden }) {
|
|
|
4186
4400
|
]
|
|
4187
4401
|
}
|
|
4188
4402
|
),
|
|
4189
|
-
/* @__PURE__ */
|
|
4403
|
+
/* @__PURE__ */ jsx35(
|
|
4190
4404
|
"div",
|
|
4191
4405
|
{
|
|
4192
4406
|
className: classes == null ? void 0 : classes.footerCell,
|
|
@@ -4198,8 +4412,8 @@ var TableInner = memo3(function TableInner2({ hidden }) {
|
|
|
4198
4412
|
]
|
|
4199
4413
|
}
|
|
4200
4414
|
),
|
|
4201
|
-
visibleColumns.map((column) => /* @__PURE__ */
|
|
4202
|
-
/* @__PURE__ */
|
|
4415
|
+
visibleColumns.map((column) => /* @__PURE__ */ jsx35(ColumnContext.Provider, { value: column.id, children: /* @__PURE__ */ jsx35(ColumnFooter, {}) }, column.id)),
|
|
4416
|
+
/* @__PURE__ */ jsx35(
|
|
4203
4417
|
"div",
|
|
4204
4418
|
{
|
|
4205
4419
|
className: classes == null ? void 0 : classes.footerCell,
|
|
@@ -4213,7 +4427,7 @@ var TableInner = memo3(function TableInner2({ hidden }) {
|
|
|
4213
4427
|
)
|
|
4214
4428
|
] })
|
|
4215
4429
|
] }),
|
|
4216
|
-
children: (itemIds, startIndex) => itemIds.map((itemId, index) => /* @__PURE__ */
|
|
4430
|
+
children: (itemIds, startIndex) => itemIds.map((itemId, index) => /* @__PURE__ */ jsx35(Row, { itemId, rowIndex: startIndex + index }, itemId))
|
|
4217
4431
|
}
|
|
4218
4432
|
);
|
|
4219
4433
|
});
|
|
@@ -4239,7 +4453,7 @@ var termMatch = (text, query) => {
|
|
|
4239
4453
|
};
|
|
4240
4454
|
|
|
4241
4455
|
// src/components/textFilter.tsx
|
|
4242
|
-
import { jsx as
|
|
4456
|
+
import { jsx as jsx36 } from "@emotion/react/jsx-runtime";
|
|
4243
4457
|
function TextFilter(_a) {
|
|
4244
4458
|
var _b = _a, {
|
|
4245
4459
|
compare = textMatch,
|
|
@@ -4263,19 +4477,19 @@ function TextFilter(_a) {
|
|
|
4263
4477
|
return compare(value2, filterValue);
|
|
4264
4478
|
}
|
|
4265
4479
|
}));
|
|
4266
|
-
return /* @__PURE__ */
|
|
4480
|
+
return /* @__PURE__ */ jsx36(
|
|
4267
4481
|
"div",
|
|
4268
4482
|
{
|
|
4269
4483
|
css: {
|
|
4270
4484
|
padding: `calc(var(--spacing) * 2)`,
|
|
4271
4485
|
display: "grid"
|
|
4272
4486
|
},
|
|
4273
|
-
children: /* @__PURE__ */
|
|
4487
|
+
children: /* @__PURE__ */ jsx36(
|
|
4274
4488
|
AutoFocusTextField,
|
|
4275
4489
|
{
|
|
4276
4490
|
value,
|
|
4277
4491
|
onChange: (event) => onChange(event.target.value),
|
|
4278
|
-
endIcon: /* @__PURE__ */
|
|
4492
|
+
endIcon: /* @__PURE__ */ jsx36(IconButton2, { onClick: () => onChange(""), children: !value ? /* @__PURE__ */ jsx36(Search2, {}) : /* @__PURE__ */ jsx36(Clear2, {}) }),
|
|
4279
4493
|
placeholder
|
|
4280
4494
|
}
|
|
4281
4495
|
)
|
|
@@ -4285,6 +4499,7 @@ function TextFilter(_a) {
|
|
|
4285
4499
|
export {
|
|
4286
4500
|
AutoFocusTextField,
|
|
4287
4501
|
ColumnContext,
|
|
4502
|
+
CombinedFilter,
|
|
4288
4503
|
DateFilter,
|
|
4289
4504
|
DatePicker,
|
|
4290
4505
|
DatePickerProvider,
|