@addsign/moje-agenda-shared-lib 2.0.54 → 2.0.56

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.
@@ -21,6 +21,7 @@ interface FileInputProps {
21
21
  message: string;
22
22
  };
23
23
  };
24
+ attachmentName?: string;
24
25
  }
25
26
  declare const FileInput: React.FC<FileInputProps>;
26
27
  export default FileInput;
@@ -34,7 +34,8 @@ const FileInput = ({
34
34
  required,
35
35
  description,
36
36
  disabled,
37
- errors = {}
37
+ errors = {},
38
+ attachmentName
38
39
  }) => {
39
40
  var _a, _b, _c, _d;
40
41
  const [fileData, setFileData] = useState(
@@ -62,6 +63,9 @@ const FileInput = ({
62
63
  });
63
64
  return;
64
65
  }
66
+ if (attachmentName) {
67
+ file.attachmentName = attachmentName;
68
+ }
65
69
  const formData = new FormData();
66
70
  formData.append("file", file);
67
71
  try {
@@ -1 +1 @@
1
- {"version":3,"file":"FileInput.js","sources":["../../../lib/components/form/FileInput.tsx"],"sourcesContent":["import React, { useState, useEffect, useCallback } from \"react\";\r\nimport { useDropzone } from \"react-dropzone\";\r\nimport { handleErrors, useFederationContext } from \"../../main\";\r\nimport { MdDeleteOutline, MdInsertDriveFile } from \"react-icons/md\";\r\nimport { AxiosError } from \"axios\";\r\n\r\nexport interface FileData {\r\n id: number;\r\n mimeType: string;\r\n size: number;\r\n filename: string;\r\n createdByEmpId: string;\r\n created: string;\r\n}\r\n\r\ninterface FileInputProps {\r\n name: string;\r\n label?: string;\r\n initialFile?: FileData;\r\n onFileChanged: (e: any) => void;\r\n required?: boolean;\r\n description?: string;\r\n disabled?: boolean;\r\n errors?: { [key: string]: { message: string } };\r\n}\r\n\r\nconst MAX_FILE_SIZE = 1024 * 1024; // 1MB\r\n\r\nconst FileInput: React.FC<FileInputProps> = ({\r\n initialFile,\r\n onFileChanged,\r\n label,\r\n name,\r\n required,\r\n description,\r\n disabled,\r\n errors = {},\r\n}) => {\r\n const [fileData, setFileData] = useState<FileData | null>(\r\n initialFile || null\r\n );\r\n const [isFocused, setIsFocused] = useState(false);\r\n\r\n const federationContext = useFederationContext();\r\n useEffect(() => {\r\n if (initialFile) {\r\n setFileData(initialFile);\r\n onFileChanged({ target: { name, value: initialFile.id.toString() } });\r\n }\r\n }, [initialFile, onFileChanged, name]);\r\n\r\n const onDrop = useCallback(\r\n async (acceptedFiles: File[]) => {\r\n if (acceptedFiles.length > 0) {\r\n const file = acceptedFiles[0];\r\n\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 return;\r\n }\r\n\r\n const formData = new FormData();\r\n formData.append(\"file\", file);\r\n\r\n try {\r\n const response = await federationContext.apiClient.post<FileData>(\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 setFileData(response.data);\r\n onFileChanged({\r\n target: { name, value: response.data.id.toString() },\r\n });\r\n setIsFocused(false);\r\n } catch (error) {\r\n handleErrors(error as AxiosError, federationContext.emitter);\r\n console.error(\"There was an error!\", error);\r\n }\r\n }\r\n },\r\n [\r\n federationContext.apiClient,\r\n federationContext.emitter,\r\n onFileChanged,\r\n name,\r\n ]\r\n );\r\n\r\n const { getRootProps, getInputProps, isDragActive } = useDropzone({\r\n onDrop,\r\n disabled,\r\n multiple: false,\r\n });\r\n\r\n const handleRemove = () => {\r\n setFileData(null);\r\n onFileChanged({ target: { name, value: null } });\r\n };\r\n\r\n return (\r\n <div className=\"w-full min-h-30 flex-col justify-start items-start gap-1.5 inline-flex sharedLibrary\">\r\n <div className=\"self-stretch flex-col justify-start items-start gap-1.5 flex\">\r\n {label && (\r\n <label\r\n className=\"text-slate-700 text-sm leading-tight font-medium\"\r\n htmlFor={name}\r\n >\r\n {label} {required ? \"*\" : \"\"}\r\n </label>\r\n )}\r\n <div\r\n className={\r\n `self-stretch px-3 py-2 rounded-lg justify-start items-center gap-2 inline-flex outline-none border` +\r\n ` ${\r\n isFocused && !errors[name]?.message\r\n ? \"outline-4 outline-indigo-200 outline-offset-0 border-indigo-300\"\r\n : \"\"\r\n }` +\r\n ` ${\r\n isFocused && errors[name]?.message\r\n ? \"outline-4 outline-red-200 outline-offset-0 border-none\"\r\n : \"\"\r\n } ` +\r\n ` ${!isFocused && errors[name]?.message ? \"border-red-200\" : \"\"} ` +\r\n ` ${disabled ? \"bg-gray-100\" : \"bg-transparent\"}`\r\n }\r\n onFocus={() => setIsFocused(true)}\r\n onBlur={() => setIsFocused(false)}\r\n >\r\n <div className=\"flex relative grow shrink basis-0 min-h-5 lg:min-h-[32px] justify-start items-stretch gap-2 max-w-full \">\r\n {!fileData ? (\r\n <div\r\n {...getRootProps()}\r\n className={`w-full p-4 border-dashed border-2 rounded-lg text-center ${\r\n isDragActive\r\n ? \"border-indigo-300 bg-indigo-50\"\r\n : \"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 soubor\"\r\n : \"Klikněte pro nahrání, nebo nahrajte přetažením souboru\"}\r\n </p>\r\n </div>\r\n ) : (\r\n <div className=\"w-full flex items-center justify-between p-2\">\r\n <div className=\" flex\">\r\n <MdInsertDriveFile style={{ fontSize: \"2rem\" }} />\r\n <a\r\n href={`/api/files/download/${fileData.id}`}\r\n className=\"pl-2 text-left underline text-primary\"\r\n target=\"_blank\"\r\n >\r\n {fileData.filename}\r\n </a>\r\n </div>\r\n {!disabled && (\r\n <div\r\n onClick={handleRemove}\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: \"15px\" }}\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 {errors[name] && (\r\n <div\r\n className=\"HintText self-stretch text-red-600 text-sm font-normal leading-tight\"\r\n id={name + \":error\"}\r\n >\r\n {errors[name]?.message}\r\n </div>\r\n )}\r\n </div>\r\n );\r\n};\r\n\r\nexport default FileInput;\r\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AA0BA,MAAM,gBAAgB,OAAO;AAE7B,MAAM,YAAsC,CAAC;AAAA,EAC3C;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,SAAS,CAAC;AACZ,MAAM;;AACE,QAAA,CAAC,UAAU,WAAW,IAAI;AAAA,IAC9B,eAAe;AAAA,EAAA;AAEjB,QAAM,CAAC,WAAW,YAAY,IAAI,SAAS,KAAK;AAEhD,QAAM,oBAAoB;AAC1B,YAAU,MAAM;AACd,QAAI,aAAa;AACf,kBAAY,WAAW;AACT,oBAAA,EAAE,QAAQ,EAAE,MAAM,OAAO,YAAY,GAAG,WAAW,EAAA,CAAG;AAAA,IACtE;AAAA,EACC,GAAA,CAAC,aAAa,eAAe,IAAI,CAAC;AAErC,QAAM,SAAS;AAAA,IACb,OAAO,kBAA0B;AAC3B,UAAA,cAAc,SAAS,GAAG;AACtB,cAAA,OAAO,cAAc,CAAC;AAExB,YAAA,KAAK,OAAO,eAAe;AAEX,4BAAA,QAAQ,KAAK,WAAW;AAAA,YACxC,OAAO;AAAA,YACP,SAAS,kCAAkC,iBAAiB,OAAO,KAAK;AAAA,YACxE,SAAS;AAAA,YACT,SAAS;AAAA,YACT,MAAM;AAAA,UAAA,CACP;AACD;AAAA,QACF;AAEM,cAAA,WAAW,IAAI;AACZ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I,KACV;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,WAAU;AAAA,QACV,IAAI,OAAO;AAAA,QAEV,WAAA,YAAO,IAAI,MAAX,mBAAc;AAAA,MAAA;AAAA,IACjB;AAAA,EAEJ,EAAA,CAAA;AAEJ;"}
1
+ {"version":3,"file":"FileInput.js","sources":["../../../lib/components/form/FileInput.tsx"],"sourcesContent":["import React, { useState, useEffect, useCallback } from \"react\";\r\nimport { useDropzone } from \"react-dropzone\";\r\nimport { handleErrors, useFederationContext } from \"../../main\";\r\nimport { MdDeleteOutline, MdInsertDriveFile } from \"react-icons/md\";\r\nimport { AxiosError } from \"axios\";\r\n\r\nexport interface FileData {\r\n id: number;\r\n mimeType: string;\r\n size: number;\r\n filename: string;\r\n createdByEmpId: string;\r\n created: string;\r\n}\r\n\r\ninterface FileInputProps {\r\n name: string;\r\n label?: string;\r\n initialFile?: FileData;\r\n onFileChanged: (e: any) => void;\r\n required?: boolean;\r\n description?: string;\r\n disabled?: boolean;\r\n errors?: { [key: string]: { message: string } };\r\n attachmentName?: string;\r\n}\r\n\r\nconst MAX_FILE_SIZE = 1024 * 1024; // 1MB\r\n\r\nconst FileInput: React.FC<FileInputProps> = ({\r\n initialFile,\r\n onFileChanged,\r\n label,\r\n name,\r\n required,\r\n description,\r\n disabled,\r\n errors = {},\r\n attachmentName,\r\n}) => {\r\n const [fileData, setFileData] = useState<FileData | null>(\r\n initialFile || null\r\n );\r\n const [isFocused, setIsFocused] = useState(false);\r\n\r\n const federationContext = useFederationContext();\r\n useEffect(() => {\r\n if (initialFile) {\r\n setFileData(initialFile);\r\n onFileChanged({ target: { name, value: initialFile.id.toString() } });\r\n }\r\n }, [initialFile, onFileChanged, name]);\r\n\r\n const onDrop = useCallback(\r\n async (acceptedFiles: File[]) => {\r\n if (acceptedFiles.length > 0) {\r\n const file = acceptedFiles[0];\r\n\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 return;\r\n }\r\n if (attachmentName) {\r\n (file as any).attachmentName = attachmentName;\r\n }\r\n\r\n const formData = new FormData();\r\n formData.append(\"file\", file);\r\n\r\n try {\r\n const response = await federationContext.apiClient.post<FileData>(\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 setFileData(response.data);\r\n onFileChanged({\r\n target: { name, value: response.data.id.toString() },\r\n });\r\n setIsFocused(false);\r\n } catch (error) {\r\n handleErrors(error as AxiosError, federationContext.emitter);\r\n console.error(\"There was an error!\", error);\r\n }\r\n }\r\n },\r\n [\r\n federationContext.apiClient,\r\n federationContext.emitter,\r\n onFileChanged,\r\n name,\r\n ]\r\n );\r\n\r\n const { getRootProps, getInputProps, isDragActive } = useDropzone({\r\n onDrop,\r\n disabled,\r\n multiple: false,\r\n });\r\n\r\n const handleRemove = () => {\r\n setFileData(null);\r\n onFileChanged({ target: { name, value: null } });\r\n };\r\n\r\n return (\r\n <div className=\"w-full min-h-30 flex-col justify-start items-start gap-1.5 inline-flex sharedLibrary\">\r\n <div className=\"self-stretch flex-col justify-start items-start gap-1.5 flex\">\r\n {label && (\r\n <label\r\n className=\"text-slate-700 text-sm leading-tight font-medium\"\r\n htmlFor={name}\r\n >\r\n {label} {required ? \"*\" : \"\"}\r\n </label>\r\n )}\r\n <div\r\n className={\r\n `self-stretch px-3 py-2 rounded-lg justify-start items-center gap-2 inline-flex outline-none border` +\r\n ` ${\r\n isFocused && !errors[name]?.message\r\n ? \"outline-4 outline-indigo-200 outline-offset-0 border-indigo-300\"\r\n : \"\"\r\n }` +\r\n ` ${\r\n isFocused && errors[name]?.message\r\n ? \"outline-4 outline-red-200 outline-offset-0 border-none\"\r\n : \"\"\r\n } ` +\r\n ` ${!isFocused && errors[name]?.message ? \"border-red-200\" : \"\"} ` +\r\n ` ${disabled ? \"bg-gray-100\" : \"bg-transparent\"}`\r\n }\r\n onFocus={() => setIsFocused(true)}\r\n onBlur={() => setIsFocused(false)}\r\n >\r\n <div className=\"flex relative grow shrink basis-0 min-h-5 lg:min-h-[32px] justify-start items-stretch gap-2 max-w-full \">\r\n {!fileData ? (\r\n <div\r\n {...getRootProps()}\r\n className={`w-full p-4 border-dashed border-2 rounded-lg text-center ${\r\n isDragActive\r\n ? \"border-indigo-300 bg-indigo-50\"\r\n : \"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 soubor\"\r\n : \"Klikněte pro nahrání, nebo nahrajte přetažením souboru\"}\r\n </p>\r\n </div>\r\n ) : (\r\n <div className=\"w-full flex items-center justify-between p-2\">\r\n <div className=\" flex\">\r\n <MdInsertDriveFile style={{ fontSize: \"2rem\" }} />\r\n <a\r\n href={`/api/files/download/${fileData.id}`}\r\n className=\"pl-2 text-left underline text-primary\"\r\n target=\"_blank\"\r\n >\r\n {fileData.filename}\r\n </a>\r\n </div>\r\n {!disabled && (\r\n <div\r\n onClick={handleRemove}\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: \"15px\" }}\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 {errors[name] && (\r\n <div\r\n className=\"HintText self-stretch text-red-600 text-sm font-normal leading-tight\"\r\n id={name + \":error\"}\r\n >\r\n {errors[name]?.message}\r\n </div>\r\n )}\r\n </div>\r\n );\r\n};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Name?: string;
18
19
  }
19
20
  declare const FileInputMultiple: React.FC<FileInputMultipleProps>;
20
21
  export default FileInputMultiple;
@@ -35,7 +35,8 @@ const FileInputMultiple = ({
35
35
  description,
36
36
  disabled,
37
37
  errors = {},
38
- initialFilesReadOnly = true
38
+ initialFilesReadOnly = true,
39
+ attachmentName
39
40
  }) => {
40
41
  var _a, _b;
41
42
  const [fileDataList, setFileDataList] = useState(
@@ -74,6 +75,9 @@ const FileInputMultiple = ({
74
75
  });
75
76
  return null;
76
77
  }
78
+ if (attachmentName) {
79
+ file.attachmentName = attachmentName;
80
+ }
77
81
  const formData = new FormData();
78
82
  formData.append("file", file);
79
83
  try {
@@ -1 +1 @@
1
- {"version":3,"file":"FileInputMultiple.js","sources":["../../../lib/components/form/FileInputMultiple.tsx"],"sourcesContent":["import React, { useState, useCallback, useEffect } from \"react\";\r\nimport { useDropzone } from \"react-dropzone\";\r\nimport { MdDeleteOutline, MdInsertDriveFile } from \"react-icons/md\";\r\nimport { IAttachment } from \"../../types\";\r\nimport { handleErrors, useFederationContext } from \"../../main\";\r\nimport { AxiosError } from \"axios\";\r\n\r\ninterface FileInputMultipleProps {\r\n name: string;\r\n label?: string;\r\n initialFiles?: IAttachment[];\r\n onFilesChanged: (e: any) => void;\r\n required?: boolean;\r\n description?: string;\r\n disabled?: boolean;\r\n errors?: { [key: string]: { message: string } };\r\n initialFilesReadOnly?: 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 FileInputMultiple: React.FC<FileInputMultipleProps> = ({\r\n initialFiles,\r\n onFilesChanged,\r\n label,\r\n name,\r\n required,\r\n description,\r\n disabled,\r\n errors = {},\r\n initialFilesReadOnly = true,\r\n}) => {\r\n const [fileDataList, setFileDataList] = useState<IAttachmentReadOnly[]>(\r\n initialFiles\r\n ? [...initialFiles].map((file) => ({\r\n ...file,\r\n readonly: initialFilesReadOnly,\r\n }))\r\n : []\r\n );\r\n const federationContext = useFederationContext();\r\n\r\n useEffect(() => {\r\n console.log(\r\n \"%clibcomponents\\formFileInputMultiple.tsx:40 initialFiles\",\r\n \"color: #007acc;\",\r\n initialFiles\r\n );\r\n if (!initialFiles || initialFiles.length === 0) return;\r\n setFileDataList(\r\n [...initialFiles].map((file) => ({\r\n ...file,\r\n readonly: initialFilesReadOnly,\r\n }))\r\n );\r\n }, [initialFiles, initialFilesReadOnly]);\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\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 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({\r\n target: {\r\n name,\r\n value: updatedFileDataList.map((file) => file.id.toString()),\r\n },\r\n });\r\n },\r\n [federationContext, fileDataList, onFilesChanged, name]\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({\r\n target: {\r\n name,\r\n value: updatedFileDataList.map((file) => file.id.toString()),\r\n },\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 className=\"w-full min-h-30 flex-col justify-start items-start gap-1.5 inline-flex sharedLibrary\">\r\n <div className=\"self-stretch flex-col justify-start items-start gap-1.5 flex\">\r\n {label && (\r\n <label\r\n className=\"text-slate-700 text-sm leading-tight font-medium\"\r\n htmlFor={name}\r\n >\r\n {label} {required ? \"*\" : \"\"}\r\n </label>\r\n )}\r\n <div\r\n className={\r\n `self-stretch px-3 py-2 rounded-lg justify-start items-center gap-2 outline-none border bg-transparent ` +\r\n ` ${errors[name]?.message ? \"border-red-200\" : \"border-gray-300\"} `\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 {errors[name] && (\r\n <div\r\n className=\"HintText self-stretch text-red-600 text-sm font-normal leading-tight\"\r\n id={name + \":error\"}\r\n >\r\n {errors[name]?.message}\r\n </div>\r\n )}\r\n </div>\r\n );\r\n};\r\n\r\nexport default FileInputMultiple;\r\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAuBA,MAAM,gBAAgB,OAAO;AAE7B,MAAM,oBAAsD,CAAC;AAAA,EAC3D;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,SAAS,CAAC;AAAA,EACV,uBAAuB;AACzB,MAAM;;AACE,QAAA,CAAC,cAAc,eAAe,IAAI;AAAA,IACtC,eACI,CAAC,GAAG,YAAY,EAAE,IAAI,CAAC,UAAU;AAAA,MAC/B,GAAG;AAAA,MACH,UAAU;AAAA,IACZ,EAAE,IACF,CAAC;AAAA,EAAA;AAEP,QAAM,oBAAoB;AAE1B,YAAU,MAAM;AACN,YAAA;AAAA,MACN;AAAA,MACA;AAAA,MACA;AAAA,IAAA;AAEE,QAAA,CAAC,gBAAgB,aAAa,WAAW;AAAG;AAChD;AAAA,MACE,CAAC,GAAG,YAAY,EAAE,IAAI,CAAC,UAAU;AAAA,QAC/B,GAAG;AAAA,QACH,UAAU;AAAA,MAAA,EACV;AAAA,IAAA;AAAA,EACJ,GACC,CAAC,cAAc,oBAAoB,CAAC;AAEvC,QAAM,SAAS;AAAA,IACb,OAAO,kBA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KAAK,EAAE;AAAA,wBACpC,WAAU;AAAA,wBACV,QAAO;AAAA,wBAEN,UAAK,KAAA;AAAA,sBAAA;AAAA,oBACR;AAAA,kBAAA,GACF;AAAA,kBACC,CAAC,YAAY,KAAK,aAAa,QAC9B;AAAA,oBAAC;AAAA,oBAAA;AAAA,sBACC,SAAS,MAAM,aAAa,KAAK,EAAE;AAAA,sBACnC,WAAU;AAAA,sBAEV,UAAA;AAAA,wBAAC;AAAA,wBAAA;AAAA,0BACC,OAAO,EAAE,UAAU,UAAU,QAAQ,OAAO;AAAA,wBAAA;AAAA,sBAC9C;AAAA,oBAAA;AAAA,kBACF;AAAA,gBAAA;AAAA,cAAA;AAAA,cArBG,KAAK;AAAA,YAwBb,CAAA,GACH;AAAA,UAAA;AAAA,QAAA;AAAA,MACF;AAAA,IAAA,GACF;AAAA,IACC,eACC;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,WAAU;AAAA,QACV,IAAI,OAAO;AAAA,QAEV,UAAA;AAAA,MAAA;AAAA,IACH;AAAA,IAED,OAAO,IAAI,KACV;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,WAAU;AAAA,QACV,IAAI,OAAO;AAAA,QAEV,WAAA,YAAO,IAAI,MAAX,mBAAc;AAAA,MAAA;AAAA,IACjB;AAAA,EAEJ,EAAA,CAAA;AAEJ;"}
1
+ {"version":3,"file":"FileInputMultiple.js","sources":["../../../lib/components/form/FileInputMultiple.tsx"],"sourcesContent":["import React, { useState, useCallback, useEffect } from \"react\";\r\nimport { useDropzone } from \"react-dropzone\";\r\nimport { MdDeleteOutline, MdInsertDriveFile } from \"react-icons/md\";\r\nimport { IAttachment } from \"../../types\";\r\nimport { handleErrors, useFederationContext } from \"../../main\";\r\nimport { AxiosError } from \"axios\";\r\n\r\ninterface FileInputMultipleProps {\r\n name: string;\r\n label?: string;\r\n initialFiles?: IAttachment[];\r\n onFilesChanged: (e: any) => void;\r\n required?: boolean;\r\n description?: string;\r\n disabled?: boolean;\r\n errors?: { [key: string]: { message: string } };\r\n initialFilesReadOnly?: boolean;\r\n attachmentName?: 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 FileInputMultiple: React.FC<FileInputMultipleProps> = ({\r\n initialFiles,\r\n onFilesChanged,\r\n label,\r\n name,\r\n required,\r\n description,\r\n disabled,\r\n errors = {},\r\n initialFilesReadOnly = true,\r\n attachmentName,\r\n}) => {\r\n const [fileDataList, setFileDataList] = useState<IAttachmentReadOnly[]>(\r\n initialFiles\r\n ? [...initialFiles].map((file) => ({\r\n ...file,\r\n readonly: initialFilesReadOnly,\r\n }))\r\n : []\r\n );\r\n const federationContext = useFederationContext();\r\n\r\n useEffect(() => {\r\n console.log(\r\n \"%clibcomponents\\formFileInputMultiple.tsx:40 initialFiles\",\r\n \"color: #007acc;\",\r\n initialFiles\r\n );\r\n if (!initialFiles || initialFiles.length === 0) return;\r\n setFileDataList(\r\n [...initialFiles].map((file) => ({\r\n ...file,\r\n readonly: initialFilesReadOnly,\r\n }))\r\n );\r\n }, [initialFiles, initialFilesReadOnly]);\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\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 if (attachmentName) {\r\n (file as any).attachmentName = attachmentName;\r\n }\r\n\r\n const formData = new FormData();\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({\r\n target: {\r\n name,\r\n value: updatedFileDataList.map((file) => file.id.toString()),\r\n },\r\n });\r\n },\r\n [federationContext, fileDataList, onFilesChanged, name]\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({\r\n target: {\r\n name,\r\n value: updatedFileDataList.map((file) => file.id.toString()),\r\n },\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 className=\"w-full min-h-30 flex-col justify-start items-start gap-1.5 inline-flex sharedLibrary\">\r\n <div className=\"self-stretch flex-col justify-start items-start gap-1.5 flex\">\r\n {label && (\r\n <label\r\n className=\"text-slate-700 text-sm leading-tight font-medium\"\r\n htmlFor={name}\r\n >\r\n {label} {required ? \"*\" : \"\"}\r\n </label>\r\n )}\r\n <div\r\n className={\r\n `self-stretch px-3 py-2 rounded-lg justify-start items-center gap-2 outline-none border bg-transparent ` +\r\n ` ${errors[name]?.message ? \"border-red-200\" : \"border-gray-300\"} `\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 {errors[name] && (\r\n <div\r\n className=\"HintText self-stretch text-red-600 text-sm font-normal leading-tight\"\r\n id={name + \":error\"}\r\n >\r\n {errors[name]?.message}\r\n </div>\r\n )}\r\n </div>\r\n );\r\n};\r\n\r\nexport default FileInputMultiple;\r\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAwBA,MAAM,gBAAgB,OAAO;AAE7B,MAAM,oBAAsD,CAAC;AAAA,EAC3D;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,SAAS,CAAC;AAAA,EACV,uBAAuB;AAAA,EACvB;AACF,MAAM;;AACE,QAAA,CAAC,cAAc,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AAA;AAAA,QACC,WAAU;AAAA,QACV,IAAI,OAAO;AAAA,QAEV,WAAA,YAAO,IAAI,MAAX,mBAAc;AAAA,MAAA;AAAA,IACjB;AAAA,EAEJ,EAAA,CAAA;AAEJ;"}
package/dist/types.d.ts CHANGED
@@ -264,6 +264,7 @@ export interface IAttachment {
264
264
  mimeType: string;
265
265
  size: number;
266
266
  filename: string;
267
+ attachmentName?: string;
267
268
  }
268
269
  export interface IStep {
269
270
  date: string;
package/dist/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sources":["../lib/types.ts"],"sourcesContent":["import { AxiosInstance } from \"axios\";\r\nimport { Emitter } from \"mitt\";\r\n\r\n\r\nimport { UseFormReturn } from \"react-hook-form\";\r\n\r\nexport interface IUserInfo {\r\n contractGroup: number;\r\n degreeAfter: string;\r\n degreeBefore: string;\r\n departmentId: string;\r\n departmentName: string;\r\n departmentNameLong: string;\r\n email: string;\r\n employeeId: number;\r\n firstName: string;\r\n lastName: string;\r\n positionName: string;\r\n positionNumber: string;\r\n userId: string;\r\n mobile: string;\r\n phone: string;\r\n contractTitle: string;\r\n managerTitle: string;\r\n manager: string;\r\n functionTitle: string;\r\n officeAddress: string;\r\n\r\n}\r\nexport interface IBuilding {\r\n buildingId: string;\r\n nameFull: string;\r\n\r\n}export interface IBuildingLOV {\r\n buildingId: string;\r\n name: string;\r\n ofsId?: number;\r\n\r\n}\r\nexport interface IEmployee extends IUserInfo {\r\n\r\n deleted: boolean\r\n hasComputer: string\r\n language: string\r\n manager: string\r\n parentFrId: number\r\n positionId: number\r\n validFrom: string\r\n validTo: string\r\n contractType: number\r\n exemption: number\r\n activatedOn: string\r\n building?: IBuilding | null\r\n}\r\n\r\nexport interface IAuthApp {\r\n name: string;\r\n label: string;\r\n roles: string[];\r\n}\r\n\r\nexport type IAuthApps = IAuthApp[];\r\n\r\nexport interface IEventMessage {\r\n title?: string;\r\n message?: string;\r\n timeout?: number;\r\n classes?: string;\r\n type?: \"success\" | \"info\" | \"warning\" | \"error\";\r\n}\r\n\r\nexport type Events = {\r\n message?: IEventMessage;\r\n loading?: boolean;\r\n};\r\n\r\nexport interface IContextValue {\r\n userInfo: IUserInfo;\r\n apiClient: AxiosInstance;\r\n authApps: IAuthApps;\r\n emitter: Emitter<Events>;\r\n isAdminApp?: boolean;\r\n}\r\nexport interface IOptionItem {\r\n value: string | number | null;\r\n label: string;\r\n description?: string;\r\n}\r\n\r\nexport type IFormProps = {\r\n formName: string;\r\n entityId: string;\r\n entityName: string;\r\n context: IContextValue;\r\n onSuccess: (path: string, message?: string) => void;\r\n};\r\nexport type IListProps = {\r\n id?: string;\r\n listName: string;\r\n filters: object; //{ [key: string]: any };\r\n context: IContextValue;\r\n title?: string;\r\n};\r\nexport type IPageProps = {\r\n pageName: string;\r\n context: IContextValue;\r\n};\r\n\r\nexport type IStartProcessProps = {\r\n context: IContextValue;\r\n\r\n onNavigate: (path: string) => void;\r\n};\r\n\r\nexport interface IModuleProcess {\r\n\r\n key: string;\r\n name: string;\r\n description: string;\r\n disabled?: boolean;\r\n\r\n}\r\nexport interface IModulePage {\r\n\r\n pageName: string;\r\n name: string;\r\n description: string;\r\n disabled?: boolean;\r\n roles?: string[];\r\n admin?: boolean;\r\n}\r\nexport interface IModuleSettings {\r\n\r\n key: string;\r\n name: string;\r\n description: string;\r\n disabled?: boolean;\r\n roles?: string[];\r\n admin?: boolean;\r\n\r\n}\r\n\r\nexport interface IModuleConstants {\r\n\r\n key: string\r\n name: string\r\n processes: IModuleProcess[],\r\n reports?: IModulePage[],\r\n pages?: IModulePage[],\r\n\r\n}\r\n\r\n\r\nexport interface IPosition {\r\n id: number;\r\n departmentId: string;\r\n positionName: string;\r\n positionNumber: string;\r\n manager: string;\r\n virtual: boolean;\r\n title: string;\r\n}\r\nexport interface IPositionEmployee extends IPosition {\r\n employee: IEmployee;\r\n}\r\nexport interface IEmployeePosition extends IEmployee {\r\n position: IPosition;\r\n}\r\nexport type { ICalendarItem } from \"./components/Calendar\";\r\n\r\n\r\nexport interface ITimeOffCategoryDto {\r\n id?: number;\r\n name?: string;\r\n}\r\nexport interface ITimeOffData {\r\n id: number;\r\n startDate: string;\r\n endDate: string;\r\n days?: number;\r\n year?: number;\r\n comment?: string;\r\n applicant?: IEmployee;\r\n place?: string;\r\n leaveType?: string;\r\n initiator?: string;\r\n dateFromEvidence?: string;\r\n dateToEvidence?: string;\r\n status?: number;\r\n statusText?: string;\r\n timeOffCategoryDto: ITimeOffCategoryDto;\r\n applicantContractGroup?: number;\r\n name?: string;\r\n daysOfEvidence?: number;\r\n daysInStartMonth?: number;\r\n daysInEndMonth?: number;\r\n lastChange?: string;\r\n created?: string;\r\n updated?: string;\r\n attachment?: IAttachment;\r\n steps?: IStep[];\r\n}\r\n\r\nexport interface IDepartment {\r\n departmentId: string;\r\n nameLong: string;\r\n parentDepartmentId: string;\r\n parentLocationId: number;\r\n nameShort: string;\r\n}\r\n\r\nexport interface IPageable<T> {\r\n content: T[];\r\n empty: boolean;\r\n first: boolean;\r\n last: boolean;\r\n number: number;\r\n numberOfElements: number;\r\n size: number;\r\n totalElements: number;\r\n totalPages: number;\r\n}\r\n\r\n\r\nexport interface IFormFieldGlobalProps {\r\n label?: string;\r\n description?: string;\r\n name: string;\r\n type?: string;\r\n value?: any;\r\n\r\n methods?: UseFormReturn<any>;\r\n\r\n errors?: any;\r\n register?: any;\r\n disabled?: boolean;\r\n required?: boolean;\r\n clearable?: boolean;\r\n placeholder?: string;\r\n children?: React.ReactNode;\r\n className?: string;\r\n rounded?: boolean;\r\n onInputChange: (\r\n e: React.ChangeEvent<\r\n HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement | any\r\n >\r\n ) => void;\r\n\r\n onFocus?: () => void;\r\n onBlur?: () => void;\r\n inline?: boolean,\r\n ref?: any;\r\n}\r\n\r\n\r\nexport interface SysConfigHolidayEntityResponse {\r\n \"id\": number,\r\n \"date\": string,\r\n \"day\": number,\r\n \"month\": number,\r\n \"year\": number,\r\n \"dayOfWeek\": number\r\n}\r\n\r\n\r\nexport interface IProfileApprover {\r\n id: number;\r\n role: number;\r\n roleTxt: string;\r\n approverOrder: number;\r\n approver: IEmployee;\r\n position: IPositionEmployee;\r\n isEmployee: boolean;\r\n ignore: boolean;\r\n makePreapprover: boolean;\r\n}\r\n\r\n\r\nexport enum EApproverRoles {\r\n predschvalovatel = 10,\r\n zastupce = 20,\r\n zastupce9 = 30,\r\n vedouci = 40,\r\n vyssiSchvalovatel = 60,\r\n vyssiSchvalovatelZastupce = 61,\r\n vyssiSchvalovatelZastupce9 = 62,\r\n dochazkovyVedouci = 90,\r\n}\r\nexport enum EApproverTypes {\r\n vyssiSchvalovatel = \"vyssiSchvalovatel\",\r\n vyssiSchvalovatelZastupce = \"vyssiSchvalovatelZastupce\",\r\n vyssiSchvalovatelZastupce9 = \"vyssiSchvalovatelZastupce9\",\r\n vedouci = \"vedouci\",\r\n zastupce9 = \"zastupce9\",\r\n zastupce = \"zastupce\",\r\n predschvalovatel1 = \"predschvalovatel1\",\r\n predschvalovatel2 = \"predschvalovatel2\",\r\n predschvalovatel3 = \"predschvalovatel3\",\r\n dochazkovyVedouci = \"dochazkovyVedouci\",\r\n}\r\n\r\nexport interface IAttachment {\r\n\r\n\r\n id: number;\r\n created: string;\r\n createdByEmp: IEmployee;\r\n updated: string;\r\n updatedByEmp: IEmployee;\r\n mimeType: string;\r\n size: number;\r\n filename: string;\r\n\r\n}\r\n\r\n\r\n\r\nexport interface IStep {\r\n\r\n\r\n date: string;\r\n type: number;\r\n comment: string;\r\n decision: string;\r\n employee: IEmployee;\r\n\r\n}\r\n\r\n\r\nexport enum EDecisionsTranslations {\r\n approved = 'Schváleno',\r\n rejected = 'Zamítnuto',\r\n cancelled = 'Stornováno',\r\n evided = 'Zaevidováno',\r\n}\r\n\r\n\r\nexport interface ProcessDefinitionDto {\r\n /**\r\n * The id of the process definition\r\n *\r\n * @type {string}\r\n * @memberof ProcessDefinitionDto\r\n */\r\n id?: string | null;\r\n\r\n /**\r\n * The key of the process definition, i.e., the id of the BPMN 2.0 XML process definition.\r\n *\r\n * @type {string}\r\n * @memberof ProcessDefinitionDto\r\n */\r\n key?: string | null;\r\n\r\n /**\r\n * The category of the process definition.\r\n *\r\n * @type {string}\r\n * @memberof ProcessDefinitionDto\r\n */\r\n category?: string | null;\r\n\r\n /**\r\n * The description of the process definition.\r\n *\r\n * @type {string}\r\n * @memberof ProcessDefinitionDto\r\n */\r\n description?: string | null;\r\n\r\n /**\r\n * The name of the process definition.\r\n *\r\n * @type {string}\r\n * @memberof ProcessDefinitionDto\r\n */\r\n name?: string | null;\r\n\r\n /**\r\n * The version of the process definition that the engine assigned to it.\r\n *\r\n * @type {number}\r\n * @memberof ProcessDefinitionDto\r\n */\r\n version?: number | null;\r\n\r\n /**\r\n * The file name of the process definition.\r\n *\r\n * @type {string}\r\n * @memberof ProcessDefinitionDto\r\n */\r\n resource?: string | null;\r\n\r\n /**\r\n * The deployment id of the process definition.\r\n *\r\n * @type {string}\r\n * @memberof ProcessDefinitionDto\r\n */\r\n deploymentId?: string | null;\r\n\r\n /**\r\n * The file name of the process definition diagram, if it exists.\r\n *\r\n * @type {string}\r\n * @memberof ProcessDefinitionDto\r\n */\r\n diagram?: string | null;\r\n\r\n /**\r\n * A flag indicating whether the definition is suspended or not.\r\n *\r\n * @type {boolean}\r\n * @memberof ProcessDefinitionDto\r\n */\r\n suspended?: boolean | null;\r\n\r\n /**\r\n * The tenant id of the process definition.\r\n *\r\n * @type {string}\r\n * @memberof ProcessDefinitionDto\r\n */\r\n tenantId?: string | null;\r\n\r\n /**\r\n * The version tag of the process definition.\r\n *\r\n * @type {string}\r\n * @memberof ProcessDefinitionDto\r\n */\r\n versionTag?: string | null;\r\n\r\n /**\r\n * History time to live value of the process definition. Is used within [History cleanup](https://docs.camunda.org/manual/7.20/user-guide/process-engine/history/#history-cleanup).\r\n *\r\n * @type {number}\r\n * @memberof ProcessDefinitionDto\r\n */\r\n historyTimeToLive?: number | null;\r\n\r\n /**\r\n * A flag indicating whether the process definition is startable in Tasklist or not.\r\n *\r\n * @type {boolean}\r\n * @memberof ProcessDefinitionDto\r\n */\r\n startableInTasklist?: boolean | null;\r\n}\r\n\r\nexport interface VariableValueDto {\r\n /**\r\n * @type {AnyValue}\r\n * @memberof VariableValueDto\r\n */\r\n value?: unknown;\r\n\r\n /**\r\n * The value type of the variable.\r\n *\r\n * @type {string}\r\n * @memberof VariableValueDto\r\n */\r\n type?: string | null;\r\n\r\n /**\r\n * A JSON object containing additional, value-type-dependent properties. For serialized variables of type Object, the following properties can be provided: * `objectTypeName`: A string representation of the object's type name. * `serializationDataFormat`: The serialization format used to store the variable. For serialized variables of type File, the following properties can be provided: * `filename`: The name of the file. This is not the variable name but the name that will be used when downloading the file again. * `mimetype`: The MIME type of the file that is being uploaded. * `encoding`: The encoding of the file that is being uploaded. The following property can be provided for all value types: * `transient`: Indicates whether the variable should be transient or not. See [documentation](https://docs.camunda.org/manual/7.20/user-guide/process-engine/variables#transient-variables) for more informations. (Not applicable for `decision-definition`, ` /process-instance/variables-async`, and `/migration/executeAsync` endpoints)\r\n *\r\n * @type {{ [key: string]: any; }}\r\n * @memberof VariableValueDto\r\n */\r\n valueInfo?: { [key: string]: unknown };\r\n}\r\n\r\n\r\n\r\nexport interface FormValues {\r\n [key: string]: VariableValueDto;\r\n}\r\n\r\n\r\nexport enum Eagendy {\r\n all = \"Všechny\",\r\n timeoff = \"Nepřítomnost\",\r\n vacatransfer = \"Převod dovolené\",\r\n}\r\nexport enum Estavy {\r\n active = \"Ke zpracování\",\r\n done = \"Hotové\",\r\n all = 'Všechny',\r\n}\r\nexport enum Eassignments {\r\n my = \"Moje\",\r\n sub = \"Podřízených\",\r\n all = 'Všechny',\r\n}\r\nexport enum EEntity {\r\n task = \"Úkoly\",\r\n application = \"Žádosti\",\r\n}\r\n\r\n\r\nexport interface IEmployeeWithDepartment extends IEmployee {\r\n department: IDepartment;\r\n}"],"names":["EApproverRoles","EApproverT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AHIA,SAAAA;AAAA,GAAA,UAAA,CAAA,CAAA;AAKA,IAAA,iCAAAC,kBAAL;AACLA,gBAAA,IAAK,IAAA;AACLA,gBAAA,KAAM,IAAA;AACNA,gBAAA,KAAM,IAAA;AAHIA,SAAAA;AAAA,GAAA,gBAAA,CAAA,CAAA;AAKA,IAAA,4BAAAC,aAAL;AACLA,WAAA,MAAO,IAAA;AACPA,WAAA,aAAc,IAAA;AAFJA,SAAAA;AAAA,GAAA,WAAA,CAAA,CAAA;"}
1
+ {"version":3,"file":"types.js","sources":["../lib/types.ts"],"sourcesContent":["import { AxiosInstance } from \"axios\";\r\nimport { Emitter } from \"mitt\";\r\n\r\n\r\nimport { UseFormReturn } from \"react-hook-form\";\r\n\r\nexport interface IUserInfo {\r\n contractGroup: number;\r\n degreeAfter: string;\r\n degreeBefore: string;\r\n departmentId: string;\r\n departmentName: string;\r\n departmentNameLong: string;\r\n email: string;\r\n employeeId: number;\r\n firstName: string;\r\n lastName: string;\r\n positionName: string;\r\n positionNumber: string;\r\n userId: string;\r\n mobile: string;\r\n phone: string;\r\n contractTitle: string;\r\n managerTitle: string;\r\n manager: string;\r\n functionTitle: string;\r\n officeAddress: string;\r\n\r\n}\r\nexport interface IBuilding {\r\n buildingId: string;\r\n nameFull: string;\r\n\r\n}export interface IBuildingLOV {\r\n buildingId: string;\r\n name: string;\r\n ofsId?: number;\r\n\r\n}\r\nexport interface IEmployee extends IUserInfo {\r\n\r\n deleted: boolean\r\n hasComputer: string\r\n language: string\r\n manager: string\r\n parentFrId: number\r\n positionId: number\r\n validFrom: string\r\n validTo: string\r\n contractType: number\r\n exemption: number\r\n activatedOn: string\r\n building?: IBuilding | null\r\n}\r\n\r\nexport interface IAuthApp {\r\n name: string;\r\n label: string;\r\n roles: string[];\r\n}\r\n\r\nexport type IAuthApps = IAuthApp[];\r\n\r\nexport interface IEventMessage {\r\n title?: string;\r\n message?: string;\r\n timeout?: number;\r\n classes?: string;\r\n type?: \"success\" | \"info\" | \"warning\" | \"error\";\r\n}\r\n\r\nexport type Events = {\r\n message?: IEventMessage;\r\n loading?: boolean;\r\n};\r\n\r\nexport interface IContextValue {\r\n userInfo: IUserInfo;\r\n apiClient: AxiosInstance;\r\n authApps: IAuthApps;\r\n emitter: Emitter<Events>;\r\n isAdminApp?: boolean;\r\n}\r\nexport interface IOptionItem {\r\n value: string | number | null;\r\n label: string;\r\n description?: string;\r\n}\r\n\r\nexport type IFormProps = {\r\n formName: string;\r\n entityId: string;\r\n entityName: string;\r\n context: IContextValue;\r\n onSuccess: (path: string, message?: string) => void;\r\n};\r\nexport type IListProps = {\r\n id?: string;\r\n listName: string;\r\n filters: object; //{ [key: string]: any };\r\n context: IContextValue;\r\n title?: string;\r\n};\r\nexport type IPageProps = {\r\n pageName: string;\r\n context: IContextValue;\r\n};\r\n\r\nexport type IStartProcessProps = {\r\n context: IContextValue;\r\n\r\n onNavigate: (path: string) => void;\r\n};\r\n\r\nexport interface IModuleProcess {\r\n\r\n key: string;\r\n name: string;\r\n description: string;\r\n disabled?: boolean;\r\n\r\n}\r\nexport interface IModulePage {\r\n\r\n pageName: string;\r\n name: string;\r\n description: string;\r\n disabled?: boolean;\r\n roles?: string[];\r\n admin?: boolean;\r\n}\r\nexport interface IModuleSettings {\r\n\r\n key: string;\r\n name: string;\r\n description: string;\r\n disabled?: boolean;\r\n roles?: string[];\r\n admin?: boolean;\r\n\r\n}\r\n\r\nexport interface IModuleConstants {\r\n\r\n key: string\r\n name: string\r\n processes: IModuleProcess[],\r\n reports?: IModulePage[],\r\n pages?: IModulePage[],\r\n\r\n}\r\n\r\n\r\nexport interface IPosition {\r\n id: number;\r\n departmentId: string;\r\n positionName: string;\r\n positionNumber: string;\r\n manager: string;\r\n virtual: boolean;\r\n title: string;\r\n}\r\nexport interface IPositionEmployee extends IPosition {\r\n employee: IEmployee;\r\n}\r\nexport interface IEmployeePosition extends IEmployee {\r\n position: IPosition;\r\n}\r\nexport type { ICalendarItem } from \"./components/Calendar\";\r\n\r\n\r\nexport interface ITimeOffCategoryDto {\r\n id?: number;\r\n name?: string;\r\n}\r\nexport interface ITimeOffData {\r\n id: number;\r\n startDate: string;\r\n endDate: string;\r\n days?: number;\r\n year?: number;\r\n comment?: string;\r\n applicant?: IEmployee;\r\n place?: string;\r\n leaveType?: string;\r\n initiator?: string;\r\n dateFromEvidence?: string;\r\n dateToEvidence?: string;\r\n status?: number;\r\n statusText?: string;\r\n timeOffCategoryDto: ITimeOffCategoryDto;\r\n applicantContractGroup?: number;\r\n name?: string;\r\n daysOfEvidence?: number;\r\n daysInStartMonth?: number;\r\n daysInEndMonth?: number;\r\n lastChange?: string;\r\n created?: string;\r\n updated?: string;\r\n attachment?: IAttachment;\r\n steps?: IStep[];\r\n}\r\n\r\nexport interface IDepartment {\r\n departmentId: string;\r\n nameLong: string;\r\n parentDepartmentId: string;\r\n parentLocationId: number;\r\n nameShort: string;\r\n}\r\n\r\nexport interface IPageable<T> {\r\n content: T[];\r\n empty: boolean;\r\n first: boolean;\r\n last: boolean;\r\n number: number;\r\n numberOfElements: number;\r\n size: number;\r\n totalElements: number;\r\n totalPages: number;\r\n}\r\n\r\n\r\nexport interface IFormFieldGlobalProps {\r\n label?: string;\r\n description?: string;\r\n name: string;\r\n type?: string;\r\n value?: any;\r\n\r\n methods?: UseFormReturn<any>;\r\n\r\n errors?: any;\r\n register?: any;\r\n disabled?: boolean;\r\n required?: boolean;\r\n clearable?: boolean;\r\n placeholder?: string;\r\n children?: React.ReactNode;\r\n className?: string;\r\n rounded?: boolean;\r\n onInputChange: (\r\n e: React.ChangeEvent<\r\n HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement | any\r\n >\r\n ) => void;\r\n\r\n onFocus?: () => void;\r\n onBlur?: () => void;\r\n inline?: boolean,\r\n ref?: any;\r\n}\r\n\r\n\r\nexport interface SysConfigHolidayEntityResponse {\r\n \"id\": number,\r\n \"date\": string,\r\n \"day\": number,\r\n \"month\": number,\r\n \"year\": number,\r\n \"dayOfWeek\": number\r\n}\r\n\r\n\r\nexport interface IProfileApprover {\r\n id: number;\r\n role: number;\r\n roleTxt: string;\r\n approverOrder: number;\r\n approver: IEmployee;\r\n position: IPositionEmployee;\r\n isEmployee: boolean;\r\n ignore: boolean;\r\n makePreapprover: boolean;\r\n}\r\n\r\n\r\nexport enum EApproverRoles {\r\n predschvalovatel = 10,\r\n zastupce = 20,\r\n zastupce9 = 30,\r\n vedouci = 40,\r\n vyssiSchvalovatel = 60,\r\n vyssiSchvalovatelZastupce = 61,\r\n vyssiSchvalovatelZastupce9 = 62,\r\n dochazkovyVedouci = 90,\r\n}\r\nexport enum EApproverTypes {\r\n vyssiSchvalovatel = \"vyssiSchvalovatel\",\r\n vyssiSchvalovatelZastupce = \"vyssiSchvalovatelZastupce\",\r\n vyssiSchvalovatelZastupce9 = \"vyssiSchvalovatelZastupce9\",\r\n vedouci = \"vedouci\",\r\n zastupce9 = \"zastupce9\",\r\n zastupce = \"zastupce\",\r\n predschvalovatel1 = \"predschvalovatel1\",\r\n predschvalovatel2 = \"predschvalovatel2\",\r\n predschvalovatel3 = \"predschvalovatel3\",\r\n dochazkovyVedouci = \"dochazkovyVedouci\",\r\n}\r\n\r\nexport interface IAttachment {\r\n\r\n\r\n id: number;\r\n created: string;\r\n createdByEmp: IEmployee;\r\n updated: string;\r\n updatedByEmp: IEmployee;\r\n mimeType: string;\r\n size: number;\r\n filename: string;\r\n attachmentName?: string;\r\n\r\n}\r\n\r\n\r\n\r\nexport interface IStep {\r\n\r\n\r\n date: string;\r\n type: number;\r\n comment: string;\r\n decision: string;\r\n employee: IEmployee;\r\n\r\n}\r\n\r\n\r\nexport enum EDecisionsTranslations {\r\n approved = 'Schváleno',\r\n rejected = 'Zamítnuto',\r\n cancelled = 'Stornováno',\r\n evided = 'Zaevidováno',\r\n}\r\n\r\n\r\nexport interface ProcessDefinitionDto {\r\n /**\r\n * The id of the process definition\r\n *\r\n * @type {string}\r\n * @memberof ProcessDefinitionDto\r\n */\r\n id?: string | null;\r\n\r\n /**\r\n * The key of the process definition, i.e., the id of the BPMN 2.0 XML process definition.\r\n *\r\n * @type {string}\r\n * @memberof ProcessDefinitionDto\r\n */\r\n key?: string | null;\r\n\r\n /**\r\n * The category of the process definition.\r\n *\r\n * @type {string}\r\n * @memberof ProcessDefinitionDto\r\n */\r\n category?: string | null;\r\n\r\n /**\r\n * The description of the process definition.\r\n *\r\n * @type {string}\r\n * @memberof ProcessDefinitionDto\r\n */\r\n description?: string | null;\r\n\r\n /**\r\n * The name of the process definition.\r\n *\r\n * @type {string}\r\n * @memberof ProcessDefinitionDto\r\n */\r\n name?: string | null;\r\n\r\n /**\r\n * The version of the process definition that the engine assigned to it.\r\n *\r\n * @type {number}\r\n * @memberof ProcessDefinitionDto\r\n */\r\n version?: number | null;\r\n\r\n /**\r\n * The file name of the process definition.\r\n *\r\n * @type {string}\r\n * @memberof ProcessDefinitionDto\r\n */\r\n resource?: string | null;\r\n\r\n /**\r\n * The deployment id of the process definition.\r\n *\r\n * @type {string}\r\n * @memberof ProcessDefinitionDto\r\n */\r\n deploymentId?: string | null;\r\n\r\n /**\r\n * The file name of the process definition diagram, if it exists.\r\n *\r\n * @type {string}\r\n * @memberof ProcessDefinitionDto\r\n */\r\n diagram?: string | null;\r\n\r\n /**\r\n * A flag indicating whether the definition is suspended or not.\r\n *\r\n * @type {boolean}\r\n * @memberof ProcessDefinitionDto\r\n */\r\n suspended?: boolean | null;\r\n\r\n /**\r\n * The tenant id of the process definition.\r\n *\r\n * @type {string}\r\n * @memberof ProcessDefinitionDto\r\n */\r\n tenantId?: string | null;\r\n\r\n /**\r\n * The version tag of the process definition.\r\n *\r\n * @type {string}\r\n * @memberof ProcessDefinitionDto\r\n */\r\n versionTag?: string | null;\r\n\r\n /**\r\n * History time to live value of the process definition. Is used within [History cleanup](https://docs.camunda.org/manual/7.20/user-guide/process-engine/history/#history-cleanup).\r\n *\r\n * @type {number}\r\n * @memberof ProcessDefinitionDto\r\n */\r\n historyTimeToLive?: number | null;\r\n\r\n /**\r\n * A flag indicating whether the process definition is startable in Tasklist or not.\r\n *\r\n * @type {boolean}\r\n * @memberof ProcessDefinitionDto\r\n */\r\n startableInTasklist?: boolean | null;\r\n}\r\n\r\nexport interface VariableValueDto {\r\n /**\r\n * @type {AnyValue}\r\n * @memberof VariableValueDto\r\n */\r\n value?: unknown;\r\n\r\n /**\r\n * The value type of the variable.\r\n *\r\n * @type {string}\r\n * @memberof VariableValueDto\r\n */\r\n type?: string | null;\r\n\r\n /**\r\n * A JSON object containing additional, value-type-dependent properties. For serialized variables of type Object, the following properties can be provided: * `objectTypeName`: A string representation of the object's type name. * `serializationDataFormat`: The serialization format used to store the variable. For serialized variables of type File, the following properties can be provided: * `filename`: The name of the file. This is not the variable name but the name that will be used when downloading the file again. * `mimetype`: The MIME type of the file that is being uploaded. * `encoding`: The encoding of the file that is being uploaded. The following property can be provided for all value types: * `transient`: Indicates whether the variable should be transient or not. See [documentation](https://docs.camunda.org/manual/7.20/user-guide/process-engine/variables#transient-variables) for more informations. (Not applicable for `decision-definition`, ` /process-instance/variables-async`, and `/migration/executeAsync` endpoints)\r\n *\r\n * @type {{ [key: string]: any; }}\r\n * @memberof VariableValueDto\r\n */\r\n valueInfo?: { [key: string]: unknown };\r\n}\r\n\r\n\r\n\r\nexport interface FormValues {\r\n [key: string]: VariableValueDto;\r\n}\r\n\r\n\r\nexport enum Eagendy {\r\n all = \"Všechny\",\r\n timeoff = \"Nepřítomnost\",\r\n vacatransfer = \"Převod dovolené\",\r\n}\r\nexport enum Estavy {\r\n active = \"Ke zpracování\",\r\n done = \"Hotové\",\r\n all = 'Všechny',\r\n}\r\nexport enum Eassignments {\r\n my = \"Moje\",\r\n sub = \"Podřízených\",\r\n all = 'Všechny',\r\n}\r\nexport enum EEntity {\r\n task = \"Úkoly\",\r\n application = \"Žádosti\",\r\n}\r\n\r\n\r\nexport interface IEmployeeWithDepartment extends IEmployee {\r\n department: IDepartment;\r\n}"],"names":["EApproverRoles","E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AA;AAHIA,SAAAA;AAAA,GAAA,UAAA,CAAA,CAAA;AAKA,IAAA,iCAAAC,kBAAL;AACLA,gBAAA,IAAK,IAAA;AACLA,gBAAA,KAAM,IAAA;AACNA,gBAAA,KAAM,IAAA;AAHIA,SAAAA;AAAA,GAAA,gBAAA,CAAA,CAAA;AAKA,IAAA,4BAAAC,aAAL;AACLA,WAAA,MAAO,IAAA;AACPA,WAAA,aAAc,IAAA;AAFJA,SAAAA;AAAA,GAAA,WAAA,CAAA,CAAA;"}
@@ -22,6 +22,7 @@ interface FileInputProps {
22
22
  description?: string;
23
23
  disabled?: boolean;
24
24
  errors?: { [key: string]: { message: string } };
25
+ attachmentName?: string;
25
26
  }
26
27
 
27
28
  const MAX_FILE_SIZE = 1024 * 1024; // 1MB
@@ -35,6 +36,7 @@ const FileInput: React.FC<FileInputProps> = ({
35
36
  description,
36
37
  disabled,
37
38
  errors = {},
39
+ attachmentName,
38
40
  }) => {
39
41
  const [fileData, setFileData] = useState<FileData | null>(
40
42
  initialFile || null
@@ -65,6 +67,9 @@ const FileInput: React.FC<FileInputProps> = ({
65
67
  });
66
68
  return;
67
69
  }
70
+ if (attachmentName) {
71
+ (file as any).attachmentName = attachmentName;
72
+ }
68
73
 
69
74
  const formData = new FormData();
70
75
  formData.append("file", file);
@@ -15,6 +15,7 @@ interface FileInputMultipleProps {
15
15
  disabled?: boolean;
16
16
  errors?: { [key: string]: { message: string } };
17
17
  initialFilesReadOnly?: boolean;
18
+ attachmentName?: string;
18
19
  }
19
20
 
20
21
  interface IAttachmentReadOnly extends IAttachment {
@@ -33,6 +34,7 @@ const FileInputMultiple: React.FC<FileInputMultipleProps> = ({
33
34
  disabled,
34
35
  errors = {},
35
36
  initialFilesReadOnly = true,
37
+ attachmentName,
36
38
  }) => {
37
39
  const [fileDataList, setFileDataList] = useState<IAttachmentReadOnly[]>(
38
40
  initialFiles
@@ -77,6 +79,10 @@ const FileInputMultiple: React.FC<FileInputMultipleProps> = ({
77
79
  return null;
78
80
  }
79
81
 
82
+ if (attachmentName) {
83
+ (file as any).attachmentName = attachmentName;
84
+ }
85
+
80
86
  const formData = new FormData();
81
87
  formData.append("file", file);
82
88
 
package/lib/types.ts CHANGED
@@ -310,6 +310,7 @@ export interface IAttachment {
310
310
  mimeType: string;
311
311
  size: number;
312
312
  filename: string;
313
+ attachmentName?: string;
313
314
 
314
315
  }
315
316
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@addsign/moje-agenda-shared-lib",
3
3
  "private": false,
4
- "version": "2.0.54",
4
+ "version": "2.0.56",
5
5
  "type": "module",
6
6
  "main": "dist/main.js",
7
7
  "types": "dist/main.d.ts",