@grafosoft/excel-validator 1.0.4 → 1.0.7

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.
@@ -1,2 +1,2 @@
1
1
  import { ExcelFileProps } from "../types/excelTypes";
2
- export declare const ExcelFile: ({ initData, fileContent, matrix, error, onFileSelected, onReset, validationErrors, onSelectError, hasBalanceDifference, }: ExcelFileProps) => import("react").JSX.Element;
2
+ export declare const ExcelFile: ({ initData, fileContent, matrix, error, onFileSelected, onReset, validationErrors, onSelectError, hasBalanceDifference, onApplyStringEmptyFilter, onDownloadFilteredExcel, isStringEmptyFilterApplied, hasStringEmptyDuplicateErrors, }: ExcelFileProps) => import("react").JSX.Element;
@@ -6,7 +6,7 @@ const react_1 = require("@heroui/react");
6
6
  const react_2 = require("react");
7
7
  const tb_1 = require("react-icons/tb");
8
8
  const ExcelValidator_1 = require("./ExcelValidator");
9
- const ExcelFile = ({ initData, fileContent, matrix, error, onFileSelected, onReset, validationErrors, onSelectError, hasBalanceDifference = false, }) => {
9
+ const ExcelFile = ({ initData, fileContent, matrix, error, onFileSelected, onReset, validationErrors, onSelectError, hasBalanceDifference = false, onApplyStringEmptyFilter, onDownloadFilteredExcel, isStringEmptyFilterApplied, hasStringEmptyDuplicateErrors, }) => {
10
10
  var _a;
11
11
  const [isVisible, setIsVisible] = (0, react_2.useState)(false);
12
12
  const inputRef = (0, react_2.useRef)(null);
@@ -28,7 +28,9 @@ const ExcelFile = ({ initData, fileContent, matrix, error, onFileSelected, onRes
28
28
  }
29
29
  return (bytes / KB).toFixed(2) + " KB";
30
30
  };
31
- return ((0, jsx_runtime_1.jsxs)("section", { className: "h-full bg-content1 p-4 border-r border-default-200", children: [(0, jsx_runtime_1.jsxs)("h2", { className: "text-xl font-semibold text-default-700", children: ["Importa ", initData.title] }), error ? ((0, jsx_runtime_1.jsx)(react_1.Alert, { color: "danger", title: error, className: "mt-3", radius: "sm", hideIconWrapper: true })) : isVisible ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(react_1.Alert, { radius: "sm", hideIconWrapper: true, hideIcon: true, isVisible: isVisible, className: "mt-4", variant: "bordered", onClose: handleReset, children: (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2 text-default-700", children: [(0, jsx_runtime_1.jsx)(tb_1.TbFile, { size: 28 }), " ", (0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col", children: [(0, jsx_runtime_1.jsx)("p", { className: "text-sm", children: fileContent === null || fileContent === void 0 ? void 0 : fileContent.name }), (0, jsx_runtime_1.jsx)("small", { className: "text-default-500", children: bytesFormat((_a = fileContent === null || fileContent === void 0 ? void 0 : fileContent.size) !== null && _a !== void 0 ? _a : 0) })] })] }) }), (0, jsx_runtime_1.jsx)(ExcelValidator_1.ExcelValidator, { initData: initData, fileContent: fileContent, matrix: matrix, validationErrors: validationErrors, onSelectError: onSelectError, hasBalanceDifference: hasBalanceDifference })] })) : ((0, jsx_runtime_1.jsx)("label", { className: "mt-4 flex cursor-pointer items-center justify-center rounded-lg border border-dashed border-default-300 px-4 py-8 text-sm font-medium text-default-600 transition hover:border-primary hover:text-primary", htmlFor: "excel-upload", children: (0, jsx_runtime_1.jsxs)("div", { className: "text-center flex flex-col items-center gap-2", children: [(0, jsx_runtime_1.jsx)(tb_1.TbUpload, { size: 28 }), (0, jsx_runtime_1.jsx)("p", { className: "font-semibold text-lg", children: "Seleccionar plantilla" }), (0, jsx_runtime_1.jsx)("small", { className: "text-default-500", children: "Adjunta un archivo .xlsx o .xls para validar y previsualizar." })] }) })), (0, jsx_runtime_1.jsx)("input", { id: "excel-upload", ref: inputRef, className: "hidden", type: "file", accept: ".xlsx,.xls", onChange: (event) => {
31
+ return ((0, jsx_runtime_1.jsxs)("section", { className: "h-full bg-content1 p-4 border-r border-default-200", children: [(0, jsx_runtime_1.jsxs)("h2", { className: "text-xl font-semibold text-default-700", children: ["Importa ", initData.title] }), error ? ((0, jsx_runtime_1.jsx)(react_1.Alert, { color: "danger", title: error, className: "mt-3", radius: "sm", hideIconWrapper: true })) : isVisible ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(react_1.Alert, { radius: "sm", hideIconWrapper: true, hideIcon: true, isVisible: isVisible, className: "mt-4", variant: "bordered", onClose: handleReset, children: (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2 text-default-700", children: [(0, jsx_runtime_1.jsx)(tb_1.TbFile, { size: 28 }), " ", (0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col", children: [(0, jsx_runtime_1.jsx)("p", { className: "text-sm", children: fileContent === null || fileContent === void 0 ? void 0 : fileContent.name }), (0, jsx_runtime_1.jsx)("small", { className: "text-default-500", children: bytesFormat((_a = fileContent === null || fileContent === void 0 ? void 0 : fileContent.size) !== null && _a !== void 0 ? _a : 0) })] })] }) }), initData.type === "accounts" && ((0, jsx_runtime_1.jsxs)("div", { className: "mt-4 space-y-2 flex md:flex-col gap-5 md:gap-0", children: [(0, jsx_runtime_1.jsx)(react_1.Button, { className: "w-full border-1", color: "warning", variant: "bordered", radius: "sm", startContent: (0, jsx_runtime_1.jsx)(tb_1.TbFilter, { size: 18 }), onPress: onApplyStringEmptyFilter, isDisabled: !hasStringEmptyDuplicateErrors || isStringEmptyFilterApplied, children: isStringEmptyFilterApplied
32
+ ? "Filtro aplicado"
33
+ : "Filtrar cuentas ya registradas" }), (0, jsx_runtime_1.jsx)(react_1.Button, { className: "w-full border-1", color: "success", variant: "bordered", radius: "sm", startContent: (0, jsx_runtime_1.jsx)(tb_1.TbDownload, { size: 18 }), onPress: onDownloadFilteredExcel, isDisabled: !isStringEmptyFilterApplied || !hasStringEmptyDuplicateErrors, children: "Descargar Nuevo Excel" })] })), (0, jsx_runtime_1.jsx)(ExcelValidator_1.ExcelValidator, { initData: initData, fileContent: fileContent, matrix: matrix, validationErrors: validationErrors, onSelectError: onSelectError, hasBalanceDifference: hasBalanceDifference })] })) : ((0, jsx_runtime_1.jsx)("label", { className: "mt-4 flex cursor-pointer items-center justify-center rounded-lg border border-dashed border-default-300 px-4 py-8 text-sm font-medium text-default-600 transition hover:border-primary hover:text-primary", htmlFor: "excel-upload", children: (0, jsx_runtime_1.jsxs)("div", { className: "text-center flex flex-col items-center gap-2", children: [(0, jsx_runtime_1.jsx)(tb_1.TbUpload, { size: 28 }), (0, jsx_runtime_1.jsx)("p", { className: "font-semibold text-lg", children: "Seleccionar plantilla" }), (0, jsx_runtime_1.jsx)("small", { className: "text-default-500", children: "Adjunta un archivo .xlsx o .xls para validar y previsualizar." })] }) })), (0, jsx_runtime_1.jsx)("input", { id: "excel-upload", ref: inputRef, className: "hidden", type: "file", accept: ".xlsx,.xls", onChange: (event) => {
32
34
  void onFileSelected(event);
33
35
  setIsVisible(true);
34
36
  } })] }));
