wcz-layout
Version:
3,429 lines • 96.4 kB
JavaScript
import { a as foldForSearch, o as getFieldStatus } from "./utils-KaM5VMTJ.mjs";
import { a as tableContext, c as useTableContext, f as columnLabel, g as shortcutLabel, i as layoutTableFeatures, l as formatValue, m as moveColumn, n as cellContext, o as useCellContext, p as hasColumnLabel, r as headerContext, s as useHeaderContext, t as AggregatedCell, v as useDialogs } from "./AggregatedCell-BtKC5-m6.mjs";
import { c } from "react/compiler-runtime";
import { Autocomplete, Badge, Box, Button, Checkbox, Divider, FormControl, FormControlLabel, FormHelperText, FormLabel, IconButton, InputAdornment, InputLabel, ListItemIcon, ListItemText, Menu, MenuItem, Popover, Radio, RadioGroup, Select, Skeleton, Slider, Stack, Switch, TableCell, TablePagination, TableRow, TableSortLabel, TextField, Tooltip, Typography, useTheme } from "@mui/material";
import { DatePicker, DateTimePicker, TimePicker } from "@mui/x-date-pickers";
import dayjs from "dayjs";
import { useEffect, useRef, useState } from "react";
import { useTranslation, useTranslation as useTranslation$1 } from "react-i18next";
import ArrowBack from "@mui/icons-material/ArrowBack";
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
import Close from "@mui/icons-material/Close";
import MoreVert from "@mui/icons-material/MoreVert";
import { useInView } from "react-intersection-observer";
import { useHotkey } from "@tanstack/react-hotkeys";
import { FlexRender, Subscribe, constructFilterFn, createTableHook, filterFn_arrHas, filterFn_empty, filterFn_endsWith, filterFn_equals, filterFn_equalsString, filterFn_greaterThan, filterFn_greaterThanOrEqualTo, filterFn_inDateRange, filterFn_inNumberRange, filterFn_includesString, filterFn_lessThan, filterFn_lessThanOrEqualTo, filterFn_notEmpty, filterFn_startsWith } from "@tanstack/react-table";
import { createFormHook, createFormHookContexts } from "@tanstack/react-form";
import { NumericFormat } from "react-number-format";
import KeyboardArrowDown from "@mui/icons-material/KeyboardArrowDown";
import KeyboardArrowRight from "@mui/icons-material/KeyboardArrowRight";
import PushPin from "@mui/icons-material/PushPin";
import Check from "@mui/icons-material/Check";
import localizedFormat from "dayjs/plugin/localizedFormat";
import ArrowDownward from "@mui/icons-material/ArrowDownward";
import ArrowForward from "@mui/icons-material/ArrowForward";
import ArrowUpward from "@mui/icons-material/ArrowUpward";
import Clear from "@mui/icons-material/Clear";
import VisibilityOff from "@mui/icons-material/VisibilityOff";
import Workspaces from "@mui/icons-material/Workspaces";
import ViewColumn from "@mui/icons-material/ViewColumn";
import Add from "@mui/icons-material/Add";
import DeleteForever from "@mui/icons-material/DeleteForever";
import FilterList from "@mui/icons-material/FilterList";
import Search from "@mui/icons-material/Search";
//#region src/components/form/FormAutocomplete.tsx
const FormAutocomplete = (t0) => {
const $ = c(24);
if ($[0] !== "08d53cad56d2dac80ef56bbd2f830976f2e70d8964a73d7d2d08c54c9f468e3c") {
for (let $i = 0; $i < 24; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
$[0] = "08d53cad56d2dac80ef56bbd2f830976f2e70d8964a73d7d2d08c54c9f468e3c";
}
let autocompleteProps;
let textFieldProps;
if ($[1] !== t0) {
({textFieldProps, ...autocompleteProps} = t0);
$[1] = t0;
$[2] = autocompleteProps;
$[3] = textFieldProps;
} else {
autocompleteProps = $[2];
textFieldProps = $[3];
}
const field = useFieldContext();
let t1;
if ($[4] !== field) {
t1 = getFieldStatus(field);
$[4] = field;
$[5] = t1;
} else t1 = $[5];
const { isTouched, hasError, helperText } = t1;
let t2;
let t3;
if ($[6] !== autocompleteProps.freeSolo || $[7] !== field) {
t2 = (_, value) => !autocompleteProps.freeSolo && field.handleChange(value);
t3 = (__0, value_0, reason) => reason !== "reset" && autocompleteProps.freeSolo && field.handleChange(value_0);
$[6] = autocompleteProps.freeSolo;
$[7] = field;
$[8] = t2;
$[9] = t3;
} else {
t2 = $[8];
t3 = $[9];
}
let t4;
if ($[10] !== field.name || $[11] !== hasError || $[12] !== helperText || $[13] !== isTouched || $[14] !== textFieldProps) {
t4 = (parameters) => /* @__PURE__ */ jsx(TextField, {
...parameters,
name: field.name,
error: isTouched && hasError,
helperText: isTouched && helperText,
...textFieldProps
});
$[10] = field.name;
$[11] = hasError;
$[12] = helperText;
$[13] = isTouched;
$[14] = textFieldProps;
$[15] = t4;
} else t4 = $[15];
let t5;
if ($[16] !== autocompleteProps || $[17] !== field.handleBlur || $[18] !== field.name || $[19] !== field.state.value || $[20] !== t2 || $[21] !== t3 || $[22] !== t4) {
t5 = /* @__PURE__ */ jsx(Autocomplete, {
value: field.state.value,
onChange: t2,
onInputChange: t3,
onBlur: field.handleBlur,
"aria-label": field.name,
...autocompleteProps,
renderInput: t4
});
$[16] = autocompleteProps;
$[17] = field.handleBlur;
$[18] = field.name;
$[19] = field.state.value;
$[20] = t2;
$[21] = t3;
$[22] = t4;
$[23] = t5;
} else t5 = $[23];
return t5;
};
//#endregion
//#region src/components/form/FormCheckbox.tsx
const FormCheckbox = (props) => {
const $ = c(21);
if ($[0] !== "c45ef823da959fcba4cace3352d1647bfefa3bcb5bff7fc0886d583d1409709f") {
for (let $i = 0; $i < 21; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
$[0] = "c45ef823da959fcba4cace3352d1647bfefa3bcb5bff7fc0886d583d1409709f";
}
const field = useFieldContext();
let t0;
if ($[1] !== field) {
t0 = getFieldStatus(field);
$[1] = field;
$[2] = t0;
} else t0 = $[2];
const { isTouched, hasError, helperText } = t0;
const t1 = field.name;
const t2 = Boolean(field.state.value);
let t3;
if ($[3] !== field) {
t3 = (event) => field.handleChange(event.target.checked);
$[3] = field;
$[4] = t3;
} else t3 = $[4];
let t4;
if ($[5] !== field.handleBlur || $[6] !== field.name || $[7] !== props || $[8] !== t2 || $[9] !== t3) {
t4 = /* @__PURE__ */ jsx(Checkbox, {
name: t1,
checked: t2,
onChange: t3,
onBlur: field.handleBlur,
"aria-label": field.name,
...props
});
$[5] = field.handleBlur;
$[6] = field.name;
$[7] = props;
$[8] = t2;
$[9] = t3;
$[10] = t4;
} else t4 = $[10];
const t5 = props.label ?? "";
let t6;
if ($[11] !== t4 || $[12] !== t5) {
t6 = /* @__PURE__ */ jsx(FormControlLabel, {
control: t4,
label: t5
});
$[11] = t4;
$[12] = t5;
$[13] = t6;
} else t6 = $[13];
let t7;
if ($[14] !== hasError || $[15] !== helperText || $[16] !== isTouched) {
t7 = isTouched && hasError && /* @__PURE__ */ jsx(FormHelperText, {
error: hasError,
children: helperText
});
$[14] = hasError;
$[15] = helperText;
$[16] = isTouched;
$[17] = t7;
} else t7 = $[17];
let t8;
if ($[18] !== t6 || $[19] !== t7) {
t8 = /* @__PURE__ */ jsxs(FormControl, {
component: "fieldset",
children: [t6, t7]
});
$[18] = t6;
$[19] = t7;
$[20] = t8;
} else t8 = $[20];
return t8;
};
//#endregion
//#region src/components/form/FormDatePicker.tsx
const FormDatePicker = (props) => {
const $ = c(19);
if ($[0] !== "b3ec6a4f7a9d751734b17e31959ca5d29f8a6181225d63bd8d0d932da93bddff") {
for (let $i = 0; $i < 19; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
$[0] = "b3ec6a4f7a9d751734b17e31959ca5d29f8a6181225d63bd8d0d932da93bddff";
}
const field = useFieldContext();
let t0;
if ($[1] !== field) {
t0 = getFieldStatus(field);
$[1] = field;
$[2] = t0;
} else t0 = $[2];
const { isTouched, hasError, helperText } = t0;
let t1;
if ($[3] !== field) {
t1 = (value) => field.handleChange(value);
$[3] = field;
$[4] = t1;
} else t1 = $[4];
const t2 = isTouched && hasError;
const t3 = isTouched && helperText;
let t4;
if ($[5] !== field.handleBlur || $[6] !== props.textFieldProps || $[7] !== t2 || $[8] !== t3) {
t4 = {
onBlur: field.handleBlur,
error: t2,
helperText: t3,
...props.textFieldProps
};
$[5] = field.handleBlur;
$[6] = props.textFieldProps;
$[7] = t2;
$[8] = t3;
$[9] = t4;
} else t4 = $[9];
let t5;
if ($[10] !== props.slotProps || $[11] !== t4) {
t5 = {
textField: t4,
...props.slotProps
};
$[10] = props.slotProps;
$[11] = t4;
$[12] = t5;
} else t5 = $[12];
let t6;
if ($[13] !== field.name || $[14] !== field.state.value || $[15] !== props || $[16] !== t1 || $[17] !== t5) {
t6 = /* @__PURE__ */ jsx(DatePicker, {
name: field.name,
value: field.state.value,
onChange: t1,
slotProps: t5,
"aria-label": field.name,
...props
});
$[13] = field.name;
$[14] = field.state.value;
$[15] = props;
$[16] = t1;
$[17] = t5;
$[18] = t6;
} else t6 = $[18];
return t6;
};
//#endregion
//#region src/components/form/FormTimePicker.tsx
const FormTimePicker = (props) => {
const $ = c(19);
if ($[0] !== "009664b5441550099c1a5250000faad760e9a295ff513262f5d4c405041c4af0") {
for (let $i = 0; $i < 19; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
$[0] = "009664b5441550099c1a5250000faad760e9a295ff513262f5d4c405041c4af0";
}
const field = useFieldContext();
let t0;
if ($[1] !== field) {
t0 = getFieldStatus(field);
$[1] = field;
$[2] = t0;
} else t0 = $[2];
const { isTouched, hasError, helperText } = t0;
let t1;
if ($[3] !== field) {
t1 = (value) => field.handleChange(value);
$[3] = field;
$[4] = t1;
} else t1 = $[4];
const t2 = isTouched && hasError;
const t3 = isTouched && helperText;
let t4;
if ($[5] !== field.handleBlur || $[6] !== props.textFieldProps || $[7] !== t2 || $[8] !== t3) {
t4 = {
onBlur: field.handleBlur,
error: t2,
helperText: t3,
...props.textFieldProps
};
$[5] = field.handleBlur;
$[6] = props.textFieldProps;
$[7] = t2;
$[8] = t3;
$[9] = t4;
} else t4 = $[9];
let t5;
if ($[10] !== props.slotProps || $[11] !== t4) {
t5 = {
textField: t4,
...props.slotProps
};
$[10] = props.slotProps;
$[11] = t4;
$[12] = t5;
} else t5 = $[12];
let t6;
if ($[13] !== field.name || $[14] !== field.state.value || $[15] !== props || $[16] !== t1 || $[17] !== t5) {
t6 = /* @__PURE__ */ jsx(TimePicker, {
name: field.name,
value: field.state.value,
onChange: t1,
slotProps: t5,
"aria-label": field.name,
...props
});
$[13] = field.name;
$[14] = field.state.value;
$[15] = props;
$[16] = t1;
$[17] = t5;
$[18] = t6;
} else t6 = $[18];
return t6;
};
//#endregion
//#region src/components/form/FormDateTimePicker.tsx
const FormDateTimePicker = (props) => {
const $ = c(19);
if ($[0] !== "dc1d4a9f2239023276c3ff2c1edc368e73b5542beb69edd186ca52ac837a180c") {
for (let $i = 0; $i < 19; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
$[0] = "dc1d4a9f2239023276c3ff2c1edc368e73b5542beb69edd186ca52ac837a180c";
}
const field = useFieldContext();
let t0;
if ($[1] !== field) {
t0 = getFieldStatus(field);
$[1] = field;
$[2] = t0;
} else t0 = $[2];
const { isTouched, hasError, helperText } = t0;
let t1;
if ($[3] !== field) {
t1 = (value) => field.handleChange(value);
$[3] = field;
$[4] = t1;
} else t1 = $[4];
const t2 = isTouched && hasError;
const t3 = isTouched && helperText;
let t4;
if ($[5] !== field.handleBlur || $[6] !== props.textFieldProps || $[7] !== t2 || $[8] !== t3) {
t4 = {
onBlur: field.handleBlur,
error: t2,
helperText: t3,
...props.textFieldProps
};
$[5] = field.handleBlur;
$[6] = props.textFieldProps;
$[7] = t2;
$[8] = t3;
$[9] = t4;
} else t4 = $[9];
let t5;
if ($[10] !== props.slotProps || $[11] !== t4) {
t5 = {
textField: t4,
...props.slotProps
};
$[10] = props.slotProps;
$[11] = t4;
$[12] = t5;
} else t5 = $[12];
let t6;
if ($[13] !== field.name || $[14] !== field.state.value || $[15] !== props || $[16] !== t1 || $[17] !== t5) {
t6 = /* @__PURE__ */ jsx(DateTimePicker, {
name: field.name,
value: field.state.value,
onChange: t1,
slotProps: t5,
"aria-label": field.name,
...props
});
$[13] = field.name;
$[14] = field.state.value;
$[15] = props;
$[16] = t1;
$[17] = t5;
$[18] = t6;
} else t6 = $[18];
return t6;
};
//#endregion
//#region src/components/form/FormNumberField.tsx
const FormNumberField = (t0) => {
const $ = c(17);
if ($[0] !== "00b816bda1dc4ba09b312c8ae98a88c3418eef08ba63cd4310978775184c98dc") {
for (let $i = 0; $i < 17; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
$[0] = "00b816bda1dc4ba09b312c8ae98a88c3418eef08ba63cd4310978775184c98dc";
}
let options;
let props;
if ($[1] !== t0) {
({options, ...props} = t0);
$[1] = t0;
$[2] = options;
$[3] = props;
} else {
options = $[2];
props = $[3];
}
const field = useFieldContext();
let t1;
if ($[4] !== field) {
t1 = getFieldStatus(field);
$[4] = field;
$[5] = t1;
} else t1 = $[5];
const { isTouched, hasError, helperText } = t1;
const t2 = field.state.value ?? "";
let t3;
if ($[6] !== field) {
t3 = (t4) => {
const { floatValue } = t4;
return field.handleChange(floatValue);
};
$[6] = field;
$[7] = t3;
} else t3 = $[7];
const t4 = isTouched && hasError;
const t5 = isTouched && helperText;
let t6;
if ($[8] !== field.handleBlur || $[9] !== field.name || $[10] !== options || $[11] !== props || $[12] !== t2 || $[13] !== t3 || $[14] !== t4 || $[15] !== t5) {
t6 = /* @__PURE__ */ jsx(NumericFormat, {
customInput: TextField,
name: field.name,
value: t2,
onValueChange: t3,
onBlur: field.handleBlur,
error: t4,
helperText: t5,
"aria-label": field.name,
...props,
...options
});
$[8] = field.handleBlur;
$[9] = field.name;
$[10] = options;
$[11] = props;
$[12] = t2;
$[13] = t3;
$[14] = t4;
$[15] = t5;
$[16] = t6;
} else t6 = $[16];
return t6;
};
//#endregion
//#region src/components/form/FormRadioGroup.tsx
const FormRadioGroup = (t0) => {
const $ = c(28);
if ($[0] !== "a850da04fbd650d370339841fd124049fe34d7b5bc939e2cb4c03f7f04aa21c0") {
for (let $i = 0; $i < 28; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
$[0] = "a850da04fbd650d370339841fd124049fe34d7b5bc939e2cb4c03f7f04aa21c0";
}
let label;
let options;
let props;
if ($[1] !== t0) {
({label, options, ...props} = t0);
$[1] = t0;
$[2] = label;
$[3] = options;
$[4] = props;
} else {
label = $[2];
options = $[3];
props = $[4];
}
const field = useFieldContext();
let t1;
if ($[5] !== field) {
t1 = getFieldStatus(field);
$[5] = field;
$[6] = t1;
} else t1 = $[6];
const { isTouched, hasError, helperText } = t1;
let t2;
if ($[7] !== label) {
t2 = label && /* @__PURE__ */ jsx(FormLabel, {
component: "legend",
children: label
});
$[7] = label;
$[8] = t2;
} else t2 = $[8];
const t3 = field.name;
const t4 = field.state.value ?? "";
let t5;
if ($[9] !== field) {
t5 = (event) => field.handleChange(event.target.value);
$[9] = field;
$[10] = t5;
} else t5 = $[10];
const t6 = field.handleBlur;
const t7 = field.name;
let t8;
if ($[11] !== options) {
t8 = options.map(_temp$8);
$[11] = options;
$[12] = t8;
} else t8 = $[12];
let t9;
if ($[13] !== field.handleBlur || $[14] !== field.name || $[15] !== props || $[16] !== t4 || $[17] !== t5 || $[18] !== t8) {
t9 = /* @__PURE__ */ jsx(RadioGroup, {
name: t3,
value: t4,
onChange: t5,
onBlur: t6,
"aria-label": t7,
...props,
children: t8
});
$[13] = field.handleBlur;
$[14] = field.name;
$[15] = props;
$[16] = t4;
$[17] = t5;
$[18] = t8;
$[19] = t9;
} else t9 = $[19];
let t10;
if ($[20] !== hasError || $[21] !== helperText || $[22] !== isTouched) {
t10 = isTouched && hasError && /* @__PURE__ */ jsx(FormHelperText, {
error: hasError,
children: helperText
});
$[20] = hasError;
$[21] = helperText;
$[22] = isTouched;
$[23] = t10;
} else t10 = $[23];
let t11;
if ($[24] !== t10 || $[25] !== t2 || $[26] !== t9) {
t11 = /* @__PURE__ */ jsxs(FormControl, {
component: "fieldset",
children: [
t2,
t9,
t10
]
});
$[24] = t10;
$[25] = t2;
$[26] = t9;
$[27] = t11;
} else t11 = $[27];
return t11;
};
function _temp$8(option) {
return /* @__PURE__ */ jsx(FormControlLabel, {
value: option.value,
control: /* @__PURE__ */ jsx(Radio, {}),
label: option.label
}, option.value);
}
//#endregion
//#region src/components/form/FormSlider.tsx
const FormSlider = (t0) => {
const $ = c(24);
if ($[0] !== "be365ef369c416103ecb5903710205bb23477213ad4cdc6a06c5febdb6d1bb11") {
for (let $i = 0; $i < 24; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
$[0] = "be365ef369c416103ecb5903710205bb23477213ad4cdc6a06c5febdb6d1bb11";
}
let label;
let props;
if ($[1] !== t0) {
({label, ...props} = t0);
$[1] = t0;
$[2] = label;
$[3] = props;
} else {
label = $[2];
props = $[3];
}
const field = useFieldContext();
let t1;
if ($[4] !== field) {
t1 = getFieldStatus(field);
$[4] = field;
$[5] = t1;
} else t1 = $[5];
const { isTouched, hasError, helperText } = t1;
let t2;
if ($[6] !== label) {
t2 = label && /* @__PURE__ */ jsx(FormLabel, { children: label });
$[6] = label;
$[7] = t2;
} else t2 = $[7];
const t3 = field.state.value ?? 0;
let t4;
if ($[8] !== field) {
t4 = (_, value) => field.handleChange(Array.isArray(value) ? value[0] : value);
$[8] = field;
$[9] = t4;
} else t4 = $[9];
let t5;
if ($[10] !== field.handleBlur || $[11] !== field.name || $[12] !== props || $[13] !== t3 || $[14] !== t4) {
t5 = /* @__PURE__ */ jsx(Slider, {
name: field.name,
value: t3,
onChange: t4,
onBlur: field.handleBlur,
"aria-label": field.name,
...props
});
$[10] = field.handleBlur;
$[11] = field.name;
$[12] = props;
$[13] = t3;
$[14] = t4;
$[15] = t5;
} else t5 = $[15];
let t6;
if ($[16] !== hasError || $[17] !== helperText || $[18] !== isTouched) {
t6 = isTouched && hasError && /* @__PURE__ */ jsx(FormHelperText, {
error: hasError,
children: helperText
});
$[16] = hasError;
$[17] = helperText;
$[18] = isTouched;
$[19] = t6;
} else t6 = $[19];
let t7;
if ($[20] !== t2 || $[21] !== t5 || $[22] !== t6) {
t7 = /* @__PURE__ */ jsxs(FormControl, {
component: "fieldset",
children: [
t2,
t5,
t6
]
});
$[20] = t2;
$[21] = t5;
$[22] = t6;
$[23] = t7;
} else t7 = $[23];
return t7;
};
//#endregion
//#region src/components/form/FormSubmitButton.tsx
const FormSubmitButton = (props) => {
const $ = c(9);
if ($[0] !== "4add800393855c4d952f96633b719e669aaecc56277e6909db9c5198dc483706") {
for (let $i = 0; $i < 9; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
$[0] = "4add800393855c4d952f96633b719e669aaecc56277e6909db9c5198dc483706";
}
const form = useFormContext();
let t0;
if ($[1] !== form) {
t0 = async (event) => {
event.preventDefault();
event.stopPropagation();
await form.handleSubmit();
};
$[1] = form;
$[2] = t0;
} else t0 = $[2];
const handleClick = t0;
let t1;
if ($[3] !== handleClick || $[4] !== props) {
t1 = (t2) => {
const [canSubmit, isSubmitting] = t2;
return /* @__PURE__ */ jsx(Button, {
loading: isSubmitting,
disabled: !canSubmit,
onClick: handleClick,
type: "submit",
"aria-label": "submit",
...props
});
};
$[3] = handleClick;
$[4] = props;
$[5] = t1;
} else t1 = $[5];
let t2;
if ($[6] !== form.Subscribe || $[7] !== t1) {
t2 = /* @__PURE__ */ jsx(form.Subscribe, {
selector: _temp$7,
children: t1
});
$[6] = form.Subscribe;
$[7] = t1;
$[8] = t2;
} else t2 = $[8];
return t2;
};
function _temp$7(state) {
return [state.canSubmit, state.isSubmitting];
}
//#endregion
//#region src/components/form/FormSwitch.tsx
const FormSwitch = (props) => {
const $ = c(21);
if ($[0] !== "b2c73964ddfc177a41aa3103af5a1f6930769d39d28fb1640348d24708ae50df") {
for (let $i = 0; $i < 21; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
$[0] = "b2c73964ddfc177a41aa3103af5a1f6930769d39d28fb1640348d24708ae50df";
}
const field = useFieldContext();
let t0;
if ($[1] !== field) {
t0 = getFieldStatus(field);
$[1] = field;
$[2] = t0;
} else t0 = $[2];
const { isTouched, hasError, helperText } = t0;
const t1 = field.name;
const t2 = Boolean(field.state.value);
let t3;
if ($[3] !== field) {
t3 = (event) => field.handleChange(event.target.checked);
$[3] = field;
$[4] = t3;
} else t3 = $[4];
let t4;
if ($[5] !== field.handleBlur || $[6] !== field.name || $[7] !== props || $[8] !== t2 || $[9] !== t3) {
t4 = /* @__PURE__ */ jsx(Switch, {
name: t1,
checked: t2,
onChange: t3,
onBlur: field.handleBlur,
"aria-label": field.name,
...props
});
$[5] = field.handleBlur;
$[6] = field.name;
$[7] = props;
$[8] = t2;
$[9] = t3;
$[10] = t4;
} else t4 = $[10];
const t5 = props.label ?? "";
let t6;
if ($[11] !== t4 || $[12] !== t5) {
t6 = /* @__PURE__ */ jsx(FormControlLabel, {
control: t4,
label: t5
});
$[11] = t4;
$[12] = t5;
$[13] = t6;
} else t6 = $[13];
let t7;
if ($[14] !== hasError || $[15] !== helperText || $[16] !== isTouched) {
t7 = isTouched && hasError && /* @__PURE__ */ jsx(FormHelperText, {
error: hasError,
children: helperText
});
$[14] = hasError;
$[15] = helperText;
$[16] = isTouched;
$[17] = t7;
} else t7 = $[17];
let t8;
if ($[18] !== t6 || $[19] !== t7) {
t8 = /* @__PURE__ */ jsxs(FormControl, {
component: "fieldset",
children: [t6, t7]
});
$[18] = t6;
$[19] = t7;
$[20] = t8;
} else t8 = $[20];
return t8;
};
//#endregion
//#region src/components/form/FormTextField.tsx
const FormTextField = (props) => {
const $ = c(13);
if ($[0] !== "20e2a782e9425ec2804dbc633150b8a14908f9e4003d07e479eb52b3e3b281c8") {
for (let $i = 0; $i < 13; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
$[0] = "20e2a782e9425ec2804dbc633150b8a14908f9e4003d07e479eb52b3e3b281c8";
}
const field = useFieldContext();
let t0;
if ($[1] !== field) {
t0 = getFieldStatus(field);
$[1] = field;
$[2] = t0;
} else t0 = $[2];
const { isTouched, hasError, helperText } = t0;
const t1 = field.state.value ?? "";
let t2;
if ($[3] !== field) {
t2 = (event) => field.handleChange(event.target.value);
$[3] = field;
$[4] = t2;
} else t2 = $[4];
const t3 = isTouched && hasError;
const t4 = isTouched && helperText;
let t5;
if ($[5] !== field.handleBlur || $[6] !== field.name || $[7] !== props || $[8] !== t1 || $[9] !== t2 || $[10] !== t3 || $[11] !== t4) {
t5 = /* @__PURE__ */ jsx(TextField, {
name: field.name,
value: t1,
onChange: t2,
onBlur: field.handleBlur,
error: t3,
helperText: t4,
"aria-label": field.name,
...props
});
$[5] = field.handleBlur;
$[6] = field.name;
$[7] = props;
$[8] = t1;
$[9] = t2;
$[10] = t3;
$[11] = t4;
$[12] = t5;
} else t5 = $[12];
return t5;
};
//#endregion
//#region src/hooks/useForm.ts
const { fieldContext, useFieldContext, formContext, useFormContext } = createFormHookContexts();
const { useAppForm: useLayoutForm, withForm: withLayoutForm } = createFormHook({
fieldComponents: {
TextField: FormTextField,
NumberField: FormNumberField,
Autocomplete: FormAutocomplete,
Checkbox: FormCheckbox,
Switch: FormSwitch,
RadioGroup: FormRadioGroup,
Slider: FormSlider,
DatePicker: FormDatePicker,
TimePicker: FormTimePicker,
DateTimePicker: FormDateTimePicker
},
formComponents: { SubmitButton: FormSubmitButton },
fieldContext,
formContext
});
//#endregion
//#region src/hooks/useScanDetection.ts
const useScanDetection = ({ timeToEvaluate = 100, averageWaitTime = 50, startCharacter = [], endCharacter = ["Enter", "Escape"], onComplete, onError, minLength = 1, ignoreIfFocusOn, stopPropagation = false, preventDefault = false, container, enabled = true }) => {
const buffer = useRef([]);
const timeout = useRef(void 0);
const clearBuffer = () => {
buffer.current = [];
};
const evaluateBuffer = () => {
clearTimeout(timeout.current);
const avg = buffer.current.map(({ time }, k, arr) => k > 0 ? time - arr[k - 1].time : 0).slice(1).reduce((total, delta) => total + delta, 0) / (buffer.current.length - 1);
const code = buffer.current.slice(startCharacter.length > 0 ? 1 : 0).filter(({ char }) => char !== "Shift" && char !== "Tab").map(({ char: char_0 }) => char_0).join("");
if (avg <= averageWaitTime && buffer.current.slice(startCharacter.length > 0 ? 1 : 0).length >= minLength) onComplete(code);
else if (avg <= averageWaitTime) onError?.(code);
clearBuffer();
};
const onKeyDown = (event) => {
if (!enabled) return;
if (event.currentTarget !== ignoreIfFocusOn) {
if (endCharacter.includes(event.key)) evaluateBuffer();
if (buffer.current.length > 0 || startCharacter.includes(event.key) || startCharacter.length === 0) {
clearTimeout(timeout.current);
timeout.current = setTimeout(evaluateBuffer, timeToEvaluate);
buffer.current.push({
time: performance.now(),
char: event.key
});
}
}
if (stopPropagation) event.stopPropagation();
if (preventDefault) event.preventDefault();
};
const onKeyDownRef = useRef(onKeyDown);
onKeyDownRef.current = onKeyDown;
useEffect(() => {
return () => {
clearTimeout(timeout.current);
};
}, []);
useEffect(() => {
const target = container ?? document;
const listener = (event_0) => onKeyDownRef.current(event_0);
target.addEventListener("keydown", listener);
return () => {
target.removeEventListener("keydown", listener);
};
}, [container]);
};
//#endregion
//#region src/components/table/cells/features/ActionsCell.tsx
const ActionsCell = (t0) => {
const $ = c(25);
if ($[0] !== "c383b316e656daf525eafc82d0cfbfc90d697f09f84d09450d77bdc197a2cd1c") {
for (let $i = 0; $i < 25; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
$[0] = "c383b316e656daf525eafc82d0cfbfc90d697f09f84d09450d77bdc197a2cd1c";
}
const { actions } = t0;
const cell = useCellContext();
const { t } = useTranslation$1();
const [anchorEl, setAnchorEl] = useState(null);
if (!actions.length) return null;
let t1;
if ($[1] !== t) {
t1 = t("Layout.Table.RowActions");
$[1] = t;
$[2] = t1;
} else t1 = $[2];
let t2;
if ($[3] !== t) {
t2 = t("Layout.Table.RowActions");
$[3] = t;
$[4] = t2;
} else t2 = $[4];
let t3;
let t4;
if ($[5] === Symbol.for("react.memo_cache_sentinel")) {
t3 = (event) => {
event.stopPropagation();
setAnchorEl(event.currentTarget);
};
t4 = /* @__PURE__ */ jsx(MoreVert, { fontSize: "small" });
$[5] = t3;
$[6] = t4;
} else {
t3 = $[5];
t4 = $[6];
}
let t5;
if ($[7] !== t2) {
t5 = /* @__PURE__ */ jsx(IconButton, {
size: "small",
"aria-label": t2,
"aria-haspopup": "menu",
onClick: t3,
children: t4
});
$[7] = t2;
$[8] = t5;
} else t5 = $[8];
let t6;
if ($[9] !== t1 || $[10] !== t5) {
t6 = /* @__PURE__ */ jsx(Tooltip, {
title: t1,
children: t5
});
$[9] = t1;
$[10] = t5;
$[11] = t6;
} else t6 = $[11];
const t7 = !!anchorEl;
let t8;
if ($[12] === Symbol.for("react.memo_cache_sentinel")) {
t8 = () => setAnchorEl(null);
$[12] = t8;
} else t8 = $[12];
let t9;
if ($[13] !== actions || $[14] !== cell) {
let t10;
if ($[16] !== cell) {
t10 = (action) => [...action.divider ? [/* @__PURE__ */ jsx(Divider, {}, `${action.label}-divider`)] : [], /* @__PURE__ */ jsxs(MenuItem, {
disabled: action.disabled,
onClick: (event_0) => {
event_0.stopPropagation();
action.onClick(cell.row.original);
setAnchorEl(null);
},
children: [action.icon && /* @__PURE__ */ jsx(ListItemIcon, { children: action.icon }), /* @__PURE__ */ jsx(ListItemText, { children: action.label })]
}, action.label)];
$[16] = cell;
$[17] = t10;
} else t10 = $[17];
t9 = actions.flatMap(t10);
$[13] = actions;
$[14] = cell;
$[15] = t9;
} else t9 = $[15];
let t10;
if ($[18] !== anchorEl || $[19] !== t7 || $[20] !== t9) {
t10 = /* @__PURE__ */ jsx(Menu, {
anchorEl,
open: t7,
onClose: t8,
children: t9
});
$[18] = anchorEl;
$[19] = t7;
$[20] = t9;
$[21] = t10;
} else t10 = $[21];
let t11;
if ($[22] !== t10 || $[23] !== t6) {
t11 = /* @__PURE__ */ jsxs(Fragment$1, { children: [t6, t10] });
$[22] = t10;
$[23] = t6;
$[24] = t11;
} else t11 = $[24];
return t11;
};
//#endregion
//#region src/components/table/cells/features/ExpandCell.tsx
const ExpandCell = () => {
const $ = c(6);
if ($[0] !== "e373a958f2659efd7f8e4c11adbdf6443660367dbb6d665b170d691b9c28fde7") {
for (let $i = 0; $i < 6; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
$[0] = "e373a958f2659efd7f8e4c11adbdf6443660367dbb6d665b170d691b9c28fde7";
}
const { row } = useCellContext();
let t0;
if ($[1] !== row) {
t0 = () => {
if (!row.getCanExpand()) return null;
const expanded = row.getIsExpanded();
return /* @__PURE__ */ jsx(IconButton, {
size: "small",
onClick: (event) => {
event.stopPropagation();
row.toggleExpanded();
},
"aria-label": expanded ? "Collapse row" : "Expand row",
sx: { ml: row.depth * 2 },
children: expanded ? /* @__PURE__ */ jsx(KeyboardArrowDown, { fontSize: "small" }) : /* @__PURE__ */ jsx(KeyboardArrowRight, { fontSize: "small" })
});
};
$[1] = row;
$[2] = t0;
} else t0 = $[2];
let t1;
if ($[3] !== row.table.atoms.expanded || $[4] !== t0) {
t1 = /* @__PURE__ */ jsx(Subscribe, {
source: row.table.atoms.expanded,
children: t0
});
$[3] = row.table.atoms.expanded;
$[4] = t0;
$[5] = t1;
} else t1 = $[5];
return t1;
};
//#endregion
//#region src/components/table/cells/features/GroupCell.tsx
const GroupCell = () => {
const $ = c(17);
if ($[0] !== "5e5ed5193c8ad64ae2d82dd097433b77f8ae2ca32d57487fd7564cb6ebc811a4") {
for (let $i = 0; $i < 17; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
$[0] = "5e5ed5193c8ad64ae2d82dd097433b77f8ae2ca32d57487fd7564cb6ebc811a4";
}
const cell = useCellContext();
const { row } = cell;
const t0 = row.depth * 2;
let t1;
if ($[1] !== t0) {
t1 = {
ml: t0,
alignItems: "center"
};
$[1] = t0;
$[2] = t1;
} else t1 = $[2];
let t2;
if ($[3] !== row) {
t2 = () => {
const expanded = row.getIsExpanded();
return /* @__PURE__ */ jsx(IconButton, {
size: "small",
onClick: (event) => {
event.stopPropagation();
row.toggleExpanded();
},
"aria-label": expanded ? "Collapse group" : "Expand group",
children: expanded ? /* @__PURE__ */ jsx(KeyboardArrowDown, { fontSize: "small" }) : /* @__PURE__ */ jsx(KeyboardArrowRight, { fontSize: "small" })
});
};
$[3] = row;
$[4] = t2;
} else t2 = $[4];
let t3;
if ($[5] !== row.table.atoms.expanded || $[6] !== t2) {
t3 = /* @__PURE__ */ jsx(Subscribe, {
source: row.table.atoms.expanded,
children: t2
});
$[5] = row.table.atoms.expanded;
$[6] = t2;
$[7] = t3;
} else t3 = $[7];
let t4;
if ($[8] !== cell) {
t4 = /* @__PURE__ */ jsx(FlexRender, { cell });
$[8] = cell;
$[9] = t4;
} else t4 = $[9];
let t5;
if ($[10] !== row.subRows.length) {
t5 = /* @__PURE__ */ jsxs(Typography, {
variant: "caption",
color: "text.secondary",
children: [
"(",
row.subRows.length,
")"
]
});
$[10] = row.subRows.length;
$[11] = t5;
} else t5 = $[11];
let t6;
if ($[12] !== t1 || $[13] !== t3 || $[14] !== t4 || $[15] !== t5) {
t6 = /* @__PURE__ */ jsxs(Stack, {
direction: "row",
spacing: .5,
sx: t1,
children: [
t3,
t4,
t5
]
});
$[12] = t1;
$[13] = t3;
$[14] = t4;
$[15] = t5;
$[16] = t6;
} else t6 = $[16];
return t6;
};
//#endregion
//#region src/components/table/cells/features/PinRowCell.tsx
const PinRowCell = () => {
const $ = c(6);
if ($[0] !== "7f27a5609f2431f18a788370d3382a09670f5d22d3f0bf3673d963f7c1d96a2d") {
for (let $i = 0; $i < 6; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
$[0] = "7f27a5609f2431f18a788370d3382a09670f5d22d3f0bf3673d963f7c1d96a2d";
}
const { row } = useCellContext();
let t0;
if ($[1] !== row) {
t0 = () => {
if (!row.getCanPin()) return null;
const pinned = row.getIsPinned();
return /* @__PURE__ */ jsx(Tooltip, {
title: pinned ? "Unpin row" : "Pin row",
children: /* @__PURE__ */ jsx(IconButton, {
size: "small",
color: pinned ? "primary" : "default",
onClick: (event) => {
event.stopPropagation();
row.pin(pinned ? false : "top");
},
children: /* @__PURE__ */ jsx(PushPin, { fontSize: "small" })
})
});
};
$[1] = row;
$[2] = t0;
} else t0 = $[2];
let t1;
if ($[3] !== row.table.atoms.rowPinning || $[4] !== t0) {
t1 = /* @__PURE__ */ jsx(Subscribe, {
source: row.table.atoms.rowPinning,
children: t0
});
$[3] = row.table.atoms.rowPinning;
$[4] = t0;
$[5] = t1;
} else t1 = $[5];
return t1;
};
//#endregion
//#region src/components/table/cells/features/SelectCell.tsx
const SelectCell = () => {
const $ = c(6);
if ($[0] !== "63921cbcf7fcb34cd713e4f8ddc73200874bc27abe8c714719a6e3a2f7d9bc3a") {
for (let $i = 0; $i < 6; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
$[0] = "63921cbcf7fcb34cd713e4f8ddc73200874bc27abe8c714719a6e3a2f7d9bc3a";
}
const { row } = useCellContext();
let t0;
if ($[1] !== row) {
t0 = () => row.getCanSelect() ? /* @__PURE__ */ jsx(Checkbox, {
size: "small",
checked: row.getIsSelected(),
indeterminate: !row.getIsSelected() && row.getIsSomeSelected(),
onChange: row.getToggleSelectedHandler(),
onClick: _temp$6,
slotProps: { input: { "aria-label": "Select row" } }
}) : null;
$[1] = row;
$[2] = t0;
} else t0 = $[2];
let t1;
if ($[3] !== row.table.atoms.rowSelection || $[4] !== t0) {
t1 = /* @__PURE__ */ jsx(Subscribe, {
source: row.table.atoms.rowSelection,
children: t0
});
$[3] = row.table.atoms.rowSelection;
$[4] = t0;
$[5] = t1;
} else t1 = $[5];
return t1;
};
function _temp$6(event) {
return event.stopPropagation();
}
//#endregion
//#region src/components/table/cells/formatters/BooleanCell.tsx
/** Icons are inline-block, so without this they sit on the baseline and read as too high. */
const ICON_SX = { verticalAlign: "middle" };
const BooleanCell = () => {
const $ = c(3);
if ($[0] !== "c4041104e91084b687210e0524e009dc1af846acee76bcfc3bf9d28753f13090") {
for (let $i = 0; $i < 3; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
$[0] = "c4041104e91084b687210e0524e009dc1af846acee76bcfc3bf9d28753f13090";
}
const cell = useCellContext();
let t0;
if ($[1] !== cell) {
t0 = cell.getValue() ? /* @__PURE__ */ jsx(Check, {
fontSize: "small",
color: "success",
sx: ICON_SX
}) : /* @__PURE__ */ jsx(Close, {
fontSize: "small",
color: "error",
sx: ICON_SX
});
$[1] = cell;
$[2] = t0;
} else t0 = $[2];
return t0;
};
//#endregion
//#region src/components/table/cells/formatters/DateCell.tsx
dayjs.extend(localizedFormat);
const DateCell = (t0) => {
const $ = c(19);
if ($[0] !== "21b387c4bddca0bccbe970e472aebb39930745f6d942bddb5392537064b45906") {
for (let $i = 0; $i < 19; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
$[0] = "21b387c4bddca0bccbe970e472aebb39930745f6d942bddb5392537064b45906";
}
let props;
let t1;
if ($[1] !== t0) {
({format: t1, ...props} = t0);
$[1] = t0;
$[2] = props;
$[3] = t1;
} else {
props = $[2];
t1 = $[3];
}
const format = t1 === void 0 ? "L" : t1;
const cell = useCellContext();
let T0;
let t2;
let t3;
let t4;
let t5;
let t6;
if ($[4] !== cell || $[5] !== format || $[6] !== props) {
t6 = Symbol.for("react.early_return_sentinel");
bb0: {
const value = cell.getValue();
if (!value) {
t6 = null;
break bb0;
}
T0 = Typography;
t2 = "body2";
t3 = true;
t4 = props;
t5 = dayjs(value).format(format);
}
$[4] = cell;
$[5] = format;
$[6] = props;
$[7] = T0;
$[8] = t2;
$[9] = t3;
$[10] = t4;
$[11] = t5;
$[12] = t6;
} else {
T0 = $[7];
t2 = $[8];
t3 = $[9];
t4 = $[10];
t5 = $[11];
t6 = $[12];
}
if (t6 !== Symbol.for("react.early_return_sentinel")) return t6;
let t7;
if ($[13] !== T0 || $[14] !== t2 || $[15] !== t3 || $[16] !== t4 || $[17] !== t5) {
t7 = /* @__PURE__ */ jsx(T0, {
variant: t2,
noWrap: t3,
...t4,
children: t5
});
$[13] = T0;
$[14] = t2;
$[15] = t3;
$[16] = t4;
$[17] = t5;
$[18] = t7;
} else t7 = $[18];
return t7;
};
//#endregion
//#region src/components/table/cells/formatters/DateTimeCell.tsx
const DateTimeCell = (t0) => {
const $ = c(7);
if ($[0] !== "fe9e4fc38583f37e5227c0f76eb86e36fdbf232415dbb06681be0a948a3dc051") {
for (let $i = 0; $i < 7; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
$[0] = "fe9e4fc38583f37e5227c0f76eb86e36fdbf232415dbb06681be0a948a3dc051";
}
let props;
let t1;
if ($[1] !== t0) {
({format: t1, ...props} = t0);
$[1] = t0;
$[2] = props;
$[3] = t1;
} else {
props = $[2];
t1 = $[3];
}
const format = t1 === void 0 ? "L LT" : t1;
let t2;
if ($[4] !== format || $[5] !== props) {
t2 = /* @__PURE__ */ jsx(DateCell, {
format,
...props
});
$[4] = format;
$[5] = props;
$[6] = t2;
} else t2 = $[6];
return t2;
};
//#endregion
//#region src/components/table/cells/formatters/NumberCell.tsx
const NumberCell = (t0) => {
const $ = c(12);
if ($[0] !== "7cf664bb8daeb610d39db08282e13af06d501456129b3096149df17a8de8bf43") {
for (let $i = 0; $i < 12; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
$[0] = "7cf664bb8daeb610d39db08282e13af06d501456129b3096149df17a8de8bf43";
}
let options;
let props;
let sx;
if ($[1] !== t0) {
({options, sx, ...props} = t0);
$[1] = t0;
$[2] = options;
$[3] = props;
$[4] = sx;
} else {
options = $[2];
props = $[3];
sx = $[4];
}
const cell = useCellContext();
let t1;
if ($[5] !== cell || $[6] !== options || $[7] !== props || $[8] !== sx) {
const value = cell.getValue();
let t2;
if ($[10] !== sx) {
t2 = {
fontVariantNumeric: "tabular-nums",
...sx
};
$[10] = sx;
$[11] = t2;
} else t2 = $[11];
t1 = /* @__PURE__ */ jsx(Typography, {
variant: "body2",
noWrap: true,
sx: t2,
...props,
children: typeof value === "number" && value.toLocaleString(void 0, options)
});
$[5] = cell;
$[6] = options;
$[7] = props;
$[8] = sx;
$[9] = t1;
} else t1 = $[9];
return t1;
};
//#endregion
//#region src/components/table/cells/formatters/ValueCell.tsx
const ValueCell = (props) => {
const $ = c(6);
if ($[0] !== "0ab00a06181368c5fd56e221c1dd8e5c7a77c9128bcfd533b69fc70bfb59896f") {
for (let $i = 0; $i < 6; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
$[0] = "0ab00a06181368c5fd56e221c1dd8e5c7a77c9128bcfd533b69fc70bfb59896f";
}
const cell = useCellContext();
let t0;
if ($[1] !== cell) {
t0 = cell.renderValue();
$[1] = cell;
$[2] = t0;
} else t0 = $[2];
const value = t0;
let t1;
if ($[3] !== props || $[4] !== value) {
t1 = /* @__PURE__ */ jsx(Typography, {
variant: "body2",
noWrap: true,
...props,
children: value
});
$[3] = props;
$[4] = value;
$[5] = t1;
} else t1 = $[5];
return t1;
};
//#endregion
//#region src/components/table/filterFns.ts
const apply = (fn, row, columnId, value) => fn(row, columnId, fn.resolveFilterValue?.(value) ?? value);
const ignoreDiacritics = (fn) => constructFilterFn({
...fn,
resolveFilterValue: foldForSearch,
resolveDataValue: foldForSearch
});
const includesString = ignoreDiacritics(filterFn_includesString);
const equalsString = ignoreDiacritics(filterFn_equalsString);
const startsWith = ignoreDiacritics(filterFn_startsWith);
const endsWith = ignoreDiacritics(filterFn_endsWith);
const isFilterActive = (filter) => filter.operator === "isEmpty" || filter.operator === "isNotEmpty" || !isBlank(filter.value);
const isBlank = (value) => value === void 0 || value === null || value === "" || Array.isArray(value) && (!value.length || value.every(isBlank));
const toTime = (value) => {
if (value instanceof Date) return Number.isNaN(value.getTime()) ? null : value.getTime();
if (typeof value === "string" || typeof value === "number") {
const time = new Date(value).getTime();
return Number.isNaN(time) ? null : time;
}
return null;
};
const toDay = (time) => new Date(time).setHours(0, 0, 0, 0);
const compareDates = (row, columnId, value, operator) => {
const rowTime = toTime(row.getValue(columnId));
const filterTime = toTime(value);
if (rowTime === null || filterTime === null) return void 0;
switch (operator) {
case "equals": return toDay(rowTime) === toDay(filterTime);
case "greaterThan": return rowTime > filterTime;
case "greaterThanOrEqualTo": return rowTime >= filterTime;
case "lessThan": return rowTime < filterTime;
case "lessThanOrEqualTo": return rowTime <= filterTime;
default: return;
}
};
const daysFromToday = (row, columnId) => {
const rowTime = toTime(row.getValue(columnId));
if (rowTime === null) return null;
return Math.floor((toDay(rowTime) - toDay(Date.now())) / 864e5);
};
const isRelativeToToday = (row, columnId, value) => {
const diff = daysFromToday(row, columnId);
if (diff === null) return false;
if (Array.isArray(value)) {
const [min, max] = value.map(Number);
return (Number.isNaN(min) || diff >= min) && (Number.isNaN(max) || diff <= max);
}
const days = Number(value);
return !Number.isNaN(days) && diff === days;
};
const equals = (row, columnId, value, variant) => {
if (Array.isArray(value)) return apply(filterFn_arrHas, row, columnId, value);
if (variant === "date") return compareDates(row, columnId, value, "equals") ?? false;
return apply(filterFn_equals, row, columnId, value);
};
const test = (row, columnId, operator, value, variant) => {
switch (operator) {
case "includesString": return apply(includesString, row, columnId, value);
case "notIncludesString": return !apply(includesString, row, columnId, value);
case "equalsString": return apply(equalsString, row, columnId, value);
case "notEqualsString": return !apply(equalsString, row, columnId, value);
case "startsWith": return apply(startsWith, row, columnId, value);
case "endsWith": return apply(endsWith, row, columnId, value);
case "isEmpty": return filterFn_empty(row, columnId, true);
case "isNotEmpty": return filterFn_notEmpty(row, columnId, true);
case "equals": return equals(row, columnId, value, variant);
case "notEquals": return !equals(row, columnId, value, variant);
case "greaterThan":
case "greaterThanOrEqualTo":
case "lessThan":
case "lessThanOrEqualTo": {
if (variant === "date") return compareDates(row, columnId, value, operator) ?? false;
const fn = {
greaterThan: filterFn_greaterThan,
greaterThanOrEqualTo: filterFn_greaterThanOrEqualTo,
lessThan: filterFn_lessThan,
lessThanOrEqualTo: filterFn_lessThanOrEqualTo
}[operator];
return apply(fn, row, columnId, value);
}
case "inRange": return apply(variant === "date" ? filterFn_inDateRange : filterFn_inNumberRange, row, columnId, Array.isArray(value) ? value : [value, value]);
case "isRelativeToToday": return isRelativeToToday(row, columnId, value);
}
};
const dynamicFilterFn = (row, columnId) => {
const filters = row.table.store.state.columnFilters.filter((filter) => filter.id === columnId);
if (!filters.length) return true;
const variant = (row.table.getColumn(columnId)?.columnDef.meta)?.variant ?? "text";
const results = filters.filter(isFilterActive).map((filter) => test(row, columnId, filter.operator ?? "includesString", filter.value, variant));
if (!results.length) return true;
return (filters[0].joinOperator ?? "and") === "and" ? results.every(Boolean) : results.some(Boolean);
};
dynamicFilterFn.autoRemove = () => false;
const globalFilterFn = includesString;
const TEXT_OPERATORS = [
"includesString",
"notIncludesString",
"startsWith",
"endsWith",
"equalsString",
"notEqualsString",
"isEmpty",
"isNotEmpty"
];
const NUMBER_OPERATORS = [
"equals",
"notEquals",
"lessThan",
"lessThanOrEqualTo",
"greaterThan",
"greaterThanOrEqualTo",
"inRange"
];
const DATE_OPERATORS = [
"equals",
"notEquals",
"lessThan",
"lessThanOrEqualTo",
"greaterThan",
"greaterThanOrEqualTo",
"inRange",
"isRelativeToToday",
"isEmpty",
"isNotEmpty"
];
const CHOICE_OPERATORS = [
"equals",
"notEquals",
"isEmpty",
"isNotEmpty"
];
const getFilterOperators = (variant) => {
switch (variant) {
case "number": return NUMBER_OPERATORS;
case "date": return DATE_OPERATORS;
case "boolean":
case "select":
case "multi-select": return CHOICE_OPERATORS;
default: return TEXT_OPERATORS;
}
};
//#endregion
//#region src/components/table/headers/AggregationFooter.tsx
const AggregationFooter = (t0) => {
const $ = c(8);
if ($[0] !== "2b3427c1cdd7a1c3368f3344dda08d0113fd71842b5d048d5aefe63b4f576caa") {
for (let $i = 0; $i < 8; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
$[0] = "2b3427c1cdd7a1c3368f3344dda08d0113fd71842b5d048d5aefe63b4f576caa";
}
const { prefix: t1, options } = t0;
const prefix = t1 === void 0 ? "" : t1;
const { column } = useHeaderContext();
let t2;
if ($[1] !== column || $[2] !== options || $[3] !== prefix) {
t2 = () => {
const value = formatValue(column.getAggregationValue({ rows: column.table.getFilteredRowModel().rows }));
if (!value) return null;
const numeric = Number(value);
return /* @__PURE__ */ jsxs(Typography, {
variant: "body2",
noWrap: true,
sx: { fontWeight: 700 },
children: [prefix, Number.isFinite(numeric) ? numeric.toLocaleString(void 0, options) : value]
});
};
$[1] = column;
$[2] = options;
$[3] = prefix;
$[4] = t2;
} else t2 = $[4];
let t3;
if ($[5] !== column.table.atoms.columnFilters || $[6] !== t2) {
t3 = /* @__PURE__ */ jsx(Subscribe, {
source: column.table.atoms.columnFilters,
children: t2
});
$[5] = column.table.atoms.columnFilters;
$[6] = t2;
$[7] = t3;
} else t3 = $[7];
return t3;
};
//#endregion
//#region src/components/table/headers/ExpandAllCell.tsx
const ExpandAllCell = () => {
const $ = c(6);
if ($[0] !== "851f8a7aeadefee23d0b10559fef0b77d249b3af774b5b47e7baf05db417b810") {
for (let $i = 0; $i < 6; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
$[0] = "851f8a7aeadefee23d0b10559fef0b77d249b3af774b5b47e7baf05db417b810";
}
const table = useHeaderContext().table;
let t0;
if ($[1] !== table) {
t0 = () => {
if (!table.getCanSomeRowsExpand()) return null;
return /* @__PURE__ */ jsx(IconButton, {
size: "small",
onClick: table.getToggleAllRowsExpandedHandler(),
"aria-label": "Toggle all rows",
children: /* @__PURE__ */ jsx(ArrowDownward, {
fontSize: "small",
sx: {
transition: "transform 150ms",
transform: table.getIsAllRowsExpanded() ? "rotate(0deg)" : "rotate(-90deg)"
}
})
});
};
$[1] = table;
$[2] = t0;
} else t0 = $[2];
let t1;
if ($[3] !== t0 || $[4] !== table.atoms.expanded) {
t1 = /* @__PURE__ */ jsx(Subscribe, {
source: table.atoms.expanded,
children: t0
});
$[3] = t0;
$[4] = table.atoms.expanded;
$[5] = t1;
} else t1 = $[5];
return t1;
};
//#endregion
//#region src/components/table/headers/HeaderMenu.tsx
const HeaderMenu = () => {
const $ = c(10);
if ($[0] !== "ecfcf0f9fe23e5b130d059c75e052010db8c0f428bc5ec35c88d8a9df9828811") {
for (let $i = 0; $i < 10; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
$[0] = "ecfcf0f9fe23e5b130d059c75e052010db8c0f428bc5ec35c88d8a9df9828811";
}
const header = useHeaderContext();
const { t } = useTranslation$1();
const [anchorEl, setAnchorEl] = useState(null);
const { column } = header;
let t0;
if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
t0 = () => setAnchorEl(null);
$[1] = t0;
} else t0 = $[1];
const close = t0;
let t1;
if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
t1 = (action) => () => {
action();
close();
};
$[2] = t1;
} else t1 = $[2];
const run = t1;
if (!hasColumnLabel(column)) return null;
let t2;
if ($[3] !== anchorEl || $[4] !== column || $[5] !== t) {
t2 = () => {
const canSort = column.getCanSort();
const canPin = column.getCanPin();
const canGroup = column.getCanGroup();
const canHide = column.getCanHide();
if (!canSort && !canPin && !canGroup && !canHide) return null;
const sorted = column.getIsSorted();
const pinned = column.getIsPinned();
const grouped = column.getIsGrouped();
const index = column.getIndex();
const leafCount = column.table.getVisibleLeafColumns().length;
return /* @__PURE__ */ jsxs(Box, {
sx: {
display: "flex",
flexShrink: 0,
mr: "-5px",
overflow: "hidden",
width: anchorEl ? "auto" : 0,
".MuiTableCell-root:hover &": { width: "auto" },
"&:focus-within": { width: "auto" },
"@media (hover: none)": { width: "auto" }
},
children: [/* @__PURE__ */ jsx(IconButton, {
size: "small",
onClick: (event) => setAnchorEl(event.currentTarget),
"aria-label": t("Layout.Table.ColumnMenu"),
children: /* @__PURE__ */ jsx(MoreVert, { fontSize: "small" })
}), /* @__PURE__ */ jsxs(Menu, {
anchorEl,
open: !!anchorEl,
onClose: close,
children: [
canSort && sorted !== "asc" && /* @__PURE__ */ jsxs(MenuItem, {
onClick: run(() => column.toggleSorting(false, true)),
children: [/* @__PURE__ */ jsx(ListItemIcon, { children: /* @__PURE__ */ jsx(ArrowUpward, { fontSize: "small" }) }), /* @__PURE__ */ jsx(ListItemText, { children: t("Layout.Table.SortAscending") })]
}),
canSort && sorted !== "desc" && /* @__PURE__ */ jsxs(MenuItem, {
onClick: run(() => column.toggleSorting(true, true)),
children: [/* @__PURE__ */ jsx(ListItemIcon, { children: /* @__PURE__ */ jsx(ArrowDownward, { fontSize: "small" }) }), /* @__PURE__ */ jsx(ListItemText, { children: t("Layout.Table.SortDescending") })]
}),
canSort && sorted !== false && /* @__PURE__ */ jsxs(MenuItem, {
onClick: run(() => column.clearSorting()),
children: [/* @__PURE__ */ jsx(ListItemIcon, { children: /* @__PURE__ */ jsx(Clear, { fontSize: "small" }) }), /* @__PURE__ */ jsx(ListItemText, { children: t("Layout.Table.ClearSort") })]
}),
canPin && /* @__PURE__ */ jsx(Divider, {}),
canPin && ["start", "end"].map((position) => /* @__PURE__ */ jsxs(MenuItem, {
selected: pinned === position,
onClick: run(() => column.pin(pinned === position ? false : position)),
children: [/* @__PURE__ */ jsx(ListItemIcon, { children: /* @__PURE__ */ jsx(PushPin, { fontSize: "small" }) }), /* @__PURE__ */ jsx(ListItemText, { children: pinned === position ? t("Layout.Table.Unpin") : position === "start" ? t("Layout.Table.PinStart") : t("Layout.Table.PinEnd") })]
}, position)),
/* @__PURE__ */ jsx(Divider, {}),
/* @__PURE__ */ jsxs(MenuItem, {
disabled: index <= 0,
onClick: run(() => moveColumn(column, -1)),
children: [/* @__PURE__ */ jsx(ListItemIcon, { children: /* @__PURE__ */ jsx(ArrowBack, { fontSize: "small" }) }), /* @__PURE__ */ jsx(ListItemText, { children: t("Layout.Table.MoveLeft") })]
}),
/* @__PURE__ */ jsxs(MenuItem, {
disabled: index >= leafCount - 1,
onClick: run(() => moveColumn(column, 1)),
children: [/* @__PURE__ */ jsx(ListItemIcon, { children: /* @__PURE__ */ jsx(ArrowForward, { fontSize: "small" }) }), /* @__PURE__ */ jsx(ListItemText, { children: t("Layout.Table.MoveRight") })]
}),
canGroup && /* @__PURE__ */ jsx(Divider, {}),
canGroup && /* @__PURE__ */ jsxs(MenuItem, {
onClick: run(() => column.toggleGrouping()),
children: [/* @__PURE__ */ jsx(ListItemIcon, { children: /* @__PURE__ */ jsx(Workspaces, { fontSize: "small" }) }), /* @__PURE__ */ jsx(ListItemText, { children: grouped ? t("Layout.Table.Ungroup") : t("Layout.Table.GroupBy") })]
}),
canHide && /* @__PURE__ */ jsx(Divider, {}),
canHide && /* @__PURE__ */ jsxs(MenuItem, {
onClick: run(() => column.toggleVisibility(false)),
children: [/* @__PURE__ */ jsx(ListItemIcon, { children: /* @__PURE__ */ jsx(VisibilityOff, { fontSize: "small" }) }), /* @__PURE__ */ jsx(ListItemText, { children: t("Layout.Table.HideColumn") })]
})
]
})]
});
};
$[3] = anchorEl;
$[4] = column;
$[5] = t;
$[6] = t2;
} else t2 = $[6];
let t3;
if ($[7] !== column.table.store || $[8] !== t2) {
t3 = /* @__PURE__ */ jsx(Subscribe, {
source: column.table.store,
selector: _temp$5,
children: t2
});
$[7] = column.table.store;
$[8] = t2;
$[9] = t3;
} else t3 = $[9];
return t3;
};
function _temp$5(state) {
return state;
}
//#endregion
//#region src/components/table/headers/HeaderResizeHandle.tsx
const BAR_HEIGHT = 24;
const TARGET_SIZE = 10;
const bar = (accent) => ({
content: "\"\"",
position: "absolute",
insetInlineEnd: 0,
top: `calc(50% - ${BAR_HEIGHT / 2}px)`,
width: accent ? "3px" : "1px",
height: BAR_HEIGHT,
borderRadius: accent ? "1.5px" : "0.5px",
bgcolor: accent ? "primary.dark" : "divider",
transition: (theme) => theme.transitions.create(["width", "background-color"])
});
const base = {
position: "absolute",
insetBlock: 0,
insetInlineEnd: 0,
width: TARGET_SIZE
};
const HeaderResizeHandle = () => {
const $ = c(10);
if ($[0] !== "e1cc0c056dc5cc9102191f0d1628d7994976d6fec3257d6bc6da3e49d48245f1") {
for (let $i = 0; $i < 10; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
$[0] = "e1cc0c056dc5cc9102191f0d1628d7994976d6fec3257d6bc6da3e49d48245f1";
}
const header = useHeaderContext();
const { column } = header;
if (!column.getCanResize()) {
let t0;
if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
t0 = /* @__PURE__ */ jsx(Box, { sx: {
...base,
"&::after": bar(false)
} });
$[1] = t0;
} else t0 = $[1];
return t0;
}
let t0;
if ($[2] !== header) {
t0 = header.getResizeHandler();
$[2] = header;
$[3] = t0;
} else t0 = $[3];
const handler = t0;
let t1;
if ($[4] !== column || $[5] !== handler) {
t1 = () => /* @__PURE__ */ jsx(Box, {
role: "separator",
"aria-orientation": "vertical",
onMouseDown: handler,
onTouchStart: handler,
onDoubleClick: () => column.resetSize(),
onClick: _temp$4,
sx: {
...base,
cursor: "col-resize",
touchAction: "none",
userSelect: "none",
"&::after": bar(column.getIsResizing()),
"&:hover::after": bar(true)
}
});
$[4] = column;
$[5] = handler;
$[6] = t1;
} else t1 = $[6];
let t2;
if ($[7] !== column.table.atoms.columnResizing || $[8] !== t1) {
t2 = /* @__PURE__ */ jsx(Subscribe, {
source: column.table.atoms.columnResizing,
children: t1
});
$[7] = column.table.atoms.columnResizing;
$[8] = t1;
$[9] = t2;
} else t2 = $[9];
return t2;
};
function _temp$4(event) {
return event.stopPropagation();
}
//#endregion
//#region src/components/table/headers/HeaderSortLabel.tsx
const HeaderSortLabel = (t0) => {
const $ = c(7);
if ($[0] !== "3963eb1f093b2c0b3513d5574e478a830b2db6eeb5db09ed16762691d354080a") {
for (let $i = 0; $i < 7; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
$[0] = "3963eb1f093b2c0b3513d5574e478a830b2db6eeb5db09ed16762691d354080a";
}
const { children } = t0;
const { column } = useHeaderContext();
if (!column.getCanSort()) return children;
let t1;
if ($[1] !== children || $[2] !== column) {
t1 = (sorting) => {
const direction = column.getIsSorted();
const sortIndex = sorting.length > 1 ? column.getSortIndex() : -1;
return /* @__PURE__ */ jsxs(TableSortLabel, {
active: direction !== false,
direction: direction === false ? "asc" : direction,
onClick: column.getToggleSortingHandler(),
children: [children, sortIndex > -1 && /* @__PURE__ */ jsx(Box, {
component: "span",
sx: {
ml: .5,
fontSize: 11,
opacity: .7
},
children: sortIndex + 1
})]
});
};
$[1] = children;
$[2] = column;
$[3] = t1;
} else t1 = $[3];
let t2;
if ($[4] !== column.table.atoms.sorting || $[5] !== t1) {
t2 = /* @__PURE__ */ jsx(Subscribe, {
source: column.table.atoms.sorting,
children: t1
});
$[4] = column.table.atoms.sorting;
$[5] = t1;
$[6] = t2;
} else t2 = $[6];
return t2;
};
//#endregion
//#region src/components/table/headers/SelectAllCell.tsx
const SelectAllCell = (t0) => {
const $ = c(7);
if ($[0] !== "33588c3e9cbdc713efa770a1c85d8af909b2a6100693622a56aa84ee845a7d85") {
for (let $i = 0; $i < 7; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
$[0] = "33588c3e9cbdc713efa770a1c85d8af909b2a6100693622a56aa84ee845a7d85";
}
const { scope: t1 } = t0;
const scope = t1 === void 0 ? "page" : t1;
const table = useHeaderContext().table;
let t2;
if ($[1] !== scope || $[2] !== table) {
t2 = () => {
const checked = scope === "page" ? table.getIsAllPageRowsSelected() : table.getIsAllRowsSelected();
const indeterminate = scope === "page" ? table.getIsSomePageRowsSelected() : table.getIsSomeRowsSelected();
return /* @__PURE__ */ jsx(Checkbox, {
size: "small",
checked,
indeterminate: !checked && indeterminate,
onChange: scope === "page" ? table.getToggleAllPageRowsSelectedHandler() : table.getToggleAllRowsSelectedHandler(),
slotProps: { input: { "aria-label": "Select all rows" } }
});
};
$[1] = scope;
$[2] = table;
$[3] = t2;
} else t2 = $[3];
let t3;
if ($[4] !== t2 || $[5] !== table.atoms.rowSelection) {
t3 = /* @__PURE__ */ jsx(Subscribe, {
source: table.atoms.rowSelection,
children: t2
});
$[4] = t2;
$[5] = table.atoms.rowSelection;
$[6] = t3;
} else t3 = $[6];
return t3;
};
//#endregion
//#region src/components/table/table/ColumnsPanel.tsx
const ColumnsPanel = () => {
const $ = c(29);
if ($[0] !== "6e9b775bc940f7c6695c6f73b0a2c1b2006d3ddafbf891fff9340e618b93e44d") {
for (let $i = 0; $i < 29; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
$[0] = "6e9b775bc940f7c6695c6f73b0a2c1b2006d3ddafbf891fff9340e618b93e44d";
}
const table = useTableContext();
const { t } = useTranslation$1();
const [anchorEl, setAnchorEl] = useState(null);
const buttonRef = useRef(null);
let t0;
if ($[1] !== table) {
t0 = table.getAllLeafColumns().filter(_temp$3);
$[1] = table;
$[2] = t0;
} else t0 = $[2];
const columns = t0;
let t1;
if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
t1 = () => setAnchorEl((current) => current ? null : buttonRef.current);
$[3] = t1;
} else t1 = $[3];
const t2 = columns.length > 0;
let t3;
if ($[4] !== t2) {
t3 = { enabled: t2 };
$[4] = t2;
$[5] = t3;
} else t3 = $[5];
useHotkey("Alt+C", t1, t3);
if (!columns.length) return null;
let t4;
if ($[6] !== t) {
t4 = shortcutLabel(t("Layout.Table.Columns"), "Alt+C");
$[6] = t;
$[7] = t4;
} else t4 = $[7];
let t5;
if ($[8] === Symbol.for("react.memo_cache_sentinel")) {
t5 = /* @__PURE__ */ jsx(IconButton, {
ref: buttonRef,
size: "small",
onClick: (event) => setAnchorEl(event.currentTarget),
children: /* @__PURE__ */ jsx(ViewColumn, { fontSize: "small" })
});
$[8] = t5;
} else t5 = $[8];
let t6;
if ($[9] !== t4) {
t6 = /* @__PURE__ */ jsx(Tooltip, {
title: t4,
children: t5
});
$[9] = t4;
$[10] = t6;
} else t6 = $[10];
const t7 = !!anchorEl;
let t10;
let t11;
let t8;
let t9;
if ($[11] === Symbol.for("react.memo_cache_sentinel")) {
t8 = () => setAnchorEl(null);
t9 = {
vertical: "bottom",
horizontal: "right"
};
t10 = {
vertical: "top",
horizontal: "right"
};
t11 = { paper: { sx: { maxWidth: "calc(100vw - 16px)" } } };
$[11] = t10;
$[12] = t11;
$[13] = t8;
$[14] = t9;
} else {
t10 = $[11];
t11 = $[12];
t8 = $[13];
t9 = $[14];
}
let t12;
if ($[15] !== columns || $[16] !== t || $[17] !== table) {
t12 = () => /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(Box, {
sx: {
display: "flex",
flexDirection: "column",
px: 1.5,
py: 1,
maxHeight: 300,
minWidth: 240,
overflow: "auto"
},
children: columns.map(_temp2$1)
}), /* @__PURE__ */ jsx(Box, {
sx: {
display: "flex",
alignItems: "center",
p: 1.5,
borderTop: 1,
borderColor: "divider"
},
children: /* @__PURE__ */ jsx(FormControlLabel, {
label: t("Layout.Table.ShowHideAll"),
slotProps: { typography: {
variant: "body2",
noWrap: true
} },
control: /* @__PURE__ */ jsx(Checkbox, {
size: "small",
checked: table.getIsAllColumnsVisible(),
indeterminate: table.getIsSomeColumnsVisible() && !table.getIsAllColumnsVisible(),
onChange: table.getToggleAllColumnsVisibilityHandler()
})
})
})] });
$[15] = columns;
$[16] = t;
$[17] = table;
$[18] = t12;
} else t12 = $[18];
let t13;
if ($[19] !== t12 || $[20] !== table.atoms.columnVisibility) {
t13 = /* @__PURE__ */ jsx(Subscribe, {
source: table.atoms.columnVisibility,
children: t12
});
$[19] = t12;
$[20] = table.atoms.columnVisibility;
$[21] = t13;
} else t13 = $[21];
let t14;
if ($[22] !== anchorEl || $[23] !== t13 || $[24] !== t7) {
t14 = /* @__PURE__ */ jsx(Popover, {
anchorEl,
open: t7,
onClose: t8,
anchorOrigin: t9,
transformOrigin: t10,
slotProps: t11,
children: t13
});
$[22] = anchorEl;
$[23] = t13;
$[24] = t7;
$[25] = t14;
} else t14 = $[25];
let t15;
if ($[26] !== t14 || $[27] !== t6) {
t15 = /* @__PURE__ */ jsxs(Fragment$1, { children: [t6, t14] });
$[26] = t14;
$[27] = t6;
$[28] = t15;
} else t15 = $[28];
return t15;
};
function _temp$3(column) {
return hasColumnLabel(column) && column.getCanHide();
}
function _temp2$1(column_0) {
return /* @__PURE__ */ jsx(FormControlLabel, {
label: columnLabel(column_0),
slotProps: { typography: {
variant: "body2",
noWrap: true
} },
control: /* @__PURE__ */ jsx(Checkbox, {
size: "small",
checked: column_0.getIsVisible(),
onChange: column_0.getToggleVisibilityHandler()
})
}, column_0.id);
}
//#endregion
//#region src/components/table/ColumnFilterField.tsx
const filterMeta = (column) => column.columnDef.meta ?? {};
const resolveOptions = (column) => {
const declared = filterMeta(column).options;
if (declared) return declared;
return Array.from(column.getFacetedUniqueValues().keys()).map((value) => ({
label: formatValue(value),
value: formatValue(value)
})).filter((option) => option.value !== "").sort((a, b) => a.label.localeCompare(b.label));
};
const toDateInputValue = (value) => {
if (!(value instanceof Date || typeof value === "string" || typeof value === "number")) return "";
const date = value instanceof Date ? value : new Date(value);
if (Number.isNaN(date.getTime())) return "";
return `${date.getFullYear()}-${String(date.getMonth() + 1).padStart(2, "0")}-${String(date.getDate()).padStart(2, "0")}`;
};
const fromDateInputValue = (raw) => raw ? (/* @__PURE__ */ new Date(`${raw}T00:00:00`)).toISOString() : void 0;
const toNumber = (raw) => raw === "" ? "" : Number(raw);
const pair = (value) => Array.isArray(value) ? [value[0], value[1]] : ["", ""];
function ColumnFilterField(t0) {
const $ = c(123);
if ($[0] !== "5472f0f3f904ec8bb8abe412ebf0d2e19ae251239f8741d21196cc627823b1ce") {
for (let $i = 0; $i < 123; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
$[0] = "5472f0f3f904ec8bb8abe412ebf0d2e19ae251239f8741d21196cc627823b1ce";
}
const { column, filter, onChange } = t0;
const { t } = useTranslation$1();
let t1;
if ($[1] !== column) {
t1 = filterMeta(column).variant ?? "text";
$[1] = column;
$[2] = t1;
} else t1 = $[2];
const variant = t1;
const operator = filter.operator ?? "includesString";
let t2;
if ($[3] !== t) {
t2 = t("Layout.Table.Value");
$[3] = t;
$[4] = t2;
} else t2 = $[4];
let t3;
if ($[5] !== t2) {
t3 = {
size: "small",
fullWidth: true,
label: t2
};
$[5] = t2;
$[6] = t3;
} else t3 = $[6];
const shared = t3;
if (operator === "isEmpty" || operator === "isNotEmpty") {
let t4;
if ($[7] !== t) {
t4 = t("Layout.Table.NoValueRequired");
$[7] = t;
$[8] = t4;
} else t4 = $[8];
let t5;
if ($[9] !== t4) {
t5 = /* @__PURE__ */ jsx(Typography, {
variant: "body2",
color: "text.secondary",
children: t4
});
$[9] = t4;
$[10] = t5;
} else t5 = $[10];
return t5;
}
if (operator === "inRange") {
let T0;
let T1;
let from;
let isDate;
let t4;
let t5;
let t6;
let t7;
let t8;
let t9;
let to;
if ($[11] !== filter.value || $[12] !== shared || $[13] !== t || $[14] !== variant) {
[from, to] = pair(filter.value);
isDate = variant === "date";
T1 = Stack;
t8 = "row";
t9 = 1;
T0 = TextField;
t4 = shared;
t5 = isDate ? "date" : "number";
if ($[26] !== t) {
t6 = t("Layout.Table.From");
$[26] = t;
$[27] = t6;
} else t6 = $[27];
t7 = isDate ? toDateInputValue(from) : from ?? "";
$[11] = filter.value;
$[12] = shared;
$[13] = t;
$[14] = variant;
$[15] = T0;
$[16] = T1;
$[17] = from;
$[18] = isDate;
$[19] = t4;
$[20] = t5;
$[21] = t6;
$[22] = t7;
$[23] = t8;
$[24] = t9;
$[25] = to;
} else {
T0 = $[15];
T1 = $[16];
from = $[17];
isDate = $[18];
t4 = $[19];
t5 = $[20];
t6 = $[21];
t7 = $[22];
t8 = $[23];
t9 = $[24];
to = $[25];
}
let t10;
if ($[28] !== isDate || $[29] !== onChange || $[30] !== to) {
t10 = (event) => onChange([isDate ? fromDateInputValue(event.target.value) : toNumber(event.target.value), to]);
$[28] = isDate;
$[29] = onChange;
$[30] = to;
$[31] = t10;
} else t10 = $[31];
let t11;
if ($[32] === Symbol.for("react.memo_cache_sentinel")) {
t11 = { inputLabel: { shrink: true } };
$[32] = t11;
} else t11 = $[32];
let t12;
if ($[33] !== T0 || $[34] !== t10 || $[35] !== t4 || $[36] !== t5 || $[37] !== t6 || $[38] !== t7) {
t12 = /* @__PURE__ */ jsx(T0, {
...t4,
type: t5,
label: t6,
value: t7,
onChange: t10,
slotProps: t11
});
$[33] = T0;
$[34] = t10;
$[35] = t4;
$[36] = t5;
$[37] = t6;
$[38] = t7;
$[39] = t12;
} else t12 = $[39];
const t13 = isDate ? "date" : "number";
let t14;
if ($[40] !== t) {
t14 = t("Layout.Table.To");
$[40] = t;
$[41] = t14;
} else t14 = $[41];
let t15;
if ($[42] !== isDate || $[43] !== to) {
t15 = isDate ? toDateInputValue(to) : to ?? "";
$[42] = isDate;
$[43] = to;
$[44] = t15;
} else t15 = $[44];
let t16;
if ($[45] !== from || $[46] !== isDate || $[47] !== onChange) {
t16 = (event_0) => onChange([from, isDate ? fromDateInputValue(event_0.target.value) : toNumber(event_0.target.value)]);
$[45] = from;
$[46] = isDate;
$[47] = onChange;
$[48] = t16;
} else t16 = $[48];
let t17;
if ($[49] === Symbol.for("react.memo_cache_sentinel")) {
t17 = { inputLabel: { shrink: true } };
$[49] = t17;
} else t17 = $[49];
let t18;
if ($[50] !== shared || $[51] !== t13 || $[52] !== t14 || $[53] !== t15 || $[54] !== t16) {
t18 = /* @__PURE__ */ jsx(TextField, {
...shared,
type: t13,
label: t14,
value: t15,
onChange: t16,
slotProps: t17
});
$[50] = shared;
$[51] = t13;
$[52] = t14;
$[53] = t15;
$[54] = t16;
$[55] = t18;
} else t18 = $[55];
let t19;
if ($[56] !== T1 || $[57] !== t12 || $[58] !== t18 || $[59] !== t8 || $[60] !== t9) {
t19 = /* @__PURE__ */ jsxs(T1, {
direction: t8,
spacing: t9,
children: [t12, t18]
});
$[56] = T1;
$[57] = t12;
$[58] = t18;
$[59] = t8;
$[60] = t9;
$[61] = t19;
} else t19 = $[61];
return t19;
}
if (operator === "isRelativeToToday") {
let t4;
if ($[62] !== t) {
t4 = t("Layout.Table.DaysFromToday");
$[62] = t;
$[63] = t4;
} else t4 = $[63];
const t5 = filter.value ?? "";
let t6;
if ($[64] !== onChange) {
t6 = (event_1) => onChange(toNumber(event_1.target.value));
$[64] = onChange;
$[65] = t6;
} else t6 = $[65];
let t7;
if ($[66] !== shared || $[67] !== t4 || $[68] !== t5 || $[69] !== t6) {
t7 = /* @__PURE__ */ jsx(TextField, {
...shared,
type: "number",
label: t4,
value: t5,
onChange: t6
});
$[66] = shared;
$[67] = t4;
$[68] = t5;
$[69] = t6;
$[70] = t7;
} else t7 = $[70];
return t7;
}
if (variant === "select" || variant === "multi-select") {
let T0;
let t4;
let t5;
let t6;
let t7;
let t8;
let t9;
if ($[71] !== column || $[72] !== filter.value || $[73] !== variant) {
const options = resolveOptions(column);
const multiple = variant === "multi-select";
let t10;
if ($[81] !== filter.value) {
t10 = Array.isArray(filter.value) ? filter.value : [];
$[81] = filter.value;
$[82] = t10;
} else t10 = $[82];
const selected = t10;
T0 = Autocomplete;
t4 = "small";
t5 = true;
t6 = multiple;
t7 = options;
t8 = multiple;
t9 = multiple ? options.filter((option) => selected.includes(option.value)) : options.find((option_0) => option_0.value === filter.value) ?? null;
$[71] = column;
$[72] = filter.value;
$[73] = variant;
$[74] = T0;
$[75] = t4;
$[76] = t5;
$[77] = t6;
$[78] = t7;
$[79] = t8;
$[80] = t9;
} else {
T0 = $[74];
t4 = $[75];
t5 = $[76];
t6 = $[77];
t7 = $[78];
t8 = $[79];
t9 = $[80];
}
let t10;
if ($[83] !== onChange) {
t10 = (_, next) => onChange(Array.isArray(next) ? next.map(_temp3) : next?.value ?? void 0);
$[83] = onChange;
$[84] = t10;
} else t10 = $[84];
let t11;
if ($[85] !== t) {
t11 = (params) => /* @__PURE__ */ jsx(TextField, {
...params,
size: "small",
label: t("Layout.Table.Value")
});
$[85] = t;
$[86] = t11;
} else t11 = $[86];
let t12;
if ($[87] !== T0 || $[88] !== t10 || $[89] !== t11 || $[90] !== t4 || $[91] !== t5 || $[92] !== t6 || $[93] !== t7 || $[94] !== t8 || $[95] !== t9) {
t12 = /* @__PURE__ */ jsx(T0, {
size: t4,
fullWidth: t5,
multiple: t6,
options: t7,
disableCloseOnSelect: t8,
value: t9,
isOptionEqualToValue: _temp$2,
getOptionLabel: _temp2,
onChange: t10,
renderInput: t11
});
$[87] = T0;
$[88] = t10;
$[89] = t11;
$[90] = t4;
$[91] = t5;
$[92] = t6;
$[93] = t7;
$[94] = t8;
$[95] = t9;
$[96] = t12;
} else t12 = $[96];
return t12;
}
if (variant === "boolean") {
const t4 = typeof filter.value === "boolean" ? String(filter.value) : "";
let t5;
if ($[97] !== onChange) {
t5 = (event_2) => onChange(event_2.target.value === "" ? void 0 : event_2.target.value === "true");
$[97] = onChange;
$[98] = t5;
} else t5 = $[98];
let t6;
let t7;
let t8;
if ($[99] === Symbol.for("react.memo_cache_sentinel")) {
t6 = /* @__PURE__ */ jsx(MenuItem, {
value: "",
children: "—"
});
t7 = /* @__PURE__ */ jsx(MenuItem, {
value: "true",
children: "✓"
});
t8 = /* @__PURE__ */ jsx(MenuItem, {
value: "false",
children: "✗"
});
$[99] = t6;
$[100] = t7;
$[101] = t8;
} else {
t6 = $[99];
t7 = $[100];
t8 = $[101];
}
let t9;
if ($[102] !== shared || $[103] !== t4 || $[104] !== t5) {
t9 = /* @__PURE__ */ jsxs(TextField, {
...shared,
select: true,
value: t4,
onChange: t5,
children: [
t6,
t7,
t8
]
});
$[102] = shared;
$[103] = t4;
$[104] = t5;
$[105] = t9;
} else t9 = $[105];
return t9;
}
if (variant === "date") {
let t4;
if ($[106] !== filter.value) {
t4 = toDateInputValue(filter.value);
$[106] = filter.value;
$[107] = t4;
} else t4 = $[107];
let t5;
if ($[108] !== onChange) {
t5 = (event_3) => onChange(fromDateInputValue(event_3.target.value) ?? "");
$[108] = onChange;
$[109] = t5;
} else t5 = $[109];
let t6;
if ($[110] === Symbol.for("react.memo_cache_sentinel")) {
t6 = { inputLabel: { shrink: true } };
$[110] = t6;
} else t6 = $[110];
let t7;
if ($[111] !== shared || $[112] !== t4 || $[113] !== t5) {
t7 = /* @__PURE__ */ jsx(TextField, {
...shared,
type: "date",
value: t4,
onChange: t5,
slotProps: t6
});
$[111] = shared;
$[112] = t4;
$[113] = t5;
$[114] = t7;
} else t7 = $[114];
return t7;
}
const t4 = variant === "number" ? "number" : "text";
const t5 = filter.value ?? "";
let t6;
if ($[115] !== onChange || $[116] !== variant) {
t6 = (event_4) => onChange(variant === "number" ? toNumber(event_4.target.value) : event_4.target.value);
$[115] = onChange;
$[116] = variant;
$[117] = t6;
} else t6 = $[117];
let t7;
if ($[118] !== shared || $[119] !== t4 || $[120] !== t5 || $[121] !== t6) {
t7 = /* @__PURE__ */ jsx(TextField, {
...shared,
type: t4,
value: t5,
onChange: t6
});
$[118] = shared;
$[119] = t4;
$[120] = t5;
$[121] = t6;
$[122] = t7;
} else t7 = $[122];
return t7;
}
function _temp3(option_3) {
return option_3.value;
}
function _temp2(option_2) {
return option_2.label;
}
function _temp$2(option_1, selectedOption) {
return option_1.value === selectedOption.value;
}
//#endregion
//#region src/components/table/table/FiltersMenu.tsx
const DATE_OPERATOR_LABELS = {
lessThan: "Layout.Table.Operators.Date.lessThan",
lessThanOrEqualTo: "Layout.Table.Operators.Date.lessThanOrEqualTo",
greaterThan: "Layout.Table.Operators.Date.greaterThan",
greaterThanOrEqualTo: "Layout.Table.Operators.Date.greaterThanOrEqualTo"
};
/** Slot widths taken from the MUI X `GridFilterForm` inputs. */
const LOGIC_WIDTH = 75;
const FIELD_WIDTH = 150;
const VALUE_WIDTH = 190;
const FiltersMenu = () => {
const table = useTableContext();
const { t } = useTranslation$1();
const [anchorEl, setAnchorEl] = useState(null);
const placeholder = useRef(null);
const buttonRef = useRef(null);
const filterableColumns = table.getAllLeafColumns().filter((column) => column.getCanFilter());
const close = () => {
setAnchorEl(null);
placeholder.current = null;
};
useHotkey("Control+F", () => anchorEl ? close() : setAnchorEl(buttonRef.current), { enabled: filterableColumns.length > 0 });
if (!filterableColumns.length) return null;
const setFilters = (filters) => table.setColumnFilters(filters);
const newFilter = (column_0, joinOperator = "and") => ({
id: column_0.id,
filterId: crypto.randomUUID(),
value: "",
operator: getFilterOperators(column_0.columnDef.meta?.variant ?? "text")[0],
joinOperator
});
return /* @__PURE__ */ jsx(Subscribe, {
source: table.atoms.columnFilters,
selector: (filters_0) => filters_0,
children: (columnFilters) => {
if (!columnFilters.length) placeholder.current ??= newFilter(filterableColumns[0]);
const rows = columnFilters.length ? columnFilters : placeholder.current ? [placeholder.current] : [];
const activeCount = columnFilters.filter(isFilterActive).length;
const update = (filterId, patch) => setFilters(rows.map((filter) => filter.filterId === filterId ? {
...filter,
...patch,
..."value" in patch && { value: patch.value ?? "" }
} : filter));
const remove = (filterId_0) => {
const next = rows.filter((filter_0) => filter_0.filterId !== filterId_0);
placeholder.current = null;
setFilters(next);
if (!next.length) close();
};
const add = () => setFilters([...rows, newFilter(filterableColumns[0], rows[0]?.joinOperator ?? "and")]);
return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(Tooltip, {
title: shortcutLabel(t("Layout.Table.Filters"), "Control+F"),
children: /* @__PURE__ */ jsx(IconButton, {
ref: buttonRef,
size: "small",
color: activeCount ? "primary" : "default",
onClick: (event) => setAnchorEl(event.currentTarget),
children: /* @__PURE__ */ jsx(Badge, {
badgeContent: activeCount,
color: "primary",
variant: "dot",
children: /* @__PURE__ */ jsx(FilterList, { fontSize: "small" })
})
})
}), /* @__PURE__ */ jsxs(Popover, {
anchorEl,
open: !!anchorEl,
onClose: close,
anchorOrigin: {
vertical: "bottom",
horizontal: "right"
},
transformOrigin: {
vertical: "top",
horizontal: "right"
},
slotProps: { paper: { sx: { maxWidth: "calc(100vw - 16px)" } } },
children: [/* @__PURE__ */ jsx(Box, {
sx: {
display: "flex",
flexDirection: "column",
gap: 2.5,
p: "20px 12px 16px 8px",
maxHeight: 400,
overflow: "auto"
},
children: rows.map((filter_1, index) => {
const column_1 = table.getColumn(filter_1.id);
if (!column_1 || !filter_1.filterId) return null;
const variant = column_1.columnDef.meta?.variant ?? "text";
const operators = getFilterOperators(variant);
return /* @__PURE__ */ jsxs(Box, {
sx: {
display: "flex",
alignItems: "center",
gap: 1.5
},
children: [
/* @__PURE__ */ jsx(IconButton, {
size: "small",
"aria-label": t("Layout.Table.RemoveFilter"),
sx: { flexShrink: 0 },
onClick: () => remove(filter_1.filterId),
children: /* @__PURE__ */ jsx(Close, { fontSize: "small" })
}),
/* @__PURE__ */ jsx(FormControl, {
size: "small",
sx: {
width: LOGIC_WIDTH,
flexShrink: 0,
visibility: index === 0 ? "hidden" : "visible"
},
children: /* @__PURE__ */ jsxs(Select, {
disabled: index > 1,
value: filter_1.joinOperator ?? "and",
inputProps: { "aria-label": t("Layout.Table.Operator") },
onChange: (event_0) => setFilters(rows.map((item) => ({
...item,
joinOperator: event_0.target.value
}))),
children: [/* @__PURE__ */ jsx(MenuItem, {
value: "and",
children: t("Layout.Table.And")
}), /* @__PURE__ */ jsx(MenuItem, {
value: "or",
children: t("Layout.Table.Or")
})]
})
}),
/* @__PURE__ */ jsx(Autocomplete, {
size: "small",
sx: {
width: FIELD_WIDTH,
flexShrink: 0
},
disableClearable: true,
options: filterableColumns,
value: column_1,
isOptionEqualToValue: (option, selected) => option.id === selected.id,
getOptionLabel: (option_0) => columnLabel(option_0),
onChange: (_, next_0) => update(filter_1.filterId, {
id: next_0.id,
operator: getFilterOperators(next_0.columnDef.meta?.variant ?? "text")[0],
value: ""
}),
renderInput: (params) => /* @__PURE__ */ jsx(TextField, {
...params,
size: "small",
label: t("Layout.Table.Field")
})
}),
/* @__PURE__ */ jsxs(FormControl, {
size: "small",
sx: {
width: FIELD_WIDTH,
flexShrink: 0
},
children: [/* @__PURE__ */ jsx(InputLabel, { children: t("Layout.Table.Operator") }), /* @__PURE__ */ jsx(Select, {
label: t("Layout.Table.Operator"),
value: filter_1.operator ?? operators[0],
onChange: (event_1) => update(filter_1.filterId, {
operator: event_1.target.value,
value: ""
}),
children: operators.map((operator) => /* @__PURE__ */ jsx(MenuItem, {
value: operator,
children: variant === "date" && operator in DATE_OPERATOR_LABELS ? t(DATE_OPERATOR_LABELS[operator]) : t(`Layout.Table.Operators.${operator}`)
}, operator))
})]
}),
/* @__PURE__ */ jsx(Box, {
sx: {
width: VALUE_WIDTH,
flexGrow: 1
},
children: /* @__PURE__ */ jsx(ColumnFilterField, {
column: column_1,
filter: filter_1,
onChange: (value) => update(filter_1.filterId, { value })
})
})
]
}, filter_1.filterId);
})
}), /* @__PURE__ */ jsxs(Box, {
sx: {
display: "flex",
justifyContent: "space-between",
gap: 1,
p: 1,
borderTop: 1,
borderColor: "divider"
},
children: [/* @__PURE__ */ jsx(Button, {
size: "small",
startIcon: /* @__PURE__ */ jsx(Add, {}),
onClick: add,
children: t("Layout.Table.AddFilter")
}), columnFilters.length > 0 && /* @__PURE__ */ jsx(Button, {
size: "small",
color: "inherit",
startIcon: /* @__PURE__ */ jsx(DeleteForever, {}),
onClick: () => {
placeholder.current = null;
table.resetColumnFilters(true);
},
children: t("Layout.Table.ClearFilters")
})]
})]
})] });
}
});
};
//#endregion
//#region src/components/table/table/GlobalFilter.tsx
const GlobalFilter = (t0) => {
const $ = c(57);
if ($[0] !== "fcd35c65e16f19ec02f235915ea90785448df1eaba0e2e257556e7ecf39f564f") {
for (let $i = 0; $i < 57; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
$[0] = "fcd35c65e16f19ec02f235915ea90785448df1eaba0e2e257556e7ecf39f564f";
}
const { defaultExpanded, debounce: t1 } = t0;
const debounce = t1 === void 0 ? 300 : t1;
const table = useTableContext();
const { t } = useTranslation$1();
const theme = useTheme();
const inputRef = useRef(null);
const [value, setValue] = useState(table.state.globalFilter ?? "");
const [expanded, setExpanded] = useState(!!defaultExpanded);
let t2;
let t3;
if ($[1] !== debounce || $[2] !== table || $[3] !== value) {
t2 = () => {
const id = setTimeout(() => table.setGlobalFilter(value), debounce);
return () => clearTimeout(id);
};
t3 = [
value,
debounce,
table
];
$[1] = debounce;
$[2] = table;
$[3] = value;
$[4] = t2;
$[5] = t3;
} else {
t2 = $[4];
t3 = $[5];
}
useEffect(t2, t3);
let t4;
if ($[6] === Symbol.for("react.memo_cache_sentinel")) {
t4 = () => {
setValue("");
setExpanded(false);
};
$[6] = t4;
} else t4 = $[6];
const collapse = t4;
let t5;
if ($[7] === Symbol.for("react.memo_cache_sentinel")) {
t5 = () => {
setExpanded(true);
inputRef.current?.focus();
};
$[7] = t5;
} else t5 = $[7];
const expand = t5;
useHotkey("Control+Q", expand);
let t6;
if ($[8] === Symbol.for("react.memo_cache_sentinel")) {
t6 = {
display: "grid",
alignItems: "center"
};
$[8] = t6;
} else t6 = $[8];
let t7;
if ($[9] !== t) {
t7 = shortcutLabel(t("Layout.Table.Search"), "Control+Q");
$[9] = t;
$[10] = t7;
} else t7 = $[10];
let t8;
if ($[11] !== t) {
t8 = t("Layout.Table.Search");
$[11] = t;
$[12] = t8;
} else t8 = $[12];
const t9 = expanded ? 0 : 1;
const t10 = expanded ? "none" : "auto";
let t11;
if ($[13] !== theme.transitions) {
t11 = theme.transitions.create(["opacity"]);
$[13] = theme.transitions;
$[14] = t11;
} else t11 = $[14];
let t12;
if ($[15] !== t10 || $[16] !== t11 || $[17] !== t9) {
t12 = {
gridArea: "1 / 1",
width: "min-content",
height: "min-content",
zIndex: 1,
opacity: t9,
pointerEvents: t10,
transition: t11
};
$[15] = t10;
$[16] = t11;
$[17] = t9;
$[18] = t12;
} else t12 = $[18];
let t13;
if ($[19] === Symbol.for("react.memo_cache_sentinel")) {
t13 = /* @__PURE__ */ jsx(Search, { fontSize: "small" });
$[19] = t13;
} else t13 = $[19];
let t14;
if ($[20] !== expanded || $[21] !== t12 || $[22] !== t8) {
t14 = /* @__PURE__ */ jsx(IconButton, {
size: "small",
"aria-label": t8,
"aria-disabled": expanded,
onClick: expand,
sx: t12,
children: t13
});
$[20] = expanded;
$[21] = t12;
$[22] = t8;
$[23] = t14;
} else t14 = $[23];
let t15;
if ($[24] !== t14 || $[25] !== t7) {
t15 = /* @__PURE__ */ jsx(Tooltip, {
title: t7,
children: t14
});
$[24] = t14;
$[25] = t7;
$[26] = t15;
} else t15 = $[26];
let t16;
if ($[27] !== t) {
t16 = t("Layout.Table.Search");
$[27] = t;
$[28] = t16;
} else t16 = $[28];
let t17;
let t18;
if ($[29] === Symbol.for("react.memo_cache_sentinel")) {
t17 = (event) => setValue(event.target.value);
t18 = (event_0) => event_0.key === "Escape" && collapse();
$[29] = t17;
$[30] = t18;
} else {
t17 = $[29];
t18 = $[30];
}
let t19;
if ($[31] !== defaultExpanded || $[32] !== value) {
t19 = () => !value && !defaultExpanded && setExpanded(false);
$[31] = defaultExpanded;
$[32] = value;
$[33] = t19;
} else t19 = $[33];
const t20 = expanded ? 260 : 40;
const t21 = expanded ? 1 : 0;
const t22 = expanded ? "auto" : "none";
let t23;
if ($[34] !== theme.transitions) {
t23 = theme.transitions.create(["width", "opacity"]);
$[34] = theme.transitions;
$[35] = t23;
} else t23 = $[35];
let t24;
if ($[36] !== t20 || $[37] !== t21 || $[38] !== t22 || $[39] !== t23) {
t24 = {
gridArea: "1 / 1",
overflowX: "clip",
width: t20,
opacity: t21,
pointerEvents: t22,
transition: t23
};
$[36] = t20;
$[37] = t21;
$[38] = t22;
$[39] = t23;
$[40] = t24;
} else t24 = $[40];
let t25;
if ($[41] === Symbol.for("react.memo_cache_sentinel")) {
t25 = /* @__PURE__ */ jsx(InputAdornment, {
position: "start",
children: /* @__PURE__ */ jsx(Search, { fontSize: "small" })
});
$[41] = t25;
} else t25 = $[41];
let t26;
if ($[42] !== t) {
t26 = t("Layout.Table.ClearSearch");
$[42] = t;
$[43] = t26;
} else t26 = $[43];
let t27;
let t28;
if ($[44] === Symbol.for("react.memo_cache_sentinel")) {
t27 = { mr: -.75 };
t28 = /* @__PURE__ */ jsx(Close, { fontSize: "small" });
$[44] = t27;
$[45] = t28;
} else {
t27 = $[44];
t28 = $[45];
}
let t29;
if ($[46] !== t26) {
t29 = { input: {
startAdornment: t25,
endAdornment: /* @__PURE__ */ jsx(InputAdornment, {
position: "end",
children: /* @__PURE__ */ jsx(IconButton, {
edge: "end",
size: "small",
"aria-label": t26,
onClick: collapse,
sx: t27,
children: t28
})
})
} };
$[46] = t26;
$[47] = t29;
} else t29 = $[47];
let t30;
if ($[48] !== t16 || $[49] !== t19 || $[50] !== t24 || $[51] !== t29 || $[52] !== value) {
t30 = /* @__PURE__ */ jsx(TextField, {
inputRef,
size: "small",
value,
placeholder: t16,
onChange: t17,
onKeyDown: t18,
onBlur: t19,
sx: t24,
slotProps: t29
});
$[48] = t16;
$[49] = t19;
$[50] = t24;
$[51] = t29;
$[52] = value;
$[53] = t30;
} else t30 = $[53];
let t31;
if ($[54] !== t15 || $[55] !== t30) {
t31 = /* @__PURE__ */ jsxs(Box, {
sx: t6,
children: [t15, t30]
});
$[54] = t15;
$[55] = t30;
$[56] = t31;
} else t31 = $[56];
return t31;
};
//#endregion
//#region src/components/table/table/Pagination.tsx
const ALL = -1;
const Pagination = (t0) => {
const $ = c(16);
if ($[0] !== "35f3e006007ae0e4ccbdd3e2e09ae9cbd9d16c7804126e9f3e24a96c2298d387") {
for (let $i = 0; $i < 16; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
$[0] = "35f3e006007ae0e4ccbdd3e2e09ae9cbd9d16c7804126e9f3e24a96c2298d387";
}
const { pageSizeOptions: t1, ...props } = t0;
const pageSizeOptions = t1 === void 0 ? [
10,
25,
50,
100
] : t1;
const table = useTableContext();
const { t } = useTranslation$1();
const { pageIndex, pageSize } = table.state.pagination;
const sizes = Number.isFinite(pageSize) && !pageSizeOptions.includes(pageSize) ? [...pageSizeOptions, pageSize].sort(_temp$1) : pageSizeOptions;
let t2;
if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
t2 = {
flexShrink: 0,
minHeight: 52,
borderTop: 1,
borderColor: "divider"
};
$[1] = t2;
} else t2 = $[1];
let t3;
if ($[2] !== t) {
t3 = t("Layout.Table.All");
$[2] = t;
$[3] = t3;
} else t3 = $[3];
let t4;
if ($[4] !== t3) {
t4 = {
label: t3,
value: ALL
};
$[4] = t3;
$[5] = t4;
} else t4 = $[5];
let t5;
if ($[6] !== sizes || $[7] !== t4) {
t5 = [...sizes, t4];
$[6] = sizes;
$[7] = t4;
$[8] = t5;
} else t5 = $[8];
let t6;
if ($[9] !== table) {
t6 = table.getRowCount();
$[9] = table;
$[10] = t6;
} else t6 = $[10];
let t7;
if ($[11] !== pageSize) {
t7 = Number.isFinite(pageSize) ? pageSize : ALL;
$[11] = pageSize;
$[12] = t7;
} else t7 = $[12];
let t8;
let t9;
if ($[13] !== table) {
t8 = (_, page) => table.setPageIndex(page);
t9 = (event) => {
const next = Number(event.target.value);
table.setPageSize(next === ALL ? Infinity : next);
table.setPageIndex(0);
};
$[13] = table;
$[14] = t8;
$[15] = t9;
} else {
t8 = $[14];
t9 = $[15];
}
return /* @__PURE__ */ jsx(TablePagination, {
component: "div",
showFirstButton: true,
showLastButton: true,
...props,
sx: [t2, ...Array.isArray(props.sx) ? props.sx : [props.sx]],
rowsPerPageOptions: t5,
count: t6,
page: pageIndex,
rowsPerPage: t7,
onPageChange: t8,
onRowsPerPageChange: t9
});
};
function _temp$1(a, b) {
return a - b;
}
//#endregion
//#region src/components/table/table/Skeleton.tsx
const Skeleton$1 = (t0) => {
const $ = c(10);
if ($[0] !== "00bef53ed4714d4f0462a8803449e9eebc94975bf5c6ef2c15a2dac40876f4db") {
for (let $i = 0; $i < 10; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
$[0] = "00bef53ed4714d4f0462a8803449e9eebc94975bf5c6ef2c15a2dac40876f4db";
}
const { rowHeight } = t0;
const table = useTableContext();
const firstRow = useRef(null);
let t1;
if ($[1] !== table.state.pagination.pageSize) {
t1 = () => Math.min(table.state.pagination.pageSize, 20);
$[1] = table.state.pagination.pageSize;
$[2] = t1;
} else t1 = $[2];
const [rowCount, setRowCount] = useState(t1);
let t2;
let t3;
if ($[3] !== rowHeight) {
t2 = () => {
const container = firstRow.current?.closest(".MuiTableContainer-root");
if (!container) return;
const measure = () => {
const spent = ["thead", "tfoot"].reduce((total, selector) => total + (container.querySelector(selector)?.getBoundingClientRect().height ?? 0), 0);
setRowCount(Math.max(1, Math.floor((container.clientHeight - spent) / rowHeight)));
};
measure();
const observer = new ResizeObserver(measure);
observer.observe(container);
return () => observer.disconnect();
};
t3 = [rowHeight];
$[3] = rowHeight;
$[4] = t2;
$[5] = t3;
} else {
t2 = $[4];
t3 = $[5];
}
useEffect(t2, t3);
let t4;
if ($[6] !== rowCount || $[7] !== rowHeight || $[8] !== table) {
t4 = /* @__PURE__ */ jsx(Fragment$1, { children: Array.from({ length: rowCount }, (_, index) => /* @__PURE__ */ jsxs(TableRow, {
ref: index === 0 ? firstRow : void 0,
sx: { height: rowHeight },
children: [table.getVisibleLeafColumns().map(_temp), /* @__PURE__ */ jsx(TableCell, {
"aria-hidden": true,
sx: { p: 0 }
})]
}, index)) });
$[6] = rowCount;
$[7] = rowHeight;
$[8] = table;
$[9] = t4;
} else t4 = $[9];
return t4;
};
function _temp(column) {
return hasColumnLabel(column) ? /* @__PURE__ */ jsx(TableCell, {
sx: {
py: 0,
px: "10px"
},
children: /* @__PURE__ */ jsx(Skeleton, { variant: "text" })
}, column.id) : /* @__PURE__ */ jsx(TableCell, {
align: "center",
sx: {
px: .5,
py: 0
},
children: /* @__PURE__ */ jsx(Skeleton, {
variant: "circular",
width: 22,
height: 22,
sx: { mx: "auto" }
})
}, column.id);
}
//#endregion
//#region src/components/table/table/Toolbar.tsx
/** Vertical rule with the MUI X toolbar proportions: half height, 4px gutters. */
const ToolbarDivider = () => {
const $ = c(2);
if ($[0] !== "f0b66427050989a7d55e85e65bda2cbd8971c5fb24eadc65102729994051490d") {
for (let $i = 0; $i < 2; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
$[0] = "f0b66427050989a7d55e85e65bda2cbd8971c5fb24eadc65102729994051490d";
}
let t0;
if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
t0 = /* @__PURE__ */ jsx(Divider, {
orientation: "vertical",
sx: {
height: "50%",
alignSelf: "center",
mx: .5
}
});
$[1] = t0;
} else t0 = $[1];
return t0;
};
const Toolbar$1 = (t0) => {
const $ = c(29);
if ($[0] !== "f0b66427050989a7d55e85e65bda2cbd8971c5fb24eadc65102729994051490d") {
for (let $i = 0; $i < 29; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
$[0] = "f0b66427050989a7d55e85e65bda2cbd8971c5fb24eadc65102729994051490d";
}
const { title, actions, disableColumnFilter, disableColumnSelector, disableSearch } = t0;
const table = useTableContext();
const { t } = useTranslation$1();
let t1;
if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
t1 = {
flexShrink: 0,
display: "flex",
alignItems: "center",
justifyContent: "end",
minHeight: 52,
gap: .25,
p: .75,
boxSizing: "border-box",
borderBottom: 1,
borderColor: "divider"
};
$[1] = t1;
} else t1 = $[1];
let t2;
if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
t2 = {
flex: 1,
minWidth: 0,
display: "flex",
alignItems: "center",
gap: 1,
mx: .5
};
$[2] = t2;
} else t2 = $[2];
let t3;
if ($[3] !== title) {
t3 = title && /* @__PURE__ */ jsx(Typography, {
variant: "body1",
noWrap: true,
sx: { fontWeight: "medium" },
children: title
});
$[3] = title;
$[4] = t3;
} else t3 = $[4];
let t4;
if ($[5] !== t || $[6] !== table) {
t4 = () => {
const count = table.getSelectedRowIds().length;
if (!count) return null;
return /* @__PURE__ */ jsx(Typography, {
variant: "body2",
noWrap: true,
color: "primary",
children: t("Layout.Table.SelectedCount", { count })
});
};
$[5] = t;
$[6] = table;
$[7] = t4;
} else t4 = $[7];
let t5;
if ($[8] !== t4 || $[9] !== table.atoms.rowSelection) {
t5 = /* @__PURE__ */ jsx(Subscribe, {
source: table.atoms.rowSelection,
children: t4
});
$[8] = t4;
$[9] = table.atoms.rowSelection;
$[10] = t5;
} else t5 = $[10];
let t6;
if ($[11] !== t3 || $[12] !== t5) {
t6 = /* @__PURE__ */ jsxs(Box, {
sx: t2,
children: [t3, t5]
});
$[11] = t3;
$[12] = t5;
$[13] = t6;
} else t6 = $[13];
let t7;
if ($[14] !== actions) {
t7 = actions && /* @__PURE__ */ jsx(ToolbarDivider, {});
$[14] = actions;
$[15] = t7;
} else t7 = $[15];
let t8;
if ($[16] !== disableColumnSelector) {
t8 = !disableColumnSelector && /* @__PURE__ */ jsx(ColumnsPanel, {});
$[16] = disableColumnSelector;
$[17] = t8;
} else t8 = $[17];
let t9;
if ($[18] !== disableColumnFilter) {
t9 = !disableColumnFilter && /* @__PURE__ */ jsx(FiltersMenu, {});
$[18] = disableColumnFilter;
$[19] = t9;
} else t9 = $[19];
let t10;
if ($[20] !== disableSearch) {
t10 = !disableSearch && /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(ToolbarDivider, {}), /* @__PURE__ */ jsx(GlobalFilter, {})] });
$[20] = disableSearch;
$[21] = t10;
} else t10 = $[21];
let t11;
if ($[22] !== actions || $[23] !== t10 || $[24] !== t6 || $[25] !== t7 || $[26] !== t8 || $[27] !== t9) {
t11 = /* @__PURE__ */ jsxs(Box, {
role: "toolbar",
"aria-orientation": "horizontal",
sx: t1,
children: [
t6,
actions,
t7,
t8,
t9,
t10
]
});
$[22] = actions;
$[23] = t10;
$[24] = t6;
$[25] = t7;
$[26] = t8;
$[27] = t9;
$[28] = t11;
} else t11 = $[28];
return t11;
};
//#endregion
//#region src/hooks/useLayoutTable.tsx
const { appFeatures, createAppColumnHelper: createLayoutColumnHelper, useAppTable: useLayoutTable } = createTableHook({
features: layoutTableFeatures,
tableContext,
cellContext,
headerContext,
getRowId: (row) => row.id,
defaultColumn: {
filterFn: dynamicFilterFn,
aggregatedCell: () => /* @__PURE__ */ jsx(AggregatedCell, {})
},
globalFilterFn,
columnResizeMode: "onChange",
isMultiSortEvent: (e) => {
const { ctrlKey, metaKey, shiftKey } = e;
return ctrlKey || metaKey || shiftKey;
},
tableComponents: {
ColumnsPanel,
FiltersMenu,
GlobalFilter,
Pagination,
Skeleton: Skeleton$1,
Toolbar: Toolbar$1
},
cellComponents: {
ActionsCell,
AggregatedCell,
BooleanCell,
DateCell,
DateTimeCell,
ExpandCell,
GroupCell,
NumberCell,
PinRowCell,
SelectCell,
ValueCell
},
headerComponents: {
AggregationFooter,
ExpandAllCell,
HeaderMenu,
HeaderResizeHandle,
HeaderSortLabel,
SelectAllCell
}
});
//#endregion
export { createLayoutColumnHelper, layoutTableFeatures, useCellContext, useDialogs, useFieldContext, useFormContext, useHeaderContext, useInView, useLayoutForm, useLayoutTable, useScanDetection, useTableContext, useTranslation, withLayoutForm };
//# sourceMappingURL=hooks.mjs.map