schummar-table 0.44.1 → 0.45.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +424 -284
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -2
- package/dist/index.d.ts +6 -2
- package/dist/index.js +343 -203
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -130,12 +130,12 @@ var react = function equal(a, b) {
|
|
|
130
130
|
if (a && b && typeof a == "object" && typeof b == "object") {
|
|
131
131
|
if (a.constructor !== b.constructor)
|
|
132
132
|
return false;
|
|
133
|
-
var
|
|
133
|
+
var length3, i, keys;
|
|
134
134
|
if (Array.isArray(a)) {
|
|
135
|
-
|
|
136
|
-
if (
|
|
135
|
+
length3 = a.length;
|
|
136
|
+
if (length3 != b.length)
|
|
137
137
|
return false;
|
|
138
|
-
for (i =
|
|
138
|
+
for (i = length3; i-- !== 0; )
|
|
139
139
|
if (!equal(a[i], b[i]))
|
|
140
140
|
return false;
|
|
141
141
|
return true;
|
|
@@ -160,10 +160,10 @@ var react = function equal(a, b) {
|
|
|
160
160
|
return true;
|
|
161
161
|
}
|
|
162
162
|
if (ArrayBuffer.isView(a) && ArrayBuffer.isView(b)) {
|
|
163
|
-
|
|
164
|
-
if (
|
|
163
|
+
length3 = a.length;
|
|
164
|
+
if (length3 != b.length)
|
|
165
165
|
return false;
|
|
166
|
-
for (i =
|
|
166
|
+
for (i = length3; i-- !== 0; )
|
|
167
167
|
if (a[i] !== b[i])
|
|
168
168
|
return false;
|
|
169
169
|
return true;
|
|
@@ -175,13 +175,13 @@ var react = function equal(a, b) {
|
|
|
175
175
|
if (a.toString !== Object.prototype.toString)
|
|
176
176
|
return a.toString() === b.toString();
|
|
177
177
|
keys = Object.keys(a);
|
|
178
|
-
|
|
179
|
-
if (
|
|
178
|
+
length3 = keys.length;
|
|
179
|
+
if (length3 !== Object.keys(b).length)
|
|
180
180
|
return false;
|
|
181
|
-
for (i =
|
|
181
|
+
for (i = length3; i-- !== 0; )
|
|
182
182
|
if (!Object.prototype.hasOwnProperty.call(b, keys[i]))
|
|
183
183
|
return false;
|
|
184
|
-
for (i =
|
|
184
|
+
for (i = length3; i-- !== 0; ) {
|
|
185
185
|
var key = keys[i];
|
|
186
186
|
if (key === "_owner" && a.$$typeof) {
|
|
187
187
|
continue;
|
|
@@ -611,11 +611,11 @@ var defaultColors = {
|
|
|
611
611
|
// src/components/spinnner.tsx
|
|
612
612
|
var import_react3 = require("@emotion/react");
|
|
613
613
|
var import_jsx_runtime = require("@emotion/react/jsx-runtime");
|
|
614
|
-
function Spinner({ className:
|
|
614
|
+
function Spinner({ className: className3 }) {
|
|
615
615
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
616
616
|
"div",
|
|
617
617
|
{
|
|
618
|
-
className:
|
|
618
|
+
className: className3,
|
|
619
619
|
css: import_react3.css`
|
|
620
620
|
display: inline-block;
|
|
621
621
|
position: relative;
|
|
@@ -777,7 +777,7 @@ var Button = (_a) => {
|
|
|
777
777
|
// src/theme/defaultTheme/checkbox.tsx
|
|
778
778
|
var import_jsx_runtime4 = require("@emotion/react/jsx-runtime");
|
|
779
779
|
var Checkbox = (_a) => {
|
|
780
|
-
var _b = _a, { className:
|
|
780
|
+
var _b = _a, { className: className3 } = _b, props = __objRest(_b, ["className"]);
|
|
781
781
|
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
782
782
|
"label",
|
|
783
783
|
{
|
|
@@ -794,7 +794,7 @@ var Checkbox = (_a) => {
|
|
|
794
794
|
},
|
|
795
795
|
props.disabled && { color: "rgba(0, 0, 0, 0.26)" }
|
|
796
796
|
],
|
|
797
|
-
className:
|
|
797
|
+
className: className3,
|
|
798
798
|
children: [
|
|
799
799
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("input", __spreadValues({ type: "checkbox" }, props)),
|
|
800
800
|
props.checked ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
@@ -950,7 +950,7 @@ var Popover = ({
|
|
|
950
950
|
hidden,
|
|
951
951
|
onClose,
|
|
952
952
|
children,
|
|
953
|
-
className:
|
|
953
|
+
className: className3,
|
|
954
954
|
backdropClassName,
|
|
955
955
|
align
|
|
956
956
|
}) => {
|
|
@@ -1049,7 +1049,7 @@ var Popover = ({
|
|
|
1049
1049
|
"div",
|
|
1050
1050
|
{
|
|
1051
1051
|
ref: popper,
|
|
1052
|
-
className:
|
|
1052
|
+
className: className3,
|
|
1053
1053
|
css: [
|
|
1054
1054
|
defaultClasses.card,
|
|
1055
1055
|
__spreadProps(__spreadValues({
|
|
@@ -1080,7 +1080,7 @@ var TextField = (_a) => {
|
|
|
1080
1080
|
var _b = _a, {
|
|
1081
1081
|
startIcon,
|
|
1082
1082
|
endIcon,
|
|
1083
|
-
className:
|
|
1083
|
+
className: className3,
|
|
1084
1084
|
inputRef,
|
|
1085
1085
|
onBlur
|
|
1086
1086
|
} = _b, props = __objRest(_b, [
|
|
@@ -1095,7 +1095,7 @@ var TextField = (_a) => {
|
|
|
1095
1095
|
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
1096
1096
|
"div",
|
|
1097
1097
|
{
|
|
1098
|
-
className:
|
|
1098
|
+
className: className3,
|
|
1099
1099
|
css: [
|
|
1100
1100
|
{
|
|
1101
1101
|
flex: 1,
|
|
@@ -1658,7 +1658,7 @@ var castArray = (a) => Array.isArray(a) ? a : [a];
|
|
|
1658
1658
|
var cx = (...classNames) => classNames.flatMap((entry) => {
|
|
1659
1659
|
if (!entry) return [];
|
|
1660
1660
|
if (typeof entry === "string") return [entry];
|
|
1661
|
-
return Object.entries(entry).filter(([, predicate]) => predicate).map(([
|
|
1661
|
+
return Object.entries(entry).filter(([, predicate]) => predicate).map(([className3]) => className3);
|
|
1662
1662
|
}).join(" ");
|
|
1663
1663
|
function isTruthy(x) {
|
|
1664
1664
|
return !!x;
|
|
@@ -2001,7 +2001,7 @@ function Filter(_a) {
|
|
|
2001
2001
|
|
|
2002
2002
|
// src/components/datePicker.tsx
|
|
2003
2003
|
var import_dayzed = require("dayzed");
|
|
2004
|
-
var
|
|
2004
|
+
var import_react19 = require("react");
|
|
2005
2005
|
|
|
2006
2006
|
// src/misc/defaults.ts
|
|
2007
2007
|
function defaults(first, ...more) {
|
|
@@ -2040,11 +2040,7 @@ var tabNext = (event) => {
|
|
|
2040
2040
|
next.focus();
|
|
2041
2041
|
}
|
|
2042
2042
|
};
|
|
2043
|
-
function DateInput({
|
|
2044
|
-
value,
|
|
2045
|
-
onChange,
|
|
2046
|
-
locale
|
|
2047
|
-
}) {
|
|
2043
|
+
function DateInput({ value, onChange, locale }) {
|
|
2048
2044
|
const [override, setOverride] = (0, import_react17.useState)();
|
|
2049
2045
|
const commit = () => {
|
|
2050
2046
|
if (!override) {
|
|
@@ -2139,17 +2135,130 @@ function Text({ id }) {
|
|
|
2139
2135
|
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_jsx_runtime15.Fragment, { children: text });
|
|
2140
2136
|
}
|
|
2141
2137
|
|
|
2142
|
-
// src/components/
|
|
2138
|
+
// src/components/timeInput.tsx
|
|
2139
|
+
var import_react18 = require("react");
|
|
2143
2140
|
var import_jsx_runtime16 = require("@emotion/react/jsx-runtime");
|
|
2144
|
-
var
|
|
2141
|
+
var className2 = "schummar-table-time-input";
|
|
2142
|
+
var defaultDate2 = new Date(1970, 0, 1);
|
|
2143
|
+
var isIncludedType2 = (type) => type === "hour" || type === "minute" || type === "second";
|
|
2144
|
+
var defaultLengths2 = {
|
|
2145
|
+
hour: 2,
|
|
2146
|
+
minute: 2,
|
|
2147
|
+
second: 2
|
|
2148
|
+
};
|
|
2149
|
+
var maxLengths2 = {
|
|
2150
|
+
hour: 2,
|
|
2151
|
+
minute: 2,
|
|
2152
|
+
second: 2
|
|
2153
|
+
};
|
|
2154
|
+
var length2 = (type, value) => Math.max(value.length, defaultLengths2[type]);
|
|
2155
|
+
var tabNext2 = (event) => {
|
|
2156
|
+
const all = Array.from(document.querySelectorAll(`.${className2}`));
|
|
2157
|
+
const index = all.indexOf(event);
|
|
2158
|
+
const next = all[(index + 1) % all.length];
|
|
2159
|
+
if (next instanceof HTMLElement) {
|
|
2160
|
+
next.focus();
|
|
2161
|
+
}
|
|
2162
|
+
};
|
|
2163
|
+
function TimeInput({ value, onChange, locale, showSeconds = true }) {
|
|
2164
|
+
const [override, setOverride] = (0, import_react18.useState)();
|
|
2165
|
+
const commit = () => {
|
|
2166
|
+
if (!override) {
|
|
2167
|
+
return;
|
|
2168
|
+
}
|
|
2169
|
+
setOverride(void 0);
|
|
2170
|
+
if (!override.value) {
|
|
2171
|
+
onChange(null);
|
|
2172
|
+
return;
|
|
2173
|
+
}
|
|
2174
|
+
const newValue = value ? new Date(value) : /* @__PURE__ */ new Date();
|
|
2175
|
+
switch (override.type) {
|
|
2176
|
+
case "hour": {
|
|
2177
|
+
newValue.setHours(Number(override.value));
|
|
2178
|
+
break;
|
|
2179
|
+
}
|
|
2180
|
+
case "minute": {
|
|
2181
|
+
newValue.setMinutes(Number(override.value));
|
|
2182
|
+
break;
|
|
2183
|
+
}
|
|
2184
|
+
case "second": {
|
|
2185
|
+
newValue.setSeconds(Number(override.value));
|
|
2186
|
+
break;
|
|
2187
|
+
}
|
|
2188
|
+
default: {
|
|
2189
|
+
break;
|
|
2190
|
+
}
|
|
2191
|
+
}
|
|
2192
|
+
onChange(newValue);
|
|
2193
|
+
};
|
|
2194
|
+
const format = (0, import_react18.useMemo)(
|
|
2195
|
+
() => new Intl.DateTimeFormat(locale, {
|
|
2196
|
+
hour: "2-digit",
|
|
2197
|
+
minute: "2-digit",
|
|
2198
|
+
second: showSeconds ? "2-digit" : void 0
|
|
2199
|
+
}),
|
|
2200
|
+
[locale]
|
|
2201
|
+
);
|
|
2202
|
+
const parts = format.formatToParts(value != null ? value : defaultDate2);
|
|
2203
|
+
const isEmpty = !value;
|
|
2204
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
2205
|
+
"div",
|
|
2206
|
+
{
|
|
2207
|
+
css: {
|
|
2208
|
+
display: "flex",
|
|
2209
|
+
alignItems: "baseline"
|
|
2210
|
+
},
|
|
2211
|
+
children: parts.map(({ type, value: value2 }, index) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_react18.Fragment, { children: isIncludedType2(type) ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
2212
|
+
"input",
|
|
2213
|
+
{
|
|
2214
|
+
className: className2,
|
|
2215
|
+
css: {
|
|
2216
|
+
boxSizing: "content-box",
|
|
2217
|
+
overflow: "visible",
|
|
2218
|
+
border: "none",
|
|
2219
|
+
borderBottom: "2px solid transparent",
|
|
2220
|
+
outline: "none",
|
|
2221
|
+
fontSize: "inherit",
|
|
2222
|
+
backgroundColor: "inherit",
|
|
2223
|
+
color: "inherit",
|
|
2224
|
+
"::placeholder": {
|
|
2225
|
+
color: "inherit",
|
|
2226
|
+
opacity: 0.5
|
|
2227
|
+
},
|
|
2228
|
+
"&:focus": {
|
|
2229
|
+
borderBottom: "2px solid var(--primaryMain)"
|
|
2230
|
+
}
|
|
2231
|
+
},
|
|
2232
|
+
style: {
|
|
2233
|
+
width: `${length2(type, value2)}ch`
|
|
2234
|
+
},
|
|
2235
|
+
placeholder: "".padEnd(length2(type, value2), "0"),
|
|
2236
|
+
value: (override == null ? void 0 : override.type) === type ? override.value : !isEmpty ? value2 : "",
|
|
2237
|
+
onChange: (event) => {
|
|
2238
|
+
setOverride({ type, value: event.target.value });
|
|
2239
|
+
if (event.target.value.length >= maxLengths2[type]) {
|
|
2240
|
+
setTimeout(() => tabNext2(event.target));
|
|
2241
|
+
}
|
|
2242
|
+
},
|
|
2243
|
+
onFocus: (event) => event.target.select(),
|
|
2244
|
+
onBlur: commit
|
|
2245
|
+
}
|
|
2246
|
+
) : type === "literal" ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { children: value2 }) : null }, index))
|
|
2247
|
+
}
|
|
2248
|
+
);
|
|
2249
|
+
}
|
|
2250
|
+
|
|
2251
|
+
// src/components/datePicker.tsx
|
|
2252
|
+
var import_jsx_runtime17 = require("@emotion/react/jsx-runtime");
|
|
2253
|
+
var DatePickerContext = (0, import_react19.createContext)({});
|
|
2145
2254
|
function DatePickerProvider(_a) {
|
|
2146
2255
|
var _b = _a, {
|
|
2147
2256
|
children
|
|
2148
2257
|
} = _b, props = __objRest(_b, [
|
|
2149
2258
|
"children"
|
|
2150
2259
|
]);
|
|
2151
|
-
const value = (0,
|
|
2152
|
-
return /* @__PURE__ */ (0,
|
|
2260
|
+
const value = (0, import_react19.useMemo)(() => props, [JSON.stringify(props)]);
|
|
2261
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(DatePickerContext.Provider, { value, children });
|
|
2153
2262
|
}
|
|
2154
2263
|
var weekDays = [0, 1, 2, 3, 4, 5, 6];
|
|
2155
2264
|
var startOfDay = (d) => new Date(d.getFullYear(), d.getMonth(), d.getDate());
|
|
@@ -2227,12 +2336,12 @@ var getCalendarWeek = (date) => {
|
|
|
2227
2336
|
return weekOfYear;
|
|
2228
2337
|
};
|
|
2229
2338
|
var commonQuickOptions = {
|
|
2230
|
-
today: { label: /* @__PURE__ */ (0,
|
|
2231
|
-
thisWeek: { label: /* @__PURE__ */ (0,
|
|
2232
|
-
thisMonth: { label: /* @__PURE__ */ (0,
|
|
2233
|
-
thisYear: { label: /* @__PURE__ */ (0,
|
|
2234
|
-
lastSevenDays: { label: /* @__PURE__ */ (0,
|
|
2235
|
-
lastThirtyDays: { label: /* @__PURE__ */ (0,
|
|
2339
|
+
today: { label: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Text, { id: "today" }), value: today },
|
|
2340
|
+
thisWeek: { label: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Text, { id: "thisWeek" }), value: (props) => thisWeek(0, props.firstDayOfWeek) },
|
|
2341
|
+
thisMonth: { label: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Text, { id: "thisMonth" }), value: () => thisMonth() },
|
|
2342
|
+
thisYear: { label: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Text, { id: "thisYear" }), value: () => thisYear() },
|
|
2343
|
+
lastSevenDays: { label: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Text, { id: "lastSevenDays" }), value: () => lastDays(7) },
|
|
2344
|
+
lastThirtyDays: { label: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Text, { id: "lastThirtyDays" }), value: () => lastDays(30) }
|
|
2236
2345
|
};
|
|
2237
2346
|
function dateIntersect(a, b) {
|
|
2238
2347
|
if (a instanceof Date) {
|
|
@@ -2267,7 +2376,7 @@ function getValueForComparison(value) {
|
|
|
2267
2376
|
}
|
|
2268
2377
|
function DatePicker(props) {
|
|
2269
2378
|
var _a;
|
|
2270
|
-
const context = (0,
|
|
2379
|
+
const context = (0, import_react19.useContext)(DatePickerContext);
|
|
2271
2380
|
const {
|
|
2272
2381
|
value,
|
|
2273
2382
|
rangeSelect,
|
|
@@ -2279,7 +2388,8 @@ function DatePicker(props) {
|
|
|
2279
2388
|
minDate,
|
|
2280
2389
|
maxDate,
|
|
2281
2390
|
showCalendarWeek,
|
|
2282
|
-
blockedRanges = []
|
|
2391
|
+
blockedRanges = [],
|
|
2392
|
+
showTime
|
|
2283
2393
|
} = defaults(props, context);
|
|
2284
2394
|
function onChange(value2, source) {
|
|
2285
2395
|
if (value2 instanceof Date) {
|
|
@@ -2347,10 +2457,10 @@ function DatePicker(props) {
|
|
|
2347
2457
|
}
|
|
2348
2458
|
];
|
|
2349
2459
|
}
|
|
2350
|
-
const mountTime = (0,
|
|
2351
|
-
const [dirty, setDirty] = (0,
|
|
2352
|
-
const [hovered, setHovered] = (0,
|
|
2353
|
-
const [dateInViewLocal, setDateInViewLocal] = (0,
|
|
2460
|
+
const mountTime = (0, import_react19.useMemo)(() => /* @__PURE__ */ new Date(), []);
|
|
2461
|
+
const [dirty, setDirty] = (0, import_react19.useState)();
|
|
2462
|
+
const [hovered, setHovered] = (0, import_react19.useState)();
|
|
2463
|
+
const [dateInViewLocal, setDateInViewLocal] = (0, import_react19.useState)(defaultDateInView != null ? defaultDateInView : mountTime);
|
|
2354
2464
|
const dateInView = (_a = props.dateInView) != null ? _a : dateInViewLocal;
|
|
2355
2465
|
function setDateInView(date) {
|
|
2356
2466
|
var _a2;
|
|
@@ -2361,7 +2471,7 @@ function DatePicker(props) {
|
|
|
2361
2471
|
const max = dirty ? dirty.max : value instanceof Date ? value : value == null ? void 0 : value.max;
|
|
2362
2472
|
const resolvedQuickOptions = [
|
|
2363
2473
|
...quickOptions,
|
|
2364
|
-
...noReset ? [] : [{ label: /* @__PURE__ */ (0,
|
|
2474
|
+
...noReset ? [] : [{ label: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Text, { id: "reset" }), value: null }]
|
|
2365
2475
|
].map((option, index) => {
|
|
2366
2476
|
if (option instanceof Function) {
|
|
2367
2477
|
return option((value3) => {
|
|
@@ -2370,7 +2480,7 @@ function DatePicker(props) {
|
|
|
2370
2480
|
});
|
|
2371
2481
|
}
|
|
2372
2482
|
const { label, value: value2 } = typeof option === "string" ? commonQuickOptions[option] : option;
|
|
2373
|
-
return /* @__PURE__ */ (0,
|
|
2483
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
2374
2484
|
Button2,
|
|
2375
2485
|
{
|
|
2376
2486
|
variant: "text",
|
|
@@ -2401,18 +2511,18 @@ function DatePicker(props) {
|
|
|
2401
2511
|
minDate,
|
|
2402
2512
|
maxDate
|
|
2403
2513
|
});
|
|
2404
|
-
const now = (0,
|
|
2405
|
-
const formatWeekday = (0,
|
|
2514
|
+
const now = (0, import_react19.useMemo)(() => startOfDay(/* @__PURE__ */ new Date()), []);
|
|
2515
|
+
const formatWeekday = (0, import_react19.useMemo)(() => {
|
|
2406
2516
|
const { format } = new Intl.DateTimeFormat(locale, { weekday: "short" });
|
|
2407
2517
|
return (weekDay) => format(new Date(Date.UTC(2021, 7, (weekDay + firstDayOfWeek) % 7 + 1)));
|
|
2408
2518
|
}, [locale, firstDayOfWeek]);
|
|
2409
|
-
(0,
|
|
2519
|
+
(0, import_react19.useEffect)(
|
|
2410
2520
|
() => setDateInView(
|
|
2411
2521
|
value === null ? defaultDateInView != null ? defaultDateInView : mountTime : value instanceof Date ? value : value.max
|
|
2412
2522
|
),
|
|
2413
2523
|
[getValueForComparison(value), getValueForComparison(defaultDateInView), mountTime]
|
|
2414
2524
|
);
|
|
2415
|
-
(0,
|
|
2525
|
+
(0, import_react19.useEffect)(() => {
|
|
2416
2526
|
if (!rangeSelect) {
|
|
2417
2527
|
setDirty(void 0);
|
|
2418
2528
|
}
|
|
@@ -2438,15 +2548,15 @@ function DatePicker(props) {
|
|
|
2438
2548
|
setDirty({ min: min2, max: max2 });
|
|
2439
2549
|
}
|
|
2440
2550
|
}
|
|
2441
|
-
const formatMonth = (0,
|
|
2551
|
+
const formatMonth = (0, import_react19.useMemo)(() => {
|
|
2442
2552
|
const { format } = new Intl.DateTimeFormat(locale, { month: "long" });
|
|
2443
2553
|
return (month) => format(new Date(2021, month));
|
|
2444
2554
|
}, [locale]);
|
|
2445
|
-
const formatYear = (0,
|
|
2555
|
+
const formatYear = (0, import_react19.useMemo)(() => {
|
|
2446
2556
|
const { format } = new Intl.DateTimeFormat(locale, { year: "numeric" });
|
|
2447
2557
|
return (year) => format(new Date(year, 0, 1));
|
|
2448
2558
|
}, [locale]);
|
|
2449
|
-
return /* @__PURE__ */ (0,
|
|
2559
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
2450
2560
|
"div",
|
|
2451
2561
|
{
|
|
2452
2562
|
css: [
|
|
@@ -2456,41 +2566,68 @@ function DatePicker(props) {
|
|
|
2456
2566
|
}
|
|
2457
2567
|
],
|
|
2458
2568
|
children: [
|
|
2459
|
-
/* @__PURE__ */ (0,
|
|
2569
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
2460
2570
|
"div",
|
|
2461
2571
|
{
|
|
2462
2572
|
css: {
|
|
2463
2573
|
display: "grid",
|
|
2464
2574
|
gridAutoFlow: "column",
|
|
2465
2575
|
justifyContent: "center",
|
|
2466
|
-
alignItems: "
|
|
2467
|
-
gap: "var(--spacing)"
|
|
2576
|
+
alignItems: "center",
|
|
2577
|
+
gap: "calc(var(--spacing) * 4)",
|
|
2578
|
+
"& > div": {
|
|
2579
|
+
display: "flex",
|
|
2580
|
+
flexDirection: "column",
|
|
2581
|
+
alignItems: "center"
|
|
2582
|
+
}
|
|
2468
2583
|
},
|
|
2469
2584
|
children: [
|
|
2470
|
-
/* @__PURE__ */ (0,
|
|
2471
|
-
|
|
2472
|
-
{
|
|
2473
|
-
value: min != null ? min : null,
|
|
2474
|
-
onChange: (date) => set("input", date != null ? date : void 0, max, "min"),
|
|
2475
|
-
locale
|
|
2476
|
-
}
|
|
2477
|
-
),
|
|
2478
|
-
rangeSelect && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
|
|
2479
|
-
" - ",
|
|
2480
|
-
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
2585
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { children: [
|
|
2586
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
2481
2587
|
DateInput,
|
|
2482
2588
|
{
|
|
2483
|
-
value:
|
|
2484
|
-
onChange: (date) => set("input",
|
|
2589
|
+
value: min != null ? min : null,
|
|
2590
|
+
onChange: (date) => set("input", date != null ? date : void 0, max, "min"),
|
|
2485
2591
|
locale
|
|
2486
2592
|
}
|
|
2593
|
+
),
|
|
2594
|
+
showTime && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
2595
|
+
TimeInput,
|
|
2596
|
+
{
|
|
2597
|
+
value: min != null ? min : null,
|
|
2598
|
+
onChange: (date) => set("input", date != null ? date : void 0, max, "min"),
|
|
2599
|
+
locale,
|
|
2600
|
+
showSeconds: typeof showTime === "boolean" ? true : showTime.showSeconds
|
|
2601
|
+
}
|
|
2487
2602
|
)
|
|
2603
|
+
] }),
|
|
2604
|
+
rangeSelect && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
|
|
2605
|
+
" - ",
|
|
2606
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { children: [
|
|
2607
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
2608
|
+
DateInput,
|
|
2609
|
+
{
|
|
2610
|
+
value: max != null ? max : null,
|
|
2611
|
+
onChange: (date) => set("input", min, date != null ? date : void 0, "max"),
|
|
2612
|
+
locale
|
|
2613
|
+
}
|
|
2614
|
+
),
|
|
2615
|
+
showTime && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
2616
|
+
TimeInput,
|
|
2617
|
+
{
|
|
2618
|
+
value: max != null ? max : null,
|
|
2619
|
+
onChange: (date) => set("input", min, date != null ? date : void 0, "max"),
|
|
2620
|
+
locale,
|
|
2621
|
+
showSeconds: typeof showTime === "boolean" ? true : showTime.showSeconds
|
|
2622
|
+
}
|
|
2623
|
+
)
|
|
2624
|
+
] })
|
|
2488
2625
|
] })
|
|
2489
2626
|
]
|
|
2490
2627
|
}
|
|
2491
2628
|
),
|
|
2492
|
-
calendars.map(({ month, year, weeks }) => /* @__PURE__ */ (0,
|
|
2493
|
-
/* @__PURE__ */ (0,
|
|
2629
|
+
calendars.map(({ month, year, weeks }) => /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { css: { display: "grid" }, children: [
|
|
2630
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
2494
2631
|
"div",
|
|
2495
2632
|
{
|
|
2496
2633
|
css: {
|
|
@@ -2501,17 +2638,17 @@ function DatePicker(props) {
|
|
|
2501
2638
|
alignItems: "center"
|
|
2502
2639
|
},
|
|
2503
2640
|
children: [
|
|
2504
|
-
/* @__PURE__ */ (0,
|
|
2505
|
-
/* @__PURE__ */ (0,
|
|
2641
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(IconButton2, __spreadProps(__spreadValues({ type: "button" }, getBackProps({ calendars })), { children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ChevronRight2, { css: { transform: "rotate3d(0, 0, 1, 180deg)" } }) })),
|
|
2642
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { css: { display: "flex" }, children: [
|
|
2506
2643
|
formatMonth(month),
|
|
2507
2644
|
" ",
|
|
2508
2645
|
formatYear(year)
|
|
2509
2646
|
] }),
|
|
2510
|
-
/* @__PURE__ */ (0,
|
|
2647
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(IconButton2, __spreadProps(__spreadValues({ type: "button" }, getForwardProps({ calendars })), { children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ChevronRight2, {}) }))
|
|
2511
2648
|
]
|
|
2512
2649
|
}
|
|
2513
2650
|
),
|
|
2514
|
-
/* @__PURE__ */ (0,
|
|
2651
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
2515
2652
|
"div",
|
|
2516
2653
|
{
|
|
2517
2654
|
css: {
|
|
@@ -2520,7 +2657,7 @@ function DatePicker(props) {
|
|
|
2520
2657
|
gridTemplateColumns: "repeat(8, max-content)"
|
|
2521
2658
|
},
|
|
2522
2659
|
children: [
|
|
2523
|
-
showCalendarWeek ? /* @__PURE__ */ (0,
|
|
2660
|
+
showCalendarWeek ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
2524
2661
|
"div",
|
|
2525
2662
|
{
|
|
2526
2663
|
css: {
|
|
@@ -2528,10 +2665,10 @@ function DatePicker(props) {
|
|
|
2528
2665
|
padding: 10,
|
|
2529
2666
|
borderRight: "1px solid var(--date-picker-separator, var(--table-border, #bdbdbd))"
|
|
2530
2667
|
},
|
|
2531
|
-
children: /* @__PURE__ */ (0,
|
|
2668
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Text, { id: "calendarWeek" })
|
|
2532
2669
|
}
|
|
2533
|
-
) : /* @__PURE__ */ (0,
|
|
2534
|
-
weekDays.map((_v, weekDay) => /* @__PURE__ */ (0,
|
|
2670
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", {}),
|
|
2671
|
+
weekDays.map((_v, weekDay) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
2535
2672
|
"div",
|
|
2536
2673
|
{
|
|
2537
2674
|
css: {
|
|
@@ -2546,8 +2683,8 @@ function DatePicker(props) {
|
|
|
2546
2683
|
const weekStart = week[0];
|
|
2547
2684
|
const weekEnd = week[6];
|
|
2548
2685
|
const weekDisabled = !rangeSelect || minDate && weekEnd.date < minDate || maxDate && weekStart.date > maxDate;
|
|
2549
|
-
return /* @__PURE__ */ (0,
|
|
2550
|
-
showCalendarWeek ? /* @__PURE__ */ (0,
|
|
2686
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_react19.Fragment, { children: [
|
|
2687
|
+
showCalendarWeek ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
2551
2688
|
"button",
|
|
2552
2689
|
{
|
|
2553
2690
|
type: "button",
|
|
@@ -2572,10 +2709,10 @@ function DatePicker(props) {
|
|
|
2572
2709
|
onPointerOut: () => !weekDisabled && setHovered(void 0),
|
|
2573
2710
|
children: getCalendarWeek(weekEnd.date)
|
|
2574
2711
|
}
|
|
2575
|
-
) : /* @__PURE__ */ (0,
|
|
2712
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", {}),
|
|
2576
2713
|
week.map((dateObject, dayIndex) => {
|
|
2577
2714
|
if (!dateObject) {
|
|
2578
|
-
return /* @__PURE__ */ (0,
|
|
2715
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", {}, dayIndex);
|
|
2579
2716
|
}
|
|
2580
2717
|
const { prevMonth, nextMonth, date } = dateObject;
|
|
2581
2718
|
const today2 = startOfDay(date).getTime() === now.getTime();
|
|
@@ -2586,7 +2723,7 @@ function DatePicker(props) {
|
|
|
2586
2723
|
min <= hovered.min ? { min, max: hovered.min } : { min: hovered.max, max: min }
|
|
2587
2724
|
));
|
|
2588
2725
|
const blocked = blockedRanges.some((range) => dateIntersect(date, range));
|
|
2589
|
-
return /* @__PURE__ */ (0,
|
|
2726
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
2590
2727
|
"button",
|
|
2591
2728
|
__spreadProps(__spreadValues({
|
|
2592
2729
|
type: "button",
|
|
@@ -2622,7 +2759,7 @@ function DatePicker(props) {
|
|
|
2622
2759
|
}
|
|
2623
2760
|
)
|
|
2624
2761
|
] }, `${month}${year}`)),
|
|
2625
|
-
/* @__PURE__ */ (0,
|
|
2762
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
2626
2763
|
"div",
|
|
2627
2764
|
{
|
|
2628
2765
|
css: {
|
|
@@ -2640,7 +2777,7 @@ function DatePicker(props) {
|
|
|
2640
2777
|
}
|
|
2641
2778
|
|
|
2642
2779
|
// src/components/dateFilter.tsx
|
|
2643
|
-
var
|
|
2780
|
+
var import_jsx_runtime18 = require("@emotion/react/jsx-runtime");
|
|
2644
2781
|
function convertDate(x) {
|
|
2645
2782
|
if (x instanceof Date) return x;
|
|
2646
2783
|
if (typeof x === "number" || typeof x === "string") return new Date(x);
|
|
@@ -2670,7 +2807,8 @@ function DateFilter(_a) {
|
|
|
2670
2807
|
filterBy = convertDateOrArray,
|
|
2671
2808
|
minDate,
|
|
2672
2809
|
maxDate,
|
|
2673
|
-
showCalendarWeek
|
|
2810
|
+
showCalendarWeek,
|
|
2811
|
+
showTime
|
|
2674
2812
|
} = _b, props = __objRest(_b, [
|
|
2675
2813
|
"locale",
|
|
2676
2814
|
"firstDayOfWeek",
|
|
@@ -2680,7 +2818,8 @@ function DateFilter(_a) {
|
|
|
2680
2818
|
"filterBy",
|
|
2681
2819
|
"minDate",
|
|
2682
2820
|
"maxDate",
|
|
2683
|
-
"showCalendarWeek"
|
|
2821
|
+
"showCalendarWeek",
|
|
2822
|
+
"showTime"
|
|
2684
2823
|
]);
|
|
2685
2824
|
const { value = null, onChange } = useFilter(__spreadProps(__spreadValues({}, props), {
|
|
2686
2825
|
filterBy,
|
|
@@ -2692,14 +2831,14 @@ function DateFilter(_a) {
|
|
|
2692
2831
|
return dateIntersect(filterValue, value2);
|
|
2693
2832
|
}
|
|
2694
2833
|
}));
|
|
2695
|
-
return /* @__PURE__ */ (0,
|
|
2834
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2696
2835
|
"div",
|
|
2697
2836
|
{
|
|
2698
2837
|
css: {
|
|
2699
2838
|
padding: "calc(var(--spacing) * 2)",
|
|
2700
2839
|
display: "grid"
|
|
2701
2840
|
},
|
|
2702
|
-
children: /* @__PURE__ */ (0,
|
|
2841
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2703
2842
|
DatePicker,
|
|
2704
2843
|
{
|
|
2705
2844
|
rangeSelect: !singleSelect,
|
|
@@ -2711,7 +2850,8 @@ function DateFilter(_a) {
|
|
|
2711
2850
|
quickOptions,
|
|
2712
2851
|
minDate,
|
|
2713
2852
|
maxDate,
|
|
2714
|
-
showCalendarWeek
|
|
2853
|
+
showCalendarWeek,
|
|
2854
|
+
showTime
|
|
2715
2855
|
}
|
|
2716
2856
|
)
|
|
2717
2857
|
}
|
|
@@ -2719,8 +2859,8 @@ function DateFilter(_a) {
|
|
|
2719
2859
|
}
|
|
2720
2860
|
|
|
2721
2861
|
// src/components/numberField.tsx
|
|
2722
|
-
var
|
|
2723
|
-
var
|
|
2862
|
+
var import_react20 = require("react");
|
|
2863
|
+
var import_jsx_runtime19 = require("@emotion/react/jsx-runtime");
|
|
2724
2864
|
var Pattern = /^-?\d*(?:[.,]\d*)?$/;
|
|
2725
2865
|
var printNumber = (value, locale) => {
|
|
2726
2866
|
if (value === null) {
|
|
@@ -2745,8 +2885,8 @@ function NumberField(_a) {
|
|
|
2745
2885
|
]);
|
|
2746
2886
|
const locale = useTheme((t2) => t2.locale);
|
|
2747
2887
|
const TextField2 = useTheme((t2) => t2.components.TextField);
|
|
2748
|
-
const [value = printNumber(commitedValue, locale), setValue] = (0,
|
|
2749
|
-
return /* @__PURE__ */ (0,
|
|
2888
|
+
const [value = printNumber(commitedValue, locale), setValue] = (0, import_react20.useState)();
|
|
2889
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
2750
2890
|
TextField2,
|
|
2751
2891
|
__spreadProps(__spreadValues({
|
|
2752
2892
|
value,
|
|
@@ -2771,7 +2911,7 @@ function NumberField(_a) {
|
|
|
2771
2911
|
}
|
|
2772
2912
|
|
|
2773
2913
|
// src/components/rangeFilter.tsx
|
|
2774
|
-
var
|
|
2914
|
+
var import_jsx_runtime20 = require("@emotion/react/jsx-runtime");
|
|
2775
2915
|
function RangeFilter(_a) {
|
|
2776
2916
|
var _b = _a, {
|
|
2777
2917
|
min,
|
|
@@ -2825,7 +2965,7 @@ function RangeFilter(_a) {
|
|
|
2825
2965
|
return value2 !== null && value2 >= min2 && value2 <= max2;
|
|
2826
2966
|
}
|
|
2827
2967
|
}));
|
|
2828
|
-
return /* @__PURE__ */ (0,
|
|
2968
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2829
2969
|
"div",
|
|
2830
2970
|
{
|
|
2831
2971
|
css: {
|
|
@@ -2833,7 +2973,7 @@ function RangeFilter(_a) {
|
|
|
2833
2973
|
display: "grid",
|
|
2834
2974
|
gap: "1em"
|
|
2835
2975
|
},
|
|
2836
|
-
children: /* @__PURE__ */ (0,
|
|
2976
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
2837
2977
|
"div",
|
|
2838
2978
|
{
|
|
2839
2979
|
css: {
|
|
@@ -2845,12 +2985,12 @@ function RangeFilter(_a) {
|
|
|
2845
2985
|
}
|
|
2846
2986
|
},
|
|
2847
2987
|
children: [
|
|
2848
|
-
/* @__PURE__ */ (0,
|
|
2988
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2849
2989
|
NumberField,
|
|
2850
2990
|
{
|
|
2851
2991
|
value: value == null ? void 0 : value[0],
|
|
2852
2992
|
onChange: (newMin) => onChange(normalize(newMin, value == null ? void 0 : value[1], "min", { min, max })),
|
|
2853
|
-
startIcon: /* @__PURE__ */ (0,
|
|
2993
|
+
startIcon: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { css: { margin: "0 calc(var(--spacing) * 2)" }, children: rangeMinText }),
|
|
2854
2994
|
placeholder: String(minValue != null ? minValue : ""),
|
|
2855
2995
|
css: {
|
|
2856
2996
|
alignItems: "baseline"
|
|
@@ -2858,12 +2998,12 @@ function RangeFilter(_a) {
|
|
|
2858
2998
|
}
|
|
2859
2999
|
),
|
|
2860
3000
|
"-",
|
|
2861
|
-
/* @__PURE__ */ (0,
|
|
3001
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2862
3002
|
NumberField,
|
|
2863
3003
|
{
|
|
2864
3004
|
value: value == null ? void 0 : value[1],
|
|
2865
3005
|
onChange: (newMax) => onChange(normalize(value == null ? void 0 : value[0], newMax, "max", { min, max })),
|
|
2866
|
-
startIcon: /* @__PURE__ */ (0,
|
|
3006
|
+
startIcon: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { css: { margin: "0 calc(var(--spacing) * 2)" }, children: rangeMaxText }),
|
|
2867
3007
|
placeholder: String(maxValue != null ? maxValue : ""),
|
|
2868
3008
|
css: {
|
|
2869
3009
|
alignItems: "baseline"
|
|
@@ -2893,16 +3033,16 @@ function clamp(value, min = Number.NEGATIVE_INFINITY, max = Number.POSITIVE_INFI
|
|
|
2893
3033
|
}
|
|
2894
3034
|
|
|
2895
3035
|
// src/components/selectFilter.tsx
|
|
2896
|
-
var
|
|
3036
|
+
var import_react22 = require("react");
|
|
2897
3037
|
|
|
2898
3038
|
// src/components/formControlLabel.tsx
|
|
2899
|
-
var
|
|
3039
|
+
var import_jsx_runtime21 = require("@emotion/react/jsx-runtime");
|
|
2900
3040
|
function FormControlLabel({
|
|
2901
3041
|
control,
|
|
2902
3042
|
label,
|
|
2903
3043
|
disabled
|
|
2904
3044
|
}) {
|
|
2905
|
-
return /* @__PURE__ */ (0,
|
|
3045
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
2906
3046
|
"label",
|
|
2907
3047
|
{
|
|
2908
3048
|
css: [
|
|
@@ -2919,14 +3059,14 @@ function FormControlLabel({
|
|
|
2919
3059
|
],
|
|
2920
3060
|
children: [
|
|
2921
3061
|
control,
|
|
2922
|
-
/* @__PURE__ */ (0,
|
|
3062
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { css: { marginLeft: "var(--spacing)" }, children: label })
|
|
2923
3063
|
]
|
|
2924
3064
|
}
|
|
2925
3065
|
);
|
|
2926
3066
|
}
|
|
2927
3067
|
|
|
2928
3068
|
// src/components/virtualList.tsx
|
|
2929
|
-
var
|
|
3069
|
+
var import_react21 = require("react");
|
|
2930
3070
|
|
|
2931
3071
|
// src/misc/throttle.ts
|
|
2932
3072
|
function throttle2(function_, ms) {
|
|
@@ -2967,7 +3107,7 @@ function throttle2(function_, ms) {
|
|
|
2967
3107
|
}
|
|
2968
3108
|
|
|
2969
3109
|
// src/components/virtualList.tsx
|
|
2970
|
-
var
|
|
3110
|
+
var import_jsx_runtime22 = require("@emotion/react/jsx-runtime");
|
|
2971
3111
|
function VirtualList(_a) {
|
|
2972
3112
|
var _b = _a, {
|
|
2973
3113
|
virtual = true,
|
|
@@ -2979,11 +3119,11 @@ function VirtualList(_a) {
|
|
|
2979
3119
|
"children"
|
|
2980
3120
|
]);
|
|
2981
3121
|
var _a2, _b2, _c, _d, _e;
|
|
2982
|
-
const container = (0,
|
|
2983
|
-
const [, setId] = (0,
|
|
3122
|
+
const container = (0, import_react21.useRef)(null);
|
|
3123
|
+
const [, setId] = (0, import_react21.useState)({});
|
|
2984
3124
|
const throttleScroll = (_b2 = (_a2 = typeof virtual === "boolean" ? void 0 : virtual) == null ? void 0 : _a2.throttleScroll) != null ? _b2 : 16;
|
|
2985
|
-
const update = (0,
|
|
2986
|
-
(0,
|
|
3125
|
+
const update = (0, import_react21.useMemo)(() => throttle2(() => setId({}), throttleScroll), [throttleScroll]);
|
|
3126
|
+
(0, import_react21.useEffect)(() => {
|
|
2987
3127
|
if (!virtual) return;
|
|
2988
3128
|
const ro = new ResizeObserver(update);
|
|
2989
3129
|
if (container.current) {
|
|
@@ -2997,7 +3137,7 @@ function VirtualList(_a) {
|
|
|
2997
3137
|
};
|
|
2998
3138
|
}, [update, virtual, throttleScroll]);
|
|
2999
3139
|
if (!virtual) {
|
|
3000
|
-
return /* @__PURE__ */ (0,
|
|
3140
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
3001
3141
|
"div",
|
|
3002
3142
|
__spreadProps(__spreadValues({}, props), {
|
|
3003
3143
|
css: {
|
|
@@ -3028,7 +3168,7 @@ function VirtualList(_a) {
|
|
|
3028
3168
|
) : 1;
|
|
3029
3169
|
const before = from * itemHeight;
|
|
3030
3170
|
const after = (items.length - to) * itemHeight;
|
|
3031
|
-
return /* @__PURE__ */ (0,
|
|
3171
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
3032
3172
|
"div",
|
|
3033
3173
|
__spreadProps(__spreadValues({}, props), {
|
|
3034
3174
|
onScroll: (event) => {
|
|
@@ -3042,9 +3182,9 @@ function VirtualList(_a) {
|
|
|
3042
3182
|
display: "grid"
|
|
3043
3183
|
},
|
|
3044
3184
|
children: [
|
|
3045
|
-
/* @__PURE__ */ (0,
|
|
3185
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { "data-virtual-before": true, style: { height: before } }),
|
|
3046
3186
|
items.slice(from, to).map((item, index) => children(item, index + from)),
|
|
3047
|
-
/* @__PURE__ */ (0,
|
|
3187
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { "data-virtual-after": true, style: { height: after } })
|
|
3048
3188
|
]
|
|
3049
3189
|
})
|
|
3050
3190
|
);
|
|
@@ -3058,7 +3198,7 @@ function averageItemHeight(container) {
|
|
|
3058
3198
|
}
|
|
3059
3199
|
|
|
3060
3200
|
// src/components/selectFilter.tsx
|
|
3061
|
-
var
|
|
3201
|
+
var import_jsx_runtime23 = require("@emotion/react/jsx-runtime");
|
|
3062
3202
|
function toggle(set, value, singleSelect) {
|
|
3063
3203
|
const newSet = new Set(singleSelect ? [] : set);
|
|
3064
3204
|
if (set.has(value)) {
|
|
@@ -3116,17 +3256,17 @@ function SelectFilter(_a) {
|
|
|
3116
3256
|
)
|
|
3117
3257
|
);
|
|
3118
3258
|
});
|
|
3119
|
-
const [query, setQuery] = (0,
|
|
3259
|
+
const [query, setQuery] = (0, import_react22.useState)("");
|
|
3120
3260
|
const filtered = options.filter(
|
|
3121
3261
|
(option) => !query || stringValue(option).toLowerCase().includes(query.toLowerCase())
|
|
3122
3262
|
);
|
|
3123
|
-
const delayedValue = (0,
|
|
3263
|
+
const delayedValue = (0, import_react22.useMemo)(() => value, [isActive]);
|
|
3124
3264
|
const ordered = filtered.filter((option) => delayedValue.has(option)).concat(filtered.filter((option) => !delayedValue.has(option)));
|
|
3125
3265
|
const Button2 = useTheme((t2) => t2.components.Button);
|
|
3126
|
-
(0,
|
|
3266
|
+
(0, import_react22.useEffect)(() => {
|
|
3127
3267
|
setQuery("");
|
|
3128
3268
|
}, [isActive]);
|
|
3129
|
-
return /* @__PURE__ */ (0,
|
|
3269
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
3130
3270
|
"div",
|
|
3131
3271
|
{
|
|
3132
3272
|
css: {
|
|
@@ -3136,16 +3276,16 @@ function SelectFilter(_a) {
|
|
|
3136
3276
|
gap: "var(--spacing)"
|
|
3137
3277
|
},
|
|
3138
3278
|
children: [
|
|
3139
|
-
!hideSearchField && /* @__PURE__ */ (0,
|
|
3279
|
+
!hideSearchField && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
3140
3280
|
AutoFocusTextField,
|
|
3141
3281
|
{
|
|
3142
3282
|
value: query,
|
|
3143
3283
|
onChange: (event) => setQuery(event.target.value),
|
|
3144
|
-
endIcon: /* @__PURE__ */ (0,
|
|
3284
|
+
endIcon: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(IconButton2, { onClick: () => setQuery(""), children: !query ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Search2, {}) : /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Clear2, {}) }),
|
|
3145
3285
|
css: { marginBottom: "var(--spacing)" }
|
|
3146
3286
|
}
|
|
3147
3287
|
),
|
|
3148
|
-
!hideResetButton && /* @__PURE__ */ (0,
|
|
3288
|
+
!hideResetButton && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
3149
3289
|
Button2,
|
|
3150
3290
|
{
|
|
3151
3291
|
disabled: value.size === 0,
|
|
@@ -3160,7 +3300,7 @@ function SelectFilter(_a) {
|
|
|
3160
3300
|
children: deselectAll
|
|
3161
3301
|
}
|
|
3162
3302
|
),
|
|
3163
|
-
/* @__PURE__ */ (0,
|
|
3303
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
3164
3304
|
VirtualList,
|
|
3165
3305
|
{
|
|
3166
3306
|
items: ordered,
|
|
@@ -3172,10 +3312,10 @@ function SelectFilter(_a) {
|
|
|
3172
3312
|
display: "grid",
|
|
3173
3313
|
gridTemplateColumns: "minmax(0, 1fr)"
|
|
3174
3314
|
},
|
|
3175
|
-
children: (option, index) => /* @__PURE__ */ (0,
|
|
3315
|
+
children: (option, index) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
3176
3316
|
FormControlLabel,
|
|
3177
3317
|
{
|
|
3178
|
-
control: /* @__PURE__ */ (0,
|
|
3318
|
+
control: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
3179
3319
|
Checkbox2,
|
|
3180
3320
|
{
|
|
3181
3321
|
checked: value.has(option),
|
|
@@ -3188,17 +3328,17 @@ function SelectFilter(_a) {
|
|
|
3188
3328
|
)
|
|
3189
3329
|
}
|
|
3190
3330
|
),
|
|
3191
|
-
ordered.length === 0 && /* @__PURE__ */ (0,
|
|
3331
|
+
ordered.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { css: { textAlign: "center" }, children: noResults })
|
|
3192
3332
|
]
|
|
3193
3333
|
}
|
|
3194
3334
|
);
|
|
3195
3335
|
}
|
|
3196
3336
|
|
|
3197
3337
|
// src/components/table.tsx
|
|
3198
|
-
var
|
|
3338
|
+
var import_react42 = require("react");
|
|
3199
3339
|
|
|
3200
3340
|
// src/internalState/tableStateStorage.ts
|
|
3201
|
-
var
|
|
3341
|
+
var import_react23 = require("react");
|
|
3202
3342
|
|
|
3203
3343
|
// src/misc/queue.ts
|
|
3204
3344
|
var Queue = class {
|
|
@@ -3282,9 +3422,9 @@ function parse(value) {
|
|
|
3282
3422
|
});
|
|
3283
3423
|
}
|
|
3284
3424
|
function useTableStateStorage(table) {
|
|
3285
|
-
const [isHydrated, setIsHydrated] = (0,
|
|
3286
|
-
const [q2] = (0,
|
|
3287
|
-
(0,
|
|
3425
|
+
const [isHydrated, setIsHydrated] = (0, import_react23.useState)(false);
|
|
3426
|
+
const [q2] = (0, import_react23.useState)(() => new Queue());
|
|
3427
|
+
(0, import_react23.useEffect)(() => {
|
|
3288
3428
|
const { persist } = table.getState().props;
|
|
3289
3429
|
if (!persist) {
|
|
3290
3430
|
setIsHydrated(true);
|
|
@@ -3344,7 +3484,7 @@ function useTableStateStorage(table) {
|
|
|
3344
3484
|
isCanceled = true;
|
|
3345
3485
|
};
|
|
3346
3486
|
}, [table]);
|
|
3347
|
-
(0,
|
|
3487
|
+
(0, import_react23.useEffect)(() => {
|
|
3348
3488
|
if (!isHydrated) return;
|
|
3349
3489
|
return table.subscribe(
|
|
3350
3490
|
(state) => {
|
|
@@ -3405,13 +3545,13 @@ function useTableStateStorage(table) {
|
|
|
3405
3545
|
|
|
3406
3546
|
// src/internalState/useTableState.ts
|
|
3407
3547
|
var import_immer6 = require("immer");
|
|
3408
|
-
var
|
|
3548
|
+
var import_react31 = require("react");
|
|
3409
3549
|
|
|
3410
3550
|
// src/internalState/calcItems.ts
|
|
3411
3551
|
var import_immer4 = require("immer");
|
|
3412
|
-
var
|
|
3552
|
+
var import_react24 = require("react");
|
|
3413
3553
|
function calcItems(state) {
|
|
3414
|
-
(0,
|
|
3554
|
+
(0, import_react24.useEffect)(
|
|
3415
3555
|
() => state.addReaction(
|
|
3416
3556
|
(state2) => [
|
|
3417
3557
|
state2.props.items,
|
|
@@ -3530,7 +3670,7 @@ function calcItems(state) {
|
|
|
3530
3670
|
}
|
|
3531
3671
|
|
|
3532
3672
|
// src/internalState/calcProps.ts
|
|
3533
|
-
var
|
|
3673
|
+
var import_react25 = require("react");
|
|
3534
3674
|
|
|
3535
3675
|
// src/exporters/serializer.ts
|
|
3536
3676
|
function defaultSerializer(x) {
|
|
@@ -3579,7 +3719,7 @@ var defaultProps = {
|
|
|
3579
3719
|
};
|
|
3580
3720
|
function calcProps(props) {
|
|
3581
3721
|
const cache = useTableMemo();
|
|
3582
|
-
return (0,
|
|
3722
|
+
return (0, import_react25.useMemo)(
|
|
3583
3723
|
() => overrides(defaultProps, calc(props, cache)),
|
|
3584
3724
|
[props]
|
|
3585
3725
|
);
|
|
@@ -3687,9 +3827,9 @@ function calc(props, cache) {
|
|
|
3687
3827
|
}
|
|
3688
3828
|
|
|
3689
3829
|
// src/internalState/cleanupState.ts
|
|
3690
|
-
var
|
|
3830
|
+
var import_react26 = require("react");
|
|
3691
3831
|
function cleanupState(state) {
|
|
3692
|
-
(0,
|
|
3832
|
+
(0, import_react26.useEffect)(
|
|
3693
3833
|
() => state.addReaction(
|
|
3694
3834
|
(state2) => [
|
|
3695
3835
|
state2.props.columns,
|
|
@@ -3749,9 +3889,9 @@ function cleanupState(state) {
|
|
|
3749
3889
|
}
|
|
3750
3890
|
|
|
3751
3891
|
// src/internalState/filterColumns.ts
|
|
3752
|
-
var
|
|
3892
|
+
var import_react27 = require("react");
|
|
3753
3893
|
function filterColumns(state) {
|
|
3754
|
-
(0,
|
|
3894
|
+
(0, import_react27.useEffect)(
|
|
3755
3895
|
() => state.addReaction(
|
|
3756
3896
|
(state2) => [
|
|
3757
3897
|
state2.props.columns,
|
|
@@ -3779,9 +3919,9 @@ function filterColumns(state) {
|
|
|
3779
3919
|
}
|
|
3780
3920
|
|
|
3781
3921
|
// src/internalState/normalizeExpanded.ts
|
|
3782
|
-
var
|
|
3922
|
+
var import_react28 = require("react");
|
|
3783
3923
|
function normalizeExpanded(table) {
|
|
3784
|
-
(0,
|
|
3924
|
+
(0, import_react28.useEffect)(
|
|
3785
3925
|
() => table.addReaction(
|
|
3786
3926
|
(state) => [state.props.expandOnlyOne, state.expanded, state.itemsById],
|
|
3787
3927
|
([expandOnlyOne, , itemsById], state) => {
|
|
@@ -3825,9 +3965,9 @@ function normalizeExpanded(table) {
|
|
|
3825
3965
|
}
|
|
3826
3966
|
|
|
3827
3967
|
// src/internalState/syncSelections.ts
|
|
3828
|
-
var
|
|
3968
|
+
var import_react29 = require("react");
|
|
3829
3969
|
function syncSelections(table) {
|
|
3830
|
-
(0,
|
|
3970
|
+
(0, import_react29.useEffect)(
|
|
3831
3971
|
() => table.addReaction(
|
|
3832
3972
|
(state) => [state.props.selectSyncChildren, state.selection, state.activeItems],
|
|
3833
3973
|
([selectSyncChildren, selection, activeItems], state) => {
|
|
@@ -3854,13 +3994,13 @@ function syncSelections(table) {
|
|
|
3854
3994
|
|
|
3855
3995
|
// src/internalState/watchDisplaySize.ts
|
|
3856
3996
|
var import_immer5 = require("immer");
|
|
3857
|
-
var
|
|
3997
|
+
var import_react30 = require("react");
|
|
3858
3998
|
var DEFAULT_DISPLAY_SIZES = {
|
|
3859
3999
|
mobile: 400,
|
|
3860
4000
|
desktop: Infinity
|
|
3861
4001
|
};
|
|
3862
4002
|
function watchDisplaySize(state) {
|
|
3863
|
-
(0,
|
|
4003
|
+
(0, import_react30.useEffect)(
|
|
3864
4004
|
() => state.addReaction(
|
|
3865
4005
|
(state2) => ({
|
|
3866
4006
|
displaySizePx: state2.displaySizePx,
|
|
@@ -3882,7 +4022,7 @@ function watchDisplaySize(state) {
|
|
|
3882
4022
|
),
|
|
3883
4023
|
[state]
|
|
3884
4024
|
);
|
|
3885
|
-
(0,
|
|
4025
|
+
(0, import_react30.useEffect)(
|
|
3886
4026
|
() => state.addReaction(
|
|
3887
4027
|
(state2) => ({
|
|
3888
4028
|
props: state2.normalizedProps,
|
|
@@ -3901,7 +4041,7 @@ function watchDisplaySize(state) {
|
|
|
3901
4041
|
|
|
3902
4042
|
// src/internalState/useTableState.ts
|
|
3903
4043
|
function useTableState(_props) {
|
|
3904
|
-
const [key, setKey] = (0,
|
|
4044
|
+
const [key, setKey] = (0, import_react31.useState)({});
|
|
3905
4045
|
const props = calcProps(_props);
|
|
3906
4046
|
function reset() {
|
|
3907
4047
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
@@ -3920,7 +4060,7 @@ function useTableState(_props) {
|
|
|
3920
4060
|
}
|
|
3921
4061
|
(_i = props.onReset) == null ? void 0 : _i.call(props, "table");
|
|
3922
4062
|
}
|
|
3923
|
-
const state = (0,
|
|
4063
|
+
const state = (0, import_react31.useMemo)(
|
|
3924
4064
|
() => {
|
|
3925
4065
|
var _a, _b, _c, _d;
|
|
3926
4066
|
return new Store2({
|
|
@@ -3956,7 +4096,7 @@ function useTableState(_props) {
|
|
|
3956
4096
|
syncSelections(state);
|
|
3957
4097
|
cleanupState(state);
|
|
3958
4098
|
watchDisplaySize(state);
|
|
3959
|
-
(0,
|
|
4099
|
+
(0, import_react31.useEffect)(() => {
|
|
3960
4100
|
state.update((state2) => {
|
|
3961
4101
|
state2.normalizedProps = (0, import_immer6.castDraft)(props);
|
|
3962
4102
|
if (props.sort) state2.sort = props.sort;
|
|
@@ -3975,12 +4115,12 @@ function useTableState(_props) {
|
|
|
3975
4115
|
}
|
|
3976
4116
|
|
|
3977
4117
|
// src/components/clearFiltersButton.tsx
|
|
3978
|
-
var
|
|
4118
|
+
var import_jsx_runtime24 = require("@emotion/react/jsx-runtime");
|
|
3979
4119
|
function ClearFiltersButton() {
|
|
3980
4120
|
const Button2 = useTheme((t2) => t2.components.Button);
|
|
3981
4121
|
const textClearFilters = useTheme((t2) => t2.text.clearFilters);
|
|
3982
4122
|
const table = useTableContext();
|
|
3983
|
-
return /* @__PURE__ */ (0,
|
|
4123
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { css: defaultClasses.clearFiltersButton, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
3984
4124
|
Button2,
|
|
3985
4125
|
{
|
|
3986
4126
|
variant: "outlined",
|
|
@@ -3999,7 +4139,7 @@ function ClearFiltersButton() {
|
|
|
3999
4139
|
}
|
|
4000
4140
|
|
|
4001
4141
|
// src/components/columnFooter.tsx
|
|
4002
|
-
var
|
|
4142
|
+
var import_jsx_runtime25 = require("@emotion/react/jsx-runtime");
|
|
4003
4143
|
function ColumnFooter() {
|
|
4004
4144
|
const table = useTableContext();
|
|
4005
4145
|
const columnId = useColumnContext();
|
|
@@ -4031,7 +4171,7 @@ function ColumnFooter() {
|
|
|
4031
4171
|
const column = state.activeColumns.find((column2) => column2.id === columnId);
|
|
4032
4172
|
return column == null ? void 0 : column.footer;
|
|
4033
4173
|
});
|
|
4034
|
-
return /* @__PURE__ */ (0,
|
|
4174
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
4035
4175
|
"div",
|
|
4036
4176
|
{
|
|
4037
4177
|
className: cx(classes, columnClasses),
|
|
@@ -4050,10 +4190,10 @@ function ColumnFooter() {
|
|
|
4050
4190
|
|
|
4051
4191
|
// src/components/columnHeader.tsx
|
|
4052
4192
|
var import_immer7 = require("immer");
|
|
4053
|
-
var
|
|
4193
|
+
var import_react33 = require("react");
|
|
4054
4194
|
|
|
4055
4195
|
// src/components/resizeHandle.tsx
|
|
4056
|
-
var
|
|
4196
|
+
var import_jsx_runtime26 = require("@emotion/react/jsx-runtime");
|
|
4057
4197
|
function ResizeHandle() {
|
|
4058
4198
|
const table = useTableContext();
|
|
4059
4199
|
const columnId = useColumnContext();
|
|
@@ -4090,7 +4230,7 @@ function ResizeHandle() {
|
|
|
4090
4230
|
if (!enabled) {
|
|
4091
4231
|
return null;
|
|
4092
4232
|
}
|
|
4093
|
-
return /* @__PURE__ */ (0,
|
|
4233
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4094
4234
|
ResizeHandleView,
|
|
4095
4235
|
{
|
|
4096
4236
|
enabled,
|
|
@@ -4107,7 +4247,7 @@ function ResizeHandleView(_a) {
|
|
|
4107
4247
|
} = _b, props = __objRest(_b, [
|
|
4108
4248
|
"enabled"
|
|
4109
4249
|
]);
|
|
4110
|
-
const
|
|
4250
|
+
const className3 = useTheme((theme) => {
|
|
4111
4251
|
var _a2;
|
|
4112
4252
|
return (_a2 = theme.classes) == null ? void 0 : _a2.columnDivider;
|
|
4113
4253
|
});
|
|
@@ -4115,10 +4255,10 @@ function ResizeHandleView(_a) {
|
|
|
4115
4255
|
var _a2;
|
|
4116
4256
|
return (_a2 = theme.styles) == null ? void 0 : _a2.columnDivider;
|
|
4117
4257
|
});
|
|
4118
|
-
return /* @__PURE__ */ (0,
|
|
4258
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4119
4259
|
"div",
|
|
4120
4260
|
__spreadValues({
|
|
4121
|
-
className:
|
|
4261
|
+
className: className3,
|
|
4122
4262
|
css: [
|
|
4123
4263
|
{
|
|
4124
4264
|
alignSelf: "stretch",
|
|
@@ -4144,7 +4284,7 @@ function ResizeHandleView(_a) {
|
|
|
4144
4284
|
}
|
|
4145
4285
|
|
|
4146
4286
|
// src/components/sortComponent.tsx
|
|
4147
|
-
var
|
|
4287
|
+
var import_jsx_runtime27 = require("@emotion/react/jsx-runtime");
|
|
4148
4288
|
function SortComponent({ children }) {
|
|
4149
4289
|
const table = useTableContext();
|
|
4150
4290
|
const columnId = useColumnContext();
|
|
@@ -4184,7 +4324,7 @@ function SortComponent({ children }) {
|
|
|
4184
4324
|
event.preventDefault();
|
|
4185
4325
|
return false;
|
|
4186
4326
|
}
|
|
4187
|
-
return /* @__PURE__ */ (0,
|
|
4327
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
|
|
4188
4328
|
"div",
|
|
4189
4329
|
{
|
|
4190
4330
|
css: {
|
|
@@ -4201,8 +4341,8 @@ function SortComponent({ children }) {
|
|
|
4201
4341
|
onClick: (event) => toggle2(event),
|
|
4202
4342
|
onContextMenu: (event) => toggle2(event, true),
|
|
4203
4343
|
children: [
|
|
4204
|
-
/* @__PURE__ */ (0,
|
|
4205
|
-
/* @__PURE__ */ (0,
|
|
4344
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { children }),
|
|
4345
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Badge2, { badgeContent: sortDisabled ? 0 : index, children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
4206
4346
|
"span",
|
|
4207
4347
|
{
|
|
4208
4348
|
css: [
|
|
@@ -4210,7 +4350,7 @@ function SortComponent({ children }) {
|
|
|
4210
4350
|
!direction && { opacity: 0 },
|
|
4211
4351
|
direction === "desc" && { transform: "rotate3d(0, 0, 1, 180deg)" }
|
|
4212
4352
|
],
|
|
4213
|
-
children: /* @__PURE__ */ (0,
|
|
4353
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ArrowUpward2, {})
|
|
4214
4354
|
}
|
|
4215
4355
|
) })
|
|
4216
4356
|
]
|
|
@@ -4219,12 +4359,12 @@ function SortComponent({ children }) {
|
|
|
4219
4359
|
}
|
|
4220
4360
|
|
|
4221
4361
|
// src/components/columnHeader.tsx
|
|
4222
|
-
var
|
|
4362
|
+
var import_jsx_runtime28 = require("@emotion/react/jsx-runtime");
|
|
4223
4363
|
var ColumnHeaderContext = new StoreScope({
|
|
4224
4364
|
items: /* @__PURE__ */ new Map()
|
|
4225
4365
|
});
|
|
4226
4366
|
function ColumnHeader() {
|
|
4227
|
-
const ref = (0,
|
|
4367
|
+
const ref = (0, import_react33.useRef)(null);
|
|
4228
4368
|
const columnId = useColumnContext();
|
|
4229
4369
|
const table = useTableContext();
|
|
4230
4370
|
const enabled = table.useState((state) => state.props.enableColumnReorder);
|
|
@@ -4250,9 +4390,9 @@ function ColumnHeader() {
|
|
|
4250
4390
|
};
|
|
4251
4391
|
});
|
|
4252
4392
|
const store = ColumnHeaderContext.useStore();
|
|
4253
|
-
const draggingStart = (0,
|
|
4254
|
-
const clone = (0,
|
|
4255
|
-
(0,
|
|
4393
|
+
const draggingStart = (0, import_react33.useRef)();
|
|
4394
|
+
const clone = (0, import_react33.useRef)();
|
|
4395
|
+
(0, import_react33.useEffect)(() => {
|
|
4256
4396
|
const div = ref.current;
|
|
4257
4397
|
if (!div) return;
|
|
4258
4398
|
store.update((state) => {
|
|
@@ -4361,7 +4501,7 @@ function ColumnHeader() {
|
|
|
4361
4501
|
clone.current = void 0;
|
|
4362
4502
|
});
|
|
4363
4503
|
}
|
|
4364
|
-
return /* @__PURE__ */ (0,
|
|
4504
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
|
4365
4505
|
"div",
|
|
4366
4506
|
{
|
|
4367
4507
|
ref,
|
|
@@ -4382,18 +4522,18 @@ function ColumnHeader() {
|
|
|
4382
4522
|
onPointerMove: enabled ? onPointerMove : void 0,
|
|
4383
4523
|
onPointerUp: enabled ? onPointerUp : void 0,
|
|
4384
4524
|
children: [
|
|
4385
|
-
/* @__PURE__ */ (0,
|
|
4386
|
-
/* @__PURE__ */ (0,
|
|
4387
|
-
/* @__PURE__ */ (0,
|
|
4388
|
-
/* @__PURE__ */ (0,
|
|
4525
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(SortComponent, { children: header }),
|
|
4526
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { css: { flex: 1 } }),
|
|
4527
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(FilterControl, {}),
|
|
4528
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(ResizeHandle, {})
|
|
4389
4529
|
]
|
|
4390
4530
|
}
|
|
4391
4531
|
);
|
|
4392
4532
|
}
|
|
4393
4533
|
|
|
4394
4534
|
// src/components/columnSelection.tsx
|
|
4395
|
-
var
|
|
4396
|
-
var
|
|
4535
|
+
var import_react35 = require("react");
|
|
4536
|
+
var import_jsx_runtime29 = require("@emotion/react/jsx-runtime");
|
|
4397
4537
|
function ColumnSelection() {
|
|
4398
4538
|
const IconButton2 = useTheme((t2) => t2.components.IconButton);
|
|
4399
4539
|
const Popover2 = useTheme((t2) => t2.components.Popover);
|
|
@@ -4407,10 +4547,10 @@ function ColumnSelection() {
|
|
|
4407
4547
|
const classes = useTheme((t2) => t2.classes);
|
|
4408
4548
|
const cssVariables = useCssVariables();
|
|
4409
4549
|
const table = useTableContext();
|
|
4410
|
-
const reset = (0,
|
|
4550
|
+
const reset = (0, import_react35.useContext)(TableResetContext);
|
|
4411
4551
|
const columns = table.useState((state) => state.props.columns);
|
|
4412
4552
|
const hiddenColumns = table.useState((state) => state.hiddenColumns);
|
|
4413
|
-
const [anchorElement, setAnchorElement] = (0,
|
|
4553
|
+
const [anchorElement, setAnchorElement] = (0, import_react35.useState)(null);
|
|
4414
4554
|
const toggle2 = (column, state) => {
|
|
4415
4555
|
const {
|
|
4416
4556
|
props: { hiddenColumns: controlledHiddenColumns, onHiddenColumnsChange }
|
|
@@ -4431,9 +4571,9 @@ function ColumnSelection() {
|
|
|
4431
4571
|
onHiddenColumnsChange == null ? void 0 : onHiddenColumnsChange(newValue);
|
|
4432
4572
|
};
|
|
4433
4573
|
const allVisible = columns.every((column) => !hiddenColumns.has(column.id));
|
|
4434
|
-
return /* @__PURE__ */ (0,
|
|
4435
|
-
/* @__PURE__ */ (0,
|
|
4436
|
-
/* @__PURE__ */ (0,
|
|
4574
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_jsx_runtime29.Fragment, { children: [
|
|
4575
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(IconButton2, { onClick: (event) => setAnchorElement(anchorElement ? null : event.currentTarget), children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Settings2, {}) }),
|
|
4576
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
4437
4577
|
Popover2,
|
|
4438
4578
|
{
|
|
4439
4579
|
anchorEl: anchorElement,
|
|
@@ -4442,18 +4582,18 @@ function ColumnSelection() {
|
|
|
4442
4582
|
css: cssVariables,
|
|
4443
4583
|
className: classes == null ? void 0 : classes.popover,
|
|
4444
4584
|
backdropClassName: classes == null ? void 0 : classes.popoverBackdrop,
|
|
4445
|
-
children: /* @__PURE__ */ (0,
|
|
4446
|
-
/* @__PURE__ */ (0,
|
|
4447
|
-
/* @__PURE__ */ (0,
|
|
4448
|
-
/* @__PURE__ */ (0,
|
|
4449
|
-
/* @__PURE__ */ (0,
|
|
4585
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { css: { padding: `calc(var(--spacing) * 2)`, display: "grid" }, children: [
|
|
4586
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { css: { marginBottom: "var(--spacing)" }, children: selectColumns }),
|
|
4587
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { css: { margin: "0.5em 0", display: "flex", gap: "0.5em" }, children: [
|
|
4588
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Button2, { variant: "outlined", onClick: () => toggle2(void 0, !allVisible), children: allVisible ? hideAll : showAll }),
|
|
4589
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Button2, { variant: "outlined", onClick: reset, children: resetAll })
|
|
4450
4590
|
] }),
|
|
4451
4591
|
columns.map((column) => {
|
|
4452
4592
|
var _a;
|
|
4453
|
-
return /* @__PURE__ */ (0,
|
|
4593
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
4454
4594
|
FormControlLabel,
|
|
4455
4595
|
{
|
|
4456
|
-
control: /* @__PURE__ */ (0,
|
|
4596
|
+
control: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
4457
4597
|
Checkbox2,
|
|
4458
4598
|
{
|
|
4459
4599
|
checked: !((_a = column.hidden) != null ? _a : hiddenColumns.has(column.id)),
|
|
@@ -4473,10 +4613,10 @@ function ColumnSelection() {
|
|
|
4473
4613
|
}
|
|
4474
4614
|
|
|
4475
4615
|
// src/components/export.tsx
|
|
4476
|
-
var
|
|
4477
|
-
var
|
|
4616
|
+
var import_react36 = require("react");
|
|
4617
|
+
var import_jsx_runtime30 = require("@emotion/react/jsx-runtime");
|
|
4478
4618
|
function Export2() {
|
|
4479
|
-
const { exporters: contextExporters } = (0,
|
|
4619
|
+
const { exporters: contextExporters } = (0, import_react36.useContext)(TableSettingsContext);
|
|
4480
4620
|
const table = useTableContext();
|
|
4481
4621
|
const Button2 = useTheme((t2) => t2.components.Button);
|
|
4482
4622
|
const IconButton2 = useTheme((t2) => t2.components.IconButton);
|
|
@@ -4497,7 +4637,7 @@ function Export2() {
|
|
|
4497
4637
|
}
|
|
4498
4638
|
return state.props.enableExport;
|
|
4499
4639
|
});
|
|
4500
|
-
const [anchor, setAnchor] = (0,
|
|
4640
|
+
const [anchor, setAnchor] = (0, import_react36.useState)(null);
|
|
4501
4641
|
function execute({ action, exporter }) {
|
|
4502
4642
|
const { activeColumns, activeItems, items } = table.getState();
|
|
4503
4643
|
const columns = activeColumns.map((column) => column.exportHeader);
|
|
@@ -4519,9 +4659,9 @@ function Export2() {
|
|
|
4519
4659
|
URL.revokeObjectURL(url);
|
|
4520
4660
|
}
|
|
4521
4661
|
}
|
|
4522
|
-
return /* @__PURE__ */ (0,
|
|
4523
|
-
/* @__PURE__ */ (0,
|
|
4524
|
-
/* @__PURE__ */ (0,
|
|
4662
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_jsx_runtime30.Fragment, { children: [
|
|
4663
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(IconButton2, { onClick: (event) => setAnchor(anchor ? null : event.currentTarget), children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(ExportIcon, { css: !!anchor && { color: "var(--primaryMain)" } }) }),
|
|
4664
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
4525
4665
|
Popover2,
|
|
4526
4666
|
{
|
|
4527
4667
|
open: !!anchor,
|
|
@@ -4530,7 +4670,7 @@ function Export2() {
|
|
|
4530
4670
|
css: cssVariables,
|
|
4531
4671
|
className: classes == null ? void 0 : classes.popover,
|
|
4532
4672
|
backdropClassName: classes == null ? void 0 : classes.popoverBackdrop,
|
|
4533
|
-
children: /* @__PURE__ */ (0,
|
|
4673
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
|
|
4534
4674
|
"div",
|
|
4535
4675
|
{
|
|
4536
4676
|
css: {
|
|
@@ -4543,11 +4683,11 @@ function Export2() {
|
|
|
4543
4683
|
}
|
|
4544
4684
|
},
|
|
4545
4685
|
children: [
|
|
4546
|
-
/* @__PURE__ */ (0,
|
|
4547
|
-
exporters.map((entry, index) => /* @__PURE__ */ (0,
|
|
4686
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { css: { marginBottom: "var(--spacing)" }, children: exportTitle }),
|
|
4687
|
+
exporters.map((entry, index) => /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
|
|
4548
4688
|
Button2,
|
|
4549
4689
|
{
|
|
4550
|
-
startIcon: entry.action === "copy" ? /* @__PURE__ */ (0,
|
|
4690
|
+
startIcon: entry.action === "copy" ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Clipboard2, {}) : /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(ExportIcon, {}),
|
|
4551
4691
|
onClick: () => execute(entry),
|
|
4552
4692
|
children: [
|
|
4553
4693
|
entry.action === "copy" ? exportCopy : exportDownload,
|
|
@@ -4567,8 +4707,8 @@ function Export2() {
|
|
|
4567
4707
|
}
|
|
4568
4708
|
|
|
4569
4709
|
// src/components/row.tsx
|
|
4570
|
-
var
|
|
4571
|
-
var
|
|
4710
|
+
var import_react39 = require("@emotion/react");
|
|
4711
|
+
var import_react40 = require("react");
|
|
4572
4712
|
|
|
4573
4713
|
// src/misc/calcClassNames.ts
|
|
4574
4714
|
function calcClassNames(classes, item, index) {
|
|
@@ -4587,15 +4727,15 @@ function calcCss(styles, item, index) {
|
|
|
4587
4727
|
}
|
|
4588
4728
|
|
|
4589
4729
|
// src/components/cell.tsx
|
|
4590
|
-
var
|
|
4591
|
-
var
|
|
4730
|
+
var import_react37 = require("react");
|
|
4731
|
+
var import_jsx_runtime31 = require("@emotion/react/jsx-runtime");
|
|
4592
4732
|
var defaultWrapCell = (content) => {
|
|
4593
4733
|
if (typeof content === "string") {
|
|
4594
|
-
return /* @__PURE__ */ (0,
|
|
4734
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { css: defaultClasses.text, title: content, children: content });
|
|
4595
4735
|
}
|
|
4596
4736
|
return content;
|
|
4597
4737
|
};
|
|
4598
|
-
var Cell = (0,
|
|
4738
|
+
var Cell = (0, import_react37.memo)(function Cell2({ itemId, rowIndex }) {
|
|
4599
4739
|
var _a;
|
|
4600
4740
|
const table = useTableContext();
|
|
4601
4741
|
const columnId = useColumnContext();
|
|
@@ -4611,25 +4751,25 @@ var Cell = (0, import_react36.memo)(function Cell2({ itemId, rowIndex }) {
|
|
|
4611
4751
|
const columnStyleOverride = table.useState((state) => state.columnStyleOverride.get(columnId), {
|
|
4612
4752
|
throttle: 16
|
|
4613
4753
|
});
|
|
4614
|
-
(0,
|
|
4754
|
+
(0, import_react37.useLayoutEffect)(() => {
|
|
4615
4755
|
var _a2, _b;
|
|
4616
4756
|
return (_b = (_a2 = table.getState().props).debugRender) == null ? void 0 : _b.call(_a2, "render cell", itemId, columnId);
|
|
4617
4757
|
});
|
|
4618
|
-
const
|
|
4758
|
+
const className3 = useTheme((t2) => cx(...calcClassNames(t2.classes, item == null ? void 0 : item.value, rowIndex)));
|
|
4619
4759
|
const styles = useTheme((t2) => calcCss(t2.styles, item == null ? void 0 : item.value, rowIndex));
|
|
4620
4760
|
if (!column || !item) return null;
|
|
4621
4761
|
const content = column.renderCell(column.value(item.value), item.value);
|
|
4622
|
-
return /* @__PURE__ */ (0,
|
|
4762
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: className3, css: [defaultClasses.cell, styles], style: columnStyleOverride, children: wrapCell(content, column.value(item.value), item.value, rowIndex) });
|
|
4623
4763
|
});
|
|
4624
4764
|
|
|
4625
4765
|
// src/components/details.tsx
|
|
4626
|
-
var
|
|
4627
|
-
var
|
|
4628
|
-
var Details = (0,
|
|
4766
|
+
var import_react38 = require("react");
|
|
4767
|
+
var import_jsx_runtime32 = require("@emotion/react/jsx-runtime");
|
|
4768
|
+
var Details = (0, import_react38.forwardRef)(function Details2({ itemId, rowIndex }, ref) {
|
|
4629
4769
|
const table = useTableContext();
|
|
4630
4770
|
const classes = useTheme((t2) => t2.classes);
|
|
4631
4771
|
const styles = useTheme((t2) => t2.styles);
|
|
4632
|
-
const { details, className:
|
|
4772
|
+
const { details, className: className3, css: css4 } = table.useState((state) => {
|
|
4633
4773
|
const item = state.activeItemsById.get(itemId);
|
|
4634
4774
|
return {
|
|
4635
4775
|
details: state.expanded.has(itemId) ? state.props.rowDetails instanceof Function ? item ? state.props.rowDetails(item.value, rowIndex) : null : state.props.rowDetails : void 0,
|
|
@@ -4637,11 +4777,11 @@ var Details = (0, import_react37.forwardRef)(function Details2({ itemId, rowInde
|
|
|
4637
4777
|
css: (styles == null ? void 0 : styles.details) instanceof Function ? styles.details(item == null ? void 0 : item.value, rowIndex) : styles == null ? void 0 : styles.details
|
|
4638
4778
|
};
|
|
4639
4779
|
});
|
|
4640
|
-
return details ? /* @__PURE__ */ (0,
|
|
4780
|
+
return details ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { ref, className: className3, css: [defaultClasses.details, css4], children: details }) : null;
|
|
4641
4781
|
});
|
|
4642
4782
|
|
|
4643
4783
|
// src/components/expandControl.tsx
|
|
4644
|
-
var
|
|
4784
|
+
var import_jsx_runtime33 = require("@emotion/react/jsx-runtime");
|
|
4645
4785
|
function ExpandControl({
|
|
4646
4786
|
itemId,
|
|
4647
4787
|
hasDeferredChildren
|
|
@@ -4688,9 +4828,9 @@ function ExpandControl({
|
|
|
4688
4828
|
}
|
|
4689
4829
|
}
|
|
4690
4830
|
if (isExpanded && hasDeferredChildren && !hasChildren) {
|
|
4691
|
-
return /* @__PURE__ */ (0,
|
|
4831
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Spinner2, { css: { margin: "0 var(--spacing)" } });
|
|
4692
4832
|
}
|
|
4693
|
-
return /* @__PURE__ */ (0,
|
|
4833
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(IconButton2, { onClick: toggle2, children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
4694
4834
|
"span",
|
|
4695
4835
|
{
|
|
4696
4836
|
css: {
|
|
@@ -4698,13 +4838,13 @@ function ExpandControl({
|
|
|
4698
4838
|
transition: "all 300ms",
|
|
4699
4839
|
transform: isExpanded ? "rotate3d(0, 0, 1, 90deg)" : "rotate3d(0, 0, 1, 0deg)"
|
|
4700
4840
|
},
|
|
4701
|
-
children: /* @__PURE__ */ (0,
|
|
4841
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ChevronRight2, {})
|
|
4702
4842
|
}
|
|
4703
4843
|
) });
|
|
4704
4844
|
}
|
|
4705
4845
|
|
|
4706
4846
|
// src/components/selectComponent.tsx
|
|
4707
|
-
var
|
|
4847
|
+
var import_jsx_runtime34 = require("@emotion/react/jsx-runtime");
|
|
4708
4848
|
function SelectComponent({ itemId }) {
|
|
4709
4849
|
const table = useTableContext();
|
|
4710
4850
|
const Checkbox2 = useTheme((t2) => t2.components.Checkbox);
|
|
@@ -4753,7 +4893,7 @@ function SelectComponent({ itemId }) {
|
|
|
4753
4893
|
state.lastSelectedId = itemId;
|
|
4754
4894
|
});
|
|
4755
4895
|
}
|
|
4756
|
-
return /* @__PURE__ */ (0,
|
|
4896
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
4757
4897
|
Checkbox2,
|
|
4758
4898
|
{
|
|
4759
4899
|
css: {
|
|
@@ -4767,19 +4907,19 @@ function SelectComponent({ itemId }) {
|
|
|
4767
4907
|
}
|
|
4768
4908
|
|
|
4769
4909
|
// src/components/row.tsx
|
|
4770
|
-
var
|
|
4771
|
-
var Row = (0,
|
|
4910
|
+
var import_jsx_runtime35 = require("@emotion/react/jsx-runtime");
|
|
4911
|
+
var Row = (0, import_react40.memo)(function Row2({
|
|
4772
4912
|
itemId,
|
|
4773
4913
|
rowIndex
|
|
4774
4914
|
}) {
|
|
4775
4915
|
var _a;
|
|
4776
4916
|
const table = useTableContext();
|
|
4777
|
-
const divRef = (0,
|
|
4778
|
-
const detailsDivRef = (0,
|
|
4917
|
+
const divRef = (0, import_react40.useRef)(null);
|
|
4918
|
+
const detailsDivRef = (0, import_react40.useRef)(null);
|
|
4779
4919
|
const classes = useTheme((t2) => t2.classes);
|
|
4780
4920
|
const styles = useTheme((t2) => t2.styles);
|
|
4781
4921
|
const item = table.useState((state) => state.activeItemsById.get(itemId));
|
|
4782
|
-
const wrapRow = (_a = table.useState((state) => state.props.wrapRow)) != null ? _a : (props) => /* @__PURE__ */ (0,
|
|
4922
|
+
const wrapRow = (_a = table.useState((state) => state.props.wrapRow)) != null ? _a : (props) => /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", __spreadValues({}, props));
|
|
4783
4923
|
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;
|
|
4784
4924
|
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;
|
|
4785
4925
|
const subgrid = table.useState((state) => state.props.subgrid);
|
|
@@ -4808,7 +4948,7 @@ var Row = (0, import_react39.memo)(function Row2({
|
|
|
4808
4948
|
hasDetails: state.props.rowDetails instanceof Function ? item2 ? !!state.props.rowDetails(item2.value, rowIndex) : null : !!state.props.rowDetails
|
|
4809
4949
|
};
|
|
4810
4950
|
});
|
|
4811
|
-
(0,
|
|
4951
|
+
(0, import_react40.useLayoutEffect)(() => {
|
|
4812
4952
|
function update() {
|
|
4813
4953
|
table.update((state) => {
|
|
4814
4954
|
if (!divRef.current) {
|
|
@@ -4829,14 +4969,14 @@ var Row = (0, import_react39.memo)(function Row2({
|
|
|
4829
4969
|
handles.forEach((h2) => h2());
|
|
4830
4970
|
};
|
|
4831
4971
|
}, [table, itemId, divRef.current, detailsDivRef.current]);
|
|
4832
|
-
(0,
|
|
4972
|
+
(0, import_react40.useLayoutEffect)(() => {
|
|
4833
4973
|
var _a2, _b;
|
|
4834
4974
|
return (_b = (_a2 = table.getState().props).debugRender) == null ? void 0 : _b.call(_a2, "render row", itemId);
|
|
4835
4975
|
});
|
|
4836
4976
|
if (!item) {
|
|
4837
4977
|
return null;
|
|
4838
4978
|
}
|
|
4839
|
-
return /* @__PURE__ */ (0,
|
|
4979
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_react39.ClassNames, { children: ({ css: css4 }) => /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_jsx_runtime35.Fragment, { children: wrapRow(
|
|
4840
4980
|
{
|
|
4841
4981
|
className: css4([
|
|
4842
4982
|
subgrid ? {
|
|
@@ -4849,8 +4989,8 @@ var Row = (0, import_react39.memo)(function Row2({
|
|
|
4849
4989
|
rowClassName,
|
|
4850
4990
|
rowStyles
|
|
4851
4991
|
]),
|
|
4852
|
-
children: /* @__PURE__ */ (0,
|
|
4853
|
-
/* @__PURE__ */ (0,
|
|
4992
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_jsx_runtime35.Fragment, { children: [
|
|
4993
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
4854
4994
|
"div",
|
|
4855
4995
|
{
|
|
4856
4996
|
className: cellClassName,
|
|
@@ -4858,22 +4998,22 @@ var Row = (0, import_react39.memo)(function Row2({
|
|
|
4858
4998
|
ref: divRef
|
|
4859
4999
|
}
|
|
4860
5000
|
),
|
|
4861
|
-
/* @__PURE__ */ (0,
|
|
5001
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
|
|
4862
5002
|
"div",
|
|
4863
5003
|
{
|
|
4864
5004
|
className: cellClassName,
|
|
4865
5005
|
css: [defaultClasses.cell, defaultClasses.firstCell, css_],
|
|
4866
5006
|
children: [
|
|
4867
|
-
indent > 0 && /* @__PURE__ */ (0,
|
|
4868
|
-
enableSelection && /* @__PURE__ */ (0,
|
|
4869
|
-
(hasChildren || hasDeferredChildren || hasDetails) && /* @__PURE__ */ (0,
|
|
5007
|
+
indent > 0 && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { css: { width: indent * 20 } }),
|
|
5008
|
+
enableSelection && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(SelectComponent, { itemId }),
|
|
5009
|
+
(hasChildren || hasDeferredChildren || hasDetails) && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(ExpandControl, { itemId, hasDeferredChildren }),
|
|
4870
5010
|
rowAction
|
|
4871
5011
|
]
|
|
4872
5012
|
}
|
|
4873
5013
|
),
|
|
4874
|
-
columnIds.map((columnId) => /* @__PURE__ */ (0,
|
|
4875
|
-
/* @__PURE__ */ (0,
|
|
4876
|
-
/* @__PURE__ */ (0,
|
|
5014
|
+
columnIds.map((columnId) => /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(ColumnContext.Provider, { value: columnId, children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Cell, { itemId, rowIndex }) }, columnId)),
|
|
5015
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: cellClassName, css: [defaultClasses.cellFill, css_] }),
|
|
5016
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Details, { ref: detailsDivRef, itemId, rowIndex })
|
|
4877
5017
|
] })
|
|
4878
5018
|
},
|
|
4879
5019
|
item.value,
|
|
@@ -4882,8 +5022,8 @@ var Row = (0, import_react39.memo)(function Row2({
|
|
|
4882
5022
|
});
|
|
4883
5023
|
|
|
4884
5024
|
// src/components/virtualized.tsx
|
|
4885
|
-
var
|
|
4886
|
-
var
|
|
5025
|
+
var import_react41 = require("react");
|
|
5026
|
+
var import_jsx_runtime36 = require("@emotion/react/jsx-runtime");
|
|
4887
5027
|
var findScrollRoot = (x) => {
|
|
4888
5028
|
const parent = x.parentElement;
|
|
4889
5029
|
if (!parent) return document.documentElement;
|
|
@@ -4909,8 +5049,8 @@ function Virtualized(_a) {
|
|
|
4909
5049
|
var _a2, _b2;
|
|
4910
5050
|
const table = useTableContext();
|
|
4911
5051
|
const virtual = table.useState((state) => state.props.virtual);
|
|
4912
|
-
const probeRef = (0,
|
|
4913
|
-
const [, setId] = (0,
|
|
5052
|
+
const probeRef = (0, import_react41.useRef)(null);
|
|
5053
|
+
const [, setId] = (0, import_react41.useState)({});
|
|
4914
5054
|
const {
|
|
4915
5055
|
itemIds = [],
|
|
4916
5056
|
from = 0,
|
|
@@ -4962,8 +5102,8 @@ function Virtualized(_a) {
|
|
|
4962
5102
|
{ throttle: 16 }
|
|
4963
5103
|
);
|
|
4964
5104
|
const throttleScroll = (_b2 = (_a2 = typeof virtual === "boolean" ? void 0 : virtual) == null ? void 0 : _a2.throttleScroll) != null ? _b2 : 16;
|
|
4965
|
-
const update = (0,
|
|
4966
|
-
(0,
|
|
5105
|
+
const update = (0, import_react41.useMemo)(() => throttle2(() => setId({}), throttleScroll), [throttleScroll]);
|
|
5106
|
+
(0, import_react41.useEffect)(() => {
|
|
4967
5107
|
var _a3;
|
|
4968
5108
|
const tableElem = (_a3 = probeRef.current) == null ? void 0 : _a3.parentElement;
|
|
4969
5109
|
if (!tableElem) return;
|
|
@@ -4980,7 +5120,7 @@ function Virtualized(_a) {
|
|
|
4980
5120
|
window.removeEventListener("resize", update2, true);
|
|
4981
5121
|
};
|
|
4982
5122
|
}, [table, probeRef.current]);
|
|
4983
|
-
(0,
|
|
5123
|
+
(0, import_react41.useEffect)(() => {
|
|
4984
5124
|
if (!virtual || !probeRef.current) return;
|
|
4985
5125
|
window.addEventListener("scroll", update, true);
|
|
4986
5126
|
window.addEventListener("resize", update, true);
|
|
@@ -4989,24 +5129,24 @@ function Virtualized(_a) {
|
|
|
4989
5129
|
window.removeEventListener("resize", update, true);
|
|
4990
5130
|
};
|
|
4991
5131
|
}, [update, virtual]);
|
|
4992
|
-
(0,
|
|
4993
|
-
(0,
|
|
5132
|
+
(0, import_react41.useEffect)(() => update.cancel, [update]);
|
|
5133
|
+
(0, import_react41.useLayoutEffect)(
|
|
4994
5134
|
() => {
|
|
4995
5135
|
var _a3, _b3;
|
|
4996
5136
|
return (_b3 = (_a3 = table.getState().props).debugRender) == null ? void 0 : _b3.call(_a3, `Virtualalized render ${from} to ${to}`);
|
|
4997
5137
|
}
|
|
4998
5138
|
);
|
|
4999
|
-
return /* @__PURE__ */ (0,
|
|
5139
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", __spreadProps(__spreadValues({}, props), { children: [
|
|
5000
5140
|
header,
|
|
5001
|
-
virtual && /* @__PURE__ */ (0,
|
|
5141
|
+
virtual && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { style: { gridColumn: "1 / -1", height: before }, ref: probeRef }),
|
|
5002
5142
|
children(itemIds, from),
|
|
5003
|
-
virtual && /* @__PURE__ */ (0,
|
|
5143
|
+
virtual && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { style: { gridColumn: "1 / -1", height: after } }),
|
|
5004
5144
|
footer
|
|
5005
5145
|
] }));
|
|
5006
5146
|
}
|
|
5007
5147
|
|
|
5008
5148
|
// src/components/table.tsx
|
|
5009
|
-
var
|
|
5149
|
+
var import_jsx_runtime37 = require("@emotion/react/jsx-runtime");
|
|
5010
5150
|
function Table(props) {
|
|
5011
5151
|
const [table, resetState] = useTableState(props);
|
|
5012
5152
|
const [isHydrated, clearStorage] = useTableStateStorage(table);
|
|
@@ -5016,25 +5156,25 @@ function Table(props) {
|
|
|
5016
5156
|
resetState();
|
|
5017
5157
|
});
|
|
5018
5158
|
}
|
|
5019
|
-
(0,
|
|
5159
|
+
(0, import_react42.useLayoutEffect)(() => {
|
|
5020
5160
|
var _a, _b;
|
|
5021
5161
|
return (_b = (_a = table.getState().props).debugRender) == null ? void 0 : _b.call(_a, "render table");
|
|
5022
5162
|
});
|
|
5023
|
-
return /* @__PURE__ */ (0,
|
|
5163
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(TableContext.Provider, { value: table, children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(TableResetContext.Provider, { value: reset, children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(TableMemoContextProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(TableLoadingState, { isHydrated }) }) }) });
|
|
5024
5164
|
}
|
|
5025
5165
|
function TableLoadingState({ isHydrated }) {
|
|
5026
5166
|
const loadingText = useTheme((t2) => t2.text.loading);
|
|
5027
|
-
const [showLoading, setShowLoading] = (0,
|
|
5028
|
-
(0,
|
|
5167
|
+
const [showLoading, setShowLoading] = (0, import_react42.useState)(false);
|
|
5168
|
+
(0, import_react42.useEffect)(() => {
|
|
5029
5169
|
const handle = setTimeout(() => setShowLoading(true), 500);
|
|
5030
5170
|
return () => clearTimeout(handle);
|
|
5031
5171
|
});
|
|
5032
|
-
return /* @__PURE__ */ (0,
|
|
5033
|
-
!isHydrated && showLoading && /* @__PURE__ */ (0,
|
|
5034
|
-
/* @__PURE__ */ (0,
|
|
5172
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(import_jsx_runtime37.Fragment, { children: [
|
|
5173
|
+
!isHydrated && showLoading && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { children: loadingText }),
|
|
5174
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(TableInner, { hidden: !isHydrated })
|
|
5035
5175
|
] });
|
|
5036
5176
|
}
|
|
5037
|
-
var TableInner = (0,
|
|
5177
|
+
var TableInner = (0, import_react42.memo)(function TableInner2({ hidden }) {
|
|
5038
5178
|
const table = useTableContext();
|
|
5039
5179
|
const fullWidth = table.useState((state) => state.props.fullWidth);
|
|
5040
5180
|
const visibleColumns = table.useState(
|
|
@@ -5068,11 +5208,11 @@ var TableInner = (0, import_react41.memo)(function TableInner2({ hidden }) {
|
|
|
5068
5208
|
);
|
|
5069
5209
|
const cssVariables = useCssVariables();
|
|
5070
5210
|
const enableClearFiltersButton = table.useState((state) => state.props.enableClearFiltersButton);
|
|
5071
|
-
(0,
|
|
5211
|
+
(0, import_react42.useLayoutEffect)(() => {
|
|
5072
5212
|
var _a, _b;
|
|
5073
5213
|
return (_b = (_a = table.getState().props).debugRender) == null ? void 0 : _b.call(_a, "render table inner");
|
|
5074
5214
|
});
|
|
5075
|
-
return /* @__PURE__ */ (0,
|
|
5215
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
5076
5216
|
Virtualized,
|
|
5077
5217
|
{
|
|
5078
5218
|
className: classes == null ? void 0 : classes.table,
|
|
@@ -5091,8 +5231,8 @@ var TableInner = (0, import_react41.memo)(function TableInner2({ hidden }) {
|
|
|
5091
5231
|
fullWidth === "left" || fullWidth === true ? "auto" : "0"
|
|
5092
5232
|
].join(" ")
|
|
5093
5233
|
},
|
|
5094
|
-
header: /* @__PURE__ */ (0,
|
|
5095
|
-
/* @__PURE__ */ (0,
|
|
5234
|
+
header: /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(import_jsx_runtime37.Fragment, { children: [
|
|
5235
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
5096
5236
|
"div",
|
|
5097
5237
|
{
|
|
5098
5238
|
className: classes == null ? void 0 : classes.headerCell,
|
|
@@ -5105,7 +5245,7 @@ var TableInner = (0, import_react41.memo)(function TableInner2({ hidden }) {
|
|
|
5105
5245
|
]
|
|
5106
5246
|
}
|
|
5107
5247
|
),
|
|
5108
|
-
/* @__PURE__ */ (0,
|
|
5248
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(
|
|
5109
5249
|
"div",
|
|
5110
5250
|
{
|
|
5111
5251
|
className: classes == null ? void 0 : classes.headerCell,
|
|
@@ -5117,18 +5257,18 @@ var TableInner = (0, import_react41.memo)(function TableInner2({ hidden }) {
|
|
|
5117
5257
|
styles == null ? void 0 : styles.headerCell
|
|
5118
5258
|
],
|
|
5119
5259
|
children: [
|
|
5120
|
-
enableSelection && /* @__PURE__ */ (0,
|
|
5121
|
-
enableColumnSelection && /* @__PURE__ */ (0,
|
|
5122
|
-
enableExport && /* @__PURE__ */ (0,
|
|
5123
|
-
(enableSelection || enableColumnSelection || enableExport) && /* @__PURE__ */ (0,
|
|
5124
|
-
/* @__PURE__ */ (0,
|
|
5125
|
-
/* @__PURE__ */ (0,
|
|
5260
|
+
enableSelection && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(SelectComponent, {}),
|
|
5261
|
+
enableColumnSelection && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(ColumnSelection, {}),
|
|
5262
|
+
enableExport && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Export2, {}),
|
|
5263
|
+
(enableSelection || enableColumnSelection || enableExport) && /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(import_jsx_runtime37.Fragment, { children: [
|
|
5264
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { css: { flex: 1 } }),
|
|
5265
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(ResizeHandleView, {})
|
|
5126
5266
|
] })
|
|
5127
5267
|
]
|
|
5128
5268
|
}
|
|
5129
5269
|
),
|
|
5130
|
-
/* @__PURE__ */ (0,
|
|
5131
|
-
/* @__PURE__ */ (0,
|
|
5270
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(ColumnHeaderContext.Provider, { children: visibleColumns.map((column) => /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(ColumnContext.Provider, { value: column.id, children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(ColumnHeader, {}) }, column.id)) }),
|
|
5271
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
5132
5272
|
"div",
|
|
5133
5273
|
{
|
|
5134
5274
|
className: classes == null ? void 0 : classes.headerCell,
|
|
@@ -5141,10 +5281,10 @@ var TableInner = (0, import_react41.memo)(function TableInner2({ hidden }) {
|
|
|
5141
5281
|
}
|
|
5142
5282
|
)
|
|
5143
5283
|
] }),
|
|
5144
|
-
footer: /* @__PURE__ */ (0,
|
|
5145
|
-
enableClearFiltersButton && hasActiveFilters && /* @__PURE__ */ (0,
|
|
5146
|
-
hasFooter && /* @__PURE__ */ (0,
|
|
5147
|
-
/* @__PURE__ */ (0,
|
|
5284
|
+
footer: /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(import_jsx_runtime37.Fragment, { children: [
|
|
5285
|
+
enableClearFiltersButton && hasActiveFilters && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(ClearFiltersButton, {}),
|
|
5286
|
+
hasFooter && /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(import_jsx_runtime37.Fragment, { children: [
|
|
5287
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
5148
5288
|
"div",
|
|
5149
5289
|
{
|
|
5150
5290
|
className: classes == null ? void 0 : classes.footerCell,
|
|
@@ -5157,7 +5297,7 @@ var TableInner = (0, import_react41.memo)(function TableInner2({ hidden }) {
|
|
|
5157
5297
|
]
|
|
5158
5298
|
}
|
|
5159
5299
|
),
|
|
5160
|
-
/* @__PURE__ */ (0,
|
|
5300
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
5161
5301
|
"div",
|
|
5162
5302
|
{
|
|
5163
5303
|
className: classes == null ? void 0 : classes.footerCell,
|
|
@@ -5169,8 +5309,8 @@ var TableInner = (0, import_react41.memo)(function TableInner2({ hidden }) {
|
|
|
5169
5309
|
]
|
|
5170
5310
|
}
|
|
5171
5311
|
),
|
|
5172
|
-
visibleColumns.map((column) => /* @__PURE__ */ (0,
|
|
5173
|
-
/* @__PURE__ */ (0,
|
|
5312
|
+
visibleColumns.map((column) => /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(ColumnContext.Provider, { value: column.id, children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(ColumnFooter, {}) }, column.id)),
|
|
5313
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
5174
5314
|
"div",
|
|
5175
5315
|
{
|
|
5176
5316
|
className: classes == null ? void 0 : classes.footerCell,
|
|
@@ -5184,7 +5324,7 @@ var TableInner = (0, import_react41.memo)(function TableInner2({ hidden }) {
|
|
|
5184
5324
|
)
|
|
5185
5325
|
] })
|
|
5186
5326
|
] }),
|
|
5187
|
-
children: (itemIds, startIndex) => itemIds.map((itemId, index) => /* @__PURE__ */ (0,
|
|
5327
|
+
children: (itemIds, startIndex) => itemIds.map((itemId, index) => /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Row, { itemId, rowIndex: startIndex + index }, itemId))
|
|
5188
5328
|
}
|
|
5189
5329
|
);
|
|
5190
5330
|
});
|
|
@@ -5210,7 +5350,7 @@ var termMatch = (text, query) => {
|
|
|
5210
5350
|
};
|
|
5211
5351
|
|
|
5212
5352
|
// src/components/textFilter.tsx
|
|
5213
|
-
var
|
|
5353
|
+
var import_jsx_runtime38 = require("@emotion/react/jsx-runtime");
|
|
5214
5354
|
function TextFilter(_a) {
|
|
5215
5355
|
var _b = _a, {
|
|
5216
5356
|
compare = textMatch,
|
|
@@ -5234,19 +5374,19 @@ function TextFilter(_a) {
|
|
|
5234
5374
|
return compare(value2, filterValue);
|
|
5235
5375
|
}
|
|
5236
5376
|
}));
|
|
5237
|
-
return /* @__PURE__ */ (0,
|
|
5377
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
5238
5378
|
"div",
|
|
5239
5379
|
{
|
|
5240
5380
|
css: {
|
|
5241
5381
|
padding: `calc(var(--spacing) * 2)`,
|
|
5242
5382
|
display: "grid"
|
|
5243
5383
|
},
|
|
5244
|
-
children: /* @__PURE__ */ (0,
|
|
5384
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
5245
5385
|
AutoFocusTextField,
|
|
5246
5386
|
{
|
|
5247
5387
|
value,
|
|
5248
5388
|
onChange: (event) => onChange(event.target.value),
|
|
5249
|
-
endIcon: /* @__PURE__ */ (0,
|
|
5389
|
+
endIcon: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(IconButton2, { onClick: () => onChange(""), children: !value ? /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Search2, {}) : /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Clear2, {}) }),
|
|
5250
5390
|
placeholder
|
|
5251
5391
|
}
|
|
5252
5392
|
)
|