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.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);
|
|
@@ -2692,14 +2829,14 @@ function DateFilter(_a) {
|
|
|
2692
2829
|
return dateIntersect(filterValue, value2);
|
|
2693
2830
|
}
|
|
2694
2831
|
}));
|
|
2695
|
-
return /* @__PURE__ */ (0,
|
|
2832
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2696
2833
|
"div",
|
|
2697
2834
|
{
|
|
2698
2835
|
css: {
|
|
2699
2836
|
padding: "calc(var(--spacing) * 2)",
|
|
2700
2837
|
display: "grid"
|
|
2701
2838
|
},
|
|
2702
|
-
children: /* @__PURE__ */ (0,
|
|
2839
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2703
2840
|
DatePicker,
|
|
2704
2841
|
{
|
|
2705
2842
|
rangeSelect: !singleSelect,
|
|
@@ -2719,8 +2856,8 @@ function DateFilter(_a) {
|
|
|
2719
2856
|
}
|
|
2720
2857
|
|
|
2721
2858
|
// src/components/numberField.tsx
|
|
2722
|
-
var
|
|
2723
|
-
var
|
|
2859
|
+
var import_react20 = require("react");
|
|
2860
|
+
var import_jsx_runtime19 = require("@emotion/react/jsx-runtime");
|
|
2724
2861
|
var Pattern = /^-?\d*(?:[.,]\d*)?$/;
|
|
2725
2862
|
var printNumber = (value, locale) => {
|
|
2726
2863
|
if (value === null) {
|
|
@@ -2745,8 +2882,8 @@ function NumberField(_a) {
|
|
|
2745
2882
|
]);
|
|
2746
2883
|
const locale = useTheme((t2) => t2.locale);
|
|
2747
2884
|
const TextField2 = useTheme((t2) => t2.components.TextField);
|
|
2748
|
-
const [value = printNumber(commitedValue, locale), setValue] = (0,
|
|
2749
|
-
return /* @__PURE__ */ (0,
|
|
2885
|
+
const [value = printNumber(commitedValue, locale), setValue] = (0, import_react20.useState)();
|
|
2886
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
2750
2887
|
TextField2,
|
|
2751
2888
|
__spreadProps(__spreadValues({
|
|
2752
2889
|
value,
|
|
@@ -2771,7 +2908,7 @@ function NumberField(_a) {
|
|
|
2771
2908
|
}
|
|
2772
2909
|
|
|
2773
2910
|
// src/components/rangeFilter.tsx
|
|
2774
|
-
var
|
|
2911
|
+
var import_jsx_runtime20 = require("@emotion/react/jsx-runtime");
|
|
2775
2912
|
function RangeFilter(_a) {
|
|
2776
2913
|
var _b = _a, {
|
|
2777
2914
|
min,
|
|
@@ -2825,7 +2962,7 @@ function RangeFilter(_a) {
|
|
|
2825
2962
|
return value2 !== null && value2 >= min2 && value2 <= max2;
|
|
2826
2963
|
}
|
|
2827
2964
|
}));
|
|
2828
|
-
return /* @__PURE__ */ (0,
|
|
2965
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2829
2966
|
"div",
|
|
2830
2967
|
{
|
|
2831
2968
|
css: {
|
|
@@ -2833,7 +2970,7 @@ function RangeFilter(_a) {
|
|
|
2833
2970
|
display: "grid",
|
|
2834
2971
|
gap: "1em"
|
|
2835
2972
|
},
|
|
2836
|
-
children: /* @__PURE__ */ (0,
|
|
2973
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
2837
2974
|
"div",
|
|
2838
2975
|
{
|
|
2839
2976
|
css: {
|
|
@@ -2845,12 +2982,12 @@ function RangeFilter(_a) {
|
|
|
2845
2982
|
}
|
|
2846
2983
|
},
|
|
2847
2984
|
children: [
|
|
2848
|
-
/* @__PURE__ */ (0,
|
|
2985
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2849
2986
|
NumberField,
|
|
2850
2987
|
{
|
|
2851
2988
|
value: value == null ? void 0 : value[0],
|
|
2852
2989
|
onChange: (newMin) => onChange(normalize(newMin, value == null ? void 0 : value[1], "min", { min, max })),
|
|
2853
|
-
startIcon: /* @__PURE__ */ (0,
|
|
2990
|
+
startIcon: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { css: { margin: "0 calc(var(--spacing) * 2)" }, children: rangeMinText }),
|
|
2854
2991
|
placeholder: String(minValue != null ? minValue : ""),
|
|
2855
2992
|
css: {
|
|
2856
2993
|
alignItems: "baseline"
|
|
@@ -2858,12 +2995,12 @@ function RangeFilter(_a) {
|
|
|
2858
2995
|
}
|
|
2859
2996
|
),
|
|
2860
2997
|
"-",
|
|
2861
|
-
/* @__PURE__ */ (0,
|
|
2998
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2862
2999
|
NumberField,
|
|
2863
3000
|
{
|
|
2864
3001
|
value: value == null ? void 0 : value[1],
|
|
2865
3002
|
onChange: (newMax) => onChange(normalize(value == null ? void 0 : value[0], newMax, "max", { min, max })),
|
|
2866
|
-
startIcon: /* @__PURE__ */ (0,
|
|
3003
|
+
startIcon: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { css: { margin: "0 calc(var(--spacing) * 2)" }, children: rangeMaxText }),
|
|
2867
3004
|
placeholder: String(maxValue != null ? maxValue : ""),
|
|
2868
3005
|
css: {
|
|
2869
3006
|
alignItems: "baseline"
|
|
@@ -2893,16 +3030,16 @@ function clamp(value, min = Number.NEGATIVE_INFINITY, max = Number.POSITIVE_INFI
|
|
|
2893
3030
|
}
|
|
2894
3031
|
|
|
2895
3032
|
// src/components/selectFilter.tsx
|
|
2896
|
-
var
|
|
3033
|
+
var import_react22 = require("react");
|
|
2897
3034
|
|
|
2898
3035
|
// src/components/formControlLabel.tsx
|
|
2899
|
-
var
|
|
3036
|
+
var import_jsx_runtime21 = require("@emotion/react/jsx-runtime");
|
|
2900
3037
|
function FormControlLabel({
|
|
2901
3038
|
control,
|
|
2902
3039
|
label,
|
|
2903
3040
|
disabled
|
|
2904
3041
|
}) {
|
|
2905
|
-
return /* @__PURE__ */ (0,
|
|
3042
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
2906
3043
|
"label",
|
|
2907
3044
|
{
|
|
2908
3045
|
css: [
|
|
@@ -2919,14 +3056,14 @@ function FormControlLabel({
|
|
|
2919
3056
|
],
|
|
2920
3057
|
children: [
|
|
2921
3058
|
control,
|
|
2922
|
-
/* @__PURE__ */ (0,
|
|
3059
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { css: { marginLeft: "var(--spacing)" }, children: label })
|
|
2923
3060
|
]
|
|
2924
3061
|
}
|
|
2925
3062
|
);
|
|
2926
3063
|
}
|
|
2927
3064
|
|
|
2928
3065
|
// src/components/virtualList.tsx
|
|
2929
|
-
var
|
|
3066
|
+
var import_react21 = require("react");
|
|
2930
3067
|
|
|
2931
3068
|
// src/misc/throttle.ts
|
|
2932
3069
|
function throttle2(function_, ms) {
|
|
@@ -2967,7 +3104,7 @@ function throttle2(function_, ms) {
|
|
|
2967
3104
|
}
|
|
2968
3105
|
|
|
2969
3106
|
// src/components/virtualList.tsx
|
|
2970
|
-
var
|
|
3107
|
+
var import_jsx_runtime22 = require("@emotion/react/jsx-runtime");
|
|
2971
3108
|
function VirtualList(_a) {
|
|
2972
3109
|
var _b = _a, {
|
|
2973
3110
|
virtual = true,
|
|
@@ -2979,11 +3116,11 @@ function VirtualList(_a) {
|
|
|
2979
3116
|
"children"
|
|
2980
3117
|
]);
|
|
2981
3118
|
var _a2, _b2, _c, _d, _e;
|
|
2982
|
-
const container = (0,
|
|
2983
|
-
const [, setId] = (0,
|
|
3119
|
+
const container = (0, import_react21.useRef)(null);
|
|
3120
|
+
const [, setId] = (0, import_react21.useState)({});
|
|
2984
3121
|
const throttleScroll = (_b2 = (_a2 = typeof virtual === "boolean" ? void 0 : virtual) == null ? void 0 : _a2.throttleScroll) != null ? _b2 : 16;
|
|
2985
|
-
const update = (0,
|
|
2986
|
-
(0,
|
|
3122
|
+
const update = (0, import_react21.useMemo)(() => throttle2(() => setId({}), throttleScroll), [throttleScroll]);
|
|
3123
|
+
(0, import_react21.useEffect)(() => {
|
|
2987
3124
|
if (!virtual) return;
|
|
2988
3125
|
const ro = new ResizeObserver(update);
|
|
2989
3126
|
if (container.current) {
|
|
@@ -2997,7 +3134,7 @@ function VirtualList(_a) {
|
|
|
2997
3134
|
};
|
|
2998
3135
|
}, [update, virtual, throttleScroll]);
|
|
2999
3136
|
if (!virtual) {
|
|
3000
|
-
return /* @__PURE__ */ (0,
|
|
3137
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
3001
3138
|
"div",
|
|
3002
3139
|
__spreadProps(__spreadValues({}, props), {
|
|
3003
3140
|
css: {
|
|
@@ -3028,7 +3165,7 @@ function VirtualList(_a) {
|
|
|
3028
3165
|
) : 1;
|
|
3029
3166
|
const before = from * itemHeight;
|
|
3030
3167
|
const after = (items.length - to) * itemHeight;
|
|
3031
|
-
return /* @__PURE__ */ (0,
|
|
3168
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
3032
3169
|
"div",
|
|
3033
3170
|
__spreadProps(__spreadValues({}, props), {
|
|
3034
3171
|
onScroll: (event) => {
|
|
@@ -3042,9 +3179,9 @@ function VirtualList(_a) {
|
|
|
3042
3179
|
display: "grid"
|
|
3043
3180
|
},
|
|
3044
3181
|
children: [
|
|
3045
|
-
/* @__PURE__ */ (0,
|
|
3182
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { "data-virtual-before": true, style: { height: before } }),
|
|
3046
3183
|
items.slice(from, to).map((item, index) => children(item, index + from)),
|
|
3047
|
-
/* @__PURE__ */ (0,
|
|
3184
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { "data-virtual-after": true, style: { height: after } })
|
|
3048
3185
|
]
|
|
3049
3186
|
})
|
|
3050
3187
|
);
|
|
@@ -3058,7 +3195,7 @@ function averageItemHeight(container) {
|
|
|
3058
3195
|
}
|
|
3059
3196
|
|
|
3060
3197
|
// src/components/selectFilter.tsx
|
|
3061
|
-
var
|
|
3198
|
+
var import_jsx_runtime23 = require("@emotion/react/jsx-runtime");
|
|
3062
3199
|
function toggle(set, value, singleSelect) {
|
|
3063
3200
|
const newSet = new Set(singleSelect ? [] : set);
|
|
3064
3201
|
if (set.has(value)) {
|
|
@@ -3116,17 +3253,17 @@ function SelectFilter(_a) {
|
|
|
3116
3253
|
)
|
|
3117
3254
|
);
|
|
3118
3255
|
});
|
|
3119
|
-
const [query, setQuery] = (0,
|
|
3256
|
+
const [query, setQuery] = (0, import_react22.useState)("");
|
|
3120
3257
|
const filtered = options.filter(
|
|
3121
3258
|
(option) => !query || stringValue(option).toLowerCase().includes(query.toLowerCase())
|
|
3122
3259
|
);
|
|
3123
|
-
const delayedValue = (0,
|
|
3260
|
+
const delayedValue = (0, import_react22.useMemo)(() => value, [isActive]);
|
|
3124
3261
|
const ordered = filtered.filter((option) => delayedValue.has(option)).concat(filtered.filter((option) => !delayedValue.has(option)));
|
|
3125
3262
|
const Button2 = useTheme((t2) => t2.components.Button);
|
|
3126
|
-
(0,
|
|
3263
|
+
(0, import_react22.useEffect)(() => {
|
|
3127
3264
|
setQuery("");
|
|
3128
3265
|
}, [isActive]);
|
|
3129
|
-
return /* @__PURE__ */ (0,
|
|
3266
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
3130
3267
|
"div",
|
|
3131
3268
|
{
|
|
3132
3269
|
css: {
|
|
@@ -3136,16 +3273,16 @@ function SelectFilter(_a) {
|
|
|
3136
3273
|
gap: "var(--spacing)"
|
|
3137
3274
|
},
|
|
3138
3275
|
children: [
|
|
3139
|
-
!hideSearchField && /* @__PURE__ */ (0,
|
|
3276
|
+
!hideSearchField && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
3140
3277
|
AutoFocusTextField,
|
|
3141
3278
|
{
|
|
3142
3279
|
value: query,
|
|
3143
3280
|
onChange: (event) => setQuery(event.target.value),
|
|
3144
|
-
endIcon: /* @__PURE__ */ (0,
|
|
3281
|
+
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
3282
|
css: { marginBottom: "var(--spacing)" }
|
|
3146
3283
|
}
|
|
3147
3284
|
),
|
|
3148
|
-
!hideResetButton && /* @__PURE__ */ (0,
|
|
3285
|
+
!hideResetButton && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
3149
3286
|
Button2,
|
|
3150
3287
|
{
|
|
3151
3288
|
disabled: value.size === 0,
|
|
@@ -3160,7 +3297,7 @@ function SelectFilter(_a) {
|
|
|
3160
3297
|
children: deselectAll
|
|
3161
3298
|
}
|
|
3162
3299
|
),
|
|
3163
|
-
/* @__PURE__ */ (0,
|
|
3300
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
3164
3301
|
VirtualList,
|
|
3165
3302
|
{
|
|
3166
3303
|
items: ordered,
|
|
@@ -3172,10 +3309,10 @@ function SelectFilter(_a) {
|
|
|
3172
3309
|
display: "grid",
|
|
3173
3310
|
gridTemplateColumns: "minmax(0, 1fr)"
|
|
3174
3311
|
},
|
|
3175
|
-
children: (option, index) => /* @__PURE__ */ (0,
|
|
3312
|
+
children: (option, index) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
3176
3313
|
FormControlLabel,
|
|
3177
3314
|
{
|
|
3178
|
-
control: /* @__PURE__ */ (0,
|
|
3315
|
+
control: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
3179
3316
|
Checkbox2,
|
|
3180
3317
|
{
|
|
3181
3318
|
checked: value.has(option),
|
|
@@ -3188,17 +3325,17 @@ function SelectFilter(_a) {
|
|
|
3188
3325
|
)
|
|
3189
3326
|
}
|
|
3190
3327
|
),
|
|
3191
|
-
ordered.length === 0 && /* @__PURE__ */ (0,
|
|
3328
|
+
ordered.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { css: { textAlign: "center" }, children: noResults })
|
|
3192
3329
|
]
|
|
3193
3330
|
}
|
|
3194
3331
|
);
|
|
3195
3332
|
}
|
|
3196
3333
|
|
|
3197
3334
|
// src/components/table.tsx
|
|
3198
|
-
var
|
|
3335
|
+
var import_react42 = require("react");
|
|
3199
3336
|
|
|
3200
3337
|
// src/internalState/tableStateStorage.ts
|
|
3201
|
-
var
|
|
3338
|
+
var import_react23 = require("react");
|
|
3202
3339
|
|
|
3203
3340
|
// src/misc/queue.ts
|
|
3204
3341
|
var Queue = class {
|
|
@@ -3282,9 +3419,9 @@ function parse(value) {
|
|
|
3282
3419
|
});
|
|
3283
3420
|
}
|
|
3284
3421
|
function useTableStateStorage(table) {
|
|
3285
|
-
const [isHydrated, setIsHydrated] = (0,
|
|
3286
|
-
const [q2] = (0,
|
|
3287
|
-
(0,
|
|
3422
|
+
const [isHydrated, setIsHydrated] = (0, import_react23.useState)(false);
|
|
3423
|
+
const [q2] = (0, import_react23.useState)(() => new Queue());
|
|
3424
|
+
(0, import_react23.useEffect)(() => {
|
|
3288
3425
|
const { persist } = table.getState().props;
|
|
3289
3426
|
if (!persist) {
|
|
3290
3427
|
setIsHydrated(true);
|
|
@@ -3344,7 +3481,7 @@ function useTableStateStorage(table) {
|
|
|
3344
3481
|
isCanceled = true;
|
|
3345
3482
|
};
|
|
3346
3483
|
}, [table]);
|
|
3347
|
-
(0,
|
|
3484
|
+
(0, import_react23.useEffect)(() => {
|
|
3348
3485
|
if (!isHydrated) return;
|
|
3349
3486
|
return table.subscribe(
|
|
3350
3487
|
(state) => {
|
|
@@ -3405,13 +3542,13 @@ function useTableStateStorage(table) {
|
|
|
3405
3542
|
|
|
3406
3543
|
// src/internalState/useTableState.ts
|
|
3407
3544
|
var import_immer6 = require("immer");
|
|
3408
|
-
var
|
|
3545
|
+
var import_react31 = require("react");
|
|
3409
3546
|
|
|
3410
3547
|
// src/internalState/calcItems.ts
|
|
3411
3548
|
var import_immer4 = require("immer");
|
|
3412
|
-
var
|
|
3549
|
+
var import_react24 = require("react");
|
|
3413
3550
|
function calcItems(state) {
|
|
3414
|
-
(0,
|
|
3551
|
+
(0, import_react24.useEffect)(
|
|
3415
3552
|
() => state.addReaction(
|
|
3416
3553
|
(state2) => [
|
|
3417
3554
|
state2.props.items,
|
|
@@ -3530,7 +3667,7 @@ function calcItems(state) {
|
|
|
3530
3667
|
}
|
|
3531
3668
|
|
|
3532
3669
|
// src/internalState/calcProps.ts
|
|
3533
|
-
var
|
|
3670
|
+
var import_react25 = require("react");
|
|
3534
3671
|
|
|
3535
3672
|
// src/exporters/serializer.ts
|
|
3536
3673
|
function defaultSerializer(x) {
|
|
@@ -3579,7 +3716,7 @@ var defaultProps = {
|
|
|
3579
3716
|
};
|
|
3580
3717
|
function calcProps(props) {
|
|
3581
3718
|
const cache = useTableMemo();
|
|
3582
|
-
return (0,
|
|
3719
|
+
return (0, import_react25.useMemo)(
|
|
3583
3720
|
() => overrides(defaultProps, calc(props, cache)),
|
|
3584
3721
|
[props]
|
|
3585
3722
|
);
|
|
@@ -3687,9 +3824,9 @@ function calc(props, cache) {
|
|
|
3687
3824
|
}
|
|
3688
3825
|
|
|
3689
3826
|
// src/internalState/cleanupState.ts
|
|
3690
|
-
var
|
|
3827
|
+
var import_react26 = require("react");
|
|
3691
3828
|
function cleanupState(state) {
|
|
3692
|
-
(0,
|
|
3829
|
+
(0, import_react26.useEffect)(
|
|
3693
3830
|
() => state.addReaction(
|
|
3694
3831
|
(state2) => [
|
|
3695
3832
|
state2.props.columns,
|
|
@@ -3749,9 +3886,9 @@ function cleanupState(state) {
|
|
|
3749
3886
|
}
|
|
3750
3887
|
|
|
3751
3888
|
// src/internalState/filterColumns.ts
|
|
3752
|
-
var
|
|
3889
|
+
var import_react27 = require("react");
|
|
3753
3890
|
function filterColumns(state) {
|
|
3754
|
-
(0,
|
|
3891
|
+
(0, import_react27.useEffect)(
|
|
3755
3892
|
() => state.addReaction(
|
|
3756
3893
|
(state2) => [
|
|
3757
3894
|
state2.props.columns,
|
|
@@ -3779,9 +3916,9 @@ function filterColumns(state) {
|
|
|
3779
3916
|
}
|
|
3780
3917
|
|
|
3781
3918
|
// src/internalState/normalizeExpanded.ts
|
|
3782
|
-
var
|
|
3919
|
+
var import_react28 = require("react");
|
|
3783
3920
|
function normalizeExpanded(table) {
|
|
3784
|
-
(0,
|
|
3921
|
+
(0, import_react28.useEffect)(
|
|
3785
3922
|
() => table.addReaction(
|
|
3786
3923
|
(state) => [state.props.expandOnlyOne, state.expanded, state.itemsById],
|
|
3787
3924
|
([expandOnlyOne, , itemsById], state) => {
|
|
@@ -3825,9 +3962,9 @@ function normalizeExpanded(table) {
|
|
|
3825
3962
|
}
|
|
3826
3963
|
|
|
3827
3964
|
// src/internalState/syncSelections.ts
|
|
3828
|
-
var
|
|
3965
|
+
var import_react29 = require("react");
|
|
3829
3966
|
function syncSelections(table) {
|
|
3830
|
-
(0,
|
|
3967
|
+
(0, import_react29.useEffect)(
|
|
3831
3968
|
() => table.addReaction(
|
|
3832
3969
|
(state) => [state.props.selectSyncChildren, state.selection, state.activeItems],
|
|
3833
3970
|
([selectSyncChildren, selection, activeItems], state) => {
|
|
@@ -3854,13 +3991,13 @@ function syncSelections(table) {
|
|
|
3854
3991
|
|
|
3855
3992
|
// src/internalState/watchDisplaySize.ts
|
|
3856
3993
|
var import_immer5 = require("immer");
|
|
3857
|
-
var
|
|
3994
|
+
var import_react30 = require("react");
|
|
3858
3995
|
var DEFAULT_DISPLAY_SIZES = {
|
|
3859
3996
|
mobile: 400,
|
|
3860
3997
|
desktop: Infinity
|
|
3861
3998
|
};
|
|
3862
3999
|
function watchDisplaySize(state) {
|
|
3863
|
-
(0,
|
|
4000
|
+
(0, import_react30.useEffect)(
|
|
3864
4001
|
() => state.addReaction(
|
|
3865
4002
|
(state2) => ({
|
|
3866
4003
|
displaySizePx: state2.displaySizePx,
|
|
@@ -3882,7 +4019,7 @@ function watchDisplaySize(state) {
|
|
|
3882
4019
|
),
|
|
3883
4020
|
[state]
|
|
3884
4021
|
);
|
|
3885
|
-
(0,
|
|
4022
|
+
(0, import_react30.useEffect)(
|
|
3886
4023
|
() => state.addReaction(
|
|
3887
4024
|
(state2) => ({
|
|
3888
4025
|
props: state2.normalizedProps,
|
|
@@ -3901,7 +4038,7 @@ function watchDisplaySize(state) {
|
|
|
3901
4038
|
|
|
3902
4039
|
// src/internalState/useTableState.ts
|
|
3903
4040
|
function useTableState(_props) {
|
|
3904
|
-
const [key, setKey] = (0,
|
|
4041
|
+
const [key, setKey] = (0, import_react31.useState)({});
|
|
3905
4042
|
const props = calcProps(_props);
|
|
3906
4043
|
function reset() {
|
|
3907
4044
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
@@ -3920,7 +4057,7 @@ function useTableState(_props) {
|
|
|
3920
4057
|
}
|
|
3921
4058
|
(_i = props.onReset) == null ? void 0 : _i.call(props, "table");
|
|
3922
4059
|
}
|
|
3923
|
-
const state = (0,
|
|
4060
|
+
const state = (0, import_react31.useMemo)(
|
|
3924
4061
|
() => {
|
|
3925
4062
|
var _a, _b, _c, _d;
|
|
3926
4063
|
return new Store2({
|
|
@@ -3956,7 +4093,7 @@ function useTableState(_props) {
|
|
|
3956
4093
|
syncSelections(state);
|
|
3957
4094
|
cleanupState(state);
|
|
3958
4095
|
watchDisplaySize(state);
|
|
3959
|
-
(0,
|
|
4096
|
+
(0, import_react31.useEffect)(() => {
|
|
3960
4097
|
state.update((state2) => {
|
|
3961
4098
|
state2.normalizedProps = (0, import_immer6.castDraft)(props);
|
|
3962
4099
|
if (props.sort) state2.sort = props.sort;
|
|
@@ -3975,12 +4112,12 @@ function useTableState(_props) {
|
|
|
3975
4112
|
}
|
|
3976
4113
|
|
|
3977
4114
|
// src/components/clearFiltersButton.tsx
|
|
3978
|
-
var
|
|
4115
|
+
var import_jsx_runtime24 = require("@emotion/react/jsx-runtime");
|
|
3979
4116
|
function ClearFiltersButton() {
|
|
3980
4117
|
const Button2 = useTheme((t2) => t2.components.Button);
|
|
3981
4118
|
const textClearFilters = useTheme((t2) => t2.text.clearFilters);
|
|
3982
4119
|
const table = useTableContext();
|
|
3983
|
-
return /* @__PURE__ */ (0,
|
|
4120
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { css: defaultClasses.clearFiltersButton, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
3984
4121
|
Button2,
|
|
3985
4122
|
{
|
|
3986
4123
|
variant: "outlined",
|
|
@@ -3999,7 +4136,7 @@ function ClearFiltersButton() {
|
|
|
3999
4136
|
}
|
|
4000
4137
|
|
|
4001
4138
|
// src/components/columnFooter.tsx
|
|
4002
|
-
var
|
|
4139
|
+
var import_jsx_runtime25 = require("@emotion/react/jsx-runtime");
|
|
4003
4140
|
function ColumnFooter() {
|
|
4004
4141
|
const table = useTableContext();
|
|
4005
4142
|
const columnId = useColumnContext();
|
|
@@ -4031,7 +4168,7 @@ function ColumnFooter() {
|
|
|
4031
4168
|
const column = state.activeColumns.find((column2) => column2.id === columnId);
|
|
4032
4169
|
return column == null ? void 0 : column.footer;
|
|
4033
4170
|
});
|
|
4034
|
-
return /* @__PURE__ */ (0,
|
|
4171
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
4035
4172
|
"div",
|
|
4036
4173
|
{
|
|
4037
4174
|
className: cx(classes, columnClasses),
|
|
@@ -4050,10 +4187,10 @@ function ColumnFooter() {
|
|
|
4050
4187
|
|
|
4051
4188
|
// src/components/columnHeader.tsx
|
|
4052
4189
|
var import_immer7 = require("immer");
|
|
4053
|
-
var
|
|
4190
|
+
var import_react33 = require("react");
|
|
4054
4191
|
|
|
4055
4192
|
// src/components/resizeHandle.tsx
|
|
4056
|
-
var
|
|
4193
|
+
var import_jsx_runtime26 = require("@emotion/react/jsx-runtime");
|
|
4057
4194
|
function ResizeHandle() {
|
|
4058
4195
|
const table = useTableContext();
|
|
4059
4196
|
const columnId = useColumnContext();
|
|
@@ -4090,7 +4227,7 @@ function ResizeHandle() {
|
|
|
4090
4227
|
if (!enabled) {
|
|
4091
4228
|
return null;
|
|
4092
4229
|
}
|
|
4093
|
-
return /* @__PURE__ */ (0,
|
|
4230
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4094
4231
|
ResizeHandleView,
|
|
4095
4232
|
{
|
|
4096
4233
|
enabled,
|
|
@@ -4107,7 +4244,7 @@ function ResizeHandleView(_a) {
|
|
|
4107
4244
|
} = _b, props = __objRest(_b, [
|
|
4108
4245
|
"enabled"
|
|
4109
4246
|
]);
|
|
4110
|
-
const
|
|
4247
|
+
const className3 = useTheme((theme) => {
|
|
4111
4248
|
var _a2;
|
|
4112
4249
|
return (_a2 = theme.classes) == null ? void 0 : _a2.columnDivider;
|
|
4113
4250
|
});
|
|
@@ -4115,10 +4252,10 @@ function ResizeHandleView(_a) {
|
|
|
4115
4252
|
var _a2;
|
|
4116
4253
|
return (_a2 = theme.styles) == null ? void 0 : _a2.columnDivider;
|
|
4117
4254
|
});
|
|
4118
|
-
return /* @__PURE__ */ (0,
|
|
4255
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4119
4256
|
"div",
|
|
4120
4257
|
__spreadValues({
|
|
4121
|
-
className:
|
|
4258
|
+
className: className3,
|
|
4122
4259
|
css: [
|
|
4123
4260
|
{
|
|
4124
4261
|
alignSelf: "stretch",
|
|
@@ -4144,7 +4281,7 @@ function ResizeHandleView(_a) {
|
|
|
4144
4281
|
}
|
|
4145
4282
|
|
|
4146
4283
|
// src/components/sortComponent.tsx
|
|
4147
|
-
var
|
|
4284
|
+
var import_jsx_runtime27 = require("@emotion/react/jsx-runtime");
|
|
4148
4285
|
function SortComponent({ children }) {
|
|
4149
4286
|
const table = useTableContext();
|
|
4150
4287
|
const columnId = useColumnContext();
|
|
@@ -4184,7 +4321,7 @@ function SortComponent({ children }) {
|
|
|
4184
4321
|
event.preventDefault();
|
|
4185
4322
|
return false;
|
|
4186
4323
|
}
|
|
4187
|
-
return /* @__PURE__ */ (0,
|
|
4324
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
|
|
4188
4325
|
"div",
|
|
4189
4326
|
{
|
|
4190
4327
|
css: {
|
|
@@ -4201,8 +4338,8 @@ function SortComponent({ children }) {
|
|
|
4201
4338
|
onClick: (event) => toggle2(event),
|
|
4202
4339
|
onContextMenu: (event) => toggle2(event, true),
|
|
4203
4340
|
children: [
|
|
4204
|
-
/* @__PURE__ */ (0,
|
|
4205
|
-
/* @__PURE__ */ (0,
|
|
4341
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { children }),
|
|
4342
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Badge2, { badgeContent: sortDisabled ? 0 : index, children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
4206
4343
|
"span",
|
|
4207
4344
|
{
|
|
4208
4345
|
css: [
|
|
@@ -4210,7 +4347,7 @@ function SortComponent({ children }) {
|
|
|
4210
4347
|
!direction && { opacity: 0 },
|
|
4211
4348
|
direction === "desc" && { transform: "rotate3d(0, 0, 1, 180deg)" }
|
|
4212
4349
|
],
|
|
4213
|
-
children: /* @__PURE__ */ (0,
|
|
4350
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ArrowUpward2, {})
|
|
4214
4351
|
}
|
|
4215
4352
|
) })
|
|
4216
4353
|
]
|
|
@@ -4219,12 +4356,12 @@ function SortComponent({ children }) {
|
|
|
4219
4356
|
}
|
|
4220
4357
|
|
|
4221
4358
|
// src/components/columnHeader.tsx
|
|
4222
|
-
var
|
|
4359
|
+
var import_jsx_runtime28 = require("@emotion/react/jsx-runtime");
|
|
4223
4360
|
var ColumnHeaderContext = new StoreScope({
|
|
4224
4361
|
items: /* @__PURE__ */ new Map()
|
|
4225
4362
|
});
|
|
4226
4363
|
function ColumnHeader() {
|
|
4227
|
-
const ref = (0,
|
|
4364
|
+
const ref = (0, import_react33.useRef)(null);
|
|
4228
4365
|
const columnId = useColumnContext();
|
|
4229
4366
|
const table = useTableContext();
|
|
4230
4367
|
const enabled = table.useState((state) => state.props.enableColumnReorder);
|
|
@@ -4250,9 +4387,9 @@ function ColumnHeader() {
|
|
|
4250
4387
|
};
|
|
4251
4388
|
});
|
|
4252
4389
|
const store = ColumnHeaderContext.useStore();
|
|
4253
|
-
const draggingStart = (0,
|
|
4254
|
-
const clone = (0,
|
|
4255
|
-
(0,
|
|
4390
|
+
const draggingStart = (0, import_react33.useRef)();
|
|
4391
|
+
const clone = (0, import_react33.useRef)();
|
|
4392
|
+
(0, import_react33.useEffect)(() => {
|
|
4256
4393
|
const div = ref.current;
|
|
4257
4394
|
if (!div) return;
|
|
4258
4395
|
store.update((state) => {
|
|
@@ -4361,7 +4498,7 @@ function ColumnHeader() {
|
|
|
4361
4498
|
clone.current = void 0;
|
|
4362
4499
|
});
|
|
4363
4500
|
}
|
|
4364
|
-
return /* @__PURE__ */ (0,
|
|
4501
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
|
4365
4502
|
"div",
|
|
4366
4503
|
{
|
|
4367
4504
|
ref,
|
|
@@ -4382,18 +4519,18 @@ function ColumnHeader() {
|
|
|
4382
4519
|
onPointerMove: enabled ? onPointerMove : void 0,
|
|
4383
4520
|
onPointerUp: enabled ? onPointerUp : void 0,
|
|
4384
4521
|
children: [
|
|
4385
|
-
/* @__PURE__ */ (0,
|
|
4386
|
-
/* @__PURE__ */ (0,
|
|
4387
|
-
/* @__PURE__ */ (0,
|
|
4388
|
-
/* @__PURE__ */ (0,
|
|
4522
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(SortComponent, { children: header }),
|
|
4523
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { css: { flex: 1 } }),
|
|
4524
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(FilterControl, {}),
|
|
4525
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(ResizeHandle, {})
|
|
4389
4526
|
]
|
|
4390
4527
|
}
|
|
4391
4528
|
);
|
|
4392
4529
|
}
|
|
4393
4530
|
|
|
4394
4531
|
// src/components/columnSelection.tsx
|
|
4395
|
-
var
|
|
4396
|
-
var
|
|
4532
|
+
var import_react35 = require("react");
|
|
4533
|
+
var import_jsx_runtime29 = require("@emotion/react/jsx-runtime");
|
|
4397
4534
|
function ColumnSelection() {
|
|
4398
4535
|
const IconButton2 = useTheme((t2) => t2.components.IconButton);
|
|
4399
4536
|
const Popover2 = useTheme((t2) => t2.components.Popover);
|
|
@@ -4407,10 +4544,10 @@ function ColumnSelection() {
|
|
|
4407
4544
|
const classes = useTheme((t2) => t2.classes);
|
|
4408
4545
|
const cssVariables = useCssVariables();
|
|
4409
4546
|
const table = useTableContext();
|
|
4410
|
-
const reset = (0,
|
|
4547
|
+
const reset = (0, import_react35.useContext)(TableResetContext);
|
|
4411
4548
|
const columns = table.useState((state) => state.props.columns);
|
|
4412
4549
|
const hiddenColumns = table.useState((state) => state.hiddenColumns);
|
|
4413
|
-
const [anchorElement, setAnchorElement] = (0,
|
|
4550
|
+
const [anchorElement, setAnchorElement] = (0, import_react35.useState)(null);
|
|
4414
4551
|
const toggle2 = (column, state) => {
|
|
4415
4552
|
const {
|
|
4416
4553
|
props: { hiddenColumns: controlledHiddenColumns, onHiddenColumnsChange }
|
|
@@ -4431,9 +4568,9 @@ function ColumnSelection() {
|
|
|
4431
4568
|
onHiddenColumnsChange == null ? void 0 : onHiddenColumnsChange(newValue);
|
|
4432
4569
|
};
|
|
4433
4570
|
const allVisible = columns.every((column) => !hiddenColumns.has(column.id));
|
|
4434
|
-
return /* @__PURE__ */ (0,
|
|
4435
|
-
/* @__PURE__ */ (0,
|
|
4436
|
-
/* @__PURE__ */ (0,
|
|
4571
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_jsx_runtime29.Fragment, { children: [
|
|
4572
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(IconButton2, { onClick: (event) => setAnchorElement(anchorElement ? null : event.currentTarget), children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Settings2, {}) }),
|
|
4573
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
4437
4574
|
Popover2,
|
|
4438
4575
|
{
|
|
4439
4576
|
anchorEl: anchorElement,
|
|
@@ -4442,18 +4579,18 @@ function ColumnSelection() {
|
|
|
4442
4579
|
css: cssVariables,
|
|
4443
4580
|
className: classes == null ? void 0 : classes.popover,
|
|
4444
4581
|
backdropClassName: classes == null ? void 0 : classes.popoverBackdrop,
|
|
4445
|
-
children: /* @__PURE__ */ (0,
|
|
4446
|
-
/* @__PURE__ */ (0,
|
|
4447
|
-
/* @__PURE__ */ (0,
|
|
4448
|
-
/* @__PURE__ */ (0,
|
|
4449
|
-
/* @__PURE__ */ (0,
|
|
4582
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { css: { padding: `calc(var(--spacing) * 2)`, display: "grid" }, children: [
|
|
4583
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { css: { marginBottom: "var(--spacing)" }, children: selectColumns }),
|
|
4584
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { css: { margin: "0.5em 0", display: "flex", gap: "0.5em" }, children: [
|
|
4585
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Button2, { variant: "outlined", onClick: () => toggle2(void 0, !allVisible), children: allVisible ? hideAll : showAll }),
|
|
4586
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Button2, { variant: "outlined", onClick: reset, children: resetAll })
|
|
4450
4587
|
] }),
|
|
4451
4588
|
columns.map((column) => {
|
|
4452
4589
|
var _a;
|
|
4453
|
-
return /* @__PURE__ */ (0,
|
|
4590
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
4454
4591
|
FormControlLabel,
|
|
4455
4592
|
{
|
|
4456
|
-
control: /* @__PURE__ */ (0,
|
|
4593
|
+
control: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
4457
4594
|
Checkbox2,
|
|
4458
4595
|
{
|
|
4459
4596
|
checked: !((_a = column.hidden) != null ? _a : hiddenColumns.has(column.id)),
|
|
@@ -4473,10 +4610,10 @@ function ColumnSelection() {
|
|
|
4473
4610
|
}
|
|
4474
4611
|
|
|
4475
4612
|
// src/components/export.tsx
|
|
4476
|
-
var
|
|
4477
|
-
var
|
|
4613
|
+
var import_react36 = require("react");
|
|
4614
|
+
var import_jsx_runtime30 = require("@emotion/react/jsx-runtime");
|
|
4478
4615
|
function Export2() {
|
|
4479
|
-
const { exporters: contextExporters } = (0,
|
|
4616
|
+
const { exporters: contextExporters } = (0, import_react36.useContext)(TableSettingsContext);
|
|
4480
4617
|
const table = useTableContext();
|
|
4481
4618
|
const Button2 = useTheme((t2) => t2.components.Button);
|
|
4482
4619
|
const IconButton2 = useTheme((t2) => t2.components.IconButton);
|
|
@@ -4497,7 +4634,7 @@ function Export2() {
|
|
|
4497
4634
|
}
|
|
4498
4635
|
return state.props.enableExport;
|
|
4499
4636
|
});
|
|
4500
|
-
const [anchor, setAnchor] = (0,
|
|
4637
|
+
const [anchor, setAnchor] = (0, import_react36.useState)(null);
|
|
4501
4638
|
function execute({ action, exporter }) {
|
|
4502
4639
|
const { activeColumns, activeItems, items } = table.getState();
|
|
4503
4640
|
const columns = activeColumns.map((column) => column.exportHeader);
|
|
@@ -4519,9 +4656,9 @@ function Export2() {
|
|
|
4519
4656
|
URL.revokeObjectURL(url);
|
|
4520
4657
|
}
|
|
4521
4658
|
}
|
|
4522
|
-
return /* @__PURE__ */ (0,
|
|
4523
|
-
/* @__PURE__ */ (0,
|
|
4524
|
-
/* @__PURE__ */ (0,
|
|
4659
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_jsx_runtime30.Fragment, { children: [
|
|
4660
|
+
/* @__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)" } }) }),
|
|
4661
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
4525
4662
|
Popover2,
|
|
4526
4663
|
{
|
|
4527
4664
|
open: !!anchor,
|
|
@@ -4530,7 +4667,7 @@ function Export2() {
|
|
|
4530
4667
|
css: cssVariables,
|
|
4531
4668
|
className: classes == null ? void 0 : classes.popover,
|
|
4532
4669
|
backdropClassName: classes == null ? void 0 : classes.popoverBackdrop,
|
|
4533
|
-
children: /* @__PURE__ */ (0,
|
|
4670
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
|
|
4534
4671
|
"div",
|
|
4535
4672
|
{
|
|
4536
4673
|
css: {
|
|
@@ -4543,11 +4680,11 @@ function Export2() {
|
|
|
4543
4680
|
}
|
|
4544
4681
|
},
|
|
4545
4682
|
children: [
|
|
4546
|
-
/* @__PURE__ */ (0,
|
|
4547
|
-
exporters.map((entry, index) => /* @__PURE__ */ (0,
|
|
4683
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { css: { marginBottom: "var(--spacing)" }, children: exportTitle }),
|
|
4684
|
+
exporters.map((entry, index) => /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
|
|
4548
4685
|
Button2,
|
|
4549
4686
|
{
|
|
4550
|
-
startIcon: entry.action === "copy" ? /* @__PURE__ */ (0,
|
|
4687
|
+
startIcon: entry.action === "copy" ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Clipboard2, {}) : /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(ExportIcon, {}),
|
|
4551
4688
|
onClick: () => execute(entry),
|
|
4552
4689
|
children: [
|
|
4553
4690
|
entry.action === "copy" ? exportCopy : exportDownload,
|
|
@@ -4567,8 +4704,8 @@ function Export2() {
|
|
|
4567
4704
|
}
|
|
4568
4705
|
|
|
4569
4706
|
// src/components/row.tsx
|
|
4570
|
-
var
|
|
4571
|
-
var
|
|
4707
|
+
var import_react39 = require("@emotion/react");
|
|
4708
|
+
var import_react40 = require("react");
|
|
4572
4709
|
|
|
4573
4710
|
// src/misc/calcClassNames.ts
|
|
4574
4711
|
function calcClassNames(classes, item, index) {
|
|
@@ -4587,15 +4724,15 @@ function calcCss(styles, item, index) {
|
|
|
4587
4724
|
}
|
|
4588
4725
|
|
|
4589
4726
|
// src/components/cell.tsx
|
|
4590
|
-
var
|
|
4591
|
-
var
|
|
4727
|
+
var import_react37 = require("react");
|
|
4728
|
+
var import_jsx_runtime31 = require("@emotion/react/jsx-runtime");
|
|
4592
4729
|
var defaultWrapCell = (content) => {
|
|
4593
4730
|
if (typeof content === "string") {
|
|
4594
|
-
return /* @__PURE__ */ (0,
|
|
4731
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { css: defaultClasses.text, title: content, children: content });
|
|
4595
4732
|
}
|
|
4596
4733
|
return content;
|
|
4597
4734
|
};
|
|
4598
|
-
var Cell = (0,
|
|
4735
|
+
var Cell = (0, import_react37.memo)(function Cell2({ itemId, rowIndex }) {
|
|
4599
4736
|
var _a;
|
|
4600
4737
|
const table = useTableContext();
|
|
4601
4738
|
const columnId = useColumnContext();
|
|
@@ -4611,25 +4748,25 @@ var Cell = (0, import_react36.memo)(function Cell2({ itemId, rowIndex }) {
|
|
|
4611
4748
|
const columnStyleOverride = table.useState((state) => state.columnStyleOverride.get(columnId), {
|
|
4612
4749
|
throttle: 16
|
|
4613
4750
|
});
|
|
4614
|
-
(0,
|
|
4751
|
+
(0, import_react37.useLayoutEffect)(() => {
|
|
4615
4752
|
var _a2, _b;
|
|
4616
4753
|
return (_b = (_a2 = table.getState().props).debugRender) == null ? void 0 : _b.call(_a2, "render cell", itemId, columnId);
|
|
4617
4754
|
});
|
|
4618
|
-
const
|
|
4755
|
+
const className3 = useTheme((t2) => cx(...calcClassNames(t2.classes, item == null ? void 0 : item.value, rowIndex)));
|
|
4619
4756
|
const styles = useTheme((t2) => calcCss(t2.styles, item == null ? void 0 : item.value, rowIndex));
|
|
4620
4757
|
if (!column || !item) return null;
|
|
4621
4758
|
const content = column.renderCell(column.value(item.value), item.value);
|
|
4622
|
-
return /* @__PURE__ */ (0,
|
|
4759
|
+
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
4760
|
});
|
|
4624
4761
|
|
|
4625
4762
|
// src/components/details.tsx
|
|
4626
|
-
var
|
|
4627
|
-
var
|
|
4628
|
-
var Details = (0,
|
|
4763
|
+
var import_react38 = require("react");
|
|
4764
|
+
var import_jsx_runtime32 = require("@emotion/react/jsx-runtime");
|
|
4765
|
+
var Details = (0, import_react38.forwardRef)(function Details2({ itemId, rowIndex }, ref) {
|
|
4629
4766
|
const table = useTableContext();
|
|
4630
4767
|
const classes = useTheme((t2) => t2.classes);
|
|
4631
4768
|
const styles = useTheme((t2) => t2.styles);
|
|
4632
|
-
const { details, className:
|
|
4769
|
+
const { details, className: className3, css: css4 } = table.useState((state) => {
|
|
4633
4770
|
const item = state.activeItemsById.get(itemId);
|
|
4634
4771
|
return {
|
|
4635
4772
|
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 +4774,11 @@ var Details = (0, import_react37.forwardRef)(function Details2({ itemId, rowInde
|
|
|
4637
4774
|
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
4775
|
};
|
|
4639
4776
|
});
|
|
4640
|
-
return details ? /* @__PURE__ */ (0,
|
|
4777
|
+
return details ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { ref, className: className3, css: [defaultClasses.details, css4], children: details }) : null;
|
|
4641
4778
|
});
|
|
4642
4779
|
|
|
4643
4780
|
// src/components/expandControl.tsx
|
|
4644
|
-
var
|
|
4781
|
+
var import_jsx_runtime33 = require("@emotion/react/jsx-runtime");
|
|
4645
4782
|
function ExpandControl({
|
|
4646
4783
|
itemId,
|
|
4647
4784
|
hasDeferredChildren
|
|
@@ -4688,9 +4825,9 @@ function ExpandControl({
|
|
|
4688
4825
|
}
|
|
4689
4826
|
}
|
|
4690
4827
|
if (isExpanded && hasDeferredChildren && !hasChildren) {
|
|
4691
|
-
return /* @__PURE__ */ (0,
|
|
4828
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Spinner2, { css: { margin: "0 var(--spacing)" } });
|
|
4692
4829
|
}
|
|
4693
|
-
return /* @__PURE__ */ (0,
|
|
4830
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(IconButton2, { onClick: toggle2, children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
4694
4831
|
"span",
|
|
4695
4832
|
{
|
|
4696
4833
|
css: {
|
|
@@ -4698,13 +4835,13 @@ function ExpandControl({
|
|
|
4698
4835
|
transition: "all 300ms",
|
|
4699
4836
|
transform: isExpanded ? "rotate3d(0, 0, 1, 90deg)" : "rotate3d(0, 0, 1, 0deg)"
|
|
4700
4837
|
},
|
|
4701
|
-
children: /* @__PURE__ */ (0,
|
|
4838
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ChevronRight2, {})
|
|
4702
4839
|
}
|
|
4703
4840
|
) });
|
|
4704
4841
|
}
|
|
4705
4842
|
|
|
4706
4843
|
// src/components/selectComponent.tsx
|
|
4707
|
-
var
|
|
4844
|
+
var import_jsx_runtime34 = require("@emotion/react/jsx-runtime");
|
|
4708
4845
|
function SelectComponent({ itemId }) {
|
|
4709
4846
|
const table = useTableContext();
|
|
4710
4847
|
const Checkbox2 = useTheme((t2) => t2.components.Checkbox);
|
|
@@ -4753,7 +4890,7 @@ function SelectComponent({ itemId }) {
|
|
|
4753
4890
|
state.lastSelectedId = itemId;
|
|
4754
4891
|
});
|
|
4755
4892
|
}
|
|
4756
|
-
return /* @__PURE__ */ (0,
|
|
4893
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
4757
4894
|
Checkbox2,
|
|
4758
4895
|
{
|
|
4759
4896
|
css: {
|
|
@@ -4767,19 +4904,19 @@ function SelectComponent({ itemId }) {
|
|
|
4767
4904
|
}
|
|
4768
4905
|
|
|
4769
4906
|
// src/components/row.tsx
|
|
4770
|
-
var
|
|
4771
|
-
var Row = (0,
|
|
4907
|
+
var import_jsx_runtime35 = require("@emotion/react/jsx-runtime");
|
|
4908
|
+
var Row = (0, import_react40.memo)(function Row2({
|
|
4772
4909
|
itemId,
|
|
4773
4910
|
rowIndex
|
|
4774
4911
|
}) {
|
|
4775
4912
|
var _a;
|
|
4776
4913
|
const table = useTableContext();
|
|
4777
|
-
const divRef = (0,
|
|
4778
|
-
const detailsDivRef = (0,
|
|
4914
|
+
const divRef = (0, import_react40.useRef)(null);
|
|
4915
|
+
const detailsDivRef = (0, import_react40.useRef)(null);
|
|
4779
4916
|
const classes = useTheme((t2) => t2.classes);
|
|
4780
4917
|
const styles = useTheme((t2) => t2.styles);
|
|
4781
4918
|
const item = table.useState((state) => state.activeItemsById.get(itemId));
|
|
4782
|
-
const wrapRow = (_a = table.useState((state) => state.props.wrapRow)) != null ? _a : (props) => /* @__PURE__ */ (0,
|
|
4919
|
+
const wrapRow = (_a = table.useState((state) => state.props.wrapRow)) != null ? _a : (props) => /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", __spreadValues({}, props));
|
|
4783
4920
|
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
4921
|
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
4922
|
const subgrid = table.useState((state) => state.props.subgrid);
|
|
@@ -4808,7 +4945,7 @@ var Row = (0, import_react39.memo)(function Row2({
|
|
|
4808
4945
|
hasDetails: state.props.rowDetails instanceof Function ? item2 ? !!state.props.rowDetails(item2.value, rowIndex) : null : !!state.props.rowDetails
|
|
4809
4946
|
};
|
|
4810
4947
|
});
|
|
4811
|
-
(0,
|
|
4948
|
+
(0, import_react40.useLayoutEffect)(() => {
|
|
4812
4949
|
function update() {
|
|
4813
4950
|
table.update((state) => {
|
|
4814
4951
|
if (!divRef.current) {
|
|
@@ -4829,14 +4966,14 @@ var Row = (0, import_react39.memo)(function Row2({
|
|
|
4829
4966
|
handles.forEach((h2) => h2());
|
|
4830
4967
|
};
|
|
4831
4968
|
}, [table, itemId, divRef.current, detailsDivRef.current]);
|
|
4832
|
-
(0,
|
|
4969
|
+
(0, import_react40.useLayoutEffect)(() => {
|
|
4833
4970
|
var _a2, _b;
|
|
4834
4971
|
return (_b = (_a2 = table.getState().props).debugRender) == null ? void 0 : _b.call(_a2, "render row", itemId);
|
|
4835
4972
|
});
|
|
4836
4973
|
if (!item) {
|
|
4837
4974
|
return null;
|
|
4838
4975
|
}
|
|
4839
|
-
return /* @__PURE__ */ (0,
|
|
4976
|
+
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
4977
|
{
|
|
4841
4978
|
className: css4([
|
|
4842
4979
|
subgrid ? {
|
|
@@ -4849,8 +4986,8 @@ var Row = (0, import_react39.memo)(function Row2({
|
|
|
4849
4986
|
rowClassName,
|
|
4850
4987
|
rowStyles
|
|
4851
4988
|
]),
|
|
4852
|
-
children: /* @__PURE__ */ (0,
|
|
4853
|
-
/* @__PURE__ */ (0,
|
|
4989
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_jsx_runtime35.Fragment, { children: [
|
|
4990
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
4854
4991
|
"div",
|
|
4855
4992
|
{
|
|
4856
4993
|
className: cellClassName,
|
|
@@ -4858,22 +4995,22 @@ var Row = (0, import_react39.memo)(function Row2({
|
|
|
4858
4995
|
ref: divRef
|
|
4859
4996
|
}
|
|
4860
4997
|
),
|
|
4861
|
-
/* @__PURE__ */ (0,
|
|
4998
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
|
|
4862
4999
|
"div",
|
|
4863
5000
|
{
|
|
4864
5001
|
className: cellClassName,
|
|
4865
5002
|
css: [defaultClasses.cell, defaultClasses.firstCell, css_],
|
|
4866
5003
|
children: [
|
|
4867
|
-
indent > 0 && /* @__PURE__ */ (0,
|
|
4868
|
-
enableSelection && /* @__PURE__ */ (0,
|
|
4869
|
-
(hasChildren || hasDeferredChildren || hasDetails) && /* @__PURE__ */ (0,
|
|
5004
|
+
indent > 0 && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { css: { width: indent * 20 } }),
|
|
5005
|
+
enableSelection && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(SelectComponent, { itemId }),
|
|
5006
|
+
(hasChildren || hasDeferredChildren || hasDetails) && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(ExpandControl, { itemId, hasDeferredChildren }),
|
|
4870
5007
|
rowAction
|
|
4871
5008
|
]
|
|
4872
5009
|
}
|
|
4873
5010
|
),
|
|
4874
|
-
columnIds.map((columnId) => /* @__PURE__ */ (0,
|
|
4875
|
-
/* @__PURE__ */ (0,
|
|
4876
|
-
/* @__PURE__ */ (0,
|
|
5011
|
+
columnIds.map((columnId) => /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(ColumnContext.Provider, { value: columnId, children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Cell, { itemId, rowIndex }) }, columnId)),
|
|
5012
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: cellClassName, css: [defaultClasses.cellFill, css_] }),
|
|
5013
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Details, { ref: detailsDivRef, itemId, rowIndex })
|
|
4877
5014
|
] })
|
|
4878
5015
|
},
|
|
4879
5016
|
item.value,
|
|
@@ -4882,8 +5019,8 @@ var Row = (0, import_react39.memo)(function Row2({
|
|
|
4882
5019
|
});
|
|
4883
5020
|
|
|
4884
5021
|
// src/components/virtualized.tsx
|
|
4885
|
-
var
|
|
4886
|
-
var
|
|
5022
|
+
var import_react41 = require("react");
|
|
5023
|
+
var import_jsx_runtime36 = require("@emotion/react/jsx-runtime");
|
|
4887
5024
|
var findScrollRoot = (x) => {
|
|
4888
5025
|
const parent = x.parentElement;
|
|
4889
5026
|
if (!parent) return document.documentElement;
|
|
@@ -4909,8 +5046,8 @@ function Virtualized(_a) {
|
|
|
4909
5046
|
var _a2, _b2;
|
|
4910
5047
|
const table = useTableContext();
|
|
4911
5048
|
const virtual = table.useState((state) => state.props.virtual);
|
|
4912
|
-
const probeRef = (0,
|
|
4913
|
-
const [, setId] = (0,
|
|
5049
|
+
const probeRef = (0, import_react41.useRef)(null);
|
|
5050
|
+
const [, setId] = (0, import_react41.useState)({});
|
|
4914
5051
|
const {
|
|
4915
5052
|
itemIds = [],
|
|
4916
5053
|
from = 0,
|
|
@@ -4962,8 +5099,8 @@ function Virtualized(_a) {
|
|
|
4962
5099
|
{ throttle: 16 }
|
|
4963
5100
|
);
|
|
4964
5101
|
const throttleScroll = (_b2 = (_a2 = typeof virtual === "boolean" ? void 0 : virtual) == null ? void 0 : _a2.throttleScroll) != null ? _b2 : 16;
|
|
4965
|
-
const update = (0,
|
|
4966
|
-
(0,
|
|
5102
|
+
const update = (0, import_react41.useMemo)(() => throttle2(() => setId({}), throttleScroll), [throttleScroll]);
|
|
5103
|
+
(0, import_react41.useEffect)(() => {
|
|
4967
5104
|
var _a3;
|
|
4968
5105
|
const tableElem = (_a3 = probeRef.current) == null ? void 0 : _a3.parentElement;
|
|
4969
5106
|
if (!tableElem) return;
|
|
@@ -4980,7 +5117,7 @@ function Virtualized(_a) {
|
|
|
4980
5117
|
window.removeEventListener("resize", update2, true);
|
|
4981
5118
|
};
|
|
4982
5119
|
}, [table, probeRef.current]);
|
|
4983
|
-
(0,
|
|
5120
|
+
(0, import_react41.useEffect)(() => {
|
|
4984
5121
|
if (!virtual || !probeRef.current) return;
|
|
4985
5122
|
window.addEventListener("scroll", update, true);
|
|
4986
5123
|
window.addEventListener("resize", update, true);
|
|
@@ -4989,24 +5126,24 @@ function Virtualized(_a) {
|
|
|
4989
5126
|
window.removeEventListener("resize", update, true);
|
|
4990
5127
|
};
|
|
4991
5128
|
}, [update, virtual]);
|
|
4992
|
-
(0,
|
|
4993
|
-
(0,
|
|
5129
|
+
(0, import_react41.useEffect)(() => update.cancel, [update]);
|
|
5130
|
+
(0, import_react41.useLayoutEffect)(
|
|
4994
5131
|
() => {
|
|
4995
5132
|
var _a3, _b3;
|
|
4996
5133
|
return (_b3 = (_a3 = table.getState().props).debugRender) == null ? void 0 : _b3.call(_a3, `Virtualalized render ${from} to ${to}`);
|
|
4997
5134
|
}
|
|
4998
5135
|
);
|
|
4999
|
-
return /* @__PURE__ */ (0,
|
|
5136
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", __spreadProps(__spreadValues({}, props), { children: [
|
|
5000
5137
|
header,
|
|
5001
|
-
virtual && /* @__PURE__ */ (0,
|
|
5138
|
+
virtual && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { style: { gridColumn: "1 / -1", height: before }, ref: probeRef }),
|
|
5002
5139
|
children(itemIds, from),
|
|
5003
|
-
virtual && /* @__PURE__ */ (0,
|
|
5140
|
+
virtual && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { style: { gridColumn: "1 / -1", height: after } }),
|
|
5004
5141
|
footer
|
|
5005
5142
|
] }));
|
|
5006
5143
|
}
|
|
5007
5144
|
|
|
5008
5145
|
// src/components/table.tsx
|
|
5009
|
-
var
|
|
5146
|
+
var import_jsx_runtime37 = require("@emotion/react/jsx-runtime");
|
|
5010
5147
|
function Table(props) {
|
|
5011
5148
|
const [table, resetState] = useTableState(props);
|
|
5012
5149
|
const [isHydrated, clearStorage] = useTableStateStorage(table);
|
|
@@ -5016,25 +5153,25 @@ function Table(props) {
|
|
|
5016
5153
|
resetState();
|
|
5017
5154
|
});
|
|
5018
5155
|
}
|
|
5019
|
-
(0,
|
|
5156
|
+
(0, import_react42.useLayoutEffect)(() => {
|
|
5020
5157
|
var _a, _b;
|
|
5021
5158
|
return (_b = (_a = table.getState().props).debugRender) == null ? void 0 : _b.call(_a, "render table");
|
|
5022
5159
|
});
|
|
5023
|
-
return /* @__PURE__ */ (0,
|
|
5160
|
+
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
5161
|
}
|
|
5025
5162
|
function TableLoadingState({ isHydrated }) {
|
|
5026
5163
|
const loadingText = useTheme((t2) => t2.text.loading);
|
|
5027
|
-
const [showLoading, setShowLoading] = (0,
|
|
5028
|
-
(0,
|
|
5164
|
+
const [showLoading, setShowLoading] = (0, import_react42.useState)(false);
|
|
5165
|
+
(0, import_react42.useEffect)(() => {
|
|
5029
5166
|
const handle = setTimeout(() => setShowLoading(true), 500);
|
|
5030
5167
|
return () => clearTimeout(handle);
|
|
5031
5168
|
});
|
|
5032
|
-
return /* @__PURE__ */ (0,
|
|
5033
|
-
!isHydrated && showLoading && /* @__PURE__ */ (0,
|
|
5034
|
-
/* @__PURE__ */ (0,
|
|
5169
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(import_jsx_runtime37.Fragment, { children: [
|
|
5170
|
+
!isHydrated && showLoading && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { children: loadingText }),
|
|
5171
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(TableInner, { hidden: !isHydrated })
|
|
5035
5172
|
] });
|
|
5036
5173
|
}
|
|
5037
|
-
var TableInner = (0,
|
|
5174
|
+
var TableInner = (0, import_react42.memo)(function TableInner2({ hidden }) {
|
|
5038
5175
|
const table = useTableContext();
|
|
5039
5176
|
const fullWidth = table.useState((state) => state.props.fullWidth);
|
|
5040
5177
|
const visibleColumns = table.useState(
|
|
@@ -5068,11 +5205,11 @@ var TableInner = (0, import_react41.memo)(function TableInner2({ hidden }) {
|
|
|
5068
5205
|
);
|
|
5069
5206
|
const cssVariables = useCssVariables();
|
|
5070
5207
|
const enableClearFiltersButton = table.useState((state) => state.props.enableClearFiltersButton);
|
|
5071
|
-
(0,
|
|
5208
|
+
(0, import_react42.useLayoutEffect)(() => {
|
|
5072
5209
|
var _a, _b;
|
|
5073
5210
|
return (_b = (_a = table.getState().props).debugRender) == null ? void 0 : _b.call(_a, "render table inner");
|
|
5074
5211
|
});
|
|
5075
|
-
return /* @__PURE__ */ (0,
|
|
5212
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
5076
5213
|
Virtualized,
|
|
5077
5214
|
{
|
|
5078
5215
|
className: classes == null ? void 0 : classes.table,
|
|
@@ -5091,8 +5228,8 @@ var TableInner = (0, import_react41.memo)(function TableInner2({ hidden }) {
|
|
|
5091
5228
|
fullWidth === "left" || fullWidth === true ? "auto" : "0"
|
|
5092
5229
|
].join(" ")
|
|
5093
5230
|
},
|
|
5094
|
-
header: /* @__PURE__ */ (0,
|
|
5095
|
-
/* @__PURE__ */ (0,
|
|
5231
|
+
header: /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(import_jsx_runtime37.Fragment, { children: [
|
|
5232
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
5096
5233
|
"div",
|
|
5097
5234
|
{
|
|
5098
5235
|
className: classes == null ? void 0 : classes.headerCell,
|
|
@@ -5105,7 +5242,7 @@ var TableInner = (0, import_react41.memo)(function TableInner2({ hidden }) {
|
|
|
5105
5242
|
]
|
|
5106
5243
|
}
|
|
5107
5244
|
),
|
|
5108
|
-
/* @__PURE__ */ (0,
|
|
5245
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(
|
|
5109
5246
|
"div",
|
|
5110
5247
|
{
|
|
5111
5248
|
className: classes == null ? void 0 : classes.headerCell,
|
|
@@ -5117,18 +5254,18 @@ var TableInner = (0, import_react41.memo)(function TableInner2({ hidden }) {
|
|
|
5117
5254
|
styles == null ? void 0 : styles.headerCell
|
|
5118
5255
|
],
|
|
5119
5256
|
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,
|
|
5257
|
+
enableSelection && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(SelectComponent, {}),
|
|
5258
|
+
enableColumnSelection && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(ColumnSelection, {}),
|
|
5259
|
+
enableExport && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Export2, {}),
|
|
5260
|
+
(enableSelection || enableColumnSelection || enableExport) && /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(import_jsx_runtime37.Fragment, { children: [
|
|
5261
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { css: { flex: 1 } }),
|
|
5262
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(ResizeHandleView, {})
|
|
5126
5263
|
] })
|
|
5127
5264
|
]
|
|
5128
5265
|
}
|
|
5129
5266
|
),
|
|
5130
|
-
/* @__PURE__ */ (0,
|
|
5131
|
-
/* @__PURE__ */ (0,
|
|
5267
|
+
/* @__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)) }),
|
|
5268
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
5132
5269
|
"div",
|
|
5133
5270
|
{
|
|
5134
5271
|
className: classes == null ? void 0 : classes.headerCell,
|
|
@@ -5141,10 +5278,10 @@ var TableInner = (0, import_react41.memo)(function TableInner2({ hidden }) {
|
|
|
5141
5278
|
}
|
|
5142
5279
|
)
|
|
5143
5280
|
] }),
|
|
5144
|
-
footer: /* @__PURE__ */ (0,
|
|
5145
|
-
enableClearFiltersButton && hasActiveFilters && /* @__PURE__ */ (0,
|
|
5146
|
-
hasFooter && /* @__PURE__ */ (0,
|
|
5147
|
-
/* @__PURE__ */ (0,
|
|
5281
|
+
footer: /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(import_jsx_runtime37.Fragment, { children: [
|
|
5282
|
+
enableClearFiltersButton && hasActiveFilters && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(ClearFiltersButton, {}),
|
|
5283
|
+
hasFooter && /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(import_jsx_runtime37.Fragment, { children: [
|
|
5284
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
5148
5285
|
"div",
|
|
5149
5286
|
{
|
|
5150
5287
|
className: classes == null ? void 0 : classes.footerCell,
|
|
@@ -5157,7 +5294,7 @@ var TableInner = (0, import_react41.memo)(function TableInner2({ hidden }) {
|
|
|
5157
5294
|
]
|
|
5158
5295
|
}
|
|
5159
5296
|
),
|
|
5160
|
-
/* @__PURE__ */ (0,
|
|
5297
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
5161
5298
|
"div",
|
|
5162
5299
|
{
|
|
5163
5300
|
className: classes == null ? void 0 : classes.footerCell,
|
|
@@ -5169,8 +5306,8 @@ var TableInner = (0, import_react41.memo)(function TableInner2({ hidden }) {
|
|
|
5169
5306
|
]
|
|
5170
5307
|
}
|
|
5171
5308
|
),
|
|
5172
|
-
visibleColumns.map((column) => /* @__PURE__ */ (0,
|
|
5173
|
-
/* @__PURE__ */ (0,
|
|
5309
|
+
visibleColumns.map((column) => /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(ColumnContext.Provider, { value: column.id, children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(ColumnFooter, {}) }, column.id)),
|
|
5310
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
5174
5311
|
"div",
|
|
5175
5312
|
{
|
|
5176
5313
|
className: classes == null ? void 0 : classes.footerCell,
|
|
@@ -5184,7 +5321,7 @@ var TableInner = (0, import_react41.memo)(function TableInner2({ hidden }) {
|
|
|
5184
5321
|
)
|
|
5185
5322
|
] })
|
|
5186
5323
|
] }),
|
|
5187
|
-
children: (itemIds, startIndex) => itemIds.map((itemId, index) => /* @__PURE__ */ (0,
|
|
5324
|
+
children: (itemIds, startIndex) => itemIds.map((itemId, index) => /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Row, { itemId, rowIndex: startIndex + index }, itemId))
|
|
5188
5325
|
}
|
|
5189
5326
|
);
|
|
5190
5327
|
});
|
|
@@ -5210,7 +5347,7 @@ var termMatch = (text, query) => {
|
|
|
5210
5347
|
};
|
|
5211
5348
|
|
|
5212
5349
|
// src/components/textFilter.tsx
|
|
5213
|
-
var
|
|
5350
|
+
var import_jsx_runtime38 = require("@emotion/react/jsx-runtime");
|
|
5214
5351
|
function TextFilter(_a) {
|
|
5215
5352
|
var _b = _a, {
|
|
5216
5353
|
compare = textMatch,
|
|
@@ -5234,19 +5371,19 @@ function TextFilter(_a) {
|
|
|
5234
5371
|
return compare(value2, filterValue);
|
|
5235
5372
|
}
|
|
5236
5373
|
}));
|
|
5237
|
-
return /* @__PURE__ */ (0,
|
|
5374
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
5238
5375
|
"div",
|
|
5239
5376
|
{
|
|
5240
5377
|
css: {
|
|
5241
5378
|
padding: `calc(var(--spacing) * 2)`,
|
|
5242
5379
|
display: "grid"
|
|
5243
5380
|
},
|
|
5244
|
-
children: /* @__PURE__ */ (0,
|
|
5381
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
5245
5382
|
AutoFocusTextField,
|
|
5246
5383
|
{
|
|
5247
5384
|
value,
|
|
5248
5385
|
onChange: (event) => onChange(event.target.value),
|
|
5249
|
-
endIcon: /* @__PURE__ */ (0,
|
|
5386
|
+
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
5387
|
placeholder
|
|
5251
5388
|
}
|
|
5252
5389
|
)
|