@@ -84,6 +84,7 @@ function ExcelLayout({ initData, jsonValidator, isBalances = false, }) {
84
84
  const [error, setError] = (0, react_1.useState)(null);
85
85
  const [currentPage, setCurrentPage] = (0, react_1.useState)(1);
86
86
  const [focusTarget, setFocusTarget] = (0, react_1.useState)(null);
87
+ const [isStringEmptyFilterApplied, setIsStringEmptyFilterApplied] = (0, react_1.useState)(false);
87
88
  const [fetchCatalogsByUrl, setFetchCatalogsByUrl] = (0, react_1.useState)({});
88
89
  const [stringEmptyCatalogsByUrl, setStringEmptyCatalogsByUrl] = (0, react_1.useState)({});
89
90
  (0, react_1.useEffect)(() => {
@@ -403,6 +404,9 @@ function ExcelLayout({ initData, jsonValidator, isBalances = false, }) {
403
404
  message: alreadyExists
404
405
  ? `El valor '${trimmedValue}' ya existe`
405
406
  : "",
407
+ errorCode: alreadyExists
408
+ ? "string-empty-already-exists"
409
+ : undefined,
406
410
  };
407
411
  }
408
412
  return { valid: true, message: "" };
@@ -418,6 +422,7 @@ function ExcelLayout({ initData, jsonValidator, isBalances = false, }) {
418
422
  message: result.message,
419
423
  value,
420
424
  filteredRowIndex,
425
+ errorCode: result.errorCode,
421
426
  });
422
427
  }
423
428
  });
@@ -429,6 +434,53 @@ function ExcelLayout({ initData, jsonValidator, isBalances = false, }) {
429
434
  fetchCatalogsByUrl,
430
435
  stringEmptyCatalogsByUrl,
431
436
  ]);
