componentes-sinco 1.0.19 → 1.0.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +46 -21
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -4
- package/dist/index.d.ts +6 -4
- package/dist/index.js +46 -21
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -23,10 +23,12 @@ interface AdjuntarProps<T> {
|
|
|
23
23
|
fileAccepted?: string;
|
|
24
24
|
onChange?: (archivos: File[]) => void;
|
|
25
25
|
onLoading?: boolean;
|
|
26
|
-
downloadAction?: () => void;
|
|
26
|
+
downloadAction?: (name: string) => void;
|
|
27
|
+
deleteAction?: (name: string) => Promise<void> | void;
|
|
27
28
|
initialFiles?: UploadedFile[];
|
|
28
|
-
}
|
|
29
|
-
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
declare const Attachment: ({ sx, compact, error, maxSize, fileAccepted, onLoading, onChange, downloadAction, deleteAction, initialFiles, }: AdjuntarProps<any>) => React__default.JSX.Element;
|
|
30
32
|
|
|
31
33
|
type ReplyPalette$1 = "primary" | "secondary" | "warning" | "info" | "success" | "error" | any;
|
|
32
34
|
type ReplyTextPalette = "primary" | "secondary" | "disabled";
|
|
@@ -549,4 +551,4 @@ declare const SincoTheme: _mui_material_styles.Theme;
|
|
|
549
551
|
declare let AdproSincoTheme: _mui_material_styles.Theme;
|
|
550
552
|
declare let ADCSincoTheme: _mui_material_styles.Theme;
|
|
551
553
|
|
|
552
|
-
export { ADCSincoTheme,
|
|
554
|
+
export { ADCSincoTheme, AdproSincoTheme, Attachment, Calendar, type CalendarEvent, type CalendarProps, type CalendarView, EmptyState, type EmptyStateProperties, type EmptyStateSize, type EmptyStateStates, FooterAction, type FooterActionsProperties, type ModalProps, type ModalStates, MultiSelect, type MultiSelectProps, PageHeader, type PageheaderProperties, type ReplyPalette$1 as ReplyPalette, type ReplyTextPalette, type ReplyVariants, type RepplyButtonVariants, SCAutocomplete, SCCalendarSwipeable, SCCard, SCDataGrid, SCDataGridInitial, SCDateRange, SCDialog, SCDrawer, SCMenu, SCModal, SCSelect, SCTabs, SCTextArea, type SCTextAreaProps, SCTextField, type SCTextFieldProps, SCTime, SCToastNotification, SincoTheme, type ToastBaseProperties, ToastProgress, type ToastType, capitalize, getButtonColor, getIcon, getIconComponent, getIconMultiSelect, getModalColor, modalStateConfig, useFilteredItems, useMultiSelectHandlers, useProgress };
|
package/dist/index.d.ts
CHANGED
|
@@ -23,10 +23,12 @@ interface AdjuntarProps<T> {
|
|
|
23
23
|
fileAccepted?: string;
|
|
24
24
|
onChange?: (archivos: File[]) => void;
|
|
25
25
|
onLoading?: boolean;
|
|
26
|
-
downloadAction?: () => void;
|
|
26
|
+
downloadAction?: (name: string) => void;
|
|
27
|
+
deleteAction?: (name: string) => Promise<void> | void;
|
|
27
28
|
initialFiles?: UploadedFile[];
|
|
28
|
-
}
|
|
29
|
-
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
declare const Attachment: ({ sx, compact, error, maxSize, fileAccepted, onLoading, onChange, downloadAction, deleteAction, initialFiles, }: AdjuntarProps<any>) => React__default.JSX.Element;
|
|
30
32
|
|
|
31
33
|
type ReplyPalette$1 = "primary" | "secondary" | "warning" | "info" | "success" | "error" | any;
|
|
32
34
|
type ReplyTextPalette = "primary" | "secondary" | "disabled";
|
|
@@ -549,4 +551,4 @@ declare const SincoTheme: _mui_material_styles.Theme;
|
|
|
549
551
|
declare let AdproSincoTheme: _mui_material_styles.Theme;
|
|
550
552
|
declare let ADCSincoTheme: _mui_material_styles.Theme;
|
|
551
553
|
|
|
552
|
-
export { ADCSincoTheme,
|
|
554
|
+
export { ADCSincoTheme, AdproSincoTheme, Attachment, Calendar, type CalendarEvent, type CalendarProps, type CalendarView, EmptyState, type EmptyStateProperties, type EmptyStateSize, type EmptyStateStates, FooterAction, type FooterActionsProperties, type ModalProps, type ModalStates, MultiSelect, type MultiSelectProps, PageHeader, type PageheaderProperties, type ReplyPalette$1 as ReplyPalette, type ReplyTextPalette, type ReplyVariants, type RepplyButtonVariants, SCAutocomplete, SCCalendarSwipeable, SCCard, SCDataGrid, SCDataGridInitial, SCDateRange, SCDialog, SCDrawer, SCMenu, SCModal, SCSelect, SCTabs, SCTextArea, type SCTextAreaProps, SCTextField, type SCTextFieldProps, SCTime, SCToastNotification, SincoTheme, type ToastBaseProperties, ToastProgress, type ToastType, capitalize, getButtonColor, getIcon, getIconComponent, getIconMultiSelect, getModalColor, modalStateConfig, useFilteredItems, useMultiSelectHandlers, useProgress };
|
package/dist/index.js
CHANGED
|
@@ -29,6 +29,26 @@ var __objRest = (source, exclude) => {
|
|
|
29
29
|
}
|
|
30
30
|
return target;
|
|
31
31
|
};
|
|
32
|
+
var __async = (__this, __arguments, generator) => {
|
|
33
|
+
return new Promise((resolve, reject) => {
|
|
34
|
+
var fulfilled = (value) => {
|
|
35
|
+
try {
|
|
36
|
+
step(generator.next(value));
|
|
37
|
+
} catch (e) {
|
|
38
|
+
reject(e);
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
var rejected = (value) => {
|
|
42
|
+
try {
|
|
43
|
+
step(generator.throw(value));
|
|
44
|
+
} catch (e) {
|
|
45
|
+
reject(e);
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
49
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
50
|
+
});
|
|
51
|
+
};
|
|
32
52
|
|
|
33
53
|
// src/Components/Adjuntar/Adjuntar.tsx
|
|
34
54
|
import React4, { useEffect as useEffect4, useRef, useState as useState4 } from "react";
|
|
@@ -385,6 +405,7 @@ var Attachment = ({
|
|
|
385
405
|
onLoading,
|
|
386
406
|
onChange,
|
|
387
407
|
downloadAction,
|
|
408
|
+
deleteAction,
|
|
388
409
|
initialFiles = []
|
|
389
410
|
}) => {
|
|
390
411
|
const [files, setFiles] = useState4([]);
|
|
@@ -395,17 +416,9 @@ var Attachment = ({
|
|
|
395
416
|
const inputRef = useRef(null);
|
|
396
417
|
useEffect4(() => {
|
|
397
418
|
if (initialFiles.length > 0) {
|
|
398
|
-
|
|
399
|
-
var _a, _b;
|
|
400
|
-
return __spreadProps(__spreadValues({}, f), {
|
|
401
|
-
progress: (_a = f.progress) != null ? _a : 100,
|
|
402
|
-
uploadError: (_b = f.uploadError) != null ? _b : false
|
|
403
|
-
});
|
|
404
|
-
});
|
|
405
|
-
setFiles(initials);
|
|
406
|
-
onChange == null ? void 0 : onChange(initials.map((f) => new File([], f.name, { type: f.type })));
|
|
419
|
+
setFiles(initialFiles);
|
|
407
420
|
}
|
|
408
|
-
}, []);
|
|
421
|
+
}, [initialFiles]);
|
|
409
422
|
const handleDrop = (event2) => {
|
|
410
423
|
event2.preventDefault();
|
|
411
424
|
setIsDragFile(false);
|
|
@@ -670,7 +683,7 @@ var Attachment = ({
|
|
|
670
683
|
},
|
|
671
684
|
file.uploadError && file.size / (1024 * 1024) > maxSize ? "Archivo super\xF3 el l\xEDmite \u2022 Carga fallida" : file.uploadError ? "Archivo duplicado o inv\xE1lido \u2022 Carga fallida" : `${(file.size / (1024 * 1024)).toFixed(2)}MB \u2022 ${file.type}`
|
|
672
685
|
))),
|
|
673
|
-
/* @__PURE__ */ React4.createElement(Tooltip, { title: "Descargar" }, /* @__PURE__ */ React4.createElement(IconButton3, { size: "small", onClick: downloadAction }, /* @__PURE__ */ React4.createElement(FileDownload, { fontSize: "small", color: "action" }))),
|
|
686
|
+
/* @__PURE__ */ React4.createElement(Tooltip, { title: "Descargar" }, /* @__PURE__ */ React4.createElement(IconButton3, { size: "small", onClick: () => downloadAction == null ? void 0 : downloadAction(file.name) }, /* @__PURE__ */ React4.createElement(FileDownload, { fontSize: "small", color: "action" }))),
|
|
674
687
|
/* @__PURE__ */ React4.createElement(Tooltip, { title: "Eliminar" }, /* @__PURE__ */ React4.createElement(
|
|
675
688
|
IconButton3,
|
|
676
689
|
{
|
|
@@ -694,18 +707,30 @@ var Attachment = ({
|
|
|
694
707
|
action: [
|
|
695
708
|
{
|
|
696
709
|
text: "Eliminar",
|
|
697
|
-
fn: () => {
|
|
710
|
+
fn: () => __async(void 0, null, function* () {
|
|
698
711
|
if (fileToDelete) {
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
712
|
+
try {
|
|
713
|
+
if (deleteAction) {
|
|
714
|
+
yield deleteAction(fileToDelete.name);
|
|
715
|
+
}
|
|
716
|
+
deleteFiles(fileToDelete.name);
|
|
717
|
+
setToast({
|
|
718
|
+
title: "Archivo eliminado",
|
|
719
|
+
type: "success",
|
|
720
|
+
time: 2
|
|
721
|
+
});
|
|
722
|
+
} catch (error2) {
|
|
723
|
+
setToast({
|
|
724
|
+
title: "Error al eliminar archivo",
|
|
725
|
+
type: "error",
|
|
726
|
+
time: 4
|
|
727
|
+
});
|
|
728
|
+
} finally {
|
|
729
|
+
setFileToDelete(null);
|
|
730
|
+
setOpenModal(false);
|
|
731
|
+
}
|
|
706
732
|
}
|
|
707
|
-
|
|
708
|
-
}
|
|
733
|
+
})
|
|
709
734
|
}
|
|
710
735
|
]
|
|
711
736
|
}
|