@addsign/moje-agenda-shared-lib 2.0.71 → 2.0.73
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/Dialog-BmQoVu5C.js.map +1 -1
- package/dist/assets/style.css +1782 -1755
- package/dist/components/Attachments.js +2 -2
- package/dist/components/datatable/DataTable.js +3 -3
- package/dist/components/datatable/DataTableServer.js +24 -5
- package/dist/components/datatable/DataTableServer.js.map +1 -1
- package/dist/components/form/AutocompleteSearchBar.js +2 -2
- package/dist/components/form/AutocompleteSearchBarServer.js +2 -2
- package/dist/components/form/FileInput.js +3 -3
- package/dist/components/form/FileInputForm.d.ts +1 -0
- package/dist/components/form/FileInputForm.js +201 -93
- package/dist/components/form/FileInputForm.js.map +1 -1
- package/dist/components/form/FileInputFormMultiple.d.ts +1 -0
- package/dist/components/form/FileInputFormMultiple.js +203 -82
- package/dist/components/form/FileInputFormMultiple.js.map +1 -1
- package/dist/components/form/FileInputMultiple.js +3 -3
- package/dist/components/form/FormField.js +2 -2
- package/dist/components/form/PositionsSelectorSingle.js +3 -3
- package/dist/components/form/SelectField.js +2 -2
- package/dist/components/layout/Neoptimizovano.js +2 -2
- package/dist/components/profiles/ProfileOverview.js +2 -2
- package/dist/components/ui/Combobox.js +1 -1
- package/dist/components/ui/DatePicker.js +2 -2
- package/dist/components/ui/DateTimePicker.js +2 -2
- package/dist/components/ui/Dialog.js +1 -1
- package/dist/components/ui/ScrollArea.js +2 -2
- package/dist/components/ui/checkbox.js +4 -4
- package/dist/components/ui/command.d.ts +6 -6
- package/dist/components/ui/command.js +2 -2
- package/dist/components/ui/input.js +8 -107
- package/dist/components/ui/input.js.map +1 -1
- package/dist/components/ui/multi-select.js +1 -1
- package/dist/components/ui/popover.js +1 -1
- package/dist/components/ui/radioGroup.js +5 -5
- package/dist/components/ui/select.js +7 -7
- package/dist/components/ui/toast.js +5 -5
- package/dist/components/ui/tooltip.js +6 -6
- package/dist/input-Cm_FjJOF.js +111 -0
- package/dist/input-Cm_FjJOF.js.map +1 -0
- package/dist/main.js +3 -3
- package/dist/popover-DpJhfyvx.js.map +1 -1
- package/lib/components/datatable/DataTableServer.tsx +1399 -1369
- package/lib/components/form/FileInputForm.tsx +245 -99
- package/lib/components/form/FileInputFormMultiple.tsx +233 -65
- package/lib/css/tailwind.css +9 -9
- package/package.json +1 -1
- package/tailwind.config.js +97 -97
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { jsxs, jsx } from "react/jsx-runtime";
|
|
1
|
+
import { jsxs, Fragment, jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useState, useEffect, useCallback } from "react";
|
|
3
|
-
import { u as useDropzone } from "../../index-
|
|
3
|
+
import { u as useDropzone } from "../../index-DrJcw1yx.js";
|
|
4
4
|
import { d as MdInsertDriveFile, e as MdDeleteOutline } from "../../index-CrfjcbOs.js";
|
|
5
5
|
import { cn } from "../../utils/utils.js";
|
|
6
6
|
import "../../tailwind-l0sNRNKZ.js";
|
|
7
|
-
import "
|
|
8
|
-
import "
|
|
7
|
+
import { D as Dialog, e as DialogContent, f as DialogHeader, h as DialogTitle, g as DialogFooter } from "../../Dialog-BmQoVu5C.js";
|
|
8
|
+
import { L as LoaderCircle, I as Input } from "../../input-Cm_FjJOF.js";
|
|
9
|
+
import { Button } from "../ui/button.js";
|
|
9
10
|
import "../ui/multi-select.js";
|
|
10
11
|
import "../ui/select.js";
|
|
11
12
|
import "../../index.esm-ifS8v9eQ.js";
|
|
12
13
|
import "../../jspdf.plugin.autotable-7hp3hM-a.js";
|
|
13
14
|
import "../../contexts/FederationContext.js";
|
|
14
15
|
import { useFederationContext } from "../../contexts/useFederationContext.js";
|
|
15
|
-
import "../../Dialog-CCrUyF91.js";
|
|
16
16
|
import "../ui/ScrollArea.js";
|
|
17
17
|
import { useFormField } from "../ui/form.js";
|
|
18
18
|
import "../ui/radioGroup.js";
|
|
@@ -63,7 +63,8 @@ const FileInputFormMultiple = ({
|
|
|
63
63
|
initialFilesReadOnly = true,
|
|
64
64
|
initialFileIds,
|
|
65
65
|
attachmentName,
|
|
66
|
-
attachmentType
|
|
66
|
+
attachmentType,
|
|
67
|
+
askForAttachmentName = false
|
|
67
68
|
}) => {
|
|
68
69
|
const [fileDataList, setFileDataList] = useState(
|
|
69
70
|
(value == null ? void 0 : value.map((file) => ({
|
|
@@ -71,6 +72,10 @@ const FileInputFormMultiple = ({
|
|
|
71
72
|
readonly: initialFilesReadOnly && (initialFileIds == null ? void 0 : initialFileIds.includes(file.id))
|
|
72
73
|
}))) || []
|
|
73
74
|
);
|
|
75
|
+
const [pendingFiles, setPendingFiles] = useState([]);
|
|
76
|
+
const [isDialogOpen, setIsDialogOpen] = useState(false);
|
|
77
|
+
const [fileNames, setFileNames] = useState({});
|
|
78
|
+
const [isUploading, setIsUploading] = useState(false);
|
|
74
79
|
const federationContext = useFederationContext();
|
|
75
80
|
const { error } = useFormField();
|
|
76
81
|
const hasError = !!error;
|
|
@@ -86,10 +91,11 @@ const FileInputFormMultiple = ({
|
|
|
86
91
|
}))
|
|
87
92
|
);
|
|
88
93
|
}, [value, initialFilesReadOnly, initialFileIds]);
|
|
89
|
-
const
|
|
90
|
-
async (
|
|
94
|
+
const uploadFiles = useCallback(
|
|
95
|
+
async (files, customNames) => {
|
|
96
|
+
setIsUploading(true);
|
|
91
97
|
const uploadedFiles = await Promise.all(
|
|
92
|
-
|
|
98
|
+
files.map(async (file) => {
|
|
93
99
|
if (file.size > MAX_FILE_SIZE) {
|
|
94
100
|
federationContext.emitter.emit("message", {
|
|
95
101
|
title: "Velikost souboru byla překročena",
|
|
@@ -102,7 +108,7 @@ const FileInputFormMultiple = ({
|
|
|
102
108
|
}
|
|
103
109
|
const formData = new FormData();
|
|
104
110
|
const dataObject = {
|
|
105
|
-
...attachmentName && { attachmentName },
|
|
111
|
+
...(customNames == null ? void 0 : customNames[file.name]) ? { attachmentName: customNames[file.name] } : attachmentName && { attachmentName },
|
|
106
112
|
...attachmentType && { attachmentType }
|
|
107
113
|
};
|
|
108
114
|
formData.append(
|
|
@@ -134,6 +140,7 @@ const FileInputFormMultiple = ({
|
|
|
134
140
|
const updatedFileDataList = [...fileDataList, ...validFiles];
|
|
135
141
|
setFileDataList(updatedFileDataList);
|
|
136
142
|
onFilesChanged(updatedFileDataList);
|
|
143
|
+
setIsUploading(false);
|
|
137
144
|
},
|
|
138
145
|
[
|
|
139
146
|
federationContext,
|
|
@@ -143,9 +150,60 @@ const FileInputFormMultiple = ({
|
|
|
143
150
|
attachmentType
|
|
144
151
|
]
|
|
145
152
|
);
|
|
153
|
+
const onDrop = useCallback(
|
|
154
|
+
async (acceptedFiles) => {
|
|
155
|
+
const validFiles = acceptedFiles.filter((file) => {
|
|
156
|
+
if (file.size > MAX_FILE_SIZE) {
|
|
157
|
+
federationContext.emitter.emit("message", {
|
|
158
|
+
title: "Velikost souboru byla překročena",
|
|
159
|
+
message: `Maximální povolená velikost je ${MAX_FILE_SIZE / (1024 * 1024)} MB.`,
|
|
160
|
+
classes: "bg-danger ",
|
|
161
|
+
timeout: 0,
|
|
162
|
+
type: "error"
|
|
163
|
+
});
|
|
164
|
+
return false;
|
|
165
|
+
}
|
|
166
|
+
return true;
|
|
167
|
+
});
|
|
168
|
+
if (validFiles.length === 0) {
|
|
169
|
+
return;
|
|
170
|
+
}
|
|
171
|
+
if (askForAttachmentName) {
|
|
172
|
+
const initialNames = {};
|
|
173
|
+
validFiles.forEach((file) => {
|
|
174
|
+
initialNames[file.name] = file.name;
|
|
175
|
+
});
|
|
176
|
+
setFileNames(initialNames);
|
|
177
|
+
setPendingFiles(validFiles);
|
|
178
|
+
setIsDialogOpen(true);
|
|
179
|
+
} else {
|
|
180
|
+
await uploadFiles(validFiles);
|
|
181
|
+
}
|
|
182
|
+
},
|
|
183
|
+
[askForAttachmentName, uploadFiles, federationContext]
|
|
184
|
+
);
|
|
185
|
+
const handleDialogSubmit = async () => {
|
|
186
|
+
setIsDialogOpen(false);
|
|
187
|
+
await uploadFiles(pendingFiles, fileNames);
|
|
188
|
+
setPendingFiles([]);
|
|
189
|
+
setFileNames({});
|
|
190
|
+
};
|
|
191
|
+
const handleDialogCancel = () => {
|
|
192
|
+
setIsDialogOpen(false);
|
|
193
|
+
setPendingFiles([]);
|
|
194
|
+
setFileNames({});
|
|
195
|
+
};
|
|
196
|
+
const formatFileSize = (bytes) => {
|
|
197
|
+
if (bytes === 0)
|
|
198
|
+
return "0 Bytes";
|
|
199
|
+
const k = 1024;
|
|
200
|
+
const sizes = ["Bytes", "KB", "MB", "GB"];
|
|
201
|
+
const i = Math.floor(Math.log(bytes) / Math.log(k));
|
|
202
|
+
return Math.round(bytes / Math.pow(k, i) * 100) / 100 + " " + sizes[i];
|
|
203
|
+
};
|
|
146
204
|
const { getRootProps, getInputProps, isDragActive } = useDropzone({
|
|
147
205
|
onDrop,
|
|
148
|
-
disabled
|
|
206
|
+
disabled: disabled || isUploading
|
|
149
207
|
});
|
|
150
208
|
const handleRemove = (fileId) => {
|
|
151
209
|
const updatedFileDataList = fileDataList.filter(
|
|
@@ -157,82 +215,145 @@ const FileInputFormMultiple = ({
|
|
|
157
215
|
if (disabled === true && fileDataList.length === 0) {
|
|
158
216
|
return null;
|
|
159
217
|
}
|
|
160
|
-
return /* @__PURE__ */ jsxs(
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
"div",
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
children: [
|
|
175
|
-
!disabled && /* @__PURE__ */ jsxs(
|
|
176
|
-
"div",
|
|
177
|
-
{
|
|
178
|
-
...getRootProps(),
|
|
179
|
-
className: `w-full p-4 border-dashed cursor-pointer
|
|
180
|
-
border-2 rounded-lg text-center hover:bg-gray-100
|
|
181
|
-
${isDragActive ? "border-indigo-300 bg-indigo-50" : "border-gray-300"}`,
|
|
182
|
-
children: [
|
|
183
|
-
/* @__PURE__ */ jsx("input", { ...getInputProps(), id: name }),
|
|
184
|
-
/* @__PURE__ */ jsx("p", { className: "text-gray-500", children: isDragActive ? "Sem přetáhněte soubory" : "Klikněte pro nahrání, nebo nahrajte přetažením souborů" })
|
|
185
|
-
]
|
|
186
|
-
}
|
|
218
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
219
|
+
/* @__PURE__ */ jsxs(
|
|
220
|
+
"div",
|
|
221
|
+
{
|
|
222
|
+
className: "w-full min-h-30 flex-col justify-start items-start gap-1.5 inline-flex sharedLibrary",
|
|
223
|
+
"data-cy": "file-input-form-multiple-" + name,
|
|
224
|
+
children: [
|
|
225
|
+
/* @__PURE__ */ jsx("div", { className: "self-stretch flex-col justify-start items-start gap-1.5 flex", children: /* @__PURE__ */ jsxs(
|
|
226
|
+
"div",
|
|
227
|
+
{
|
|
228
|
+
className: cn(
|
|
229
|
+
`self-stretch px-3 py-2 rounded-lg justify-start items-center gap-2 outline-none border bg-transparent relative`,
|
|
230
|
+
hasError && "outline-4 outline-red-200 outline-offset-0 border-none ",
|
|
231
|
+
disabled ? "bg-gray-100" : "bg-transparent"
|
|
187
232
|
),
|
|
188
|
-
|
|
189
|
-
"div",
|
|
190
|
-
|
|
191
|
-
className: "
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
233
|
+
children: [
|
|
234
|
+
isUploading && /* @__PURE__ */ jsx("div", { className: "absolute inset-0 bg-white/80 backdrop-blur-sm rounded-lg z-10 flex items-center justify-center", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center gap-2", children: [
|
|
235
|
+
/* @__PURE__ */ jsx(LoaderCircle, { className: "h-8 w-8 animate-spin text-primary" }),
|
|
236
|
+
/* @__PURE__ */ jsx("p", { className: "text-sm text-gray-600", children: "Nahrávání..." })
|
|
237
|
+
] }) }),
|
|
238
|
+
!disabled && /* @__PURE__ */ jsxs(
|
|
239
|
+
"div",
|
|
240
|
+
{
|
|
241
|
+
...getRootProps(),
|
|
242
|
+
className: cn(
|
|
243
|
+
`w-full p-4 border-dashed border-2 rounded-lg text-center`,
|
|
244
|
+
isUploading ? "cursor-not-allowed opacity-50" : "cursor-pointer hover:bg-gray-100",
|
|
245
|
+
isDragActive ? "border-indigo-300 bg-indigo-50" : "border-gray-300"
|
|
246
|
+
),
|
|
247
|
+
children: [
|
|
248
|
+
/* @__PURE__ */ jsx("input", { ...getInputProps(), id: name }),
|
|
249
|
+
/* @__PURE__ */ jsx("p", { className: "text-gray-500", children: isDragActive ? "Sem přetáhněte soubory" : "Klikněte pro nahrání, nebo nahrajte přetažením souborů" })
|
|
250
|
+
]
|
|
251
|
+
}
|
|
252
|
+
),
|
|
253
|
+
/* @__PURE__ */ jsx("div", { className: "w-full", children: fileDataList.map((file) => /* @__PURE__ */ jsxs(
|
|
254
|
+
"div",
|
|
255
|
+
{
|
|
256
|
+
className: "w-full flex items-center justify-between py-2 border-b ",
|
|
257
|
+
children: [
|
|
258
|
+
/* @__PURE__ */ jsx("div", { className: "flex flex-col flex-1", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center content-center gap-2", children: [
|
|
259
|
+
/* @__PURE__ */ jsx(MdInsertDriveFile, { style: { fontSize: "2rem" } }),
|
|
260
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col flex-1", children: [
|
|
261
|
+
/* @__PURE__ */ jsx(
|
|
262
|
+
"a",
|
|
263
|
+
{
|
|
264
|
+
href: `/api/files/download/${file.id}`,
|
|
265
|
+
className: "text-left underline text-primary text-sm",
|
|
266
|
+
target: "_blank",
|
|
267
|
+
children: file.filename
|
|
268
|
+
}
|
|
269
|
+
),
|
|
270
|
+
file.attachmentName && /* @__PURE__ */ jsx("div", { className: "text-sm text-gray-600", children: file.attachmentName })
|
|
271
|
+
] })
|
|
272
|
+
] }) }),
|
|
273
|
+
!disabled && file.readonly !== true && !isUploading && /* @__PURE__ */ jsx(
|
|
274
|
+
"div",
|
|
197
275
|
{
|
|
198
|
-
|
|
199
|
-
className: "
|
|
200
|
-
|
|
201
|
-
|
|
276
|
+
onClick: () => handleRemove(file.id),
|
|
277
|
+
className: "text-gray-600 cursor-pointer hover:text-primary hover:bg-gray-200 rounded-full ml-4",
|
|
278
|
+
children: /* @__PURE__ */ jsx(
|
|
279
|
+
MdDeleteOutline,
|
|
280
|
+
{
|
|
281
|
+
style: { fontSize: "1.5rem", margin: "10px" }
|
|
282
|
+
}
|
|
283
|
+
)
|
|
202
284
|
}
|
|
203
285
|
)
|
|
204
|
-
]
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
286
|
+
]
|
|
287
|
+
},
|
|
288
|
+
file.id
|
|
289
|
+
)) })
|
|
290
|
+
]
|
|
291
|
+
}
|
|
292
|
+
) }),
|
|
293
|
+
description && /* @__PURE__ */ jsx(
|
|
294
|
+
"div",
|
|
295
|
+
{
|
|
296
|
+
className: "HintText self-stretch text-slate-600 text-sm font-normal leading-tight",
|
|
297
|
+
id: name + ":description",
|
|
298
|
+
children: description
|
|
299
|
+
}
|
|
300
|
+
)
|
|
301
|
+
]
|
|
302
|
+
}
|
|
303
|
+
),
|
|
304
|
+
/* @__PURE__ */ jsx(
|
|
305
|
+
Dialog,
|
|
306
|
+
{
|
|
307
|
+
open: isDialogOpen,
|
|
308
|
+
onOpenChange: (open) => {
|
|
309
|
+
setIsDialogOpen(open);
|
|
310
|
+
if (!open) {
|
|
311
|
+
handleDialogCancel();
|
|
223
312
|
}
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
"
|
|
227
|
-
{
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
313
|
+
},
|
|
314
|
+
children: /* @__PURE__ */ jsxs(DialogContent, { className: "max-w-2xl max-h-[80vh] overflow-y-auto", children: [
|
|
315
|
+
/* @__PURE__ */ jsx(DialogHeader, { children: /* @__PURE__ */ jsx(DialogTitle, { children: "Zadejte popisy příloh" }) }),
|
|
316
|
+
/* @__PURE__ */ jsx("div", { className: "space-y-4 py-4", children: pendingFiles.map((file) => /* @__PURE__ */ jsxs(
|
|
317
|
+
"div",
|
|
318
|
+
{
|
|
319
|
+
className: "flex flex-col gap-2 p-4 border rounded-lg",
|
|
320
|
+
children: [
|
|
321
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
322
|
+
/* @__PURE__ */ jsx(MdInsertDriveFile, { style: { fontSize: "1.5rem" } }),
|
|
323
|
+
/* @__PURE__ */ jsxs("div", { className: "flex-1", children: [
|
|
324
|
+
/* @__PURE__ */ jsx("div", { className: "font-medium text-sm", children: file.name }),
|
|
325
|
+
/* @__PURE__ */ jsx("div", { className: "text-xs text-gray-500", children: formatFileSize(file.size) })
|
|
326
|
+
] })
|
|
327
|
+
] }),
|
|
328
|
+
/* @__PURE__ */ jsxs("div", { className: "mt-2", children: [
|
|
329
|
+
/* @__PURE__ */ jsx("label", { className: "text-sm font-medium mb-1 block", children: "Popis přílohy:" }),
|
|
330
|
+
/* @__PURE__ */ jsx(
|
|
331
|
+
Input,
|
|
332
|
+
{
|
|
333
|
+
value: fileNames[file.name] || file.name,
|
|
334
|
+
onChange: (e) => setFileNames({
|
|
335
|
+
...fileNames,
|
|
336
|
+
[file.name]: e.target.value
|
|
337
|
+
}),
|
|
338
|
+
placeholder: "Zadejte popis přílohy"
|
|
339
|
+
}
|
|
340
|
+
)
|
|
341
|
+
] })
|
|
342
|
+
]
|
|
343
|
+
},
|
|
344
|
+
file.name
|
|
345
|
+
)) }),
|
|
346
|
+
/* @__PURE__ */ jsxs(DialogFooter, { children: [
|
|
347
|
+
/* @__PURE__ */ jsx(Button, { variant: "outline", onClick: handleDialogCancel, disabled: isUploading, children: "Zrušit" }),
|
|
348
|
+
/* @__PURE__ */ jsx(Button, { onClick: handleDialogSubmit, disabled: isUploading, children: isUploading ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
349
|
+
/* @__PURE__ */ jsx(LoaderCircle, { className: "h-4 w-4 animate-spin mr-2" }),
|
|
350
|
+
"Nahrávání..."
|
|
351
|
+
] }) : "Nahrát" })
|
|
352
|
+
] })
|
|
353
|
+
] })
|
|
354
|
+
}
|
|
355
|
+
)
|
|
356
|
+
] });
|
|
236
357
|
};
|
|
237
358
|
export {
|
|
238
359
|
FileInputFormMultiple as default
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FileInputFormMultiple.js","sources":["../../utils/handleErrors.js","../../../lib/components/form/FileInputFormMultiple.tsx"],"sourcesContent":["const handleErrors = (error, emitter, customMessage) => {\n var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;\n let errmsgToDisplay = (customMessage || \"\") + \" \" + (((_c = (_b = (_a = error.response) == null ? void 0 : _a.data) == null ? void 0 : _b.error) == null ? void 0 : _c.message) || error.message || \"\");\n let errorTitle = \"\";\n if (error.code == \"ERR_NETWORK\") {\n errorTitle = \"Síťová chyba\";\n errmsgToDisplay = errmsgToDisplay + \" \" + (/* @__PURE__ */ new Date()).toLocaleString();\n } else if (error.code == \"ERR_BAD_REQUEST\") {\n if (((_d = error.response) == null ? void 0 : _d.status) == 403) {\n errorTitle = \"Přístup zamítnut\";\n } else if (((_e = error.response) == null ? void 0 : _e.status) == 409) {\n errorTitle = \"Konflikt\";\n } else {\n errorTitle = \"Interní chyba aplikace\";\n }\n errmsgToDisplay = (/* @__PURE__ */ new Date()).toLocaleString() + \" (\" + ((_f = error.response) == null ? void 0 : _f.status) + \") \\n\" + errmsgToDisplay;\n }\n console.error(error);\n const bgColor = ((_g = error.response) == null ? void 0 : _g.status) && ((_h = error.response) == null ? void 0 : _h.status) >= 400 ? \" bg-danger \" : \" bg-warning \";\n const type = ((_i = error.response) == null ? void 0 : _i.status) && ((_j = error.response) == null ? void 0 : _j.status) >= 400 ? \"error\" : \"warning\";\n emitter.emit(\"message\", {\n title: errorTitle,\n message: errmsgToDisplay,\n classes: bgColor || \" bg-danger \",\n timeout: 0,\n type\n });\n};\nexport {\n handleErrors\n};\n//# sourceMappingURL=handleErrors.js.map\n","import React, { useState, useCallback, useEffect } from \"react\";\r\nimport { useDropzone } from \"react-dropzone\";\r\nimport { MdDeleteOutline, MdInsertDriveFile } from \"react-icons/md\";\r\nimport { AxiosError } from \"axios\";\r\nimport { cn } from \"../../utils/utils\";\r\nimport { handleErrors } from \"@addsign/moje-agenda-shared-lib\";\r\nimport { IAttachment } from \"../../types\";\r\nimport { useFederationContext, useFormField } from \"../../main\";\r\n\r\ninterface FileInputFormMultipleProps {\r\n name: string;\r\n value?: IAttachment[] | null;\r\n onFilesChanged: (files: IAttachment[]) => void;\r\n description?: string;\r\n disabled?: boolean;\r\n initialFilesReadOnly?: boolean;\r\n initialFileIds?: number[];\r\n attachmentName?: string;\r\n attachmentType?: string;\r\n}\r\n\r\ninterface IAttachmentReadOnly extends IAttachment {\r\n readonly?: boolean;\r\n}\r\n\r\nconst MAX_FILE_SIZE = 1024 * 1024; // 1MB\r\n\r\nconst FileInputFormMultiple: React.FC<FileInputFormMultipleProps> = ({\r\n value,\r\n onFilesChanged,\r\n name,\r\n description,\r\n disabled,\r\n initialFilesReadOnly = true,\r\n initialFileIds,\r\n attachmentName,\r\n attachmentType,\r\n}) => {\r\n const [fileDataList, setFileDataList] = useState<IAttachmentReadOnly[]>(\r\n value?.map((file) => ({\r\n ...file,\r\n readonly: initialFilesReadOnly && initialFileIds?.includes(file.id),\r\n })) || []\r\n );\r\n\r\n const federationContext = useFederationContext();\r\n\r\n const { error } = useFormField();\r\n const hasError = !!error;\r\n useEffect(() => {\r\n if (!value || value.length === 0) {\r\n setFileDataList([]);\r\n return;\r\n }\r\n\r\n setFileDataList(\r\n value.map((file) => ({\r\n ...file,\r\n readonly: initialFilesReadOnly && initialFileIds?.includes(file.id),\r\n }))\r\n );\r\n }, [value, initialFilesReadOnly, initialFileIds]);\r\n\r\n const onDrop = useCallback(\r\n async (acceptedFiles: File[]) => {\r\n const uploadedFiles = await Promise.all(\r\n acceptedFiles.map(async (file) => {\r\n if (file.size > MAX_FILE_SIZE) {\r\n // Handle the case when the file size is exceeded\r\n federationContext.emitter.emit(\"message\", {\r\n title: \"Velikost souboru byla překročena\",\r\n message: `Maximální povolená velikost je ${MAX_FILE_SIZE / (1024 * 1024)} MB.`,\r\n classes: \"bg-danger \",\r\n timeout: 0,\r\n type: \"error\",\r\n });\r\n\r\n return null;\r\n }\r\n\r\n const formData = new FormData();\r\n\r\n // Add the JSON data object\r\n const dataObject = {\r\n ...(attachmentName && { attachmentName }),\r\n ...(attachmentType && { attachmentType }),\r\n };\r\n\r\n formData.append(\r\n \"data\",\r\n new Blob([JSON.stringify(dataObject)], { type: \"application/json\" })\r\n );\r\n formData.append(\"file\", file);\r\n\r\n try {\r\n const response =\r\n await federationContext.apiClient.post<IAttachment>(\r\n \"/files/upload\",\r\n formData,\r\n {\r\n headers: {\r\n \"Content-Type\": \"multipart/form-data\",\r\n },\r\n }\r\n );\r\n return response.data;\r\n } catch (error) {\r\n handleErrors(error as AxiosError, federationContext.emitter);\r\n console.error(\"There was an error!\", error);\r\n return null;\r\n }\r\n })\r\n );\r\n\r\n const validFiles = uploadedFiles.filter(\r\n (file) => file !== null\r\n ) as IAttachment[];\r\n const updatedFileDataList = [...fileDataList, ...validFiles];\r\n setFileDataList(updatedFileDataList);\r\n onFilesChanged(updatedFileDataList);\r\n },\r\n [\r\n federationContext,\r\n fileDataList,\r\n onFilesChanged,\r\n attachmentName,\r\n attachmentType,\r\n ]\r\n );\r\n\r\n const { getRootProps, getInputProps, isDragActive } = useDropzone({\r\n onDrop,\r\n disabled,\r\n });\r\n\r\n const handleRemove = (fileId: number) => {\r\n const updatedFileDataList = fileDataList.filter(\r\n (file) => file.id !== fileId\r\n );\r\n setFileDataList(updatedFileDataList);\r\n onFilesChanged(updatedFileDataList);\r\n };\r\n\r\n if (disabled === true && fileDataList.length === 0) {\r\n return null;\r\n }\r\n\r\n return (\r\n <div\r\n className=\"w-full min-h-30 flex-col justify-start items-start gap-1.5 inline-flex sharedLibrary\"\r\n data-cy={\"file-input-form-multiple-\" + name}\r\n >\r\n <div className=\"self-stretch flex-col justify-start items-start gap-1.5 flex\">\r\n <div\r\n className={cn(\r\n `self-stretch px-3 py-2 rounded-lg justify-start items-center gap-2 outline-none border bg-transparent `,\r\n hasError &&\r\n \"outline-4 outline-red-200 outline-offset-0 border-none \",\r\n disabled ? \"bg-gray-100\" : \"bg-transparent\"\r\n )}\r\n >\r\n {!disabled && (\r\n <div\r\n {...getRootProps()}\r\n className={`w-full p-4 border-dashed cursor-pointer \r\n border-2 rounded-lg text-center hover:bg-gray-100\r\n ${isDragActive ? \"border-indigo-300 bg-indigo-50\" : \"border-gray-300\"}`}\r\n >\r\n <input {...getInputProps()} id={name} />\r\n <p className=\"text-gray-500\">\r\n {isDragActive\r\n ? \"Sem přetáhněte soubory\"\r\n : \"Klikněte pro nahrání, nebo nahrajte přetažením souborů\"}\r\n </p>\r\n </div>\r\n )}\r\n <div className=\"w-full\">\r\n {fileDataList.map((file) => (\r\n <div\r\n key={file.id}\r\n className=\"w-full flex items-center justify-between py-2 border-b \"\r\n >\r\n <div className=\"flex items-center content-center\">\r\n <MdInsertDriveFile style={{ fontSize: \"2rem\" }} />\r\n <a\r\n href={`/api/files/download/${file.id}`}\r\n className=\"pl-2 text-left underline text-primary\"\r\n target=\"_blank\"\r\n >\r\n {file.filename}\r\n </a>\r\n </div>\r\n {!disabled && file.readonly !== true && (\r\n <div\r\n onClick={() => handleRemove(file.id)}\r\n className=\"text-gray-600 cursor-pointer hover:text-primary hover:bg-gray-200 rounded-full ml-4\"\r\n >\r\n <MdDeleteOutline\r\n style={{ fontSize: \"1.5rem\", margin: \"10px\" }}\r\n />\r\n </div>\r\n )}\r\n </div>\r\n ))}\r\n </div>\r\n </div>\r\n </div>\r\n {description && (\r\n <div\r\n className=\"HintText self-stretch text-slate-600 text-sm font-normal leading-tight\"\r\n id={name + \":description\"}\r\n >\r\n {description}\r\n </div>\r\n )}\r\n </div>\r\n );\r\n};\r\n\r\nexport default FileInputFormMultiple;\r\n"],"names":["error"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,MAAM,eAAe,CAAC,OAAO,SAAS,kBAAkB;AACtD,MAAI,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI;AACxC,MAAI,kBAAoC,SAAe,MAAM,MAAM,KAAK,MAAM,aAAa,OAAO,SAAS,GAAG,SAAS,OAAO,SAAS,GAAG,UAAU,OAAO,SAAS,GAAG,YAAY,MAAM,WAAW;AACpM,MAAI,aAAa;AACjB,MAAI,MAAM,QAAQ,eAAe;AAC/B,iBAAa;AACb,sBAAkB,kBAAkB,OAAuB,oBAAI,KAAI,GAAI;EAC3E,WAAa,MAAM,QAAQ,mBAAmB;AAC1C,UAAM,KAAK,MAAM,aAAa,OAAO,SAAS,GAAG,WAAW,KAAK;AAC/D,mBAAa;AAAA,IACd,aAAY,KAAK,MAAM,aAAa,OAAO,SAAS,GAAG,WAAW,KAAK;AACtE,mBAAa;AAAA,IACnB,OAAW;AACL,mBAAa;AAAA,IACd;AACD,uBAAmC,oBAAI,KAAM,GAAE,eAAc,IAAK,SAAS,KAAK,MAAM,aAAa,OAAO,SAAS,GAAG,UAAU,SAAS;AAAA,EAC1I;AACD,UAAQ,MAAM,KAAK;AACnB,QAAM,YAAY,KAAK,MAAM,aAAa,OAAO,SAAS,GAAG,aAAa,KAAK,MAAM,aAAa,OAAO,SAAS,GAAG,WAAW,MAAM,gBAAgB;AACtJ,QAAM,SAAS,KAAK,MAAM,aAAa,OAAO,SAAS,GAAG,aAAa,KAAK,MAAM,aAA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F;AAAA,kBAAA;AAAA,gBAAA;AAAA,gBArBG,KAAK;AAAA,cAwBb,CAAA,GACH;AAAA,YAAA;AAAA,UAAA;AAAA,QAAA,GAEJ;AAAA,QACC,eACC;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,WAAU;AAAA,YACV,IAAI,OAAO;AAAA,YAEV,UAAA;AAAA,UAAA;AAAA,QACH;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAIR;"}
|
|
1
|
+
{"version":3,"file":"FileInputFormMultiple.js","sources":["../../utils/handleErrors.js","../../../lib/components/form/FileInputFormMultiple.tsx"],"sourcesContent":["const handleErrors = (error, emitter, customMessage) => {\n var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;\n let errmsgToDisplay = (customMessage || \"\") + \" \" + (((_c = (_b = (_a = error.response) == null ? void 0 : _a.data) == null ? void 0 : _b.error) == null ? void 0 : _c.message) || error.message || \"\");\n let errorTitle = \"\";\n if (error.code == \"ERR_NETWORK\") {\n errorTitle = \"Síťová chyba\";\n errmsgToDisplay = errmsgToDisplay + \" \" + (/* @__PURE__ */ new Date()).toLocaleString();\n } else if (error.code == \"ERR_BAD_REQUEST\") {\n if (((_d = error.response) == null ? void 0 : _d.status) == 403) {\n errorTitle = \"Přístup zamítnut\";\n } else if (((_e = error.response) == null ? void 0 : _e.status) == 409) {\n errorTitle = \"Konflikt\";\n } else {\n errorTitle = \"Interní chyba aplikace\";\n }\n errmsgToDisplay = (/* @__PURE__ */ new Date()).toLocaleString() + \" (\" + ((_f = error.response) == null ? void 0 : _f.status) + \") \\n\" + errmsgToDisplay;\n }\n console.error(error);\n const bgColor = ((_g = error.response) == null ? void 0 : _g.status) && ((_h = error.response) == null ? void 0 : _h.status) >= 400 ? \" bg-danger \" : \" bg-warning \";\n const type = ((_i = error.response) == null ? void 0 : _i.status) && ((_j = error.response) == null ? void 0 : _j.status) >= 400 ? \"error\" : \"warning\";\n emitter.emit(\"message\", {\n title: errorTitle,\n message: errmsgToDisplay,\n classes: bgColor || \" bg-danger \",\n timeout: 0,\n type\n });\n};\nexport {\n handleErrors\n};\n//# sourceMappingURL=handleErrors.js.map\n","import React, { useState, useCallback, useEffect } from \"react\";\r\nimport { useDropzone } from \"react-dropzone\";\r\nimport { MdDeleteOutline, MdInsertDriveFile } from \"react-icons/md\";\r\nimport { AxiosError } from \"axios\";\r\nimport { LoaderCircleIcon } from \"lucide-react\";\r\nimport { cn } from \"../../utils/utils\";\r\nimport { handleErrors } from \"@addsign/moje-agenda-shared-lib\";\r\nimport { IAttachment } from \"../../types\";\r\nimport { useFederationContext, useFormField } from \"../../main\";\r\nimport {\r\n Dialog,\r\n DialogContent,\r\n DialogHeader,\r\n DialogTitle,\r\n DialogFooter,\r\n} from \"../ui/Dialog\";\r\nimport { Input } from \"../ui/input\";\r\nimport { Button } from \"../ui/button\";\r\n\r\ninterface FileInputFormMultipleProps {\r\n name: string;\r\n value?: IAttachment[] | null;\r\n onFilesChanged: (files: IAttachment[]) => void;\r\n description?: string;\r\n disabled?: boolean;\r\n initialFilesReadOnly?: boolean;\r\n initialFileIds?: number[];\r\n attachmentName?: string;\r\n attachmentType?: string;\r\n askForAttachmentName?: boolean;\r\n}\r\n\r\ninterface IAttachmentReadOnly extends IAttachment {\r\n readonly?: boolean;\r\n}\r\n\r\nconst MAX_FILE_SIZE = 1024 * 1024; // 1MB\r\n\r\nconst FileInputFormMultiple: React.FC<FileInputFormMultipleProps> = ({\r\n value,\r\n onFilesChanged,\r\n name,\r\n description,\r\n disabled,\r\n initialFilesReadOnly = true,\r\n initialFileIds,\r\n attachmentName,\r\n attachmentType,\r\n askForAttachmentName = false,\r\n}) => {\r\n const [fileDataList, setFileDataList] = useState<IAttachmentReadOnly[]>(\r\n value?.map((file) => ({\r\n ...file,\r\n readonly: initialFilesReadOnly && initialFileIds?.includes(file.id),\r\n })) || []\r\n );\r\n\r\n const [pendingFiles, setPendingFiles] = useState<File[]>([]);\r\n const [isDialogOpen, setIsDialogOpen] = useState(false);\r\n const [fileNames, setFileNames] = useState<Record<string, string>>({});\r\n const [isUploading, setIsUploading] = useState(false);\r\n\r\n const federationContext = useFederationContext();\r\n\r\n const { error } = useFormField();\r\n const hasError = !!error;\r\n useEffect(() => {\r\n if (!value || value.length === 0) {\r\n setFileDataList([]);\r\n return;\r\n }\r\n\r\n setFileDataList(\r\n value.map((file) => ({\r\n ...file,\r\n readonly: initialFilesReadOnly && initialFileIds?.includes(file.id),\r\n }))\r\n );\r\n }, [value, initialFilesReadOnly, initialFileIds]);\r\n\r\n const uploadFiles = useCallback(\r\n async (files: File[], customNames?: Record<string, string>) => {\r\n setIsUploading(true);\r\n const uploadedFiles = await Promise.all(\r\n files.map(async (file) => {\r\n if (file.size > MAX_FILE_SIZE) {\r\n // Handle the case when the file size is exceeded\r\n federationContext.emitter.emit(\"message\", {\r\n title: \"Velikost souboru byla překročena\",\r\n message: `Maximální povolená velikost je ${MAX_FILE_SIZE / (1024 * 1024)} MB.`,\r\n classes: \"bg-danger \",\r\n timeout: 0,\r\n type: \"error\",\r\n });\r\n\r\n return null;\r\n }\r\n\r\n const formData = new FormData();\r\n\r\n // Add the JSON data object\r\n const dataObject = {\r\n ...(customNames?.[file.name]\r\n ? { attachmentName: customNames[file.name] }\r\n : attachmentName && { attachmentName }),\r\n ...(attachmentType && { attachmentType }),\r\n };\r\n\r\n formData.append(\r\n \"data\",\r\n new Blob([JSON.stringify(dataObject)], { type: \"application/json\" })\r\n );\r\n formData.append(\"file\", file);\r\n\r\n try {\r\n const response =\r\n await federationContext.apiClient.post<IAttachment>(\r\n \"/files/upload\",\r\n formData,\r\n {\r\n headers: {\r\n \"Content-Type\": \"multipart/form-data\",\r\n },\r\n }\r\n );\r\n return response.data;\r\n } catch (error) {\r\n handleErrors(error as AxiosError, federationContext.emitter);\r\n console.error(\"There was an error!\", error);\r\n return null;\r\n }\r\n })\r\n );\r\n\r\n const validFiles = uploadedFiles.filter(\r\n (file) => file !== null\r\n ) as IAttachment[];\r\n const updatedFileDataList = [...fileDataList, ...validFiles];\r\n setFileDataList(updatedFileDataList);\r\n onFilesChanged(updatedFileDataList);\r\n setIsUploading(false);\r\n },\r\n [\r\n federationContext,\r\n fileDataList,\r\n onFilesChanged,\r\n attachmentName,\r\n attachmentType,\r\n ]\r\n );\r\n\r\n const onDrop = useCallback(\r\n async (acceptedFiles: File[]) => {\r\n // Filter out files that exceed size limit\r\n const validFiles = acceptedFiles.filter((file) => {\r\n if (file.size > MAX_FILE_SIZE) {\r\n federationContext.emitter.emit(\"message\", {\r\n title: \"Velikost souboru byla překročena\",\r\n message: `Maximální povolená velikost je ${MAX_FILE_SIZE / (1024 * 1024)} MB.`,\r\n classes: \"bg-danger \",\r\n timeout: 0,\r\n type: \"error\",\r\n });\r\n return false;\r\n }\r\n return true;\r\n });\r\n\r\n if (validFiles.length === 0) {\r\n return;\r\n }\r\n\r\n if (askForAttachmentName) {\r\n // Initialize file names with original file names\r\n const initialNames: Record<string, string> = {};\r\n validFiles.forEach((file) => {\r\n initialNames[file.name] = file.name;\r\n });\r\n setFileNames(initialNames);\r\n setPendingFiles(validFiles);\r\n setIsDialogOpen(true);\r\n } else {\r\n await uploadFiles(validFiles);\r\n }\r\n },\r\n [askForAttachmentName, uploadFiles, federationContext]\r\n );\r\n\r\n const handleDialogSubmit = async () => {\r\n setIsDialogOpen(false);\r\n await uploadFiles(pendingFiles, fileNames);\r\n setPendingFiles([]);\r\n setFileNames({});\r\n };\r\n\r\n const handleDialogCancel = () => {\r\n setIsDialogOpen(false);\r\n setPendingFiles([]);\r\n setFileNames({});\r\n };\r\n\r\n const formatFileSize = (bytes: number): string => {\r\n if (bytes === 0) return \"0 Bytes\";\r\n const k = 1024;\r\n const sizes = [\"Bytes\", \"KB\", \"MB\", \"GB\"];\r\n const i = Math.floor(Math.log(bytes) / Math.log(k));\r\n return Math.round(bytes / Math.pow(k, i) * 100) / 100 + \" \" + sizes[i];\r\n };\r\n\r\n const { getRootProps, getInputProps, isDragActive } = useDropzone({\r\n onDrop,\r\n disabled: disabled || isUploading,\r\n });\r\n\r\n const handleRemove = (fileId: number) => {\r\n const updatedFileDataList = fileDataList.filter(\r\n (file) => file.id !== fileId\r\n );\r\n setFileDataList(updatedFileDataList);\r\n onFilesChanged(updatedFileDataList);\r\n };\r\n\r\n if (disabled === true && fileDataList.length === 0) {\r\n return null;\r\n }\r\n\r\n return (\r\n <>\r\n <div\r\n className=\"w-full min-h-30 flex-col justify-start items-start gap-1.5 inline-flex sharedLibrary\"\r\n data-cy={\"file-input-form-multiple-\" + name}\r\n >\r\n <div className=\"self-stretch flex-col justify-start items-start gap-1.5 flex\">\r\n <div\r\n className={cn(\r\n `self-stretch px-3 py-2 rounded-lg justify-start items-center gap-2 outline-none border bg-transparent relative`,\r\n hasError &&\r\n \"outline-4 outline-red-200 outline-offset-0 border-none \",\r\n disabled ? \"bg-gray-100\" : \"bg-transparent\"\r\n )}\r\n >\r\n {isUploading && (\r\n <div className=\"absolute inset-0 bg-white/80 backdrop-blur-sm rounded-lg z-10 flex items-center justify-center\">\r\n <div className=\"flex flex-col items-center gap-2\">\r\n <LoaderCircleIcon className=\"h-8 w-8 animate-spin text-primary\" />\r\n <p className=\"text-sm text-gray-600\">Nahrávání...</p>\r\n </div>\r\n </div>\r\n )}\r\n {!disabled && (\r\n <div\r\n {...getRootProps()}\r\n className={cn(\r\n `w-full p-4 border-dashed border-2 rounded-lg text-center`,\r\n isUploading\r\n ? \"cursor-not-allowed opacity-50\"\r\n : \"cursor-pointer hover:bg-gray-100\",\r\n isDragActive ? \"border-indigo-300 bg-indigo-50\" : \"border-gray-300\"\r\n )}\r\n >\r\n <input {...getInputProps()} id={name} />\r\n <p className=\"text-gray-500\">\r\n {isDragActive\r\n ? \"Sem přetáhněte soubory\"\r\n : \"Klikněte pro nahrání, nebo nahrajte přetažením souborů\"}\r\n </p>\r\n </div>\r\n )}\r\n <div className=\"w-full\">\r\n {fileDataList.map((file) => (\r\n <div\r\n key={file.id}\r\n className=\"w-full flex items-center justify-between py-2 border-b \"\r\n >\r\n <div className=\"flex flex-col flex-1\">\r\n <div className=\"flex items-center content-center gap-2\">\r\n <MdInsertDriveFile style={{ fontSize: \"2rem\" }} />\r\n\r\n <div className=\"flex flex-col flex-1\">\r\n <a\r\n href={`/api/files/download/${file.id}`}\r\n className=\"text-left underline text-primary text-sm\"\r\n target=\"_blank\"\r\n >\r\n {file.filename}\r\n </a>\r\n {file.attachmentName && (\r\n <div className=\"text-sm text-gray-600\">\r\n {file.attachmentName}\r\n </div>\r\n )}\r\n </div>\r\n </div>\r\n\r\n </div>\r\n {!disabled && file.readonly !== true && !isUploading && (\r\n <div\r\n onClick={() => handleRemove(file.id)}\r\n className=\"text-gray-600 cursor-pointer hover:text-primary hover:bg-gray-200 rounded-full ml-4\"\r\n >\r\n <MdDeleteOutline\r\n style={{ fontSize: \"1.5rem\", margin: \"10px\" }}\r\n />\r\n </div>\r\n )}\r\n </div>\r\n ))}\r\n </div>\r\n </div>\r\n </div>\r\n {description && (\r\n <div\r\n className=\"HintText self-stretch text-slate-600 text-sm font-normal leading-tight\"\r\n id={name + \":description\"}\r\n >\r\n {description}\r\n </div>\r\n )}\r\n </div>\r\n\r\n <Dialog\r\n open={isDialogOpen}\r\n onOpenChange={(open) => {\r\n setIsDialogOpen(open);\r\n if (!open) {\r\n handleDialogCancel();\r\n }\r\n }}\r\n >\r\n <DialogContent className=\"max-w-2xl max-h-[80vh] overflow-y-auto\">\r\n <DialogHeader>\r\n <DialogTitle>Zadejte popisy příloh</DialogTitle>\r\n </DialogHeader>\r\n <div className=\"space-y-4 py-4\">\r\n {pendingFiles.map((file) => (\r\n <div\r\n key={file.name}\r\n className=\"flex flex-col gap-2 p-4 border rounded-lg\"\r\n >\r\n <div className=\"flex items-center gap-2\">\r\n <MdInsertDriveFile style={{ fontSize: \"1.5rem\" }} />\r\n <div className=\"flex-1\">\r\n <div className=\"font-medium text-sm\">{file.name}</div>\r\n <div className=\"text-xs text-gray-500\">\r\n {formatFileSize(file.size)}\r\n </div>\r\n </div>\r\n </div>\r\n <div className=\"mt-2\">\r\n <label className=\"text-sm font-medium mb-1 block\">\r\n Popis přílohy:\r\n </label>\r\n <Input\r\n value={fileNames[file.name] || file.name}\r\n onChange={(e) =>\r\n setFileNames({\r\n ...fileNames,\r\n [file.name]: e.target.value,\r\n })\r\n }\r\n placeholder=\"Zadejte popis přílohy\"\r\n />\r\n </div>\r\n </div>\r\n ))}\r\n </div>\r\n <DialogFooter>\r\n <Button variant=\"outline\" onClick={handleDialogCancel} disabled={isUploading}>\r\n Zrušit\r\n </Button>\r\n <Button onClick={handleDialogSubmit} disabled={isUploading}>\r\n {isUploading ? (\r\n <>\r\n <LoaderCircleIcon className=\"h-4 w-4 animate-spin mr-2\" />\r\n Nahrávání...\r\n </>\r\n ) : (\r\n \"Nahrát\"\r\n )}\r\n </Button>\r\n </DialogFooter>\r\n </DialogContent>\r\n </Dialog>\r\n </>\r\n );\r\n};\r\n\r\nexport default FileInputFormMultiple;\r\n"],"names":["error","LoaderCircleIcon"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,MAAM,eAAe,CAAC,OAAO,SAAS,kBAAkB;AACtD,MAAI,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI;AACxC,MAAI,kBAAoC,SAAe,MAAM,MAAM,KAAK,MAAM,aAAa,OAAO,SAAS,GAAG,SAAS,OAAO,SAAS,GAAG,UAAU,OAAO,SAAS,GAAG,YAAY,MAAM,WAAW;AACpM,MAAI,aAAa;AACjB,MAAI,MAAM,QAAQ,eAAe;AAC/B,iBAAa;AACb,sBAAkB,kBAAkB,OAAuB,oBAAI,KAAI,GAAI;EAC3E,WAAa,MAAM,QAAQ,mBAAmB;AAC1C,UAAM,KAAK,MAAM,aAAa,OAAO,SAAS,GAAG,WAAW,KAAK;AAC/D,mBAAa;AAAA,IACd,aAAY,KAAK,MAAM,aAAa,OAAO,SAAS,GAAG,WAAW,KAAK;AACtE,mBAAa;A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KAAK,KAAK;AAAA,sBACpC,UAAU,CAAC,MACT,aAAa;AAAA,wBACX,GAAG;AAAA,wBACH,CAAC,KAAK,IAAI,GAAG,EAAE,OAAO;AAAA,sBAAA,CACvB;AAAA,sBAEH,aAAY;AAAA,oBAAA;AAAA,kBACd;AAAA,gBAAA,GACF;AAAA,cAAA;AAAA,YAAA;AAAA,YA1BK,KAAK;AAAA,UA4Bb,CAAA,GACH;AAAA,+BACC,cACC,EAAA,UAAA;AAAA,YAAA,oBAAC,UAAO,SAAQ,WAAU,SAAS,oBAAoB,UAAU,aAAa,UAE9E,SAAA,CAAA;AAAA,gCACC,QAAO,EAAA,SAAS,oBAAoB,UAAU,aAC5C,wBAEG,qBAAA,UAAA,EAAA,UAAA;AAAA,cAAC,oBAAAA,cAAA,EAAiB,WAAU,4BAA4B,CAAA;AAAA,cAAE;AAAA,YAAA,EAE5D,CAAA,IAEA,UAEJ;AAAA,UAAA,GACF;AAAA,QAAA,GACF;AAAA,MAAA;AAAA,IACF;AAAA,EACF,EAAA,CAAA;AAEJ;"}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useState, useEffect, useCallback } from "react";
|
|
3
|
-
import { u as useDropzone } from "../../index-
|
|
3
|
+
import { u as useDropzone } from "../../index-DrJcw1yx.js";
|
|
4
4
|
import { d as MdInsertDriveFile, e as MdDeleteOutline } from "../../index-CrfjcbOs.js";
|
|
5
5
|
import "../../tailwind-l0sNRNKZ.js";
|
|
6
6
|
import { cn } from "../../utils/utils.js";
|
|
7
|
+
import "../../Dialog-BmQoVu5C.js";
|
|
8
|
+
import "../../input-Cm_FjJOF.js";
|
|
7
9
|
import "../ui/button.js";
|
|
8
|
-
import "../ui/input.js";
|
|
9
10
|
import "../ui/multi-select.js";
|
|
10
11
|
import "../ui/select.js";
|
|
11
12
|
import "../../index.esm-ifS8v9eQ.js";
|
|
@@ -13,7 +14,6 @@ import "../../jspdf.plugin.autotable-7hp3hM-a.js";
|
|
|
13
14
|
import "../../contexts/FederationContext.js";
|
|
14
15
|
import { useFederationContext } from "../../contexts/useFederationContext.js";
|
|
15
16
|
import { handleErrors } from "../../utils/handleErrors.js";
|
|
16
|
-
import "../../Dialog-CCrUyF91.js";
|
|
17
17
|
import "../ui/ScrollArea.js";
|
|
18
18
|
import "../ui/form.js";
|
|
19
19
|
import "../ui/radioGroup.js";
|
|
@@ -2,15 +2,15 @@ import { jsxs, jsx, Fragment } from "react/jsx-runtime";
|
|
|
2
2
|
import { useState, useRef, useEffect } from "react";
|
|
3
3
|
import { b as MdClose } from "../../index-CrfjcbOs.js";
|
|
4
4
|
import "../../tailwind-l0sNRNKZ.js";
|
|
5
|
+
import "../../Dialog-BmQoVu5C.js";
|
|
6
|
+
import "../../input-Cm_FjJOF.js";
|
|
5
7
|
import "../ui/button.js";
|
|
6
|
-
import "../ui/input.js";
|
|
7
8
|
import "../ui/multi-select.js";
|
|
8
9
|
import "../ui/select.js";
|
|
9
10
|
import "../../index.esm-ifS8v9eQ.js";
|
|
10
11
|
import "../../jspdf.plugin.autotable-7hp3hM-a.js";
|
|
11
12
|
import "../../contexts/FederationContext.js";
|
|
12
13
|
import { useFederationContext } from "../../contexts/useFederationContext.js";
|
|
13
|
-
import "../../Dialog-CCrUyF91.js";
|
|
14
14
|
import "../ui/ScrollArea.js";
|
|
15
15
|
import "../ui/form.js";
|
|
16
16
|
import "../ui/radioGroup.js";
|
|
@@ -5,9 +5,10 @@ import Button from "../Button.js";
|
|
|
5
5
|
import AutocompleteSearchBar from "./AutocompleteSearchBar.js";
|
|
6
6
|
import { c as MdCheck } from "../../index-CrfjcbOs.js";
|
|
7
7
|
import FormField from "./FormField.js";
|
|
8
|
-
import
|
|
8
|
+
import "../../Dialog-BmQoVu5C.js";
|
|
9
|
+
import "../../input-Cm_FjJOF.js";
|
|
9
10
|
import "../ui/button.js";
|
|
10
|
-
import "../
|
|
11
|
+
import SectionTitle from "../layout/SectionTitle.js";
|
|
11
12
|
import "../ui/multi-select.js";
|
|
12
13
|
import "../ui/select.js";
|
|
13
14
|
import "../../index.esm-ifS8v9eQ.js";
|
|
@@ -15,7 +16,6 @@ import "../../jspdf.plugin.autotable-7hp3hM-a.js";
|
|
|
15
16
|
import "../../contexts/FederationContext.js";
|
|
16
17
|
import { useFederationContext } from "../../contexts/useFederationContext.js";
|
|
17
18
|
import { getFullName } from "../../utils/getFullName.js";
|
|
18
|
-
import "../../Dialog-CCrUyF91.js";
|
|
19
19
|
import "../ui/ScrollArea.js";
|
|
20
20
|
import "../ui/form.js";
|
|
21
21
|
import "../ui/radioGroup.js";
|
|
@@ -4,15 +4,15 @@ import { b as MdClose, M as MdExpandLess, a as MdExpandMore, c as MdCheck } from
|
|
|
4
4
|
import "../../tailwind-l0sNRNKZ.js";
|
|
5
5
|
import { c as FaSpinner } from "../../index-DH-TC1O6.js";
|
|
6
6
|
import SpinnerIcon from "../SpinnerIcon.js";
|
|
7
|
+
import "../../Dialog-BmQoVu5C.js";
|
|
8
|
+
import "../../input-Cm_FjJOF.js";
|
|
7
9
|
import "../ui/button.js";
|
|
8
|
-
import "../ui/input.js";
|
|
9
10
|
import "../ui/multi-select.js";
|
|
10
11
|
import "../ui/select.js";
|
|
11
12
|
import "../../index.esm-ifS8v9eQ.js";
|
|
12
13
|
import "../../jspdf.plugin.autotable-7hp3hM-a.js";
|
|
13
14
|
import "../../contexts/FederationContext.js";
|
|
14
15
|
import { useFederationContext } from "../../contexts/useFederationContext.js";
|
|
15
|
-
import "../../Dialog-CCrUyF91.js";
|
|
16
16
|
import "../ui/ScrollArea.js";
|
|
17
17
|
import "../ui/form.js";
|
|
18
18
|
import "../ui/radioGroup.js";
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
2
|
import "../../tailwind-l0sNRNKZ.js";
|
|
3
3
|
import "react";
|
|
4
|
+
import "../../Dialog-BmQoVu5C.js";
|
|
5
|
+
import "../../input-Cm_FjJOF.js";
|
|
4
6
|
import { Button } from "../ui/button.js";
|
|
5
|
-
import "../ui/input.js";
|
|
6
7
|
import "../ui/multi-select.js";
|
|
7
8
|
import "../ui/select.js";
|
|
8
9
|
import "../../index.esm-ifS8v9eQ.js";
|
|
9
10
|
import "../../jspdf.plugin.autotable-7hp3hM-a.js";
|
|
10
11
|
import "../../contexts/FederationContext.js";
|
|
11
|
-
import "../../Dialog-CCrUyF91.js";
|
|
12
12
|
import "../ui/ScrollArea.js";
|
|
13
13
|
import "../ui/form.js";
|
|
14
14
|
import "../ui/radioGroup.js";
|
|
@@ -2,8 +2,9 @@ import { jsxs, Fragment, jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { useState, useMemo, useEffect } from "react";
|
|
3
3
|
import SectionTitle from "../layout/SectionTitle.js";
|
|
4
4
|
import "../../tailwind-l0sNRNKZ.js";
|
|
5
|
+
import "../../Dialog-BmQoVu5C.js";
|
|
6
|
+
import "../../input-Cm_FjJOF.js";
|
|
5
7
|
import "../ui/button.js";
|
|
6
|
-
import "../ui/input.js";
|
|
7
8
|
import "../ui/multi-select.js";
|
|
8
9
|
import "../ui/select.js";
|
|
9
10
|
import "../../index.esm-ifS8v9eQ.js";
|
|
@@ -13,7 +14,6 @@ import { useFederationContext } from "../../contexts/useFederationContext.js";
|
|
|
13
14
|
import { getFullName } from "../../utils/getFullName.js";
|
|
14
15
|
import { handleErrors } from "../../utils/handleErrors.js";
|
|
15
16
|
import { EApproverRoles } from "../../types.js";
|
|
16
|
-
import "../../Dialog-CCrUyF91.js";
|
|
17
17
|
import "../ui/ScrollArea.js";
|
|
18
18
|
import "../ui/form.js";
|
|
19
19
|
import "../ui/radioGroup.js";
|
|
@@ -3,7 +3,7 @@ import * as React from "react";
|
|
|
3
3
|
import { cn } from "../../utils/utils.js";
|
|
4
4
|
import { Button } from "./button.js";
|
|
5
5
|
import { Command, CommandInput, CommandList, CommandEmpty, CommandGroup, CommandItem } from "./command.js";
|
|
6
|
-
import { P as Popover, a as PopoverTrigger, b as PopoverContent } from "../../popover-
|
|
6
|
+
import { P as Popover, a as PopoverTrigger, b as PopoverContent } from "../../popover-DpJhfyvx.js";
|
|
7
7
|
import { c as createLucideIcon } from "../../createLucideIcon-KSoQd4Wi.js";
|
|
8
8
|
import { X } from "../../x-DciOkaU0.js";
|
|
9
9
|
import { C as Check } from "../../check-B7dJm08z.js";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
2
|
import { Button } from "./button.js";
|
|
3
3
|
import { f as format, C as Calendar$1, i as isValid } from "../../Calendar-DWT4e7Th.js";
|
|
4
|
-
import { P as Popover, a as PopoverTrigger, b as PopoverContent } from "../../popover-
|
|
4
|
+
import { P as Popover, a as PopoverTrigger, b as PopoverContent } from "../../popover-DpJhfyvx.js";
|
|
5
5
|
import { cn } from "../../utils/utils.js";
|
|
6
6
|
import { forwardRef, useState, useEffect } from "react";
|
|
7
|
-
import { Input } from "
|
|
7
|
+
import { I as Input } from "../../input-Cm_FjJOF.js";
|
|
8
8
|
import { c as createLucideIcon } from "../../createLucideIcon-KSoQd4Wi.js";
|
|
9
9
|
import { X } from "../../x-DciOkaU0.js";
|
|
10
10
|
import { p as parse } from "../../parse-D2yb8751.js";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
2
|
import { Button } from "./button.js";
|
|
3
3
|
import { t as toDate, c as constructFrom, s as setMonth, f as format, C as Calendar, i as isValid } from "../../Calendar-DWT4e7Th.js";
|
|
4
|
-
import { P as Popover, a as PopoverTrigger, b as PopoverContent, c as PopoverClose } from "../../popover-
|
|
4
|
+
import { P as Popover, a as PopoverTrigger, b as PopoverContent, c as PopoverClose } from "../../popover-DpJhfyvx.js";
|
|
5
5
|
import { cn } from "../../utils/utils.js";
|
|
6
6
|
import React__default, { forwardRef, useEffect } from "react";
|
|
7
|
-
import { Input } from "
|
|
7
|
+
import { I as Input } from "../../input-Cm_FjJOF.js";
|
|
8
8
|
import { Select, SelectTrigger, SelectValue, SelectContent, SelectItem } from "./select.js";
|
|
9
9
|
import { c as createLucideIcon } from "../../createLucideIcon-KSoQd4Wi.js";
|
|
10
10
|
import { X } from "../../x-DciOkaU0.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "react/jsx-runtime";
|
|
2
2
|
import "react";
|
|
3
|
-
import { D, c, e, i, g, f, b, a, h, d } from "../../Dialog-
|
|
3
|
+
import { D, c, e, i, g, f, b, a, h, d } from "../../Dialog-BmQoVu5C.js";
|
|
4
4
|
import "../../utils/utils.js";
|
|
5
5
|
import "../../x-DciOkaU0.js";
|
|
6
6
|
export {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
import { P as Primitive } from "../../index-B761_inZ.js";
|
|
4
|
-
import { P as Presence } from "../../index-
|
|
5
|
-
import { c as createContextScope, b as composeEventHandlers, a as useCallbackRef, u as useLayoutEffect2 } from "../../index-
|
|
4
|
+
import { P as Presence } from "../../index-CA2QNu6z.js";
|
|
5
|
+
import { c as createContextScope, b as composeEventHandlers, a as useCallbackRef, u as useLayoutEffect2 } from "../../index-CDCkSjVs.js";
|
|
6
6
|
import { u as useComposedRefs } from "../../index-D9mvqz1C.js";
|
|
7
7
|
import { u as useDirection } from "../../index-Bk8dRTPE.js";
|
|
8
8
|
import { c as clamp } from "../../index-IXOTxK3N.js";
|