437
+ const stringEmptyDuplicateRowIndexes = (0, react_1.useMemo)(() => Array.from(new Set(validationErrors
438
+ .filter((validationError) => validationError.errorCode === "string-empty-already-exists")
439
+ .map((validationError) => validationError.filteredRowIndex))), [validationErrors]);
440
+ const hasStringEmptyDuplicateErrors = stringEmptyDuplicateRowIndexes.length > 0;
441
+ const validationErrorsForPanel = (0, react_1.useMemo)(() => {
442
+ if (!isStringEmptyFilterApplied) {
443
+ return validationErrors;
444
+ }
445
+ const hiddenIndexes = new Set(stringEmptyDuplicateRowIndexes);
446
+ return validationErrors.filter((validationError) => !hiddenIndexes.has(validationError.filteredRowIndex));
447
+ }, [
448
+ isStringEmptyFilterApplied,
449
+ stringEmptyDuplicateRowIndexes,
450
+ validationErrors,
451
+ ]);
452
+ const handleApplyStringEmptyFilter = () => {
453
+ if (!hasStringEmptyDuplicateErrors) {
454
+ return;
455
+ }
456
+ setIsStringEmptyFilterApplied(true);
457
+ setCurrentPage(1);
458
+ setFocusTarget(null);
459
+ };
460
+ const handleDownloadFilteredExcel = () => {
461
+ var _a;
462
+ if (!hasStringEmptyDuplicateErrors) {
463
+ return;
464
+ }
465
+ const headers = (_a = matrix[0]) !== null && _a !== void 0 ? _a : [];
466
+ const dataRows = matrix
467
+ .slice(1)
468
+ .filter((row) => { var _a, _b; return ((_b = (_a = row[0]) === null || _a === void 0 ? void 0 : _a.toString().trim()) !== null && _b !== void 0 ? _b : "") !== ""; });
469
+ const excludedIndexes = new Set(stringEmptyDuplicateRowIndexes);
470
+ const filteredRows = dataRows.filter((_row, rowIndex) => !excludedIndexes.has(rowIndex));
471
+ const workbook = XLSX.utils.book_new();
472
+ const worksheet = XLSX.utils.aoa_to_sheet([headers, ...filteredRows]);
473
+ const totalColumns = Math.max(headers.length, ...filteredRows.map((row) => row.length));
474
+ worksheet["!cols"] = Array.from({ length: totalColumns }, (_, colIndex) => {
475
+ var _a;
476
+ const longestValue = Math.max(String((_a = headers[colIndex]) !== null && _a !== void 0 ? _a : "").length, ...filteredRows.map((row) => { var _a; return String((_a = row[colIndex]) !== null && _a !== void 0 ? _a : "").length; }));
477
+ return {
478
+ wch: Math.min(Math.max(longestValue + 2, 12), 80),
479
+ };
480
+ });
481
+ XLSX.utils.book_append_sheet(workbook, worksheet, "Filtrado");
482
+ XLSX.writeFile(workbook, `${initData.title}-filtrado.xlsx`);
483
+ };
432
484
  const hasBalanceDifference = (0, react_1.useMemo)(() => {
433
485
  var _a;
434
486
  if (!isBalances || matrix.length <= 1) {
@@ -452,6 +504,7 @@ function ExcelLayout({ initData, jsonValidator, isBalances = false, }) {
452
504
  setError(null);
453
505
  setCurrentPage(1);
454
506
  setFocusTarget(null);
507
+ setIsStringEmptyFilterApplied(false);
455
508
  const fileBuffer = await file.arrayBuffer();
456
509
  const workbook = XLSX.read(fileBuffer, { type: "array" });
457
510
  const firstSheetName = workbook.SheetNames[0];
@@ -495,12 +548,34 @@ function ExcelLayout({ initData, jsonValidator, isBalances = false, }) {
495
548
  token: Date.now(),
496
549
  });
497
550
  };
551
+ const mainRef = (0, react_1.useRef)(null);
552
+ const [mainHeight, setMainHeight] = (0, react_1.useState)(null);
553
+ (0, react_1.useEffect)(() => {
554
+ const updateHeight = () => {
555
+ if (!mainRef.current) {
556
+ return;
557
+ }
558
+ const { top } = mainRef.current.getBoundingClientRect();
559
+ setMainHeight(Math.max(280, Math.floor(window.innerHeight - top - 8)));
560
+ };
561
+ updateHeight();
562
+ window.addEventListener("resize", updateHeight);
563
+ const observer = typeof ResizeObserver !== "undefined"
564
+ ? new ResizeObserver(updateHeight)
565
+ : null;
566
+ observer === null || observer === void 0 ? void 0 : observer.observe(document.body);
567
+ return () => {
568
+ window.removeEventListener("resize", updateHeight);
569
+ observer === null || observer === void 0 ? void 0 : observer.disconnect();
570
+ };
571
+ }, []);
498
572
  const handleReset = () => {
499
573
  setFileContent(undefined);
500
574
  setMatrix([]);
501
575
  setError(null);
502
576
  setCurrentPage(1);
503
577
  setFocusTarget(null);
578
+ setIsStringEmptyFilterApplied(false);
504
579
  };
505
- return ((0, jsx_runtime_1.jsxs)("main", { className: "grid min-h-screen grid-cols-1 md:grid-cols-4", children: [(0, jsx_runtime_1.jsx)("div", { className: "space-y-4 md:col-span-1", children: (0, jsx_runtime_1.jsx)(ExcelFile_1.ExcelFile, { initData: initData, fileContent: fileContent, matrix: matrix, error: error, onFileSelected: handleFileSelected, onReset: handleReset, validationErrors: validationErrors, onSelectError: handleSelectError, hasBalanceDifference: hasBalanceDifference }) }), (0, jsx_runtime_1.jsx)("div", { className: "md:col-span-3", children: (0, jsx_runtime_1.jsx)(ExcelPreview_1.ExcelPreview, { initData: initData, fileContent: fileContent, matrix: matrix, error: error, validationErrors: validationErrors, focusTarget: focusTarget, currentPage: currentPage, onPageChange: setCurrentPage, isBalances: isBalances }) })] }));
580
+ return ((0, jsx_runtime_1.jsxs)("main", { ref: mainRef, style: mainHeight ? { height: `${mainHeight}px` } : undefined, className: "grid grid-cols-1 grid-rows-2 md:grid-rows-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 overflow-hidden", children: [(0, jsx_runtime_1.jsx)("div", { className: "space-y-4 col-span-1 order-2 ", children: (0, jsx_runtime_1.jsx)(ExcelFile_1.ExcelFile, { initData: initData, fileContent: fileContent, matrix: matrix, error: error, onFileSelected: handleFileSelected, onReset: handleReset, validationErrors: validationErrorsForPanel, onSelectError: handleSelectError, hasBalanceDifference: hasBalanceDifference, onApplyStringEmptyFilter: handleApplyStringEmptyFilter, onDownloadFilteredExcel: handleDownloadFilteredExcel, isStringEmptyFilterApplied: isStringEmptyFilterApplied, hasStringEmptyDuplicateErrors: hasStringEmptyDuplicateErrors }) }), (0, jsx_runtime_1.jsx)("div", { className: "col-span-1 lg:col-span-2 xl:col-span-3", children: (0, jsx_runtime_1.jsx)(ExcelPreview_1.ExcelPreview, { initData: initData, fileContent: fileContent, matrix: matrix, error: error, validationErrors: validationErrors, focusTarget: focusTarget, currentPage: currentPage, onPageChange: setCurrentPage, isBalances: isBalances, hiddenFilteredRowIndexes: isStringEmptyFilterApplied ? stringEmptyDuplicateRowIndexes : [] }) })] }));
506
581
  }
@@ -1,2 +1,2 @@
1
1
  import { ExcelPreviewProps } from "../types/excelTypes";
2
- export declare const ExcelPreview: ({ initData, fileContent, matrix, error, validationErrors, focusTarget, currentPage, onPageChange, isBalances, }: ExcelPreviewProps) => import("react").JSX.Element;
2
+ export declare const ExcelPreview: ({ initData, fileContent, matrix, error, validationErrors, focusTarget, currentPage, onPageChange, isBalances, hiddenFilteredRowIndexes, }: ExcelPreviewProps) => import("react").JSX.Element;
@@ -7,15 +7,21 @@ const react_2 = require("react");
7
7
  const pi_1 = require("react-icons/pi");
8
8
  const tb_1 = require("react-icons/tb");
9
9
  const BalanceTotals_1 = require("./BalanceTotals");
10
- const ExcelPreview = ({ initData, fileContent, matrix, error, validationErrors, focusTarget, currentPage, onPageChange, isBalances = false, }) => {
10
+ const ExcelPreview = ({ initData, fileContent, matrix, error, validationErrors, focusTarget, currentPage, onPageChange, isBalances = false, hiddenFilteredRowIndexes = [], }) => {
11
11
  var _a;
12
12
  const rowsPerPage = 30;
13
13
  const cellRefs = (0, react_2.useRef)({});
14
14
  const maxColumns = (0, react_2.useMemo)(() => matrix.reduce((max, row) => Math.max(max, row.length), 0), [matrix]);
15
15
  const tableHeaders = (_a = matrix[0]) !== null && _a !== void 0 ? _a : [];
16
- const allDataRows = matrix
16
+ const hiddenRowIndexesSet = (0, react_2.useMemo)(() => new Set(hiddenFilteredRowIndexes), [hiddenFilteredRowIndexes]);
17
+ const allDataRows = (0, react_2.useMemo)(() => matrix
17
18
  .slice(1)
18
- .filter((row) => { var _a, _b; return ((_b = (_a = row[0]) === null || _a === void 0 ? void 0 : _a.toString().trim()) !== null && _b !== void 0 ? _b : "") !== ""; });
19
+ .filter((row) => { var _a, _b; return ((_b = (_a = row[0]) === null || _a === void 0 ? void 0 : _a.toString().trim()) !== null && _b !== void 0 ? _b : "") !== ""; })
20
+ .map((row, originalFilteredRowIndex) => ({
21
+ row,
22
+ originalFilteredRowIndex,
23
+ }))
24
+ .filter(({ originalFilteredRowIndex }) => !hiddenRowIndexesSet.has(originalFilteredRowIndex)), [matrix, hiddenRowIndexesSet]);
19
25
  const totalRecords = allDataRows.length;
20
26
  const totalPages = Math.max(1, Math.ceil(totalRecords / rowsPerPage));
21
27
  const effectivePage = Math.min(currentPage, totalPages);
@@ -51,18 +57,19 @@ const ExcelPreview = ({ initData, fileContent, matrix, error, validationErrors,
51
57
  targetCell.focus();
52
58
  });
53
59
  }, [focusTarget, effectivePage]);
54
- return ((0, jsx_runtime_1.jsxs)("section", { className: "h-full bg-gray-50 dark:bg-content1 border-l border-default-200 px-4 py-2", children: [!fileContent ? ((0, jsx_runtime_1.jsx)(react_1.Alert, { color: "primary", title: `Al importar ${initData.title} verás una previsualización de su contenido.`, className: "my-3", radius: "sm", hideIconWrapper: true, variant: "faded" })) : null, fileContent && matrix.length === 0 && !error ? ((0, jsx_runtime_1.jsx)(react_1.Alert, { color: "danger", title: `No se encontraron datos en el archivo seleccionado.`, className: "my-3", radius: "sm", hideIconWrapper: true, variant: "faded" })) : null, fileContent && matrix.length > 0 ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("div", { className: "mt-4 max-h-[85vh] max-w-full overflow-x-auto overflow-y-auto ", children: (0, jsx_runtime_1.jsxs)("table", { className: "min-w-max w-full text-sm", children: [(0, jsx_runtime_1.jsx)("thead", { className: "sticky top-0 bg-default-100", children: (0, jsx_runtime_1.jsx)("tr", { children: Array.from({ length: maxColumns }).map((_, columnIndex) => ((0, jsx_runtime_1.jsx)("th", { className: "border-x border-t border-default-200 p-3 font-semibold text-default-700", children: tableHeaders[columnIndex] ||
60
+ return ((0, jsx_runtime_1.jsxs)("section", { className: "h-full bg-gray-50 dark:bg-content1 border-l border-default-200 px-4 py-2 flex flex-col overflow-hidden", children: [!fileContent ? ((0, jsx_runtime_1.jsx)(react_1.Alert, { color: "primary", title: `Al importar ${initData.title} verás una previsualización de su contenido.`, className: "my-3 max-h-[70px]", radius: "sm", hideIconWrapper: true, variant: "faded" })) : null, fileContent && matrix.length === 0 && !error ? ((0, jsx_runtime_1.jsx)(react_1.Alert, { color: "danger", title: `No se encontraron datos en el archivo seleccionado.`, className: "my-3", radius: "sm", hideIconWrapper: true, variant: "faded" })) : null, fileContent && matrix.length > 0 ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("div", { className: "mt-4 min-h-0 flex-1 max-w-full overflow-x-auto overflow-y-auto", children: (0, jsx_runtime_1.jsxs)("table", { className: "min-w-max w-full text-sm", children: [(0, jsx_runtime_1.jsx)("thead", { className: "sticky top-0 bg-default-100", children: (0, jsx_runtime_1.jsx)("tr", { children: Array.from({ length: maxColumns }).map((_, columnIndex) => ((0, jsx_runtime_1.jsx)("th", { className: "border-x border-t border-default-200 p-3 font-semibold text-default-700", children: tableHeaders[columnIndex] ||
55
61
  `Columna ${columnIndex + 1}` }, `header-${columnIndex}`))) }) }), (0, jsx_runtime_1.jsx)("tbody", { className: "bg-content1", children: dataRows.map((row, rowIndex) => ((0, jsx_runtime_1.jsx)("tr", { children: Array.from({ length: maxColumns }).map((_, columnIndex) => (() => {
56
62
  var _a, _b;
57
- const absoluteRowIndex = startIndex + rowIndex;
58
- const key = `${absoluteRowIndex}-${columnIndex}`;
63
+ const originalFilteredRowIndex = row.originalFilteredRowIndex;
64
+ const key = `${originalFilteredRowIndex}-${columnIndex}`;
59
65
  const hasError = errorMap.has(key);
60
- const isFocusedTarget = (focusTarget === null || focusTarget === void 0 ? void 0 : focusTarget.filteredRowIndex) === absoluteRowIndex &&
66
+ const isFocusedTarget = (focusTarget === null || focusTarget === void 0 ? void 0 : focusTarget.filteredRowIndex) ===
67
+ originalFilteredRowIndex &&
61
68
  (focusTarget === null || focusTarget === void 0 ? void 0 : focusTarget.columnIndex) === columnIndex;
62
69
  return ((0, jsx_runtime_1.jsx)("td", { ref: (element) => {
63
70
  cellRefs.current[key] = element;
64
71
  }, tabIndex: -1, className: `border border-default-200 p-3 align-top whitespace-nowrap outline-none transition-all duration-200 ease-in-out text-default-700
65
- ${isFocusedTarget ? "ring-[1.7px] ring-danger ring-inset" : ""}`, children: hasError ? ((0, jsx_runtime_1.jsxs)("div", { className: "flex justify-between", children: [(0, jsx_runtime_1.jsx)("p", { children: (_a = row[columnIndex]) !== null && _a !== void 0 ? _a : "" }), (0, jsx_runtime_1.jsx)(tb_1.TbAlertCircle, { color: "red", size: 20 })] })) : ((0, jsx_runtime_1.jsx)("p", { children: (_b = row[columnIndex]) !== null && _b !== void 0 ? _b : "" })) }, `cell-${rowIndex}-${columnIndex}`));
66
- })()) }, `row-${rowIndex}`))) })] }) }), totalRecords > rowsPerPage ? ((0, jsx_runtime_1.jsxs)("div", { className: "mt-4 flex items-center justify-between gap-3", children: [(0, jsx_runtime_1.jsxs)("p", { className: "text-sm text-default-600", children: ["Mostrando ", startIndex + 1, "-", Math.min(endIndex, totalRecords), " de", " ", totalRecords, " registros"] }), (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2", children: [(0, jsx_runtime_1.jsx)(react_1.Button, { size: "sm", className: "text-sm border border-default-300 disabled:border-default-200 disabled:bg-default-100 disabled:text-default-500 dark:border-default-400 dark:text-default-700", variant: "bordered", disabled: effectivePage === 1, onPress: () => onPageChange(Math.max(1, effectivePage - 1)), isIconOnly: true, children: (0, jsx_runtime_1.jsx)(pi_1.PiCaretLeftBold, { size: 16 }) }), (0, jsx_runtime_1.jsxs)("span", { className: "text-sm text-default-700 mx-1", children: ["Pagina ", effectivePage, " de ", totalPages] }), (0, jsx_runtime_1.jsx)(react_1.Button, { size: "sm", className: "text-sm border border-default-300 disabled:border-default-200 disabled:bg-default-100 disabled:text-default-500 dark:border-default-400 dark:text-default-700", variant: "bordered", disabled: effectivePage === totalPages, onPress: () => onPageChange(Math.min(totalPages, effectivePage + 1)), isIconOnly: true, children: (0, jsx_runtime_1.jsx)(pi_1.PiCaretRightBold, { size: 16 }) })] })] })) : null, isBalances ? ((0, jsx_runtime_1.jsx)(BalanceTotals_1.BalanceTotals, { headers: tableHeaders, rows: allDataRows })) : null] })) : null] }));
72
+ ${isFocusedTarget ? "ring-[1.7px] ring-danger ring-inset" : ""}`, children: hasError ? ((0, jsx_runtime_1.jsxs)("div", { className: "flex justify-between", children: [(0, jsx_runtime_1.jsx)("p", { children: (_a = row.row[columnIndex]) !== null && _a !== void 0 ? _a : "" }), (0, jsx_runtime_1.jsx)(tb_1.TbAlertCircle, { color: "red", size: 20 })] })) : ((0, jsx_runtime_1.jsx)("p", { children: (_b = row.row[columnIndex]) !== null && _b !== void 0 ? _b : "" })) }, `cell-${rowIndex}-${columnIndex}`));
73
+ })()) }, `row-${rowIndex}`))) })] }) }), totalRecords > rowsPerPage ? ((0, jsx_runtime_1.jsxs)("div", { className: "mt-4 flex items-center justify-between gap-3", children: [(0, jsx_runtime_1.jsxs)("p", { className: "text-sm text-default-600", children: ["Mostrando ", startIndex + 1, "-", Math.min(endIndex, totalRecords), " de", " ", totalRecords, " registros"] }), (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2", children: [(0, jsx_runtime_1.jsx)(react_1.Button, { size: "sm", className: "text-sm border border-default-300 disabled:border-default-200 disabled:bg-default-100 disabled:text-default-500 dark:border-default-400 dark:text-default-700", variant: "bordered", disabled: effectivePage === 1, onPress: () => onPageChange(Math.max(1, effectivePage - 1)), isIconOnly: true, children: (0, jsx_runtime_1.jsx)(pi_1.PiCaretLeftBold, { size: 16 }) }), (0, jsx_runtime_1.jsxs)("span", { className: "text-sm text-default-700 mx-1", children: ["Pagina ", effectivePage, " de ", totalPages] }), (0, jsx_runtime_1.jsx)(react_1.Button, { size: "sm", className: "text-sm border border-default-300 disabled:border-default-200 disabled:bg-default-100 disabled:text-default-500 dark:border-default-400 dark:text-default-700", variant: "bordered", disabled: effectivePage === totalPages, onPress: () => onPageChange(Math.min(totalPages, effectivePage + 1)), isIconOnly: true, children: (0, jsx_runtime_1.jsx)(pi_1.PiCaretRightBold, { size: 16 }) })] })] })) : null, isBalances ? ((0, jsx_runtime_1.jsx)(BalanceTotals_1.BalanceTotals, { headers: tableHeaders, rows: allDataRows.map((entry) => entry.row) })) : null] })) : null] }));
67
74
  };
68
75
  exports.ExcelPreview = ExcelPreview;
@@ -59,7 +59,7 @@ const ExcelValidator = ({ initData, fileContent, matrix, validationErrors, onSel
59
59
  }, 3000);
60
60
  }
61
61
  };
62
- return ((0, jsx_runtime_1.jsxs)("section", { className: "mt-10 bg-content1 max-h-[calc(100vh-11.5rem)] overflow-y-auto pr-1", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex xl:flex-row lg:flex-col mb-3 justify-between items-center", children: [(0, jsx_runtime_1.jsx)("h2", { className: "text-xl font-semibold text-default-700", children: "Validaciones" }), (0, jsx_runtime_1.jsx)(react_1.Chip, { color: validationErrors.length > 0 ? "danger" : "success", variant: "solid", className: "text-white", startContent: validationErrors.length > 0 ? ((0, jsx_runtime_1.jsx)(tb_1.TbAlertCircle, { size: 20 })) : ((0, jsx_runtime_1.jsx)(tb_1.TbCheck, { size: 20 })), children: (0, jsx_runtime_1.jsxs)("p", { className: "pl-1", children: [validationErrors.length, " ", validationErrors.length === 1
62
+ return ((0, jsx_runtime_1.jsxs)("section", { className: "mt-5 bg-content1 max-h-[calc(100vh-11.5rem)] overflow-y-auto pr-1", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex xl:flex-row lg:flex-col mb-3 justify-between items-center", children: [(0, jsx_runtime_1.jsx)("h2", { className: "text-xl font-semibold text-default-700", children: "Validaciones" }), (0, jsx_runtime_1.jsx)(react_1.Chip, { color: validationErrors.length > 0 ? "danger" : "success", variant: "solid", className: "text-white", startContent: validationErrors.length > 0 ? ((0, jsx_runtime_1.jsx)(tb_1.TbAlertCircle, { size: 20 })) : ((0, jsx_runtime_1.jsx)(tb_1.TbCheck, { size: 20 })), children: (0, jsx_runtime_1.jsxs)("p", { className: "pl-1", children: [validationErrors.length, " ", validationErrors.length === 1
63
63
  ? "error encontrado"
64
64
  : "errores encontrados"] }) })] }), hasBalanceDifference ? ((0, jsx_runtime_1.jsx)(react_1.Alert, { color: "danger", title: "Hay diferencias en los saldos iniciales", variant: "faded", hideIcon: true, startContent: (0, jsx_runtime_1.jsx)(tb_1.TbAlertCircle, { size: 30 }), className: "mb-3" })) : null, validationErrors.length === 0 && !hasBalanceDifference ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(react_1.Alert, { color: "success", title: "Sin errores de validaci\u00F3n.", variant: "faded", hideIcon: true, startContent: (0, jsx_runtime_1.jsx)(tb_1.TbCircleCheck, { size: 30 }) }), (0, jsx_runtime_1.jsx)(react_1.Button, { color: "success", className: "mt-4 w-full", variant: "flat", endContent: (0, jsx_runtime_1.jsx)(tb_1.TbUpload, { size: 20 }), radius: "sm", isLoading: isUploadingTemplate, onPress: handleTXTFormat, children: "Enviar Plantilla" }), uploadMessage ? ((0, jsx_runtime_1.jsx)("p", { className: `mt-2 text-sm ${uploadMessage.type === "success"
65
65
  ? "text-success-600"
@@ -0,0 +1,6 @@
1
+ import { type FC } from "react";
2
+ interface Props {
3
+ showMobileMenu?: () => void;
4
+ }
5
+ export declare const NavbarUser: FC<Props>;
6
+ export {};
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.NavbarUser = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const ri_1 = require("react-icons/ri");
6
+ const tb_1 = require("react-icons/tb");
7
+ const react_1 = require("@heroui/react");
8
+ const fa_1 = require("react-icons/fa");
9
+ const io_1 = require("react-icons/io");
10
+ const navigation_1 = require("next/navigation");
11
+ const ThemeSwitcher_1 = require("../ThemeSwitcher");
12
+ const NavbarUser = ({ showMobileMenu }) => {
13
+ const pathname = (0, navigation_1.usePathname)();
14
+ return ((0, jsx_runtime_1.jsxs)("div", { className: `flex w-full bg-[#04383f] px-4 py-3 justify-between lg:justify-end`, children: [pathname !== "/empresas" && pathname !== "/proveedores" && ((0, jsx_runtime_1.jsx)("button", { className: "lg:hidden", onClick: showMobileMenu, children: (0, jsx_runtime_1.jsxs)("div", { className: "flex", children: [(0, jsx_runtime_1.jsx)(tb_1.TbGridDots, { size: 25, className: "text-white" }), (0, jsx_runtime_1.jsx)("p", { className: "text-white font-semibold pl-2", children: "Menu" })] }) })), (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center", children: [(0, jsx_runtime_1.jsx)(ThemeSwitcher_1.ThemeSwitcher, {}), (0, jsx_runtime_1.jsx)(tb_1.TbBellFilled, { size: 20, className: "cursor-pointer mx-3", style: { color: "white" } }), (0, jsx_runtime_1.jsxs)(react_1.Popover, { placement: "bottom", showArrow: true, children: [(0, jsx_runtime_1.jsx)(react_1.PopoverTrigger, { children: (0, jsx_runtime_1.jsx)("button", { className: "outline-none", children: (0, jsx_runtime_1.jsx)(tb_1.TbHelpSquareRoundedFilled, { size: 20, className: "cursor-pointer mx-3", style: { color: "white" } }) }) }), (0, jsx_runtime_1.jsx)(react_1.PopoverContent, { children: (0, jsx_runtime_1.jsxs)("div", { className: "px-2 py-3", children: [(0, jsx_runtime_1.jsx)(react_1.Link, { isExternal: true, href: "https://api.whatsapp.com/send?phone=573142441243", children: (0, jsx_runtime_1.jsxs)("div", { className: "text-small font-medium flex items-center pb-3 gap-2", children: [(0, jsx_runtime_1.jsx)(io_1.IoLogoWhatsapp, { size: 20, className: "text-[#25d366]" }), " ", "Com\u00FAnicate al WhatsApp"] }) }), (0, jsx_runtime_1.jsx)(react_1.Divider, {}), (0, jsx_runtime_1.jsx)(react_1.Link, { isExternal: true, href: "mailto:contacto@grafosoft.com", children: (0, jsx_runtime_1.jsxs)("div", { className: "text-small font-medium flex items-center py-3 gap-2", children: [(0, jsx_runtime_1.jsx)(tb_1.TbMailFilled, { size: 20, className: "text-[#f31260]" }), " ", "contacto@grafosoft.com"] }) }), (0, jsx_runtime_1.jsx)(react_1.Divider, {}), (0, jsx_runtime_1.jsx)(react_1.Link, { isExternal: true, href: "https://bilidox.com/contacto/", children: (0, jsx_runtime_1.jsxs)("div", { className: "text-small font-medium flex items-center py-3 gap-2", children: [(0, jsx_runtime_1.jsx)(fa_1.FaGlobe, { size: 20, className: "text-[#006FEE]" }), " P\u00E1gina de contacto"] }) }), (0, jsx_runtime_1.jsx)(react_1.Divider, {}), (0, jsx_runtime_1.jsx)(react_1.Link, { isExternal: true, href: "https://grafosoft.atlassian.net/wiki/spaces/GUB", children: (0, jsx_runtime_1.jsxs)("div", { className: "text-small font-medium flex items-center pt-3 gap-2", children: [(0, jsx_runtime_1.jsx)(ri_1.RiBookMarkFill, { size: 20, className: "text-purple-600" }), " Guia BILIDOX"] }) })] }) })] }), (0, jsx_runtime_1.jsx)(tb_1.TbSettingsFilled, { size: 20, className: "cursor-pointer mx-3", style: { color: "white" } }), (0, jsx_runtime_1.jsx)(tb_1.TbLogout, { size: 20, className: "cursor-pointer mx-5", color: "#60941a" })] })] }));
15
+ };
16
+ exports.NavbarUser = NavbarUser;
@@ -0,0 +1,2 @@
1
+ import { FC } from "react";
2
+ export declare const NavigationPage: FC;
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.NavigationPage = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const react_1 = require("@heroui/react");
6
+ const navigation_1 = require("next/navigation");
7
+ const NavigationPage = () => {
8
+ const pathName = (0, navigation_1.usePathname)();
9
+ const router = (0, navigation_1.useRouter)();
10
+ const newArrayPath = pathName.split("/").filter((element) => element !== "");
11
+ const goToBreadcrumb = (index) => {
12
+ const target = `/${newArrayPath.slice(0, index + 1).join("/")}`;
13
+ router.push(target);
14
+ };
15
+ return ((0, jsx_runtime_1.jsx)(react_1.Breadcrumbs, { size: "lg", className: "pt-5 pl-5", children: newArrayPath.map((element, index) => ((0, jsx_runtime_1.jsx)(react_1.BreadcrumbItem, { onPress: () => {
16
+ goToBreadcrumb(index);
17
+ }, className: "capitalize", children: element }, index))) }));
18
+ };
19
+ exports.NavigationPage = NavigationPage;
@@ -0,0 +1,7 @@
1
+ import { type FC, type ReactNode } from "react";
2
+ interface Props {
3
+ children: ReactNode;
4
+ isError?: boolean;
5
+ }
6
+ export declare const DashboardLayout: FC<Props>;
7
+ export {};
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DashboardLayout = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const react_1 = require("react");
6
+ const Sidebar_1 = require("./Sidebar");
7
+ const tb_1 = require("react-icons/tb");
8
+ const navigation_1 = require("next/navigation");
9
+ const Sidebar_2 = require("./Sidebar");
10
+ const NavbarUser_1 = require("../navbar/NavbarUser");
11
+ const DashboardLayout = ({ children, isError = false }) => {
12
+ const pathname = (0, navigation_1.usePathname)();
13
+ const [sideBarMobile, setSideBarMobile] = (0, react_1.useState)(false);
14
+ const companyId = "";
15
+ const [expanded, setExpanded] = (0, react_1.useState)(true);
16
+ return ((0, jsx_runtime_1.jsx)(Sidebar_2.SidebarContext.Provider, { value: expanded, children: (0, jsx_runtime_1.jsxs)("div", { className: "flex", children: [(0, jsx_runtime_1.jsxs)(Sidebar_1.Sidebar, { openMenu: sideBarMobile, setOpenMenu: setSideBarMobile, companyId: companyId, expanded: expanded, setExpanded: setExpanded, children: [(0, jsx_runtime_1.jsx)(Sidebar_1.SidebarItem, { icon: (0, jsx_runtime_1.jsx)(tb_1.TbBuilding, { size: 25 }), text: "Ver Empresa", urlPath: `/empresa/${companyId}`, active: pathname.includes("/empresa") }), (0, jsx_runtime_1.jsx)(Sidebar_1.SidebarItem, { icon: (0, jsx_runtime_1.jsx)(tb_1.TbFileInvoice, { size: 25 }), text: "Documentos", urlPath: `/documentos`, active: pathname.includes("/documento") }), (0, jsx_runtime_1.jsx)(Sidebar_1.SidebarItem, { icon: (0, jsx_runtime_1.jsx)(tb_1.TbLayoutCollage, { size: 25 }), text: "Certificados", urlPath: `/certificados`, active: pathname.includes("/certificado") }), (0, jsx_runtime_1.jsx)(Sidebar_1.SidebarItem, { icon: (0, jsx_runtime_1.jsx)(tb_1.TbInbox, { size: 25 }), text: "Softwares", urlPath: `/softwares`, active: pathname.includes("/software") }), (0, jsx_runtime_1.jsx)(Sidebar_1.SidebarItem, { icon: (0, jsx_runtime_1.jsx)(tb_1.TbFileDigit, { size: 25 }), text: "Numeraciones", urlPath: `/numeraciones`, active: pathname.includes("/numeracion") }), (0, jsx_runtime_1.jsx)(Sidebar_1.SidebarItem, { icon: (0, jsx_runtime_1.jsx)(tb_1.TbSourceCode, { size: 25 }), text: "M\u00F3dulos", urlPath: `/modulos`, active: pathname.includes("/modulos") ||
17
+ pathname.includes("/facturas-excel") }), (0, jsx_runtime_1.jsx)(Sidebar_1.SidebarItem, { icon: (0, jsx_runtime_1.jsx)(tb_1.TbCalendarDollar, { size: 25 }), text: "Ordenes de Compra", urlPath: `/ordenes`, active: pathname.includes("/orden") }), (0, jsx_runtime_1.jsx)(Sidebar_1.SidebarItem, { icon: (0, jsx_runtime_1.jsx)(tb_1.TbUsers, { size: 25 }), text: "Usuarios", urlPath: `/usuarios`, active: pathname.includes("/usuario") })] }), (0, jsx_runtime_1.jsxs)("div", { className: "w-full", children: [(0, jsx_runtime_1.jsx)(NavbarUser_1.NavbarUser, { showMobileMenu: () => {
18
+ setSideBarMobile((prev) => !prev);
19
+ } }), isError ? ((0, jsx_runtime_1.jsx)("div", { children: children })) : ((0, jsx_runtime_1.jsx)("div", { className: `transition-all duration-300 ease-in-out ${expanded ? "lg:ml-[250px]" : "lg:pl-[68px]"}`, children: children }))] })] }) }));
20
+ };
21
+ exports.DashboardLayout = DashboardLayout;
@@ -0,0 +1,21 @@
1
+ import { type FC, type ReactNode } from "react";
2
+ export declare const SidebarContext: import("react").Context<boolean>;
3
+ interface Props {
4
+ children: ReactNode;
5
+ openMenu: boolean;
6
+ setOpenMenu: (openMenu: boolean) => void;
7
+ companyId: string;
8
+ expanded: boolean;
9
+ setExpanded: React.Dispatch<React.SetStateAction<boolean>>;
10
+ }
11
+ export declare const Sidebar: FC<Props>;
12
+ interface SidebarItemProps {
13
+ icon: ReactNode;
14
+ text: string;
15
+ active?: boolean;
16
+ dropdown?: boolean;
17
+ sidebarList?: React.JSX.Element[];
18
+ urlPath?: string;
19
+ }
20
+ export declare const SidebarItem: FC<SidebarItemProps>;
21
+ export {};
@@ -0,0 +1,68 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SidebarItem = exports.Sidebar = exports.SidebarContext = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const react_1 = require("@heroui/react");
6
+ const react_2 = require("react");
7
+ const tb_1 = require("react-icons/tb");
8
+ const cg_1 = require("react-icons/cg");
9
+ const fa_1 = require("react-icons/fa");
10
+ const navigation_1 = require("next/navigation");
11
+ exports.SidebarContext = (0, react_2.createContext)(false);
12
+ const Sidebar = ({ children, openMenu, setOpenMenu, expanded, setExpanded, }) => {
13
+ var _a, _b;
14
+ const [companyInfo] = (0, react_2.useState)({
15
+ imageUrl: "",
16
+ name: "",
17
+ email: "",
18
+ });
19
+ const ref = (0, react_2.useRef)(null);
20
+ (0, react_2.useEffect)(() => {
21
+ function handleClickOutside(e) {
22
+ if (ref.current && !ref.current.contains(e.target)) {
23
+ setOpenMenu(false);
24
+ }
25
+ }
26
+ document.addEventListener("mousedown", handleClickOutside);
27
+ return () => {
28
+ document.removeEventListener("mousedown", handleClickOutside);
29
+ };
30
+ }, [ref, setOpenMenu]);
31
+ return ((0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsx)("aside", { className: `flex flex-col justify-between
32
+ bg-white shadow-2xl lg:shadow-sm lg:h-screen dark:bg-black
33
+ lg:dark:bg-black top-0 fixed h-full transition-transform
34
+ .3s ease-in-out lg:-translate-x-0 ${!openMenu ? "-translate-x-full" : ""}`, style: { maxWidth: "250px", zIndex: "50" }, ref: ref, children: (0, jsx_runtime_1.jsxs)("nav", { className: "h-full flex flex-col dark:border-none", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex p-4 pb-2 justify-between items-center", children: [expanded ? (0, jsx_runtime_1.jsx)(fa_1.FaDownload, { size: 50 }) : (0, jsx_runtime_1.jsx)("div", {}), (0, jsx_runtime_1.jsx)("button", { onClick: () => {
35
+ setExpanded((curr) => !curr);
36
+ }, className: "p-1.5 rounded-lg bg-gray-50 dark:bg-transparent bg-green-50 text-green-800", children: expanded ? ((0, jsx_runtime_1.jsx)(cg_1.CgPushChevronLeft, { size: 20 })) : ((0, jsx_runtime_1.jsx)(cg_1.CgPushChevronRight, { size: 20 })) })] }), (0, jsx_runtime_1.jsx)("ul", { className: "flex-1 px-3", children: children }), (0, jsx_runtime_1.jsxs)("div", { className: "cursos-pointer border-t dark:border-none flex p-3", children: [(0, jsx_runtime_1.jsx)(react_1.Avatar, { showFallback: true, fallback: (0, jsx_runtime_1.jsx)(tb_1.TbBuilding, { size: 25 }), size: "md", radius: "sm", src: companyInfo.imageUrl, classNames: {
37
+ base: companyInfo.imageUrl ? "bg-transparent" : "",
38
+ } }), (0, jsx_runtime_1.jsx)("div", { className: `
39
+ flex justify-between items-center
40
+ overflow-hidden transition-all ${expanded ? "w-52 ml-3" : "w-0"}
41
+ `, children: (0, jsx_runtime_1.jsxs)("div", { className: "leading-4", children: [(0, jsx_runtime_1.jsx)("h4", { className: "font-medium", children: (_a = companyInfo.name) !== null && _a !== void 0 ? _a : "Empresa" }), (0, jsx_runtime_1.jsx)("span", { className: "text-xs text-gray-400", children: (_b = companyInfo.email) !== null && _b !== void 0 ? _b : "correo@empresa.com" })] }) })] })] }) }) }));
42
+ };
43
+ exports.Sidebar = Sidebar;
44
+ const SidebarItem = ({ icon, text, active, dropdown, sidebarList, urlPath = "/", }) => {
45
+ const expanded = (0, react_2.useContext)(exports.SidebarContext);
46
+ const router = (0, navigation_1.useRouter)();
47
+ const children = ((0, jsx_runtime_1.jsxs)("li", { className: `
48
+ relative flex items-center py-2 px-3 my-1
49
+ font-medium rounded-md cursor-pointer
50
+ transition-colors group
51
+ ${active
52
+ ? "bg-gradient-to-tr from-green-200 to-green-100 text-green-800"
53
+ : "hover:bg-green-50 hover:text-green-800"}
54
+ `, onClick: async () => {
55
+ var _a;
56
+ const urlApikey = urlPath.replace("$apikey", (_a = localStorage.getItem("apikey")) !== null && _a !== void 0 ? _a : "");
57
+ if (!dropdown) {
58
+ router.push(urlApikey);
59
+ }
60
+ }, children: [(0, jsx_runtime_1.jsx)("div", { className: "", children: icon }), (0, jsx_runtime_1.jsx)("span", { className: `font-normal text-md overflow-hidden transition-all ${expanded ? "w-52 ml-3" : "w-0"}`, children: text }), !expanded && ((0, jsx_runtime_1.jsx)("div", { className: `
61
+ absolute left-full rounded-md px-2 py-1 ml-6
62
+ bg-green-100 text-green-800 text-sm
63
+ invisible opacity-20 -translate-x-3 transition-all
64
+ group-hover:visible group-hover:opacity-100 group-hover:translate-x-0
65
+ `, children: text }))] }));
66
+ return dropdown && expanded ? ((0, jsx_runtime_1.jsx)(react_1.Accordion, { className: "px-0", isCompact: true, children: (0, jsx_runtime_1.jsx)(react_1.AccordionItem, { "aria-label": text, isCompact: true, title: text, startContent: icon, className: "py-2 px-3", children: sidebarList }) })) : dropdown && !expanded ? ((0, jsx_runtime_1.jsxs)(react_1.Popover, { placement: "right", showArrow: true, offset: 25, children: [(0, jsx_runtime_1.jsx)(react_1.PopoverTrigger, { children: children }), (0, jsx_runtime_1.jsx)(react_1.PopoverContent, { children: (0, jsx_runtime_1.jsx)("div", { className: "px-1 py-2", children: sidebarList }) })] })) : (children);
67
+ };
68
+ exports.SidebarItem = SidebarItem;
@@ -9,6 +9,7 @@ export type ValidationError = {
9
9
  message: string;
10
10
  value: string;
11
11
  filteredRowIndex: number;
12
+ errorCode?: string;
12
13
  };
13
14
  export type FocusTarget = {
14
15
  filteredRowIndex: number;
@@ -25,6 +26,10 @@ export type ExcelFileProps = {
25
26
  validationErrors: ValidationError[];
26
27
  onSelectError: (error: ValidationError) => void;
27
28
  hasBalanceDifference?: boolean;
29
+ onApplyStringEmptyFilter: () => void;
30
+ onDownloadFilteredExcel: () => void;
31
+ isStringEmptyFilterApplied: boolean;
32
+ hasStringEmptyDuplicateErrors: boolean;
28
33
  };
29
34
  export type ExcelValidatorProps = {
30
35
  initData: SettingsProps;
@@ -44,4 +49,5 @@ export type ExcelPreviewProps = {
44
49
  currentPage: number;
45
50
  onPageChange: (page: number) => void;
46
51
  isBalances?: boolean;
52
+ hiddenFilteredRowIndexes?: number[];
47
53
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@grafosoft/excel-validator",
3
- "version": "1.0.4",
3
+ "version": "1.0.7",
4
4
  "description": "React component to validate Excel files against configurable JSON rules.",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",