@caribeng/ui 22.2.0 → 22.5.0
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/README.md +311 -231
- package/fesm2022/caribeng-ui-accordion.mjs +2 -2
- package/fesm2022/caribeng-ui-account-picker.mjs +533 -0
- package/fesm2022/caribeng-ui-aging.mjs +488 -0
- package/fesm2022/{caribeng-ui-caribe-alert.mjs → caribeng-ui-alert.mjs} +45 -45
- package/fesm2022/caribeng-ui-amount.mjs +249 -0
- package/fesm2022/caribeng-ui-anchor.mjs +2 -2
- package/fesm2022/{caribeng-ui-caribe-animation-lottie.mjs → caribeng-ui-animation-lottie.mjs} +41 -41
- package/fesm2022/caribeng-ui-audit-log.mjs +323 -0
- package/fesm2022/caribeng-ui-avatar.mjs +4 -4
- package/fesm2022/caribeng-ui-badge.mjs +8 -2
- package/fesm2022/caribeng-ui-breadcrumb.mjs +26 -9
- package/fesm2022/{caribeng-ui-caribe-button-group.mjs → caribeng-ui-button-group.mjs} +15 -15
- package/fesm2022/caribeng-ui-button.mjs +2 -2
- package/fesm2022/{caribeng-ui-caribe-card-content.mjs → caribeng-ui-card-content.mjs} +39 -39
- package/fesm2022/{caribeng-ui-caribe-card-move.mjs → caribeng-ui-card-move.mjs} +65 -65
- package/fesm2022/{caribeng-ui-caribe-card-primary.mjs → caribeng-ui-card-primary.mjs} +31 -31
- package/fesm2022/{caribeng-ui-caribe-card-select.mjs → caribeng-ui-card-select.mjs} +67 -67
- package/fesm2022/caribeng-ui-carousel.mjs +2 -2
- package/fesm2022/caribeng-ui-cascadeselect.mjs +45 -9
- package/fesm2022/caribeng-ui-chart.mjs +8 -5
- package/fesm2022/caribeng-ui-chat.mjs +1303 -0
- package/fesm2022/{caribeng-ui-caribe-coachmark.mjs → caribeng-ui-coachmark.mjs} +85 -85
- package/fesm2022/caribeng-ui-code-block.mjs +332 -0
- package/fesm2022/caribeng-ui-colorpicker.mjs +99 -5
- package/fesm2022/caribeng-ui-command-palette.mjs +476 -0
- package/fesm2022/caribeng-ui-comments.mjs +864 -0
- package/fesm2022/caribeng-ui-confirmdialog.mjs +78 -13
- package/fesm2022/caribeng-ui-confirmpopup.mjs +91 -16
- package/fesm2022/caribeng-ui-contextmenu.mjs +8 -4
- package/fesm2022/caribeng-ui-copy-button.mjs +230 -0
- package/fesm2022/caribeng-ui-datagrid.mjs +1635 -0
- package/fesm2022/caribeng-ui-dataview.mjs +6 -3
- package/fesm2022/caribeng-ui-datepicker.mjs +2 -2
- package/fesm2022/caribeng-ui-dock.mjs +52 -12
- package/fesm2022/caribeng-ui-document.mjs +495 -0
- package/fesm2022/{caribeng-ui-caribe-dots-indicator.mjs → caribeng-ui-dots-indicator.mjs} +41 -41
- package/fesm2022/caribeng-ui-drawer.mjs +9 -4
- package/fesm2022/caribeng-ui-dynamic-form.mjs +1581 -0
- package/fesm2022/caribeng-ui-editor.mjs +2324 -1311
- package/fesm2022/{caribeng-ui-caribe-expansion-panel.mjs → caribeng-ui-expansion-panel.mjs} +39 -39
- package/fesm2022/{caribeng-ui-caribe-fab-menu.mjs → caribeng-ui-fab-menu.mjs} +75 -75
- package/fesm2022/caribeng-ui-fieldset.mjs +2 -2
- package/fesm2022/caribeng-ui-file-card.mjs +134 -17
- package/fesm2022/{caribeng-ui-caribe-file-download.mjs → caribeng-ui-file-download.mjs} +63 -63
- package/fesm2022/caribeng-ui-financial-report.mjs +380 -0
- package/fesm2022/{caribeng-ui-caribe-float-menu.mjs → caribeng-ui-float-menu.mjs} +31 -31
- package/fesm2022/caribeng-ui-floatlabel.mjs +2 -2
- package/fesm2022/caribeng-ui-flow.mjs +1508 -0
- package/fesm2022/caribeng-ui-folder-card.mjs +122 -12
- package/fesm2022/{caribeng-ui-caribe-footer.mjs → caribeng-ui-footer.mjs} +19 -19
- package/fesm2022/caribeng-ui-gantt.mjs +1094 -0
- package/fesm2022/{caribeng-ui-caribe-header.mjs → caribeng-ui-header.mjs} +49 -49
- package/fesm2022/{caribeng-ui-caribe-icon-button.mjs → caribeng-ui-icon-button.mjs} +23 -23
- package/fesm2022/caribeng-ui-image-cropper.mjs +671 -0
- package/fesm2022/caribeng-ui-import-wizard.mjs +746 -0
- package/fesm2022/caribeng-ui-infinite-scroll.mjs +226 -0
- package/fesm2022/caribeng-ui-inlinemessage.mjs +2 -2
- package/fesm2022/caribeng-ui-input-number.mjs +22 -6
- package/fesm2022/{caribeng-ui-caribe-input-search.mjs → caribeng-ui-input-search.mjs} +65 -65
- package/fesm2022/{caribeng-ui-caribe-input-token.mjs → caribeng-ui-input-token.mjs} +59 -59
- package/fesm2022/caribeng-ui-inputmask.mjs +8 -2
- package/fesm2022/caribeng-ui-inputotp.mjs +2 -2
- package/fesm2022/caribeng-ui-journal-entry.mjs +340 -0
- package/fesm2022/caribeng-ui-kanban.mjs +4612 -0
- package/fesm2022/caribeng-ui-kbd.mjs +122 -0
- package/fesm2022/caribeng-ui-kpi.mjs +189 -0
- package/fesm2022/{caribeng-ui-caribe-link.mjs → caribeng-ui-link.mjs} +37 -37
- package/fesm2022/caribeng-ui-masonry.mjs +93 -0
- package/fesm2022/caribeng-ui-media-player.mjs +821 -0
- package/fesm2022/caribeng-ui-megamenu.mjs +13 -9
- package/fesm2022/caribeng-ui-mentions.mjs +495 -0
- package/fesm2022/caribeng-ui-menu.mjs +8 -4
- package/fesm2022/caribeng-ui-menubar.mjs +9 -5
- package/fesm2022/caribeng-ui-message.mjs +6 -3
- package/fesm2022/caribeng-ui-notification-center.mjs +636 -0
- package/fesm2022/{caribeng-ui-caribe-off-canvas.mjs → caribeng-ui-off-canvas.mjs} +55 -55
- package/fesm2022/{caribeng-ui-caribe-onboarding.mjs → caribeng-ui-onboarding.mjs} +105 -105
- package/fesm2022/caribeng-ui-orderlist.mjs +2 -2
- package/fesm2022/caribeng-ui-organizationchart.mjs +6 -10
- package/fesm2022/caribeng-ui-panel.mjs +6 -6
- package/fesm2022/caribeng-ui-panelmenu.mjs +9 -6
- package/fesm2022/caribeng-ui-pdfviewer.mjs +1755 -25
- package/fesm2022/caribeng-ui-period-picker.mjs +637 -0
- package/fesm2022/caribeng-ui-phone-input.mjs +688 -0
- package/fesm2022/caribeng-ui-picklist.mjs +2 -2
- package/fesm2022/caribeng-ui-pivot.mjs +419 -0
- package/fesm2022/caribeng-ui-pricing.mjs +263 -69
- package/fesm2022/caribeng-ui-qrcode.mjs +564 -0
- package/fesm2022/caribeng-ui-rating.mjs +14 -17
- package/fesm2022/caribeng-ui-reconciliation.mjs +386 -0
- package/fesm2022/caribeng-ui-ripple.mjs +2 -0
- package/fesm2022/caribeng-ui-scheduler.mjs +1027 -0
- package/fesm2022/caribeng-ui-scrolltop.mjs +3 -1
- package/fesm2022/caribeng-ui-select.mjs +2 -2
- package/fesm2022/{caribeng-ui-caribe-shortcut.mjs → caribeng-ui-shortcut.mjs} +29 -29
- package/fesm2022/caribeng-ui-sidebar.mjs +573 -0
- package/fesm2022/caribeng-ui-signature-pad.mjs +654 -0
- package/fesm2022/{caribeng-ui-caribe-status.mjs → caribeng-ui-status.mjs} +11 -11
- package/fesm2022/{caribeng-ui-caribe-step-indicator.mjs → caribeng-ui-step-indicator.mjs} +53 -53
- package/fesm2022/caribeng-ui-stepper.mjs +12 -5
- package/fesm2022/caribeng-ui-steps.mjs +2 -2
- package/fesm2022/caribeng-ui-table.mjs +333 -19
- package/fesm2022/caribeng-ui-tabmenu.mjs +10 -6
- package/fesm2022/caribeng-ui-tabs.mjs +2 -2
- package/fesm2022/{caribeng-ui-caribe-tag-button.mjs → caribeng-ui-tag-button.mjs} +25 -25
- package/fesm2022/caribeng-ui-tag.mjs +2 -2
- package/fesm2022/caribeng-ui-tieredmenu.mjs +111 -21
- package/fesm2022/{caribeng-ui-caribe-tracker.mjs → caribeng-ui-tracker.mjs} +29 -29
- package/fesm2022/{caribeng-ui-caribe-transaction-status.mjs → caribeng-ui-transaction-status.mjs} +11 -11
- package/fesm2022/caribeng-ui-treeselect.mjs +44 -9
- package/fesm2022/caribeng-ui-treetable.mjs +236 -17
- package/fesm2022/{caribeng-ui-caribe-voucher.mjs → caribeng-ui-voucher.mjs} +45 -45
- package/fesm2022/caribeng-ui-xlsx.mjs +486 -0
- package/fesm2022/caribeng-ui.mjs +1568 -1
- package/package.json +258 -178
- package/schematics/collection.json +5 -0
- package/schematics/migrate-from-primeng/core-icons.json +1 -0
- package/schematics/migrate-from-primeng/icons.js +269 -0
- package/schematics/migrate-from-primeng/index.js +290 -0
- package/schematics/migrate-from-primeng/mappings/button.js +93 -0
- package/schematics/migrate-from-primeng/mappings/card.js +33 -0
- package/schematics/migrate-from-primeng/mappings/checkbox.js +44 -0
- package/schematics/migrate-from-primeng/mappings/confirm.js +221 -0
- package/schematics/migrate-from-primeng/mappings/datepicker.js +121 -0
- package/schematics/migrate-from-primeng/mappings/dialog.js +84 -0
- package/schematics/migrate-from-primeng/mappings/index.js +88 -0
- package/schematics/migrate-from-primeng/mappings/inputnumber.js +62 -0
- package/schematics/migrate-from-primeng/mappings/inputtext.js +60 -0
- package/schematics/migrate-from-primeng/mappings/menu.js +468 -0
- package/schematics/migrate-from-primeng/mappings/multiselect.js +49 -0
- package/schematics/migrate-from-primeng/mappings/radiobutton.js +22 -0
- package/schematics/migrate-from-primeng/mappings/rules.js +206 -0
- package/schematics/migrate-from-primeng/mappings/select.js +97 -0
- package/schematics/migrate-from-primeng/mappings/service-calls.js +100 -0
- package/schematics/migrate-from-primeng/mappings/table.js +613 -0
- package/schematics/migrate-from-primeng/mappings/tabs.js +225 -0
- package/schematics/migrate-from-primeng/mappings/tag.js +29 -0
- package/schematics/migrate-from-primeng/mappings/textarea.js +44 -0
- package/schematics/migrate-from-primeng/mappings/toast.js +173 -0
- package/schematics/migrate-from-primeng/mappings/toggleswitch.js +37 -0
- package/schematics/migrate-from-primeng/mappings/tooltip.js +44 -0
- package/schematics/migrate-from-primeng/mappings/types.js +10 -0
- package/schematics/migrate-from-primeng/report.js +79 -0
- package/schematics/migrate-from-primeng/schema.js +2 -0
- package/schematics/migrate-from-primeng/schema.json +34 -0
- package/schematics/migrate-from-primeng/template.js +387 -0
- package/schematics/migrate-from-primeng/todo.js +5 -0
- package/schematics/migrate-from-primeng/typescript.js +442 -0
- package/schematics/migrate-from-primeng/workspace.js +117 -0
- package/schematics/ng-add/index.js +16 -1
- package/types/caribeng-ui-account-picker.d.ts +142 -0
- package/types/caribeng-ui-aging.d.ts +123 -0
- package/types/{caribeng-ui-caribe-alert.d.ts → caribeng-ui-alert.d.ts} +2 -2
- package/types/caribeng-ui-amount.d.ts +82 -0
- package/types/{caribeng-ui-caribe-animation-lottie.d.ts → caribeng-ui-animation-lottie.d.ts} +2 -2
- package/types/caribeng-ui-audit-log.d.ts +86 -0
- package/types/caribeng-ui-badge.d.ts +3 -1
- package/types/caribeng-ui-breadcrumb.d.ts +9 -1
- package/types/{caribeng-ui-caribe-button-group.d.ts → caribeng-ui-button-group.d.ts} +2 -2
- package/types/{caribeng-ui-caribe-card-content.d.ts → caribeng-ui-card-content.d.ts} +2 -2
- package/types/{caribeng-ui-caribe-card-move.d.ts → caribeng-ui-card-move.d.ts} +1 -1
- package/types/{caribeng-ui-caribe-card-primary.d.ts → caribeng-ui-card-primary.d.ts} +2 -2
- package/types/{caribeng-ui-caribe-card-select.d.ts → caribeng-ui-card-select.d.ts} +2 -2
- package/types/caribeng-ui-cascadeselect.d.ts +6 -0
- package/types/caribeng-ui-chart.d.ts +3 -1
- package/types/caribeng-ui-chat.d.ts +299 -0
- package/types/{caribeng-ui-caribe-coachmark.d.ts → caribeng-ui-coachmark.d.ts} +2 -2
- package/types/caribeng-ui-code-block.d.ts +65 -0
- package/types/caribeng-ui-colorpicker.d.ts +5 -1
- package/types/caribeng-ui-command-palette.d.ts +133 -0
- package/types/caribeng-ui-comments.d.ts +214 -0
- package/types/caribeng-ui-confirmdialog.d.ts +34 -2
- package/types/caribeng-ui-confirmpopup.d.ts +39 -2
- package/types/caribeng-ui-contextmenu.d.ts +7 -0
- package/types/caribeng-ui-copy-button.d.ts +90 -0
- package/types/caribeng-ui-datagrid.d.ts +269 -0
- package/types/caribeng-ui-dataview.d.ts +2 -0
- package/types/caribeng-ui-dock.d.ts +13 -1
- package/types/caribeng-ui-document.d.ts +138 -0
- package/types/{caribeng-ui-caribe-dots-indicator.d.ts → caribeng-ui-dots-indicator.d.ts} +2 -2
- package/types/caribeng-ui-drawer.d.ts +3 -1
- package/types/caribeng-ui-dynamic-form.d.ts +409 -0
- package/types/caribeng-ui-editor.d.ts +110 -12
- package/types/{caribeng-ui-caribe-expansion-panel.d.ts → caribeng-ui-expansion-panel.d.ts} +1 -1
- package/types/{caribeng-ui-caribe-fab-menu.d.ts → caribeng-ui-fab-menu.d.ts} +2 -2
- package/types/caribeng-ui-file-card.d.ts +27 -2
- package/types/{caribeng-ui-caribe-file-download.d.ts → caribeng-ui-file-download.d.ts} +1 -1
- package/types/caribeng-ui-financial-report.d.ts +102 -0
- package/types/{caribeng-ui-caribe-float-menu.d.ts → caribeng-ui-float-menu.d.ts} +2 -2
- package/types/caribeng-ui-flow.d.ts +228 -0
- package/types/caribeng-ui-folder-card.d.ts +27 -5
- package/types/{caribeng-ui-caribe-footer.d.ts → caribeng-ui-footer.d.ts} +2 -2
- package/types/caribeng-ui-gantt.d.ts +244 -0
- package/types/{caribeng-ui-caribe-header.d.ts → caribeng-ui-header.d.ts} +2 -2
- package/types/{caribeng-ui-caribe-icon-button.d.ts → caribeng-ui-icon-button.d.ts} +2 -2
- package/types/{caribeng-ui-caribe-illustration.d.ts → caribeng-ui-illustration.d.ts} +1 -1
- package/types/caribeng-ui-image-cropper.d.ts +169 -0
- package/types/caribeng-ui-import-wizard.d.ts +149 -0
- package/types/caribeng-ui-infinite-scroll.d.ts +75 -0
- package/types/caribeng-ui-input-number.d.ts +1 -1
- package/types/{caribeng-ui-caribe-input-search.d.ts → caribeng-ui-input-search.d.ts} +2 -2
- package/types/{caribeng-ui-caribe-input-token.d.ts → caribeng-ui-input-token.d.ts} +2 -2
- package/types/caribeng-ui-inputmask.d.ts +3 -1
- package/types/caribeng-ui-journal-entry.d.ts +110 -0
- package/types/caribeng-ui-kanban.d.ts +783 -0
- package/types/caribeng-ui-kbd.d.ts +36 -0
- package/types/caribeng-ui-kpi.d.ts +64 -0
- package/types/{caribeng-ui-caribe-link.d.ts → caribeng-ui-link.d.ts} +2 -2
- package/types/{caribeng-ui-caribe-logo.d.ts → caribeng-ui-logo.d.ts} +1 -1
- package/types/caribeng-ui-masonry.d.ts +32 -0
- package/types/caribeng-ui-media-player.d.ts +140 -0
- package/types/caribeng-ui-megamenu.d.ts +11 -0
- package/types/caribeng-ui-mentions.d.ts +127 -0
- package/types/caribeng-ui-menu.d.ts +7 -0
- package/types/caribeng-ui-menubar.d.ts +7 -0
- package/types/caribeng-ui-message.d.ts +2 -0
- package/types/caribeng-ui-notification-center.d.ts +153 -0
- package/types/{caribeng-ui-caribe-off-canvas.d.ts → caribeng-ui-off-canvas.d.ts} +2 -2
- package/types/{caribeng-ui-caribe-onboarding.d.ts → caribeng-ui-onboarding.d.ts} +2 -2
- package/types/caribeng-ui-panelmenu.d.ts +7 -0
- package/types/caribeng-ui-pdfviewer.d.ts +245 -5
- package/types/caribeng-ui-period-picker.d.ts +148 -0
- package/types/caribeng-ui-phone-input.d.ts +168 -0
- package/types/caribeng-ui-pivot.d.ts +116 -0
- package/types/caribeng-ui-pricing.d.ts +41 -4
- package/types/caribeng-ui-qrcode.d.ts +88 -0
- package/types/caribeng-ui-reconciliation.d.ts +109 -0
- package/types/caribeng-ui-scheduler.d.ts +188 -0
- package/types/{caribeng-ui-caribe-shortcut.d.ts → caribeng-ui-shortcut.d.ts} +2 -2
- package/types/caribeng-ui-sidebar.d.ts +167 -0
- package/types/caribeng-ui-signature-pad.d.ts +151 -0
- package/types/{caribeng-ui-caribe-status.d.ts → caribeng-ui-status.d.ts} +2 -2
- package/types/{caribeng-ui-caribe-step-indicator.d.ts → caribeng-ui-step-indicator.d.ts} +2 -2
- package/types/caribeng-ui-stepper.d.ts +2 -0
- package/types/caribeng-ui-table.d.ts +67 -3
- package/types/caribeng-ui-tabmenu.d.ts +7 -0
- package/types/{caribeng-ui-caribe-tag-button.d.ts → caribeng-ui-tag-button.d.ts} +2 -2
- package/types/caribeng-ui-tieredmenu.d.ts +17 -1
- package/types/{caribeng-ui-caribe-tracker.d.ts → caribeng-ui-tracker.d.ts} +2 -2
- package/types/{caribeng-ui-caribe-transaction-status.d.ts → caribeng-ui-transaction-status.d.ts} +2 -2
- package/types/caribeng-ui-treeselect.d.ts +6 -0
- package/types/caribeng-ui-treetable.d.ts +67 -2
- package/types/{caribeng-ui-caribe-voucher.d.ts → caribeng-ui-voucher.d.ts} +2 -2
- package/types/caribeng-ui-xlsx.d.ts +79 -0
- package/types/caribeng-ui.d.ts +985 -2
- package/fesm2022/caribeng-ui-caribe-calendar.mjs +0 -92
- package/fesm2022/caribeng-ui-caribe-circle-loading.mjs +0 -130
- package/fesm2022/caribeng-ui-caribe-data-table.mjs +0 -94
- package/fesm2022/caribeng-ui-caribe-file-select.mjs +0 -88
- package/fesm2022/caribeng-ui-caribe-inline-alert.mjs +0 -100
- package/fesm2022/caribeng-ui-caribe-input-date.mjs +0 -138
- package/fesm2022/caribeng-ui-caribe-input-select.mjs +0 -154
- package/fesm2022/caribeng-ui-caribe-loader.mjs +0 -48
- package/fesm2022/caribeng-ui-caribe-modal.mjs +0 -119
- package/fesm2022/caribeng-ui-caribe-pictogram.mjs +0 -52
- package/fesm2022/caribeng-ui-caribe-pop-over.mjs +0 -104
- package/fesm2022/caribeng-ui-caribe-preloader.mjs +0 -57
- package/fesm2022/caribeng-ui-caribe-progress-bar.mjs +0 -84
- package/fesm2022/caribeng-ui-caribe-stroke.mjs +0 -69
- package/fesm2022/caribeng-ui-caribe-switch.mjs +0 -182
- package/styles/caribeng.css +0 -380
- package/styles/scss/_mixins.scss +0 -46
- package/styles/scss/_overlay.scss +0 -15
- package/styles/scss/_tokens.scss +0 -267
- package/styles/scss/_utilities.scss +0 -73
- package/styles/scss/_variables.scss +0 -33
- package/styles/scss/index.scss +0 -16
- package/types/caribeng-ui-caribe-calendar.d.ts +0 -27
- package/types/caribeng-ui-caribe-circle-loading.d.ts +0 -28
- package/types/caribeng-ui-caribe-data-table.d.ts +0 -26
- package/types/caribeng-ui-caribe-file-select.d.ts +0 -31
- package/types/caribeng-ui-caribe-inline-alert.d.ts +0 -28
- package/types/caribeng-ui-caribe-input-date.d.ts +0 -40
- package/types/caribeng-ui-caribe-input-select.d.ts +0 -47
- package/types/caribeng-ui-caribe-loader.d.ts +0 -22
- package/types/caribeng-ui-caribe-modal.d.ts +0 -21
- package/types/caribeng-ui-caribe-pictogram.d.ts +0 -15
- package/types/caribeng-ui-caribe-pop-over.d.ts +0 -17
- package/types/caribeng-ui-caribe-preloader.d.ts +0 -24
- package/types/caribeng-ui-caribe-progress-bar.d.ts +0 -28
- package/types/caribeng-ui-caribe-stroke.d.ts +0 -17
- package/types/caribeng-ui-caribe-switch.d.ts +0 -55
- /package/fesm2022/{caribeng-ui-caribe-illustration.mjs → caribeng-ui-illustration.mjs} +0 -0
- /package/fesm2022/{caribeng-ui-caribe-logo.mjs → caribeng-ui-logo.mjs} +0 -0
|
@@ -3,7 +3,7 @@ import { input, output, ViewEncapsulation, ChangeDetectionStrategy, Component }
|
|
|
3
3
|
import { injectCbTranslation } from '@caribeng/ui';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
* Voucher
|
|
6
|
+
* Voucher: comprobante de operación con filas clave/valor y
|
|
7
7
|
* una acción para compartir.
|
|
8
8
|
*
|
|
9
9
|
* @example
|
|
@@ -24,53 +24,53 @@ class CbVoucher {
|
|
|
24
24
|
this.copy = output();
|
|
25
25
|
}
|
|
26
26
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: CbVoucher, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
27
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: CbVoucher, isStandalone: true, selector: "cb-voucher", inputs: { title: { classPropertyName: "title", publicName: "title", isSignal: true, isRequired: false, transformFunction: null }, rows: { classPropertyName: "rows", publicName: "rows", isSignal: true, isRequired: false, transformFunction: null }, actionLabel: { classPropertyName: "actionLabel", publicName: "actionLabel", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { copy: "copy" }, ngImport: i0, template: `
|
|
28
|
-
<article class="cb-voucher">
|
|
29
|
-
<header class="cb-voucher__head">
|
|
30
|
-
<span class="cb-voucher__check" aria-hidden="true">✓</span>
|
|
31
|
-
<h2 class="cb-voucher__title">{{ (title() ?? t().receipt) }}</h2>
|
|
32
|
-
</header>
|
|
33
|
-
<div class="cb-voucher__intro"><ng-content /></div>
|
|
34
|
-
<dl class="cb-voucher__list">
|
|
35
|
-
@for (row of rows(); track $index) {
|
|
36
|
-
<div class="cb-voucher__row">
|
|
37
|
-
<dt class="cb-voucher__label">{{ row.label }}</dt>
|
|
38
|
-
<dd class="cb-voucher__value">{{ row.value }}</dd>
|
|
39
|
-
</div>
|
|
40
|
-
}
|
|
41
|
-
</dl>
|
|
42
|
-
<div class="cb-voucher__foot">
|
|
43
|
-
<button type="button" class="cb-voucher__action" (click)="copy.emit()">
|
|
44
|
-
{{ (actionLabel() ?? t().share) }}
|
|
45
|
-
</button>
|
|
46
|
-
</div>
|
|
47
|
-
</article>
|
|
48
|
-
`, isInline: true, styles: [":host{display:block;width:100%;max-width:22rem}.cb-voucher{display:flex;flex-direction:column;gap:var(--cb-space-4, 1rem);box-sizing:border-box;padding:var(--cb-space-5, 1.25rem);font-family:var(--cb-font-sans, inherit);color:var(--cb-color-text-strong, #0f172a);background-color:var(--cb-color-surface-0, #ffffff);border:1px solid var(--cb-color-border, #e2e8f0);border-radius:var(--cb-radius-lg, .75rem);box-shadow:var(--cb-shadow-sm, 0 1px 3px rgba(0, 0, 0, .08))}.cb-voucher__head{display:flex;flex-direction:column;align-items:center;gap:var(--cb-space-2, .5rem);text-align:center}.cb-voucher__check{display:inline-flex;align-items:center;justify-content:center;width:2.75rem;height:2.75rem;font-size:1.4rem;font-weight:var(--cb-font-weight-bold, 700);color:#fff;background-color:var(--cb-color-success-500, #16a34a);border-radius:var(--cb-radius-full, 999px)}.cb-voucher__title{margin:0;font-size:var(--cb-text-lg, 1.05rem);font-weight:var(--cb-font-weight-semibold, 600)}.cb-voucher__intro{font-size:var(--cb-text-sm, .875rem);color:var(--cb-color-text-muted, #64748b);text-align:center}.cb-voucher__intro:empty{display:none}.cb-voucher__list{margin:0;padding:var(--cb-space-3, .75rem) 0;border-top:1px dashed var(--cb-color-border, #e2e8f0);border-bottom:1px dashed var(--cb-color-border, #e2e8f0);display:flex;flex-direction:column;gap:var(--cb-space-3, .6rem)}.cb-voucher__row{display:flex;align-items:baseline;justify-content:space-between;gap:var(--cb-space-3, .75rem)}.cb-voucher__label{font-size:var(--cb-text-sm, .8125rem);color:var(--cb-color-text-muted, #64748b)}.cb-voucher__value{margin:0;font-size:var(--cb-text-sm, .875rem);font-weight:var(--cb-font-weight-medium, 500);text-align:right}.cb-voucher__foot{display:flex;justify-content:center}.cb-voucher__action{width:100%;padding:var(--cb-space-3, .65rem) var(--cb-space-4, 1rem);font:inherit;font-size:var(--cb-text-sm, .875rem);font-weight:var(--cb-font-weight-semibold, 600);color
|
|
27
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: CbVoucher, isStandalone: true, selector: "cb-voucher", inputs: { title: { classPropertyName: "title", publicName: "title", isSignal: true, isRequired: false, transformFunction: null }, rows: { classPropertyName: "rows", publicName: "rows", isSignal: true, isRequired: false, transformFunction: null }, actionLabel: { classPropertyName: "actionLabel", publicName: "actionLabel", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { copy: "copy" }, ngImport: i0, template: `
|
|
28
|
+
<article class="cb-voucher">
|
|
29
|
+
<header class="cb-voucher__head">
|
|
30
|
+
<span class="cb-voucher__check" aria-hidden="true">✓</span>
|
|
31
|
+
<h2 class="cb-voucher__title">{{ (title() ?? t().receipt) }}</h2>
|
|
32
|
+
</header>
|
|
33
|
+
<div class="cb-voucher__intro"><ng-content /></div>
|
|
34
|
+
<dl class="cb-voucher__list">
|
|
35
|
+
@for (row of rows(); track $index) {
|
|
36
|
+
<div class="cb-voucher__row">
|
|
37
|
+
<dt class="cb-voucher__label">{{ row.label }}</dt>
|
|
38
|
+
<dd class="cb-voucher__value">{{ row.value }}</dd>
|
|
39
|
+
</div>
|
|
40
|
+
}
|
|
41
|
+
</dl>
|
|
42
|
+
<div class="cb-voucher__foot">
|
|
43
|
+
<button type="button" class="cb-voucher__action" (click)="copy.emit()">
|
|
44
|
+
{{ (actionLabel() ?? t().share) }}
|
|
45
|
+
</button>
|
|
46
|
+
</div>
|
|
47
|
+
</article>
|
|
48
|
+
`, isInline: true, styles: [":host{display:block;width:100%;max-width:22rem}.cb-voucher{display:flex;flex-direction:column;gap:var(--cb-space-4, 1rem);box-sizing:border-box;padding:var(--cb-space-5, 1.25rem);font-family:var(--cb-font-sans, inherit);color:var(--cb-color-text-strong, #0f172a);background-color:var(--cb-color-surface-0, #ffffff);border:1px solid var(--cb-color-border, #e2e8f0);border-radius:var(--cb-radius-lg, .75rem);box-shadow:var(--cb-shadow-sm, 0 1px 3px rgba(0, 0, 0, .08))}.cb-voucher__head{display:flex;flex-direction:column;align-items:center;gap:var(--cb-space-2, .5rem);text-align:center}.cb-voucher__check{display:inline-flex;align-items:center;justify-content:center;width:2.75rem;height:2.75rem;font-size:1.4rem;font-weight:var(--cb-font-weight-bold, 700);color:#fff;background-color:var(--cb-color-success-500, #16a34a);border-radius:var(--cb-radius-full, 999px)}.cb-voucher__title{margin:0;font-size:var(--cb-text-lg, 1.05rem);font-weight:var(--cb-font-weight-semibold, 600)}.cb-voucher__intro{font-size:var(--cb-text-sm, .875rem);color:var(--cb-color-text-muted, #64748b);text-align:center}.cb-voucher__intro:empty{display:none}.cb-voucher__list{margin:0;padding:var(--cb-space-3, .75rem) 0;border-top:1px dashed var(--cb-color-border, #e2e8f0);border-bottom:1px dashed var(--cb-color-border, #e2e8f0);display:flex;flex-direction:column;gap:var(--cb-space-3, .6rem)}.cb-voucher__row{display:flex;align-items:baseline;justify-content:space-between;gap:var(--cb-space-3, .75rem)}.cb-voucher__label{font-size:var(--cb-text-sm, .8125rem);color:var(--cb-color-text-muted, #64748b)}.cb-voucher__value{margin:0;font-size:var(--cb-text-sm, .875rem);font-weight:var(--cb-font-weight-medium, 500);text-align:right}.cb-voucher__foot{display:flex;justify-content:center}.cb-voucher__action{width:100%;padding:var(--cb-space-3, .65rem) var(--cb-space-4, 1rem);font:inherit;font-size:var(--cb-text-sm, .875rem);font-weight:var(--cb-font-weight-semibold, 600);color:#fff;background-color:var(--cb-color-primary-700, #047857);border:none;border-radius:var(--cb-radius-md, .5rem);cursor:pointer;transition:background-color var(--cb-duration-fast, .12s) var(--cb-ease, ease)}.cb-voucher__action:hover{background-color:var(--cb-color-primary-700, #065f46)}:host-context([data-theme=\"dark\"]) .cb-voucher{color:var(--cb-color-surface-0, #f8fafc);background-color:var(--cb-color-surface-800, #1e293b);border-color:var(--cb-color-surface-600, #475569)}:host-context([data-theme=\"dark\"]) .cb-voucher__list{border-color:var(--cb-color-surface-600, #475569)}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
49
49
|
}
|
|
50
50
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: CbVoucher, decorators: [{
|
|
51
51
|
type: Component,
|
|
52
|
-
args: [{ selector: 'cb-voucher', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.Emulated, template: `
|
|
53
|
-
<article class="cb-voucher">
|
|
54
|
-
<header class="cb-voucher__head">
|
|
55
|
-
<span class="cb-voucher__check" aria-hidden="true">✓</span>
|
|
56
|
-
<h2 class="cb-voucher__title">{{ (title() ?? t().receipt) }}</h2>
|
|
57
|
-
</header>
|
|
58
|
-
<div class="cb-voucher__intro"><ng-content /></div>
|
|
59
|
-
<dl class="cb-voucher__list">
|
|
60
|
-
@for (row of rows(); track $index) {
|
|
61
|
-
<div class="cb-voucher__row">
|
|
62
|
-
<dt class="cb-voucher__label">{{ row.label }}</dt>
|
|
63
|
-
<dd class="cb-voucher__value">{{ row.value }}</dd>
|
|
64
|
-
</div>
|
|
65
|
-
}
|
|
66
|
-
</dl>
|
|
67
|
-
<div class="cb-voucher__foot">
|
|
68
|
-
<button type="button" class="cb-voucher__action" (click)="copy.emit()">
|
|
69
|
-
{{ (actionLabel() ?? t().share) }}
|
|
70
|
-
</button>
|
|
71
|
-
</div>
|
|
72
|
-
</article>
|
|
73
|
-
`, styles: [":host{display:block;width:100%;max-width:22rem}.cb-voucher{display:flex;flex-direction:column;gap:var(--cb-space-4, 1rem);box-sizing:border-box;padding:var(--cb-space-5, 1.25rem);font-family:var(--cb-font-sans, inherit);color:var(--cb-color-text-strong, #0f172a);background-color:var(--cb-color-surface-0, #ffffff);border:1px solid var(--cb-color-border, #e2e8f0);border-radius:var(--cb-radius-lg, .75rem);box-shadow:var(--cb-shadow-sm, 0 1px 3px rgba(0, 0, 0, .08))}.cb-voucher__head{display:flex;flex-direction:column;align-items:center;gap:var(--cb-space-2, .5rem);text-align:center}.cb-voucher__check{display:inline-flex;align-items:center;justify-content:center;width:2.75rem;height:2.75rem;font-size:1.4rem;font-weight:var(--cb-font-weight-bold, 700);color:#fff;background-color:var(--cb-color-success-500, #16a34a);border-radius:var(--cb-radius-full, 999px)}.cb-voucher__title{margin:0;font-size:var(--cb-text-lg, 1.05rem);font-weight:var(--cb-font-weight-semibold, 600)}.cb-voucher__intro{font-size:var(--cb-text-sm, .875rem);color:var(--cb-color-text-muted, #64748b);text-align:center}.cb-voucher__intro:empty{display:none}.cb-voucher__list{margin:0;padding:var(--cb-space-3, .75rem) 0;border-top:1px dashed var(--cb-color-border, #e2e8f0);border-bottom:1px dashed var(--cb-color-border, #e2e8f0);display:flex;flex-direction:column;gap:var(--cb-space-3, .6rem)}.cb-voucher__row{display:flex;align-items:baseline;justify-content:space-between;gap:var(--cb-space-3, .75rem)}.cb-voucher__label{font-size:var(--cb-text-sm, .8125rem);color:var(--cb-color-text-muted, #64748b)}.cb-voucher__value{margin:0;font-size:var(--cb-text-sm, .875rem);font-weight:var(--cb-font-weight-medium, 500);text-align:right}.cb-voucher__foot{display:flex;justify-content:center}.cb-voucher__action{width:100%;padding:var(--cb-space-3, .65rem) var(--cb-space-4, 1rem);font:inherit;font-size:var(--cb-text-sm, .875rem);font-weight:var(--cb-font-weight-semibold, 600);color
|
|
52
|
+
args: [{ selector: 'cb-voucher', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.Emulated, template: `
|
|
53
|
+
<article class="cb-voucher">
|
|
54
|
+
<header class="cb-voucher__head">
|
|
55
|
+
<span class="cb-voucher__check" aria-hidden="true">✓</span>
|
|
56
|
+
<h2 class="cb-voucher__title">{{ (title() ?? t().receipt) }}</h2>
|
|
57
|
+
</header>
|
|
58
|
+
<div class="cb-voucher__intro"><ng-content /></div>
|
|
59
|
+
<dl class="cb-voucher__list">
|
|
60
|
+
@for (row of rows(); track $index) {
|
|
61
|
+
<div class="cb-voucher__row">
|
|
62
|
+
<dt class="cb-voucher__label">{{ row.label }}</dt>
|
|
63
|
+
<dd class="cb-voucher__value">{{ row.value }}</dd>
|
|
64
|
+
</div>
|
|
65
|
+
}
|
|
66
|
+
</dl>
|
|
67
|
+
<div class="cb-voucher__foot">
|
|
68
|
+
<button type="button" class="cb-voucher__action" (click)="copy.emit()">
|
|
69
|
+
{{ (actionLabel() ?? t().share) }}
|
|
70
|
+
</button>
|
|
71
|
+
</div>
|
|
72
|
+
</article>
|
|
73
|
+
`, styles: [":host{display:block;width:100%;max-width:22rem}.cb-voucher{display:flex;flex-direction:column;gap:var(--cb-space-4, 1rem);box-sizing:border-box;padding:var(--cb-space-5, 1.25rem);font-family:var(--cb-font-sans, inherit);color:var(--cb-color-text-strong, #0f172a);background-color:var(--cb-color-surface-0, #ffffff);border:1px solid var(--cb-color-border, #e2e8f0);border-radius:var(--cb-radius-lg, .75rem);box-shadow:var(--cb-shadow-sm, 0 1px 3px rgba(0, 0, 0, .08))}.cb-voucher__head{display:flex;flex-direction:column;align-items:center;gap:var(--cb-space-2, .5rem);text-align:center}.cb-voucher__check{display:inline-flex;align-items:center;justify-content:center;width:2.75rem;height:2.75rem;font-size:1.4rem;font-weight:var(--cb-font-weight-bold, 700);color:#fff;background-color:var(--cb-color-success-500, #16a34a);border-radius:var(--cb-radius-full, 999px)}.cb-voucher__title{margin:0;font-size:var(--cb-text-lg, 1.05rem);font-weight:var(--cb-font-weight-semibold, 600)}.cb-voucher__intro{font-size:var(--cb-text-sm, .875rem);color:var(--cb-color-text-muted, #64748b);text-align:center}.cb-voucher__intro:empty{display:none}.cb-voucher__list{margin:0;padding:var(--cb-space-3, .75rem) 0;border-top:1px dashed var(--cb-color-border, #e2e8f0);border-bottom:1px dashed var(--cb-color-border, #e2e8f0);display:flex;flex-direction:column;gap:var(--cb-space-3, .6rem)}.cb-voucher__row{display:flex;align-items:baseline;justify-content:space-between;gap:var(--cb-space-3, .75rem)}.cb-voucher__label{font-size:var(--cb-text-sm, .8125rem);color:var(--cb-color-text-muted, #64748b)}.cb-voucher__value{margin:0;font-size:var(--cb-text-sm, .875rem);font-weight:var(--cb-font-weight-medium, 500);text-align:right}.cb-voucher__foot{display:flex;justify-content:center}.cb-voucher__action{width:100%;padding:var(--cb-space-3, .65rem) var(--cb-space-4, 1rem);font:inherit;font-size:var(--cb-text-sm, .875rem);font-weight:var(--cb-font-weight-semibold, 600);color:#fff;background-color:var(--cb-color-primary-700, #047857);border:none;border-radius:var(--cb-radius-md, .5rem);cursor:pointer;transition:background-color var(--cb-duration-fast, .12s) var(--cb-ease, ease)}.cb-voucher__action:hover{background-color:var(--cb-color-primary-700, #065f46)}:host-context([data-theme=\"dark\"]) .cb-voucher{color:var(--cb-color-surface-0, #f8fafc);background-color:var(--cb-color-surface-800, #1e293b);border-color:var(--cb-color-surface-600, #475569)}:host-context([data-theme=\"dark\"]) .cb-voucher__list{border-color:var(--cb-color-surface-600, #475569)}\n"] }]
|
|
74
74
|
}], propDecorators: { title: [{ type: i0.Input, args: [{ isSignal: true, alias: "title", required: false }] }], rows: [{ type: i0.Input, args: [{ isSignal: true, alias: "rows", required: false }] }], actionLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "actionLabel", required: false }] }], copy: [{ type: i0.Output, args: ["copy"] }] } });
|
|
75
75
|
|
|
76
76
|
/**
|
|
@@ -0,0 +1,486 @@
|
|
|
1
|
+
/** Tabla del CRC-32 (polinomio 0xEDB88320). */
|
|
2
|
+
const CRC_TABLE = (() => {
|
|
3
|
+
const table = new Uint32Array(256);
|
|
4
|
+
for (let n = 0; n < 256; n++) {
|
|
5
|
+
let c = n;
|
|
6
|
+
for (let k = 0; k < 8; k++)
|
|
7
|
+
c = c & 1 ? 0xedb88320 ^ (c >>> 1) : c >>> 1;
|
|
8
|
+
table[n] = c >>> 0;
|
|
9
|
+
}
|
|
10
|
+
return table;
|
|
11
|
+
})();
|
|
12
|
+
function crc32(data) {
|
|
13
|
+
let crc = 0xffffffff;
|
|
14
|
+
for (let i = 0; i < data.length; i++)
|
|
15
|
+
crc = CRC_TABLE[(crc ^ data[i]) & 0xff] ^ (crc >>> 8);
|
|
16
|
+
return (crc ^ 0xffffffff) >>> 0;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* ZIP sin compresión (método *store*): suficiente para un .xlsx, que Excel,
|
|
20
|
+
* LibreOffice y Google Sheets abren sin problema.
|
|
21
|
+
*/
|
|
22
|
+
function zip(files) {
|
|
23
|
+
const encoder = new TextEncoder();
|
|
24
|
+
const local = [];
|
|
25
|
+
const central = [];
|
|
26
|
+
let offset = 0;
|
|
27
|
+
// Fecha y hora DOS fijas (1/1/2020): el contenido no depende del reloj.
|
|
28
|
+
const dosTime = 0;
|
|
29
|
+
const dosDate = ((2020 - 1980) << 9) | (1 << 5) | 1;
|
|
30
|
+
for (const file of files) {
|
|
31
|
+
const name = encoder.encode(file.name);
|
|
32
|
+
const crc = crc32(file.data);
|
|
33
|
+
const size = file.data.length;
|
|
34
|
+
const header = new Uint8Array(30 + name.length);
|
|
35
|
+
const h = new DataView(header.buffer);
|
|
36
|
+
h.setUint32(0, 0x04034b50, true);
|
|
37
|
+
h.setUint16(4, 20, true);
|
|
38
|
+
h.setUint16(6, 0x0800, true); // nombres en UTF-8
|
|
39
|
+
h.setUint16(8, 0, true);
|
|
40
|
+
h.setUint16(10, dosTime, true);
|
|
41
|
+
h.setUint16(12, dosDate, true);
|
|
42
|
+
h.setUint32(14, crc, true);
|
|
43
|
+
h.setUint32(18, size, true);
|
|
44
|
+
h.setUint32(22, size, true);
|
|
45
|
+
h.setUint16(26, name.length, true);
|
|
46
|
+
h.setUint16(28, 0, true);
|
|
47
|
+
header.set(name, 30);
|
|
48
|
+
local.push(header, file.data);
|
|
49
|
+
const entry = new Uint8Array(46 + name.length);
|
|
50
|
+
const c = new DataView(entry.buffer);
|
|
51
|
+
c.setUint32(0, 0x02014b50, true);
|
|
52
|
+
c.setUint16(4, 20, true);
|
|
53
|
+
c.setUint16(6, 20, true);
|
|
54
|
+
c.setUint16(8, 0x0800, true);
|
|
55
|
+
c.setUint16(10, 0, true);
|
|
56
|
+
c.setUint16(12, dosTime, true);
|
|
57
|
+
c.setUint16(14, dosDate, true);
|
|
58
|
+
c.setUint32(16, crc, true);
|
|
59
|
+
c.setUint32(20, size, true);
|
|
60
|
+
c.setUint32(24, size, true);
|
|
61
|
+
c.setUint16(28, name.length, true);
|
|
62
|
+
c.setUint32(42, offset, true);
|
|
63
|
+
entry.set(name, 46);
|
|
64
|
+
central.push(entry);
|
|
65
|
+
offset += header.length + size;
|
|
66
|
+
}
|
|
67
|
+
const centralSize = central.reduce((n, e) => n + e.length, 0);
|
|
68
|
+
const end = new Uint8Array(22);
|
|
69
|
+
const e = new DataView(end.buffer);
|
|
70
|
+
e.setUint32(0, 0x06054b50, true);
|
|
71
|
+
e.setUint16(8, files.length, true);
|
|
72
|
+
e.setUint16(10, files.length, true);
|
|
73
|
+
e.setUint32(12, centralSize, true);
|
|
74
|
+
e.setUint32(16, offset, true);
|
|
75
|
+
const parts = [...local, ...central, end];
|
|
76
|
+
const out = new Uint8Array(parts.reduce((n, p) => n + p.length, 0));
|
|
77
|
+
let pos = 0;
|
|
78
|
+
for (const p of parts) {
|
|
79
|
+
out.set(p, pos);
|
|
80
|
+
pos += p.length;
|
|
81
|
+
}
|
|
82
|
+
return out;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/** Símbolo corto de una moneda (`COP` → `$`, `EUR` → `€`). */
|
|
86
|
+
function currencySymbol(code, locale = 'es') {
|
|
87
|
+
try {
|
|
88
|
+
return new Intl.NumberFormat(locale, { style: 'currency', currency: code, currencyDisplay: 'narrowSymbol' }).formatToParts(0).find((p) => p.type === 'currency')?.value ?? code;
|
|
89
|
+
}
|
|
90
|
+
catch {
|
|
91
|
+
return code;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
const XML_HEADER = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\n';
|
|
95
|
+
function esc(text) {
|
|
96
|
+
return text
|
|
97
|
+
.replace(/&/g, '&')
|
|
98
|
+
.replace(/</g, '<')
|
|
99
|
+
.replace(/>/g, '>')
|
|
100
|
+
.replace(/"/g, '"')
|
|
101
|
+
// Caracteres de control que XML no admite.
|
|
102
|
+
.replace(/[\u0000-\u0008\u000b\u000c\u000e-\u001f]/g, '');
|
|
103
|
+
}
|
|
104
|
+
/** Letra(s) de columna: 0 → A, 26 → AA. */
|
|
105
|
+
function columnName(index) {
|
|
106
|
+
let n = index + 1;
|
|
107
|
+
let name = '';
|
|
108
|
+
while (n > 0) {
|
|
109
|
+
const r = (n - 1) % 26;
|
|
110
|
+
name = String.fromCharCode(65 + r) + name;
|
|
111
|
+
n = Math.floor((n - 1) / 26);
|
|
112
|
+
}
|
|
113
|
+
return name;
|
|
114
|
+
}
|
|
115
|
+
/** Fecha a número de serie de Excel (días desde el 30/12/1899, hora local). */
|
|
116
|
+
function excelDate(date) {
|
|
117
|
+
const utc = Date.UTC(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds());
|
|
118
|
+
return utc / 86400000 + 25569;
|
|
119
|
+
}
|
|
120
|
+
/** Código de formato numérico de Excel para una columna. */
|
|
121
|
+
function numberFormat(col) {
|
|
122
|
+
const type = col.type ?? 'text';
|
|
123
|
+
const decimals = col.decimals ?? (type === 'integer' ? 0 : 2);
|
|
124
|
+
const frac = decimals > 0 ? '.' + '0'.repeat(decimals) : '';
|
|
125
|
+
const parens = col.negative === 'parens';
|
|
126
|
+
const signed = (pos) => `${pos};[Red]${parens ? `(${pos})` : `-${pos}`}`;
|
|
127
|
+
switch (type) {
|
|
128
|
+
case 'number':
|
|
129
|
+
case 'integer':
|
|
130
|
+
return signed(`#,##0${frac}`);
|
|
131
|
+
case 'currency': {
|
|
132
|
+
const symbol = (col.symbol ?? '$').replace(/"/g, '');
|
|
133
|
+
return signed(`"${symbol}" #,##0${frac}`);
|
|
134
|
+
}
|
|
135
|
+
case 'percent':
|
|
136
|
+
return signed(`0${frac}%`);
|
|
137
|
+
case 'date':
|
|
138
|
+
return 'dd/mm/yyyy';
|
|
139
|
+
default:
|
|
140
|
+
return null;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
/** Registro de estilos (formatos de número, negrita, sangría) → índices de `cellXfs`. */
|
|
144
|
+
class Styles {
|
|
145
|
+
constructor() {
|
|
146
|
+
this.fmts = new Map();
|
|
147
|
+
this.xfs = ['<xf numFmtId="0" fontId="0" fillId="0" borderId="0" xfId="0"/>'];
|
|
148
|
+
this.keys = new Map();
|
|
149
|
+
}
|
|
150
|
+
style(options) {
|
|
151
|
+
const key = JSON.stringify(options);
|
|
152
|
+
const known = this.keys.get(key);
|
|
153
|
+
if (known !== undefined)
|
|
154
|
+
return known;
|
|
155
|
+
let fmtId = 0;
|
|
156
|
+
if (options.format) {
|
|
157
|
+
fmtId = this.fmts.get(options.format) ?? 164 + this.fmts.size;
|
|
158
|
+
this.fmts.set(options.format, fmtId);
|
|
159
|
+
}
|
|
160
|
+
const fontId = options.title ? 2 : options.bold || options.header ? 1 : 0;
|
|
161
|
+
const fillId = options.header ? 2 : 0;
|
|
162
|
+
const borderId = options.header ? 1 : 0;
|
|
163
|
+
const align = options.indent ? `<alignment indent="${Math.min(options.indent, 15)}"/>` : '';
|
|
164
|
+
const attrs = `numFmtId="${fmtId}" fontId="${fontId}" fillId="${fillId}" borderId="${borderId}" xfId="0"${fmtId ? ' applyNumberFormat="1"' : ''}${fontId ? ' applyFont="1"' : ''}${fillId ? ' applyFill="1"' : ''}${borderId ? ' applyBorder="1"' : ''}${align ? ' applyAlignment="1"' : ''}`;
|
|
165
|
+
this.xfs.push(align ? `<xf ${attrs}>${align}</xf>` : `<xf ${attrs}/>`);
|
|
166
|
+
const index = this.xfs.length - 1;
|
|
167
|
+
this.keys.set(key, index);
|
|
168
|
+
return index;
|
|
169
|
+
}
|
|
170
|
+
xml() {
|
|
171
|
+
const fmts = [...this.fmts].map(([code, id]) => `<numFmt numFmtId="${id}" formatCode="${esc(code)}"/>`).join('');
|
|
172
|
+
return (XML_HEADER +
|
|
173
|
+
'<styleSheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main">' +
|
|
174
|
+
(fmts ? `<numFmts count="${this.fmts.size}">${fmts}</numFmts>` : '') +
|
|
175
|
+
'<fonts count="3"><font><sz val="11"/><name val="Calibri"/></font><font><b/><sz val="11"/><name val="Calibri"/></font><font><b/><sz val="13"/><name val="Calibri"/></font></fonts>' +
|
|
176
|
+
'<fills count="3"><fill><patternFill patternType="none"/></fill><fill><patternFill patternType="gray125"/></fill><fill><patternFill patternType="solid"><fgColor rgb="FFF1F5F9"/><bgColor indexed="64"/></patternFill></fill></fills>' +
|
|
177
|
+
'<borders count="2"><border><left/><right/><top/><bottom/><diagonal/></border><border><left/><right/><top/><bottom style="thin"><color rgb="FF94A3B8"/></bottom><diagonal/></border></borders>' +
|
|
178
|
+
'<cellStyleXfs count="1"><xf numFmtId="0" fontId="0" fillId="0" borderId="0"/></cellStyleXfs>' +
|
|
179
|
+
`<cellXfs count="${this.xfs.length}">${this.xfs.join('')}</cellXfs>` +
|
|
180
|
+
'<cellStyles count="1"><cellStyle name="Normal" xfId="0" builtinId="0"/></cellStyles>' +
|
|
181
|
+
'</styleSheet>');
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
function toRow(row) {
|
|
185
|
+
return Array.isArray(row) ? { cells: row } : row;
|
|
186
|
+
}
|
|
187
|
+
function cellXml(ref, value, style, type) {
|
|
188
|
+
const s = style ? ` s="${style}"` : '';
|
|
189
|
+
if (value === null || value === undefined || value === '')
|
|
190
|
+
return style ? `<c r="${ref}"${s}/>` : '';
|
|
191
|
+
if (value instanceof Date && !Number.isNaN(value.getTime()))
|
|
192
|
+
return `<c r="${ref}"${s}><v>${excelDate(value)}</v></c>`;
|
|
193
|
+
if (type === 'date' && typeof value === 'string' && /^\d{4}-\d{2}-\d{2}/.test(value)) {
|
|
194
|
+
const [y, m, d] = value.slice(0, 10).split('-').map(Number);
|
|
195
|
+
return `<c r="${ref}"${s}><v>${excelDate(new Date(y, m - 1, d))}</v></c>`;
|
|
196
|
+
}
|
|
197
|
+
if (typeof value === 'number' && Number.isFinite(value))
|
|
198
|
+
return `<c r="${ref}"${s}><v>${value}</v></c>`;
|
|
199
|
+
if (typeof value === 'boolean')
|
|
200
|
+
return `<c r="${ref}"${s} t="b"><v>${value ? 1 : 0}</v></c>`;
|
|
201
|
+
return `<c r="${ref}"${s} t="inlineStr"><is><t xml:space="preserve">${esc(String(value))}</t></is></c>`;
|
|
202
|
+
}
|
|
203
|
+
function sheetXml(sheet, styles) {
|
|
204
|
+
const cols = sheet.columns;
|
|
205
|
+
const title = sheet.title ?? [];
|
|
206
|
+
const headerRow = title.length ? title.length + 2 : 1;
|
|
207
|
+
const rows = sheet.rows.map(toRow);
|
|
208
|
+
const out = [];
|
|
209
|
+
let r = 0;
|
|
210
|
+
const titleStyle = styles.style({ title: true });
|
|
211
|
+
title.forEach((line, i) => {
|
|
212
|
+
r++;
|
|
213
|
+
out.push(`<row r="${r}">${cellXml(`A${r}`, line, i === 0 ? titleStyle : 0, 'text')}</row>`);
|
|
214
|
+
});
|
|
215
|
+
if (title.length)
|
|
216
|
+
r++;
|
|
217
|
+
r++;
|
|
218
|
+
const headerStyle = styles.style({ header: true });
|
|
219
|
+
out.push(`<row r="${r}">${cols.map((c, i) => cellXml(`${columnName(i)}${r}`, c.header, headerStyle, 'text')).join('')}</row>`);
|
|
220
|
+
let maxLevel = 0;
|
|
221
|
+
const write = (row, forceBold = false) => {
|
|
222
|
+
r++;
|
|
223
|
+
const level = Math.max(0, Math.min(7, row.level ?? 0));
|
|
224
|
+
maxLevel = Math.max(maxLevel, level);
|
|
225
|
+
const bold = forceBold || !!row.bold;
|
|
226
|
+
const cells = cols
|
|
227
|
+
.map((c, i) => {
|
|
228
|
+
const style = styles.style({ format: numberFormat(c), bold, indent: i === 0 ? row.indent : undefined });
|
|
229
|
+
return cellXml(`${columnName(i)}${r}`, row.cells[i], style === 0 ? 0 : style, c.type ?? 'text');
|
|
230
|
+
})
|
|
231
|
+
.join('');
|
|
232
|
+
out.push(`<row r="${r}"${level ? ` outlineLevel="${level}"` : ''}>${cells}</row>`);
|
|
233
|
+
};
|
|
234
|
+
rows.forEach((row) => write(row));
|
|
235
|
+
if (sheet.totals)
|
|
236
|
+
write({ cells: sheet.totals }, true);
|
|
237
|
+
// Anchos: el indicado o el del texto más largo (con margen), entre 6 y 60.
|
|
238
|
+
const widths = cols.map((c, i) => {
|
|
239
|
+
if (c.width)
|
|
240
|
+
return c.width;
|
|
241
|
+
let max = c.header.length;
|
|
242
|
+
for (const row of rows) {
|
|
243
|
+
const v = row.cells[i];
|
|
244
|
+
const len = v instanceof Date ? 10 : typeof v === 'number' ? v.toFixed(c.decimals ?? 2).length + 4 : String(v ?? '').length + (i === 0 ? (row.indent ?? 0) * 2 : 0);
|
|
245
|
+
if (len > max)
|
|
246
|
+
max = len;
|
|
247
|
+
}
|
|
248
|
+
return Math.max(6, Math.min(60, max + 2));
|
|
249
|
+
});
|
|
250
|
+
const lastCol = columnName(Math.max(0, cols.length - 1));
|
|
251
|
+
const freeze = sheet.freeze ?? true;
|
|
252
|
+
return (XML_HEADER +
|
|
253
|
+
'<worksheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships">' +
|
|
254
|
+
(maxLevel ? '<sheetPr><outlinePr summaryBelow="0"/></sheetPr>' : '') +
|
|
255
|
+
`<dimension ref="A1:${lastCol}${Math.max(r, 1)}"/>` +
|
|
256
|
+
(freeze
|
|
257
|
+
? `<sheetViews><sheetView workbookViewId="0"><pane ySplit="${headerRow}" topLeftCell="A${headerRow + 1}" activePane="bottomLeft" state="frozen"/></sheetView></sheetViews>`
|
|
258
|
+
: '<sheetViews><sheetView workbookViewId="0"/></sheetViews>') +
|
|
259
|
+
`<sheetFormatPr defaultRowHeight="15"${maxLevel ? ` outlineLevelRow="${maxLevel}"` : ''}/>` +
|
|
260
|
+
`<cols>${widths.map((w, i) => `<col min="${i + 1}" max="${i + 1}" width="${w}" customWidth="1"/>`).join('')}</cols>` +
|
|
261
|
+
`<sheetData>${out.join('')}</sheetData>` +
|
|
262
|
+
((sheet.autoFilter ?? true) && cols.length ? `<autoFilter ref="A${headerRow}:${lastCol}${headerRow}"/>` : '') +
|
|
263
|
+
'</worksheet>');
|
|
264
|
+
}
|
|
265
|
+
function sheetName(name, used) {
|
|
266
|
+
let base = (name.replace(/[\\/?*[\]:]/g, ' ').trim() || 'Hoja').slice(0, 31);
|
|
267
|
+
let candidate = base;
|
|
268
|
+
for (let n = 2; used.has(candidate.toLowerCase()); n++)
|
|
269
|
+
candidate = `${base.slice(0, 28)} ${n}`;
|
|
270
|
+
used.add(candidate.toLowerCase());
|
|
271
|
+
return candidate;
|
|
272
|
+
}
|
|
273
|
+
/** Bytes del libro .xlsx con una o varias hojas. */
|
|
274
|
+
function cbXlsxBytes(sheets) {
|
|
275
|
+
const list = Array.isArray(sheets) ? sheets : [sheets];
|
|
276
|
+
const styles = new Styles();
|
|
277
|
+
const used = new Set();
|
|
278
|
+
const names = list.map((s) => sheetName(s.name, used));
|
|
279
|
+
const sheetsXml = list.map((s) => sheetXml(s, styles));
|
|
280
|
+
const enc = new TextEncoder();
|
|
281
|
+
const file = (name, text) => ({ name, data: enc.encode(text) });
|
|
282
|
+
return zip([
|
|
283
|
+
file('[Content_Types].xml', XML_HEADER +
|
|
284
|
+
'<Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types">' +
|
|
285
|
+
'<Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml"/>' +
|
|
286
|
+
'<Default Extension="xml" ContentType="application/xml"/>' +
|
|
287
|
+
'<Override PartName="/xl/workbook.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml"/>' +
|
|
288
|
+
'<Override PartName="/xl/styles.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml"/>' +
|
|
289
|
+
list.map((_, i) => `<Override PartName="/xl/worksheets/sheet${i + 1}.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml"/>`).join('') +
|
|
290
|
+
'</Types>'),
|
|
291
|
+
file('_rels/.rels', XML_HEADER +
|
|
292
|
+
'<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"><Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" Target="xl/workbook.xml"/></Relationships>'),
|
|
293
|
+
file('xl/workbook.xml', XML_HEADER +
|
|
294
|
+
'<workbook xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"><sheets>' +
|
|
295
|
+
names.map((n, i) => `<sheet name="${esc(n)}" sheetId="${i + 1}" r:id="rId${i + 1}"/>`).join('') +
|
|
296
|
+
'</sheets>' +
|
|
297
|
+
// El filtro necesita su nombre definido para que Excel lo reconozca.
|
|
298
|
+
`<definedNames>${list
|
|
299
|
+
.map((s, i) => {
|
|
300
|
+
if (!(s.autoFilter ?? true) || !s.columns.length)
|
|
301
|
+
return '';
|
|
302
|
+
const hr = s.title?.length ? s.title.length + 2 : 1;
|
|
303
|
+
return `<definedName name="_xlnm._FilterDatabase" localSheetId="${i}" hidden="1">'${esc(names[i].replace(/'/g, "''"))}'!$A$${hr}:$${columnName(s.columns.length - 1)}$${hr}</definedName>`;
|
|
304
|
+
})
|
|
305
|
+
.join('')}</definedNames>` +
|
|
306
|
+
'</workbook>'),
|
|
307
|
+
file('xl/_rels/workbook.xml.rels', XML_HEADER +
|
|
308
|
+
'<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">' +
|
|
309
|
+
list.map((_, i) => `<Relationship Id="rId${i + 1}" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet" Target="worksheets/sheet${i + 1}.xml"/>`).join('') +
|
|
310
|
+
`<Relationship Id="rId${list.length + 1}" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles" Target="styles.xml"/>` +
|
|
311
|
+
'</Relationships>'),
|
|
312
|
+
file('xl/styles.xml', styles.xml()),
|
|
313
|
+
...sheetsXml.map((xml, i) => file(`xl/worksheets/sheet${i + 1}.xml`, xml)),
|
|
314
|
+
]);
|
|
315
|
+
}
|
|
316
|
+
/** Libro .xlsx como `Blob`. */
|
|
317
|
+
function cbXlsx(sheets) {
|
|
318
|
+
return new Blob([cbXlsxBytes(sheets)], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' });
|
|
319
|
+
}
|
|
320
|
+
/** Descarga el libro (`nombre.xlsx`). */
|
|
321
|
+
function cbDownloadXlsx(filename, sheets) {
|
|
322
|
+
const url = URL.createObjectURL(cbXlsx(sheets));
|
|
323
|
+
const link = document.createElement('a');
|
|
324
|
+
link.href = url;
|
|
325
|
+
link.download = filename.toLowerCase().endsWith('.xlsx') ? filename : `${filename}.xlsx`;
|
|
326
|
+
link.click();
|
|
327
|
+
setTimeout(() => URL.revokeObjectURL(url));
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
/** Entradas del directorio central de un ZIP. */
|
|
331
|
+
function entries(bytes) {
|
|
332
|
+
const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
333
|
+
let end = -1;
|
|
334
|
+
for (let i = bytes.length - 22; i >= Math.max(0, bytes.length - 65557); i--) {
|
|
335
|
+
if (view.getUint32(i, true) === 0x06054b50) {
|
|
336
|
+
end = i;
|
|
337
|
+
break;
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
if (end < 0)
|
|
341
|
+
throw new Error('No es un archivo ZIP/XLSX válido.');
|
|
342
|
+
const count = view.getUint16(end + 10, true);
|
|
343
|
+
let pos = view.getUint32(end + 16, true);
|
|
344
|
+
const dec = new TextDecoder();
|
|
345
|
+
const out = [];
|
|
346
|
+
for (let n = 0; n < count; n++) {
|
|
347
|
+
if (view.getUint32(pos, true) !== 0x02014b50)
|
|
348
|
+
break;
|
|
349
|
+
const method = view.getUint16(pos + 10, true);
|
|
350
|
+
const compressedSize = view.getUint32(pos + 20, true);
|
|
351
|
+
const nameLen = view.getUint16(pos + 28, true);
|
|
352
|
+
const extraLen = view.getUint16(pos + 30, true);
|
|
353
|
+
const commentLen = view.getUint16(pos + 32, true);
|
|
354
|
+
const local = view.getUint32(pos + 42, true);
|
|
355
|
+
const name = dec.decode(bytes.subarray(pos + 46, pos + 46 + nameLen));
|
|
356
|
+
// El contenido empieza tras la cabecera local (con su propio nombre y extra).
|
|
357
|
+
const localName = view.getUint16(local + 26, true);
|
|
358
|
+
const localExtra = view.getUint16(local + 28, true);
|
|
359
|
+
out.push({ name, method, compressedSize, offset: local + 30 + localName + localExtra });
|
|
360
|
+
pos += 46 + nameLen + extraLen + commentLen;
|
|
361
|
+
}
|
|
362
|
+
return out;
|
|
363
|
+
}
|
|
364
|
+
async function inflate(data) {
|
|
365
|
+
const source = new ReadableStream({
|
|
366
|
+
start(controller) {
|
|
367
|
+
controller.enqueue(data);
|
|
368
|
+
controller.close();
|
|
369
|
+
},
|
|
370
|
+
});
|
|
371
|
+
const reader = source.pipeThrough(new DecompressionStream('deflate-raw')).getReader();
|
|
372
|
+
const chunks = [];
|
|
373
|
+
let size = 0;
|
|
374
|
+
for (;;) {
|
|
375
|
+
const { done, value } = await reader.read();
|
|
376
|
+
if (done)
|
|
377
|
+
break;
|
|
378
|
+
chunks.push(value);
|
|
379
|
+
size += value.length;
|
|
380
|
+
}
|
|
381
|
+
const out = new Uint8Array(size);
|
|
382
|
+
let pos = 0;
|
|
383
|
+
for (const c of chunks) {
|
|
384
|
+
out.set(c, pos);
|
|
385
|
+
pos += c.length;
|
|
386
|
+
}
|
|
387
|
+
return out;
|
|
388
|
+
}
|
|
389
|
+
async function readEntry(bytes, entry) {
|
|
390
|
+
const raw = bytes.subarray(entry.offset, entry.offset + entry.compressedSize);
|
|
391
|
+
const data = entry.method === 0 ? raw : await inflate(raw);
|
|
392
|
+
return new TextDecoder().decode(data);
|
|
393
|
+
}
|
|
394
|
+
/** Índice de columna a partir de una referencia (`C12` → 2). */
|
|
395
|
+
function columnIndex(ref) {
|
|
396
|
+
let n = 0;
|
|
397
|
+
for (const ch of ref.replace(/\d+$/, ''))
|
|
398
|
+
n = n * 26 + (ch.charCodeAt(0) - 64);
|
|
399
|
+
return n - 1;
|
|
400
|
+
}
|
|
401
|
+
/** Texto de un nodo `<si>` o `<is>` (con o sin formato enriquecido). */
|
|
402
|
+
function richText(node) {
|
|
403
|
+
return Array.from(node.getElementsByTagName('t'))
|
|
404
|
+
.map((t) => t.textContent ?? '')
|
|
405
|
+
.join('');
|
|
406
|
+
}
|
|
407
|
+
/**
|
|
408
|
+
* Lee un libro .xlsx (Excel, LibreOffice, Google Sheets) en el navegador: todas
|
|
409
|
+
* las hojas con sus celdas como texto, número o booleano. Las fechas quedan
|
|
410
|
+
* como número de serie de Excel (ver `excelSerialToDate`).
|
|
411
|
+
*/
|
|
412
|
+
async function cbReadXlsx(input) {
|
|
413
|
+
const bytes = input instanceof Uint8Array ? input : new Uint8Array(input instanceof Blob ? await input.arrayBuffer() : input);
|
|
414
|
+
const list = entries(bytes);
|
|
415
|
+
const get = async (name) => {
|
|
416
|
+
const e = list.find((x) => x.name === name);
|
|
417
|
+
return e ? readEntry(bytes, e) : null;
|
|
418
|
+
};
|
|
419
|
+
const parser = new DOMParser();
|
|
420
|
+
const xml = (text) => parser.parseFromString(text, 'application/xml');
|
|
421
|
+
const shared = [];
|
|
422
|
+
const sst = await get('xl/sharedStrings.xml');
|
|
423
|
+
if (sst)
|
|
424
|
+
for (const si of Array.from(xml(sst).getElementsByTagName('si')))
|
|
425
|
+
shared.push(richText(si));
|
|
426
|
+
// Nombres y orden de las hojas según el libro y sus relaciones.
|
|
427
|
+
const workbook = xml((await get('xl/workbook.xml')) ?? '<workbook/>');
|
|
428
|
+
const rels = xml((await get('xl/_rels/workbook.xml.rels')) ?? '<Relationships/>');
|
|
429
|
+
const targets = new Map(Array.from(rels.getElementsByTagName('Relationship')).map((r) => [r.getAttribute('Id'), r.getAttribute('Target') ?? '']));
|
|
430
|
+
const sheets = Array.from(workbook.getElementsByTagName('sheet')).map((s) => {
|
|
431
|
+
const rid = s.getAttribute('r:id') ?? s.getAttributeNS('http://schemas.openxmlformats.org/officeDocument/2006/relationships', 'id');
|
|
432
|
+
const target = (targets.get(rid) ?? '').replace(/^\/?xl\//, '').replace(/^\//, '');
|
|
433
|
+
return { name: s.getAttribute('name') ?? 'Hoja', path: `xl/${target}` };
|
|
434
|
+
});
|
|
435
|
+
const out = [];
|
|
436
|
+
for (const sheet of sheets) {
|
|
437
|
+
const text = await get(sheet.path);
|
|
438
|
+
if (!text)
|
|
439
|
+
continue;
|
|
440
|
+
const rows = [];
|
|
441
|
+
for (const row of Array.from(xml(text).getElementsByTagName('row'))) {
|
|
442
|
+
const r = Number(row.getAttribute('r') ?? rows.length + 1) - 1;
|
|
443
|
+
const cells = [];
|
|
444
|
+
for (const c of Array.from(row.getElementsByTagName('c'))) {
|
|
445
|
+
const ref = c.getAttribute('r');
|
|
446
|
+
const ci = ref ? columnIndex(ref) : cells.length;
|
|
447
|
+
const type = c.getAttribute('t');
|
|
448
|
+
const v = c.getElementsByTagName('v')[0]?.textContent ?? null;
|
|
449
|
+
let value = null;
|
|
450
|
+
if (type === 's')
|
|
451
|
+
value = v === null ? null : (shared[Number(v)] ?? '');
|
|
452
|
+
else if (type === 'inlineStr')
|
|
453
|
+
value = richText(c.getElementsByTagName('is')[0] ?? c);
|
|
454
|
+
else if (type === 'b')
|
|
455
|
+
value = v === '1';
|
|
456
|
+
else if (type === 'str' || type === 'e')
|
|
457
|
+
value = v;
|
|
458
|
+
else
|
|
459
|
+
value = v === null || v === '' ? null : Number(v);
|
|
460
|
+
while (cells.length < ci)
|
|
461
|
+
cells.push(null);
|
|
462
|
+
cells[ci] = value;
|
|
463
|
+
}
|
|
464
|
+
while (rows.length < r)
|
|
465
|
+
rows.push([]);
|
|
466
|
+
rows[r] = cells;
|
|
467
|
+
}
|
|
468
|
+
out.push({ name: sheet.name, rows });
|
|
469
|
+
}
|
|
470
|
+
return out;
|
|
471
|
+
}
|
|
472
|
+
/** Número de serie de Excel a fecha local. */
|
|
473
|
+
function excelSerialToDate(serial) {
|
|
474
|
+
const utc = new Date(Math.round((serial - 25569) * 86400000));
|
|
475
|
+
return new Date(utc.getUTCFullYear(), utc.getUTCMonth(), utc.getUTCDate());
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
/*
|
|
479
|
+
* Public API Surface de @caribeng/ui/xlsx
|
|
480
|
+
*/
|
|
481
|
+
|
|
482
|
+
/**
|
|
483
|
+
* Generated bundle index. Do not edit.
|
|
484
|
+
*/
|
|
485
|
+
|
|
486
|
+
export { cbDownloadXlsx, cbReadXlsx, cbXlsx, cbXlsxBytes, columnName, currencySymbol, excelDate, excelSerialToDate, numberFormat };
|