schummar-table 0.44.1 → 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 +418 -281
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +337 -200
- 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;
|
|
@@ -1101,12 +1101,12 @@ function Filter(_a) {
|
|
|
1101
1101
|
// src/components/datePicker.tsx
|
|
1102
1102
|
import { useDayzed } from "dayzed";
|
|
1103
1103
|
import {
|
|
1104
|
-
Fragment as
|
|
1104
|
+
Fragment as Fragment4,
|
|
1105
1105
|
createContext as createContext4,
|
|
1106
1106
|
useContext as useContext6,
|
|
1107
1107
|
useEffect as useEffect2,
|
|
1108
|
-
useMemo as
|
|
1109
|
-
useState as
|
|
1108
|
+
useMemo as useMemo6,
|
|
1109
|
+
useState as useState6
|
|
1110
1110
|
} from "react";
|
|
1111
1111
|
|
|
1112
1112
|
// src/misc/defaults.ts
|
|
@@ -1146,11 +1146,7 @@ var tabNext = (event) => {
|
|
|
1146
1146
|
next.focus();
|
|
1147
1147
|
}
|
|
1148
1148
|
};
|
|
1149
|
-
function DateInput({
|
|
1150
|
-
value,
|
|
1151
|
-
onChange,
|
|
1152
|
-
locale
|
|
1153
|
-
}) {
|
|
1149
|
+
function DateInput({ value, onChange, locale }) {
|
|
1154
1150
|
const [override, setOverride] = useState4();
|
|
1155
1151
|
const commit = () => {
|
|
1156
1152
|
if (!override) {
|
|
@@ -1245,8 +1241,121 @@ function Text({ id }) {
|
|
|
1245
1241
|
return /* @__PURE__ */ jsx13(Fragment2, { children: text });
|
|
1246
1242
|
}
|
|
1247
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
|
+
);
|
|
1355
|
+
}
|
|
1356
|
+
|
|
1248
1357
|
// src/components/datePicker.tsx
|
|
1249
|
-
import { Fragment as
|
|
1358
|
+
import { Fragment as Fragment5, jsx as jsx15, jsxs as jsxs8 } from "@emotion/react/jsx-runtime";
|
|
1250
1359
|
var DatePickerContext = createContext4({});
|
|
1251
1360
|
function DatePickerProvider(_a) {
|
|
1252
1361
|
var _b = _a, {
|
|
@@ -1254,8 +1363,8 @@ function DatePickerProvider(_a) {
|
|
|
1254
1363
|
} = _b, props = __objRest(_b, [
|
|
1255
1364
|
"children"
|
|
1256
1365
|
]);
|
|
1257
|
-
const value =
|
|
1258
|
-
return /* @__PURE__ */
|
|
1366
|
+
const value = useMemo6(() => props, [JSON.stringify(props)]);
|
|
1367
|
+
return /* @__PURE__ */ jsx15(DatePickerContext.Provider, { value, children });
|
|
1259
1368
|
}
|
|
1260
1369
|
var weekDays = [0, 1, 2, 3, 4, 5, 6];
|
|
1261
1370
|
var startOfDay = (d) => new Date(d.getFullYear(), d.getMonth(), d.getDate());
|
|
@@ -1333,12 +1442,12 @@ var getCalendarWeek = (date) => {
|
|
|
1333
1442
|
return weekOfYear;
|
|
1334
1443
|
};
|
|
1335
1444
|
var commonQuickOptions = {
|
|
1336
|
-
today: { label: /* @__PURE__ */
|
|
1337
|
-
thisWeek: { label: /* @__PURE__ */
|
|
1338
|
-
thisMonth: { label: /* @__PURE__ */
|
|
1339
|
-
thisYear: { label: /* @__PURE__ */
|
|
1340
|
-
lastSevenDays: { label: /* @__PURE__ */
|
|
1341
|
-
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) }
|
|
1342
1451
|
};
|
|
1343
1452
|
function dateIntersect(a, b) {
|
|
1344
1453
|
if (a instanceof Date) {
|
|
@@ -1385,7 +1494,8 @@ function DatePicker(props) {
|
|
|
1385
1494
|
minDate,
|
|
1386
1495
|
maxDate,
|
|
1387
1496
|
showCalendarWeek,
|
|
1388
|
-
blockedRanges = []
|
|
1497
|
+
blockedRanges = [],
|
|
1498
|
+
showTime
|
|
1389
1499
|
} = defaults(props, context);
|
|
1390
1500
|
function onChange(value2, source) {
|
|
1391
1501
|
if (value2 instanceof Date) {
|
|
@@ -1453,10 +1563,10 @@ function DatePicker(props) {
|
|
|
1453
1563
|
}
|
|
1454
1564
|
];
|
|
1455
1565
|
}
|
|
1456
|
-
const mountTime =
|
|
1457
|
-
const [dirty, setDirty] =
|
|
1458
|
-
const [hovered, setHovered] =
|
|
1459
|
-
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);
|
|
1460
1570
|
const dateInView = (_a = props.dateInView) != null ? _a : dateInViewLocal;
|
|
1461
1571
|
function setDateInView(date) {
|
|
1462
1572
|
var _a2;
|
|
@@ -1467,7 +1577,7 @@ function DatePicker(props) {
|
|
|
1467
1577
|
const max = dirty ? dirty.max : value instanceof Date ? value : value == null ? void 0 : value.max;
|
|
1468
1578
|
const resolvedQuickOptions = [
|
|
1469
1579
|
...quickOptions,
|
|
1470
|
-
...noReset ? [] : [{ label: /* @__PURE__ */
|
|
1580
|
+
...noReset ? [] : [{ label: /* @__PURE__ */ jsx15(Text, { id: "reset" }), value: null }]
|
|
1471
1581
|
].map((option, index) => {
|
|
1472
1582
|
if (option instanceof Function) {
|
|
1473
1583
|
return option((value3) => {
|
|
@@ -1476,7 +1586,7 @@ function DatePicker(props) {
|
|
|
1476
1586
|
});
|
|
1477
1587
|
}
|
|
1478
1588
|
const { label, value: value2 } = typeof option === "string" ? commonQuickOptions[option] : option;
|
|
1479
|
-
return /* @__PURE__ */
|
|
1589
|
+
return /* @__PURE__ */ jsx15(
|
|
1480
1590
|
Button2,
|
|
1481
1591
|
{
|
|
1482
1592
|
variant: "text",
|
|
@@ -1507,8 +1617,8 @@ function DatePicker(props) {
|
|
|
1507
1617
|
minDate,
|
|
1508
1618
|
maxDate
|
|
1509
1619
|
});
|
|
1510
|
-
const now =
|
|
1511
|
-
const formatWeekday =
|
|
1620
|
+
const now = useMemo6(() => startOfDay(/* @__PURE__ */ new Date()), []);
|
|
1621
|
+
const formatWeekday = useMemo6(() => {
|
|
1512
1622
|
const { format } = new Intl.DateTimeFormat(locale, { weekday: "short" });
|
|
1513
1623
|
return (weekDay) => format(new Date(Date.UTC(2021, 7, (weekDay + firstDayOfWeek) % 7 + 1)));
|
|
1514
1624
|
}, [locale, firstDayOfWeek]);
|
|
@@ -1544,11 +1654,11 @@ function DatePicker(props) {
|
|
|
1544
1654
|
setDirty({ min: min2, max: max2 });
|
|
1545
1655
|
}
|
|
1546
1656
|
}
|
|
1547
|
-
const formatMonth =
|
|
1657
|
+
const formatMonth = useMemo6(() => {
|
|
1548
1658
|
const { format } = new Intl.DateTimeFormat(locale, { month: "long" });
|
|
1549
1659
|
return (month) => format(new Date(2021, month));
|
|
1550
1660
|
}, [locale]);
|
|
1551
|
-
const formatYear =
|
|
1661
|
+
const formatYear = useMemo6(() => {
|
|
1552
1662
|
const { format } = new Intl.DateTimeFormat(locale, { year: "numeric" });
|
|
1553
1663
|
return (year) => format(new Date(year, 0, 1));
|
|
1554
1664
|
}, [locale]);
|
|
@@ -1569,28 +1679,55 @@ function DatePicker(props) {
|
|
|
1569
1679
|
display: "grid",
|
|
1570
1680
|
gridAutoFlow: "column",
|
|
1571
1681
|
justifyContent: "center",
|
|
1572
|
-
alignItems: "
|
|
1573
|
-
gap: "var(--spacing)"
|
|
1682
|
+
alignItems: "center",
|
|
1683
|
+
gap: "calc(var(--spacing) * 4)",
|
|
1684
|
+
"& > div": {
|
|
1685
|
+
display: "flex",
|
|
1686
|
+
flexDirection: "column",
|
|
1687
|
+
alignItems: "center"
|
|
1688
|
+
}
|
|
1574
1689
|
},
|
|
1575
1690
|
children: [
|
|
1576
|
-
/* @__PURE__ */
|
|
1577
|
-
|
|
1578
|
-
{
|
|
1579
|
-
value: min != null ? min : null,
|
|
1580
|
-
onChange: (date) => set("input", date != null ? date : void 0, max, "min"),
|
|
1581
|
-
locale
|
|
1582
|
-
}
|
|
1583
|
-
),
|
|
1584
|
-
rangeSelect && /* @__PURE__ */ jsxs8(Fragment4, { children: [
|
|
1585
|
-
" - ",
|
|
1586
|
-
/* @__PURE__ */ jsx14(
|
|
1691
|
+
/* @__PURE__ */ jsxs8("div", { children: [
|
|
1692
|
+
/* @__PURE__ */ jsx15(
|
|
1587
1693
|
DateInput,
|
|
1588
1694
|
{
|
|
1589
|
-
value:
|
|
1590
|
-
onChange: (date) => set("input",
|
|
1695
|
+
value: min != null ? min : null,
|
|
1696
|
+
onChange: (date) => set("input", date != null ? date : void 0, max, "min"),
|
|
1591
1697
|
locale
|
|
1592
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
|
+
}
|
|
1593
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
|
+
] })
|
|
1594
1731
|
] })
|
|
1595
1732
|
]
|
|
1596
1733
|
}
|
|
@@ -1607,13 +1744,13 @@ function DatePicker(props) {
|
|
|
1607
1744
|
alignItems: "center"
|
|
1608
1745
|
},
|
|
1609
1746
|
children: [
|
|
1610
|
-
/* @__PURE__ */
|
|
1747
|
+
/* @__PURE__ */ jsx15(IconButton2, __spreadProps(__spreadValues({ type: "button" }, getBackProps({ calendars })), { children: /* @__PURE__ */ jsx15(ChevronRight2, { css: { transform: "rotate3d(0, 0, 1, 180deg)" } }) })),
|
|
1611
1748
|
/* @__PURE__ */ jsxs8("div", { css: { display: "flex" }, children: [
|
|
1612
1749
|
formatMonth(month),
|
|
1613
1750
|
" ",
|
|
1614
1751
|
formatYear(year)
|
|
1615
1752
|
] }),
|
|
1616
|
-
/* @__PURE__ */
|
|
1753
|
+
/* @__PURE__ */ jsx15(IconButton2, __spreadProps(__spreadValues({ type: "button" }, getForwardProps({ calendars })), { children: /* @__PURE__ */ jsx15(ChevronRight2, {}) }))
|
|
1617
1754
|
]
|
|
1618
1755
|
}
|
|
1619
1756
|
),
|
|
@@ -1626,7 +1763,7 @@ function DatePicker(props) {
|
|
|
1626
1763
|
gridTemplateColumns: "repeat(8, max-content)"
|
|
1627
1764
|
},
|
|
1628
1765
|
children: [
|
|
1629
|
-
showCalendarWeek ? /* @__PURE__ */
|
|
1766
|
+
showCalendarWeek ? /* @__PURE__ */ jsx15(
|
|
1630
1767
|
"div",
|
|
1631
1768
|
{
|
|
1632
1769
|
css: {
|
|
@@ -1634,10 +1771,10 @@ function DatePicker(props) {
|
|
|
1634
1771
|
padding: 10,
|
|
1635
1772
|
borderRight: "1px solid var(--date-picker-separator, var(--table-border, #bdbdbd))"
|
|
1636
1773
|
},
|
|
1637
|
-
children: /* @__PURE__ */
|
|
1774
|
+
children: /* @__PURE__ */ jsx15(Text, { id: "calendarWeek" })
|
|
1638
1775
|
}
|
|
1639
|
-
) : /* @__PURE__ */
|
|
1640
|
-
weekDays.map((_v, weekDay) => /* @__PURE__ */
|
|
1776
|
+
) : /* @__PURE__ */ jsx15("div", {}),
|
|
1777
|
+
weekDays.map((_v, weekDay) => /* @__PURE__ */ jsx15(
|
|
1641
1778
|
"div",
|
|
1642
1779
|
{
|
|
1643
1780
|
css: {
|
|
@@ -1652,8 +1789,8 @@ function DatePicker(props) {
|
|
|
1652
1789
|
const weekStart = week[0];
|
|
1653
1790
|
const weekEnd = week[6];
|
|
1654
1791
|
const weekDisabled = !rangeSelect || minDate && weekEnd.date < minDate || maxDate && weekStart.date > maxDate;
|
|
1655
|
-
return /* @__PURE__ */ jsxs8(
|
|
1656
|
-
showCalendarWeek ? /* @__PURE__ */
|
|
1792
|
+
return /* @__PURE__ */ jsxs8(Fragment4, { children: [
|
|
1793
|
+
showCalendarWeek ? /* @__PURE__ */ jsx15(
|
|
1657
1794
|
"button",
|
|
1658
1795
|
{
|
|
1659
1796
|
type: "button",
|
|
@@ -1678,10 +1815,10 @@ function DatePicker(props) {
|
|
|
1678
1815
|
onPointerOut: () => !weekDisabled && setHovered(void 0),
|
|
1679
1816
|
children: getCalendarWeek(weekEnd.date)
|
|
1680
1817
|
}
|
|
1681
|
-
) : /* @__PURE__ */
|
|
1818
|
+
) : /* @__PURE__ */ jsx15("div", {}),
|
|
1682
1819
|
week.map((dateObject, dayIndex) => {
|
|
1683
1820
|
if (!dateObject) {
|
|
1684
|
-
return /* @__PURE__ */
|
|
1821
|
+
return /* @__PURE__ */ jsx15("div", {}, dayIndex);
|
|
1685
1822
|
}
|
|
1686
1823
|
const { prevMonth, nextMonth, date } = dateObject;
|
|
1687
1824
|
const today2 = startOfDay(date).getTime() === now.getTime();
|
|
@@ -1692,7 +1829,7 @@ function DatePicker(props) {
|
|
|
1692
1829
|
min <= hovered.min ? { min, max: hovered.min } : { min: hovered.max, max: min }
|
|
1693
1830
|
));
|
|
1694
1831
|
const blocked = blockedRanges.some((range) => dateIntersect(date, range));
|
|
1695
|
-
return /* @__PURE__ */
|
|
1832
|
+
return /* @__PURE__ */ jsx15(
|
|
1696
1833
|
"button",
|
|
1697
1834
|
__spreadProps(__spreadValues({
|
|
1698
1835
|
type: "button",
|
|
@@ -1728,7 +1865,7 @@ function DatePicker(props) {
|
|
|
1728
1865
|
}
|
|
1729
1866
|
)
|
|
1730
1867
|
] }, `${month}${year}`)),
|
|
1731
|
-
/* @__PURE__ */
|
|
1868
|
+
/* @__PURE__ */ jsx15(
|
|
1732
1869
|
"div",
|
|
1733
1870
|
{
|
|
1734
1871
|
css: {
|
|
@@ -1746,7 +1883,7 @@ function DatePicker(props) {
|
|
|
1746
1883
|
}
|
|
1747
1884
|
|
|
1748
1885
|
// src/components/dateFilter.tsx
|
|
1749
|
-
import { jsx as
|
|
1886
|
+
import { jsx as jsx16 } from "@emotion/react/jsx-runtime";
|
|
1750
1887
|
function convertDate(x) {
|
|
1751
1888
|
if (x instanceof Date) return x;
|
|
1752
1889
|
if (typeof x === "number" || typeof x === "string") return new Date(x);
|
|
@@ -1798,14 +1935,14 @@ function DateFilter(_a) {
|
|
|
1798
1935
|
return dateIntersect(filterValue, value2);
|
|
1799
1936
|
}
|
|
1800
1937
|
}));
|
|
1801
|
-
return /* @__PURE__ */
|
|
1938
|
+
return /* @__PURE__ */ jsx16(
|
|
1802
1939
|
"div",
|
|
1803
1940
|
{
|
|
1804
1941
|
css: {
|
|
1805
1942
|
padding: "calc(var(--spacing) * 2)",
|
|
1806
1943
|
display: "grid"
|
|
1807
1944
|
},
|
|
1808
|
-
children: /* @__PURE__ */
|
|
1945
|
+
children: /* @__PURE__ */ jsx16(
|
|
1809
1946
|
DatePicker,
|
|
1810
1947
|
{
|
|
1811
1948
|
rangeSelect: !singleSelect,
|
|
@@ -1825,8 +1962,8 @@ function DateFilter(_a) {
|
|
|
1825
1962
|
}
|
|
1826
1963
|
|
|
1827
1964
|
// src/components/numberField.tsx
|
|
1828
|
-
import { useState as
|
|
1829
|
-
import { jsx as
|
|
1965
|
+
import { useState as useState7 } from "react";
|
|
1966
|
+
import { jsx as jsx17 } from "@emotion/react/jsx-runtime";
|
|
1830
1967
|
var Pattern = /^-?\d*(?:[.,]\d*)?$/;
|
|
1831
1968
|
var printNumber = (value, locale) => {
|
|
1832
1969
|
if (value === null) {
|
|
@@ -1851,8 +1988,8 @@ function NumberField(_a) {
|
|
|
1851
1988
|
]);
|
|
1852
1989
|
const locale = useTheme((t) => t.locale);
|
|
1853
1990
|
const TextField2 = useTheme((t) => t.components.TextField);
|
|
1854
|
-
const [value = printNumber(commitedValue, locale), setValue] =
|
|
1855
|
-
return /* @__PURE__ */
|
|
1991
|
+
const [value = printNumber(commitedValue, locale), setValue] = useState7();
|
|
1992
|
+
return /* @__PURE__ */ jsx17(
|
|
1856
1993
|
TextField2,
|
|
1857
1994
|
__spreadProps(__spreadValues({
|
|
1858
1995
|
value,
|
|
@@ -1877,7 +2014,7 @@ function NumberField(_a) {
|
|
|
1877
2014
|
}
|
|
1878
2015
|
|
|
1879
2016
|
// src/components/rangeFilter.tsx
|
|
1880
|
-
import { jsx as
|
|
2017
|
+
import { jsx as jsx18, jsxs as jsxs9 } from "@emotion/react/jsx-runtime";
|
|
1881
2018
|
function RangeFilter(_a) {
|
|
1882
2019
|
var _b = _a, {
|
|
1883
2020
|
min,
|
|
@@ -1931,7 +2068,7 @@ function RangeFilter(_a) {
|
|
|
1931
2068
|
return value2 !== null && value2 >= min2 && value2 <= max2;
|
|
1932
2069
|
}
|
|
1933
2070
|
}));
|
|
1934
|
-
return /* @__PURE__ */
|
|
2071
|
+
return /* @__PURE__ */ jsx18(
|
|
1935
2072
|
"div",
|
|
1936
2073
|
{
|
|
1937
2074
|
css: {
|
|
@@ -1951,12 +2088,12 @@ function RangeFilter(_a) {
|
|
|
1951
2088
|
}
|
|
1952
2089
|
},
|
|
1953
2090
|
children: [
|
|
1954
|
-
/* @__PURE__ */
|
|
2091
|
+
/* @__PURE__ */ jsx18(
|
|
1955
2092
|
NumberField,
|
|
1956
2093
|
{
|
|
1957
2094
|
value: value == null ? void 0 : value[0],
|
|
1958
2095
|
onChange: (newMin) => onChange(normalize(newMin, value == null ? void 0 : value[1], "min", { min, max })),
|
|
1959
|
-
startIcon: /* @__PURE__ */
|
|
2096
|
+
startIcon: /* @__PURE__ */ jsx18("span", { css: { margin: "0 calc(var(--spacing) * 2)" }, children: rangeMinText }),
|
|
1960
2097
|
placeholder: String(minValue != null ? minValue : ""),
|
|
1961
2098
|
css: {
|
|
1962
2099
|
alignItems: "baseline"
|
|
@@ -1964,12 +2101,12 @@ function RangeFilter(_a) {
|
|
|
1964
2101
|
}
|
|
1965
2102
|
),
|
|
1966
2103
|
"-",
|
|
1967
|
-
/* @__PURE__ */
|
|
2104
|
+
/* @__PURE__ */ jsx18(
|
|
1968
2105
|
NumberField,
|
|
1969
2106
|
{
|
|
1970
2107
|
value: value == null ? void 0 : value[1],
|
|
1971
2108
|
onChange: (newMax) => onChange(normalize(value == null ? void 0 : value[0], newMax, "max", { min, max })),
|
|
1972
|
-
startIcon: /* @__PURE__ */
|
|
2109
|
+
startIcon: /* @__PURE__ */ jsx18("span", { css: { margin: "0 calc(var(--spacing) * 2)" }, children: rangeMaxText }),
|
|
1973
2110
|
placeholder: String(maxValue != null ? maxValue : ""),
|
|
1974
2111
|
css: {
|
|
1975
2112
|
alignItems: "baseline"
|
|
@@ -1999,10 +2136,10 @@ function clamp(value, min = Number.NEGATIVE_INFINITY, max = Number.POSITIVE_INFI
|
|
|
1999
2136
|
}
|
|
2000
2137
|
|
|
2001
2138
|
// src/components/selectFilter.tsx
|
|
2002
|
-
import { useEffect as useEffect4, useMemo as
|
|
2139
|
+
import { useEffect as useEffect4, useMemo as useMemo8, useState as useState9 } from "react";
|
|
2003
2140
|
|
|
2004
2141
|
// src/components/formControlLabel.tsx
|
|
2005
|
-
import { jsx as
|
|
2142
|
+
import { jsx as jsx19, jsxs as jsxs10 } from "@emotion/react/jsx-runtime";
|
|
2006
2143
|
function FormControlLabel({
|
|
2007
2144
|
control,
|
|
2008
2145
|
label,
|
|
@@ -2025,14 +2162,14 @@ function FormControlLabel({
|
|
|
2025
2162
|
],
|
|
2026
2163
|
children: [
|
|
2027
2164
|
control,
|
|
2028
|
-
/* @__PURE__ */
|
|
2165
|
+
/* @__PURE__ */ jsx19("span", { css: { marginLeft: "var(--spacing)" }, children: label })
|
|
2029
2166
|
]
|
|
2030
2167
|
}
|
|
2031
2168
|
);
|
|
2032
2169
|
}
|
|
2033
2170
|
|
|
2034
2171
|
// src/components/virtualList.tsx
|
|
2035
|
-
import { useEffect as useEffect3, useMemo as
|
|
2172
|
+
import { useEffect as useEffect3, useMemo as useMemo7, useRef as useRef3, useState as useState8 } from "react";
|
|
2036
2173
|
|
|
2037
2174
|
// src/misc/throttle.ts
|
|
2038
2175
|
function throttle(function_, ms) {
|
|
@@ -2073,7 +2210,7 @@ function throttle(function_, ms) {
|
|
|
2073
2210
|
}
|
|
2074
2211
|
|
|
2075
2212
|
// src/components/virtualList.tsx
|
|
2076
|
-
import { jsx as
|
|
2213
|
+
import { jsx as jsx20, jsxs as jsxs11 } from "@emotion/react/jsx-runtime";
|
|
2077
2214
|
function VirtualList(_a) {
|
|
2078
2215
|
var _b = _a, {
|
|
2079
2216
|
virtual = true,
|
|
@@ -2086,9 +2223,9 @@ function VirtualList(_a) {
|
|
|
2086
2223
|
]);
|
|
2087
2224
|
var _a2, _b2, _c, _d, _e;
|
|
2088
2225
|
const container = useRef3(null);
|
|
2089
|
-
const [, setId] =
|
|
2226
|
+
const [, setId] = useState8({});
|
|
2090
2227
|
const throttleScroll = (_b2 = (_a2 = typeof virtual === "boolean" ? void 0 : virtual) == null ? void 0 : _a2.throttleScroll) != null ? _b2 : 16;
|
|
2091
|
-
const update =
|
|
2228
|
+
const update = useMemo7(() => throttle(() => setId({}), throttleScroll), [throttleScroll]);
|
|
2092
2229
|
useEffect3(() => {
|
|
2093
2230
|
if (!virtual) return;
|
|
2094
2231
|
const ro = new ResizeObserver(update);
|
|
@@ -2103,7 +2240,7 @@ function VirtualList(_a) {
|
|
|
2103
2240
|
};
|
|
2104
2241
|
}, [update, virtual, throttleScroll]);
|
|
2105
2242
|
if (!virtual) {
|
|
2106
|
-
return /* @__PURE__ */
|
|
2243
|
+
return /* @__PURE__ */ jsx20(
|
|
2107
2244
|
"div",
|
|
2108
2245
|
__spreadProps(__spreadValues({}, props), {
|
|
2109
2246
|
css: {
|
|
@@ -2148,9 +2285,9 @@ function VirtualList(_a) {
|
|
|
2148
2285
|
display: "grid"
|
|
2149
2286
|
},
|
|
2150
2287
|
children: [
|
|
2151
|
-
/* @__PURE__ */
|
|
2288
|
+
/* @__PURE__ */ jsx20("div", { "data-virtual-before": true, style: { height: before } }),
|
|
2152
2289
|
items.slice(from, to).map((item, index) => children(item, index + from)),
|
|
2153
|
-
/* @__PURE__ */
|
|
2290
|
+
/* @__PURE__ */ jsx20("div", { "data-virtual-after": true, style: { height: after } })
|
|
2154
2291
|
]
|
|
2155
2292
|
})
|
|
2156
2293
|
);
|
|
@@ -2164,7 +2301,7 @@ function averageItemHeight(container) {
|
|
|
2164
2301
|
}
|
|
2165
2302
|
|
|
2166
2303
|
// src/components/selectFilter.tsx
|
|
2167
|
-
import { jsx as
|
|
2304
|
+
import { jsx as jsx21, jsxs as jsxs12 } from "@emotion/react/jsx-runtime";
|
|
2168
2305
|
function toggle(set, value, singleSelect) {
|
|
2169
2306
|
const newSet = new Set(singleSelect ? [] : set);
|
|
2170
2307
|
if (set.has(value)) {
|
|
@@ -2222,11 +2359,11 @@ function SelectFilter(_a) {
|
|
|
2222
2359
|
)
|
|
2223
2360
|
);
|
|
2224
2361
|
});
|
|
2225
|
-
const [query, setQuery] =
|
|
2362
|
+
const [query, setQuery] = useState9("");
|
|
2226
2363
|
const filtered = options.filter(
|
|
2227
2364
|
(option) => !query || stringValue(option).toLowerCase().includes(query.toLowerCase())
|
|
2228
2365
|
);
|
|
2229
|
-
const delayedValue =
|
|
2366
|
+
const delayedValue = useMemo8(() => value, [isActive]);
|
|
2230
2367
|
const ordered = filtered.filter((option) => delayedValue.has(option)).concat(filtered.filter((option) => !delayedValue.has(option)));
|
|
2231
2368
|
const Button2 = useTheme((t) => t.components.Button);
|
|
2232
2369
|
useEffect4(() => {
|
|
@@ -2242,16 +2379,16 @@ function SelectFilter(_a) {
|
|
|
2242
2379
|
gap: "var(--spacing)"
|
|
2243
2380
|
},
|
|
2244
2381
|
children: [
|
|
2245
|
-
!hideSearchField && /* @__PURE__ */
|
|
2382
|
+
!hideSearchField && /* @__PURE__ */ jsx21(
|
|
2246
2383
|
AutoFocusTextField,
|
|
2247
2384
|
{
|
|
2248
2385
|
value: query,
|
|
2249
2386
|
onChange: (event) => setQuery(event.target.value),
|
|
2250
|
-
endIcon: /* @__PURE__ */
|
|
2387
|
+
endIcon: /* @__PURE__ */ jsx21(IconButton2, { onClick: () => setQuery(""), children: !query ? /* @__PURE__ */ jsx21(Search2, {}) : /* @__PURE__ */ jsx21(Clear2, {}) }),
|
|
2251
2388
|
css: { marginBottom: "var(--spacing)" }
|
|
2252
2389
|
}
|
|
2253
2390
|
),
|
|
2254
|
-
!hideResetButton && /* @__PURE__ */
|
|
2391
|
+
!hideResetButton && /* @__PURE__ */ jsx21(
|
|
2255
2392
|
Button2,
|
|
2256
2393
|
{
|
|
2257
2394
|
disabled: value.size === 0,
|
|
@@ -2266,7 +2403,7 @@ function SelectFilter(_a) {
|
|
|
2266
2403
|
children: deselectAll
|
|
2267
2404
|
}
|
|
2268
2405
|
),
|
|
2269
|
-
/* @__PURE__ */
|
|
2406
|
+
/* @__PURE__ */ jsx21(
|
|
2270
2407
|
VirtualList,
|
|
2271
2408
|
{
|
|
2272
2409
|
items: ordered,
|
|
@@ -2278,10 +2415,10 @@ function SelectFilter(_a) {
|
|
|
2278
2415
|
display: "grid",
|
|
2279
2416
|
gridTemplateColumns: "minmax(0, 1fr)"
|
|
2280
2417
|
},
|
|
2281
|
-
children: (option, index) => /* @__PURE__ */
|
|
2418
|
+
children: (option, index) => /* @__PURE__ */ jsx21(
|
|
2282
2419
|
FormControlLabel,
|
|
2283
2420
|
{
|
|
2284
|
-
control: /* @__PURE__ */
|
|
2421
|
+
control: /* @__PURE__ */ jsx21(
|
|
2285
2422
|
Checkbox2,
|
|
2286
2423
|
{
|
|
2287
2424
|
checked: value.has(option),
|
|
@@ -2294,17 +2431,17 @@ function SelectFilter(_a) {
|
|
|
2294
2431
|
)
|
|
2295
2432
|
}
|
|
2296
2433
|
),
|
|
2297
|
-
ordered.length === 0 && /* @__PURE__ */
|
|
2434
|
+
ordered.length === 0 && /* @__PURE__ */ jsx21("span", { css: { textAlign: "center" }, children: noResults })
|
|
2298
2435
|
]
|
|
2299
2436
|
}
|
|
2300
2437
|
);
|
|
2301
2438
|
}
|
|
2302
2439
|
|
|
2303
2440
|
// src/components/table.tsx
|
|
2304
|
-
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";
|
|
2305
2442
|
|
|
2306
2443
|
// src/internalState/tableStateStorage.ts
|
|
2307
|
-
import { useEffect as useEffect5, useState as
|
|
2444
|
+
import { useEffect as useEffect5, useState as useState10 } from "react";
|
|
2308
2445
|
|
|
2309
2446
|
// src/misc/queue.ts
|
|
2310
2447
|
var Queue = class {
|
|
@@ -2388,8 +2525,8 @@ function parse(value) {
|
|
|
2388
2525
|
});
|
|
2389
2526
|
}
|
|
2390
2527
|
function useTableStateStorage(table) {
|
|
2391
|
-
const [isHydrated, setIsHydrated] =
|
|
2392
|
-
const [q] =
|
|
2528
|
+
const [isHydrated, setIsHydrated] = useState10(false);
|
|
2529
|
+
const [q] = useState10(() => new Queue());
|
|
2393
2530
|
useEffect5(() => {
|
|
2394
2531
|
const { persist } = table.getState().props;
|
|
2395
2532
|
if (!persist) {
|
|
@@ -2511,7 +2648,7 @@ function useTableStateStorage(table) {
|
|
|
2511
2648
|
|
|
2512
2649
|
// src/internalState/useTableState.ts
|
|
2513
2650
|
import { castDraft as castDraft4 } from "immer";
|
|
2514
|
-
import { useEffect as useEffect12, useMemo as
|
|
2651
|
+
import { useEffect as useEffect12, useMemo as useMemo10, useState as useState11 } from "react";
|
|
2515
2652
|
|
|
2516
2653
|
// src/internalState/calcItems.ts
|
|
2517
2654
|
import { castDraft as castDraft2 } from "immer";
|
|
@@ -2636,7 +2773,7 @@ function calcItems(state) {
|
|
|
2636
2773
|
}
|
|
2637
2774
|
|
|
2638
2775
|
// src/internalState/calcProps.ts
|
|
2639
|
-
import { useMemo as
|
|
2776
|
+
import { useMemo as useMemo9 } from "react";
|
|
2640
2777
|
|
|
2641
2778
|
// src/exporters/serializer.ts
|
|
2642
2779
|
function defaultSerializer(x) {
|
|
@@ -2685,7 +2822,7 @@ var defaultProps = {
|
|
|
2685
2822
|
};
|
|
2686
2823
|
function calcProps(props) {
|
|
2687
2824
|
const cache = useTableMemo();
|
|
2688
|
-
return
|
|
2825
|
+
return useMemo9(
|
|
2689
2826
|
() => overrides(defaultProps, calc(props, cache)),
|
|
2690
2827
|
[props]
|
|
2691
2828
|
);
|
|
@@ -3007,7 +3144,7 @@ function watchDisplaySize(state) {
|
|
|
3007
3144
|
|
|
3008
3145
|
// src/internalState/useTableState.ts
|
|
3009
3146
|
function useTableState(_props) {
|
|
3010
|
-
const [key, setKey] =
|
|
3147
|
+
const [key, setKey] = useState11({});
|
|
3011
3148
|
const props = calcProps(_props);
|
|
3012
3149
|
function reset() {
|
|
3013
3150
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
@@ -3026,7 +3163,7 @@ function useTableState(_props) {
|
|
|
3026
3163
|
}
|
|
3027
3164
|
(_i = props.onReset) == null ? void 0 : _i.call(props, "table");
|
|
3028
3165
|
}
|
|
3029
|
-
const state =
|
|
3166
|
+
const state = useMemo10(
|
|
3030
3167
|
() => {
|
|
3031
3168
|
var _a, _b, _c, _d;
|
|
3032
3169
|
return new Store({
|
|
@@ -3081,12 +3218,12 @@ function useTableState(_props) {
|
|
|
3081
3218
|
}
|
|
3082
3219
|
|
|
3083
3220
|
// src/components/clearFiltersButton.tsx
|
|
3084
|
-
import { jsx as
|
|
3221
|
+
import { jsx as jsx22 } from "@emotion/react/jsx-runtime";
|
|
3085
3222
|
function ClearFiltersButton() {
|
|
3086
3223
|
const Button2 = useTheme((t) => t.components.Button);
|
|
3087
3224
|
const textClearFilters = useTheme((t) => t.text.clearFilters);
|
|
3088
3225
|
const table = useTableContext();
|
|
3089
|
-
return /* @__PURE__ */
|
|
3226
|
+
return /* @__PURE__ */ jsx22("div", { css: defaultClasses.clearFiltersButton, children: /* @__PURE__ */ jsx22(
|
|
3090
3227
|
Button2,
|
|
3091
3228
|
{
|
|
3092
3229
|
variant: "outlined",
|
|
@@ -3105,7 +3242,7 @@ function ClearFiltersButton() {
|
|
|
3105
3242
|
}
|
|
3106
3243
|
|
|
3107
3244
|
// src/components/columnFooter.tsx
|
|
3108
|
-
import { jsx as
|
|
3245
|
+
import { jsx as jsx23 } from "@emotion/react/jsx-runtime";
|
|
3109
3246
|
function ColumnFooter() {
|
|
3110
3247
|
const table = useTableContext();
|
|
3111
3248
|
const columnId = useColumnContext();
|
|
@@ -3137,7 +3274,7 @@ function ColumnFooter() {
|
|
|
3137
3274
|
const column = state.activeColumns.find((column2) => column2.id === columnId);
|
|
3138
3275
|
return column == null ? void 0 : column.footer;
|
|
3139
3276
|
});
|
|
3140
|
-
return /* @__PURE__ */
|
|
3277
|
+
return /* @__PURE__ */ jsx23(
|
|
3141
3278
|
"div",
|
|
3142
3279
|
{
|
|
3143
3280
|
className: cx(classes, columnClasses),
|
|
@@ -3159,7 +3296,7 @@ import { castDraft as castDraft5 } from "immer";
|
|
|
3159
3296
|
import { useEffect as useEffect13, useRef as useRef4 } from "react";
|
|
3160
3297
|
|
|
3161
3298
|
// src/components/resizeHandle.tsx
|
|
3162
|
-
import { jsx as
|
|
3299
|
+
import { jsx as jsx24 } from "@emotion/react/jsx-runtime";
|
|
3163
3300
|
function ResizeHandle() {
|
|
3164
3301
|
const table = useTableContext();
|
|
3165
3302
|
const columnId = useColumnContext();
|
|
@@ -3196,7 +3333,7 @@ function ResizeHandle() {
|
|
|
3196
3333
|
if (!enabled) {
|
|
3197
3334
|
return null;
|
|
3198
3335
|
}
|
|
3199
|
-
return /* @__PURE__ */
|
|
3336
|
+
return /* @__PURE__ */ jsx24(
|
|
3200
3337
|
ResizeHandleView,
|
|
3201
3338
|
{
|
|
3202
3339
|
enabled,
|
|
@@ -3213,7 +3350,7 @@ function ResizeHandleView(_a) {
|
|
|
3213
3350
|
} = _b, props = __objRest(_b, [
|
|
3214
3351
|
"enabled"
|
|
3215
3352
|
]);
|
|
3216
|
-
const
|
|
3353
|
+
const className3 = useTheme((theme) => {
|
|
3217
3354
|
var _a2;
|
|
3218
3355
|
return (_a2 = theme.classes) == null ? void 0 : _a2.columnDivider;
|
|
3219
3356
|
});
|
|
@@ -3221,10 +3358,10 @@ function ResizeHandleView(_a) {
|
|
|
3221
3358
|
var _a2;
|
|
3222
3359
|
return (_a2 = theme.styles) == null ? void 0 : _a2.columnDivider;
|
|
3223
3360
|
});
|
|
3224
|
-
return /* @__PURE__ */
|
|
3361
|
+
return /* @__PURE__ */ jsx24(
|
|
3225
3362
|
"div",
|
|
3226
3363
|
__spreadValues({
|
|
3227
|
-
className:
|
|
3364
|
+
className: className3,
|
|
3228
3365
|
css: [
|
|
3229
3366
|
{
|
|
3230
3367
|
alignSelf: "stretch",
|
|
@@ -3250,7 +3387,7 @@ function ResizeHandleView(_a) {
|
|
|
3250
3387
|
}
|
|
3251
3388
|
|
|
3252
3389
|
// src/components/sortComponent.tsx
|
|
3253
|
-
import { jsx as
|
|
3390
|
+
import { jsx as jsx25, jsxs as jsxs13 } from "@emotion/react/jsx-runtime";
|
|
3254
3391
|
function SortComponent({ children }) {
|
|
3255
3392
|
const table = useTableContext();
|
|
3256
3393
|
const columnId = useColumnContext();
|
|
@@ -3307,8 +3444,8 @@ function SortComponent({ children }) {
|
|
|
3307
3444
|
onClick: (event) => toggle2(event),
|
|
3308
3445
|
onContextMenu: (event) => toggle2(event, true),
|
|
3309
3446
|
children: [
|
|
3310
|
-
/* @__PURE__ */
|
|
3311
|
-
/* @__PURE__ */
|
|
3447
|
+
/* @__PURE__ */ jsx25("div", { children }),
|
|
3448
|
+
/* @__PURE__ */ jsx25(Badge2, { badgeContent: sortDisabled ? 0 : index, children: /* @__PURE__ */ jsx25(
|
|
3312
3449
|
"span",
|
|
3313
3450
|
{
|
|
3314
3451
|
css: [
|
|
@@ -3316,7 +3453,7 @@ function SortComponent({ children }) {
|
|
|
3316
3453
|
!direction && { opacity: 0 },
|
|
3317
3454
|
direction === "desc" && { transform: "rotate3d(0, 0, 1, 180deg)" }
|
|
3318
3455
|
],
|
|
3319
|
-
children: /* @__PURE__ */
|
|
3456
|
+
children: /* @__PURE__ */ jsx25(ArrowUpward2, {})
|
|
3320
3457
|
}
|
|
3321
3458
|
) })
|
|
3322
3459
|
]
|
|
@@ -3325,7 +3462,7 @@ function SortComponent({ children }) {
|
|
|
3325
3462
|
}
|
|
3326
3463
|
|
|
3327
3464
|
// src/components/columnHeader.tsx
|
|
3328
|
-
import { jsx as
|
|
3465
|
+
import { jsx as jsx26, jsxs as jsxs14 } from "@emotion/react/jsx-runtime";
|
|
3329
3466
|
var ColumnHeaderContext = new StoreScope({
|
|
3330
3467
|
items: /* @__PURE__ */ new Map()
|
|
3331
3468
|
});
|
|
@@ -3488,18 +3625,18 @@ function ColumnHeader() {
|
|
|
3488
3625
|
onPointerMove: enabled ? onPointerMove : void 0,
|
|
3489
3626
|
onPointerUp: enabled ? onPointerUp : void 0,
|
|
3490
3627
|
children: [
|
|
3491
|
-
/* @__PURE__ */
|
|
3492
|
-
/* @__PURE__ */
|
|
3493
|
-
/* @__PURE__ */
|
|
3494
|
-
/* @__PURE__ */
|
|
3628
|
+
/* @__PURE__ */ jsx26(SortComponent, { children: header }),
|
|
3629
|
+
/* @__PURE__ */ jsx26("div", { css: { flex: 1 } }),
|
|
3630
|
+
/* @__PURE__ */ jsx26(FilterControl, {}),
|
|
3631
|
+
/* @__PURE__ */ jsx26(ResizeHandle, {})
|
|
3495
3632
|
]
|
|
3496
3633
|
}
|
|
3497
3634
|
);
|
|
3498
3635
|
}
|
|
3499
3636
|
|
|
3500
3637
|
// src/components/columnSelection.tsx
|
|
3501
|
-
import { useContext as useContext7, useState as
|
|
3502
|
-
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";
|
|
3503
3640
|
function ColumnSelection() {
|
|
3504
3641
|
const IconButton2 = useTheme((t) => t.components.IconButton);
|
|
3505
3642
|
const Popover2 = useTheme((t) => t.components.Popover);
|
|
@@ -3516,7 +3653,7 @@ function ColumnSelection() {
|
|
|
3516
3653
|
const reset = useContext7(TableResetContext);
|
|
3517
3654
|
const columns = table.useState((state) => state.props.columns);
|
|
3518
3655
|
const hiddenColumns = table.useState((state) => state.hiddenColumns);
|
|
3519
|
-
const [anchorElement, setAnchorElement] =
|
|
3656
|
+
const [anchorElement, setAnchorElement] = useState12(null);
|
|
3520
3657
|
const toggle2 = (column, state) => {
|
|
3521
3658
|
const {
|
|
3522
3659
|
props: { hiddenColumns: controlledHiddenColumns, onHiddenColumnsChange }
|
|
@@ -3537,9 +3674,9 @@ function ColumnSelection() {
|
|
|
3537
3674
|
onHiddenColumnsChange == null ? void 0 : onHiddenColumnsChange(newValue);
|
|
3538
3675
|
};
|
|
3539
3676
|
const allVisible = columns.every((column) => !hiddenColumns.has(column.id));
|
|
3540
|
-
return /* @__PURE__ */ jsxs15(
|
|
3541
|
-
/* @__PURE__ */
|
|
3542
|
-
/* @__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(
|
|
3543
3680
|
Popover2,
|
|
3544
3681
|
{
|
|
3545
3682
|
anchorEl: anchorElement,
|
|
@@ -3549,17 +3686,17 @@ function ColumnSelection() {
|
|
|
3549
3686
|
className: classes == null ? void 0 : classes.popover,
|
|
3550
3687
|
backdropClassName: classes == null ? void 0 : classes.popoverBackdrop,
|
|
3551
3688
|
children: /* @__PURE__ */ jsxs15("div", { css: { padding: `calc(var(--spacing) * 2)`, display: "grid" }, children: [
|
|
3552
|
-
/* @__PURE__ */
|
|
3689
|
+
/* @__PURE__ */ jsx27("div", { css: { marginBottom: "var(--spacing)" }, children: selectColumns }),
|
|
3553
3690
|
/* @__PURE__ */ jsxs15("div", { css: { margin: "0.5em 0", display: "flex", gap: "0.5em" }, children: [
|
|
3554
|
-
/* @__PURE__ */
|
|
3555
|
-
/* @__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 })
|
|
3556
3693
|
] }),
|
|
3557
3694
|
columns.map((column) => {
|
|
3558
3695
|
var _a;
|
|
3559
|
-
return /* @__PURE__ */
|
|
3696
|
+
return /* @__PURE__ */ jsx27(
|
|
3560
3697
|
FormControlLabel,
|
|
3561
3698
|
{
|
|
3562
|
-
control: /* @__PURE__ */
|
|
3699
|
+
control: /* @__PURE__ */ jsx27(
|
|
3563
3700
|
Checkbox2,
|
|
3564
3701
|
{
|
|
3565
3702
|
checked: !((_a = column.hidden) != null ? _a : hiddenColumns.has(column.id)),
|
|
@@ -3579,8 +3716,8 @@ function ColumnSelection() {
|
|
|
3579
3716
|
}
|
|
3580
3717
|
|
|
3581
3718
|
// src/components/export.tsx
|
|
3582
|
-
import { useContext as useContext8, useState as
|
|
3583
|
-
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";
|
|
3584
3721
|
function Export2() {
|
|
3585
3722
|
const { exporters: contextExporters } = useContext8(TableSettingsContext);
|
|
3586
3723
|
const table = useTableContext();
|
|
@@ -3603,7 +3740,7 @@ function Export2() {
|
|
|
3603
3740
|
}
|
|
3604
3741
|
return state.props.enableExport;
|
|
3605
3742
|
});
|
|
3606
|
-
const [anchor, setAnchor] =
|
|
3743
|
+
const [anchor, setAnchor] = useState13(null);
|
|
3607
3744
|
function execute({ action, exporter }) {
|
|
3608
3745
|
const { activeColumns, activeItems, items } = table.getState();
|
|
3609
3746
|
const columns = activeColumns.map((column) => column.exportHeader);
|
|
@@ -3625,9 +3762,9 @@ function Export2() {
|
|
|
3625
3762
|
URL.revokeObjectURL(url);
|
|
3626
3763
|
}
|
|
3627
3764
|
}
|
|
3628
|
-
return /* @__PURE__ */ jsxs16(
|
|
3629
|
-
/* @__PURE__ */
|
|
3630
|
-
/* @__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(
|
|
3631
3768
|
Popover2,
|
|
3632
3769
|
{
|
|
3633
3770
|
open: !!anchor,
|
|
@@ -3649,11 +3786,11 @@ function Export2() {
|
|
|
3649
3786
|
}
|
|
3650
3787
|
},
|
|
3651
3788
|
children: [
|
|
3652
|
-
/* @__PURE__ */
|
|
3789
|
+
/* @__PURE__ */ jsx28("div", { css: { marginBottom: "var(--spacing)" }, children: exportTitle }),
|
|
3653
3790
|
exporters.map((entry, index) => /* @__PURE__ */ jsxs16(
|
|
3654
3791
|
Button2,
|
|
3655
3792
|
{
|
|
3656
|
-
startIcon: entry.action === "copy" ? /* @__PURE__ */
|
|
3793
|
+
startIcon: entry.action === "copy" ? /* @__PURE__ */ jsx28(Clipboard2, {}) : /* @__PURE__ */ jsx28(ExportIcon, {}),
|
|
3657
3794
|
onClick: () => execute(entry),
|
|
3658
3795
|
children: [
|
|
3659
3796
|
entry.action === "copy" ? exportCopy : exportDownload,
|
|
@@ -3694,10 +3831,10 @@ function calcCss(styles, item, index) {
|
|
|
3694
3831
|
|
|
3695
3832
|
// src/components/cell.tsx
|
|
3696
3833
|
import { memo, useLayoutEffect as useLayoutEffect3 } from "react";
|
|
3697
|
-
import { jsx as
|
|
3834
|
+
import { jsx as jsx29 } from "@emotion/react/jsx-runtime";
|
|
3698
3835
|
var defaultWrapCell = (content) => {
|
|
3699
3836
|
if (typeof content === "string") {
|
|
3700
|
-
return /* @__PURE__ */
|
|
3837
|
+
return /* @__PURE__ */ jsx29("span", { css: defaultClasses.text, title: content, children: content });
|
|
3701
3838
|
}
|
|
3702
3839
|
return content;
|
|
3703
3840
|
};
|
|
@@ -3721,21 +3858,21 @@ var Cell = memo(function Cell2({ itemId, rowIndex }) {
|
|
|
3721
3858
|
var _a2, _b;
|
|
3722
3859
|
return (_b = (_a2 = table.getState().props).debugRender) == null ? void 0 : _b.call(_a2, "render cell", itemId, columnId);
|
|
3723
3860
|
});
|
|
3724
|
-
const
|
|
3861
|
+
const className3 = useTheme((t) => cx(...calcClassNames(t.classes, item == null ? void 0 : item.value, rowIndex)));
|
|
3725
3862
|
const styles = useTheme((t) => calcCss(t.styles, item == null ? void 0 : item.value, rowIndex));
|
|
3726
3863
|
if (!column || !item) return null;
|
|
3727
3864
|
const content = column.renderCell(column.value(item.value), item.value);
|
|
3728
|
-
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) });
|
|
3729
3866
|
});
|
|
3730
3867
|
|
|
3731
3868
|
// src/components/details.tsx
|
|
3732
3869
|
import { forwardRef } from "react";
|
|
3733
|
-
import { jsx as
|
|
3870
|
+
import { jsx as jsx30 } from "@emotion/react/jsx-runtime";
|
|
3734
3871
|
var Details = forwardRef(function Details2({ itemId, rowIndex }, ref) {
|
|
3735
3872
|
const table = useTableContext();
|
|
3736
3873
|
const classes = useTheme((t) => t.classes);
|
|
3737
3874
|
const styles = useTheme((t) => t.styles);
|
|
3738
|
-
const { details, className:
|
|
3875
|
+
const { details, className: className3, css: css3 } = table.useState((state) => {
|
|
3739
3876
|
const item = state.activeItemsById.get(itemId);
|
|
3740
3877
|
return {
|
|
3741
3878
|
details: state.expanded.has(itemId) ? state.props.rowDetails instanceof Function ? item ? state.props.rowDetails(item.value, rowIndex) : null : state.props.rowDetails : void 0,
|
|
@@ -3743,11 +3880,11 @@ var Details = forwardRef(function Details2({ itemId, rowIndex }, ref) {
|
|
|
3743
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
|
|
3744
3881
|
};
|
|
3745
3882
|
});
|
|
3746
|
-
return details ? /* @__PURE__ */
|
|
3883
|
+
return details ? /* @__PURE__ */ jsx30("div", { ref, className: className3, css: [defaultClasses.details, css3], children: details }) : null;
|
|
3747
3884
|
});
|
|
3748
3885
|
|
|
3749
3886
|
// src/components/expandControl.tsx
|
|
3750
|
-
import { jsx as
|
|
3887
|
+
import { jsx as jsx31 } from "@emotion/react/jsx-runtime";
|
|
3751
3888
|
function ExpandControl({
|
|
3752
3889
|
itemId,
|
|
3753
3890
|
hasDeferredChildren
|
|
@@ -3794,9 +3931,9 @@ function ExpandControl({
|
|
|
3794
3931
|
}
|
|
3795
3932
|
}
|
|
3796
3933
|
if (isExpanded && hasDeferredChildren && !hasChildren) {
|
|
3797
|
-
return /* @__PURE__ */
|
|
3934
|
+
return /* @__PURE__ */ jsx31(Spinner2, { css: { margin: "0 var(--spacing)" } });
|
|
3798
3935
|
}
|
|
3799
|
-
return /* @__PURE__ */
|
|
3936
|
+
return /* @__PURE__ */ jsx31(IconButton2, { onClick: toggle2, children: /* @__PURE__ */ jsx31(
|
|
3800
3937
|
"span",
|
|
3801
3938
|
{
|
|
3802
3939
|
css: {
|
|
@@ -3804,13 +3941,13 @@ function ExpandControl({
|
|
|
3804
3941
|
transition: "all 300ms",
|
|
3805
3942
|
transform: isExpanded ? "rotate3d(0, 0, 1, 90deg)" : "rotate3d(0, 0, 1, 0deg)"
|
|
3806
3943
|
},
|
|
3807
|
-
children: /* @__PURE__ */
|
|
3944
|
+
children: /* @__PURE__ */ jsx31(ChevronRight2, {})
|
|
3808
3945
|
}
|
|
3809
3946
|
) });
|
|
3810
3947
|
}
|
|
3811
3948
|
|
|
3812
3949
|
// src/components/selectComponent.tsx
|
|
3813
|
-
import { jsx as
|
|
3950
|
+
import { jsx as jsx32 } from "@emotion/react/jsx-runtime";
|
|
3814
3951
|
function SelectComponent({ itemId }) {
|
|
3815
3952
|
const table = useTableContext();
|
|
3816
3953
|
const Checkbox2 = useTheme((t) => t.components.Checkbox);
|
|
@@ -3859,7 +3996,7 @@ function SelectComponent({ itemId }) {
|
|
|
3859
3996
|
state.lastSelectedId = itemId;
|
|
3860
3997
|
});
|
|
3861
3998
|
}
|
|
3862
|
-
return /* @__PURE__ */
|
|
3999
|
+
return /* @__PURE__ */ jsx32(
|
|
3863
4000
|
Checkbox2,
|
|
3864
4001
|
{
|
|
3865
4002
|
css: {
|
|
@@ -3873,7 +4010,7 @@ function SelectComponent({ itemId }) {
|
|
|
3873
4010
|
}
|
|
3874
4011
|
|
|
3875
4012
|
// src/components/row.tsx
|
|
3876
|
-
import { Fragment as
|
|
4013
|
+
import { Fragment as Fragment8, jsx as jsx33, jsxs as jsxs17 } from "@emotion/react/jsx-runtime";
|
|
3877
4014
|
var Row = memo2(function Row2({
|
|
3878
4015
|
itemId,
|
|
3879
4016
|
rowIndex
|
|
@@ -3885,7 +4022,7 @@ var Row = memo2(function Row2({
|
|
|
3885
4022
|
const classes = useTheme((t) => t.classes);
|
|
3886
4023
|
const styles = useTheme((t) => t.styles);
|
|
3887
4024
|
const item = table.useState((state) => state.activeItemsById.get(itemId));
|
|
3888
|
-
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));
|
|
3889
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;
|
|
3890
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;
|
|
3891
4028
|
const subgrid = table.useState((state) => state.props.subgrid);
|
|
@@ -3942,7 +4079,7 @@ var Row = memo2(function Row2({
|
|
|
3942
4079
|
if (!item) {
|
|
3943
4080
|
return null;
|
|
3944
4081
|
}
|
|
3945
|
-
return /* @__PURE__ */
|
|
4082
|
+
return /* @__PURE__ */ jsx33(ClassNames2, { children: ({ css: css3 }) => /* @__PURE__ */ jsx33(Fragment8, { children: wrapRow(
|
|
3946
4083
|
{
|
|
3947
4084
|
className: css3([
|
|
3948
4085
|
subgrid ? {
|
|
@@ -3955,8 +4092,8 @@ var Row = memo2(function Row2({
|
|
|
3955
4092
|
rowClassName,
|
|
3956
4093
|
rowStyles
|
|
3957
4094
|
]),
|
|
3958
|
-
children: /* @__PURE__ */ jsxs17(
|
|
3959
|
-
/* @__PURE__ */
|
|
4095
|
+
children: /* @__PURE__ */ jsxs17(Fragment8, { children: [
|
|
4096
|
+
/* @__PURE__ */ jsx33(
|
|
3960
4097
|
"div",
|
|
3961
4098
|
{
|
|
3962
4099
|
className: cellClassName,
|
|
@@ -3970,16 +4107,16 @@ var Row = memo2(function Row2({
|
|
|
3970
4107
|
className: cellClassName,
|
|
3971
4108
|
css: [defaultClasses.cell, defaultClasses.firstCell, css_],
|
|
3972
4109
|
children: [
|
|
3973
|
-
indent > 0 && /* @__PURE__ */
|
|
3974
|
-
enableSelection && /* @__PURE__ */
|
|
3975
|
-
(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 }),
|
|
3976
4113
|
rowAction
|
|
3977
4114
|
]
|
|
3978
4115
|
}
|
|
3979
4116
|
),
|
|
3980
|
-
columnIds.map((columnId) => /* @__PURE__ */
|
|
3981
|
-
/* @__PURE__ */
|
|
3982
|
-
/* @__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 })
|
|
3983
4120
|
] })
|
|
3984
4121
|
},
|
|
3985
4122
|
item.value,
|
|
@@ -3988,8 +4125,8 @@ var Row = memo2(function Row2({
|
|
|
3988
4125
|
});
|
|
3989
4126
|
|
|
3990
4127
|
// src/components/virtualized.tsx
|
|
3991
|
-
import { useEffect as useEffect14, useLayoutEffect as useLayoutEffect5, useMemo as
|
|
3992
|
-
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";
|
|
3993
4130
|
var findScrollRoot = (x) => {
|
|
3994
4131
|
const parent = x.parentElement;
|
|
3995
4132
|
if (!parent) return document.documentElement;
|
|
@@ -4016,7 +4153,7 @@ function Virtualized(_a) {
|
|
|
4016
4153
|
const table = useTableContext();
|
|
4017
4154
|
const virtual = table.useState((state) => state.props.virtual);
|
|
4018
4155
|
const probeRef = useRef6(null);
|
|
4019
|
-
const [, setId] =
|
|
4156
|
+
const [, setId] = useState14({});
|
|
4020
4157
|
const {
|
|
4021
4158
|
itemIds = [],
|
|
4022
4159
|
from = 0,
|
|
@@ -4068,7 +4205,7 @@ function Virtualized(_a) {
|
|
|
4068
4205
|
{ throttle: 16 }
|
|
4069
4206
|
);
|
|
4070
4207
|
const throttleScroll = (_b2 = (_a2 = typeof virtual === "boolean" ? void 0 : virtual) == null ? void 0 : _a2.throttleScroll) != null ? _b2 : 16;
|
|
4071
|
-
const update =
|
|
4208
|
+
const update = useMemo11(() => throttle(() => setId({}), throttleScroll), [throttleScroll]);
|
|
4072
4209
|
useEffect14(() => {
|
|
4073
4210
|
var _a3;
|
|
4074
4211
|
const tableElem = (_a3 = probeRef.current) == null ? void 0 : _a3.parentElement;
|
|
@@ -4104,15 +4241,15 @@ function Virtualized(_a) {
|
|
|
4104
4241
|
);
|
|
4105
4242
|
return /* @__PURE__ */ jsxs18("div", __spreadProps(__spreadValues({}, props), { children: [
|
|
4106
4243
|
header,
|
|
4107
|
-
virtual && /* @__PURE__ */
|
|
4244
|
+
virtual && /* @__PURE__ */ jsx34("div", { style: { gridColumn: "1 / -1", height: before }, ref: probeRef }),
|
|
4108
4245
|
children(itemIds, from),
|
|
4109
|
-
virtual && /* @__PURE__ */
|
|
4246
|
+
virtual && /* @__PURE__ */ jsx34("div", { style: { gridColumn: "1 / -1", height: after } }),
|
|
4110
4247
|
footer
|
|
4111
4248
|
] }));
|
|
4112
4249
|
}
|
|
4113
4250
|
|
|
4114
4251
|
// src/components/table.tsx
|
|
4115
|
-
import { Fragment as
|
|
4252
|
+
import { Fragment as Fragment9, jsx as jsx35, jsxs as jsxs19 } from "@emotion/react/jsx-runtime";
|
|
4116
4253
|
function Table(props) {
|
|
4117
4254
|
const [table, resetState] = useTableState(props);
|
|
4118
4255
|
const [isHydrated, clearStorage] = useTableStateStorage(table);
|
|
@@ -4126,18 +4263,18 @@ function Table(props) {
|
|
|
4126
4263
|
var _a, _b;
|
|
4127
4264
|
return (_b = (_a = table.getState().props).debugRender) == null ? void 0 : _b.call(_a, "render table");
|
|
4128
4265
|
});
|
|
4129
|
-
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 }) }) }) });
|
|
4130
4267
|
}
|
|
4131
4268
|
function TableLoadingState({ isHydrated }) {
|
|
4132
4269
|
const loadingText = useTheme((t) => t.text.loading);
|
|
4133
|
-
const [showLoading, setShowLoading] =
|
|
4270
|
+
const [showLoading, setShowLoading] = useState15(false);
|
|
4134
4271
|
useEffect15(() => {
|
|
4135
4272
|
const handle = setTimeout(() => setShowLoading(true), 500);
|
|
4136
4273
|
return () => clearTimeout(handle);
|
|
4137
4274
|
});
|
|
4138
|
-
return /* @__PURE__ */ jsxs19(
|
|
4139
|
-
!isHydrated && showLoading && /* @__PURE__ */
|
|
4140
|
-
/* @__PURE__ */
|
|
4275
|
+
return /* @__PURE__ */ jsxs19(Fragment9, { children: [
|
|
4276
|
+
!isHydrated && showLoading && /* @__PURE__ */ jsx35("div", { children: loadingText }),
|
|
4277
|
+
/* @__PURE__ */ jsx35(TableInner, { hidden: !isHydrated })
|
|
4141
4278
|
] });
|
|
4142
4279
|
}
|
|
4143
4280
|
var TableInner = memo3(function TableInner2({ hidden }) {
|
|
@@ -4178,7 +4315,7 @@ var TableInner = memo3(function TableInner2({ hidden }) {
|
|
|
4178
4315
|
var _a, _b;
|
|
4179
4316
|
return (_b = (_a = table.getState().props).debugRender) == null ? void 0 : _b.call(_a, "render table inner");
|
|
4180
4317
|
});
|
|
4181
|
-
return /* @__PURE__ */
|
|
4318
|
+
return /* @__PURE__ */ jsx35(
|
|
4182
4319
|
Virtualized,
|
|
4183
4320
|
{
|
|
4184
4321
|
className: classes == null ? void 0 : classes.table,
|
|
@@ -4197,8 +4334,8 @@ var TableInner = memo3(function TableInner2({ hidden }) {
|
|
|
4197
4334
|
fullWidth === "left" || fullWidth === true ? "auto" : "0"
|
|
4198
4335
|
].join(" ")
|
|
4199
4336
|
},
|
|
4200
|
-
header: /* @__PURE__ */ jsxs19(
|
|
4201
|
-
/* @__PURE__ */
|
|
4337
|
+
header: /* @__PURE__ */ jsxs19(Fragment9, { children: [
|
|
4338
|
+
/* @__PURE__ */ jsx35(
|
|
4202
4339
|
"div",
|
|
4203
4340
|
{
|
|
4204
4341
|
className: classes == null ? void 0 : classes.headerCell,
|
|
@@ -4223,18 +4360,18 @@ var TableInner = memo3(function TableInner2({ hidden }) {
|
|
|
4223
4360
|
styles == null ? void 0 : styles.headerCell
|
|
4224
4361
|
],
|
|
4225
4362
|
children: [
|
|
4226
|
-
enableSelection && /* @__PURE__ */
|
|
4227
|
-
enableColumnSelection && /* @__PURE__ */
|
|
4228
|
-
enableExport && /* @__PURE__ */
|
|
4229
|
-
(enableSelection || enableColumnSelection || enableExport) && /* @__PURE__ */ jsxs19(
|
|
4230
|
-
/* @__PURE__ */
|
|
4231
|
-
/* @__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, {})
|
|
4232
4369
|
] })
|
|
4233
4370
|
]
|
|
4234
4371
|
}
|
|
4235
4372
|
),
|
|
4236
|
-
/* @__PURE__ */
|
|
4237
|
-
/* @__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(
|
|
4238
4375
|
"div",
|
|
4239
4376
|
{
|
|
4240
4377
|
className: classes == null ? void 0 : classes.headerCell,
|
|
@@ -4247,10 +4384,10 @@ var TableInner = memo3(function TableInner2({ hidden }) {
|
|
|
4247
4384
|
}
|
|
4248
4385
|
)
|
|
4249
4386
|
] }),
|
|
4250
|
-
footer: /* @__PURE__ */ jsxs19(
|
|
4251
|
-
enableClearFiltersButton && hasActiveFilters && /* @__PURE__ */
|
|
4252
|
-
hasFooter && /* @__PURE__ */ jsxs19(
|
|
4253
|
-
/* @__PURE__ */
|
|
4387
|
+
footer: /* @__PURE__ */ jsxs19(Fragment9, { children: [
|
|
4388
|
+
enableClearFiltersButton && hasActiveFilters && /* @__PURE__ */ jsx35(ClearFiltersButton, {}),
|
|
4389
|
+
hasFooter && /* @__PURE__ */ jsxs19(Fragment9, { children: [
|
|
4390
|
+
/* @__PURE__ */ jsx35(
|
|
4254
4391
|
"div",
|
|
4255
4392
|
{
|
|
4256
4393
|
className: classes == null ? void 0 : classes.footerCell,
|
|
@@ -4263,7 +4400,7 @@ var TableInner = memo3(function TableInner2({ hidden }) {
|
|
|
4263
4400
|
]
|
|
4264
4401
|
}
|
|
4265
4402
|
),
|
|
4266
|
-
/* @__PURE__ */
|
|
4403
|
+
/* @__PURE__ */ jsx35(
|
|
4267
4404
|
"div",
|
|
4268
4405
|
{
|
|
4269
4406
|
className: classes == null ? void 0 : classes.footerCell,
|
|
@@ -4275,8 +4412,8 @@ var TableInner = memo3(function TableInner2({ hidden }) {
|
|
|
4275
4412
|
]
|
|
4276
4413
|
}
|
|
4277
4414
|
),
|
|
4278
|
-
visibleColumns.map((column) => /* @__PURE__ */
|
|
4279
|
-
/* @__PURE__ */
|
|
4415
|
+
visibleColumns.map((column) => /* @__PURE__ */ jsx35(ColumnContext.Provider, { value: column.id, children: /* @__PURE__ */ jsx35(ColumnFooter, {}) }, column.id)),
|
|
4416
|
+
/* @__PURE__ */ jsx35(
|
|
4280
4417
|
"div",
|
|
4281
4418
|
{
|
|
4282
4419
|
className: classes == null ? void 0 : classes.footerCell,
|
|
@@ -4290,7 +4427,7 @@ var TableInner = memo3(function TableInner2({ hidden }) {
|
|
|
4290
4427
|
)
|
|
4291
4428
|
] })
|
|
4292
4429
|
] }),
|
|
4293
|
-
children: (itemIds, startIndex) => itemIds.map((itemId, index) => /* @__PURE__ */
|
|
4430
|
+
children: (itemIds, startIndex) => itemIds.map((itemId, index) => /* @__PURE__ */ jsx35(Row, { itemId, rowIndex: startIndex + index }, itemId))
|
|
4294
4431
|
}
|
|
4295
4432
|
);
|
|
4296
4433
|
});
|
|
@@ -4316,7 +4453,7 @@ var termMatch = (text, query) => {
|
|
|
4316
4453
|
};
|
|
4317
4454
|
|
|
4318
4455
|
// src/components/textFilter.tsx
|
|
4319
|
-
import { jsx as
|
|
4456
|
+
import { jsx as jsx36 } from "@emotion/react/jsx-runtime";
|
|
4320
4457
|
function TextFilter(_a) {
|
|
4321
4458
|
var _b = _a, {
|
|
4322
4459
|
compare = textMatch,
|
|
@@ -4340,19 +4477,19 @@ function TextFilter(_a) {
|
|
|
4340
4477
|
return compare(value2, filterValue);
|
|
4341
4478
|
}
|
|
4342
4479
|
}));
|
|
4343
|
-
return /* @__PURE__ */
|
|
4480
|
+
return /* @__PURE__ */ jsx36(
|
|
4344
4481
|
"div",
|
|
4345
4482
|
{
|
|
4346
4483
|
css: {
|
|
4347
4484
|
padding: `calc(var(--spacing) * 2)`,
|
|
4348
4485
|
display: "grid"
|
|
4349
4486
|
},
|
|
4350
|
-
children: /* @__PURE__ */
|
|
4487
|
+
children: /* @__PURE__ */ jsx36(
|
|
4351
4488
|
AutoFocusTextField,
|
|
4352
4489
|
{
|
|
4353
4490
|
value,
|
|
4354
4491
|
onChange: (event) => onChange(event.target.value),
|
|
4355
|
-
endIcon: /* @__PURE__ */
|
|
4492
|
+
endIcon: /* @__PURE__ */ jsx36(IconButton2, { onClick: () => onChange(""), children: !value ? /* @__PURE__ */ jsx36(Search2, {}) : /* @__PURE__ */ jsx36(Clear2, {}) }),
|
|
4356
4493
|
placeholder
|
|
4357
4494
|
}
|
|
4358
4495
|
)
|