wcz-test 3.4.9 → 4.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +3654 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +426 -0
- package/dist/index.d.ts +426 -0
- package/dist/index.js +3312 -0
- package/dist/index.js.map +1 -0
- package/package.json +83 -84
package/dist/index.js
ADDED
|
@@ -0,0 +1,3312 @@
|
|
|
1
|
+
import { Button, IconButton, Link, Tab, ListItemButton, FormControl, FormLabel, Slider, FormHelperText, RadioGroup, FormControlLabel, Radio, Switch, Checkbox, Autocomplete, TextField, Stack, Typography, CardHeader, Box, useTheme, Paper, Chip, Divider, List, Dialog, Fab, InitColorSchemeScript, CssBaseline, AppBar, Toolbar, LinearProgress, ListItemIcon, ListItemText, ImageListItem, ImageListItemBar, Tooltip, createTheme, darken, lighten, useColorScheme, ListSubheader, Avatar, Menu, ListItem, useMediaQuery, Collapse } from '@mui/material';
|
|
2
|
+
import { jsx, jsxs, Fragment as Fragment$1 } from 'react/jsx-runtime';
|
|
3
|
+
import * as React11 from 'react';
|
|
4
|
+
import React11__default, { createContext, useRef, useState, useEffect, useContext, useMemo, useId, useCallback, Fragment } from 'react';
|
|
5
|
+
import CloudUpload from '@mui/icons-material/CloudUpload';
|
|
6
|
+
import { useDropzone } from 'react-dropzone';
|
|
7
|
+
import { initReactI18next, useTranslation, I18nextProvider } from 'react-i18next';
|
|
8
|
+
export { useTranslation } from 'react-i18next';
|
|
9
|
+
import { useQuery, useMutation, useQueryClient, useIsFetching, useIsMutating } from '@tanstack/react-query';
|
|
10
|
+
import saveAs from 'file-saver';
|
|
11
|
+
import { Upload } from 'tus-js-client';
|
|
12
|
+
import { uuidv7 } from 'uuidv7';
|
|
13
|
+
export { uuidv7 } from 'uuidv7';
|
|
14
|
+
import { createLink, useRouterState, useNavigate, useRouter } from '@tanstack/react-router';
|
|
15
|
+
import axios from 'axios';
|
|
16
|
+
import MoreVert from '@mui/icons-material/MoreVert';
|
|
17
|
+
import { grey } from '@mui/material/colors';
|
|
18
|
+
import Delete from '@mui/icons-material/Delete';
|
|
19
|
+
import FileDownload from '@mui/icons-material/FileDownload';
|
|
20
|
+
import Button$1 from '@mui/material/Button';
|
|
21
|
+
import Dialog$1 from '@mui/material/Dialog';
|
|
22
|
+
import DialogActions from '@mui/material/DialogActions';
|
|
23
|
+
import DialogContent from '@mui/material/DialogContent';
|
|
24
|
+
import DialogTitle from '@mui/material/DialogTitle';
|
|
25
|
+
import AttachFile from '@mui/icons-material/AttachFile';
|
|
26
|
+
import Image from '@mui/icons-material/Image';
|
|
27
|
+
import SmartDisplay from '@mui/icons-material/SmartDisplay';
|
|
28
|
+
import Close from '@mui/icons-material/Close';
|
|
29
|
+
import Edit from '@mui/icons-material/Edit';
|
|
30
|
+
import { GridActionsCellItem } from '@mui/x-data-grid-premium';
|
|
31
|
+
import { styled, useThemeProps, ThemeProvider, useTheme as useTheme$1 } from '@mui/material/styles';
|
|
32
|
+
import dayjs from 'dayjs';
|
|
33
|
+
import weekOfYearPlugin from 'dayjs/plugin/weekOfYear.js';
|
|
34
|
+
import customParseFormatPlugin from 'dayjs/plugin/customParseFormat.js';
|
|
35
|
+
import localizedFormatPlugin from 'dayjs/plugin/localizedFormat.js';
|
|
36
|
+
import isBetweenPlugin from 'dayjs/plugin/isBetween.js';
|
|
37
|
+
import advancedFormatPlugin from 'dayjs/plugin/advancedFormat.js';
|
|
38
|
+
import * as z from 'zod';
|
|
39
|
+
import { cs, en } from 'zod/locales';
|
|
40
|
+
import Menu3 from '@mui/icons-material/Menu';
|
|
41
|
+
import MenuOpen from '@mui/icons-material/MenuOpen';
|
|
42
|
+
import useLocalStorageState from 'use-local-storage-state';
|
|
43
|
+
export { default as useLocalStorageState } from 'use-local-storage-state';
|
|
44
|
+
import { csCZ as csCZ$2, enUS as enUS$2 } from '@mui/material/locale';
|
|
45
|
+
import { csCZ as csCZ$1, enUS as enUS$1 } from '@mui/x-data-grid-premium/locales';
|
|
46
|
+
import { csCZ, enUS } from '@mui/x-date-pickers-pro/locales';
|
|
47
|
+
import Box6 from '@mui/material/Box';
|
|
48
|
+
import Drawer from '@mui/material/Drawer';
|
|
49
|
+
import Divider3 from '@mui/material/Divider';
|
|
50
|
+
import List3 from '@mui/material/List';
|
|
51
|
+
import ListSubheader$1 from '@mui/material/ListSubheader';
|
|
52
|
+
import ExpandMoreIcon from '@mui/icons-material/ExpandMore';
|
|
53
|
+
import Avatar$1 from '@mui/material/Avatar';
|
|
54
|
+
import Popper from '@mui/material/Popper';
|
|
55
|
+
import ListItem$1 from '@mui/material/ListItem';
|
|
56
|
+
import ListItemButton4 from '@mui/material/ListItemButton';
|
|
57
|
+
import ListItemIcon3 from '@mui/material/ListItemIcon';
|
|
58
|
+
import ListItemText3 from '@mui/material/ListItemText';
|
|
59
|
+
import Paper2 from '@mui/material/Paper';
|
|
60
|
+
import Typography7 from '@mui/material/Typography';
|
|
61
|
+
import AccountCircle from '@mui/icons-material/AccountCircle';
|
|
62
|
+
import ArrowBack from '@mui/icons-material/ArrowBack';
|
|
63
|
+
import Brightness4 from '@mui/icons-material/Brightness4';
|
|
64
|
+
import ChevronRight from '@mui/icons-material/ChevronRight';
|
|
65
|
+
import DarkMode from '@mui/icons-material/DarkMode';
|
|
66
|
+
import LightMode from '@mui/icons-material/LightMode';
|
|
67
|
+
import Login from '@mui/icons-material/Login';
|
|
68
|
+
import Logout from '@mui/icons-material/Logout';
|
|
69
|
+
import SettingsBrightness from '@mui/icons-material/SettingsBrightness';
|
|
70
|
+
import Translate from '@mui/icons-material/Translate';
|
|
71
|
+
import 'keycloak-js';
|
|
72
|
+
import default2 from 'i18next';
|
|
73
|
+
export { t } from 'i18next';
|
|
74
|
+
import LanguageDetector from 'i18next-browser-languagedetector';
|
|
75
|
+
import HttpBackend from 'i18next-http-backend';
|
|
76
|
+
import { createFormHookContexts, createFormHook } from '@tanstack/react-form';
|
|
77
|
+
import { DateTimePicker, DatePicker } from '@mui/x-date-pickers-pro';
|
|
78
|
+
import { NumericFormat } from 'react-number-format';
|
|
79
|
+
|
|
80
|
+
var __create = Object.create;
|
|
81
|
+
var __defProp = Object.defineProperty;
|
|
82
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
83
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
84
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
85
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
86
|
+
var __commonJS = (cb, mod) => function __require() {
|
|
87
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
88
|
+
};
|
|
89
|
+
var __copyProps = (to, from, except, desc) => {
|
|
90
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
91
|
+
for (let key of __getOwnPropNames(from))
|
|
92
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
93
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
94
|
+
}
|
|
95
|
+
return to;
|
|
96
|
+
};
|
|
97
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
98
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
99
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
100
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
101
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
102
|
+
__defProp(target, "default", { value: mod, enumerable: true }) ,
|
|
103
|
+
mod
|
|
104
|
+
));
|
|
105
|
+
|
|
106
|
+
// node_modules/prop-types/node_modules/react-is/cjs/react-is.production.min.js
|
|
107
|
+
var require_react_is_production_min = __commonJS({
|
|
108
|
+
"node_modules/prop-types/node_modules/react-is/cjs/react-is.production.min.js"(exports) {
|
|
109
|
+
var b = "function" === typeof Symbol && Symbol.for;
|
|
110
|
+
var c = b ? Symbol.for("react.element") : 60103;
|
|
111
|
+
var d = b ? Symbol.for("react.portal") : 60106;
|
|
112
|
+
var e = b ? Symbol.for("react.fragment") : 60107;
|
|
113
|
+
var f = b ? Symbol.for("react.strict_mode") : 60108;
|
|
114
|
+
var g = b ? Symbol.for("react.profiler") : 60114;
|
|
115
|
+
var h = b ? Symbol.for("react.provider") : 60109;
|
|
116
|
+
var k = b ? Symbol.for("react.context") : 60110;
|
|
117
|
+
var l = b ? Symbol.for("react.async_mode") : 60111;
|
|
118
|
+
var m = b ? Symbol.for("react.concurrent_mode") : 60111;
|
|
119
|
+
var n = b ? Symbol.for("react.forward_ref") : 60112;
|
|
120
|
+
var p = b ? Symbol.for("react.suspense") : 60113;
|
|
121
|
+
var q = b ? Symbol.for("react.suspense_list") : 60120;
|
|
122
|
+
var r = b ? Symbol.for("react.memo") : 60115;
|
|
123
|
+
var t2 = b ? Symbol.for("react.lazy") : 60116;
|
|
124
|
+
var v = b ? Symbol.for("react.block") : 60121;
|
|
125
|
+
var w = b ? Symbol.for("react.fundamental") : 60117;
|
|
126
|
+
var x = b ? Symbol.for("react.responder") : 60118;
|
|
127
|
+
var y = b ? Symbol.for("react.scope") : 60119;
|
|
128
|
+
function z2(a) {
|
|
129
|
+
if ("object" === typeof a && null !== a) {
|
|
130
|
+
var u = a.$$typeof;
|
|
131
|
+
switch (u) {
|
|
132
|
+
case c:
|
|
133
|
+
switch (a = a.type, a) {
|
|
134
|
+
case l:
|
|
135
|
+
case m:
|
|
136
|
+
case e:
|
|
137
|
+
case g:
|
|
138
|
+
case f:
|
|
139
|
+
case p:
|
|
140
|
+
return a;
|
|
141
|
+
default:
|
|
142
|
+
switch (a = a && a.$$typeof, a) {
|
|
143
|
+
case k:
|
|
144
|
+
case n:
|
|
145
|
+
case t2:
|
|
146
|
+
case r:
|
|
147
|
+
case h:
|
|
148
|
+
return a;
|
|
149
|
+
default:
|
|
150
|
+
return u;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
case d:
|
|
154
|
+
return u;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
function A(a) {
|
|
159
|
+
return z2(a) === m;
|
|
160
|
+
}
|
|
161
|
+
exports.AsyncMode = l;
|
|
162
|
+
exports.ConcurrentMode = m;
|
|
163
|
+
exports.ContextConsumer = k;
|
|
164
|
+
exports.ContextProvider = h;
|
|
165
|
+
exports.Element = c;
|
|
166
|
+
exports.ForwardRef = n;
|
|
167
|
+
exports.Fragment = e;
|
|
168
|
+
exports.Lazy = t2;
|
|
169
|
+
exports.Memo = r;
|
|
170
|
+
exports.Portal = d;
|
|
171
|
+
exports.Profiler = g;
|
|
172
|
+
exports.StrictMode = f;
|
|
173
|
+
exports.Suspense = p;
|
|
174
|
+
exports.isAsyncMode = function(a) {
|
|
175
|
+
return A(a) || z2(a) === l;
|
|
176
|
+
};
|
|
177
|
+
exports.isConcurrentMode = A;
|
|
178
|
+
exports.isContextConsumer = function(a) {
|
|
179
|
+
return z2(a) === k;
|
|
180
|
+
};
|
|
181
|
+
exports.isContextProvider = function(a) {
|
|
182
|
+
return z2(a) === h;
|
|
183
|
+
};
|
|
184
|
+
exports.isElement = function(a) {
|
|
185
|
+
return "object" === typeof a && null !== a && a.$$typeof === c;
|
|
186
|
+
};
|
|
187
|
+
exports.isForwardRef = function(a) {
|
|
188
|
+
return z2(a) === n;
|
|
189
|
+
};
|
|
190
|
+
exports.isFragment = function(a) {
|
|
191
|
+
return z2(a) === e;
|
|
192
|
+
};
|
|
193
|
+
exports.isLazy = function(a) {
|
|
194
|
+
return z2(a) === t2;
|
|
195
|
+
};
|
|
196
|
+
exports.isMemo = function(a) {
|
|
197
|
+
return z2(a) === r;
|
|
198
|
+
};
|
|
199
|
+
exports.isPortal = function(a) {
|
|
200
|
+
return z2(a) === d;
|
|
201
|
+
};
|
|
202
|
+
exports.isProfiler = function(a) {
|
|
203
|
+
return z2(a) === g;
|
|
204
|
+
};
|
|
205
|
+
exports.isStrictMode = function(a) {
|
|
206
|
+
return z2(a) === f;
|
|
207
|
+
};
|
|
208
|
+
exports.isSuspense = function(a) {
|
|
209
|
+
return z2(a) === p;
|
|
210
|
+
};
|
|
211
|
+
exports.isValidElementType = function(a) {
|
|
212
|
+
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);
|
|
213
|
+
};
|
|
214
|
+
exports.typeOf = z2;
|
|
215
|
+
}
|
|
216
|
+
});
|
|
217
|
+
|
|
218
|
+
// node_modules/prop-types/node_modules/react-is/cjs/react-is.development.js
|
|
219
|
+
var require_react_is_development = __commonJS({
|
|
220
|
+
"node_modules/prop-types/node_modules/react-is/cjs/react-is.development.js"(exports) {
|
|
221
|
+
if (process.env.NODE_ENV !== "production") {
|
|
222
|
+
(function() {
|
|
223
|
+
var hasSymbol = typeof Symbol === "function" && Symbol.for;
|
|
224
|
+
var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for("react.element") : 60103;
|
|
225
|
+
var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for("react.portal") : 60106;
|
|
226
|
+
var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for("react.fragment") : 60107;
|
|
227
|
+
var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for("react.strict_mode") : 60108;
|
|
228
|
+
var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for("react.profiler") : 60114;
|
|
229
|
+
var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for("react.provider") : 60109;
|
|
230
|
+
var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for("react.context") : 60110;
|
|
231
|
+
var REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol.for("react.async_mode") : 60111;
|
|
232
|
+
var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for("react.concurrent_mode") : 60111;
|
|
233
|
+
var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for("react.forward_ref") : 60112;
|
|
234
|
+
var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for("react.suspense") : 60113;
|
|
235
|
+
var REACT_SUSPENSE_LIST_TYPE = hasSymbol ? Symbol.for("react.suspense_list") : 60120;
|
|
236
|
+
var REACT_MEMO_TYPE = hasSymbol ? Symbol.for("react.memo") : 60115;
|
|
237
|
+
var REACT_LAZY_TYPE = hasSymbol ? Symbol.for("react.lazy") : 60116;
|
|
238
|
+
var REACT_BLOCK_TYPE = hasSymbol ? Symbol.for("react.block") : 60121;
|
|
239
|
+
var REACT_FUNDAMENTAL_TYPE = hasSymbol ? Symbol.for("react.fundamental") : 60117;
|
|
240
|
+
var REACT_RESPONDER_TYPE = hasSymbol ? Symbol.for("react.responder") : 60118;
|
|
241
|
+
var REACT_SCOPE_TYPE = hasSymbol ? Symbol.for("react.scope") : 60119;
|
|
242
|
+
function isValidElementType(type) {
|
|
243
|
+
return typeof type === "string" || typeof type === "function" || // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.
|
|
244
|
+
type === REACT_FRAGMENT_TYPE || type === REACT_CONCURRENT_MODE_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || typeof type === "object" && type !== null && (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_FUNDAMENTAL_TYPE || type.$$typeof === REACT_RESPONDER_TYPE || type.$$typeof === REACT_SCOPE_TYPE || type.$$typeof === REACT_BLOCK_TYPE);
|
|
245
|
+
}
|
|
246
|
+
function typeOf(object) {
|
|
247
|
+
if (typeof object === "object" && object !== null) {
|
|
248
|
+
var $$typeof = object.$$typeof;
|
|
249
|
+
switch ($$typeof) {
|
|
250
|
+
case REACT_ELEMENT_TYPE:
|
|
251
|
+
var type = object.type;
|
|
252
|
+
switch (type) {
|
|
253
|
+
case REACT_ASYNC_MODE_TYPE:
|
|
254
|
+
case REACT_CONCURRENT_MODE_TYPE:
|
|
255
|
+
case REACT_FRAGMENT_TYPE:
|
|
256
|
+
case REACT_PROFILER_TYPE:
|
|
257
|
+
case REACT_STRICT_MODE_TYPE:
|
|
258
|
+
case REACT_SUSPENSE_TYPE:
|
|
259
|
+
return type;
|
|
260
|
+
default:
|
|
261
|
+
var $$typeofType = type && type.$$typeof;
|
|
262
|
+
switch ($$typeofType) {
|
|
263
|
+
case REACT_CONTEXT_TYPE:
|
|
264
|
+
case REACT_FORWARD_REF_TYPE:
|
|
265
|
+
case REACT_LAZY_TYPE:
|
|
266
|
+
case REACT_MEMO_TYPE:
|
|
267
|
+
case REACT_PROVIDER_TYPE:
|
|
268
|
+
return $$typeofType;
|
|
269
|
+
default:
|
|
270
|
+
return $$typeof;
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
case REACT_PORTAL_TYPE:
|
|
274
|
+
return $$typeof;
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
return void 0;
|
|
278
|
+
}
|
|
279
|
+
var AsyncMode = REACT_ASYNC_MODE_TYPE;
|
|
280
|
+
var ConcurrentMode = REACT_CONCURRENT_MODE_TYPE;
|
|
281
|
+
var ContextConsumer = REACT_CONTEXT_TYPE;
|
|
282
|
+
var ContextProvider = REACT_PROVIDER_TYPE;
|
|
283
|
+
var Element = REACT_ELEMENT_TYPE;
|
|
284
|
+
var ForwardRef = REACT_FORWARD_REF_TYPE;
|
|
285
|
+
var Fragment7 = REACT_FRAGMENT_TYPE;
|
|
286
|
+
var Lazy = REACT_LAZY_TYPE;
|
|
287
|
+
var Memo = REACT_MEMO_TYPE;
|
|
288
|
+
var Portal = REACT_PORTAL_TYPE;
|
|
289
|
+
var Profiler = REACT_PROFILER_TYPE;
|
|
290
|
+
var StrictMode = REACT_STRICT_MODE_TYPE;
|
|
291
|
+
var Suspense = REACT_SUSPENSE_TYPE;
|
|
292
|
+
var hasWarnedAboutDeprecatedIsAsyncMode = false;
|
|
293
|
+
function isAsyncMode(object) {
|
|
294
|
+
{
|
|
295
|
+
if (!hasWarnedAboutDeprecatedIsAsyncMode) {
|
|
296
|
+
hasWarnedAboutDeprecatedIsAsyncMode = true;
|
|
297
|
+
console["warn"]("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.");
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
return isConcurrentMode(object) || typeOf(object) === REACT_ASYNC_MODE_TYPE;
|
|
301
|
+
}
|
|
302
|
+
function isConcurrentMode(object) {
|
|
303
|
+
return typeOf(object) === REACT_CONCURRENT_MODE_TYPE;
|
|
304
|
+
}
|
|
305
|
+
function isContextConsumer(object) {
|
|
306
|
+
return typeOf(object) === REACT_CONTEXT_TYPE;
|
|
307
|
+
}
|
|
308
|
+
function isContextProvider(object) {
|
|
309
|
+
return typeOf(object) === REACT_PROVIDER_TYPE;
|
|
310
|
+
}
|
|
311
|
+
function isElement(object) {
|
|
312
|
+
return typeof object === "object" && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
|
|
313
|
+
}
|
|
314
|
+
function isForwardRef(object) {
|
|
315
|
+
return typeOf(object) === REACT_FORWARD_REF_TYPE;
|
|
316
|
+
}
|
|
317
|
+
function isFragment(object) {
|
|
318
|
+
return typeOf(object) === REACT_FRAGMENT_TYPE;
|
|
319
|
+
}
|
|
320
|
+
function isLazy(object) {
|
|
321
|
+
return typeOf(object) === REACT_LAZY_TYPE;
|
|
322
|
+
}
|
|
323
|
+
function isMemo(object) {
|
|
324
|
+
return typeOf(object) === REACT_MEMO_TYPE;
|
|
325
|
+
}
|
|
326
|
+
function isPortal(object) {
|
|
327
|
+
return typeOf(object) === REACT_PORTAL_TYPE;
|
|
328
|
+
}
|
|
329
|
+
function isProfiler(object) {
|
|
330
|
+
return typeOf(object) === REACT_PROFILER_TYPE;
|
|
331
|
+
}
|
|
332
|
+
function isStrictMode(object) {
|
|
333
|
+
return typeOf(object) === REACT_STRICT_MODE_TYPE;
|
|
334
|
+
}
|
|
335
|
+
function isSuspense(object) {
|
|
336
|
+
return typeOf(object) === REACT_SUSPENSE_TYPE;
|
|
337
|
+
}
|
|
338
|
+
exports.AsyncMode = AsyncMode;
|
|
339
|
+
exports.ConcurrentMode = ConcurrentMode;
|
|
340
|
+
exports.ContextConsumer = ContextConsumer;
|
|
341
|
+
exports.ContextProvider = ContextProvider;
|
|
342
|
+
exports.Element = Element;
|
|
343
|
+
exports.ForwardRef = ForwardRef;
|
|
344
|
+
exports.Fragment = Fragment7;
|
|
345
|
+
exports.Lazy = Lazy;
|
|
346
|
+
exports.Memo = Memo;
|
|
347
|
+
exports.Portal = Portal;
|
|
348
|
+
exports.Profiler = Profiler;
|
|
349
|
+
exports.StrictMode = StrictMode;
|
|
350
|
+
exports.Suspense = Suspense;
|
|
351
|
+
exports.isAsyncMode = isAsyncMode;
|
|
352
|
+
exports.isConcurrentMode = isConcurrentMode;
|
|
353
|
+
exports.isContextConsumer = isContextConsumer;
|
|
354
|
+
exports.isContextProvider = isContextProvider;
|
|
355
|
+
exports.isElement = isElement;
|
|
356
|
+
exports.isForwardRef = isForwardRef;
|
|
357
|
+
exports.isFragment = isFragment;
|
|
358
|
+
exports.isLazy = isLazy;
|
|
359
|
+
exports.isMemo = isMemo;
|
|
360
|
+
exports.isPortal = isPortal;
|
|
361
|
+
exports.isProfiler = isProfiler;
|
|
362
|
+
exports.isStrictMode = isStrictMode;
|
|
363
|
+
exports.isSuspense = isSuspense;
|
|
364
|
+
exports.isValidElementType = isValidElementType;
|
|
365
|
+
exports.typeOf = typeOf;
|
|
366
|
+
})();
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
});
|
|
370
|
+
|
|
371
|
+
// node_modules/prop-types/node_modules/react-is/index.js
|
|
372
|
+
var require_react_is = __commonJS({
|
|
373
|
+
"node_modules/prop-types/node_modules/react-is/index.js"(exports, module) {
|
|
374
|
+
if (process.env.NODE_ENV === "production") {
|
|
375
|
+
module.exports = require_react_is_production_min();
|
|
376
|
+
} else {
|
|
377
|
+
module.exports = require_react_is_development();
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
});
|
|
381
|
+
|
|
382
|
+
// node_modules/object-assign/index.js
|
|
383
|
+
var require_object_assign = __commonJS({
|
|
384
|
+
"node_modules/object-assign/index.js"(exports, module) {
|
|
385
|
+
var getOwnPropertySymbols = Object.getOwnPropertySymbols;
|
|
386
|
+
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
387
|
+
var propIsEnumerable = Object.prototype.propertyIsEnumerable;
|
|
388
|
+
function toObject(val) {
|
|
389
|
+
if (val === null || val === void 0) {
|
|
390
|
+
throw new TypeError("Object.assign cannot be called with null or undefined");
|
|
391
|
+
}
|
|
392
|
+
return Object(val);
|
|
393
|
+
}
|
|
394
|
+
function shouldUseNative() {
|
|
395
|
+
try {
|
|
396
|
+
if (!Object.assign) {
|
|
397
|
+
return false;
|
|
398
|
+
}
|
|
399
|
+
var test1 = new String("abc");
|
|
400
|
+
test1[5] = "de";
|
|
401
|
+
if (Object.getOwnPropertyNames(test1)[0] === "5") {
|
|
402
|
+
return false;
|
|
403
|
+
}
|
|
404
|
+
var test2 = {};
|
|
405
|
+
for (var i = 0; i < 10; i++) {
|
|
406
|
+
test2["_" + String.fromCharCode(i)] = i;
|
|
407
|
+
}
|
|
408
|
+
var order2 = Object.getOwnPropertyNames(test2).map(function(n) {
|
|
409
|
+
return test2[n];
|
|
410
|
+
});
|
|
411
|
+
if (order2.join("") !== "0123456789") {
|
|
412
|
+
return false;
|
|
413
|
+
}
|
|
414
|
+
var test3 = {};
|
|
415
|
+
"abcdefghijklmnopqrst".split("").forEach(function(letter) {
|
|
416
|
+
test3[letter] = letter;
|
|
417
|
+
});
|
|
418
|
+
if (Object.keys(Object.assign({}, test3)).join("") !== "abcdefghijklmnopqrst") {
|
|
419
|
+
return false;
|
|
420
|
+
}
|
|
421
|
+
return true;
|
|
422
|
+
} catch (err) {
|
|
423
|
+
return false;
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
module.exports = shouldUseNative() ? Object.assign : function(target, source) {
|
|
427
|
+
var from;
|
|
428
|
+
var to = toObject(target);
|
|
429
|
+
var symbols;
|
|
430
|
+
for (var s = 1; s < arguments.length; s++) {
|
|
431
|
+
from = Object(arguments[s]);
|
|
432
|
+
for (var key in from) {
|
|
433
|
+
if (hasOwnProperty.call(from, key)) {
|
|
434
|
+
to[key] = from[key];
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
if (getOwnPropertySymbols) {
|
|
438
|
+
symbols = getOwnPropertySymbols(from);
|
|
439
|
+
for (var i = 0; i < symbols.length; i++) {
|
|
440
|
+
if (propIsEnumerable.call(from, symbols[i])) {
|
|
441
|
+
to[symbols[i]] = from[symbols[i]];
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
return to;
|
|
447
|
+
};
|
|
448
|
+
}
|
|
449
|
+
});
|
|
450
|
+
|
|
451
|
+
// node_modules/prop-types/lib/ReactPropTypesSecret.js
|
|
452
|
+
var require_ReactPropTypesSecret = __commonJS({
|
|
453
|
+
"node_modules/prop-types/lib/ReactPropTypesSecret.js"(exports, module) {
|
|
454
|
+
var ReactPropTypesSecret = "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";
|
|
455
|
+
module.exports = ReactPropTypesSecret;
|
|
456
|
+
}
|
|
457
|
+
});
|
|
458
|
+
|
|
459
|
+
// node_modules/prop-types/lib/has.js
|
|
460
|
+
var require_has = __commonJS({
|
|
461
|
+
"node_modules/prop-types/lib/has.js"(exports, module) {
|
|
462
|
+
module.exports = Function.call.bind(Object.prototype.hasOwnProperty);
|
|
463
|
+
}
|
|
464
|
+
});
|
|
465
|
+
|
|
466
|
+
// node_modules/prop-types/checkPropTypes.js
|
|
467
|
+
var require_checkPropTypes = __commonJS({
|
|
468
|
+
"node_modules/prop-types/checkPropTypes.js"(exports, module) {
|
|
469
|
+
var printWarning = function() {
|
|
470
|
+
};
|
|
471
|
+
if (process.env.NODE_ENV !== "production") {
|
|
472
|
+
ReactPropTypesSecret = require_ReactPropTypesSecret();
|
|
473
|
+
loggedTypeFailures = {};
|
|
474
|
+
has = require_has();
|
|
475
|
+
printWarning = function(text) {
|
|
476
|
+
var message = "Warning: " + text;
|
|
477
|
+
if (typeof console !== "undefined") {
|
|
478
|
+
console.error(message);
|
|
479
|
+
}
|
|
480
|
+
try {
|
|
481
|
+
throw new Error(message);
|
|
482
|
+
} catch (x) {
|
|
483
|
+
}
|
|
484
|
+
};
|
|
485
|
+
}
|
|
486
|
+
var ReactPropTypesSecret;
|
|
487
|
+
var loggedTypeFailures;
|
|
488
|
+
var has;
|
|
489
|
+
function checkPropTypes(typeSpecs, values, location, componentName, getStack) {
|
|
490
|
+
if (process.env.NODE_ENV !== "production") {
|
|
491
|
+
for (var typeSpecName in typeSpecs) {
|
|
492
|
+
if (has(typeSpecs, typeSpecName)) {
|
|
493
|
+
var error;
|
|
494
|
+
try {
|
|
495
|
+
if (typeof typeSpecs[typeSpecName] !== "function") {
|
|
496
|
+
var err = Error(
|
|
497
|
+
(componentName || "React class") + ": " + location + " type `" + typeSpecName + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof typeSpecs[typeSpecName] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`."
|
|
498
|
+
);
|
|
499
|
+
err.name = "Invariant Violation";
|
|
500
|
+
throw err;
|
|
501
|
+
}
|
|
502
|
+
error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret);
|
|
503
|
+
} catch (ex) {
|
|
504
|
+
error = ex;
|
|
505
|
+
}
|
|
506
|
+
if (error && !(error instanceof Error)) {
|
|
507
|
+
printWarning(
|
|
508
|
+
(componentName || "React class") + ": type specification of " + location + " `" + typeSpecName + "` is invalid; the type checker function must return `null` or an `Error` but returned a " + typeof error + ". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."
|
|
509
|
+
);
|
|
510
|
+
}
|
|
511
|
+
if (error instanceof Error && !(error.message in loggedTypeFailures)) {
|
|
512
|
+
loggedTypeFailures[error.message] = true;
|
|
513
|
+
var stack = getStack ? getStack() : "";
|
|
514
|
+
printWarning(
|
|
515
|
+
"Failed " + location + " type: " + error.message + (stack != null ? stack : "")
|
|
516
|
+
);
|
|
517
|
+
}
|
|
518
|
+
}
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
checkPropTypes.resetWarningCache = function() {
|
|
523
|
+
if (process.env.NODE_ENV !== "production") {
|
|
524
|
+
loggedTypeFailures = {};
|
|
525
|
+
}
|
|
526
|
+
};
|
|
527
|
+
module.exports = checkPropTypes;
|
|
528
|
+
}
|
|
529
|
+
});
|
|
530
|
+
|
|
531
|
+
// node_modules/prop-types/factoryWithTypeCheckers.js
|
|
532
|
+
var require_factoryWithTypeCheckers = __commonJS({
|
|
533
|
+
"node_modules/prop-types/factoryWithTypeCheckers.js"(exports, module) {
|
|
534
|
+
var ReactIs = require_react_is();
|
|
535
|
+
var assign = require_object_assign();
|
|
536
|
+
var ReactPropTypesSecret = require_ReactPropTypesSecret();
|
|
537
|
+
var has = require_has();
|
|
538
|
+
var checkPropTypes = require_checkPropTypes();
|
|
539
|
+
var printWarning = function() {
|
|
540
|
+
};
|
|
541
|
+
if (process.env.NODE_ENV !== "production") {
|
|
542
|
+
printWarning = function(text) {
|
|
543
|
+
var message = "Warning: " + text;
|
|
544
|
+
if (typeof console !== "undefined") {
|
|
545
|
+
console.error(message);
|
|
546
|
+
}
|
|
547
|
+
try {
|
|
548
|
+
throw new Error(message);
|
|
549
|
+
} catch (x) {
|
|
550
|
+
}
|
|
551
|
+
};
|
|
552
|
+
}
|
|
553
|
+
function emptyFunctionThatReturnsNull() {
|
|
554
|
+
return null;
|
|
555
|
+
}
|
|
556
|
+
module.exports = function(isValidElement, throwOnDirectAccess) {
|
|
557
|
+
var ITERATOR_SYMBOL = typeof Symbol === "function" && Symbol.iterator;
|
|
558
|
+
var FAUX_ITERATOR_SYMBOL = "@@iterator";
|
|
559
|
+
function getIteratorFn(maybeIterable) {
|
|
560
|
+
var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]);
|
|
561
|
+
if (typeof iteratorFn === "function") {
|
|
562
|
+
return iteratorFn;
|
|
563
|
+
}
|
|
564
|
+
}
|
|
565
|
+
var ANONYMOUS = "<<anonymous>>";
|
|
566
|
+
var ReactPropTypes = {
|
|
567
|
+
array: createPrimitiveTypeChecker("array"),
|
|
568
|
+
bigint: createPrimitiveTypeChecker("bigint"),
|
|
569
|
+
bool: createPrimitiveTypeChecker("boolean"),
|
|
570
|
+
func: createPrimitiveTypeChecker("function"),
|
|
571
|
+
number: createPrimitiveTypeChecker("number"),
|
|
572
|
+
object: createPrimitiveTypeChecker("object"),
|
|
573
|
+
string: createPrimitiveTypeChecker("string"),
|
|
574
|
+
symbol: createPrimitiveTypeChecker("symbol"),
|
|
575
|
+
any: createAnyTypeChecker(),
|
|
576
|
+
arrayOf: createArrayOfTypeChecker,
|
|
577
|
+
element: createElementTypeChecker(),
|
|
578
|
+
elementType: createElementTypeTypeChecker(),
|
|
579
|
+
instanceOf: createInstanceTypeChecker,
|
|
580
|
+
node: createNodeChecker(),
|
|
581
|
+
objectOf: createObjectOfTypeChecker,
|
|
582
|
+
oneOf: createEnumTypeChecker,
|
|
583
|
+
oneOfType: createUnionTypeChecker,
|
|
584
|
+
shape: createShapeTypeChecker,
|
|
585
|
+
exact: createStrictShapeTypeChecker
|
|
586
|
+
};
|
|
587
|
+
function is(x, y) {
|
|
588
|
+
if (x === y) {
|
|
589
|
+
return x !== 0 || 1 / x === 1 / y;
|
|
590
|
+
} else {
|
|
591
|
+
return x !== x && y !== y;
|
|
592
|
+
}
|
|
593
|
+
}
|
|
594
|
+
function PropTypeError(message, data) {
|
|
595
|
+
this.message = message;
|
|
596
|
+
this.data = data && typeof data === "object" ? data : {};
|
|
597
|
+
this.stack = "";
|
|
598
|
+
}
|
|
599
|
+
PropTypeError.prototype = Error.prototype;
|
|
600
|
+
function createChainableTypeChecker(validate) {
|
|
601
|
+
if (process.env.NODE_ENV !== "production") {
|
|
602
|
+
var manualPropTypeCallCache = {};
|
|
603
|
+
var manualPropTypeWarningCount = 0;
|
|
604
|
+
}
|
|
605
|
+
function checkType(isRequired, props, propName, componentName, location, propFullName, secret) {
|
|
606
|
+
componentName = componentName || ANONYMOUS;
|
|
607
|
+
propFullName = propFullName || propName;
|
|
608
|
+
if (secret !== ReactPropTypesSecret) {
|
|
609
|
+
if (throwOnDirectAccess) {
|
|
610
|
+
var err = new Error(
|
|
611
|
+
"Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types"
|
|
612
|
+
);
|
|
613
|
+
err.name = "Invariant Violation";
|
|
614
|
+
throw err;
|
|
615
|
+
} else if (process.env.NODE_ENV !== "production" && typeof console !== "undefined") {
|
|
616
|
+
var cacheKey = componentName + ":" + propName;
|
|
617
|
+
if (!manualPropTypeCallCache[cacheKey] && // Avoid spamming the console because they are often not actionable except for lib authors
|
|
618
|
+
manualPropTypeWarningCount < 3) {
|
|
619
|
+
printWarning(
|
|
620
|
+
"You are manually calling a React.PropTypes validation function for the `" + propFullName + "` prop on `" + componentName + "`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details."
|
|
621
|
+
);
|
|
622
|
+
manualPropTypeCallCache[cacheKey] = true;
|
|
623
|
+
manualPropTypeWarningCount++;
|
|
624
|
+
}
|
|
625
|
+
}
|
|
626
|
+
}
|
|
627
|
+
if (props[propName] == null) {
|
|
628
|
+
if (isRequired) {
|
|
629
|
+
if (props[propName] === null) {
|
|
630
|
+
return new PropTypeError("The " + location + " `" + propFullName + "` is marked as required " + ("in `" + componentName + "`, but its value is `null`."));
|
|
631
|
+
}
|
|
632
|
+
return new PropTypeError("The " + location + " `" + propFullName + "` is marked as required in " + ("`" + componentName + "`, but its value is `undefined`."));
|
|
633
|
+
}
|
|
634
|
+
return null;
|
|
635
|
+
} else {
|
|
636
|
+
return validate(props, propName, componentName, location, propFullName);
|
|
637
|
+
}
|
|
638
|
+
}
|
|
639
|
+
var chainedCheckType = checkType.bind(null, false);
|
|
640
|
+
chainedCheckType.isRequired = checkType.bind(null, true);
|
|
641
|
+
return chainedCheckType;
|
|
642
|
+
}
|
|
643
|
+
function createPrimitiveTypeChecker(expectedType) {
|
|
644
|
+
function validate(props, propName, componentName, location, propFullName, secret) {
|
|
645
|
+
var propValue = props[propName];
|
|
646
|
+
var propType = getPropType(propValue);
|
|
647
|
+
if (propType !== expectedType) {
|
|
648
|
+
var preciseType = getPreciseType(propValue);
|
|
649
|
+
return new PropTypeError(
|
|
650
|
+
"Invalid " + location + " `" + propFullName + "` of type " + ("`" + preciseType + "` supplied to `" + componentName + "`, expected ") + ("`" + expectedType + "`."),
|
|
651
|
+
{ expectedType }
|
|
652
|
+
);
|
|
653
|
+
}
|
|
654
|
+
return null;
|
|
655
|
+
}
|
|
656
|
+
return createChainableTypeChecker(validate);
|
|
657
|
+
}
|
|
658
|
+
function createAnyTypeChecker() {
|
|
659
|
+
return createChainableTypeChecker(emptyFunctionThatReturnsNull);
|
|
660
|
+
}
|
|
661
|
+
function createArrayOfTypeChecker(typeChecker) {
|
|
662
|
+
function validate(props, propName, componentName, location, propFullName) {
|
|
663
|
+
if (typeof typeChecker !== "function") {
|
|
664
|
+
return new PropTypeError("Property `" + propFullName + "` of component `" + componentName + "` has invalid PropType notation inside arrayOf.");
|
|
665
|
+
}
|
|
666
|
+
var propValue = props[propName];
|
|
667
|
+
if (!Array.isArray(propValue)) {
|
|
668
|
+
var propType = getPropType(propValue);
|
|
669
|
+
return new PropTypeError("Invalid " + location + " `" + propFullName + "` of type " + ("`" + propType + "` supplied to `" + componentName + "`, expected an array."));
|
|
670
|
+
}
|
|
671
|
+
for (var i = 0; i < propValue.length; i++) {
|
|
672
|
+
var error = typeChecker(propValue, i, componentName, location, propFullName + "[" + i + "]", ReactPropTypesSecret);
|
|
673
|
+
if (error instanceof Error) {
|
|
674
|
+
return error;
|
|
675
|
+
}
|
|
676
|
+
}
|
|
677
|
+
return null;
|
|
678
|
+
}
|
|
679
|
+
return createChainableTypeChecker(validate);
|
|
680
|
+
}
|
|
681
|
+
function createElementTypeChecker() {
|
|
682
|
+
function validate(props, propName, componentName, location, propFullName) {
|
|
683
|
+
var propValue = props[propName];
|
|
684
|
+
if (!isValidElement(propValue)) {
|
|
685
|
+
var propType = getPropType(propValue);
|
|
686
|
+
return new PropTypeError("Invalid " + location + " `" + propFullName + "` of type " + ("`" + propType + "` supplied to `" + componentName + "`, expected a single ReactElement."));
|
|
687
|
+
}
|
|
688
|
+
return null;
|
|
689
|
+
}
|
|
690
|
+
return createChainableTypeChecker(validate);
|
|
691
|
+
}
|
|
692
|
+
function createElementTypeTypeChecker() {
|
|
693
|
+
function validate(props, propName, componentName, location, propFullName) {
|
|
694
|
+
var propValue = props[propName];
|
|
695
|
+
if (!ReactIs.isValidElementType(propValue)) {
|
|
696
|
+
var propType = getPropType(propValue);
|
|
697
|
+
return new PropTypeError("Invalid " + location + " `" + propFullName + "` of type " + ("`" + propType + "` supplied to `" + componentName + "`, expected a single ReactElement type."));
|
|
698
|
+
}
|
|
699
|
+
return null;
|
|
700
|
+
}
|
|
701
|
+
return createChainableTypeChecker(validate);
|
|
702
|
+
}
|
|
703
|
+
function createInstanceTypeChecker(expectedClass) {
|
|
704
|
+
function validate(props, propName, componentName, location, propFullName) {
|
|
705
|
+
if (!(props[propName] instanceof expectedClass)) {
|
|
706
|
+
var expectedClassName = expectedClass.name || ANONYMOUS;
|
|
707
|
+
var actualClassName = getClassName(props[propName]);
|
|
708
|
+
return new PropTypeError("Invalid " + location + " `" + propFullName + "` of type " + ("`" + actualClassName + "` supplied to `" + componentName + "`, expected ") + ("instance of `" + expectedClassName + "`."));
|
|
709
|
+
}
|
|
710
|
+
return null;
|
|
711
|
+
}
|
|
712
|
+
return createChainableTypeChecker(validate);
|
|
713
|
+
}
|
|
714
|
+
function createEnumTypeChecker(expectedValues) {
|
|
715
|
+
if (!Array.isArray(expectedValues)) {
|
|
716
|
+
if (process.env.NODE_ENV !== "production") {
|
|
717
|
+
if (arguments.length > 1) {
|
|
718
|
+
printWarning(
|
|
719
|
+
"Invalid arguments supplied to oneOf, expected an array, got " + arguments.length + " arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z])."
|
|
720
|
+
);
|
|
721
|
+
} else {
|
|
722
|
+
printWarning("Invalid argument supplied to oneOf, expected an array.");
|
|
723
|
+
}
|
|
724
|
+
}
|
|
725
|
+
return emptyFunctionThatReturnsNull;
|
|
726
|
+
}
|
|
727
|
+
function validate(props, propName, componentName, location, propFullName) {
|
|
728
|
+
var propValue = props[propName];
|
|
729
|
+
for (var i = 0; i < expectedValues.length; i++) {
|
|
730
|
+
if (is(propValue, expectedValues[i])) {
|
|
731
|
+
return null;
|
|
732
|
+
}
|
|
733
|
+
}
|
|
734
|
+
var valuesString = JSON.stringify(expectedValues, function replacer(key, value) {
|
|
735
|
+
var type = getPreciseType(value);
|
|
736
|
+
if (type === "symbol") {
|
|
737
|
+
return String(value);
|
|
738
|
+
}
|
|
739
|
+
return value;
|
|
740
|
+
});
|
|
741
|
+
return new PropTypeError("Invalid " + location + " `" + propFullName + "` of value `" + String(propValue) + "` " + ("supplied to `" + componentName + "`, expected one of " + valuesString + "."));
|
|
742
|
+
}
|
|
743
|
+
return createChainableTypeChecker(validate);
|
|
744
|
+
}
|
|
745
|
+
function createObjectOfTypeChecker(typeChecker) {
|
|
746
|
+
function validate(props, propName, componentName, location, propFullName) {
|
|
747
|
+
if (typeof typeChecker !== "function") {
|
|
748
|
+
return new PropTypeError("Property `" + propFullName + "` of component `" + componentName + "` has invalid PropType notation inside objectOf.");
|
|
749
|
+
}
|
|
750
|
+
var propValue = props[propName];
|
|
751
|
+
var propType = getPropType(propValue);
|
|
752
|
+
if (propType !== "object") {
|
|
753
|
+
return new PropTypeError("Invalid " + location + " `" + propFullName + "` of type " + ("`" + propType + "` supplied to `" + componentName + "`, expected an object."));
|
|
754
|
+
}
|
|
755
|
+
for (var key in propValue) {
|
|
756
|
+
if (has(propValue, key)) {
|
|
757
|
+
var error = typeChecker(propValue, key, componentName, location, propFullName + "." + key, ReactPropTypesSecret);
|
|
758
|
+
if (error instanceof Error) {
|
|
759
|
+
return error;
|
|
760
|
+
}
|
|
761
|
+
}
|
|
762
|
+
}
|
|
763
|
+
return null;
|
|
764
|
+
}
|
|
765
|
+
return createChainableTypeChecker(validate);
|
|
766
|
+
}
|
|
767
|
+
function createUnionTypeChecker(arrayOfTypeCheckers) {
|
|
768
|
+
if (!Array.isArray(arrayOfTypeCheckers)) {
|
|
769
|
+
process.env.NODE_ENV !== "production" ? printWarning("Invalid argument supplied to oneOfType, expected an instance of array.") : void 0;
|
|
770
|
+
return emptyFunctionThatReturnsNull;
|
|
771
|
+
}
|
|
772
|
+
for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
|
|
773
|
+
var checker = arrayOfTypeCheckers[i];
|
|
774
|
+
if (typeof checker !== "function") {
|
|
775
|
+
printWarning(
|
|
776
|
+
"Invalid argument supplied to oneOfType. Expected an array of check functions, but received " + getPostfixForTypeWarning(checker) + " at index " + i + "."
|
|
777
|
+
);
|
|
778
|
+
return emptyFunctionThatReturnsNull;
|
|
779
|
+
}
|
|
780
|
+
}
|
|
781
|
+
function validate(props, propName, componentName, location, propFullName) {
|
|
782
|
+
var expectedTypes = [];
|
|
783
|
+
for (var i2 = 0; i2 < arrayOfTypeCheckers.length; i2++) {
|
|
784
|
+
var checker2 = arrayOfTypeCheckers[i2];
|
|
785
|
+
var checkerResult = checker2(props, propName, componentName, location, propFullName, ReactPropTypesSecret);
|
|
786
|
+
if (checkerResult == null) {
|
|
787
|
+
return null;
|
|
788
|
+
}
|
|
789
|
+
if (checkerResult.data && has(checkerResult.data, "expectedType")) {
|
|
790
|
+
expectedTypes.push(checkerResult.data.expectedType);
|
|
791
|
+
}
|
|
792
|
+
}
|
|
793
|
+
var expectedTypesMessage = expectedTypes.length > 0 ? ", expected one of type [" + expectedTypes.join(", ") + "]" : "";
|
|
794
|
+
return new PropTypeError("Invalid " + location + " `" + propFullName + "` supplied to " + ("`" + componentName + "`" + expectedTypesMessage + "."));
|
|
795
|
+
}
|
|
796
|
+
return createChainableTypeChecker(validate);
|
|
797
|
+
}
|
|
798
|
+
function createNodeChecker() {
|
|
799
|
+
function validate(props, propName, componentName, location, propFullName) {
|
|
800
|
+
if (!isNode(props[propName])) {
|
|
801
|
+
return new PropTypeError("Invalid " + location + " `" + propFullName + "` supplied to " + ("`" + componentName + "`, expected a ReactNode."));
|
|
802
|
+
}
|
|
803
|
+
return null;
|
|
804
|
+
}
|
|
805
|
+
return createChainableTypeChecker(validate);
|
|
806
|
+
}
|
|
807
|
+
function invalidValidatorError(componentName, location, propFullName, key, type) {
|
|
808
|
+
return new PropTypeError(
|
|
809
|
+
(componentName || "React class") + ": " + location + " type `" + propFullName + "." + key + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + type + "`."
|
|
810
|
+
);
|
|
811
|
+
}
|
|
812
|
+
function createShapeTypeChecker(shapeTypes) {
|
|
813
|
+
function validate(props, propName, componentName, location, propFullName) {
|
|
814
|
+
var propValue = props[propName];
|
|
815
|
+
var propType = getPropType(propValue);
|
|
816
|
+
if (propType !== "object") {
|
|
817
|
+
return new PropTypeError("Invalid " + location + " `" + propFullName + "` of type `" + propType + "` " + ("supplied to `" + componentName + "`, expected `object`."));
|
|
818
|
+
}
|
|
819
|
+
for (var key in shapeTypes) {
|
|
820
|
+
var checker = shapeTypes[key];
|
|
821
|
+
if (typeof checker !== "function") {
|
|
822
|
+
return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker));
|
|
823
|
+
}
|
|
824
|
+
var error = checker(propValue, key, componentName, location, propFullName + "." + key, ReactPropTypesSecret);
|
|
825
|
+
if (error) {
|
|
826
|
+
return error;
|
|
827
|
+
}
|
|
828
|
+
}
|
|
829
|
+
return null;
|
|
830
|
+
}
|
|
831
|
+
return createChainableTypeChecker(validate);
|
|
832
|
+
}
|
|
833
|
+
function createStrictShapeTypeChecker(shapeTypes) {
|
|
834
|
+
function validate(props, propName, componentName, location, propFullName) {
|
|
835
|
+
var propValue = props[propName];
|
|
836
|
+
var propType = getPropType(propValue);
|
|
837
|
+
if (propType !== "object") {
|
|
838
|
+
return new PropTypeError("Invalid " + location + " `" + propFullName + "` of type `" + propType + "` " + ("supplied to `" + componentName + "`, expected `object`."));
|
|
839
|
+
}
|
|
840
|
+
var allKeys = assign({}, props[propName], shapeTypes);
|
|
841
|
+
for (var key in allKeys) {
|
|
842
|
+
var checker = shapeTypes[key];
|
|
843
|
+
if (has(shapeTypes, key) && typeof checker !== "function") {
|
|
844
|
+
return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker));
|
|
845
|
+
}
|
|
846
|
+
if (!checker) {
|
|
847
|
+
return new PropTypeError(
|
|
848
|
+
"Invalid " + location + " `" + propFullName + "` key `" + key + "` supplied to `" + componentName + "`.\nBad object: " + JSON.stringify(props[propName], null, " ") + "\nValid keys: " + JSON.stringify(Object.keys(shapeTypes), null, " ")
|
|
849
|
+
);
|
|
850
|
+
}
|
|
851
|
+
var error = checker(propValue, key, componentName, location, propFullName + "." + key, ReactPropTypesSecret);
|
|
852
|
+
if (error) {
|
|
853
|
+
return error;
|
|
854
|
+
}
|
|
855
|
+
}
|
|
856
|
+
return null;
|
|
857
|
+
}
|
|
858
|
+
return createChainableTypeChecker(validate);
|
|
859
|
+
}
|
|
860
|
+
function isNode(propValue) {
|
|
861
|
+
switch (typeof propValue) {
|
|
862
|
+
case "number":
|
|
863
|
+
case "string":
|
|
864
|
+
case "undefined":
|
|
865
|
+
return true;
|
|
866
|
+
case "boolean":
|
|
867
|
+
return !propValue;
|
|
868
|
+
case "object":
|
|
869
|
+
if (Array.isArray(propValue)) {
|
|
870
|
+
return propValue.every(isNode);
|
|
871
|
+
}
|
|
872
|
+
if (propValue === null || isValidElement(propValue)) {
|
|
873
|
+
return true;
|
|
874
|
+
}
|
|
875
|
+
var iteratorFn = getIteratorFn(propValue);
|
|
876
|
+
if (iteratorFn) {
|
|
877
|
+
var iterator = iteratorFn.call(propValue);
|
|
878
|
+
var step;
|
|
879
|
+
if (iteratorFn !== propValue.entries) {
|
|
880
|
+
while (!(step = iterator.next()).done) {
|
|
881
|
+
if (!isNode(step.value)) {
|
|
882
|
+
return false;
|
|
883
|
+
}
|
|
884
|
+
}
|
|
885
|
+
} else {
|
|
886
|
+
while (!(step = iterator.next()).done) {
|
|
887
|
+
var entry = step.value;
|
|
888
|
+
if (entry) {
|
|
889
|
+
if (!isNode(entry[1])) {
|
|
890
|
+
return false;
|
|
891
|
+
}
|
|
892
|
+
}
|
|
893
|
+
}
|
|
894
|
+
}
|
|
895
|
+
} else {
|
|
896
|
+
return false;
|
|
897
|
+
}
|
|
898
|
+
return true;
|
|
899
|
+
default:
|
|
900
|
+
return false;
|
|
901
|
+
}
|
|
902
|
+
}
|
|
903
|
+
function isSymbol(propType, propValue) {
|
|
904
|
+
if (propType === "symbol") {
|
|
905
|
+
return true;
|
|
906
|
+
}
|
|
907
|
+
if (!propValue) {
|
|
908
|
+
return false;
|
|
909
|
+
}
|
|
910
|
+
if (propValue["@@toStringTag"] === "Symbol") {
|
|
911
|
+
return true;
|
|
912
|
+
}
|
|
913
|
+
if (typeof Symbol === "function" && propValue instanceof Symbol) {
|
|
914
|
+
return true;
|
|
915
|
+
}
|
|
916
|
+
return false;
|
|
917
|
+
}
|
|
918
|
+
function getPropType(propValue) {
|
|
919
|
+
var propType = typeof propValue;
|
|
920
|
+
if (Array.isArray(propValue)) {
|
|
921
|
+
return "array";
|
|
922
|
+
}
|
|
923
|
+
if (propValue instanceof RegExp) {
|
|
924
|
+
return "object";
|
|
925
|
+
}
|
|
926
|
+
if (isSymbol(propType, propValue)) {
|
|
927
|
+
return "symbol";
|
|
928
|
+
}
|
|
929
|
+
return propType;
|
|
930
|
+
}
|
|
931
|
+
function getPreciseType(propValue) {
|
|
932
|
+
if (typeof propValue === "undefined" || propValue === null) {
|
|
933
|
+
return "" + propValue;
|
|
934
|
+
}
|
|
935
|
+
var propType = getPropType(propValue);
|
|
936
|
+
if (propType === "object") {
|
|
937
|
+
if (propValue instanceof Date) {
|
|
938
|
+
return "date";
|
|
939
|
+
} else if (propValue instanceof RegExp) {
|
|
940
|
+
return "regexp";
|
|
941
|
+
}
|
|
942
|
+
}
|
|
943
|
+
return propType;
|
|
944
|
+
}
|
|
945
|
+
function getPostfixForTypeWarning(value) {
|
|
946
|
+
var type = getPreciseType(value);
|
|
947
|
+
switch (type) {
|
|
948
|
+
case "array":
|
|
949
|
+
case "object":
|
|
950
|
+
return "an " + type;
|
|
951
|
+
case "boolean":
|
|
952
|
+
case "date":
|
|
953
|
+
case "regexp":
|
|
954
|
+
return "a " + type;
|
|
955
|
+
default:
|
|
956
|
+
return type;
|
|
957
|
+
}
|
|
958
|
+
}
|
|
959
|
+
function getClassName(propValue) {
|
|
960
|
+
if (!propValue.constructor || !propValue.constructor.name) {
|
|
961
|
+
return ANONYMOUS;
|
|
962
|
+
}
|
|
963
|
+
return propValue.constructor.name;
|
|
964
|
+
}
|
|
965
|
+
ReactPropTypes.checkPropTypes = checkPropTypes;
|
|
966
|
+
ReactPropTypes.resetWarningCache = checkPropTypes.resetWarningCache;
|
|
967
|
+
ReactPropTypes.PropTypes = ReactPropTypes;
|
|
968
|
+
return ReactPropTypes;
|
|
969
|
+
};
|
|
970
|
+
}
|
|
971
|
+
});
|
|
972
|
+
|
|
973
|
+
// node_modules/prop-types/factoryWithThrowingShims.js
|
|
974
|
+
var require_factoryWithThrowingShims = __commonJS({
|
|
975
|
+
"node_modules/prop-types/factoryWithThrowingShims.js"(exports, module) {
|
|
976
|
+
var ReactPropTypesSecret = require_ReactPropTypesSecret();
|
|
977
|
+
function emptyFunction() {
|
|
978
|
+
}
|
|
979
|
+
function emptyFunctionWithReset() {
|
|
980
|
+
}
|
|
981
|
+
emptyFunctionWithReset.resetWarningCache = emptyFunction;
|
|
982
|
+
module.exports = function() {
|
|
983
|
+
function shim(props, propName, componentName, location, propFullName, secret) {
|
|
984
|
+
if (secret === ReactPropTypesSecret) {
|
|
985
|
+
return;
|
|
986
|
+
}
|
|
987
|
+
var err = new Error(
|
|
988
|
+
"Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types"
|
|
989
|
+
);
|
|
990
|
+
err.name = "Invariant Violation";
|
|
991
|
+
throw err;
|
|
992
|
+
}
|
|
993
|
+
shim.isRequired = shim;
|
|
994
|
+
function getShim() {
|
|
995
|
+
return shim;
|
|
996
|
+
}
|
|
997
|
+
var ReactPropTypes = {
|
|
998
|
+
array: shim,
|
|
999
|
+
bigint: shim,
|
|
1000
|
+
bool: shim,
|
|
1001
|
+
func: shim,
|
|
1002
|
+
number: shim,
|
|
1003
|
+
object: shim,
|
|
1004
|
+
string: shim,
|
|
1005
|
+
symbol: shim,
|
|
1006
|
+
any: shim,
|
|
1007
|
+
arrayOf: getShim,
|
|
1008
|
+
element: shim,
|
|
1009
|
+
elementType: shim,
|
|
1010
|
+
instanceOf: getShim,
|
|
1011
|
+
node: shim,
|
|
1012
|
+
objectOf: getShim,
|
|
1013
|
+
oneOf: getShim,
|
|
1014
|
+
oneOfType: getShim,
|
|
1015
|
+
shape: getShim,
|
|
1016
|
+
exact: getShim,
|
|
1017
|
+
checkPropTypes: emptyFunctionWithReset,
|
|
1018
|
+
resetWarningCache: emptyFunction
|
|
1019
|
+
};
|
|
1020
|
+
ReactPropTypes.PropTypes = ReactPropTypes;
|
|
1021
|
+
return ReactPropTypes;
|
|
1022
|
+
};
|
|
1023
|
+
}
|
|
1024
|
+
});
|
|
1025
|
+
|
|
1026
|
+
// node_modules/prop-types/index.js
|
|
1027
|
+
var require_prop_types = __commonJS({
|
|
1028
|
+
"node_modules/prop-types/index.js"(exports, module) {
|
|
1029
|
+
if (process.env.NODE_ENV !== "production") {
|
|
1030
|
+
ReactIs = require_react_is();
|
|
1031
|
+
throwOnDirectAccess = true;
|
|
1032
|
+
module.exports = require_factoryWithTypeCheckers()(ReactIs.isElement, throwOnDirectAccess);
|
|
1033
|
+
} else {
|
|
1034
|
+
module.exports = require_factoryWithThrowingShims()();
|
|
1035
|
+
}
|
|
1036
|
+
var ReactIs;
|
|
1037
|
+
var throwOnDirectAccess;
|
|
1038
|
+
}
|
|
1039
|
+
});
|
|
1040
|
+
var stackSxProps = [
|
|
1041
|
+
"margin",
|
|
1042
|
+
"marginTop",
|
|
1043
|
+
"marginRight",
|
|
1044
|
+
"marginBottom",
|
|
1045
|
+
"marginLeft",
|
|
1046
|
+
"m",
|
|
1047
|
+
"mt",
|
|
1048
|
+
"mr",
|
|
1049
|
+
"mb",
|
|
1050
|
+
"ml",
|
|
1051
|
+
"mx",
|
|
1052
|
+
"my",
|
|
1053
|
+
"padding",
|
|
1054
|
+
"paddingTop",
|
|
1055
|
+
"paddingRight",
|
|
1056
|
+
"paddingBottom",
|
|
1057
|
+
"paddingLeft",
|
|
1058
|
+
"p",
|
|
1059
|
+
"pt",
|
|
1060
|
+
"pr",
|
|
1061
|
+
"pb",
|
|
1062
|
+
"pl",
|
|
1063
|
+
"px",
|
|
1064
|
+
"py",
|
|
1065
|
+
"flexGrow",
|
|
1066
|
+
"flexShrink",
|
|
1067
|
+
"flexBasis",
|
|
1068
|
+
"flexDirection",
|
|
1069
|
+
"alignItems",
|
|
1070
|
+
"justifyContent",
|
|
1071
|
+
"position",
|
|
1072
|
+
"zIndex",
|
|
1073
|
+
"top",
|
|
1074
|
+
"right",
|
|
1075
|
+
"bottom",
|
|
1076
|
+
"left",
|
|
1077
|
+
"gridGap",
|
|
1078
|
+
"gridColumnGap",
|
|
1079
|
+
"gridRowGap",
|
|
1080
|
+
"gridColumn",
|
|
1081
|
+
"gridRow",
|
|
1082
|
+
"gridAutoFlow",
|
|
1083
|
+
"gap",
|
|
1084
|
+
"columnGap",
|
|
1085
|
+
"rowGap"
|
|
1086
|
+
];
|
|
1087
|
+
var TypographyWithIcon = ({ startIcon, endIcon, children, sx, gutterBottom, ...props }) => {
|
|
1088
|
+
const sxCopy = { ...sx };
|
|
1089
|
+
const stackStyles = {};
|
|
1090
|
+
if (sxCopy) {
|
|
1091
|
+
for (const current of stackSxProps) {
|
|
1092
|
+
if (sxCopy[current]) {
|
|
1093
|
+
stackStyles[current] = sxCopy[current];
|
|
1094
|
+
delete sxCopy[current];
|
|
1095
|
+
}
|
|
1096
|
+
}
|
|
1097
|
+
}
|
|
1098
|
+
return /* @__PURE__ */ jsxs(Stack, { direction: "row", alignItems: "center", gap: 1, sx: stackStyles, mb: gutterBottom ? 0.7 : void 0, children: [
|
|
1099
|
+
startIcon,
|
|
1100
|
+
/* @__PURE__ */ jsx(Typography, { ...props, sx: sxCopy, children }),
|
|
1101
|
+
endIcon
|
|
1102
|
+
] });
|
|
1103
|
+
};
|
|
1104
|
+
var PageHeader = ({ title, action, sx }) => {
|
|
1105
|
+
return /* @__PURE__ */ jsx(CardHeader, { title: /* @__PURE__ */ jsx(Typography, { variant: "h4", fontWeight: 600, children: title }), action, sx: { px: 0, ...sx } });
|
|
1106
|
+
};
|
|
1107
|
+
var TableContainer = ({ children, sx, ...props }) => {
|
|
1108
|
+
const reference = useRef(null);
|
|
1109
|
+
const [height, setHeight] = useState();
|
|
1110
|
+
useEffect(() => {
|
|
1111
|
+
const element = reference.current;
|
|
1112
|
+
if (!element) return;
|
|
1113
|
+
const recompute = () => {
|
|
1114
|
+
if (!reference.current) return;
|
|
1115
|
+
const top = Math.ceil(reference.current.getBoundingClientRect().top);
|
|
1116
|
+
const avail = Math.max(0, window.innerHeight - top);
|
|
1117
|
+
setHeight(avail);
|
|
1118
|
+
};
|
|
1119
|
+
recompute();
|
|
1120
|
+
window.addEventListener("resize", recompute);
|
|
1121
|
+
const ro = new ResizeObserver(recompute);
|
|
1122
|
+
ro.observe(document.documentElement);
|
|
1123
|
+
ro.observe(document.body);
|
|
1124
|
+
ro.observe(element);
|
|
1125
|
+
return () => {
|
|
1126
|
+
window.removeEventListener("resize", recompute);
|
|
1127
|
+
ro.disconnect();
|
|
1128
|
+
};
|
|
1129
|
+
}, []);
|
|
1130
|
+
return /* @__PURE__ */ jsx(
|
|
1131
|
+
Box,
|
|
1132
|
+
{
|
|
1133
|
+
ref: reference,
|
|
1134
|
+
sx: {
|
|
1135
|
+
display: "flex",
|
|
1136
|
+
flexDirection: "column",
|
|
1137
|
+
minHeight: 0,
|
|
1138
|
+
width: "100%",
|
|
1139
|
+
...sx
|
|
1140
|
+
},
|
|
1141
|
+
height,
|
|
1142
|
+
...props,
|
|
1143
|
+
children: /* @__PURE__ */ jsx(Box, { sx: (theme) => ({
|
|
1144
|
+
flex: 1,
|
|
1145
|
+
minHeight: 0,
|
|
1146
|
+
height: "100%",
|
|
1147
|
+
"& .MuiDataGrid-cell--editing": {
|
|
1148
|
+
"& .MuiInputBase-root": {
|
|
1149
|
+
height: "100%"
|
|
1150
|
+
}
|
|
1151
|
+
},
|
|
1152
|
+
"& .MuiDataGrid-columnHeaderTitle": {
|
|
1153
|
+
fontWeight: 600
|
|
1154
|
+
},
|
|
1155
|
+
"& .Mui-error": {
|
|
1156
|
+
backgroundColor: theme.palette.error.main,
|
|
1157
|
+
color: theme.palette.error.contrastText
|
|
1158
|
+
},
|
|
1159
|
+
"& .MuiDataGrid-booleanCell[data-value='true']": {
|
|
1160
|
+
color: `${theme.palette.success.main} !important`
|
|
1161
|
+
},
|
|
1162
|
+
"& .MuiDataGrid-booleanCell[data-value='false']": {
|
|
1163
|
+
color: `${theme.palette.error.main} !important`
|
|
1164
|
+
}
|
|
1165
|
+
}), children })
|
|
1166
|
+
}
|
|
1167
|
+
);
|
|
1168
|
+
};
|
|
1169
|
+
var baseStyle = {
|
|
1170
|
+
flex: 1,
|
|
1171
|
+
display: "flex",
|
|
1172
|
+
flexDirection: "column",
|
|
1173
|
+
alignItems: "center",
|
|
1174
|
+
padding: "20px",
|
|
1175
|
+
borderWidth: 2,
|
|
1176
|
+
borderRadius: 2,
|
|
1177
|
+
borderStyle: "dashed",
|
|
1178
|
+
outline: "none",
|
|
1179
|
+
transition: "border .24s ease-in-out",
|
|
1180
|
+
cursor: "pointer"
|
|
1181
|
+
};
|
|
1182
|
+
var Dropzone = ({ sx, ...props }) => {
|
|
1183
|
+
const { getRootProps, getInputProps, isFocused, isDragAccept, isDragReject } = useDropzone(props);
|
|
1184
|
+
const { t: t2 } = useTranslation();
|
|
1185
|
+
const theme = useTheme();
|
|
1186
|
+
const style = {
|
|
1187
|
+
...baseStyle,
|
|
1188
|
+
...isFocused ? { borderColor: theme.palette.primary.main } : {},
|
|
1189
|
+
...isDragAccept ? { borderColor: theme.palette.success.main } : {},
|
|
1190
|
+
...isDragReject ? { borderColor: theme.palette.error.main } : {}
|
|
1191
|
+
};
|
|
1192
|
+
return /* @__PURE__ */ jsxs(Paper, { variant: "outlined", ...getRootProps({ style }), sx, children: [
|
|
1193
|
+
/* @__PURE__ */ jsx("input", { ...getInputProps(), style: { display: "none" } }),
|
|
1194
|
+
/* @__PURE__ */ jsx(CloudUpload, {}),
|
|
1195
|
+
/* @__PURE__ */ jsx(Typography, { children: t2("Layout.File.DragSomeFilesHereOrClickToSelectThem") })
|
|
1196
|
+
] });
|
|
1197
|
+
};
|
|
1198
|
+
var FileContext = createContext(null);
|
|
1199
|
+
var useFile = () => {
|
|
1200
|
+
const context = useContext(FileContext);
|
|
1201
|
+
if (!context) {
|
|
1202
|
+
throw new Error("FileViewer components must be used within FileViewer");
|
|
1203
|
+
}
|
|
1204
|
+
return context;
|
|
1205
|
+
};
|
|
1206
|
+
var AppTitle = () => {
|
|
1207
|
+
const title = useAppTitle();
|
|
1208
|
+
return /* @__PURE__ */ jsxs(Stack, { direction: "row", alignItems: "center", spacing: 2, flexGrow: 1, children: [
|
|
1209
|
+
/* @__PURE__ */ jsx("img", { src: "/favicon-32x32.png", alt: "app-logo", loading: "lazy" }),
|
|
1210
|
+
/* @__PURE__ */ jsx(Typography, { variant: "h6", children: title }),
|
|
1211
|
+
import.meta.env.DEV && /* @__PURE__ */ jsx(Chip, { size: "small", label: "TEST", color: "info" })
|
|
1212
|
+
] });
|
|
1213
|
+
};
|
|
1214
|
+
var useAppTitle = () => {
|
|
1215
|
+
const rootRouterState = useRouterState({ select: (s) => s.matches[0] });
|
|
1216
|
+
return rootRouterState.meta?.find((meta) => meta?.title)?.title;
|
|
1217
|
+
};
|
|
1218
|
+
var Platform = class {
|
|
1219
|
+
static get isAndroid() {
|
|
1220
|
+
return /android/i.test(this.userAgent);
|
|
1221
|
+
}
|
|
1222
|
+
static get isIOS() {
|
|
1223
|
+
return /iPad|iPhone|iPod/.test(this.userAgent);
|
|
1224
|
+
}
|
|
1225
|
+
static get isWindows() {
|
|
1226
|
+
return /windows/i.test(this.userAgent);
|
|
1227
|
+
}
|
|
1228
|
+
static get isMacOS() {
|
|
1229
|
+
return /Macintosh|MacIntel|MacPPC|Mac68K/.test(this.userAgent);
|
|
1230
|
+
}
|
|
1231
|
+
static get userAgent() {
|
|
1232
|
+
return typeof navigator === "undefined" ? "" : navigator.userAgent;
|
|
1233
|
+
}
|
|
1234
|
+
};
|
|
1235
|
+
var rootRouteHead = ({ title }) => () => ({
|
|
1236
|
+
meta: [
|
|
1237
|
+
{ charSet: "utf-8" },
|
|
1238
|
+
{ name: "viewport", content: "width=device-width, initial-scale=1" },
|
|
1239
|
+
{ title },
|
|
1240
|
+
{ name: "og:type", content: "website" },
|
|
1241
|
+
{ name: "og:title", content: title },
|
|
1242
|
+
{ name: "og:image", content: "/favicon-32x32.png" }
|
|
1243
|
+
],
|
|
1244
|
+
links: [
|
|
1245
|
+
{ rel: "apple-touch-icon", sizes: "180x180", href: "/apple-touch-icon.png" },
|
|
1246
|
+
{ rel: "icon", type: "image/png", sizes: "32x32", href: "/favicon-32x32.png" },
|
|
1247
|
+
{ rel: "icon", type: "image/png", sizes: "16x16", href: "/favicon-16x16.png" },
|
|
1248
|
+
{ rel: "manifest", href: "/site.webmanifest" },
|
|
1249
|
+
{ rel: "icon", href: "/favicon.ico" }
|
|
1250
|
+
]
|
|
1251
|
+
});
|
|
1252
|
+
var wczApiClient = axios.create();
|
|
1253
|
+
|
|
1254
|
+
// src/hooks/FileHooks.ts
|
|
1255
|
+
var BASE_URL = import.meta.env.VITE_FILE_API_BASE_URL;
|
|
1256
|
+
var QUERY_KEY = "Files";
|
|
1257
|
+
var HOUR = 1e3 * 60 * 60;
|
|
1258
|
+
var useGetFileMetas = (subId, options) => {
|
|
1259
|
+
const appTitle = useAppTitle();
|
|
1260
|
+
return useQuery({
|
|
1261
|
+
...options,
|
|
1262
|
+
queryKey: [QUERY_KEY, "meta", subId, appTitle],
|
|
1263
|
+
queryFn: ({ signal }) => wczApiClient.request({
|
|
1264
|
+
url: `${BASE_URL}/v1/meta?appName=${appTitle}&subId=${subId}`,
|
|
1265
|
+
method: "GET",
|
|
1266
|
+
signal
|
|
1267
|
+
}),
|
|
1268
|
+
staleTime: HOUR,
|
|
1269
|
+
gcTime: HOUR,
|
|
1270
|
+
refetchOnWindowFocus: false
|
|
1271
|
+
});
|
|
1272
|
+
};
|
|
1273
|
+
var useGetFileThumbnail = (meta, options) => {
|
|
1274
|
+
const appTitle = useAppTitle();
|
|
1275
|
+
return useQuery({
|
|
1276
|
+
...options,
|
|
1277
|
+
queryKey: [QUERY_KEY, "thumbnail", meta?.id, appTitle],
|
|
1278
|
+
queryFn: ({ signal }) => wczApiClient.request({
|
|
1279
|
+
url: `${BASE_URL}/v1/thumbnail?appName=${appTitle}&id=${meta?.id}`,
|
|
1280
|
+
method: "GET",
|
|
1281
|
+
signal,
|
|
1282
|
+
responseType: "blob"
|
|
1283
|
+
}),
|
|
1284
|
+
select: (data) => URL.createObjectURL(data),
|
|
1285
|
+
staleTime: HOUR,
|
|
1286
|
+
gcTime: HOUR,
|
|
1287
|
+
refetchOnWindowFocus: false,
|
|
1288
|
+
enabled: !!meta?.id && options?.enabled
|
|
1289
|
+
});
|
|
1290
|
+
};
|
|
1291
|
+
var useGetFile = (meta, options) => {
|
|
1292
|
+
const appTitle = useAppTitle();
|
|
1293
|
+
return useQuery({
|
|
1294
|
+
...options,
|
|
1295
|
+
queryKey: [QUERY_KEY, meta?.id, appTitle],
|
|
1296
|
+
queryFn: ({ signal }) => wczApiClient.request({
|
|
1297
|
+
url: `${BASE_URL}/v1?appName=${appTitle}&id=${meta?.id}`,
|
|
1298
|
+
method: "GET",
|
|
1299
|
+
signal,
|
|
1300
|
+
responseType: "blob"
|
|
1301
|
+
}),
|
|
1302
|
+
select: (data) => URL.createObjectURL(data),
|
|
1303
|
+
staleTime: HOUR,
|
|
1304
|
+
gcTime: HOUR,
|
|
1305
|
+
refetchOnWindowFocus: false,
|
|
1306
|
+
enabled: !!meta?.id && options?.enabled
|
|
1307
|
+
});
|
|
1308
|
+
};
|
|
1309
|
+
var useDownloadFile = (options) => {
|
|
1310
|
+
const appTitle = useAppTitle();
|
|
1311
|
+
return useMutation({
|
|
1312
|
+
...options,
|
|
1313
|
+
mutationFn: (meta) => wczApiClient.request({
|
|
1314
|
+
url: `${BASE_URL}/v1/download?appName=${appTitle}&id=${meta.id}`,
|
|
1315
|
+
method: "GET",
|
|
1316
|
+
responseType: "blob"
|
|
1317
|
+
}),
|
|
1318
|
+
onSuccess: (data, variables) => saveAs(data, `${variables.fileName}.${variables.fileExtension}`)
|
|
1319
|
+
});
|
|
1320
|
+
};
|
|
1321
|
+
var useOpenFile = (options) => {
|
|
1322
|
+
const appTitle = useAppTitle();
|
|
1323
|
+
return useMutation({
|
|
1324
|
+
...options,
|
|
1325
|
+
mutationFn: (meta) => wczApiClient.request({
|
|
1326
|
+
url: `${BASE_URL}/v1?appName=${appTitle}&id=${meta.id}`,
|
|
1327
|
+
method: "GET",
|
|
1328
|
+
responseType: "blob"
|
|
1329
|
+
}),
|
|
1330
|
+
onSuccess: (data) => {
|
|
1331
|
+
window.open(URL.createObjectURL(data));
|
|
1332
|
+
}
|
|
1333
|
+
});
|
|
1334
|
+
};
|
|
1335
|
+
var useUpdateFileMeta = (options) => {
|
|
1336
|
+
const appTitle = useAppTitle();
|
|
1337
|
+
const queryClient = useQueryClient();
|
|
1338
|
+
return useMutation({
|
|
1339
|
+
...options,
|
|
1340
|
+
mutationFn: (meta) => wczApiClient.request({
|
|
1341
|
+
url: `${BASE_URL}/v1/meta?appName=${appTitle}&id=${meta.id}`,
|
|
1342
|
+
method: "PUT",
|
|
1343
|
+
data: meta
|
|
1344
|
+
}),
|
|
1345
|
+
onSettled: () => queryClient.invalidateQueries({ queryKey: [QUERY_KEY, "meta"], exact: false })
|
|
1346
|
+
});
|
|
1347
|
+
};
|
|
1348
|
+
var useDeleteFile = (options) => {
|
|
1349
|
+
const appTitle = useAppTitle();
|
|
1350
|
+
const queryClient = useQueryClient();
|
|
1351
|
+
return useMutation({
|
|
1352
|
+
...options,
|
|
1353
|
+
mutationFn: (meta) => wczApiClient.request({
|
|
1354
|
+
url: `${BASE_URL}/v1?appName=${appTitle}&id=${meta.id}`,
|
|
1355
|
+
method: "DELETE"
|
|
1356
|
+
}),
|
|
1357
|
+
onSettled: () => queryClient.invalidateQueries({ queryKey: [QUERY_KEY, "meta"], exact: false })
|
|
1358
|
+
});
|
|
1359
|
+
};
|
|
1360
|
+
var useDeleteFiles = (options) => {
|
|
1361
|
+
const appTitle = useAppTitle();
|
|
1362
|
+
const queryClient = useQueryClient();
|
|
1363
|
+
return useMutation({
|
|
1364
|
+
...options,
|
|
1365
|
+
mutationFn: (subId) => wczApiClient.request({
|
|
1366
|
+
url: `${BASE_URL}/v1?appName=${appTitle}&subId=${subId}`,
|
|
1367
|
+
method: "DELETE"
|
|
1368
|
+
}),
|
|
1369
|
+
onSettled: () => queryClient.invalidateQueries({ queryKey: [QUERY_KEY, "meta"], exact: false })
|
|
1370
|
+
});
|
|
1371
|
+
};
|
|
1372
|
+
var useUploadFile = ({ subId, onSuccess, onError }) => {
|
|
1373
|
+
const appTitle = useAppTitle();
|
|
1374
|
+
const [progress, setProgress] = useState(0);
|
|
1375
|
+
const queryClient = useQueryClient();
|
|
1376
|
+
const mutate = async (file) => {
|
|
1377
|
+
if (!subId) throw new Error("subId is required for file upload");
|
|
1378
|
+
if (!appTitle) throw new Error("appTitle is required for file upload");
|
|
1379
|
+
const metadata = {
|
|
1380
|
+
id: uuidv7(),
|
|
1381
|
+
appName: appTitle,
|
|
1382
|
+
subId,
|
|
1383
|
+
fileName: file.name
|
|
1384
|
+
};
|
|
1385
|
+
const upload = new Upload(file, {
|
|
1386
|
+
endpoint: `${BASE_URL}/v1/upload`,
|
|
1387
|
+
chunkSize: 1048576,
|
|
1388
|
+
// 1 MB
|
|
1389
|
+
metadata: {
|
|
1390
|
+
id: metadata.id,
|
|
1391
|
+
appName: metadata.appName,
|
|
1392
|
+
subId: metadata.subId,
|
|
1393
|
+
fileName: metadata.fileName,
|
|
1394
|
+
fileExtension: file.type
|
|
1395
|
+
},
|
|
1396
|
+
//headers: { "Authorization": `Bearer ${await getToken()}` }, //TODO: implement token retrieval
|
|
1397
|
+
onError: (error) => {
|
|
1398
|
+
setProgress(0);
|
|
1399
|
+
onError?.(error);
|
|
1400
|
+
},
|
|
1401
|
+
onProgress: (bytesUploaded, bytesTotal) => {
|
|
1402
|
+
setProgress(bytesUploaded / bytesTotal * 100);
|
|
1403
|
+
},
|
|
1404
|
+
onSuccess: () => {
|
|
1405
|
+
setProgress(0);
|
|
1406
|
+
queryClient.invalidateQueries({ queryKey: [QUERY_KEY, "meta", subId, appTitle], exact: false });
|
|
1407
|
+
onSuccess?.(metadata);
|
|
1408
|
+
}
|
|
1409
|
+
});
|
|
1410
|
+
const previousUploads = await upload.findPreviousUploads();
|
|
1411
|
+
if (previousUploads.length > 0) {
|
|
1412
|
+
upload.resumeFromPreviousUpload(previousUploads[0]);
|
|
1413
|
+
}
|
|
1414
|
+
upload.start();
|
|
1415
|
+
};
|
|
1416
|
+
return { mutate, progress };
|
|
1417
|
+
};
|
|
1418
|
+
var useEnhancedEffect = typeof window !== "undefined" ? React11.useLayoutEffect : React11.useEffect;
|
|
1419
|
+
var useEnhancedEffect_default = useEnhancedEffect;
|
|
1420
|
+
|
|
1421
|
+
// node_modules/@mui/utils/esm/useEventCallback/useEventCallback.js
|
|
1422
|
+
function useEventCallback(fn) {
|
|
1423
|
+
const ref = React11.useRef(fn);
|
|
1424
|
+
useEnhancedEffect_default(() => {
|
|
1425
|
+
ref.current = fn;
|
|
1426
|
+
});
|
|
1427
|
+
return React11.useRef((...args) => (
|
|
1428
|
+
// @ts-expect-error hide `this`
|
|
1429
|
+
(0, ref.current)(...args)
|
|
1430
|
+
)).current;
|
|
1431
|
+
}
|
|
1432
|
+
var useEventCallback_default = useEventCallback;
|
|
1433
|
+
var DialogsContext = createContext({});
|
|
1434
|
+
function AlertDialog({ open, payload, onClose }) {
|
|
1435
|
+
const { t: t2 } = useTranslation();
|
|
1436
|
+
return /* @__PURE__ */ jsxs(Dialog$1, { maxWidth: "xs", fullWidth: true, open, onClose: () => onClose(), children: [
|
|
1437
|
+
/* @__PURE__ */ jsx(DialogTitle, { children: payload.title ?? t2("Layout.Dialog.Alert") }),
|
|
1438
|
+
/* @__PURE__ */ jsx(DialogContent, { children: payload.message }),
|
|
1439
|
+
/* @__PURE__ */ jsx(DialogActions, { children: /* @__PURE__ */ jsx(Button$1, { disabled: !open, onClick: () => onClose(), children: t2("Layout.Dialog.Confirm") }) })
|
|
1440
|
+
] });
|
|
1441
|
+
}
|
|
1442
|
+
function ConfirmDialog({ open, payload, onClose }) {
|
|
1443
|
+
const { t: t2 } = useTranslation();
|
|
1444
|
+
return /* @__PURE__ */ jsxs(Dialog$1, { maxWidth: "xs", fullWidth: true, open, onClose: () => onClose(false), children: [
|
|
1445
|
+
/* @__PURE__ */ jsx(DialogTitle, { children: payload.title ?? t2("Layout.Dialog.Confirm") }),
|
|
1446
|
+
/* @__PURE__ */ jsx(DialogContent, { children: payload.message }),
|
|
1447
|
+
/* @__PURE__ */ jsxs(DialogActions, { children: [
|
|
1448
|
+
/* @__PURE__ */ jsx(Button$1, { autoFocus: true, disabled: !open, onClick: () => onClose(false), children: payload.cancelText ?? t2("Layout.Dialog.Cancel") }),
|
|
1449
|
+
/* @__PURE__ */ jsx(Button$1, { disabled: !open, onClick: () => onClose(true), children: t2("Layout.Dialog.Confirm") })
|
|
1450
|
+
] })
|
|
1451
|
+
] });
|
|
1452
|
+
}
|
|
1453
|
+
function useDialogs() {
|
|
1454
|
+
const { open, close } = useContext(DialogsContext);
|
|
1455
|
+
const alert = useEventCallback_default(
|
|
1456
|
+
(message, { ...options } = {}) => open(AlertDialog, { ...options, message })
|
|
1457
|
+
);
|
|
1458
|
+
const confirm = useEventCallback_default(
|
|
1459
|
+
(message, { ...options } = {}) => open(ConfirmDialog, { ...options, message })
|
|
1460
|
+
);
|
|
1461
|
+
return useMemo(() => ({ alert, confirm, open, close }), [alert, close, confirm, open]);
|
|
1462
|
+
}
|
|
1463
|
+
var ActionsMenu = ({ meta, menu, setMenu }) => {
|
|
1464
|
+
const { t: t2 } = useTranslation();
|
|
1465
|
+
const { fileMetas, onDelete, actions } = useFile();
|
|
1466
|
+
const { confirm } = useDialogs();
|
|
1467
|
+
const handleMenuClose = () => {
|
|
1468
|
+
setMenu(null);
|
|
1469
|
+
};
|
|
1470
|
+
const { mutate: download, isPending: isDownloading } = useDownloadFile();
|
|
1471
|
+
const { mutate: deleteFile, isPending: isDeleting } = useDeleteFile();
|
|
1472
|
+
const handleOnDownload = () => {
|
|
1473
|
+
handleMenuClose();
|
|
1474
|
+
download(meta);
|
|
1475
|
+
};
|
|
1476
|
+
const handleOnDelete = async () => {
|
|
1477
|
+
if (!await confirm(t2("Layout.File.AreYouSureYouWantToDelete", { fileName: meta.fileName })))
|
|
1478
|
+
return;
|
|
1479
|
+
deleteFile(meta);
|
|
1480
|
+
handleMenuClose();
|
|
1481
|
+
if (onDelete) {
|
|
1482
|
+
const remainingFileMetas = fileMetas.filter((m) => m.id !== meta.id);
|
|
1483
|
+
onDelete({ remainingFileMetas, deletedFileMeta: meta });
|
|
1484
|
+
}
|
|
1485
|
+
};
|
|
1486
|
+
return /* @__PURE__ */ jsx(
|
|
1487
|
+
Menu,
|
|
1488
|
+
{
|
|
1489
|
+
open: menu !== null,
|
|
1490
|
+
onClose: handleMenuClose,
|
|
1491
|
+
anchorReference: "anchorPosition",
|
|
1492
|
+
variant: "menu",
|
|
1493
|
+
anchorPosition: menu === null ? void 0 : { top: menu.mouseY, left: menu.mouseX },
|
|
1494
|
+
children: /* @__PURE__ */ jsxs(List, { disablePadding: true, children: [
|
|
1495
|
+
actions?.download !== false && /* @__PURE__ */ jsxs(ListItemButton, { onClick: handleOnDownload, disabled: isDownloading, children: [
|
|
1496
|
+
/* @__PURE__ */ jsx(ListItemIcon, { children: /* @__PURE__ */ jsx(FileDownload, {}) }),
|
|
1497
|
+
/* @__PURE__ */ jsx(ListItemText, { children: t2("Layout.File.Download") })
|
|
1498
|
+
] }),
|
|
1499
|
+
actions?.delete !== false && /* @__PURE__ */ jsxs(ListItemButton, { onClick: handleOnDelete, disabled: isDeleting, children: [
|
|
1500
|
+
/* @__PURE__ */ jsx(ListItemIcon, { children: /* @__PURE__ */ jsx(Delete, {}) }),
|
|
1501
|
+
/* @__PURE__ */ jsx(ListItemText, { children: t2("Layout.File.Delete") })
|
|
1502
|
+
] })
|
|
1503
|
+
] })
|
|
1504
|
+
}
|
|
1505
|
+
);
|
|
1506
|
+
};
|
|
1507
|
+
var IMAGE_SIZE = 150;
|
|
1508
|
+
var FileViewerGrid = ({ sx, size, itemBar }) => {
|
|
1509
|
+
const { fileMetas } = useFile();
|
|
1510
|
+
return /* @__PURE__ */ jsx(Stack, { direction: "row", spacing: 1, sx: { overflow: "auto", ...sx }, children: fileMetas.map((fileMeta) => /* @__PURE__ */ jsx(
|
|
1511
|
+
GridFileViewerItem,
|
|
1512
|
+
{
|
|
1513
|
+
meta: fileMeta,
|
|
1514
|
+
size,
|
|
1515
|
+
itemBar
|
|
1516
|
+
},
|
|
1517
|
+
fileMeta.id
|
|
1518
|
+
)) });
|
|
1519
|
+
};
|
|
1520
|
+
var GridFileViewerItem = ({ meta, size, itemBar }) => {
|
|
1521
|
+
const { setImageId, actions } = useFile();
|
|
1522
|
+
const [showItemBar, setShowItemBar] = useState(itemBar === "always");
|
|
1523
|
+
const [menu, setMenu] = useState(null);
|
|
1524
|
+
useEffect(() => {
|
|
1525
|
+
setShowItemBar(itemBar === "always");
|
|
1526
|
+
}, [itemBar]);
|
|
1527
|
+
const { data: source } = useGetFileThumbnail(meta);
|
|
1528
|
+
const handleOnMouseEnter = () => setShowItemBar(true);
|
|
1529
|
+
const handleOnMouseLeave = () => itemBar !== "always" && setShowItemBar(false);
|
|
1530
|
+
const openMenu = (event) => {
|
|
1531
|
+
setMenu(menu === null ? { mouseX: event.clientX, mouseY: event.clientY } : null);
|
|
1532
|
+
setTimeout(() => setShowItemBar(true));
|
|
1533
|
+
};
|
|
1534
|
+
const { mutate: openFile } = useOpenFile();
|
|
1535
|
+
const { mutate: download } = useDownloadFile();
|
|
1536
|
+
const onClick = () => {
|
|
1537
|
+
switch (meta.mediaType) {
|
|
1538
|
+
case "image": {
|
|
1539
|
+
return setImageId(meta.id);
|
|
1540
|
+
}
|
|
1541
|
+
case "application": {
|
|
1542
|
+
return openFile(meta);
|
|
1543
|
+
}
|
|
1544
|
+
case "video": {
|
|
1545
|
+
return openFile(meta);
|
|
1546
|
+
}
|
|
1547
|
+
default: {
|
|
1548
|
+
return download(meta);
|
|
1549
|
+
}
|
|
1550
|
+
}
|
|
1551
|
+
};
|
|
1552
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1553
|
+
/* @__PURE__ */ jsxs(ImageListItem, { sx: { width: size ?? IMAGE_SIZE, height: size ?? IMAGE_SIZE }, onMouseEnter: handleOnMouseEnter, onMouseLeave: handleOnMouseLeave, children: [
|
|
1554
|
+
/* @__PURE__ */ jsx(
|
|
1555
|
+
Box,
|
|
1556
|
+
{
|
|
1557
|
+
component: "img",
|
|
1558
|
+
src: source,
|
|
1559
|
+
loading: "lazy",
|
|
1560
|
+
alt: "thumbnail-" + meta.id,
|
|
1561
|
+
onClick,
|
|
1562
|
+
sx: { cursor: "pointer", objectFit: "contain", width: size ?? IMAGE_SIZE, height: size ?? IMAGE_SIZE }
|
|
1563
|
+
}
|
|
1564
|
+
),
|
|
1565
|
+
itemBar !== "hidden" && showItemBar && /* @__PURE__ */ jsx(
|
|
1566
|
+
ImageListItemBar,
|
|
1567
|
+
{
|
|
1568
|
+
title: /* @__PURE__ */ jsx(Tooltip, { title: meta.fileName, children: /* @__PURE__ */ jsx(Box, { children: meta.fileName }) }),
|
|
1569
|
+
actionIcon: (actions?.download !== false || actions?.delete !== false) && /* @__PURE__ */ jsx(IconButton, { sx: { color: grey[100] }, onClick: openMenu, children: /* @__PURE__ */ jsx(MoreVert, {}) })
|
|
1570
|
+
}
|
|
1571
|
+
)
|
|
1572
|
+
] }),
|
|
1573
|
+
(actions?.download !== false || actions?.delete !== false) && /* @__PURE__ */ jsx(ActionsMenu, { meta, menu, setMenu })
|
|
1574
|
+
] });
|
|
1575
|
+
};
|
|
1576
|
+
var FileViewerList = ({ sx }) => {
|
|
1577
|
+
const { fileMetas } = useFile();
|
|
1578
|
+
return /* @__PURE__ */ jsx(List, { dense: true, sx, children: fileMetas.map(
|
|
1579
|
+
(fileMeta) => /* @__PURE__ */ jsx(
|
|
1580
|
+
ListFileViewerItem,
|
|
1581
|
+
{
|
|
1582
|
+
meta: fileMeta
|
|
1583
|
+
},
|
|
1584
|
+
fileMeta.id
|
|
1585
|
+
)
|
|
1586
|
+
) });
|
|
1587
|
+
};
|
|
1588
|
+
var ListFileViewerItem = ({ meta }) => {
|
|
1589
|
+
const { setImageId, actions } = useFile();
|
|
1590
|
+
const [menu, setMenu] = useState(null);
|
|
1591
|
+
const openMenu = (event) => {
|
|
1592
|
+
event.stopPropagation();
|
|
1593
|
+
setMenu(menu === null ? { mouseX: event.clientX, mouseY: event.clientY } : null);
|
|
1594
|
+
};
|
|
1595
|
+
const { mutate: openFile } = useOpenFile();
|
|
1596
|
+
const { mutate: download } = useDownloadFile();
|
|
1597
|
+
const onClick = () => {
|
|
1598
|
+
switch (meta.mediaType) {
|
|
1599
|
+
case "image": {
|
|
1600
|
+
return setImageId(meta.id);
|
|
1601
|
+
}
|
|
1602
|
+
case "application": {
|
|
1603
|
+
return openFile(meta);
|
|
1604
|
+
}
|
|
1605
|
+
case "video": {
|
|
1606
|
+
return openFile(meta);
|
|
1607
|
+
}
|
|
1608
|
+
default: {
|
|
1609
|
+
return download(meta);
|
|
1610
|
+
}
|
|
1611
|
+
}
|
|
1612
|
+
};
|
|
1613
|
+
const icon = () => {
|
|
1614
|
+
switch (meta.mediaType) {
|
|
1615
|
+
case "image": {
|
|
1616
|
+
return /* @__PURE__ */ jsx(Image, {});
|
|
1617
|
+
}
|
|
1618
|
+
case "video": {
|
|
1619
|
+
return /* @__PURE__ */ jsx(SmartDisplay, {});
|
|
1620
|
+
}
|
|
1621
|
+
default: {
|
|
1622
|
+
return /* @__PURE__ */ jsx(AttachFile, {});
|
|
1623
|
+
}
|
|
1624
|
+
}
|
|
1625
|
+
};
|
|
1626
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1627
|
+
/* @__PURE__ */ jsxs(ListItemButton, { onClick, children: [
|
|
1628
|
+
/* @__PURE__ */ jsx(ListItemIcon, { children: icon() }),
|
|
1629
|
+
/* @__PURE__ */ jsx(ListItemText, { primary: `${meta.fileName}.${meta.fileExtension}` }),
|
|
1630
|
+
(actions?.download !== false || actions?.delete !== false) && /* @__PURE__ */ jsx(IconButton, { edge: "end", onClick: openMenu, children: /* @__PURE__ */ jsx(MoreVert, {}) })
|
|
1631
|
+
] }, meta.id),
|
|
1632
|
+
(actions?.download !== false || actions?.delete !== false) && /* @__PURE__ */ jsx(ActionsMenu, { meta, menu, setMenu })
|
|
1633
|
+
] });
|
|
1634
|
+
};
|
|
1635
|
+
var ImageViewer = ({ metaId }) => {
|
|
1636
|
+
const { fileMetas, setImageId } = useFile();
|
|
1637
|
+
const meta = fileMetas.find((m) => m.id === metaId);
|
|
1638
|
+
const { data: source } = useGetFile(meta);
|
|
1639
|
+
useEffect(() => {
|
|
1640
|
+
if (globalThis.window !== void 0 && metaId)
|
|
1641
|
+
globalThis.addEventListener("keydown", handleOnKeydown);
|
|
1642
|
+
return () => {
|
|
1643
|
+
globalThis.removeEventListener("keydown", handleOnKeydown);
|
|
1644
|
+
};
|
|
1645
|
+
}, [metaId]);
|
|
1646
|
+
const handleOnKeydown = (event) => {
|
|
1647
|
+
const images = fileMetas.filter((m) => m.mediaType === "image");
|
|
1648
|
+
const imageIndex = images.findIndex((m) => m.id === metaId);
|
|
1649
|
+
switch (event.key) {
|
|
1650
|
+
case "ArrowLeft": {
|
|
1651
|
+
return handleOnArrowLeft(images, imageIndex);
|
|
1652
|
+
}
|
|
1653
|
+
case "ArrowRight": {
|
|
1654
|
+
return handleOnArrowRight(images, imageIndex);
|
|
1655
|
+
}
|
|
1656
|
+
case "Backspace":
|
|
1657
|
+
case "Escape": {
|
|
1658
|
+
event.preventDefault();
|
|
1659
|
+
return onClose();
|
|
1660
|
+
}
|
|
1661
|
+
}
|
|
1662
|
+
};
|
|
1663
|
+
const handleOnArrowLeft = (images, index) => {
|
|
1664
|
+
if (index > 0) {
|
|
1665
|
+
const previousFile = images[index - 1];
|
|
1666
|
+
setImageId(previousFile.id);
|
|
1667
|
+
}
|
|
1668
|
+
};
|
|
1669
|
+
const handleOnArrowRight = (images, index) => {
|
|
1670
|
+
if (index < images.length - 1) {
|
|
1671
|
+
const nextFile = images[index + 1];
|
|
1672
|
+
setImageId(nextFile.id);
|
|
1673
|
+
}
|
|
1674
|
+
};
|
|
1675
|
+
const onClose = () => setImageId("");
|
|
1676
|
+
if (!metaId) return null;
|
|
1677
|
+
return /* @__PURE__ */ jsxs(Dialog, { open: true, onClose, maxWidth: "xl", children: [
|
|
1678
|
+
/* @__PURE__ */ jsx(Box, { component: "img", src: source, alt: metaId, sx: { maxWidth: "100vw", maxHeight: { xs: "calc(100vh - 56px)", sm: "calc(100vh - 64px)" } } }),
|
|
1679
|
+
/* @__PURE__ */ jsx(Fab, { size: "medium", onClick: onClose, sx: { position: "fixed", top: 8, right: 8 }, children: /* @__PURE__ */ jsx(Close, {}) })
|
|
1680
|
+
] });
|
|
1681
|
+
};
|
|
1682
|
+
var FileViewer = ({ subId, onDelete, actions, children }) => {
|
|
1683
|
+
const { data: fileMetas = [] } = useGetFileMetas(subId, { enabled: !!subId });
|
|
1684
|
+
const [imageId, setImageId] = useState("");
|
|
1685
|
+
const components = { Grid: FileViewerGrid, List: FileViewerList };
|
|
1686
|
+
if (fileMetas.length === 0) return null;
|
|
1687
|
+
return /* @__PURE__ */ jsxs(FileContext.Provider, { value: { fileMetas, onDelete, actions, setImageId }, children: [
|
|
1688
|
+
children(components),
|
|
1689
|
+
/* @__PURE__ */ jsx(ImageViewer, { metaId: imageId })
|
|
1690
|
+
] });
|
|
1691
|
+
};
|
|
1692
|
+
var isArray = (value) => Array.isArray(value);
|
|
1693
|
+
var ChipInputCell = ({ params, slotProps, getLabel }) => {
|
|
1694
|
+
if (!params.value) return null;
|
|
1695
|
+
const getLabelValue = (value) => {
|
|
1696
|
+
if (getLabel) return getLabel(value);
|
|
1697
|
+
return value;
|
|
1698
|
+
};
|
|
1699
|
+
if (isArray(params.value))
|
|
1700
|
+
return /* @__PURE__ */ jsx(Stack, { direction: "row", alignItems: "center", gap: 1, sx: { overflowX: "auto", height: "100%", width: params.colDef.computedWidth }, children: params.value.map(
|
|
1701
|
+
(value, index) => /* @__PURE__ */ jsx(Chip, { label: getLabelValue(value), ...slotProps }, `${index + 1}-chip-input-cell`)
|
|
1702
|
+
) });
|
|
1703
|
+
return /* @__PURE__ */ jsx(Chip, { label: getLabelValue(params.value), ...slotProps });
|
|
1704
|
+
};
|
|
1705
|
+
var EditableColumnHeader = ({ colDef }) => {
|
|
1706
|
+
return /* @__PURE__ */ jsx(TypographyWithIcon, { endIcon: /* @__PURE__ */ jsx(Edit, { color: "disabled", fontSize: "small" }), variant: "body2", className: "MuiDataGrid-columnHeaderTitle", children: colDef.headerName });
|
|
1707
|
+
};
|
|
1708
|
+
var Component = React11__default.forwardRef(function ButtonComponent(props, reference) {
|
|
1709
|
+
return /* @__PURE__ */ jsx(Button, { ref: reference, component: "a", ...props });
|
|
1710
|
+
});
|
|
1711
|
+
var CreatedComponent = createLink(Component);
|
|
1712
|
+
var RouterButton = (props) => {
|
|
1713
|
+
return /* @__PURE__ */ jsx(CreatedComponent, { ...props });
|
|
1714
|
+
};
|
|
1715
|
+
var Component2 = React11__default.forwardRef(
|
|
1716
|
+
function GridActionsCellItemComponent(props, reference) {
|
|
1717
|
+
return /* @__PURE__ */ jsx(GridActionsCellItem, { ref: reference, component: "a", ...props });
|
|
1718
|
+
}
|
|
1719
|
+
);
|
|
1720
|
+
var CreatedComponent2 = createLink(Component2);
|
|
1721
|
+
var RouterGridActionsCellItem = (props) => {
|
|
1722
|
+
return /* @__PURE__ */ jsx(CreatedComponent2, { ...props });
|
|
1723
|
+
};
|
|
1724
|
+
var Component3 = React11__default.forwardRef(function IconButtonComponent(props, reference) {
|
|
1725
|
+
return /* @__PURE__ */ jsx(IconButton, { ref: reference, component: "a", ...props });
|
|
1726
|
+
});
|
|
1727
|
+
var CreatedComponent3 = createLink(Component3);
|
|
1728
|
+
var RouterIconButton = (props) => {
|
|
1729
|
+
return /* @__PURE__ */ jsx(CreatedComponent3, { ...props });
|
|
1730
|
+
};
|
|
1731
|
+
var Component4 = React11__default.forwardRef(function LinkComponent(props, reference) {
|
|
1732
|
+
return /* @__PURE__ */ jsx(Link, { ref: reference, ...props });
|
|
1733
|
+
});
|
|
1734
|
+
var CreatedComponent4 = createLink(Component4);
|
|
1735
|
+
var RouterLink = (props) => {
|
|
1736
|
+
return /* @__PURE__ */ jsx(CreatedComponent4, { ...props });
|
|
1737
|
+
};
|
|
1738
|
+
var Component5 = React11__default.forwardRef(function TabComponent(props, reference) {
|
|
1739
|
+
return /* @__PURE__ */ jsx(Tab, { ref: reference, component: "a", ...props });
|
|
1740
|
+
});
|
|
1741
|
+
var CreatedComponent5 = createLink(Component5);
|
|
1742
|
+
var RouterTab = (props) => {
|
|
1743
|
+
return /* @__PURE__ */ jsx(CreatedComponent5, { ...props });
|
|
1744
|
+
};
|
|
1745
|
+
var Component6 = React11__default.forwardRef(function ButtonComponent2(props, reference) {
|
|
1746
|
+
return /* @__PURE__ */ jsx(ListItemButton, { ref: reference, component: "a", ...props });
|
|
1747
|
+
});
|
|
1748
|
+
var CreatedComponent6 = createLink(Component6);
|
|
1749
|
+
var RouterListItemButton = (props) => {
|
|
1750
|
+
return /* @__PURE__ */ jsx(CreatedComponent6, { ...props });
|
|
1751
|
+
};
|
|
1752
|
+
function RouterNotFound() {
|
|
1753
|
+
const { t: t2 } = useTranslation();
|
|
1754
|
+
return /* @__PURE__ */ jsx(Box, { height: "100vh", display: "flex", flexDirection: "column", alignItems: "center", justifyContent: "center", textAlign: "center", px: 2, children: /* @__PURE__ */ jsxs(Box, { display: "flex", alignItems: "center", mb: 4, children: [
|
|
1755
|
+
/* @__PURE__ */ jsx(Typography, { variant: "h3", component: "span", fontWeight: 500, sx: { lineHeight: 1 }, children: "404" }),
|
|
1756
|
+
/* @__PURE__ */ jsx(Divider, { orientation: "vertical", flexItem: true, sx: { mx: 3 } }),
|
|
1757
|
+
/* @__PURE__ */ jsx(Typography, { variant: "h5", component: "span", children: t2("Layout.ThisPageCouldNotBeFound") })
|
|
1758
|
+
] }) });
|
|
1759
|
+
}
|
|
1760
|
+
var RouterError = ({ error }) => {
|
|
1761
|
+
return /* @__PURE__ */ jsx(Box, { height: "100vh", display: "flex", flexDirection: "column", alignItems: "center", justifyContent: "center", textAlign: "center", px: 2, children: /* @__PURE__ */ jsxs(Box, { display: "flex", alignItems: "center", mb: 4, children: [
|
|
1762
|
+
/* @__PURE__ */ jsx(Typography, { variant: "h3", component: "span", fontWeight: 500, sx: { lineHeight: 1 }, children: error.name || "500" }),
|
|
1763
|
+
/* @__PURE__ */ jsx(Divider, { orientation: "vertical", flexItem: true, sx: { mx: 3 } }),
|
|
1764
|
+
/* @__PURE__ */ jsx(Typography, { variant: "h5", component: "span", children: error.message })
|
|
1765
|
+
] }) });
|
|
1766
|
+
};
|
|
1767
|
+
|
|
1768
|
+
// node_modules/@babel/runtime/helpers/esm/extends.js
|
|
1769
|
+
function _extends() {
|
|
1770
|
+
return _extends = Object.assign ? Object.assign.bind() : function(n) {
|
|
1771
|
+
for (var e = 1; e < arguments.length; e++) {
|
|
1772
|
+
var t2 = arguments[e];
|
|
1773
|
+
for (var r in t2) ({}).hasOwnProperty.call(t2, r) && (n[r] = t2[r]);
|
|
1774
|
+
}
|
|
1775
|
+
return n;
|
|
1776
|
+
}, _extends.apply(null, arguments);
|
|
1777
|
+
}
|
|
1778
|
+
|
|
1779
|
+
// node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js
|
|
1780
|
+
function _objectWithoutPropertiesLoose(r, e) {
|
|
1781
|
+
if (null == r) return {};
|
|
1782
|
+
var t2 = {};
|
|
1783
|
+
for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
|
|
1784
|
+
if (-1 !== e.indexOf(n)) continue;
|
|
1785
|
+
t2[n] = r[n];
|
|
1786
|
+
}
|
|
1787
|
+
return t2;
|
|
1788
|
+
}
|
|
1789
|
+
|
|
1790
|
+
// node_modules/@mui/x-date-pickers/esm/LocalizationProvider/LocalizationProvider.js
|
|
1791
|
+
var import_prop_types = __toESM(require_prop_types());
|
|
1792
|
+
var _excluded = ["localeText"];
|
|
1793
|
+
var PickerAdapterContext = /* @__PURE__ */ React11.createContext(null);
|
|
1794
|
+
if (process.env.NODE_ENV !== "production") PickerAdapterContext.displayName = "PickerAdapterContext";
|
|
1795
|
+
var LocalizationProvider = function LocalizationProvider2(inProps) {
|
|
1796
|
+
const {
|
|
1797
|
+
localeText: inLocaleText
|
|
1798
|
+
} = inProps, otherInProps = _objectWithoutPropertiesLoose(inProps, _excluded);
|
|
1799
|
+
const {
|
|
1800
|
+
adapter: parentAdapter,
|
|
1801
|
+
localeText: parentLocaleText
|
|
1802
|
+
} = React11.useContext(PickerAdapterContext) ?? {
|
|
1803
|
+
adapter: void 0,
|
|
1804
|
+
localeText: void 0
|
|
1805
|
+
};
|
|
1806
|
+
const props = useThemeProps({
|
|
1807
|
+
// We don't want to pass the `localeText` prop to the theme, that way it will always return the theme value,
|
|
1808
|
+
// We will then merge this theme value with our value manually
|
|
1809
|
+
props: otherInProps,
|
|
1810
|
+
name: "MuiLocalizationProvider"
|
|
1811
|
+
});
|
|
1812
|
+
const {
|
|
1813
|
+
children,
|
|
1814
|
+
dateAdapter: DateAdapter,
|
|
1815
|
+
dateFormats,
|
|
1816
|
+
dateLibInstance,
|
|
1817
|
+
adapterLocale,
|
|
1818
|
+
localeText: themeLocaleText
|
|
1819
|
+
} = props;
|
|
1820
|
+
const localeText = React11.useMemo(() => _extends({}, themeLocaleText, parentLocaleText, inLocaleText), [themeLocaleText, parentLocaleText, inLocaleText]);
|
|
1821
|
+
const adapter = React11.useMemo(() => {
|
|
1822
|
+
if (!DateAdapter) {
|
|
1823
|
+
if (parentAdapter) {
|
|
1824
|
+
return parentAdapter;
|
|
1825
|
+
}
|
|
1826
|
+
return null;
|
|
1827
|
+
}
|
|
1828
|
+
const dateAdapter = new DateAdapter({
|
|
1829
|
+
locale: adapterLocale,
|
|
1830
|
+
formats: dateFormats,
|
|
1831
|
+
instance: dateLibInstance
|
|
1832
|
+
});
|
|
1833
|
+
if (!dateAdapter.isMUIAdapter) {
|
|
1834
|
+
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(`
|
|
1835
|
+
`));
|
|
1836
|
+
}
|
|
1837
|
+
return dateAdapter;
|
|
1838
|
+
}, [DateAdapter, adapterLocale, dateFormats, dateLibInstance, parentAdapter]);
|
|
1839
|
+
const defaultDates = React11.useMemo(() => {
|
|
1840
|
+
if (!adapter) {
|
|
1841
|
+
return null;
|
|
1842
|
+
}
|
|
1843
|
+
return {
|
|
1844
|
+
minDate: adapter.date("1900-01-01T00:00:00.000"),
|
|
1845
|
+
maxDate: adapter.date("2099-12-31T00:00:00.000")
|
|
1846
|
+
};
|
|
1847
|
+
}, [adapter]);
|
|
1848
|
+
const contextValue = React11.useMemo(() => {
|
|
1849
|
+
return {
|
|
1850
|
+
utils: adapter,
|
|
1851
|
+
adapter,
|
|
1852
|
+
defaultDates,
|
|
1853
|
+
localeText
|
|
1854
|
+
};
|
|
1855
|
+
}, [defaultDates, adapter, localeText]);
|
|
1856
|
+
return /* @__PURE__ */ jsx(PickerAdapterContext.Provider, {
|
|
1857
|
+
value: contextValue,
|
|
1858
|
+
children
|
|
1859
|
+
});
|
|
1860
|
+
};
|
|
1861
|
+
if (process.env.NODE_ENV !== "production") LocalizationProvider.displayName = "LocalizationProvider";
|
|
1862
|
+
process.env.NODE_ENV !== "production" ? LocalizationProvider.propTypes = {
|
|
1863
|
+
// ----------------------------- Warning --------------------------------
|
|
1864
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
1865
|
+
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
1866
|
+
// ----------------------------------------------------------------------
|
|
1867
|
+
/**
|
|
1868
|
+
* Locale for the date library you are using
|
|
1869
|
+
*/
|
|
1870
|
+
adapterLocale: import_prop_types.default.any,
|
|
1871
|
+
children: import_prop_types.default.node,
|
|
1872
|
+
/**
|
|
1873
|
+
* Date library adapter class function.
|
|
1874
|
+
* @see See the localization provider {@link https://mui.com/x/react-date-pickers/quickstart/#integrate-provider-and-adapter date adapter setup section} for more details.
|
|
1875
|
+
*/
|
|
1876
|
+
dateAdapter: import_prop_types.default.func,
|
|
1877
|
+
/**
|
|
1878
|
+
* Formats that are used for any child pickers
|
|
1879
|
+
*/
|
|
1880
|
+
dateFormats: import_prop_types.default.shape({
|
|
1881
|
+
dayOfMonth: import_prop_types.default.string,
|
|
1882
|
+
dayOfMonthFull: import_prop_types.default.string,
|
|
1883
|
+
fullDate: import_prop_types.default.string,
|
|
1884
|
+
fullTime12h: import_prop_types.default.string,
|
|
1885
|
+
fullTime24h: import_prop_types.default.string,
|
|
1886
|
+
hours12h: import_prop_types.default.string,
|
|
1887
|
+
hours24h: import_prop_types.default.string,
|
|
1888
|
+
keyboardDate: import_prop_types.default.string,
|
|
1889
|
+
keyboardDateTime12h: import_prop_types.default.string,
|
|
1890
|
+
keyboardDateTime24h: import_prop_types.default.string,
|
|
1891
|
+
meridiem: import_prop_types.default.string,
|
|
1892
|
+
minutes: import_prop_types.default.string,
|
|
1893
|
+
month: import_prop_types.default.string,
|
|
1894
|
+
monthShort: import_prop_types.default.string,
|
|
1895
|
+
normalDate: import_prop_types.default.string,
|
|
1896
|
+
normalDateWithWeekday: import_prop_types.default.string,
|
|
1897
|
+
seconds: import_prop_types.default.string,
|
|
1898
|
+
shortDate: import_prop_types.default.string,
|
|
1899
|
+
weekday: import_prop_types.default.string,
|
|
1900
|
+
weekdayShort: import_prop_types.default.string,
|
|
1901
|
+
year: import_prop_types.default.string
|
|
1902
|
+
}),
|
|
1903
|
+
/**
|
|
1904
|
+
* Date library instance you are using, if it has some global overrides
|
|
1905
|
+
* ```jsx
|
|
1906
|
+
* dateLibInstance={momentTimeZone}
|
|
1907
|
+
* ```
|
|
1908
|
+
*/
|
|
1909
|
+
dateLibInstance: import_prop_types.default.any,
|
|
1910
|
+
/**
|
|
1911
|
+
* Locale for components texts
|
|
1912
|
+
*/
|
|
1913
|
+
localeText: import_prop_types.default.object
|
|
1914
|
+
} : void 0;
|
|
1915
|
+
|
|
1916
|
+
// node_modules/@mui/x-internals/esm/warning/warning.js
|
|
1917
|
+
var warnedOnceCache = /* @__PURE__ */ new Set();
|
|
1918
|
+
function warnOnce(message, gravity = "warning") {
|
|
1919
|
+
if (process.env.NODE_ENV === "production") {
|
|
1920
|
+
return;
|
|
1921
|
+
}
|
|
1922
|
+
const cleanMessage = Array.isArray(message) ? message.join("\n") : message;
|
|
1923
|
+
if (!warnedOnceCache.has(cleanMessage)) {
|
|
1924
|
+
warnedOnceCache.add(cleanMessage);
|
|
1925
|
+
if (gravity === "error") {
|
|
1926
|
+
console.error(cleanMessage);
|
|
1927
|
+
} else {
|
|
1928
|
+
console.warn(cleanMessage);
|
|
1929
|
+
}
|
|
1930
|
+
}
|
|
1931
|
+
}
|
|
1932
|
+
dayjs.extend(localizedFormatPlugin);
|
|
1933
|
+
dayjs.extend(weekOfYearPlugin);
|
|
1934
|
+
dayjs.extend(isBetweenPlugin);
|
|
1935
|
+
dayjs.extend(advancedFormatPlugin);
|
|
1936
|
+
var formatTokenMap = {
|
|
1937
|
+
// Year
|
|
1938
|
+
YY: "year",
|
|
1939
|
+
YYYY: {
|
|
1940
|
+
sectionType: "year",
|
|
1941
|
+
contentType: "digit",
|
|
1942
|
+
maxLength: 4
|
|
1943
|
+
},
|
|
1944
|
+
// Month
|
|
1945
|
+
M: {
|
|
1946
|
+
sectionType: "month",
|
|
1947
|
+
contentType: "digit",
|
|
1948
|
+
maxLength: 2
|
|
1949
|
+
},
|
|
1950
|
+
MM: "month",
|
|
1951
|
+
MMM: {
|
|
1952
|
+
sectionType: "month",
|
|
1953
|
+
contentType: "letter"
|
|
1954
|
+
},
|
|
1955
|
+
MMMM: {
|
|
1956
|
+
sectionType: "month",
|
|
1957
|
+
contentType: "letter"
|
|
1958
|
+
},
|
|
1959
|
+
// Day of the month
|
|
1960
|
+
D: {
|
|
1961
|
+
sectionType: "day",
|
|
1962
|
+
contentType: "digit",
|
|
1963
|
+
maxLength: 2
|
|
1964
|
+
},
|
|
1965
|
+
DD: "day",
|
|
1966
|
+
Do: {
|
|
1967
|
+
sectionType: "day",
|
|
1968
|
+
contentType: "digit-with-letter"
|
|
1969
|
+
},
|
|
1970
|
+
// Day of the week
|
|
1971
|
+
d: {
|
|
1972
|
+
sectionType: "weekDay",
|
|
1973
|
+
contentType: "digit",
|
|
1974
|
+
maxLength: 2
|
|
1975
|
+
},
|
|
1976
|
+
dd: {
|
|
1977
|
+
sectionType: "weekDay",
|
|
1978
|
+
contentType: "letter"
|
|
1979
|
+
},
|
|
1980
|
+
ddd: {
|
|
1981
|
+
sectionType: "weekDay",
|
|
1982
|
+
contentType: "letter"
|
|
1983
|
+
},
|
|
1984
|
+
dddd: {
|
|
1985
|
+
sectionType: "weekDay",
|
|
1986
|
+
contentType: "letter"
|
|
1987
|
+
},
|
|
1988
|
+
// Meridiem
|
|
1989
|
+
A: "meridiem",
|
|
1990
|
+
a: "meridiem",
|
|
1991
|
+
// Hours
|
|
1992
|
+
H: {
|
|
1993
|
+
sectionType: "hours",
|
|
1994
|
+
contentType: "digit",
|
|
1995
|
+
maxLength: 2
|
|
1996
|
+
},
|
|
1997
|
+
HH: "hours",
|
|
1998
|
+
h: {
|
|
1999
|
+
sectionType: "hours",
|
|
2000
|
+
contentType: "digit",
|
|
2001
|
+
maxLength: 2
|
|
2002
|
+
},
|
|
2003
|
+
hh: "hours",
|
|
2004
|
+
// Minutes
|
|
2005
|
+
m: {
|
|
2006
|
+
sectionType: "minutes",
|
|
2007
|
+
contentType: "digit",
|
|
2008
|
+
maxLength: 2
|
|
2009
|
+
},
|
|
2010
|
+
mm: "minutes",
|
|
2011
|
+
// Seconds
|
|
2012
|
+
s: {
|
|
2013
|
+
sectionType: "seconds",
|
|
2014
|
+
contentType: "digit",
|
|
2015
|
+
maxLength: 2
|
|
2016
|
+
},
|
|
2017
|
+
ss: "seconds"
|
|
2018
|
+
};
|
|
2019
|
+
var defaultFormats = {
|
|
2020
|
+
year: "YYYY",
|
|
2021
|
+
month: "MMMM",
|
|
2022
|
+
monthShort: "MMM",
|
|
2023
|
+
dayOfMonth: "D",
|
|
2024
|
+
dayOfMonthFull: "Do",
|
|
2025
|
+
weekday: "dddd",
|
|
2026
|
+
weekdayShort: "dd",
|
|
2027
|
+
hours24h: "HH",
|
|
2028
|
+
hours12h: "hh",
|
|
2029
|
+
meridiem: "A",
|
|
2030
|
+
minutes: "mm",
|
|
2031
|
+
seconds: "ss",
|
|
2032
|
+
fullDate: "ll",
|
|
2033
|
+
keyboardDate: "L",
|
|
2034
|
+
shortDate: "MMM D",
|
|
2035
|
+
normalDate: "D MMMM",
|
|
2036
|
+
normalDateWithWeekday: "ddd, MMM D",
|
|
2037
|
+
fullTime12h: "hh:mm A",
|
|
2038
|
+
fullTime24h: "HH:mm",
|
|
2039
|
+
keyboardDateTime12h: "L hh:mm A",
|
|
2040
|
+
keyboardDateTime24h: "L HH:mm"
|
|
2041
|
+
};
|
|
2042
|
+
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");
|
|
2043
|
+
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");
|
|
2044
|
+
var AdapterDayjs = class {
|
|
2045
|
+
isMUIAdapter = true;
|
|
2046
|
+
isTimezoneCompatible = true;
|
|
2047
|
+
lib = "dayjs";
|
|
2048
|
+
escapedCharacters = {
|
|
2049
|
+
start: "[",
|
|
2050
|
+
end: "]"
|
|
2051
|
+
};
|
|
2052
|
+
formatTokenMap = /* @__PURE__ */ (() => formatTokenMap)();
|
|
2053
|
+
constructor({
|
|
2054
|
+
locale,
|
|
2055
|
+
formats
|
|
2056
|
+
} = {}) {
|
|
2057
|
+
this.locale = locale;
|
|
2058
|
+
this.formats = _extends({}, defaultFormats, formats);
|
|
2059
|
+
dayjs.extend(customParseFormatPlugin);
|
|
2060
|
+
}
|
|
2061
|
+
setLocaleToValue = (value) => {
|
|
2062
|
+
const expectedLocale = this.getCurrentLocaleCode();
|
|
2063
|
+
if (expectedLocale === value.locale()) {
|
|
2064
|
+
return value;
|
|
2065
|
+
}
|
|
2066
|
+
return value.locale(expectedLocale);
|
|
2067
|
+
};
|
|
2068
|
+
hasUTCPlugin = () => typeof dayjs.utc !== "undefined";
|
|
2069
|
+
hasTimezonePlugin = () => typeof dayjs.tz !== "undefined";
|
|
2070
|
+
isSame = (value, comparing, comparisonTemplate) => {
|
|
2071
|
+
const comparingInValueTimezone = this.setTimezone(comparing, this.getTimezone(value));
|
|
2072
|
+
return value.format(comparisonTemplate) === comparingInValueTimezone.format(comparisonTemplate);
|
|
2073
|
+
};
|
|
2074
|
+
/**
|
|
2075
|
+
* Replaces "default" by undefined and "system" by the system timezone before passing it to `dayjs`.
|
|
2076
|
+
*/
|
|
2077
|
+
cleanTimezone = (timezone) => {
|
|
2078
|
+
switch (timezone) {
|
|
2079
|
+
case "default": {
|
|
2080
|
+
return void 0;
|
|
2081
|
+
}
|
|
2082
|
+
case "system": {
|
|
2083
|
+
return dayjs.tz.guess();
|
|
2084
|
+
}
|
|
2085
|
+
default: {
|
|
2086
|
+
return timezone;
|
|
2087
|
+
}
|
|
2088
|
+
}
|
|
2089
|
+
};
|
|
2090
|
+
createSystemDate = (value) => {
|
|
2091
|
+
let date;
|
|
2092
|
+
if (this.hasUTCPlugin() && this.hasTimezonePlugin()) {
|
|
2093
|
+
const timezone = dayjs.tz.guess();
|
|
2094
|
+
if (timezone === "UTC") {
|
|
2095
|
+
date = dayjs(value);
|
|
2096
|
+
} else {
|
|
2097
|
+
date = dayjs.tz(value, timezone);
|
|
2098
|
+
}
|
|
2099
|
+
} else {
|
|
2100
|
+
date = dayjs(value);
|
|
2101
|
+
}
|
|
2102
|
+
return this.setLocaleToValue(date);
|
|
2103
|
+
};
|
|
2104
|
+
createUTCDate = (value) => {
|
|
2105
|
+
if (!this.hasUTCPlugin()) {
|
|
2106
|
+
throw new Error(MISSING_UTC_PLUGIN);
|
|
2107
|
+
}
|
|
2108
|
+
return this.setLocaleToValue(dayjs.utc(value));
|
|
2109
|
+
};
|
|
2110
|
+
createTZDate = (value, timezone) => {
|
|
2111
|
+
if (!this.hasUTCPlugin()) {
|
|
2112
|
+
throw new Error(MISSING_UTC_PLUGIN);
|
|
2113
|
+
}
|
|
2114
|
+
if (!this.hasTimezonePlugin()) {
|
|
2115
|
+
throw new Error(MISSING_TIMEZONE_PLUGIN);
|
|
2116
|
+
}
|
|
2117
|
+
const keepLocalTime = value !== void 0 && !value.endsWith("Z");
|
|
2118
|
+
return this.setLocaleToValue(dayjs(value).tz(this.cleanTimezone(timezone), keepLocalTime));
|
|
2119
|
+
};
|
|
2120
|
+
getLocaleFormats = () => {
|
|
2121
|
+
const locales = dayjs.Ls;
|
|
2122
|
+
const locale = this.locale || "en";
|
|
2123
|
+
let localeObject = locales[locale];
|
|
2124
|
+
if (localeObject === void 0) {
|
|
2125
|
+
if (process.env.NODE_ENV !== "production") {
|
|
2126
|
+
warnOnce(["MUI X: Your locale has not been found.", "Either the locale key is not a supported one. Locales supported by dayjs are available here: https://github.com/iamkun/dayjs/tree/dev/src/locale.", "Or you forget to import the locale from 'dayjs/locale/{localeUsed}'", "fallback on English locale."]);
|
|
2127
|
+
}
|
|
2128
|
+
localeObject = locales.en;
|
|
2129
|
+
}
|
|
2130
|
+
return localeObject.formats;
|
|
2131
|
+
};
|
|
2132
|
+
/**
|
|
2133
|
+
* If the new day does not have the same offset as the old one (when switching to summer day time for example),
|
|
2134
|
+
* Then dayjs will not automatically adjust the offset (moment does).
|
|
2135
|
+
* We have to parse again the value to make sure the `fixOffset` method is applied.
|
|
2136
|
+
* See https://github.com/iamkun/dayjs/blob/b3624de619d6e734cd0ffdbbd3502185041c1b60/src/plugin/timezone/index.js#L72
|
|
2137
|
+
*/
|
|
2138
|
+
adjustOffset = (value) => {
|
|
2139
|
+
if (!this.hasTimezonePlugin()) {
|
|
2140
|
+
return value;
|
|
2141
|
+
}
|
|
2142
|
+
const timezone = this.getTimezone(value);
|
|
2143
|
+
if (timezone !== "UTC") {
|
|
2144
|
+
const fixedValue = value.tz(this.cleanTimezone(timezone), true);
|
|
2145
|
+
if (fixedValue.$offset === (value.$offset ?? 0)) {
|
|
2146
|
+
return value;
|
|
2147
|
+
}
|
|
2148
|
+
value.$offset = fixedValue.$offset;
|
|
2149
|
+
}
|
|
2150
|
+
return value;
|
|
2151
|
+
};
|
|
2152
|
+
date = (value, timezone = "default") => {
|
|
2153
|
+
if (value === null) {
|
|
2154
|
+
return null;
|
|
2155
|
+
}
|
|
2156
|
+
if (timezone === "UTC") {
|
|
2157
|
+
return this.createUTCDate(value);
|
|
2158
|
+
}
|
|
2159
|
+
if (timezone === "system" || timezone === "default" && !this.hasTimezonePlugin()) {
|
|
2160
|
+
return this.createSystemDate(value);
|
|
2161
|
+
}
|
|
2162
|
+
return this.createTZDate(value, timezone);
|
|
2163
|
+
};
|
|
2164
|
+
getInvalidDate = () => dayjs(/* @__PURE__ */ new Date("Invalid date"));
|
|
2165
|
+
getTimezone = (value) => {
|
|
2166
|
+
if (this.hasTimezonePlugin()) {
|
|
2167
|
+
const zone = value.$x?.$timezone;
|
|
2168
|
+
if (zone) {
|
|
2169
|
+
return zone;
|
|
2170
|
+
}
|
|
2171
|
+
}
|
|
2172
|
+
if (this.hasUTCPlugin() && value.isUTC()) {
|
|
2173
|
+
return "UTC";
|
|
2174
|
+
}
|
|
2175
|
+
return "system";
|
|
2176
|
+
};
|
|
2177
|
+
setTimezone = (value, timezone) => {
|
|
2178
|
+
if (this.getTimezone(value) === timezone) {
|
|
2179
|
+
return value;
|
|
2180
|
+
}
|
|
2181
|
+
if (timezone === "UTC") {
|
|
2182
|
+
if (!this.hasUTCPlugin()) {
|
|
2183
|
+
throw new Error(MISSING_UTC_PLUGIN);
|
|
2184
|
+
}
|
|
2185
|
+
return value.utc();
|
|
2186
|
+
}
|
|
2187
|
+
if (timezone === "system") {
|
|
2188
|
+
return value.local();
|
|
2189
|
+
}
|
|
2190
|
+
if (!this.hasTimezonePlugin()) {
|
|
2191
|
+
if (timezone === "default") {
|
|
2192
|
+
return value;
|
|
2193
|
+
}
|
|
2194
|
+
throw new Error(MISSING_TIMEZONE_PLUGIN);
|
|
2195
|
+
}
|
|
2196
|
+
return this.setLocaleToValue(dayjs.tz(value, this.cleanTimezone(timezone)));
|
|
2197
|
+
};
|
|
2198
|
+
toJsDate = (value) => {
|
|
2199
|
+
return value.toDate();
|
|
2200
|
+
};
|
|
2201
|
+
parse = (value, format) => {
|
|
2202
|
+
if (value === "") {
|
|
2203
|
+
return null;
|
|
2204
|
+
}
|
|
2205
|
+
return dayjs(value, format, this.locale, true);
|
|
2206
|
+
};
|
|
2207
|
+
getCurrentLocaleCode = () => {
|
|
2208
|
+
return this.locale || "en";
|
|
2209
|
+
};
|
|
2210
|
+
is12HourCycleInCurrentLocale = () => {
|
|
2211
|
+
return /A|a/.test(this.getLocaleFormats().LT || "");
|
|
2212
|
+
};
|
|
2213
|
+
expandFormat = (format) => {
|
|
2214
|
+
const localeFormats = this.getLocaleFormats();
|
|
2215
|
+
const t2 = (formatBis) => formatBis.replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g, (_, a, b) => a || b.slice(1));
|
|
2216
|
+
return format.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g, (_, a, b) => {
|
|
2217
|
+
const B = b && b.toUpperCase();
|
|
2218
|
+
return a || localeFormats[b] || t2(localeFormats[B]);
|
|
2219
|
+
});
|
|
2220
|
+
};
|
|
2221
|
+
isValid = (value) => {
|
|
2222
|
+
if (value == null) {
|
|
2223
|
+
return false;
|
|
2224
|
+
}
|
|
2225
|
+
return value.isValid();
|
|
2226
|
+
};
|
|
2227
|
+
format = (value, formatKey) => {
|
|
2228
|
+
return this.formatByString(value, this.formats[formatKey]);
|
|
2229
|
+
};
|
|
2230
|
+
formatByString = (value, formatString) => {
|
|
2231
|
+
return this.setLocaleToValue(value).format(formatString);
|
|
2232
|
+
};
|
|
2233
|
+
formatNumber = (numberToFormat) => {
|
|
2234
|
+
return numberToFormat;
|
|
2235
|
+
};
|
|
2236
|
+
isEqual = (value, comparing) => {
|
|
2237
|
+
if (value === null && comparing === null) {
|
|
2238
|
+
return true;
|
|
2239
|
+
}
|
|
2240
|
+
if (value === null || comparing === null) {
|
|
2241
|
+
return false;
|
|
2242
|
+
}
|
|
2243
|
+
return value.toDate().getTime() === comparing.toDate().getTime();
|
|
2244
|
+
};
|
|
2245
|
+
isSameYear = (value, comparing) => {
|
|
2246
|
+
return this.isSame(value, comparing, "YYYY");
|
|
2247
|
+
};
|
|
2248
|
+
isSameMonth = (value, comparing) => {
|
|
2249
|
+
return this.isSame(value, comparing, "YYYY-MM");
|
|
2250
|
+
};
|
|
2251
|
+
isSameDay = (value, comparing) => {
|
|
2252
|
+
return this.isSame(value, comparing, "YYYY-MM-DD");
|
|
2253
|
+
};
|
|
2254
|
+
isSameHour = (value, comparing) => {
|
|
2255
|
+
return value.isSame(comparing, "hour");
|
|
2256
|
+
};
|
|
2257
|
+
isAfter = (value, comparing) => {
|
|
2258
|
+
return value > comparing;
|
|
2259
|
+
};
|
|
2260
|
+
isAfterYear = (value, comparing) => {
|
|
2261
|
+
if (!this.hasUTCPlugin()) {
|
|
2262
|
+
return value.isAfter(comparing, "year");
|
|
2263
|
+
}
|
|
2264
|
+
return !this.isSameYear(value, comparing) && value.utc() > comparing.utc();
|
|
2265
|
+
};
|
|
2266
|
+
isAfterDay = (value, comparing) => {
|
|
2267
|
+
if (!this.hasUTCPlugin()) {
|
|
2268
|
+
return value.isAfter(comparing, "day");
|
|
2269
|
+
}
|
|
2270
|
+
return !this.isSameDay(value, comparing) && value.utc() > comparing.utc();
|
|
2271
|
+
};
|
|
2272
|
+
isBefore = (value, comparing) => {
|
|
2273
|
+
return value < comparing;
|
|
2274
|
+
};
|
|
2275
|
+
isBeforeYear = (value, comparing) => {
|
|
2276
|
+
if (!this.hasUTCPlugin()) {
|
|
2277
|
+
return value.isBefore(comparing, "year");
|
|
2278
|
+
}
|
|
2279
|
+
return !this.isSameYear(value, comparing) && value.utc() < comparing.utc();
|
|
2280
|
+
};
|
|
2281
|
+
isBeforeDay = (value, comparing) => {
|
|
2282
|
+
if (!this.hasUTCPlugin()) {
|
|
2283
|
+
return value.isBefore(comparing, "day");
|
|
2284
|
+
}
|
|
2285
|
+
return !this.isSameDay(value, comparing) && value.utc() < comparing.utc();
|
|
2286
|
+
};
|
|
2287
|
+
isWithinRange = (value, [start, end]) => {
|
|
2288
|
+
return value >= start && value <= end;
|
|
2289
|
+
};
|
|
2290
|
+
startOfYear = (value) => {
|
|
2291
|
+
return this.adjustOffset(value.startOf("year"));
|
|
2292
|
+
};
|
|
2293
|
+
startOfMonth = (value) => {
|
|
2294
|
+
return this.adjustOffset(value.startOf("month"));
|
|
2295
|
+
};
|
|
2296
|
+
startOfWeek = (value) => {
|
|
2297
|
+
return this.adjustOffset(this.setLocaleToValue(value).startOf("week"));
|
|
2298
|
+
};
|
|
2299
|
+
startOfDay = (value) => {
|
|
2300
|
+
return this.adjustOffset(value.startOf("day"));
|
|
2301
|
+
};
|
|
2302
|
+
endOfYear = (value) => {
|
|
2303
|
+
return this.adjustOffset(value.endOf("year"));
|
|
2304
|
+
};
|
|
2305
|
+
endOfMonth = (value) => {
|
|
2306
|
+
return this.adjustOffset(value.endOf("month"));
|
|
2307
|
+
};
|
|
2308
|
+
endOfWeek = (value) => {
|
|
2309
|
+
return this.adjustOffset(this.setLocaleToValue(value).endOf("week"));
|
|
2310
|
+
};
|
|
2311
|
+
endOfDay = (value) => {
|
|
2312
|
+
return this.adjustOffset(value.endOf("day"));
|
|
2313
|
+
};
|
|
2314
|
+
addYears = (value, amount) => {
|
|
2315
|
+
return this.adjustOffset(value.add(amount, "year"));
|
|
2316
|
+
};
|
|
2317
|
+
addMonths = (value, amount) => {
|
|
2318
|
+
return this.adjustOffset(value.add(amount, "month"));
|
|
2319
|
+
};
|
|
2320
|
+
addWeeks = (value, amount) => {
|
|
2321
|
+
return this.adjustOffset(value.add(amount, "week"));
|
|
2322
|
+
};
|
|
2323
|
+
addDays = (value, amount) => {
|
|
2324
|
+
return this.adjustOffset(value.add(amount, "day"));
|
|
2325
|
+
};
|
|
2326
|
+
addHours = (value, amount) => {
|
|
2327
|
+
return this.adjustOffset(value.add(amount, "hour"));
|
|
2328
|
+
};
|
|
2329
|
+
addMinutes = (value, amount) => {
|
|
2330
|
+
return this.adjustOffset(value.add(amount, "minute"));
|
|
2331
|
+
};
|
|
2332
|
+
addSeconds = (value, amount) => {
|
|
2333
|
+
return this.adjustOffset(value.add(amount, "second"));
|
|
2334
|
+
};
|
|
2335
|
+
getYear = (value) => {
|
|
2336
|
+
return value.year();
|
|
2337
|
+
};
|
|
2338
|
+
getMonth = (value) => {
|
|
2339
|
+
return value.month();
|
|
2340
|
+
};
|
|
2341
|
+
getDate = (value) => {
|
|
2342
|
+
return value.date();
|
|
2343
|
+
};
|
|
2344
|
+
getHours = (value) => {
|
|
2345
|
+
return value.hour();
|
|
2346
|
+
};
|
|
2347
|
+
getMinutes = (value) => {
|
|
2348
|
+
return value.minute();
|
|
2349
|
+
};
|
|
2350
|
+
getSeconds = (value) => {
|
|
2351
|
+
return value.second();
|
|
2352
|
+
};
|
|
2353
|
+
getMilliseconds = (value) => {
|
|
2354
|
+
return value.millisecond();
|
|
2355
|
+
};
|
|
2356
|
+
setYear = (value, year) => {
|
|
2357
|
+
return this.adjustOffset(value.set("year", year));
|
|
2358
|
+
};
|
|
2359
|
+
setMonth = (value, month) => {
|
|
2360
|
+
return this.adjustOffset(value.set("month", month));
|
|
2361
|
+
};
|
|
2362
|
+
setDate = (value, date) => {
|
|
2363
|
+
return this.adjustOffset(value.set("date", date));
|
|
2364
|
+
};
|
|
2365
|
+
setHours = (value, hours) => {
|
|
2366
|
+
return this.adjustOffset(value.set("hour", hours));
|
|
2367
|
+
};
|
|
2368
|
+
setMinutes = (value, minutes) => {
|
|
2369
|
+
return this.adjustOffset(value.set("minute", minutes));
|
|
2370
|
+
};
|
|
2371
|
+
setSeconds = (value, seconds) => {
|
|
2372
|
+
return this.adjustOffset(value.set("second", seconds));
|
|
2373
|
+
};
|
|
2374
|
+
setMilliseconds = (value, milliseconds) => {
|
|
2375
|
+
return this.adjustOffset(value.set("millisecond", milliseconds));
|
|
2376
|
+
};
|
|
2377
|
+
getDaysInMonth = (value) => {
|
|
2378
|
+
return value.daysInMonth();
|
|
2379
|
+
};
|
|
2380
|
+
getWeekArray = (value) => {
|
|
2381
|
+
const start = this.startOfWeek(this.startOfMonth(value));
|
|
2382
|
+
const end = this.endOfWeek(this.endOfMonth(value));
|
|
2383
|
+
let count = 0;
|
|
2384
|
+
let current = start;
|
|
2385
|
+
const nestedWeeks = [];
|
|
2386
|
+
while (current < end) {
|
|
2387
|
+
const weekNumber = Math.floor(count / 7);
|
|
2388
|
+
nestedWeeks[weekNumber] = nestedWeeks[weekNumber] || [];
|
|
2389
|
+
nestedWeeks[weekNumber].push(current);
|
|
2390
|
+
current = this.addDays(current, 1);
|
|
2391
|
+
count += 1;
|
|
2392
|
+
}
|
|
2393
|
+
return nestedWeeks;
|
|
2394
|
+
};
|
|
2395
|
+
getWeekNumber = (value) => {
|
|
2396
|
+
return value.week();
|
|
2397
|
+
};
|
|
2398
|
+
getDayOfWeek(value) {
|
|
2399
|
+
return value.day() + 1;
|
|
2400
|
+
}
|
|
2401
|
+
getYearRange = ([start, end]) => {
|
|
2402
|
+
const startDate = this.startOfYear(start);
|
|
2403
|
+
const endDate = this.endOfYear(end);
|
|
2404
|
+
const years = [];
|
|
2405
|
+
let current = startDate;
|
|
2406
|
+
while (this.isBefore(current, endDate)) {
|
|
2407
|
+
years.push(current);
|
|
2408
|
+
current = this.addYears(current, 1);
|
|
2409
|
+
}
|
|
2410
|
+
return years;
|
|
2411
|
+
};
|
|
2412
|
+
};
|
|
2413
|
+
var WISTRON_PRIMARY_COLOR = "#00506E";
|
|
2414
|
+
var WISTRON_SECONDARY_COLOR = "#64DC00";
|
|
2415
|
+
var useGetTheme = (theme) => {
|
|
2416
|
+
const { i18n: i18n2 } = useTranslation();
|
|
2417
|
+
return createTheme(
|
|
2418
|
+
{
|
|
2419
|
+
cssVariables: {
|
|
2420
|
+
colorSchemeSelector: "data-mui-color-scheme"
|
|
2421
|
+
},
|
|
2422
|
+
colorSchemes: {
|
|
2423
|
+
light: {
|
|
2424
|
+
palette: {
|
|
2425
|
+
primary: { main: WISTRON_PRIMARY_COLOR },
|
|
2426
|
+
secondary: { main: WISTRON_SECONDARY_COLOR }
|
|
2427
|
+
}
|
|
2428
|
+
},
|
|
2429
|
+
dark: {
|
|
2430
|
+
palette: {
|
|
2431
|
+
primary: { main: lighten(WISTRON_PRIMARY_COLOR, 0.5) },
|
|
2432
|
+
secondary: { main: darken(WISTRON_SECONDARY_COLOR, 0.5) }
|
|
2433
|
+
}
|
|
2434
|
+
},
|
|
2435
|
+
...theme?.colorSchemes
|
|
2436
|
+
},
|
|
2437
|
+
components: {
|
|
2438
|
+
MuiCssBaseline: {
|
|
2439
|
+
styleOverrides: (theme2) => {
|
|
2440
|
+
return {
|
|
2441
|
+
body: {
|
|
2442
|
+
"&::-webkit-scrollbar, & *::-webkit-scrollbar": {
|
|
2443
|
+
width: "0.7em",
|
|
2444
|
+
height: "0.7em"
|
|
2445
|
+
},
|
|
2446
|
+
"&::-webkit-scrollbar-track, & *::-webkit-scrollbar-track": {
|
|
2447
|
+
backgroundColor: theme2.palette.mode === "dark" ? grey[900] : grey[200],
|
|
2448
|
+
borderRadius: "5px"
|
|
2449
|
+
},
|
|
2450
|
+
"&::-webkit-scrollbar-thumb, & *::-webkit-scrollbar-thumb": {
|
|
2451
|
+
backgroundColor: theme2.palette.mode === "dark" ? grey[800] : grey[400],
|
|
2452
|
+
borderRadius: "10px"
|
|
2453
|
+
},
|
|
2454
|
+
"&::-webkit-scrollbar-thumb:hover, & *::-webkit-scrollbar-thumb:hover": {
|
|
2455
|
+
backgroundColor: theme2.palette.mode === "dark" ? grey[700] : grey[500]
|
|
2456
|
+
},
|
|
2457
|
+
"&::-webkit-scrollbar-corner, & *::-webkit-scrollbar-corner": {
|
|
2458
|
+
backgroundColor: "transparent"
|
|
2459
|
+
}
|
|
2460
|
+
}
|
|
2461
|
+
};
|
|
2462
|
+
}
|
|
2463
|
+
},
|
|
2464
|
+
...theme?.components
|
|
2465
|
+
}
|
|
2466
|
+
},
|
|
2467
|
+
i18n2.resolvedLanguage === "cs" ? csCZ : enUS,
|
|
2468
|
+
i18n2.resolvedLanguage === "cs" ? csCZ$1 : enUS$1,
|
|
2469
|
+
i18n2.resolvedLanguage === "cs" ? csCZ$2 : enUS$2
|
|
2470
|
+
);
|
|
2471
|
+
};
|
|
2472
|
+
var ICON_SIZE = 34;
|
|
2473
|
+
var StyledNavButton = styled(ListItemButton4)(({ theme }) => ({
|
|
2474
|
+
borderRadius: 8,
|
|
2475
|
+
"&.Mui-selected": {
|
|
2476
|
+
"& .MuiListItemIcon-root, & .MuiTypography-root, & .MuiSvgIcon-root": {
|
|
2477
|
+
color: (theme.vars ?? theme).palette.primary.dark
|
|
2478
|
+
},
|
|
2479
|
+
"& .MuiAvatar-root": {
|
|
2480
|
+
backgroundColor: (theme.vars ?? theme).palette.primary.dark
|
|
2481
|
+
},
|
|
2482
|
+
"& .MuiTouchRipple-child": {
|
|
2483
|
+
backgroundColor: (theme.vars ?? theme).palette.primary.dark
|
|
2484
|
+
}
|
|
2485
|
+
},
|
|
2486
|
+
"& .MuiSvgIcon-root": {
|
|
2487
|
+
color: (theme.vars ?? theme).palette.action.active
|
|
2488
|
+
},
|
|
2489
|
+
"& .MuiAvatar-root": {
|
|
2490
|
+
backgroundColor: (theme.vars ?? theme).palette.action.active
|
|
2491
|
+
}
|
|
2492
|
+
}));
|
|
2493
|
+
var StyledRouterButton = styled(RouterListItemButton)(({ theme }) => ({
|
|
2494
|
+
borderRadius: 8,
|
|
2495
|
+
"&.Mui-selected": {
|
|
2496
|
+
"& .MuiListItemIcon-root, & .MuiTypography-root, & .MuiSvgIcon-root": {
|
|
2497
|
+
color: (theme.vars ?? theme).palette.primary.dark
|
|
2498
|
+
},
|
|
2499
|
+
"& .MuiAvatar-root": {
|
|
2500
|
+
backgroundColor: (theme.vars ?? theme).palette.primary.dark
|
|
2501
|
+
},
|
|
2502
|
+
"& .MuiTouchRipple-child": {
|
|
2503
|
+
backgroundColor: (theme.vars ?? theme).palette.primary.dark
|
|
2504
|
+
}
|
|
2505
|
+
},
|
|
2506
|
+
"& .MuiSvgIcon-root": {
|
|
2507
|
+
color: (theme.vars ?? theme).palette.action.active
|
|
2508
|
+
},
|
|
2509
|
+
"& .MuiAvatar-root": {
|
|
2510
|
+
backgroundColor: (theme.vars ?? theme).palette.action.active
|
|
2511
|
+
}
|
|
2512
|
+
}));
|
|
2513
|
+
var IconOrAvatar = ({ item, collapsed }) => {
|
|
2514
|
+
if (item.icon || collapsed) {
|
|
2515
|
+
return /* @__PURE__ */ jsxs(Box6, { sx: collapsed ? { position: "absolute", left: "50%", top: "calc(50% - 6px)", transform: "translate(-50%, -50%)" } : {}, children: [
|
|
2516
|
+
/* @__PURE__ */ jsxs(ListItemIcon3, { sx: { display: "flex", alignItems: "center", justifyContent: "center", minWidth: ICON_SIZE }, children: [
|
|
2517
|
+
item.icon ?? null,
|
|
2518
|
+
!item.icon && collapsed ? /* @__PURE__ */ jsx(Avatar$1, { sx: { width: ICON_SIZE - 7, height: ICON_SIZE - 7, fontSize: 12 }, children: item.title }) : null
|
|
2519
|
+
] }),
|
|
2520
|
+
collapsed ? /* @__PURE__ */ jsx(
|
|
2521
|
+
Typography7,
|
|
2522
|
+
{
|
|
2523
|
+
variant: "caption",
|
|
2524
|
+
sx: {
|
|
2525
|
+
position: "absolute",
|
|
2526
|
+
bottom: -18,
|
|
2527
|
+
left: "50%",
|
|
2528
|
+
transform: "translateX(-50%)",
|
|
2529
|
+
fontSize: 10,
|
|
2530
|
+
fontWeight: 500,
|
|
2531
|
+
textAlign: "center",
|
|
2532
|
+
whiteSpace: "nowrap",
|
|
2533
|
+
overflow: "hidden",
|
|
2534
|
+
textOverflow: "ellipsis",
|
|
2535
|
+
maxWidth: MINI_WIDTH - 28
|
|
2536
|
+
},
|
|
2537
|
+
children: item.title
|
|
2538
|
+
}
|
|
2539
|
+
) : null
|
|
2540
|
+
] });
|
|
2541
|
+
}
|
|
2542
|
+
return null;
|
|
2543
|
+
};
|
|
2544
|
+
var MiniPopover = ({ open, anchorEl, children }) => /* @__PURE__ */ jsx(
|
|
2545
|
+
Popper,
|
|
2546
|
+
{
|
|
2547
|
+
open,
|
|
2548
|
+
anchorEl,
|
|
2549
|
+
placement: "right-start",
|
|
2550
|
+
modifiers: [
|
|
2551
|
+
{ name: "offset", options: { offset: [6, 0] } },
|
|
2552
|
+
{ name: "preventOverflow", options: { padding: 8 } },
|
|
2553
|
+
{ name: "flip", options: { fallbackPlacements: ["right-end", "left-start"] } }
|
|
2554
|
+
],
|
|
2555
|
+
children: /* @__PURE__ */ jsx(
|
|
2556
|
+
Paper2,
|
|
2557
|
+
{
|
|
2558
|
+
sx: {
|
|
2559
|
+
pt: 0.5,
|
|
2560
|
+
pb: 0.5,
|
|
2561
|
+
maxHeight: "min(calc(100vh - 100px), 560px)",
|
|
2562
|
+
overflowY: "auto",
|
|
2563
|
+
overscrollBehavior: "contain"
|
|
2564
|
+
},
|
|
2565
|
+
children
|
|
2566
|
+
}
|
|
2567
|
+
)
|
|
2568
|
+
}
|
|
2569
|
+
);
|
|
2570
|
+
var NavigationListItem = ({ item, isOpen, selected, disabled, collapsed, isSidebarFullyExpanded = true, isSidebarFullyCollapsed, onClick, renderNested }) => {
|
|
2571
|
+
const [hoveredPopoverItem, setHoveredPopoverItem] = useState(null);
|
|
2572
|
+
const [anchorElement, setAnchorElement] = useState(null);
|
|
2573
|
+
const chevronSx = useMemo(() => {
|
|
2574
|
+
if (collapsed && isSidebarFullyCollapsed && item.children) {
|
|
2575
|
+
return {
|
|
2576
|
+
fontSize: 18,
|
|
2577
|
+
position: "absolute",
|
|
2578
|
+
top: "41.5%",
|
|
2579
|
+
right: "2px",
|
|
2580
|
+
transform: "translateY(-50%) rotate(-90deg)"
|
|
2581
|
+
};
|
|
2582
|
+
}
|
|
2583
|
+
if (!collapsed && isSidebarFullyExpanded && item.children) {
|
|
2584
|
+
return {
|
|
2585
|
+
ml: 0.5,
|
|
2586
|
+
transform: `rotate(${isOpen ? 0 : -90}deg)`
|
|
2587
|
+
};
|
|
2588
|
+
}
|
|
2589
|
+
return { display: "none" };
|
|
2590
|
+
}, [collapsed, isSidebarFullyExpanded, isSidebarFullyCollapsed, isOpen, item.children]);
|
|
2591
|
+
const shouldJustExpand = item.children && !collapsed;
|
|
2592
|
+
const buttonProps = {
|
|
2593
|
+
selected,
|
|
2594
|
+
disabled,
|
|
2595
|
+
sx: { px: 1.4, height: collapsed ? 60 : 48 }
|
|
2596
|
+
};
|
|
2597
|
+
const buttonContent = /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
2598
|
+
/* @__PURE__ */ jsx(IconOrAvatar, { item, collapsed }),
|
|
2599
|
+
!collapsed && /* @__PURE__ */ jsx(
|
|
2600
|
+
ListItemText3,
|
|
2601
|
+
{
|
|
2602
|
+
primary: item.title,
|
|
2603
|
+
slotProps: { primary: { noWrap: true, title: item.title } },
|
|
2604
|
+
sx: { ml: 1.2, flex: 1, minWidth: 0, "& .MuiTypography-root": { whiteSpace: "nowrap", overflow: "hidden", textOverflow: "ellipsis" } }
|
|
2605
|
+
}
|
|
2606
|
+
),
|
|
2607
|
+
item.children ? /* @__PURE__ */ jsx(ExpandMoreIcon, { sx: chevronSx }) : null
|
|
2608
|
+
] });
|
|
2609
|
+
const listItem = /* @__PURE__ */ jsxs(
|
|
2610
|
+
ListItem$1,
|
|
2611
|
+
{
|
|
2612
|
+
...item.children && collapsed ? {
|
|
2613
|
+
onMouseEnter: (event) => {
|
|
2614
|
+
setAnchorElement(event.currentTarget);
|
|
2615
|
+
setHoveredPopoverItem(item.title);
|
|
2616
|
+
},
|
|
2617
|
+
onMouseLeave: () => {
|
|
2618
|
+
setHoveredPopoverItem(null);
|
|
2619
|
+
}
|
|
2620
|
+
} : {},
|
|
2621
|
+
sx: { py: 0, px: 1, overflowX: "hidden" },
|
|
2622
|
+
children: [
|
|
2623
|
+
shouldJustExpand ? /* @__PURE__ */ jsx(StyledNavButton, { ...buttonProps, onClick: () => onClick?.(item), children: buttonContent }) : /* @__PURE__ */ jsx(
|
|
2624
|
+
StyledRouterButton,
|
|
2625
|
+
{
|
|
2626
|
+
...buttonProps,
|
|
2627
|
+
to: item.to,
|
|
2628
|
+
href: item.href,
|
|
2629
|
+
params: item.params,
|
|
2630
|
+
search: item.search,
|
|
2631
|
+
children: buttonContent
|
|
2632
|
+
}
|
|
2633
|
+
),
|
|
2634
|
+
item.children && collapsed ? /* @__PURE__ */ jsx(MiniPopover, { open: item.title === hoveredPopoverItem, anchorEl: anchorElement, children: renderNested?.(item.children) }) : null
|
|
2635
|
+
]
|
|
2636
|
+
}
|
|
2637
|
+
);
|
|
2638
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2639
|
+
listItem,
|
|
2640
|
+
item.children && !collapsed ? /* @__PURE__ */ jsx(Collapse, { in: isOpen, timeout: "auto", unmountOnExit: true, children: renderNested?.(item.children) }) : null
|
|
2641
|
+
] }, item.to);
|
|
2642
|
+
};
|
|
2643
|
+
var isPageItem = (item) => !("kind" in item);
|
|
2644
|
+
var isDivider = (item) => "kind" in item && item.kind === "divider";
|
|
2645
|
+
var isHeader = (item) => "kind" in item && item.kind === "header";
|
|
2646
|
+
var NavigationList = ({ subNavigation, depth = 0, collapsed, isPopover, isSidebarFullyExpanded = true, isSidebarFullyCollapsed, expandedWidth, renderItem, activePath, onNavigate }) => {
|
|
2647
|
+
const [openKeys, setOpenKeys] = useState([]);
|
|
2648
|
+
useEffect(() => {
|
|
2649
|
+
if (collapsed) setOpenKeys([]);
|
|
2650
|
+
}, [collapsed]);
|
|
2651
|
+
const toggleKey = (key) => setOpenKeys((previous) => previous.includes(key) ? previous.filter((k) => k !== key) : [...previous, key]);
|
|
2652
|
+
const renderNested = (children) => /* @__PURE__ */ jsx(
|
|
2653
|
+
NavigationList,
|
|
2654
|
+
{
|
|
2655
|
+
subNavigation: children,
|
|
2656
|
+
depth: depth + 1,
|
|
2657
|
+
isPopover: collapsed,
|
|
2658
|
+
expandedWidth,
|
|
2659
|
+
activePath,
|
|
2660
|
+
onNavigate
|
|
2661
|
+
}
|
|
2662
|
+
);
|
|
2663
|
+
const filteredNavigation = subNavigation.filter((nav) => !nav.hidden);
|
|
2664
|
+
return /* @__PURE__ */ jsx(
|
|
2665
|
+
List3,
|
|
2666
|
+
{
|
|
2667
|
+
sx: {
|
|
2668
|
+
padding: 0,
|
|
2669
|
+
mt: isPopover && depth === 1 ? 0.5 : 0,
|
|
2670
|
+
mb: depth === 0 && !isPopover ? 4 : 0.5,
|
|
2671
|
+
pl: (isPopover ? 1 : 2) * (isPopover ? depth - 1 : depth),
|
|
2672
|
+
minWidth: isPopover && depth === 1 ? EXPANDED_WIDTH : "auto",
|
|
2673
|
+
width: collapsed ? MINI_WIDTH : "auto"
|
|
2674
|
+
},
|
|
2675
|
+
children: filteredNavigation.map((navItem, index) => {
|
|
2676
|
+
if (isHeader(navItem)) {
|
|
2677
|
+
return /* @__PURE__ */ jsx(
|
|
2678
|
+
ListSubheader$1,
|
|
2679
|
+
{
|
|
2680
|
+
sx: {
|
|
2681
|
+
fontSize: 12,
|
|
2682
|
+
fontWeight: "700",
|
|
2683
|
+
height: collapsed ? 0 : 40,
|
|
2684
|
+
px: 2,
|
|
2685
|
+
minWidth: expandedWidth,
|
|
2686
|
+
overflow: "hidden",
|
|
2687
|
+
textOverflow: "ellipsis",
|
|
2688
|
+
whiteSpace: "nowrap",
|
|
2689
|
+
zIndex: 2,
|
|
2690
|
+
bgcolor: "transparent",
|
|
2691
|
+
position: "static"
|
|
2692
|
+
},
|
|
2693
|
+
children: navItem.title
|
|
2694
|
+
},
|
|
2695
|
+
`subheader-${depth}-${index}`
|
|
2696
|
+
);
|
|
2697
|
+
}
|
|
2698
|
+
if (isDivider(navItem)) {
|
|
2699
|
+
const nextItem = filteredNavigation[index + 1];
|
|
2700
|
+
return /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx(Divider3, { sx: { mx: 1, mt: 1, mb: nextItem && isHeader(nextItem) && !collapsed ? 0 : 1 } }) }, `divider-${depth}-${index}`);
|
|
2701
|
+
}
|
|
2702
|
+
if (!isPageItem(navItem)) return null;
|
|
2703
|
+
const key = `item-${depth}-${index}`;
|
|
2704
|
+
const uniqueItemKey = `${depth}-${index}-${navItem.title}`;
|
|
2705
|
+
if (renderItem) return /* @__PURE__ */ jsx(Fragment, { children: renderItem(navItem, { collapsed: !!collapsed }) }, key);
|
|
2706
|
+
return /* @__PURE__ */ jsx(
|
|
2707
|
+
NavigationListItem,
|
|
2708
|
+
{
|
|
2709
|
+
item: navItem,
|
|
2710
|
+
isOpen: openKeys.includes(uniqueItemKey),
|
|
2711
|
+
selected: activePath === navItem.to,
|
|
2712
|
+
collapsed,
|
|
2713
|
+
isSidebarFullyExpanded,
|
|
2714
|
+
isSidebarFullyCollapsed,
|
|
2715
|
+
onClick: navItem.children && !collapsed ? () => toggleKey(uniqueItemKey) : void 0,
|
|
2716
|
+
renderNested
|
|
2717
|
+
},
|
|
2718
|
+
key
|
|
2719
|
+
);
|
|
2720
|
+
})
|
|
2721
|
+
}
|
|
2722
|
+
);
|
|
2723
|
+
};
|
|
2724
|
+
var MINI_WIDTH = 84;
|
|
2725
|
+
var EXPANDED_WIDTH = 320;
|
|
2726
|
+
var TOOLBAR_HEIGHT = 65;
|
|
2727
|
+
var NavigationRail = ({ navigation, expanded, setExpanded }) => {
|
|
2728
|
+
const navigate = useNavigate();
|
|
2729
|
+
const routerState = useRouterState();
|
|
2730
|
+
const theme = useTheme$1();
|
|
2731
|
+
const showPermanent = useMediaQuery(theme.breakpoints.up("sm"));
|
|
2732
|
+
const drawerContent = (collapsed) => /* @__PURE__ */ jsx(
|
|
2733
|
+
Box6,
|
|
2734
|
+
{
|
|
2735
|
+
component: "nav",
|
|
2736
|
+
sx: {
|
|
2737
|
+
height: "100%",
|
|
2738
|
+
display: "flex",
|
|
2739
|
+
flexDirection: "column",
|
|
2740
|
+
justifyContent: "space-between",
|
|
2741
|
+
overflow: "auto",
|
|
2742
|
+
scrollbarGutter: collapsed ? "stable" : "auto",
|
|
2743
|
+
overflowX: "hidden",
|
|
2744
|
+
pt: navigation[0] && isHeader(navigation[0]) && !collapsed ? 0 : 2
|
|
2745
|
+
},
|
|
2746
|
+
children: /* @__PURE__ */ jsx(
|
|
2747
|
+
NavigationList,
|
|
2748
|
+
{
|
|
2749
|
+
subNavigation: navigation,
|
|
2750
|
+
collapsed,
|
|
2751
|
+
isSidebarFullyExpanded: expanded,
|
|
2752
|
+
isSidebarFullyCollapsed: !expanded,
|
|
2753
|
+
expandedWidth: EXPANDED_WIDTH,
|
|
2754
|
+
activePath: routerState.location.pathname,
|
|
2755
|
+
onNavigate: navigate
|
|
2756
|
+
}
|
|
2757
|
+
)
|
|
2758
|
+
}
|
|
2759
|
+
);
|
|
2760
|
+
if (showPermanent)
|
|
2761
|
+
return /* @__PURE__ */ jsx(
|
|
2762
|
+
Drawer,
|
|
2763
|
+
{
|
|
2764
|
+
variant: "permanent",
|
|
2765
|
+
sx: {
|
|
2766
|
+
width: expanded ? EXPANDED_WIDTH : MINI_WIDTH,
|
|
2767
|
+
["& .MuiDrawer-paper"]: {
|
|
2768
|
+
position: "absolute",
|
|
2769
|
+
top: `${TOOLBAR_HEIGHT}px`,
|
|
2770
|
+
height: `calc(100% - ${TOOLBAR_HEIGHT}px)`,
|
|
2771
|
+
width: expanded ? EXPANDED_WIDTH : MINI_WIDTH
|
|
2772
|
+
}
|
|
2773
|
+
},
|
|
2774
|
+
children: drawerContent(!expanded)
|
|
2775
|
+
}
|
|
2776
|
+
);
|
|
2777
|
+
return /* @__PURE__ */ jsx(Drawer, { open: expanded, onClose: () => setExpanded(false), children: drawerContent(!expanded) });
|
|
2778
|
+
};
|
|
2779
|
+
({
|
|
2780
|
+
url: import.meta.env.VITE_KEYCLOAK_URL,
|
|
2781
|
+
realm: import.meta.env.VITE_KEYCLOAK_REALM,
|
|
2782
|
+
clientId: import.meta.env.VITE_KEYCLOAK_CLIENT_ID,
|
|
2783
|
+
idpHint: import.meta.env.VITE_KEYCLOAK_IDP_HINT,
|
|
2784
|
+
confidentialClientId: import.meta.env.VITE_KEYCLOAK_CONFIDENTIAL_CLIENT_ID,
|
|
2785
|
+
confidentialClientSecret: import.meta.env.VITE_KEYCLOAK_CONFIDENTIAL_CLIENT_SECRET
|
|
2786
|
+
});
|
|
2787
|
+
function useKeycloak() {
|
|
2788
|
+
const routerContext = useRouter();
|
|
2789
|
+
const keycloak = routerContext.options.context.keycloak;
|
|
2790
|
+
return keycloak;
|
|
2791
|
+
}
|
|
2792
|
+
var ToolbarAccount = () => {
|
|
2793
|
+
const [anchorElement, setAnchorElement] = useState();
|
|
2794
|
+
const [tab, setTab] = useState("settings");
|
|
2795
|
+
const open = Boolean(anchorElement);
|
|
2796
|
+
const { t: t2, i18n: i18n2 } = useTranslation();
|
|
2797
|
+
const { mode, setMode } = useColorScheme();
|
|
2798
|
+
const changeLanguage = (newLanguage) => () => {
|
|
2799
|
+
i18n2.changeLanguage(newLanguage).finally(() => closeMenu());
|
|
2800
|
+
};
|
|
2801
|
+
const changeMode = (newMode) => () => {
|
|
2802
|
+
setMode(newMode);
|
|
2803
|
+
closeMenu();
|
|
2804
|
+
};
|
|
2805
|
+
const keycloak = useKeycloak();
|
|
2806
|
+
const user = keycloak.user;
|
|
2807
|
+
const getModeText = () => {
|
|
2808
|
+
switch (mode) {
|
|
2809
|
+
case "light": {
|
|
2810
|
+
return t2("Layout.Light");
|
|
2811
|
+
}
|
|
2812
|
+
case "dark": {
|
|
2813
|
+
return t2("Layout.Dark");
|
|
2814
|
+
}
|
|
2815
|
+
default: {
|
|
2816
|
+
return t2("Layout.System");
|
|
2817
|
+
}
|
|
2818
|
+
}
|
|
2819
|
+
};
|
|
2820
|
+
const usernameInitials = () => {
|
|
2821
|
+
if (!user?.name) return "";
|
|
2822
|
+
const splittedName = user.name.split(" ");
|
|
2823
|
+
return `${splittedName[0][0]}${splittedName.length > 1 ? splittedName[1][0] : ""}`;
|
|
2824
|
+
};
|
|
2825
|
+
const openMenu = (event) => setAnchorElement(event.currentTarget);
|
|
2826
|
+
const closeMenu = () => {
|
|
2827
|
+
setAnchorElement(void 0);
|
|
2828
|
+
setTimeout(() => setTab("settings"), 300);
|
|
2829
|
+
};
|
|
2830
|
+
const changeTab = (newTab) => () => setTab(newTab);
|
|
2831
|
+
const settings = /* @__PURE__ */ jsxs(List, { component: "nav", subheader: /* @__PURE__ */ jsx(ListSubheader, { sx: { backgroundColor: "transparent" }, children: t2("Layout.Settings") }), children: [
|
|
2832
|
+
/* @__PURE__ */ jsxs(ListItemButton, { onClick: changeTab("theme"), sx: { py: 0.3 }, children: [
|
|
2833
|
+
/* @__PURE__ */ jsx(ListItemIcon, { children: /* @__PURE__ */ jsx(Brightness4, {}) }),
|
|
2834
|
+
/* @__PURE__ */ jsx(ListItemText, { primary: t2("Layout.Appearance"), secondary: getModeText() }),
|
|
2835
|
+
/* @__PURE__ */ jsx(ChevronRight, {})
|
|
2836
|
+
] }),
|
|
2837
|
+
/* @__PURE__ */ jsxs(ListItemButton, { onClick: changeTab("language"), sx: { py: 0.3 }, children: [
|
|
2838
|
+
/* @__PURE__ */ jsx(ListItemIcon, { children: /* @__PURE__ */ jsx(Translate, {}) }),
|
|
2839
|
+
/* @__PURE__ */ jsx(ListItemText, { primary: t2("Layout.Language"), secondary: i18n2.resolvedLanguage === "en" ? "English" : "\u010Ce\u0161tina" }),
|
|
2840
|
+
/* @__PURE__ */ jsx(ChevronRight, {})
|
|
2841
|
+
] })
|
|
2842
|
+
] });
|
|
2843
|
+
const theme = /* @__PURE__ */ jsxs(List, { subheader: /* @__PURE__ */ jsxs(ListSubheader, { onClick: changeTab("settings"), sx: { backgroundColor: "transparent", display: "flex", alignItems: "center", px: 1, cursor: "pointer" }, children: [
|
|
2844
|
+
/* @__PURE__ */ jsx(IconButton, { size: "small", sx: { mr: 0.5 }, children: /* @__PURE__ */ jsx(ArrowBack, { fontSize: "small" }) }),
|
|
2845
|
+
" ",
|
|
2846
|
+
t2("Layout.Appearance")
|
|
2847
|
+
] }), children: [
|
|
2848
|
+
/* @__PURE__ */ jsxs(ListItemButton, { onClick: changeMode("light"), disabled: mode === "light", children: [
|
|
2849
|
+
/* @__PURE__ */ jsx(ListItemIcon, { children: /* @__PURE__ */ jsx(LightMode, {}) }),
|
|
2850
|
+
/* @__PURE__ */ jsx(ListItemText, { primary: t2("Layout.Light") })
|
|
2851
|
+
] }),
|
|
2852
|
+
/* @__PURE__ */ jsxs(ListItemButton, { onClick: changeMode("dark"), disabled: mode === "dark", children: [
|
|
2853
|
+
/* @__PURE__ */ jsx(ListItemIcon, { children: /* @__PURE__ */ jsx(DarkMode, {}) }),
|
|
2854
|
+
/* @__PURE__ */ jsx(ListItemText, { primary: t2("Layout.Dark") })
|
|
2855
|
+
] }),
|
|
2856
|
+
/* @__PURE__ */ jsxs(ListItemButton, { onClick: changeMode("system"), disabled: mode === "system", children: [
|
|
2857
|
+
/* @__PURE__ */ jsx(ListItemIcon, { children: /* @__PURE__ */ jsx(SettingsBrightness, {}) }),
|
|
2858
|
+
/* @__PURE__ */ jsx(ListItemText, { primary: t2("Layout.System") })
|
|
2859
|
+
] })
|
|
2860
|
+
] });
|
|
2861
|
+
const language = /* @__PURE__ */ jsxs(List, { subheader: /* @__PURE__ */ jsxs(ListSubheader, { onClick: changeTab("settings"), sx: { backgroundColor: "transparent", display: "flex", alignItems: "center", px: 1, cursor: "pointer" }, children: [
|
|
2862
|
+
/* @__PURE__ */ jsx(IconButton, { size: "small", sx: { mr: 0.5 }, children: /* @__PURE__ */ jsx(ArrowBack, { fontSize: "small" }) }),
|
|
2863
|
+
" ",
|
|
2864
|
+
t2("Layout.Language")
|
|
2865
|
+
] }), children: [
|
|
2866
|
+
/* @__PURE__ */ jsx(ListItemButton, { onClick: changeLanguage("en"), disabled: i18n2.resolvedLanguage === "en", children: /* @__PURE__ */ jsx(ListItemText, { primary: "English" }) }),
|
|
2867
|
+
/* @__PURE__ */ jsx(ListItemButton, { onClick: changeLanguage("cs"), disabled: i18n2.resolvedLanguage === "cs", children: /* @__PURE__ */ jsx(ListItemText, { primary: "\u010Ce\u0161tina" }) })
|
|
2868
|
+
] });
|
|
2869
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2870
|
+
/* @__PURE__ */ jsx(IconButton, { size: "small", edge: "end", onClick: openMenu, children: user?.name ? /* @__PURE__ */ jsx(Avatar, { sx: { width: { xs: 32, sm: 40 }, height: { xs: 32, sm: 40 }, bgcolor: "primary.main" }, children: /* @__PURE__ */ jsx(Typography, { variant: "subtitle2", sx: { fontWeight: "bold", lineHeight: 0 }, children: usernameInitials() }) }) : /* @__PURE__ */ jsx(AccountCircle, { fontSize: "large" }) }),
|
|
2871
|
+
/* @__PURE__ */ jsx(Menu, { anchorEl: anchorElement, open, onClose: closeMenu, children: /* @__PURE__ */ jsxs(Box, { sx: { width: 240 }, children: [
|
|
2872
|
+
/* @__PURE__ */ jsx(List, { children: user?.name ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2873
|
+
/* @__PURE__ */ jsx(ListItem, { children: /* @__PURE__ */ jsx(ListItemText, { primary: user.name, secondary: /* @__PURE__ */ jsxs("span", { children: [
|
|
2874
|
+
/* @__PURE__ */ jsx("span", { children: user.employeeId }),
|
|
2875
|
+
/* @__PURE__ */ jsx("br", {}),
|
|
2876
|
+
/* @__PURE__ */ jsx("span", { children: user.department })
|
|
2877
|
+
] }) }) }),
|
|
2878
|
+
/* @__PURE__ */ jsxs(ListItemButton, { onClick: () => keycloak.logout(), children: [
|
|
2879
|
+
/* @__PURE__ */ jsx(ListItemIcon, { children: /* @__PURE__ */ jsx(Logout, { color: "error" }) }),
|
|
2880
|
+
/* @__PURE__ */ jsx(ListItemText, { primary: t2("Layout.Logout") })
|
|
2881
|
+
] })
|
|
2882
|
+
] }) : /* @__PURE__ */ jsxs(ListItemButton, { onClick: () => keycloak.login(), children: [
|
|
2883
|
+
/* @__PURE__ */ jsx(ListItemIcon, { children: /* @__PURE__ */ jsx(Login, { color: "success" }) }),
|
|
2884
|
+
/* @__PURE__ */ jsx(ListItemText, { primary: t2("Layout.LogIn") })
|
|
2885
|
+
] }) }),
|
|
2886
|
+
tab === "settings" && settings,
|
|
2887
|
+
tab === "theme" && theme,
|
|
2888
|
+
tab === "language" && language
|
|
2889
|
+
] }) })
|
|
2890
|
+
] });
|
|
2891
|
+
};
|
|
2892
|
+
var DrawerHeader = styled("div")(({ theme }) => ({
|
|
2893
|
+
display: "flex",
|
|
2894
|
+
alignItems: "center",
|
|
2895
|
+
justifyContent: "flex-end",
|
|
2896
|
+
padding: theme.spacing(0, 1),
|
|
2897
|
+
...theme.mixins.toolbar
|
|
2898
|
+
}));
|
|
2899
|
+
var Layout = (props) => {
|
|
2900
|
+
const theme = useGetTheme(props.theme);
|
|
2901
|
+
const [navigationOpen, setNavigationOpen] = useLocalStorageState("navigationOpen", { defaultServerValue: false });
|
|
2902
|
+
const isFetching = !!useIsFetching();
|
|
2903
|
+
const isMutating = !!useIsMutating();
|
|
2904
|
+
return /* @__PURE__ */ jsxs(ThemeProvider, { theme, children: [
|
|
2905
|
+
/* @__PURE__ */ jsx(InitColorSchemeScript, {}),
|
|
2906
|
+
/* @__PURE__ */ jsx(CssBaseline, {}),
|
|
2907
|
+
/* @__PURE__ */ jsxs(Box, { sx: { display: "flex", height: "100dvh", maxHeight: "100dvh", overflow: "hidden", width: "100%" }, children: [
|
|
2908
|
+
/* @__PURE__ */ jsx(
|
|
2909
|
+
AppBar,
|
|
2910
|
+
{
|
|
2911
|
+
color: "transparent",
|
|
2912
|
+
position: "fixed",
|
|
2913
|
+
sx: {
|
|
2914
|
+
borderBottom: "1px solid",
|
|
2915
|
+
borderColor: theme.vars?.palette.divider,
|
|
2916
|
+
boxShadow: "none"
|
|
2917
|
+
},
|
|
2918
|
+
children: /* @__PURE__ */ jsxs(Toolbar, { children: [
|
|
2919
|
+
props.navigation && /* @__PURE__ */ jsx(
|
|
2920
|
+
IconButton,
|
|
2921
|
+
{
|
|
2922
|
+
onClick: () => setNavigationOpen((previous) => !previous),
|
|
2923
|
+
sx: { marginRight: 2 },
|
|
2924
|
+
children: navigationOpen ? /* @__PURE__ */ jsx(MenuOpen, {}) : /* @__PURE__ */ jsx(Menu3, {})
|
|
2925
|
+
}
|
|
2926
|
+
),
|
|
2927
|
+
/* @__PURE__ */ jsx(AppTitle, {}),
|
|
2928
|
+
/* @__PURE__ */ jsx(ToolbarAccount, {})
|
|
2929
|
+
] })
|
|
2930
|
+
}
|
|
2931
|
+
),
|
|
2932
|
+
props.navigation && /* @__PURE__ */ jsx(NavigationRail, { navigation: props.navigation, expanded: navigationOpen ?? false, setExpanded: setNavigationOpen }),
|
|
2933
|
+
/* @__PURE__ */ jsxs(Box, { component: "main", sx: { flexGrow: 1, display: "flex", flexDirection: "column", minWidth: 0, height: "100%", overflow: "hidden" }, children: [
|
|
2934
|
+
/* @__PURE__ */ jsx(DrawerHeader, {}),
|
|
2935
|
+
/* @__PURE__ */ jsx(Box, { sx: { flex: 1, overflow: "auto", position: "relative" }, children: props.children })
|
|
2936
|
+
] })
|
|
2937
|
+
] }),
|
|
2938
|
+
(isFetching || isMutating) && /* @__PURE__ */ jsx(LinearProgress, { sx: { position: "fixed", top: { xs: 56, sm: 64 }, left: 0, right: 0 } })
|
|
2939
|
+
] });
|
|
2940
|
+
};
|
|
2941
|
+
var LayoutContext = createContext(null);
|
|
2942
|
+
default2.use(HttpBackend).use(LanguageDetector).use(initReactI18next).init({
|
|
2943
|
+
fallbackLng: "en",
|
|
2944
|
+
interpolation: {
|
|
2945
|
+
escapeValue: false
|
|
2946
|
+
},
|
|
2947
|
+
react: {
|
|
2948
|
+
useSuspense: false
|
|
2949
|
+
}
|
|
2950
|
+
});
|
|
2951
|
+
function DialogsProvider({ children, unmountAfter = 1e3 }) {
|
|
2952
|
+
const [stack, setStack] = useState([]);
|
|
2953
|
+
const keyPrefix = useId();
|
|
2954
|
+
const nextId = useRef(0);
|
|
2955
|
+
const dialogMetadata = useRef(/* @__PURE__ */ new WeakMap());
|
|
2956
|
+
const requestDialog = useEventCallback_default(function open(Component7, payload, options = {}) {
|
|
2957
|
+
const { onClose = async () => {
|
|
2958
|
+
} } = options;
|
|
2959
|
+
let resolve;
|
|
2960
|
+
const promise = new Promise((resolveImpl) => {
|
|
2961
|
+
resolve = resolveImpl;
|
|
2962
|
+
});
|
|
2963
|
+
const key = `${keyPrefix}-${nextId.current}`;
|
|
2964
|
+
nextId.current += 1;
|
|
2965
|
+
const newEntry = {
|
|
2966
|
+
key,
|
|
2967
|
+
open: true,
|
|
2968
|
+
promise,
|
|
2969
|
+
Component: Component7,
|
|
2970
|
+
payload,
|
|
2971
|
+
onClose,
|
|
2972
|
+
resolve
|
|
2973
|
+
};
|
|
2974
|
+
dialogMetadata.current.set(promise, newEntry);
|
|
2975
|
+
setStack((previousStack) => [...previousStack, newEntry]);
|
|
2976
|
+
return promise;
|
|
2977
|
+
});
|
|
2978
|
+
const removeDialogFromStack = useCallback((dialog) => {
|
|
2979
|
+
setStack((previousStack) => previousStack.filter((entry) => entry.promise !== dialog));
|
|
2980
|
+
dialogMetadata.current.delete(dialog);
|
|
2981
|
+
}, []);
|
|
2982
|
+
const closeDialogUi = useEventCallback_default(function closeDialogUi2(dialog) {
|
|
2983
|
+
setStack(
|
|
2984
|
+
(previousStack) => previousStack.map((entry) => entry.promise === dialog ? { ...entry, open: false } : entry)
|
|
2985
|
+
);
|
|
2986
|
+
setTimeout(() => removeDialogFromStack(dialog), unmountAfter);
|
|
2987
|
+
});
|
|
2988
|
+
const closeDialog = useEventCallback_default(async function closeDialog2(dialog, result) {
|
|
2989
|
+
const entryToClose = dialogMetadata.current.get(dialog);
|
|
2990
|
+
if (!entryToClose) {
|
|
2991
|
+
throw new Error("Dialog not found in stack");
|
|
2992
|
+
}
|
|
2993
|
+
try {
|
|
2994
|
+
await entryToClose.onClose(result);
|
|
2995
|
+
} finally {
|
|
2996
|
+
entryToClose.resolve(result);
|
|
2997
|
+
closeDialogUi(dialog);
|
|
2998
|
+
}
|
|
2999
|
+
return dialog;
|
|
3000
|
+
});
|
|
3001
|
+
const contextValue = useMemo(() => ({ open: requestDialog, close: closeDialog }), [requestDialog, closeDialog]);
|
|
3002
|
+
return /* @__PURE__ */ jsxs(DialogsContext.Provider, { value: contextValue, children: [
|
|
3003
|
+
children,
|
|
3004
|
+
stack.map(({ key, open, Component: Component7, payload, promise }) => /* @__PURE__ */ jsx(
|
|
3005
|
+
Component7,
|
|
3006
|
+
{
|
|
3007
|
+
payload,
|
|
3008
|
+
open,
|
|
3009
|
+
onClose: async (result) => {
|
|
3010
|
+
await closeDialog(promise, result);
|
|
3011
|
+
}
|
|
3012
|
+
},
|
|
3013
|
+
key
|
|
3014
|
+
))
|
|
3015
|
+
] });
|
|
3016
|
+
}
|
|
3017
|
+
var LayoutProvider = (props) => {
|
|
3018
|
+
const [user, setUser] = useState({ employeeId: "", name: "Unknown", department: "", company: "", category: "" });
|
|
3019
|
+
const { t: t2 } = useTranslation();
|
|
3020
|
+
const navigation = props.getNavigation?.({ user, t: t2 });
|
|
3021
|
+
useEffect(() => {
|
|
3022
|
+
z.config(default2.resolvedLanguage === "cs" ? cs() : en());
|
|
3023
|
+
}, []);
|
|
3024
|
+
return /* @__PURE__ */ jsx(I18nextProvider, { i18n: default2, children: /* @__PURE__ */ jsx(LocalizationProvider, { dateAdapter: AdapterDayjs, adapterLocale: default2.resolvedLanguage, children: /* @__PURE__ */ jsx(LayoutContext.Provider, { value: { user: { get: user, set: setUser } }, children: /* @__PURE__ */ jsxs(Layout, { navigation, theme: props.theme, children: [
|
|
3025
|
+
"\xA8",
|
|
3026
|
+
/* @__PURE__ */ jsx(DialogsProvider, { children: props.children })
|
|
3027
|
+
] }) }) }) });
|
|
3028
|
+
};
|
|
3029
|
+
|
|
3030
|
+
// src/utils/FormUtils.ts
|
|
3031
|
+
var getFieldStatus = (field) => {
|
|
3032
|
+
const { meta } = field.state;
|
|
3033
|
+
const isTouched = meta.isTouched;
|
|
3034
|
+
const hasError = !!meta.errors?.length;
|
|
3035
|
+
const helperText = meta.errors?.[0]?.message;
|
|
3036
|
+
return { isTouched, hasError, helperText };
|
|
3037
|
+
};
|
|
3038
|
+
var FormAutocomplete = ({ textFieldProps, ...autocompleteProps }) => {
|
|
3039
|
+
const field = useFieldContext();
|
|
3040
|
+
const { isTouched, hasError, helperText } = getFieldStatus(field);
|
|
3041
|
+
return /* @__PURE__ */ jsx(
|
|
3042
|
+
Autocomplete,
|
|
3043
|
+
{
|
|
3044
|
+
value: field.state.value,
|
|
3045
|
+
onChange: (_, value) => !autocompleteProps.freeSolo && field.handleChange(value),
|
|
3046
|
+
onInputChange: (_, value, reason) => reason !== "reset" && autocompleteProps.freeSolo && field.handleChange(value),
|
|
3047
|
+
onBlur: field.handleBlur,
|
|
3048
|
+
"aria-label": field.name,
|
|
3049
|
+
...autocompleteProps,
|
|
3050
|
+
renderInput: (parameters) => /* @__PURE__ */ jsx(
|
|
3051
|
+
TextField,
|
|
3052
|
+
{
|
|
3053
|
+
...parameters,
|
|
3054
|
+
name: field.name,
|
|
3055
|
+
error: isTouched && hasError,
|
|
3056
|
+
helperText: isTouched && helperText,
|
|
3057
|
+
...textFieldProps
|
|
3058
|
+
}
|
|
3059
|
+
)
|
|
3060
|
+
}
|
|
3061
|
+
);
|
|
3062
|
+
};
|
|
3063
|
+
var FormCheckbox = (props) => {
|
|
3064
|
+
const field = useFieldContext();
|
|
3065
|
+
const { isTouched, hasError, helperText } = getFieldStatus(field);
|
|
3066
|
+
return /* @__PURE__ */ jsxs(FormControl, { component: "fieldset", children: [
|
|
3067
|
+
/* @__PURE__ */ jsx(
|
|
3068
|
+
FormControlLabel,
|
|
3069
|
+
{
|
|
3070
|
+
control: /* @__PURE__ */ jsx(
|
|
3071
|
+
Checkbox,
|
|
3072
|
+
{
|
|
3073
|
+
name: field.name,
|
|
3074
|
+
checked: Boolean(field.state.value),
|
|
3075
|
+
onChange: (event) => field.handleChange(event.target.checked),
|
|
3076
|
+
onBlur: field.handleBlur,
|
|
3077
|
+
"aria-label": field.name,
|
|
3078
|
+
...props
|
|
3079
|
+
}
|
|
3080
|
+
),
|
|
3081
|
+
label: props.label ?? ""
|
|
3082
|
+
}
|
|
3083
|
+
),
|
|
3084
|
+
isTouched && hasError && /* @__PURE__ */ jsx(FormHelperText, { error: hasError, children: helperText })
|
|
3085
|
+
] });
|
|
3086
|
+
};
|
|
3087
|
+
var FormDatePicker = (props) => {
|
|
3088
|
+
const field = useFieldContext();
|
|
3089
|
+
const { isTouched, hasError, helperText } = getFieldStatus(field);
|
|
3090
|
+
return /* @__PURE__ */ jsx(
|
|
3091
|
+
DatePicker,
|
|
3092
|
+
{
|
|
3093
|
+
name: field.name,
|
|
3094
|
+
value: field.state.value ? dayjs(field.state.value) : null,
|
|
3095
|
+
onChange: (value) => field.handleChange(value ? value.format() : null),
|
|
3096
|
+
slotProps: {
|
|
3097
|
+
textField: {
|
|
3098
|
+
onBlur: field.handleBlur,
|
|
3099
|
+
error: isTouched && hasError,
|
|
3100
|
+
helperText: isTouched && helperText,
|
|
3101
|
+
...props.textFieldProps
|
|
3102
|
+
},
|
|
3103
|
+
...props.slotProps
|
|
3104
|
+
},
|
|
3105
|
+
"aria-label": field.name,
|
|
3106
|
+
...props
|
|
3107
|
+
}
|
|
3108
|
+
);
|
|
3109
|
+
};
|
|
3110
|
+
var FormDateTimePicker = (props) => {
|
|
3111
|
+
const field = useFieldContext();
|
|
3112
|
+
const { isTouched, hasError, helperText } = getFieldStatus(field);
|
|
3113
|
+
return /* @__PURE__ */ jsx(
|
|
3114
|
+
DateTimePicker,
|
|
3115
|
+
{
|
|
3116
|
+
name: field.name,
|
|
3117
|
+
value: field.state.value ? dayjs(field.state.value) : null,
|
|
3118
|
+
onChange: (value) => field.handleChange(value ? value.format() : null),
|
|
3119
|
+
slotProps: {
|
|
3120
|
+
textField: {
|
|
3121
|
+
onBlur: field.handleBlur,
|
|
3122
|
+
error: isTouched && hasError,
|
|
3123
|
+
helperText: isTouched && helperText,
|
|
3124
|
+
...props.textFieldProps
|
|
3125
|
+
},
|
|
3126
|
+
...props.slotProps
|
|
3127
|
+
},
|
|
3128
|
+
"aria-label": field.name,
|
|
3129
|
+
...props
|
|
3130
|
+
}
|
|
3131
|
+
);
|
|
3132
|
+
};
|
|
3133
|
+
var FormNumberField = ({ options, ...props }) => {
|
|
3134
|
+
const field = useFieldContext();
|
|
3135
|
+
const { isTouched, hasError, helperText } = getFieldStatus(field);
|
|
3136
|
+
return /* @__PURE__ */ jsx(
|
|
3137
|
+
NumericFormat,
|
|
3138
|
+
{
|
|
3139
|
+
customInput: TextField,
|
|
3140
|
+
name: field.name,
|
|
3141
|
+
value: field.state.value ?? "",
|
|
3142
|
+
onValueChange: ({ floatValue }) => field.handleChange(floatValue),
|
|
3143
|
+
onBlur: field.handleBlur,
|
|
3144
|
+
error: isTouched && hasError,
|
|
3145
|
+
helperText: isTouched && helperText,
|
|
3146
|
+
"aria-label": field.name,
|
|
3147
|
+
...props,
|
|
3148
|
+
...options
|
|
3149
|
+
}
|
|
3150
|
+
);
|
|
3151
|
+
};
|
|
3152
|
+
var FormRadioGroup = ({ label, options, ...props }) => {
|
|
3153
|
+
const field = useFieldContext();
|
|
3154
|
+
const { isTouched, hasError, helperText } = getFieldStatus(field);
|
|
3155
|
+
return /* @__PURE__ */ jsxs(FormControl, { component: "fieldset", children: [
|
|
3156
|
+
label && /* @__PURE__ */ jsx(FormLabel, { component: "legend", children: label }),
|
|
3157
|
+
/* @__PURE__ */ jsx(
|
|
3158
|
+
RadioGroup,
|
|
3159
|
+
{
|
|
3160
|
+
name: field.name,
|
|
3161
|
+
value: field.state.value ?? "",
|
|
3162
|
+
onChange: (event) => field.handleChange(event.target.value),
|
|
3163
|
+
onBlur: field.handleBlur,
|
|
3164
|
+
"aria-label": field.name,
|
|
3165
|
+
...props,
|
|
3166
|
+
children: options.map((option) => /* @__PURE__ */ jsx(
|
|
3167
|
+
FormControlLabel,
|
|
3168
|
+
{
|
|
3169
|
+
value: option.value,
|
|
3170
|
+
control: /* @__PURE__ */ jsx(Radio, {}),
|
|
3171
|
+
label: option.label
|
|
3172
|
+
},
|
|
3173
|
+
option.value
|
|
3174
|
+
))
|
|
3175
|
+
}
|
|
3176
|
+
),
|
|
3177
|
+
isTouched && hasError && /* @__PURE__ */ jsx(FormHelperText, { error: hasError, children: helperText })
|
|
3178
|
+
] });
|
|
3179
|
+
};
|
|
3180
|
+
var FormSlider = ({ label, ...props }) => {
|
|
3181
|
+
const field = useFieldContext();
|
|
3182
|
+
const { isTouched, hasError, helperText } = getFieldStatus(field);
|
|
3183
|
+
return /* @__PURE__ */ jsxs(FormControl, { component: "fieldset", children: [
|
|
3184
|
+
label && /* @__PURE__ */ jsx(FormLabel, { children: label }),
|
|
3185
|
+
/* @__PURE__ */ jsx(
|
|
3186
|
+
Slider,
|
|
3187
|
+
{
|
|
3188
|
+
name: field.name,
|
|
3189
|
+
value: field.state.value ?? 0,
|
|
3190
|
+
onChange: (_, value) => field.handleChange(Array.isArray(value) ? value[0] : value),
|
|
3191
|
+
onBlur: field.handleBlur,
|
|
3192
|
+
"aria-label": field.name,
|
|
3193
|
+
...props
|
|
3194
|
+
}
|
|
3195
|
+
),
|
|
3196
|
+
isTouched && hasError && /* @__PURE__ */ jsx(FormHelperText, { error: hasError, children: helperText })
|
|
3197
|
+
] });
|
|
3198
|
+
};
|
|
3199
|
+
var FormSubmitButton = (props) => {
|
|
3200
|
+
const form = useFormContext();
|
|
3201
|
+
const handleClick = (event) => {
|
|
3202
|
+
event.preventDefault();
|
|
3203
|
+
event.stopPropagation();
|
|
3204
|
+
form.handleSubmit();
|
|
3205
|
+
};
|
|
3206
|
+
return /* @__PURE__ */ jsx(form.Subscribe, { selector: (state) => [state.canSubmit, state.isSubmitting], children: ([canSubmit, isSubmitting]) => /* @__PURE__ */ jsx(
|
|
3207
|
+
Button,
|
|
3208
|
+
{
|
|
3209
|
+
loading: isSubmitting,
|
|
3210
|
+
disabled: !canSubmit,
|
|
3211
|
+
onClick: handleClick,
|
|
3212
|
+
type: "submit",
|
|
3213
|
+
"aria-label": "submit",
|
|
3214
|
+
...props
|
|
3215
|
+
}
|
|
3216
|
+
) });
|
|
3217
|
+
};
|
|
3218
|
+
var FormSwitch = (props) => {
|
|
3219
|
+
const field = useFieldContext();
|
|
3220
|
+
const { isTouched, hasError, helperText } = getFieldStatus(field);
|
|
3221
|
+
return /* @__PURE__ */ jsxs(FormControl, { component: "fieldset", children: [
|
|
3222
|
+
/* @__PURE__ */ jsx(
|
|
3223
|
+
FormControlLabel,
|
|
3224
|
+
{
|
|
3225
|
+
control: /* @__PURE__ */ jsx(
|
|
3226
|
+
Switch,
|
|
3227
|
+
{
|
|
3228
|
+
name: field.name,
|
|
3229
|
+
checked: Boolean(field.state.value),
|
|
3230
|
+
onChange: (event) => field.handleChange(event.target.checked),
|
|
3231
|
+
onBlur: field.handleBlur,
|
|
3232
|
+
"aria-label": field.name,
|
|
3233
|
+
...props
|
|
3234
|
+
}
|
|
3235
|
+
),
|
|
3236
|
+
label: props.label ?? ""
|
|
3237
|
+
}
|
|
3238
|
+
),
|
|
3239
|
+
isTouched && hasError && /* @__PURE__ */ jsx(FormHelperText, { error: hasError, children: helperText })
|
|
3240
|
+
] });
|
|
3241
|
+
};
|
|
3242
|
+
var FormTextField = (props) => {
|
|
3243
|
+
const field = useFieldContext();
|
|
3244
|
+
const { isTouched, hasError, helperText } = getFieldStatus(field);
|
|
3245
|
+
return /* @__PURE__ */ jsx(
|
|
3246
|
+
TextField,
|
|
3247
|
+
{
|
|
3248
|
+
name: field.name,
|
|
3249
|
+
value: field.state.value ?? "",
|
|
3250
|
+
onChange: (event) => field.handleChange(event.target.value),
|
|
3251
|
+
onBlur: field.handleBlur,
|
|
3252
|
+
error: isTouched && hasError,
|
|
3253
|
+
helperText: isTouched && helperText,
|
|
3254
|
+
"aria-label": field.name,
|
|
3255
|
+
...props
|
|
3256
|
+
}
|
|
3257
|
+
);
|
|
3258
|
+
};
|
|
3259
|
+
|
|
3260
|
+
// src/hooks/FormHooks.ts
|
|
3261
|
+
var { fieldContext, useFieldContext, formContext, useFormContext } = createFormHookContexts();
|
|
3262
|
+
var { useAppForm: useLayoutForm, withForm: withLayoutForm } = createFormHook({
|
|
3263
|
+
fieldComponents: {
|
|
3264
|
+
TextField: FormTextField,
|
|
3265
|
+
NumberField: FormNumberField,
|
|
3266
|
+
Autocomplete: FormAutocomplete,
|
|
3267
|
+
Checkbox: FormCheckbox,
|
|
3268
|
+
Switch: FormSwitch,
|
|
3269
|
+
RadioGroup: FormRadioGroup,
|
|
3270
|
+
Slider: FormSlider,
|
|
3271
|
+
DatePicker: FormDatePicker,
|
|
3272
|
+
DateTimePicker: FormDateTimePicker
|
|
3273
|
+
},
|
|
3274
|
+
formComponents: {
|
|
3275
|
+
SubmitButton: FormSubmitButton
|
|
3276
|
+
},
|
|
3277
|
+
fieldContext,
|
|
3278
|
+
formContext
|
|
3279
|
+
});
|
|
3280
|
+
/*! Bundled license information:
|
|
3281
|
+
|
|
3282
|
+
react-is/cjs/react-is.production.min.js:
|
|
3283
|
+
(** @license React v16.13.1
|
|
3284
|
+
* react-is.production.min.js
|
|
3285
|
+
*
|
|
3286
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
3287
|
+
*
|
|
3288
|
+
* This source code is licensed under the MIT license found in the
|
|
3289
|
+
* LICENSE file in the root directory of this source tree.
|
|
3290
|
+
*)
|
|
3291
|
+
|
|
3292
|
+
react-is/cjs/react-is.development.js:
|
|
3293
|
+
(** @license React v16.13.1
|
|
3294
|
+
* react-is.development.js
|
|
3295
|
+
*
|
|
3296
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
3297
|
+
*
|
|
3298
|
+
* This source code is licensed under the MIT license found in the
|
|
3299
|
+
* LICENSE file in the root directory of this source tree.
|
|
3300
|
+
*)
|
|
3301
|
+
|
|
3302
|
+
object-assign/index.js:
|
|
3303
|
+
(*
|
|
3304
|
+
object-assign
|
|
3305
|
+
(c) Sindre Sorhus
|
|
3306
|
+
@license MIT
|
|
3307
|
+
*)
|
|
3308
|
+
*/
|
|
3309
|
+
|
|
3310
|
+
export { ChipInputCell, Dropzone, EditableColumnHeader, FileViewer, LayoutProvider, PageHeader, Platform, RouterButton, RouterError, RouterGridActionsCellItem, RouterIconButton, RouterLink, RouterListItemButton, RouterNotFound, RouterTab, TableContainer, TypographyWithIcon, rootRouteHead, useDeleteFile, useDeleteFiles, useDialogs, useDownloadFile, useFieldContext, useFormContext, useGetFile, useGetFileMetas, useGetFileThumbnail, useLayoutForm, useOpenFile, useUpdateFileMeta, useUploadFile, wczApiClient, withLayoutForm };
|
|
3311
|
+
//# sourceMappingURL=index.js.map
|
|
3312
|
+
//# sourceMappingURL=index.js.map
|