wcz-test 2.14.0 → 3.1.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.d.ts +25 -12
- package/dist/index.js +317 -250
- package/dist/index.js.map +1 -1
- package/package.json +9 -5
package/dist/index.js
CHANGED
|
@@ -42,7 +42,7 @@ var require_react_is_production_min = __commonJS({
|
|
|
42
42
|
var p = b ? Symbol.for("react.suspense") : 60113;
|
|
43
43
|
var q = b ? Symbol.for("react.suspense_list") : 60120;
|
|
44
44
|
var r = b ? Symbol.for("react.memo") : 60115;
|
|
45
|
-
var
|
|
45
|
+
var t2 = b ? Symbol.for("react.lazy") : 60116;
|
|
46
46
|
var v = b ? Symbol.for("react.block") : 60121;
|
|
47
47
|
var w = b ? Symbol.for("react.fundamental") : 60117;
|
|
48
48
|
var x = b ? Symbol.for("react.responder") : 60118;
|
|
@@ -64,7 +64,7 @@ var require_react_is_production_min = __commonJS({
|
|
|
64
64
|
switch (a = a && a.$$typeof, a) {
|
|
65
65
|
case k:
|
|
66
66
|
case n:
|
|
67
|
-
case
|
|
67
|
+
case t2:
|
|
68
68
|
case r:
|
|
69
69
|
case h:
|
|
70
70
|
return a;
|
|
@@ -87,7 +87,7 @@ var require_react_is_production_min = __commonJS({
|
|
|
87
87
|
exports.Element = c;
|
|
88
88
|
exports.ForwardRef = n;
|
|
89
89
|
exports.Fragment = e;
|
|
90
|
-
exports.Lazy =
|
|
90
|
+
exports.Lazy = t2;
|
|
91
91
|
exports.Memo = r;
|
|
92
92
|
exports.Portal = d;
|
|
93
93
|
exports.Profiler = g;
|
|
@@ -113,7 +113,7 @@ var require_react_is_production_min = __commonJS({
|
|
|
113
113
|
return z2(a) === e;
|
|
114
114
|
};
|
|
115
115
|
exports.isLazy = function(a) {
|
|
116
|
-
return z2(a) ===
|
|
116
|
+
return z2(a) === t2;
|
|
117
117
|
};
|
|
118
118
|
exports.isMemo = function(a) {
|
|
119
119
|
return z2(a) === r;
|
|
@@ -131,7 +131,7 @@ var require_react_is_production_min = __commonJS({
|
|
|
131
131
|
return z2(a) === p;
|
|
132
132
|
};
|
|
133
133
|
exports.isValidElementType = function(a) {
|
|
134
|
-
return "string" === typeof a || "function" === typeof a || a === e || a === m || a === g || a === f || a === p || a === q || "object" === typeof a && null !== a && (a.$$typeof ===
|
|
134
|
+
return "string" === typeof a || "function" === typeof a || a === e || a === m || a === g || a === f || a === p || a === q || "object" === typeof a && null !== a && (a.$$typeof === t2 || a.$$typeof === r || a.$$typeof === h || a.$$typeof === k || a.$$typeof === n || a.$$typeof === w || a.$$typeof === x || a.$$typeof === y || a.$$typeof === v);
|
|
135
135
|
};
|
|
136
136
|
exports.typeOf = z2;
|
|
137
137
|
}
|
|
@@ -1063,9 +1063,45 @@ var PageContainer = (props) => {
|
|
|
1063
1063
|
);
|
|
1064
1064
|
};
|
|
1065
1065
|
|
|
1066
|
+
// src/components/file/Dropzone.tsx
|
|
1067
|
+
import CloudUpload from "@mui/icons-material/CloudUpload";
|
|
1068
|
+
import { Paper, Typography as Typography2, useTheme } from "@mui/material";
|
|
1069
|
+
import { useDropzone } from "react-dropzone";
|
|
1070
|
+
import { useTranslation } from "react-i18next";
|
|
1071
|
+
import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
1072
|
+
var baseStyle = {
|
|
1073
|
+
flex: 1,
|
|
1074
|
+
display: "flex",
|
|
1075
|
+
flexDirection: "column",
|
|
1076
|
+
alignItems: "center",
|
|
1077
|
+
padding: "20px",
|
|
1078
|
+
borderWidth: 2,
|
|
1079
|
+
borderRadius: 2,
|
|
1080
|
+
borderStyle: "dashed",
|
|
1081
|
+
outline: "none",
|
|
1082
|
+
transition: "border .24s ease-in-out",
|
|
1083
|
+
cursor: "pointer"
|
|
1084
|
+
};
|
|
1085
|
+
var Dropzone = ({ sx, ...props }) => {
|
|
1086
|
+
const { getRootProps, getInputProps, isFocused, isDragAccept, isDragReject } = useDropzone(props);
|
|
1087
|
+
const { t: t2 } = useTranslation();
|
|
1088
|
+
const theme = useTheme();
|
|
1089
|
+
const style = {
|
|
1090
|
+
...baseStyle,
|
|
1091
|
+
...isFocused ? { borderColor: theme.palette.primary.main } : {},
|
|
1092
|
+
...isDragAccept ? { borderColor: theme.palette.success.main } : {},
|
|
1093
|
+
...isDragReject ? { borderColor: theme.palette.error.main } : {}
|
|
1094
|
+
};
|
|
1095
|
+
return /* @__PURE__ */ jsxs2(Paper, { variant: "outlined", ...getRootProps({ style }), sx, children: [
|
|
1096
|
+
/* @__PURE__ */ jsx3("input", { ...getInputProps(), style: { display: "none" } }),
|
|
1097
|
+
/* @__PURE__ */ jsx3(CloudUpload, {}),
|
|
1098
|
+
/* @__PURE__ */ jsx3(Typography2, { children: t2("Layout.File.DragSomeFilesHereOrClickToSelectThem") })
|
|
1099
|
+
] });
|
|
1100
|
+
};
|
|
1101
|
+
|
|
1066
1102
|
// src/components/data-grid/ChipInputCell.tsx
|
|
1067
1103
|
import { Chip, Stack as Stack2 } from "@mui/material";
|
|
1068
|
-
import { jsx as
|
|
1104
|
+
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
1069
1105
|
var isArray = (value) => Array.isArray(value);
|
|
1070
1106
|
var ChipInputCell = ({ params, slotProps, getLabel }) => {
|
|
1071
1107
|
if (!params.value) return null;
|
|
@@ -1074,107 +1110,107 @@ var ChipInputCell = ({ params, slotProps, getLabel }) => {
|
|
|
1074
1110
|
return value;
|
|
1075
1111
|
};
|
|
1076
1112
|
if (isArray(params.value))
|
|
1077
|
-
return /* @__PURE__ */
|
|
1078
|
-
(value, index) => /* @__PURE__ */
|
|
1113
|
+
return /* @__PURE__ */ jsx4(Stack2, { direction: "row", alignItems: "center", gap: 1, sx: { overflowX: "auto", height: "100%", width: params.colDef.computedWidth }, children: params.value.map(
|
|
1114
|
+
(value, index) => /* @__PURE__ */ jsx4(Chip, { label: getLabelValue(value), ...slotProps }, `${index + 1}-chip-input-cell`)
|
|
1079
1115
|
) });
|
|
1080
|
-
return /* @__PURE__ */
|
|
1116
|
+
return /* @__PURE__ */ jsx4(Chip, { label: getLabelValue(params.value), ...slotProps });
|
|
1081
1117
|
};
|
|
1082
1118
|
|
|
1083
1119
|
// src/components/data-grid/EditableColumnHeader.tsx
|
|
1084
|
-
import
|
|
1085
|
-
import { jsx as
|
|
1120
|
+
import Edit from "@mui/icons-material/Edit";
|
|
1121
|
+
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
1086
1122
|
var EditableColumnHeader = ({ colDef }) => {
|
|
1087
|
-
return /* @__PURE__ */
|
|
1123
|
+
return /* @__PURE__ */ jsx5(TypographyWithIcon, { endIcon: /* @__PURE__ */ jsx5(Edit, { color: "disabled", fontSize: "small" }), variant: "body2", className: "MuiDataGrid-columnHeaderTitle", children: colDef.headerName });
|
|
1088
1124
|
};
|
|
1089
1125
|
|
|
1090
1126
|
// src/components/router/RouterButton.tsx
|
|
1091
1127
|
import { Button } from "@mui/material";
|
|
1092
1128
|
import { createLink } from "@tanstack/react-router";
|
|
1093
1129
|
import React from "react";
|
|
1094
|
-
import { jsx as
|
|
1130
|
+
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
1095
1131
|
var Component = React.forwardRef(function ButtonComponent(props, reference) {
|
|
1096
|
-
return /* @__PURE__ */
|
|
1132
|
+
return /* @__PURE__ */ jsx6(Button, { ref: reference, component: "a", ...props });
|
|
1097
1133
|
});
|
|
1098
1134
|
var CreatedComponent = createLink(Component);
|
|
1099
1135
|
var RouterButton = (props) => {
|
|
1100
|
-
return /* @__PURE__ */
|
|
1136
|
+
return /* @__PURE__ */ jsx6(CreatedComponent, { preload: "intent", ...props });
|
|
1101
1137
|
};
|
|
1102
1138
|
|
|
1103
1139
|
// src/components/router/RouterGridActionsCellItem.tsx
|
|
1104
1140
|
import { GridActionsCellItem } from "@mui/x-data-grid-premium";
|
|
1105
1141
|
import { createLink as createLink2 } from "@tanstack/react-router";
|
|
1106
1142
|
import React2 from "react";
|
|
1107
|
-
import { jsx as
|
|
1143
|
+
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
1108
1144
|
var Component2 = React2.forwardRef(
|
|
1109
1145
|
function GridActionsCellItemComponent(props, reference) {
|
|
1110
|
-
return /* @__PURE__ */
|
|
1146
|
+
return /* @__PURE__ */ jsx7(GridActionsCellItem, { ref: reference, component: "a", ...props });
|
|
1111
1147
|
}
|
|
1112
1148
|
);
|
|
1113
1149
|
var CreatedComponent2 = createLink2(Component2);
|
|
1114
1150
|
var RouterGridActionsCellItem = (props) => {
|
|
1115
|
-
return /* @__PURE__ */
|
|
1151
|
+
return /* @__PURE__ */ jsx7(CreatedComponent2, { preload: "intent", ...props });
|
|
1116
1152
|
};
|
|
1117
1153
|
|
|
1118
1154
|
// src/components/router/RouterIconButton.tsx
|
|
1119
1155
|
import { IconButton } from "@mui/material";
|
|
1120
1156
|
import { createLink as createLink3 } from "@tanstack/react-router";
|
|
1121
1157
|
import React3 from "react";
|
|
1122
|
-
import { jsx as
|
|
1158
|
+
import { jsx as jsx8 } from "react/jsx-runtime";
|
|
1123
1159
|
var Component3 = React3.forwardRef(function IconButtonComponent(props, reference) {
|
|
1124
|
-
return /* @__PURE__ */
|
|
1160
|
+
return /* @__PURE__ */ jsx8(IconButton, { ref: reference, component: "a", ...props });
|
|
1125
1161
|
});
|
|
1126
1162
|
var CreatedComponent3 = createLink3(Component3);
|
|
1127
1163
|
var RouterIconButton = (props) => {
|
|
1128
|
-
return /* @__PURE__ */
|
|
1164
|
+
return /* @__PURE__ */ jsx8(CreatedComponent3, { preload: "intent", ...props });
|
|
1129
1165
|
};
|
|
1130
1166
|
|
|
1131
1167
|
// src/components/router/RouterLink.tsx
|
|
1132
1168
|
import { Link } from "@mui/material";
|
|
1133
1169
|
import { createLink as createLink4 } from "@tanstack/react-router";
|
|
1134
1170
|
import React4 from "react";
|
|
1135
|
-
import { jsx as
|
|
1171
|
+
import { jsx as jsx9 } from "react/jsx-runtime";
|
|
1136
1172
|
var Component4 = React4.forwardRef(function LinkComponent(props, reference) {
|
|
1137
|
-
return /* @__PURE__ */
|
|
1173
|
+
return /* @__PURE__ */ jsx9(Link, { ref: reference, ...props });
|
|
1138
1174
|
});
|
|
1139
1175
|
var CreatedComponent4 = createLink4(Component4);
|
|
1140
1176
|
var RouterLink = (props) => {
|
|
1141
|
-
return /* @__PURE__ */
|
|
1177
|
+
return /* @__PURE__ */ jsx9(CreatedComponent4, { preload: "intent", ...props });
|
|
1142
1178
|
};
|
|
1143
1179
|
|
|
1144
1180
|
// src/components/router/RouterTab.tsx
|
|
1145
1181
|
import { Tab } from "@mui/material";
|
|
1146
1182
|
import { createLink as createLink5 } from "@tanstack/react-router";
|
|
1147
1183
|
import React5 from "react";
|
|
1148
|
-
import { jsx as
|
|
1184
|
+
import { jsx as jsx10 } from "react/jsx-runtime";
|
|
1149
1185
|
var Component5 = React5.forwardRef(function TabComponent(props, reference) {
|
|
1150
|
-
return /* @__PURE__ */
|
|
1186
|
+
return /* @__PURE__ */ jsx10(Tab, { ref: reference, component: "a", ...props });
|
|
1151
1187
|
});
|
|
1152
1188
|
var CreatedComponent5 = createLink5(Component5);
|
|
1153
1189
|
var RouterTab = (props) => {
|
|
1154
|
-
return /* @__PURE__ */
|
|
1190
|
+
return /* @__PURE__ */ jsx10(CreatedComponent5, { preload: "intent", ...props });
|
|
1155
1191
|
};
|
|
1156
1192
|
|
|
1157
1193
|
// src/components/router/RouterNotFound.tsx
|
|
1158
|
-
import { Box, Divider, Typography as
|
|
1159
|
-
import { useTranslation } from "react-i18next";
|
|
1160
|
-
import { jsx as
|
|
1194
|
+
import { Box, Divider, Typography as Typography3 } from "@mui/material";
|
|
1195
|
+
import { useTranslation as useTranslation2 } from "react-i18next";
|
|
1196
|
+
import { jsx as jsx11, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
1161
1197
|
function RouterNotFound() {
|
|
1162
|
-
const { t } =
|
|
1163
|
-
return /* @__PURE__ */
|
|
1164
|
-
/* @__PURE__ */
|
|
1165
|
-
/* @__PURE__ */
|
|
1166
|
-
/* @__PURE__ */
|
|
1198
|
+
const { t: t2 } = useTranslation2();
|
|
1199
|
+
return /* @__PURE__ */ jsx11(Box, { height: "100vh", display: "flex", flexDirection: "column", alignItems: "center", justifyContent: "center", textAlign: "center", px: 2, children: /* @__PURE__ */ jsxs3(Box, { display: "flex", alignItems: "center", mb: 4, children: [
|
|
1200
|
+
/* @__PURE__ */ jsx11(Typography3, { variant: "h3", component: "span", fontWeight: 500, sx: { lineHeight: 1 }, children: "404" }),
|
|
1201
|
+
/* @__PURE__ */ jsx11(Divider, { orientation: "vertical", flexItem: true, sx: { mx: 3 } }),
|
|
1202
|
+
/* @__PURE__ */ jsx11(Typography3, { variant: "h5", component: "span", children: t2("Layout.ThisPageCouldNotBeFound") })
|
|
1167
1203
|
] }) });
|
|
1168
1204
|
}
|
|
1169
1205
|
|
|
1170
1206
|
// src/components/router/RouterError.tsx
|
|
1171
|
-
import { Box as Box2, Divider as Divider2, Typography as
|
|
1172
|
-
import { jsx as
|
|
1207
|
+
import { Box as Box2, Divider as Divider2, Typography as Typography4 } from "@mui/material";
|
|
1208
|
+
import { jsx as jsx12, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
1173
1209
|
var RouterError = ({ error }) => {
|
|
1174
|
-
return /* @__PURE__ */
|
|
1175
|
-
/* @__PURE__ */
|
|
1176
|
-
/* @__PURE__ */
|
|
1177
|
-
/* @__PURE__ */
|
|
1210
|
+
return /* @__PURE__ */ jsx12(Box2, { height: "100vh", display: "flex", flexDirection: "column", alignItems: "center", justifyContent: "center", textAlign: "center", px: 2, children: /* @__PURE__ */ jsxs4(Box2, { display: "flex", alignItems: "center", mb: 4, children: [
|
|
1211
|
+
/* @__PURE__ */ jsx12(Typography4, { variant: "h3", component: "span", fontWeight: 500, sx: { lineHeight: 1 }, children: error.name || "500" }),
|
|
1212
|
+
/* @__PURE__ */ jsx12(Divider2, { orientation: "vertical", flexItem: true, sx: { mx: 3 } }),
|
|
1213
|
+
/* @__PURE__ */ jsx12(Typography4, { variant: "h5", component: "span", children: error.message })
|
|
1178
1214
|
] }) });
|
|
1179
1215
|
};
|
|
1180
1216
|
|
|
@@ -1185,8 +1221,8 @@ import { LinearProgress, useMediaQuery } from "@mui/material";
|
|
|
1185
1221
|
function _extends() {
|
|
1186
1222
|
return _extends = Object.assign ? Object.assign.bind() : function(n) {
|
|
1187
1223
|
for (var e = 1; e < arguments.length; e++) {
|
|
1188
|
-
var
|
|
1189
|
-
for (var r in
|
|
1224
|
+
var t2 = arguments[e];
|
|
1225
|
+
for (var r in t2) ({}).hasOwnProperty.call(t2, r) && (n[r] = t2[r]);
|
|
1190
1226
|
}
|
|
1191
1227
|
return n;
|
|
1192
1228
|
}, _extends.apply(null, arguments);
|
|
@@ -1195,12 +1231,12 @@ function _extends() {
|
|
|
1195
1231
|
// node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js
|
|
1196
1232
|
function _objectWithoutPropertiesLoose(r, e) {
|
|
1197
1233
|
if (null == r) return {};
|
|
1198
|
-
var
|
|
1234
|
+
var t2 = {};
|
|
1199
1235
|
for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
|
|
1200
1236
|
if (-1 !== e.indexOf(n)) continue;
|
|
1201
|
-
|
|
1237
|
+
t2[n] = r[n];
|
|
1202
1238
|
}
|
|
1203
|
-
return
|
|
1239
|
+
return t2;
|
|
1204
1240
|
}
|
|
1205
1241
|
|
|
1206
1242
|
// node_modules/@mui/x-date-pickers/esm/LocalizationProvider/LocalizationProvider.js
|
|
@@ -1209,17 +1245,18 @@ import * as React6 from "react";
|
|
|
1209
1245
|
import { useThemeProps } from "@mui/material/styles";
|
|
1210
1246
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
1211
1247
|
var _excluded = ["localeText"];
|
|
1212
|
-
var
|
|
1213
|
-
if (process.env.NODE_ENV !== "production")
|
|
1248
|
+
var PickerAdapterContext = /* @__PURE__ */ React6.createContext(null);
|
|
1249
|
+
if (process.env.NODE_ENV !== "production") PickerAdapterContext.displayName = "PickerAdapterContext";
|
|
1214
1250
|
var LocalizationProvider = function LocalizationProvider2(inProps) {
|
|
1215
1251
|
const {
|
|
1216
1252
|
localeText: inLocaleText
|
|
1217
1253
|
} = inProps, otherInProps = _objectWithoutPropertiesLoose(inProps, _excluded);
|
|
1218
1254
|
const {
|
|
1219
|
-
|
|
1255
|
+
adapter: parentAdapter,
|
|
1220
1256
|
localeText: parentLocaleText
|
|
1221
|
-
} = React6.useContext(
|
|
1257
|
+
} = React6.useContext(PickerAdapterContext) ?? {
|
|
1222
1258
|
utils: void 0,
|
|
1259
|
+
adapter: void 0,
|
|
1223
1260
|
localeText: void 0
|
|
1224
1261
|
};
|
|
1225
1262
|
const props = useThemeProps({
|
|
@@ -1237,41 +1274,42 @@ var LocalizationProvider = function LocalizationProvider2(inProps) {
|
|
|
1237
1274
|
localeText: themeLocaleText
|
|
1238
1275
|
} = props;
|
|
1239
1276
|
const localeText = React6.useMemo(() => _extends({}, themeLocaleText, parentLocaleText, inLocaleText), [themeLocaleText, parentLocaleText, inLocaleText]);
|
|
1240
|
-
const
|
|
1277
|
+
const adapter = React6.useMemo(() => {
|
|
1241
1278
|
if (!DateAdapter) {
|
|
1242
|
-
if (
|
|
1243
|
-
return
|
|
1279
|
+
if (parentAdapter) {
|
|
1280
|
+
return parentAdapter;
|
|
1244
1281
|
}
|
|
1245
1282
|
return null;
|
|
1246
1283
|
}
|
|
1247
|
-
const
|
|
1284
|
+
const dateAdapter = new DateAdapter({
|
|
1248
1285
|
locale: adapterLocale,
|
|
1249
1286
|
formats: dateFormats,
|
|
1250
1287
|
instance: dateLibInstance
|
|
1251
1288
|
});
|
|
1252
|
-
if (!
|
|
1289
|
+
if (!dateAdapter.isMUIAdapter) {
|
|
1253
1290
|
throw new Error(["MUI X: The date adapter should be imported from `@mui/x-date-pickers` or `@mui/x-date-pickers-pro`, not from `@date-io`", "For example, `import { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs'` instead of `import AdapterDayjs from '@date-io/dayjs'`", "More information on the installation documentation: https://mui.com/x/react-date-pickers/quickstart/#installation"].join(`
|
|
1254
1291
|
`));
|
|
1255
1292
|
}
|
|
1256
|
-
return
|
|
1257
|
-
}, [DateAdapter, adapterLocale, dateFormats, dateLibInstance,
|
|
1293
|
+
return dateAdapter;
|
|
1294
|
+
}, [DateAdapter, adapterLocale, dateFormats, dateLibInstance, parentAdapter]);
|
|
1258
1295
|
const defaultDates = React6.useMemo(() => {
|
|
1259
|
-
if (!
|
|
1296
|
+
if (!adapter) {
|
|
1260
1297
|
return null;
|
|
1261
1298
|
}
|
|
1262
1299
|
return {
|
|
1263
|
-
minDate:
|
|
1264
|
-
maxDate:
|
|
1300
|
+
minDate: adapter.date("1900-01-01T00:00:00.000"),
|
|
1301
|
+
maxDate: adapter.date("2099-12-31T00:00:00.000")
|
|
1265
1302
|
};
|
|
1266
|
-
}, [
|
|
1303
|
+
}, [adapter]);
|
|
1267
1304
|
const contextValue = React6.useMemo(() => {
|
|
1268
1305
|
return {
|
|
1269
|
-
utils,
|
|
1306
|
+
utils: adapter,
|
|
1307
|
+
adapter,
|
|
1270
1308
|
defaultDates,
|
|
1271
1309
|
localeText
|
|
1272
1310
|
};
|
|
1273
|
-
}, [defaultDates,
|
|
1274
|
-
return /* @__PURE__ */ _jsx(
|
|
1311
|
+
}, [defaultDates, adapter, localeText]);
|
|
1312
|
+
return /* @__PURE__ */ _jsx(PickerAdapterContext.Provider, {
|
|
1275
1313
|
value: contextValue,
|
|
1276
1314
|
children
|
|
1277
1315
|
});
|
|
@@ -1349,16 +1387,16 @@ function warnOnce(message, gravity = "warning") {
|
|
|
1349
1387
|
}
|
|
1350
1388
|
|
|
1351
1389
|
// node_modules/@mui/x-date-pickers/esm/AdapterDayjs/AdapterDayjs.js
|
|
1352
|
-
import
|
|
1390
|
+
import dayjs from "dayjs";
|
|
1353
1391
|
import weekOfYearPlugin from "dayjs/plugin/weekOfYear.js";
|
|
1354
1392
|
import customParseFormatPlugin from "dayjs/plugin/customParseFormat.js";
|
|
1355
1393
|
import localizedFormatPlugin from "dayjs/plugin/localizedFormat.js";
|
|
1356
1394
|
import isBetweenPlugin from "dayjs/plugin/isBetween.js";
|
|
1357
1395
|
import advancedFormatPlugin from "dayjs/plugin/advancedFormat.js";
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1396
|
+
dayjs.extend(localizedFormatPlugin);
|
|
1397
|
+
dayjs.extend(weekOfYearPlugin);
|
|
1398
|
+
dayjs.extend(isBetweenPlugin);
|
|
1399
|
+
dayjs.extend(advancedFormatPlugin);
|
|
1362
1400
|
var formatTokenMap = {
|
|
1363
1401
|
// Year
|
|
1364
1402
|
YY: "year",
|
|
@@ -1467,7 +1505,6 @@ var defaultFormats = {
|
|
|
1467
1505
|
};
|
|
1468
1506
|
var MISSING_UTC_PLUGIN = ["Missing UTC plugin", "To be able to use UTC or timezones, you have to enable the `utc` plugin", "Find more information on https://mui.com/x/react-date-pickers/timezone/#day-js-and-utc"].join("\n");
|
|
1469
1507
|
var MISSING_TIMEZONE_PLUGIN = ["Missing timezone plugin", "To be able to use timezones, you have to enable both the `utc` and the `timezone` plugin", "Find more information on https://mui.com/x/react-date-pickers/timezone/#day-js-and-timezone"].join("\n");
|
|
1470
|
-
var withLocale = (dayjs3, locale) => !locale ? dayjs3 : (...args) => dayjs3(...args).locale(locale);
|
|
1471
1508
|
var AdapterDayjs = class {
|
|
1472
1509
|
constructor({
|
|
1473
1510
|
locale: _locale,
|
|
@@ -1476,7 +1513,6 @@ var AdapterDayjs = class {
|
|
|
1476
1513
|
this.isMUIAdapter = true;
|
|
1477
1514
|
this.isTimezoneCompatible = true;
|
|
1478
1515
|
this.lib = "dayjs";
|
|
1479
|
-
this.dayjs = void 0;
|
|
1480
1516
|
this.locale = void 0;
|
|
1481
1517
|
this.formats = void 0;
|
|
1482
1518
|
this.escapedCharacters = {
|
|
@@ -1491,8 +1527,8 @@ var AdapterDayjs = class {
|
|
|
1491
1527
|
}
|
|
1492
1528
|
return value.locale(expectedLocale);
|
|
1493
1529
|
};
|
|
1494
|
-
this.hasUTCPlugin = () => typeof
|
|
1495
|
-
this.hasTimezonePlugin = () => typeof
|
|
1530
|
+
this.hasUTCPlugin = () => typeof dayjs.utc !== "undefined";
|
|
1531
|
+
this.hasTimezonePlugin = () => typeof dayjs.tz !== "undefined";
|
|
1496
1532
|
this.isSame = (value, comparing, comparisonTemplate) => {
|
|
1497
1533
|
const comparingInValueTimezone = this.setTimezone(comparing, this.getTimezone(value));
|
|
1498
1534
|
return value.format(comparisonTemplate) === comparingInValueTimezone.format(comparisonTemplate);
|
|
@@ -1503,7 +1539,7 @@ var AdapterDayjs = class {
|
|
|
1503
1539
|
return void 0;
|
|
1504
1540
|
}
|
|
1505
1541
|
case "system": {
|
|
1506
|
-
return
|
|
1542
|
+
return dayjs.tz.guess();
|
|
1507
1543
|
}
|
|
1508
1544
|
default: {
|
|
1509
1545
|
return timezone;
|
|
@@ -1511,20 +1547,24 @@ var AdapterDayjs = class {
|
|
|
1511
1547
|
}
|
|
1512
1548
|
};
|
|
1513
1549
|
this.createSystemDate = (value) => {
|
|
1550
|
+
let date;
|
|
1514
1551
|
if (this.hasUTCPlugin() && this.hasTimezonePlugin()) {
|
|
1515
|
-
const timezone =
|
|
1516
|
-
if (timezone
|
|
1517
|
-
|
|
1552
|
+
const timezone = dayjs.tz.guess();
|
|
1553
|
+
if (timezone === "UTC") {
|
|
1554
|
+
date = dayjs(value);
|
|
1555
|
+
} else {
|
|
1556
|
+
date = dayjs.tz(value, timezone);
|
|
1518
1557
|
}
|
|
1519
|
-
|
|
1558
|
+
} else {
|
|
1559
|
+
date = dayjs(value);
|
|
1520
1560
|
}
|
|
1521
|
-
return
|
|
1561
|
+
return this.setLocaleToValue(date);
|
|
1522
1562
|
};
|
|
1523
1563
|
this.createUTCDate = (value) => {
|
|
1524
1564
|
if (!this.hasUTCPlugin()) {
|
|
1525
1565
|
throw new Error(MISSING_UTC_PLUGIN);
|
|
1526
1566
|
}
|
|
1527
|
-
return
|
|
1567
|
+
return this.setLocaleToValue(dayjs.utc(value));
|
|
1528
1568
|
};
|
|
1529
1569
|
this.createTZDate = (value, timezone) => {
|
|
1530
1570
|
if (!this.hasUTCPlugin()) {
|
|
@@ -1534,10 +1574,10 @@ var AdapterDayjs = class {
|
|
|
1534
1574
|
throw new Error(MISSING_TIMEZONE_PLUGIN);
|
|
1535
1575
|
}
|
|
1536
1576
|
const keepLocalTime = value !== void 0 && !value.endsWith("Z");
|
|
1537
|
-
return
|
|
1577
|
+
return this.setLocaleToValue(dayjs(value).tz(this.cleanTimezone(timezone), keepLocalTime));
|
|
1538
1578
|
};
|
|
1539
1579
|
this.getLocaleFormats = () => {
|
|
1540
|
-
const locales =
|
|
1580
|
+
const locales = dayjs.Ls;
|
|
1541
1581
|
const locale = this.locale || "en";
|
|
1542
1582
|
let localeObject = locales[locale];
|
|
1543
1583
|
if (localeObject === void 0) {
|
|
@@ -1566,20 +1606,15 @@ var AdapterDayjs = class {
|
|
|
1566
1606
|
if (value === null) {
|
|
1567
1607
|
return null;
|
|
1568
1608
|
}
|
|
1569
|
-
let parsedValue;
|
|
1570
1609
|
if (timezone === "UTC") {
|
|
1571
|
-
|
|
1572
|
-
} else if (timezone === "system" || timezone === "default" && !this.hasTimezonePlugin()) {
|
|
1573
|
-
parsedValue = this.createSystemDate(value);
|
|
1574
|
-
} else {
|
|
1575
|
-
parsedValue = this.createTZDate(value, timezone);
|
|
1610
|
+
return this.createUTCDate(value);
|
|
1576
1611
|
}
|
|
1577
|
-
if (
|
|
1578
|
-
return
|
|
1612
|
+
if (timezone === "system" || timezone === "default" && !this.hasTimezonePlugin()) {
|
|
1613
|
+
return this.createSystemDate(value);
|
|
1579
1614
|
}
|
|
1580
|
-
return
|
|
1615
|
+
return this.createTZDate(value, timezone);
|
|
1581
1616
|
};
|
|
1582
|
-
this.getInvalidDate = () =>
|
|
1617
|
+
this.getInvalidDate = () => dayjs(/* @__PURE__ */ new Date("Invalid date"));
|
|
1583
1618
|
this.getTimezone = (value) => {
|
|
1584
1619
|
if (this.hasTimezonePlugin()) {
|
|
1585
1620
|
const zone = value.$x?.$timezone;
|
|
@@ -1611,7 +1646,7 @@ var AdapterDayjs = class {
|
|
|
1611
1646
|
}
|
|
1612
1647
|
throw new Error(MISSING_TIMEZONE_PLUGIN);
|
|
1613
1648
|
}
|
|
1614
|
-
return
|
|
1649
|
+
return this.setLocaleToValue(dayjs.tz(value, this.cleanTimezone(timezone)));
|
|
1615
1650
|
};
|
|
1616
1651
|
this.toJsDate = (value) => {
|
|
1617
1652
|
return value.toDate();
|
|
@@ -1620,7 +1655,7 @@ var AdapterDayjs = class {
|
|
|
1620
1655
|
if (value === "") {
|
|
1621
1656
|
return null;
|
|
1622
1657
|
}
|
|
1623
|
-
return
|
|
1658
|
+
return dayjs(value, format, this.locale, true);
|
|
1624
1659
|
};
|
|
1625
1660
|
this.getCurrentLocaleCode = () => {
|
|
1626
1661
|
return this.locale || "en";
|
|
@@ -1630,10 +1665,10 @@ var AdapterDayjs = class {
|
|
|
1630
1665
|
};
|
|
1631
1666
|
this.expandFormat = (format) => {
|
|
1632
1667
|
const localeFormats = this.getLocaleFormats();
|
|
1633
|
-
const
|
|
1668
|
+
const t2 = (formatBis) => formatBis.replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g, (_, a, b) => a || b.slice(1));
|
|
1634
1669
|
return format.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g, (_, a, b) => {
|
|
1635
1670
|
const B = b && b.toUpperCase();
|
|
1636
|
-
return a || localeFormats[b] ||
|
|
1671
|
+
return a || localeFormats[b] || t2(localeFormats[B]);
|
|
1637
1672
|
});
|
|
1638
1673
|
};
|
|
1639
1674
|
this.isValid = (value) => {
|
|
@@ -1646,7 +1681,7 @@ var AdapterDayjs = class {
|
|
|
1646
1681
|
return this.formatByString(value, this.formats[formatKey]);
|
|
1647
1682
|
};
|
|
1648
1683
|
this.formatByString = (value, formatString) => {
|
|
1649
|
-
return this.
|
|
1684
|
+
return this.setLocaleToValue(value).format(formatString);
|
|
1650
1685
|
};
|
|
1651
1686
|
this.formatNumber = (numberToFormat) => {
|
|
1652
1687
|
return numberToFormat;
|
|
@@ -1730,25 +1765,25 @@ var AdapterDayjs = class {
|
|
|
1730
1765
|
return this.adjustOffset(value.endOf("day"));
|
|
1731
1766
|
};
|
|
1732
1767
|
this.addYears = (value, amount) => {
|
|
1733
|
-
return this.adjustOffset(
|
|
1768
|
+
return this.adjustOffset(value.add(amount, "year"));
|
|
1734
1769
|
};
|
|
1735
1770
|
this.addMonths = (value, amount) => {
|
|
1736
|
-
return this.adjustOffset(
|
|
1771
|
+
return this.adjustOffset(value.add(amount, "month"));
|
|
1737
1772
|
};
|
|
1738
1773
|
this.addWeeks = (value, amount) => {
|
|
1739
|
-
return this.adjustOffset(
|
|
1774
|
+
return this.adjustOffset(value.add(amount, "week"));
|
|
1740
1775
|
};
|
|
1741
1776
|
this.addDays = (value, amount) => {
|
|
1742
|
-
return this.adjustOffset(
|
|
1777
|
+
return this.adjustOffset(value.add(amount, "day"));
|
|
1743
1778
|
};
|
|
1744
1779
|
this.addHours = (value, amount) => {
|
|
1745
|
-
return this.adjustOffset(
|
|
1780
|
+
return this.adjustOffset(value.add(amount, "hour"));
|
|
1746
1781
|
};
|
|
1747
1782
|
this.addMinutes = (value, amount) => {
|
|
1748
|
-
return this.adjustOffset(
|
|
1783
|
+
return this.adjustOffset(value.add(amount, "minute"));
|
|
1749
1784
|
};
|
|
1750
1785
|
this.addSeconds = (value, amount) => {
|
|
1751
|
-
return this.adjustOffset(
|
|
1786
|
+
return this.adjustOffset(value.add(amount, "second"));
|
|
1752
1787
|
};
|
|
1753
1788
|
this.getYear = (value) => {
|
|
1754
1789
|
return value.year();
|
|
@@ -1824,10 +1859,9 @@ var AdapterDayjs = class {
|
|
|
1824
1859
|
}
|
|
1825
1860
|
return years;
|
|
1826
1861
|
};
|
|
1827
|
-
this.dayjs = withLocale(defaultDayjs, _locale);
|
|
1828
1862
|
this.locale = _locale;
|
|
1829
1863
|
this.formats = _extends({}, defaultFormats, formats);
|
|
1830
|
-
|
|
1864
|
+
dayjs.extend(customParseFormatPlugin);
|
|
1831
1865
|
}
|
|
1832
1866
|
getDayOfWeek(value) {
|
|
1833
1867
|
return value.day() + 1;
|
|
@@ -1840,17 +1874,11 @@ import { useRouterState } from "@tanstack/react-router";
|
|
|
1840
1874
|
import { DashboardLayout } from "@toolpad/core/DashboardLayout";
|
|
1841
1875
|
import { TanStackRouterAppProvider } from "@toolpad/core/tanstack-router";
|
|
1842
1876
|
import { NotificationsProvider } from "@toolpad/core/useNotifications";
|
|
1843
|
-
import
|
|
1844
|
-
import
|
|
1845
|
-
import HttpBackend from "i18next-http-backend";
|
|
1846
|
-
import { initReactI18next, useTranslation as useTranslation5 } from "react-i18next";
|
|
1847
|
-
import { z } from "zod";
|
|
1848
|
-
import { zodI18nMap } from "zod-i18n-map";
|
|
1849
|
-
import zodCsTranslations from "zod-i18n-map/locales/cs/zod.json";
|
|
1850
|
-
import zodEnTranslations from "zod-i18n-map/locales/en/zod.json";
|
|
1877
|
+
import { useState as useState2 } from "react";
|
|
1878
|
+
import { I18nextProvider, useTranslation as useTranslation5 } from "react-i18next";
|
|
1851
1879
|
|
|
1852
1880
|
// src/components/core/AppTitle.tsx
|
|
1853
|
-
import { Stack as Stack3, Typography as
|
|
1881
|
+
import { Chip as Chip2, Stack as Stack3, Typography as Typography5 } from "@mui/material";
|
|
1854
1882
|
|
|
1855
1883
|
// src/contexts/LayoutContext.ts
|
|
1856
1884
|
import { createContext as createContext2, useContext as useContext2 } from "react";
|
|
@@ -1858,65 +1886,55 @@ var LayoutContext = createContext2({});
|
|
|
1858
1886
|
var useLayout = () => useContext2(LayoutContext);
|
|
1859
1887
|
|
|
1860
1888
|
// src/components/core/AppTitle.tsx
|
|
1861
|
-
import { jsx as
|
|
1889
|
+
import { jsx as jsx13, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1862
1890
|
var AppTitle = () => {
|
|
1863
1891
|
const { appTitle } = useLayout();
|
|
1864
|
-
return /* @__PURE__ */
|
|
1865
|
-
/* @__PURE__ */
|
|
1866
|
-
/* @__PURE__ */
|
|
1892
|
+
return /* @__PURE__ */ jsxs5(Stack3, { direction: "row", alignItems: "center", spacing: 2, children: [
|
|
1893
|
+
/* @__PURE__ */ jsx13("img", { src: "/favicon-32x32.png", alt: "app-logo", loading: "lazy" }),
|
|
1894
|
+
/* @__PURE__ */ jsx13(Typography5, { variant: "h6", children: appTitle }),
|
|
1895
|
+
import.meta.env.DEV && /* @__PURE__ */ jsx13(Chip2, { size: "small", label: "BETA", color: "info" })
|
|
1867
1896
|
] });
|
|
1868
1897
|
};
|
|
1869
1898
|
|
|
1870
|
-
// src/components/core/
|
|
1871
|
-
import
|
|
1872
|
-
import
|
|
1873
|
-
import
|
|
1874
|
-
import
|
|
1875
|
-
import
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
] }) }) });
|
|
1899
|
+
// src/components/core/ToolbarAccount.tsx
|
|
1900
|
+
import AccountCircle from "@mui/icons-material/AccountCircle";
|
|
1901
|
+
import ArrowBack from "@mui/icons-material/ArrowBack";
|
|
1902
|
+
import Brightness4 from "@mui/icons-material/Brightness4";
|
|
1903
|
+
import ChevronRight from "@mui/icons-material/ChevronRight";
|
|
1904
|
+
import DarkMode from "@mui/icons-material/DarkMode";
|
|
1905
|
+
import LightMode from "@mui/icons-material/LightMode";
|
|
1906
|
+
import Login from "@mui/icons-material/Login";
|
|
1907
|
+
import Logout from "@mui/icons-material/Logout";
|
|
1908
|
+
import SettingsBrightness from "@mui/icons-material/SettingsBrightness";
|
|
1909
|
+
import Translate from "@mui/icons-material/Translate";
|
|
1910
|
+
import { Avatar, Box as Box3, IconButton as IconButton2, List, ListItem, ListItemButton, ListItemIcon, ListItemText, ListSubheader, Menu, Typography as Typography6, useColorScheme } from "@mui/material";
|
|
1911
|
+
import { Fragment, useState } from "react";
|
|
1912
|
+
import { useTranslation as useTranslation3 } from "react-i18next";
|
|
1913
|
+
|
|
1914
|
+
// src/auth-test/keycloak.ts
|
|
1915
|
+
import { useRouter } from "@tanstack/react-router";
|
|
1916
|
+
import Keycloak from "keycloak-js";
|
|
1917
|
+
var keycloakConfig = {
|
|
1918
|
+
url: import.meta.env.VITE_KEYCLOAK_URL,
|
|
1919
|
+
realm: import.meta.env.VITE_KEYCLOAK_REALM,
|
|
1920
|
+
clientId: import.meta.env.VITE_KEYCLOAK_CLIENT_ID,
|
|
1921
|
+
idpHint: import.meta.env.VITE_KEYCLOAK_IDP_HINT,
|
|
1922
|
+
confidentialClientId: import.meta.env.VITE_KEYCLOAK_CONFIDENTIAL_CLIENT_ID,
|
|
1923
|
+
confidentialClientSecret: import.meta.env.VITE_KEYCLOAK_CONFIDENTIAL_CLIENT_SECRET
|
|
1896
1924
|
};
|
|
1925
|
+
function useKeycloak() {
|
|
1926
|
+
const routerContext = useRouter();
|
|
1927
|
+
const keycloak = routerContext.options.context.keycloak;
|
|
1928
|
+
return keycloak;
|
|
1929
|
+
}
|
|
1897
1930
|
|
|
1898
1931
|
// src/components/core/ToolbarAccount.tsx
|
|
1899
|
-
import { AccountCircle, ArrowBack, Brightness4, ChevronRight, DarkMode, LightMode, Login, Logout, SettingsBrightness, Translate } from "@mui/icons-material";
|
|
1900
|
-
import { Avatar, Box as Box3, IconButton as IconButton3, List, ListItem, ListItemButton, ListItemIcon, ListItemText, ListSubheader, Menu, Typography as Typography6, useColorScheme } from "@mui/material";
|
|
1901
|
-
import { Fragment, useState as useState2 } from "react";
|
|
1902
|
-
import { useTranslation as useTranslation3 } from "react-i18next";
|
|
1903
1932
|
import { jsx as jsx14, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1904
|
-
var user = {
|
|
1905
|
-
name: "Dalibor Homola",
|
|
1906
|
-
employeeId: "C2503017",
|
|
1907
|
-
department: "MD0L50",
|
|
1908
|
-
login: () => {
|
|
1909
|
-
console.log("Login");
|
|
1910
|
-
},
|
|
1911
|
-
logout: () => {
|
|
1912
|
-
console.log("Logout");
|
|
1913
|
-
}
|
|
1914
|
-
};
|
|
1915
1933
|
var ToolbarAccount = () => {
|
|
1916
|
-
const [anchorElement, setAnchorElement] =
|
|
1917
|
-
const [tab, setTab] =
|
|
1934
|
+
const [anchorElement, setAnchorElement] = useState();
|
|
1935
|
+
const [tab, setTab] = useState("settings");
|
|
1918
1936
|
const open = Boolean(anchorElement);
|
|
1919
|
-
const { t, i18n: i18n2 } = useTranslation3();
|
|
1937
|
+
const { t: t2, i18n: i18n2 } = useTranslation3();
|
|
1920
1938
|
const { mode, setMode } = useColorScheme();
|
|
1921
1939
|
const changeLanguage = (newLanguage) => () => {
|
|
1922
1940
|
i18n2.changeLanguage(newLanguage).finally(() => closeMenu());
|
|
@@ -1925,20 +1943,23 @@ var ToolbarAccount = () => {
|
|
|
1925
1943
|
setMode(newMode);
|
|
1926
1944
|
closeMenu();
|
|
1927
1945
|
};
|
|
1946
|
+
const keycloak = useKeycloak();
|
|
1947
|
+
const user = keycloak.user;
|
|
1928
1948
|
const getModeText = () => {
|
|
1929
1949
|
switch (mode) {
|
|
1930
1950
|
case "light": {
|
|
1931
|
-
return
|
|
1951
|
+
return t2("Layout.Light");
|
|
1932
1952
|
}
|
|
1933
1953
|
case "dark": {
|
|
1934
|
-
return
|
|
1954
|
+
return t2("Layout.Dark");
|
|
1935
1955
|
}
|
|
1936
1956
|
default: {
|
|
1937
|
-
return
|
|
1957
|
+
return t2("Layout.System");
|
|
1938
1958
|
}
|
|
1939
1959
|
}
|
|
1940
1960
|
};
|
|
1941
1961
|
const usernameInitials = () => {
|
|
1962
|
+
if (!user?.name) return "";
|
|
1942
1963
|
const splittedName = user.name.split(" ");
|
|
1943
1964
|
return `${splittedName[0][0]}${splittedName.length > 1 ? splittedName[1][0] : ""}`;
|
|
1944
1965
|
};
|
|
@@ -1947,63 +1968,61 @@ var ToolbarAccount = () => {
|
|
|
1947
1968
|
setAnchorElement(void 0);
|
|
1948
1969
|
setTimeout(() => setTab("settings"), 300);
|
|
1949
1970
|
};
|
|
1950
|
-
const login = () => user.login();
|
|
1951
|
-
const logout = () => user.logout();
|
|
1952
1971
|
const changeTab = (newTab) => () => setTab(newTab);
|
|
1953
|
-
const settings = /* @__PURE__ */ jsxs6(List, { component: "nav", subheader: /* @__PURE__ */ jsx14(ListSubheader, { sx: { backgroundColor: "transparent" }, children:
|
|
1972
|
+
const settings = /* @__PURE__ */ jsxs6(List, { component: "nav", subheader: /* @__PURE__ */ jsx14(ListSubheader, { sx: { backgroundColor: "transparent" }, children: t2("Layout.Settings") }), children: [
|
|
1954
1973
|
/* @__PURE__ */ jsxs6(ListItemButton, { onClick: changeTab("theme"), sx: { py: 0.3 }, children: [
|
|
1955
1974
|
/* @__PURE__ */ jsx14(ListItemIcon, { children: /* @__PURE__ */ jsx14(Brightness4, {}) }),
|
|
1956
|
-
/* @__PURE__ */ jsx14(ListItemText, { primary:
|
|
1975
|
+
/* @__PURE__ */ jsx14(ListItemText, { primary: t2("Layout.Appearance"), secondary: getModeText() }),
|
|
1957
1976
|
/* @__PURE__ */ jsx14(ChevronRight, {})
|
|
1958
1977
|
] }),
|
|
1959
1978
|
/* @__PURE__ */ jsxs6(ListItemButton, { onClick: changeTab("language"), sx: { py: 0.3 }, children: [
|
|
1960
1979
|
/* @__PURE__ */ jsx14(ListItemIcon, { children: /* @__PURE__ */ jsx14(Translate, {}) }),
|
|
1961
|
-
/* @__PURE__ */ jsx14(ListItemText, { primary:
|
|
1980
|
+
/* @__PURE__ */ jsx14(ListItemText, { primary: t2("Layout.Language"), secondary: i18n2.resolvedLanguage === "en" ? "English" : "\u010Ce\u0161tina" }),
|
|
1962
1981
|
/* @__PURE__ */ jsx14(ChevronRight, {})
|
|
1963
1982
|
] })
|
|
1964
1983
|
] });
|
|
1965
1984
|
const theme = /* @__PURE__ */ jsxs6(List, { subheader: /* @__PURE__ */ jsxs6(ListSubheader, { onClick: changeTab("settings"), sx: { backgroundColor: "transparent", display: "flex", alignItems: "center", px: 1, cursor: "pointer" }, children: [
|
|
1966
|
-
/* @__PURE__ */ jsx14(
|
|
1985
|
+
/* @__PURE__ */ jsx14(IconButton2, { size: "small", sx: { mr: 0.5 }, children: /* @__PURE__ */ jsx14(ArrowBack, { fontSize: "small" }) }),
|
|
1967
1986
|
" ",
|
|
1968
|
-
|
|
1987
|
+
t2("Layout.Appearance")
|
|
1969
1988
|
] }), children: [
|
|
1970
1989
|
/* @__PURE__ */ jsxs6(ListItemButton, { onClick: changeMode("light"), disabled: mode === "light", children: [
|
|
1971
1990
|
/* @__PURE__ */ jsx14(ListItemIcon, { children: /* @__PURE__ */ jsx14(LightMode, {}) }),
|
|
1972
|
-
/* @__PURE__ */ jsx14(ListItemText, { primary:
|
|
1991
|
+
/* @__PURE__ */ jsx14(ListItemText, { primary: t2("Layout.Light") })
|
|
1973
1992
|
] }),
|
|
1974
1993
|
/* @__PURE__ */ jsxs6(ListItemButton, { onClick: changeMode("dark"), disabled: mode === "dark", children: [
|
|
1975
1994
|
/* @__PURE__ */ jsx14(ListItemIcon, { children: /* @__PURE__ */ jsx14(DarkMode, {}) }),
|
|
1976
|
-
/* @__PURE__ */ jsx14(ListItemText, { primary:
|
|
1995
|
+
/* @__PURE__ */ jsx14(ListItemText, { primary: t2("Layout.Dark") })
|
|
1977
1996
|
] }),
|
|
1978
1997
|
/* @__PURE__ */ jsxs6(ListItemButton, { onClick: changeMode("system"), disabled: mode === "system", children: [
|
|
1979
1998
|
/* @__PURE__ */ jsx14(ListItemIcon, { children: /* @__PURE__ */ jsx14(SettingsBrightness, {}) }),
|
|
1980
|
-
/* @__PURE__ */ jsx14(ListItemText, { primary:
|
|
1999
|
+
/* @__PURE__ */ jsx14(ListItemText, { primary: t2("Layout.System") })
|
|
1981
2000
|
] })
|
|
1982
2001
|
] });
|
|
1983
2002
|
const language = /* @__PURE__ */ jsxs6(List, { subheader: /* @__PURE__ */ jsxs6(ListSubheader, { onClick: changeTab("settings"), sx: { backgroundColor: "transparent", display: "flex", alignItems: "center", px: 1, cursor: "pointer" }, children: [
|
|
1984
|
-
/* @__PURE__ */ jsx14(
|
|
2003
|
+
/* @__PURE__ */ jsx14(IconButton2, { size: "small", sx: { mr: 0.5 }, children: /* @__PURE__ */ jsx14(ArrowBack, { fontSize: "small" }) }),
|
|
1985
2004
|
" ",
|
|
1986
|
-
|
|
2005
|
+
t2("Layout.Language")
|
|
1987
2006
|
] }), children: [
|
|
1988
2007
|
/* @__PURE__ */ jsx14(ListItemButton, { onClick: changeLanguage("en"), disabled: i18n2.resolvedLanguage === "en", children: /* @__PURE__ */ jsx14(ListItemText, { primary: "English" }) }),
|
|
1989
2008
|
/* @__PURE__ */ jsx14(ListItemButton, { onClick: changeLanguage("cs"), disabled: i18n2.resolvedLanguage === "cs", children: /* @__PURE__ */ jsx14(ListItemText, { primary: "\u010Ce\u0161tina" }) })
|
|
1990
2009
|
] });
|
|
1991
2010
|
return /* @__PURE__ */ jsxs6(Fragment, { children: [
|
|
1992
|
-
/* @__PURE__ */ jsx14(
|
|
2011
|
+
/* @__PURE__ */ jsx14(IconButton2, { size: "small", onClick: openMenu, children: user?.name ? /* @__PURE__ */ jsx14(Avatar, { sx: { width: { xs: 32, sm: 40 }, height: { xs: 32, sm: 40 }, bgcolor: "primary.main" }, children: /* @__PURE__ */ jsx14(Typography6, { variant: "subtitle2", sx: { fontWeight: "bold", lineHeight: 0 }, children: usernameInitials() }) }) : /* @__PURE__ */ jsx14(AccountCircle, {}) }),
|
|
1993
2012
|
/* @__PURE__ */ jsx14(Menu, { anchorEl: anchorElement, open, onClose: closeMenu, children: /* @__PURE__ */ jsxs6(Box3, { sx: { width: 240 }, children: [
|
|
1994
|
-
/* @__PURE__ */ jsx14(List, { children: user
|
|
2013
|
+
/* @__PURE__ */ jsx14(List, { children: user?.name ? /* @__PURE__ */ jsxs6(Fragment, { children: [
|
|
1995
2014
|
/* @__PURE__ */ jsx14(ListItem, { children: /* @__PURE__ */ jsx14(ListItemText, { primary: user.name, secondary: /* @__PURE__ */ jsxs6("span", { children: [
|
|
1996
2015
|
/* @__PURE__ */ jsx14("span", { children: user.employeeId }),
|
|
1997
2016
|
/* @__PURE__ */ jsx14("br", {}),
|
|
1998
2017
|
/* @__PURE__ */ jsx14("span", { children: user.department })
|
|
1999
2018
|
] }) }) }),
|
|
2000
|
-
/* @__PURE__ */ jsxs6(ListItemButton, { onClick: logout, children: [
|
|
2019
|
+
/* @__PURE__ */ jsxs6(ListItemButton, { onClick: () => keycloak.logout(), children: [
|
|
2001
2020
|
/* @__PURE__ */ jsx14(ListItemIcon, { children: /* @__PURE__ */ jsx14(Logout, { color: "error" }) }),
|
|
2002
|
-
/* @__PURE__ */ jsx14(ListItemText, { primary:
|
|
2021
|
+
/* @__PURE__ */ jsx14(ListItemText, { primary: t2("Layout.Logout") })
|
|
2003
2022
|
] })
|
|
2004
|
-
] }) : /* @__PURE__ */ jsxs6(ListItemButton, { onClick: login, children: [
|
|
2023
|
+
] }) : /* @__PURE__ */ jsxs6(ListItemButton, { onClick: () => keycloak.login(), children: [
|
|
2005
2024
|
/* @__PURE__ */ jsx14(ListItemIcon, { children: /* @__PURE__ */ jsx14(Login, { color: "success" }) }),
|
|
2006
|
-
/* @__PURE__ */ jsx14(ListItemText, { primary:
|
|
2025
|
+
/* @__PURE__ */ jsx14(ListItemText, { primary: t2("Layout.LogIn") })
|
|
2007
2026
|
] }) }),
|
|
2008
2027
|
tab === "settings" && settings,
|
|
2009
2028
|
tab === "theme" && theme,
|
|
@@ -2070,11 +2089,6 @@ var useGetTheme = (theme) => {
|
|
|
2070
2089
|
};
|
|
2071
2090
|
}
|
|
2072
2091
|
},
|
|
2073
|
-
MuiTextField: {
|
|
2074
|
-
defaultProps: {
|
|
2075
|
-
fullWidth: true
|
|
2076
|
-
}
|
|
2077
|
-
},
|
|
2078
2092
|
MuiTableContainer: {
|
|
2079
2093
|
styleOverrides: {
|
|
2080
2094
|
root: ({ theme: theme2 }) => ({
|
|
@@ -2100,16 +2114,6 @@ var useGetTheme = (theme) => {
|
|
|
2100
2114
|
})
|
|
2101
2115
|
}
|
|
2102
2116
|
},
|
|
2103
|
-
MuiDialog: {
|
|
2104
|
-
defaultProps: {
|
|
2105
|
-
fullWidth: true
|
|
2106
|
-
}
|
|
2107
|
-
},
|
|
2108
|
-
MuiContainer: {
|
|
2109
|
-
defaultProps: {
|
|
2110
|
-
maxWidth: false
|
|
2111
|
-
}
|
|
2112
|
-
},
|
|
2113
2117
|
...theme?.components
|
|
2114
2118
|
}
|
|
2115
2119
|
},
|
|
@@ -2119,38 +2123,54 @@ var useGetTheme = (theme) => {
|
|
|
2119
2123
|
);
|
|
2120
2124
|
};
|
|
2121
2125
|
|
|
2122
|
-
// src/
|
|
2123
|
-
import
|
|
2126
|
+
// src/utils/i18n.ts
|
|
2127
|
+
import i18n from "i18next";
|
|
2128
|
+
import { initReactI18next } from "react-i18next";
|
|
2129
|
+
import HttpBackend from "i18next-http-backend";
|
|
2130
|
+
import LanguageDetector from "i18next-browser-languagedetector";
|
|
2131
|
+
import { z } from "zod";
|
|
2132
|
+
import { zodI18nMap } from "zod-i18n-map";
|
|
2133
|
+
import zodCsTranslations from "zod-i18n-map/locales/cs/zod.json";
|
|
2134
|
+
import zodEnTranslations from "zod-i18n-map/locales/en/zod.json";
|
|
2135
|
+
import { default as default2 } from "i18next";
|
|
2124
2136
|
i18n.use(HttpBackend).use(LanguageDetector).use(initReactI18next).init({
|
|
2125
2137
|
fallbackLng: "en",
|
|
2126
2138
|
interpolation: {
|
|
2127
2139
|
escapeValue: false
|
|
2140
|
+
},
|
|
2141
|
+
react: {
|
|
2142
|
+
useSuspense: false
|
|
2128
2143
|
}
|
|
2129
2144
|
});
|
|
2130
2145
|
i18n.addResourceBundle("en", "zod", zodEnTranslations);
|
|
2131
2146
|
i18n.addResourceBundle("cs", "zod", zodCsTranslations);
|
|
2132
2147
|
z.setErrorMap(zodI18nMap);
|
|
2148
|
+
|
|
2149
|
+
// src/providers/LayoutProvider.tsx
|
|
2150
|
+
import { jsx as jsx15, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
2133
2151
|
var LayoutProvider = (props) => {
|
|
2134
2152
|
const rootRouterState = useRouterState({ select: (s) => s.matches[0] });
|
|
2135
2153
|
const theme = useGetTheme(props.theme);
|
|
2136
|
-
const { t
|
|
2154
|
+
const { t: t2 } = useTranslation5();
|
|
2137
2155
|
const isFetching = !!useIsFetching();
|
|
2138
2156
|
const isMutating = !!useIsMutating();
|
|
2139
2157
|
const isLargeScreen = useMediaQuery(theme.breakpoints.up("sm"));
|
|
2140
|
-
const
|
|
2141
|
-
const navigation = props.getNavigation
|
|
2158
|
+
const [user, setUser] = useState2({ employeeId: "", name: "Unknown", department: "", company: "", category: "" });
|
|
2159
|
+
const navigation = props.getNavigation?.({ user, t: t2 });
|
|
2142
2160
|
const appTitle = rootRouterState.meta?.find((meta) => meta?.title)?.title;
|
|
2143
2161
|
if (!appTitle)
|
|
2144
2162
|
throw new Error("Title is not defined in the RootRoute head.");
|
|
2145
|
-
return /* @__PURE__ */ jsx15(LocalizationProvider, { dateAdapter: AdapterDayjs, adapterLocale:
|
|
2146
|
-
confirm:
|
|
2147
|
-
cancel:
|
|
2148
|
-
alert:
|
|
2149
|
-
}, children: /* @__PURE__ */ jsx15(NotificationsProvider, { slotProps: { snackbar: { anchorOrigin: { vertical: isLargeScreen ? "top" : "bottom", horizontal: "center" } } }, children: /* @__PURE__ */ jsx15(LayoutContext.Provider, { value: { appTitle }, children: /* @__PURE__ */ jsxs7(
|
|
2163
|
+
return /* @__PURE__ */ jsx15(I18nextProvider, { i18n: default2, children: /* @__PURE__ */ jsx15(LocalizationProvider, { dateAdapter: AdapterDayjs, adapterLocale: default2.resolvedLanguage, children: /* @__PURE__ */ jsx15(TanStackRouterAppProvider, { navigation, theme, localeText: {
|
|
2164
|
+
confirm: t2("Layout.Dialog.Confirm"),
|
|
2165
|
+
cancel: t2("Layout.Dialog.Cancel"),
|
|
2166
|
+
alert: t2("Layout.Dialog.Alert")
|
|
2167
|
+
}, children: /* @__PURE__ */ jsx15(NotificationsProvider, { slotProps: { snackbar: { anchorOrigin: { vertical: isLargeScreen ? "top" : "bottom", horizontal: "center" } } }, children: /* @__PURE__ */ jsx15(LayoutContext.Provider, { value: { appTitle, user: { get: user, set: setUser } }, children: /* @__PURE__ */ jsxs7(
|
|
2150
2168
|
DashboardLayout,
|
|
2151
2169
|
{
|
|
2152
|
-
defaultSidebarCollapsed: true,
|
|
2153
|
-
|
|
2170
|
+
defaultSidebarCollapsed: props.defaultSidebarCollapsed ?? true,
|
|
2171
|
+
disableCollapsibleSidebar: props.disableCollapsibleSidebar,
|
|
2172
|
+
sidebarExpandedWidth: props.sidebarExpandedWidth,
|
|
2173
|
+
hideNavigation: navigation?.length === 0,
|
|
2154
2174
|
slots: {
|
|
2155
2175
|
toolbarActions: () => null,
|
|
2156
2176
|
toolbarAccount: ToolbarAccount,
|
|
@@ -2158,31 +2178,33 @@ var LayoutProvider = (props) => {
|
|
|
2158
2178
|
},
|
|
2159
2179
|
children: [
|
|
2160
2180
|
props.children,
|
|
2161
|
-
/* @__PURE__ */ jsx15(DevelopmentBanner, { hasNavigationRoutes: navigation.length > 0 }),
|
|
2162
2181
|
(isFetching || isMutating) && /* @__PURE__ */ jsx15(LinearProgress, { sx: { position: "fixed", top: { xs: 56, sm: 64 }, left: 0, right: 0 } })
|
|
2163
2182
|
]
|
|
2164
2183
|
}
|
|
2165
|
-
) }) }) }) });
|
|
2184
|
+
) }) }) }) }) });
|
|
2166
2185
|
};
|
|
2167
2186
|
|
|
2168
2187
|
// src/index.ts
|
|
2169
|
-
import { uuidv7 } from "uuidv7";
|
|
2188
|
+
import { uuidv7 as uuidv72 } from "uuidv7";
|
|
2170
2189
|
|
|
2171
2190
|
// src/utils/ClientUtils.ts
|
|
2172
|
-
import { useQueryClient } from "@tanstack/react-query";
|
|
2173
2191
|
import axios from "axios";
|
|
2174
2192
|
var Platform = class {
|
|
2175
|
-
static isAndroid
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
static
|
|
2179
|
-
|
|
2180
|
-
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
|
|
2193
|
+
static get isAndroid() {
|
|
2194
|
+
return /android/i.test(this.userAgent);
|
|
2195
|
+
}
|
|
2196
|
+
static get isIOS() {
|
|
2197
|
+
return /iPad|iPhone|iPod/.test(this.userAgent);
|
|
2198
|
+
}
|
|
2199
|
+
static get isWindows() {
|
|
2200
|
+
return /windows/i.test(this.userAgent);
|
|
2201
|
+
}
|
|
2202
|
+
static get isMacOS() {
|
|
2203
|
+
return /Macintosh|MacIntel|MacPPC|Mac68K/.test(this.userAgent);
|
|
2204
|
+
}
|
|
2205
|
+
static get userAgent() {
|
|
2206
|
+
return typeof navigator === "undefined" ? "" : navigator.userAgent;
|
|
2207
|
+
}
|
|
2186
2208
|
};
|
|
2187
2209
|
var rootRouteHead = ({ title }) => () => ({
|
|
2188
2210
|
meta: [
|
|
@@ -2202,9 +2224,6 @@ var rootRouteHead = ({ title }) => () => ({
|
|
|
2202
2224
|
]
|
|
2203
2225
|
});
|
|
2204
2226
|
var wczApiClient = axios.create();
|
|
2205
|
-
wczApiClient.interceptors.request.use(async (config) => {
|
|
2206
|
-
return config;
|
|
2207
|
-
});
|
|
2208
2227
|
|
|
2209
2228
|
// src/hooks/FormHooks.ts
|
|
2210
2229
|
import { createFormHook, createFormHookContexts } from "@tanstack/react-form";
|
|
@@ -2279,7 +2298,7 @@ var FormCheckbox = (props) => {
|
|
|
2279
2298
|
|
|
2280
2299
|
// src/components/form/FormDatePicker.tsx
|
|
2281
2300
|
import { DatePicker } from "@mui/x-date-pickers-pro";
|
|
2282
|
-
import
|
|
2301
|
+
import dayjs2 from "dayjs";
|
|
2283
2302
|
import { jsx as jsx18 } from "react/jsx-runtime";
|
|
2284
2303
|
var FormDatePicker = (props) => {
|
|
2285
2304
|
const field = useFieldContext();
|
|
@@ -2288,7 +2307,7 @@ var FormDatePicker = (props) => {
|
|
|
2288
2307
|
DatePicker,
|
|
2289
2308
|
{
|
|
2290
2309
|
name: field.name,
|
|
2291
|
-
value: field.state.value ?
|
|
2310
|
+
value: field.state.value ? dayjs2(field.state.value) : null,
|
|
2292
2311
|
onChange: (value) => field.handleChange(value ? value.format() : null),
|
|
2293
2312
|
slotProps: {
|
|
2294
2313
|
textField: {
|
|
@@ -2307,7 +2326,7 @@ var FormDatePicker = (props) => {
|
|
|
2307
2326
|
|
|
2308
2327
|
// src/components/form/FormDateTimePicker.tsx
|
|
2309
2328
|
import { DateTimePicker } from "@mui/x-date-pickers-pro";
|
|
2310
|
-
import
|
|
2329
|
+
import dayjs3 from "dayjs";
|
|
2311
2330
|
import { jsx as jsx19 } from "react/jsx-runtime";
|
|
2312
2331
|
var FormDateTimePicker = (props) => {
|
|
2313
2332
|
const field = useFieldContext();
|
|
@@ -2316,7 +2335,7 @@ var FormDateTimePicker = (props) => {
|
|
|
2316
2335
|
DateTimePicker,
|
|
2317
2336
|
{
|
|
2318
2337
|
name: field.name,
|
|
2319
|
-
value: field.state.value ?
|
|
2338
|
+
value: field.state.value ? dayjs3(field.state.value) : null,
|
|
2320
2339
|
onChange: (value) => field.handleChange(value ? value.format() : null),
|
|
2321
2340
|
slotProps: {
|
|
2322
2341
|
textField: {
|
|
@@ -2510,12 +2529,14 @@ import { useDialogs } from "@toolpad/core/useDialogs";
|
|
|
2510
2529
|
import { useNotifications } from "@toolpad/core/useNotifications";
|
|
2511
2530
|
import { useLocalStorageState } from "@toolpad/core/useLocalStorageState";
|
|
2512
2531
|
import { useTranslation as useTranslation6 } from "react-i18next";
|
|
2532
|
+
import { t } from "i18next";
|
|
2513
2533
|
|
|
2514
2534
|
// src/hooks/FileHooks.ts
|
|
2515
|
-
import { useMutation, useQuery, useQueryClient
|
|
2535
|
+
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
|
2516
2536
|
import saveAs from "file-saver";
|
|
2517
2537
|
import { useState as useState3 } from "react";
|
|
2518
2538
|
import { Upload as TusUpload } from "tus-js-client";
|
|
2539
|
+
import { uuidv7 } from "uuidv7";
|
|
2519
2540
|
var BASE_URL = import.meta.env.VITE_FILE_API_BASE_URL;
|
|
2520
2541
|
var QUERY_KEY = "Files";
|
|
2521
2542
|
var HOUR = 1e3 * 60 * 60;
|
|
@@ -2597,7 +2618,7 @@ var useOpenFile = (options) => {
|
|
|
2597
2618
|
};
|
|
2598
2619
|
var useUpdateFileMeta = (options) => {
|
|
2599
2620
|
const { appTitle } = useLayout();
|
|
2600
|
-
const queryClient =
|
|
2621
|
+
const queryClient = useQueryClient();
|
|
2601
2622
|
return useMutation({
|
|
2602
2623
|
...options,
|
|
2603
2624
|
mutationFn: (meta) => wczApiClient.request({
|
|
@@ -2610,7 +2631,7 @@ var useUpdateFileMeta = (options) => {
|
|
|
2610
2631
|
};
|
|
2611
2632
|
var useDeleteFile = (options) => {
|
|
2612
2633
|
const { appTitle } = useLayout();
|
|
2613
|
-
const queryClient =
|
|
2634
|
+
const queryClient = useQueryClient();
|
|
2614
2635
|
return useMutation({
|
|
2615
2636
|
...options,
|
|
2616
2637
|
mutationFn: (meta) => wczApiClient.request({
|
|
@@ -2622,7 +2643,7 @@ var useDeleteFile = (options) => {
|
|
|
2622
2643
|
};
|
|
2623
2644
|
var useDeleteFiles = (options) => {
|
|
2624
2645
|
const { appTitle } = useLayout();
|
|
2625
|
-
const queryClient =
|
|
2646
|
+
const queryClient = useQueryClient();
|
|
2626
2647
|
return useMutation({
|
|
2627
2648
|
...options,
|
|
2628
2649
|
mutationFn: (subId) => wczApiClient.request({
|
|
@@ -2634,32 +2655,39 @@ var useDeleteFiles = (options) => {
|
|
|
2634
2655
|
};
|
|
2635
2656
|
var useUploadFile = ({ subId, onSuccess, onError }) => {
|
|
2636
2657
|
const { appTitle } = useLayout();
|
|
2637
|
-
const [
|
|
2638
|
-
const queryClient =
|
|
2658
|
+
const [progress, setProgress] = useState3(0);
|
|
2659
|
+
const queryClient = useQueryClient();
|
|
2639
2660
|
const mutate = async (file) => {
|
|
2640
2661
|
if (!subId) throw new Error("subId is required for file upload");
|
|
2662
|
+
const metadata = {
|
|
2663
|
+
id: uuidv7(),
|
|
2664
|
+
appName: appTitle,
|
|
2665
|
+
subId,
|
|
2666
|
+
fileName: file.name
|
|
2667
|
+
};
|
|
2641
2668
|
const upload = new TusUpload(file, {
|
|
2642
2669
|
endpoint: `${BASE_URL}/v1/upload`,
|
|
2643
2670
|
chunkSize: 1048576,
|
|
2644
2671
|
// 1 MB
|
|
2645
2672
|
metadata: {
|
|
2646
|
-
|
|
2647
|
-
|
|
2648
|
-
|
|
2649
|
-
|
|
2673
|
+
id: metadata.id,
|
|
2674
|
+
appName: metadata.appName,
|
|
2675
|
+
subId: metadata.subId,
|
|
2676
|
+
fileName: metadata.fileName,
|
|
2677
|
+
fileExtension: file.type
|
|
2650
2678
|
},
|
|
2651
2679
|
//headers: { "Authorization": `Bearer ${await getToken()}` }, //TODO: implement token retrieval
|
|
2652
2680
|
onError: (error) => {
|
|
2653
|
-
|
|
2681
|
+
setProgress(0);
|
|
2654
2682
|
onError?.(error);
|
|
2655
2683
|
},
|
|
2656
2684
|
onProgress: (bytesUploaded, bytesTotal) => {
|
|
2657
|
-
|
|
2685
|
+
setProgress(bytesUploaded / bytesTotal * 100);
|
|
2658
2686
|
},
|
|
2659
2687
|
onSuccess: () => {
|
|
2660
|
-
|
|
2688
|
+
setProgress(0);
|
|
2661
2689
|
queryClient.invalidateQueries({ queryKey: [QUERY_KEY, "meta"], exact: false });
|
|
2662
|
-
onSuccess?.(
|
|
2690
|
+
onSuccess?.(metadata);
|
|
2663
2691
|
}
|
|
2664
2692
|
});
|
|
2665
2693
|
const previousUploads = await upload.findPreviousUploads();
|
|
@@ -2668,10 +2696,48 @@ var useUploadFile = ({ subId, onSuccess, onError }) => {
|
|
|
2668
2696
|
}
|
|
2669
2697
|
upload.start();
|
|
2670
2698
|
};
|
|
2671
|
-
return { mutate,
|
|
2699
|
+
return { mutate, progress };
|
|
2672
2700
|
};
|
|
2701
|
+
function useOptimisticFileMutation(subId, options) {
|
|
2702
|
+
const [uploadedFileIds, setUploadedFileIds] = useState3([]);
|
|
2703
|
+
const [deletedFileIds, setDeletedFileIds] = useState3([]);
|
|
2704
|
+
const { data } = useGetFileMetas(subId, options);
|
|
2705
|
+
const { mutate: deleteAttachment } = useDeleteFile();
|
|
2706
|
+
function addFile(meta) {
|
|
2707
|
+
setUploadedFileIds((previous) => [...previous, meta.id]);
|
|
2708
|
+
}
|
|
2709
|
+
function removeFile(meta) {
|
|
2710
|
+
const added = uploadedFileIds.includes(meta.id);
|
|
2711
|
+
if (added) {
|
|
2712
|
+
setUploadedFileIds((previous) => previous.filter((file) => file !== meta.id));
|
|
2713
|
+
} else {
|
|
2714
|
+
setDeletedFileIds((previous) => [...previous, meta.id]);
|
|
2715
|
+
}
|
|
2716
|
+
}
|
|
2717
|
+
function save() {
|
|
2718
|
+
for (const id of deletedFileIds) {
|
|
2719
|
+
const meta = data.find((meta2) => meta2.id === id);
|
|
2720
|
+
if (!meta) continue;
|
|
2721
|
+
deleteAttachment(meta);
|
|
2722
|
+
}
|
|
2723
|
+
}
|
|
2724
|
+
function undo() {
|
|
2725
|
+
for (const id of uploadedFileIds) {
|
|
2726
|
+
const meta = data.find((meta2) => meta2.id === id);
|
|
2727
|
+
if (!meta) continue;
|
|
2728
|
+
deleteAttachment(meta);
|
|
2729
|
+
}
|
|
2730
|
+
}
|
|
2731
|
+
return {
|
|
2732
|
+
addFile,
|
|
2733
|
+
removeFile,
|
|
2734
|
+
save,
|
|
2735
|
+
undo
|
|
2736
|
+
};
|
|
2737
|
+
}
|
|
2673
2738
|
export {
|
|
2674
2739
|
ChipInputCell,
|
|
2740
|
+
Dropzone,
|
|
2675
2741
|
EditableColumnHeader,
|
|
2676
2742
|
LayoutProvider,
|
|
2677
2743
|
PageContainer,
|
|
@@ -2685,8 +2751,8 @@ export {
|
|
|
2685
2751
|
RouterNotFound,
|
|
2686
2752
|
RouterTab,
|
|
2687
2753
|
TypographyWithIcon,
|
|
2688
|
-
getContrastTextColor,
|
|
2689
2754
|
rootRouteHead,
|
|
2755
|
+
t,
|
|
2690
2756
|
useDeleteFile,
|
|
2691
2757
|
useDeleteFiles,
|
|
2692
2758
|
useDialogs,
|
|
@@ -2700,10 +2766,11 @@ export {
|
|
|
2700
2766
|
useLocalStorageState,
|
|
2701
2767
|
useNotifications,
|
|
2702
2768
|
useOpenFile,
|
|
2769
|
+
useOptimisticFileMutation,
|
|
2703
2770
|
useTranslation6 as useTranslation,
|
|
2704
2771
|
useUpdateFileMeta,
|
|
2705
2772
|
useUploadFile,
|
|
2706
|
-
uuidv7,
|
|
2773
|
+
uuidv72 as uuidv7,
|
|
2707
2774
|
wczApiClient,
|
|
2708
2775
|
withLayoutForm
|
|
2709
2776
|
};
|