@caribeng/ui 22.4.0 → 22.6.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 +313 -313
- 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 +2 -2
- package/fesm2022/caribeng-ui-breadcrumb.mjs +13 -3
- 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-chat.mjs +2 -2
- package/fesm2022/{caribeng-ui-caribe-coachmark.mjs → caribeng-ui-coachmark.mjs} +85 -85
- package/fesm2022/caribeng-ui-command-palette.mjs +2 -2
- package/fesm2022/caribeng-ui-comments.mjs +864 -0
- package/fesm2022/caribeng-ui-datagrid.mjs +1635 -0
- package/fesm2022/caribeng-ui-dataview.mjs +2 -2
- package/fesm2022/caribeng-ui-datepicker.mjs +2 -2
- 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-dynamic-form.mjs +1581 -0
- package/fesm2022/caribeng-ui-editor.mjs +2303 -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-file-card.mjs +2 -2
- 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-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-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-inputotp.mjs +2 -2
- package/fesm2022/caribeng-ui-journal-entry.mjs +340 -0
- package/fesm2022/caribeng-ui-kanban.mjs +6 -6
- 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-mentions.mjs +2 -2
- 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-pdfviewer.mjs +1755 -25
- package/fesm2022/caribeng-ui-period-picker.mjs +637 -0
- package/fesm2022/caribeng-ui-phone-input.mjs +2 -2
- package/fesm2022/caribeng-ui-picklist.mjs +2 -2
- package/fesm2022/caribeng-ui-pivot.mjs +419 -0
- package/fesm2022/caribeng-ui-pricing.mjs +2 -2
- package/fesm2022/caribeng-ui-rating.mjs +14 -17
- package/fesm2022/caribeng-ui-reconciliation.mjs +386 -0
- package/fesm2022/caribeng-ui-scheduler.mjs +1027 -0
- 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 +2 -2
- 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 +2 -2
- package/fesm2022/caribeng-ui-steps.mjs +2 -2
- package/fesm2022/caribeng-ui-table.mjs +323 -15
- package/fesm2022/caribeng-ui-tabmenu.mjs +2 -2
- 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 +6 -6
- 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 +1185 -5
- package/package.json +217 -177
- 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-breadcrumb.d.ts +2 -2
- 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-caribe-coachmark.d.ts → caribeng-ui-coachmark.d.ts} +2 -2
- package/types/caribeng-ui-comments.d.ts +214 -0
- package/types/caribeng-ui-datagrid.d.ts +269 -0
- 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-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-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-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-journal-entry.d.ts +110 -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-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-pdfviewer.d.ts +245 -5
- package/types/caribeng-ui-period-picker.d.ts +148 -0
- package/types/caribeng-ui-pivot.d.ts +116 -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-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-table.d.ts +66 -2
- package/types/{caribeng-ui-caribe-tag-button.d.ts → caribeng-ui-tag-button.d.ts} +2 -2
- 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 +713 -4
- 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/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
|
@@ -0,0 +1,495 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { inject, viewChild, input, booleanAttribute, computed, ViewEncapsulation, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
3
|
+
import { injectCbTranslation, CB_CONFIG, cbFormatAmount } from '@caribeng/ui';
|
|
4
|
+
import { cbAmountInWords } from '@caribeng/ui/amount';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Imprime solo un elemento de la página, con sus estilos, en un marco oculto: la
|
|
8
|
+
* página no cambia y el diálogo de impresión (o «Guardar como PDF») muestra
|
|
9
|
+
* únicamente ese elemento.
|
|
10
|
+
*/
|
|
11
|
+
function cbPrintElement(element, title = document.title) {
|
|
12
|
+
const doc = element.ownerDocument;
|
|
13
|
+
const frame = doc.createElement('iframe');
|
|
14
|
+
frame.setAttribute('aria-hidden', 'true');
|
|
15
|
+
frame.style.cssText = 'position:fixed;right:0;bottom:0;width:0;height:0;border:0';
|
|
16
|
+
doc.body.appendChild(frame);
|
|
17
|
+
const w = frame.contentWindow;
|
|
18
|
+
if (!w) {
|
|
19
|
+
frame.remove();
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
// Se copian las hojas de estilo (incluidas las de los componentes) y los tokens del tema.
|
|
23
|
+
const styles = Array.from(doc.querySelectorAll('style, link[rel="stylesheet"]'))
|
|
24
|
+
.map((n) => n.outerHTML)
|
|
25
|
+
.join('');
|
|
26
|
+
const root = doc.documentElement;
|
|
27
|
+
const attrs = Array.from(root.attributes)
|
|
28
|
+
.map((a) => `${a.name}="${a.value.replace(/"/g, '"')}"`)
|
|
29
|
+
.join(' ');
|
|
30
|
+
w.document.open();
|
|
31
|
+
w.document.write(
|
|
32
|
+
// La base es la de la página: así las hojas enlazadas con ruta relativa se encuentran.
|
|
33
|
+
`<!doctype html><html ${attrs}><head><meta charset="utf-8"><base href="${doc.baseURI.replace(/"/g, '"')}"><title>${title.replace(/</g, '<')}</title>${styles}` +
|
|
34
|
+
'<style>@page{margin:14mm}body{margin:0;background:#fff}.cb-print-root{box-shadow:none!important;border:0!important;max-width:none!important}</style>' +
|
|
35
|
+
`</head><body>${element.outerHTML.replace('class="', 'class="cb-print-root ')}</body></html>`);
|
|
36
|
+
w.document.close();
|
|
37
|
+
const go = () => {
|
|
38
|
+
w.focus();
|
|
39
|
+
w.print();
|
|
40
|
+
setTimeout(() => frame.remove(), 1000);
|
|
41
|
+
};
|
|
42
|
+
// Espera a que carguen las hojas enlazadas (fuentes y estilos) antes de imprimir.
|
|
43
|
+
if (w.document.readyState === 'complete')
|
|
44
|
+
setTimeout(go, 50);
|
|
45
|
+
else
|
|
46
|
+
w.addEventListener('load', go, { once: true });
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const round = (n) => Math.round(n * 100) / 100;
|
|
50
|
+
/** Totales de un documento a partir de sus líneas. */
|
|
51
|
+
function documentTotals(lines, adjustments = []) {
|
|
52
|
+
let subtotal = 0;
|
|
53
|
+
let discount = 0;
|
|
54
|
+
const taxes = new Map();
|
|
55
|
+
for (const l of lines) {
|
|
56
|
+
const gross = l.quantity * l.unitPrice;
|
|
57
|
+
const disc = gross * (l.discount ?? 0);
|
|
58
|
+
const base = gross - disc;
|
|
59
|
+
subtotal += gross;
|
|
60
|
+
discount += disc;
|
|
61
|
+
if (l.tax) {
|
|
62
|
+
const t = taxes.get(l.tax) ?? { base: 0, amount: 0 };
|
|
63
|
+
t.base += base;
|
|
64
|
+
t.amount += base * l.tax;
|
|
65
|
+
taxes.set(l.tax, t);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
const taxList = [...taxes].sort(([a], [b]) => b - a).map(([rate, t]) => ({ rate, base: round(t.base), amount: round(t.amount) }));
|
|
69
|
+
const taxTotal = round(taxList.reduce((s, t) => s + t.amount, 0));
|
|
70
|
+
const adjustmentTotal = round(adjustments.reduce((s, a) => s + a.amount, 0));
|
|
71
|
+
const net = round(subtotal - discount);
|
|
72
|
+
return { subtotal: round(subtotal), discount: round(discount), net, taxes: taxList, taxTotal, adjustments, total: round(net + taxTotal + adjustmentTotal) };
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Documento imprimible de CaribeNG: factura, cotización, comprobante o recibo con
|
|
76
|
+
* cabecera de la empresa, tercero, líneas, impuestos, retenciones, total en letras,
|
|
77
|
+
* notas y firmas.
|
|
78
|
+
*
|
|
79
|
+
* - Calcula subtotales, descuentos, impuestos por tarifa y ajustes (retenciones).
|
|
80
|
+
* - `print()` imprime solo el documento (o lo guarda en PDF) con sus estilos.
|
|
81
|
+
*
|
|
82
|
+
* @example
|
|
83
|
+
* ```html
|
|
84
|
+
* <cb-document #doc title="Factura de venta" number="FV-1252" [issuer]="empresa" [party]="cliente" [lines]="items" />
|
|
85
|
+
* <button (click)="doc.print()">Imprimir</button>
|
|
86
|
+
* ```
|
|
87
|
+
*/
|
|
88
|
+
class CbDocument {
|
|
89
|
+
constructor() {
|
|
90
|
+
this.t = injectCbTranslation();
|
|
91
|
+
this.config = inject(CB_CONFIG);
|
|
92
|
+
this.sheet = viewChild.required('sheet');
|
|
93
|
+
/** Título («Factura electrónica de venta», «Comprobante de egreso»). */
|
|
94
|
+
this.title = input('', /* @ts-ignore */
|
|
95
|
+
...(ngDevMode ? [{ debugName: "title" }] : /* istanbul ignore next */ []));
|
|
96
|
+
this.number = input('', /* @ts-ignore */
|
|
97
|
+
...(ngDevMode ? [{ debugName: "number" }] : /* istanbul ignore next */ []));
|
|
98
|
+
this.date = input(null, /* @ts-ignore */
|
|
99
|
+
...(ngDevMode ? [{ debugName: "date" }] : /* istanbul ignore next */ []));
|
|
100
|
+
this.issuer = input({ name: '' }, /* @ts-ignore */
|
|
101
|
+
...(ngDevMode ? [{ debugName: "issuer" }] : /* istanbul ignore next */ []));
|
|
102
|
+
this.party = input(null, /* @ts-ignore */
|
|
103
|
+
...(ngDevMode ? [{ debugName: "party" }] : /* istanbul ignore next */ []));
|
|
104
|
+
/** Datos sueltos de la cabecera (vencimiento, forma de pago…). */
|
|
105
|
+
this.fields = input([], /* @ts-ignore */
|
|
106
|
+
...(ngDevMode ? [{ debugName: "fields" }] : /* istanbul ignore next */ []));
|
|
107
|
+
this.lines = input([], /* @ts-ignore */
|
|
108
|
+
...(ngDevMode ? [{ debugName: "lines" }] : /* istanbul ignore next */ []));
|
|
109
|
+
/** Retenciones (negativas) u otros cargos después de impuestos. */
|
|
110
|
+
this.adjustments = input([], /* @ts-ignore */
|
|
111
|
+
...(ngDevMode ? [{ debugName: "adjustments" }] : /* istanbul ignore next */ []));
|
|
112
|
+
/** Nombre del impuesto en los totales («IVA»). */
|
|
113
|
+
this.taxLabel = input('IVA', /* @ts-ignore */
|
|
114
|
+
...(ngDevMode ? [{ debugName: "taxLabel" }] : /* istanbul ignore next */ []));
|
|
115
|
+
/** Muestra el total en letras. */
|
|
116
|
+
this.words = input(true, { ...(ngDevMode ? { debugName: "words" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
117
|
+
this.notes = input('', /* @ts-ignore */
|
|
118
|
+
...(ngDevMode ? [{ debugName: "notes" }] : /* istanbul ignore next */ []));
|
|
119
|
+
/** Rótulos de las firmas («Elaboró», «Aprobó», «Recibí conforme»). */
|
|
120
|
+
this.signatures = input([], /* @ts-ignore */
|
|
121
|
+
...(ngDevMode ? [{ debugName: "signatures" }] : /* istanbul ignore next */ []));
|
|
122
|
+
this.footer = input('', /* @ts-ignore */
|
|
123
|
+
...(ngDevMode ? [{ debugName: "footer" }] : /* istanbul ignore next */ []));
|
|
124
|
+
this.currency = input(undefined, /* @ts-ignore */
|
|
125
|
+
...(ngDevMode ? [{ debugName: "currency" }] : /* istanbul ignore next */ []));
|
|
126
|
+
/** Subtotal, descuentos, impuestos por tarifa, ajustes y total. */
|
|
127
|
+
this.totals = computed(() => documentTotals(this.lines(), this.adjustments()), /* @ts-ignore */
|
|
128
|
+
...(ngDevMode ? [{ debugName: "totals" }] : /* istanbul ignore next */ []));
|
|
129
|
+
this.hasCodes = computed(() => this.lines().some((l) => l.code), /* @ts-ignore */
|
|
130
|
+
...(ngDevMode ? [{ debugName: "hasCodes" }] : /* istanbul ignore next */ []));
|
|
131
|
+
this.hasDiscounts = computed(() => this.lines().some((l) => l.discount), /* @ts-ignore */
|
|
132
|
+
...(ngDevMode ? [{ debugName: "hasDiscounts" }] : /* istanbul ignore next */ []));
|
|
133
|
+
this.hasTaxes = computed(() => this.lines().some((l) => l.tax), /* @ts-ignore */
|
|
134
|
+
...(ngDevMode ? [{ debugName: "hasTaxes" }] : /* istanbul ignore next */ []));
|
|
135
|
+
this.locale = computed(() => this.config.numberLocale ?? this.t().intlLocale, /* @ts-ignore */
|
|
136
|
+
...(ngDevMode ? [{ debugName: "locale" }] : /* istanbul ignore next */ []));
|
|
137
|
+
this.code = computed(() => this.currency() ?? this.config.currency ?? 'COP', /* @ts-ignore */
|
|
138
|
+
...(ngDevMode ? [{ debugName: "code" }] : /* istanbul ignore next */ []));
|
|
139
|
+
this.inWords = computed(() => cbAmountInWords(this.totals().total, { language: this.t().intlLocale.startsWith('en') ? 'en' : 'es', currency: this.code() }), /* @ts-ignore */
|
|
140
|
+
...(ngDevMode ? [{ debugName: "inWords" }] : /* istanbul ignore next */ []));
|
|
141
|
+
}
|
|
142
|
+
join(...parts) {
|
|
143
|
+
return parts.filter((p) => !!p).join(' · ');
|
|
144
|
+
}
|
|
145
|
+
money(v) {
|
|
146
|
+
return cbFormatAmount(v, this.locale(), { currency: this.code(), negative: 'minus' });
|
|
147
|
+
}
|
|
148
|
+
qty(v) {
|
|
149
|
+
return new Intl.NumberFormat(this.locale(), { maximumFractionDigits: 3 }).format(v);
|
|
150
|
+
}
|
|
151
|
+
pct(v) {
|
|
152
|
+
return new Intl.NumberFormat(this.locale(), { style: 'percent', maximumFractionDigits: 2 }).format(v);
|
|
153
|
+
}
|
|
154
|
+
longDate(d) {
|
|
155
|
+
return new Intl.DateTimeFormat(this.t().intlLocale, { dateStyle: 'long' }).format(d);
|
|
156
|
+
}
|
|
157
|
+
/** Imprime solo el documento (o lo guarda como PDF desde el diálogo de impresión). */
|
|
158
|
+
print() {
|
|
159
|
+
cbPrintElement(this.sheet().nativeElement, [this.title(), this.number()].filter(Boolean).join(' '));
|
|
160
|
+
}
|
|
161
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: CbDocument, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
162
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: CbDocument, isStandalone: true, selector: "cb-document", inputs: { title: { classPropertyName: "title", publicName: "title", isSignal: true, isRequired: false, transformFunction: null }, number: { classPropertyName: "number", publicName: "number", isSignal: true, isRequired: false, transformFunction: null }, date: { classPropertyName: "date", publicName: "date", isSignal: true, isRequired: false, transformFunction: null }, issuer: { classPropertyName: "issuer", publicName: "issuer", isSignal: true, isRequired: false, transformFunction: null }, party: { classPropertyName: "party", publicName: "party", isSignal: true, isRequired: false, transformFunction: null }, fields: { classPropertyName: "fields", publicName: "fields", isSignal: true, isRequired: false, transformFunction: null }, lines: { classPropertyName: "lines", publicName: "lines", isSignal: true, isRequired: false, transformFunction: null }, adjustments: { classPropertyName: "adjustments", publicName: "adjustments", isSignal: true, isRequired: false, transformFunction: null }, taxLabel: { classPropertyName: "taxLabel", publicName: "taxLabel", isSignal: true, isRequired: false, transformFunction: null }, words: { classPropertyName: "words", publicName: "words", isSignal: true, isRequired: false, transformFunction: null }, notes: { classPropertyName: "notes", publicName: "notes", isSignal: true, isRequired: false, transformFunction: null }, signatures: { classPropertyName: "signatures", publicName: "signatures", isSignal: true, isRequired: false, transformFunction: null }, footer: { classPropertyName: "footer", publicName: "footer", isSignal: true, isRequired: false, transformFunction: null }, currency: { classPropertyName: "currency", publicName: "currency", isSignal: true, isRequired: false, transformFunction: null } }, host: { classAttribute: "cb-document" }, viewQueries: [{ propertyName: "sheet", first: true, predicate: ["sheet"], descendants: true, isSignal: true }], ngImport: i0, template: `
|
|
163
|
+
<article #sheet class="cb-doc" [attr.aria-label]="title() + (number() ? ' ' + number() : '')">
|
|
164
|
+
<header class="cb-doc__head">
|
|
165
|
+
<div class="cb-doc__issuer">
|
|
166
|
+
@if (issuer().logo) {
|
|
167
|
+
<img class="cb-doc__logo" [src]="issuer().logo" alt="" />
|
|
168
|
+
}
|
|
169
|
+
<div>
|
|
170
|
+
<p class="cb-doc__issuer-name">{{ issuer().name }}</p>
|
|
171
|
+
@if (issuer().taxId) {
|
|
172
|
+
<p>{{ t().documentTaxId }} {{ issuer().taxId }}</p>
|
|
173
|
+
}
|
|
174
|
+
@if (issuer().address) {
|
|
175
|
+
<p>{{ issuer().address }}</p>
|
|
176
|
+
}
|
|
177
|
+
@if (issuer().phone || issuer().email) {
|
|
178
|
+
<p>{{ join(issuer().phone, issuer().email) }}</p>
|
|
179
|
+
}
|
|
180
|
+
</div>
|
|
181
|
+
</div>
|
|
182
|
+
<div class="cb-doc__title-box">
|
|
183
|
+
<h2 class="cb-doc__title">{{ title() }}</h2>
|
|
184
|
+
@if (number()) {
|
|
185
|
+
<p class="cb-doc__number">{{ number() }}</p>
|
|
186
|
+
}
|
|
187
|
+
@if (date()) {
|
|
188
|
+
<p>{{ t().documentDate }}: {{ longDate(date()!) }}</p>
|
|
189
|
+
}
|
|
190
|
+
</div>
|
|
191
|
+
</header>
|
|
192
|
+
|
|
193
|
+
@if (party() || fields().length) {
|
|
194
|
+
<section class="cb-doc__meta">
|
|
195
|
+
@if (party(); as p) {
|
|
196
|
+
<div class="cb-doc__party">
|
|
197
|
+
<p class="cb-doc__caption">{{ p.label || t().documentParty }}</p>
|
|
198
|
+
<p class="cb-doc__party-name">{{ p.name }}</p>
|
|
199
|
+
@if (p.taxId) {
|
|
200
|
+
<p>{{ t().documentTaxId }} {{ p.taxId }}</p>
|
|
201
|
+
}
|
|
202
|
+
@if (p.address) {
|
|
203
|
+
<p>{{ p.address }}</p>
|
|
204
|
+
}
|
|
205
|
+
@if (p.phone || p.email) {
|
|
206
|
+
<p>{{ join(p.phone, p.email) }}</p>
|
|
207
|
+
}
|
|
208
|
+
</div>
|
|
209
|
+
}
|
|
210
|
+
@if (fields().length) {
|
|
211
|
+
<dl class="cb-doc__fields">
|
|
212
|
+
@for (f of fields(); track f.label) {
|
|
213
|
+
<div>
|
|
214
|
+
<dt>{{ f.label }}</dt>
|
|
215
|
+
<dd>{{ f.value }}</dd>
|
|
216
|
+
</div>
|
|
217
|
+
}
|
|
218
|
+
</dl>
|
|
219
|
+
}
|
|
220
|
+
</section>
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
@if (lines().length) {
|
|
224
|
+
<table class="cb-doc__lines" role="table">
|
|
225
|
+
<thead role="rowgroup">
|
|
226
|
+
<tr role="row">
|
|
227
|
+
@if (hasCodes()) {
|
|
228
|
+
<th scope="col" role="columnheader">{{ t().documentCode }}</th>
|
|
229
|
+
}
|
|
230
|
+
<th scope="col" role="columnheader">{{ t().documentDescription }}</th>
|
|
231
|
+
<th scope="col" role="columnheader" class="cb-doc__num">{{ t().documentQuantity }}</th>
|
|
232
|
+
<th scope="col" role="columnheader" class="cb-doc__num">{{ t().documentUnitPrice }}</th>
|
|
233
|
+
@if (hasDiscounts()) {
|
|
234
|
+
<th scope="col" role="columnheader" class="cb-doc__num">{{ t().documentDiscount }}</th>
|
|
235
|
+
}
|
|
236
|
+
@if (hasTaxes()) {
|
|
237
|
+
<th scope="col" role="columnheader" class="cb-doc__num">{{ t().documentTax }}</th>
|
|
238
|
+
}
|
|
239
|
+
<th scope="col" role="columnheader" class="cb-doc__num">{{ t().documentAmount }}</th>
|
|
240
|
+
</tr>
|
|
241
|
+
</thead>
|
|
242
|
+
<tbody role="rowgroup">
|
|
243
|
+
@for (l of lines(); track $index) {
|
|
244
|
+
<tr role="row">
|
|
245
|
+
@if (hasCodes()) {
|
|
246
|
+
<td class="cb-doc__code" role="cell" [attr.data-label]="t().documentCode">{{ l.code }}</td>
|
|
247
|
+
}
|
|
248
|
+
<td class="cb-doc__desc" role="cell">{{ l.description }}</td>
|
|
249
|
+
<td class="cb-doc__num" role="cell" [attr.data-label]="t().documentQuantity">{{ qty(l.quantity) }}</td>
|
|
250
|
+
<td class="cb-doc__num" role="cell" [attr.data-label]="t().documentUnitPrice">{{ money(l.unitPrice) }}</td>
|
|
251
|
+
@if (hasDiscounts()) {
|
|
252
|
+
<td class="cb-doc__num" role="cell" [attr.data-label]="t().documentDiscount">{{ l.discount ? pct(l.discount) : '' }}</td>
|
|
253
|
+
}
|
|
254
|
+
@if (hasTaxes()) {
|
|
255
|
+
<td class="cb-doc__num" role="cell" [attr.data-label]="t().documentTax">{{ l.tax ? pct(l.tax) : '' }}</td>
|
|
256
|
+
}
|
|
257
|
+
<td class="cb-doc__num cb-doc__amount" role="cell" [attr.data-label]="t().documentAmount">{{ money(l.quantity * l.unitPrice * (1 - (l.discount ?? 0))) }}</td>
|
|
258
|
+
</tr>
|
|
259
|
+
}
|
|
260
|
+
</tbody>
|
|
261
|
+
</table>
|
|
262
|
+
|
|
263
|
+
<div class="cb-doc__bottom">
|
|
264
|
+
<div class="cb-doc__left">
|
|
265
|
+
@if (words()) {
|
|
266
|
+
<p class="cb-doc__caption">{{ t().documentInWords }}</p>
|
|
267
|
+
<p class="cb-doc__words">{{ inWords() }}</p>
|
|
268
|
+
}
|
|
269
|
+
@if (notes()) {
|
|
270
|
+
<p class="cb-doc__caption">{{ t().documentNotes }}</p>
|
|
271
|
+
<p class="cb-doc__notes">{{ notes() }}</p>
|
|
272
|
+
}
|
|
273
|
+
</div>
|
|
274
|
+
<dl class="cb-doc__totals">
|
|
275
|
+
<div>
|
|
276
|
+
<dt>{{ t().documentSubtotal }}</dt>
|
|
277
|
+
<dd>{{ money(totals().subtotal) }}</dd>
|
|
278
|
+
</div>
|
|
279
|
+
@if (totals().discount) {
|
|
280
|
+
<div>
|
|
281
|
+
<dt>{{ t().documentDiscount }}</dt>
|
|
282
|
+
<dd>{{ money(-totals().discount) }}</dd>
|
|
283
|
+
</div>
|
|
284
|
+
}
|
|
285
|
+
@for (tx of totals().taxes; track tx.rate) {
|
|
286
|
+
<div>
|
|
287
|
+
<dt>{{ taxLabel() }} {{ pct(tx.rate) }}</dt>
|
|
288
|
+
<dd>{{ money(tx.amount) }}</dd>
|
|
289
|
+
</div>
|
|
290
|
+
}
|
|
291
|
+
@for (a of totals().adjustments; track a.label) {
|
|
292
|
+
<div>
|
|
293
|
+
<dt>{{ a.label }}</dt>
|
|
294
|
+
<dd>{{ money(a.amount) }}</dd>
|
|
295
|
+
</div>
|
|
296
|
+
}
|
|
297
|
+
<div class="cb-doc__grand">
|
|
298
|
+
<dt>{{ t().documentTotal }}</dt>
|
|
299
|
+
<dd>{{ money(totals().total) }}</dd>
|
|
300
|
+
</div>
|
|
301
|
+
</dl>
|
|
302
|
+
</div>
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
<ng-content />
|
|
306
|
+
|
|
307
|
+
@if (signatures().length) {
|
|
308
|
+
<div class="cb-doc__signs">
|
|
309
|
+
@for (s of signatures(); track $index) {
|
|
310
|
+
<div class="cb-doc__sign">
|
|
311
|
+
<span class="cb-doc__sign-line"></span>
|
|
312
|
+
<span>{{ s }}</span>
|
|
313
|
+
</div>
|
|
314
|
+
}
|
|
315
|
+
</div>
|
|
316
|
+
}
|
|
317
|
+
@if (footer()) {
|
|
318
|
+
<footer class="cb-doc__footer">{{ footer() }}</footer>
|
|
319
|
+
}
|
|
320
|
+
</article>
|
|
321
|
+
`, isInline: true, styles: [":host{display:block;min-width:0;container-type:inline-size}.cb-doc{display:grid;gap:1.25rem;max-width:52rem;padding:2rem 2.25rem;border:1px solid var(--cb-color-border);border-radius:var(--cb-radius-md);background:#fff;box-shadow:var(--cb-shadow-md);color:#111827;font-family:var(--cb-font-sans);font-size:.8125rem;line-height:1.45}.cb-doc p{margin:0}.cb-doc__head{display:flex;flex-wrap:wrap;justify-content:space-between;gap:1rem;padding-bottom:1rem;border-bottom:2px solid #111827}.cb-doc__issuer{display:flex;gap:.85rem;color:#4b5563}.cb-doc__logo{width:3.5rem;height:3.5rem;object-fit:contain}.cb-doc__issuer-name{color:#111827;font-size:1rem;font-weight:700}.cb-doc__title-box{text-align:end;color:#4b5563}.cb-doc__title{margin:0;color:#111827;font-size:1.15rem;font-weight:700;text-transform:uppercase;letter-spacing:.03em}.cb-doc__number{color:#111827;font-size:1rem;font-variant-numeric:tabular-nums;font-weight:600}.cb-doc__meta{display:flex;flex-wrap:wrap;justify-content:space-between;gap:1rem 2rem}.cb-doc__caption{color:#6b7280;font-size:.7rem;font-weight:600;text-transform:uppercase;letter-spacing:.05em}.cb-doc__party{color:#4b5563}.cb-doc__party-name{color:#111827;font-size:.9rem;font-weight:600}.cb-doc__fields{display:grid;grid-template-columns:auto auto;gap:.2rem 1rem;margin:0}.cb-doc__fields>div{display:contents}.cb-doc__fields dt{color:#6b7280}.cb-doc__fields dd{margin:0;font-weight:500;text-align:end}.cb-doc__lines{width:100%;border-collapse:collapse}.cb-doc__lines th,.cb-doc__lines td{padding:.45rem .5rem;border-bottom:1px solid #e5e7eb;text-align:start;vertical-align:top}.cb-doc__lines thead th{border-bottom:1.5px solid #111827;color:#4b5563;font-size:.7rem;font-weight:600;text-transform:uppercase;letter-spacing:.04em}.cb-doc .cb-doc__num{text-align:end;font-variant-numeric:tabular-nums;white-space:nowrap}.cb-doc__code{color:#6b7280;font-variant-numeric:tabular-nums}.cb-doc__bottom{display:flex;flex-wrap:wrap;justify-content:space-between;gap:1.25rem 2rem}.cb-doc__left{display:grid;flex:1 1 18rem;align-content:start;gap:.2rem}.cb-doc__words{margin-bottom:.6rem!important;font-weight:600}.cb-doc__notes{color:#4b5563;white-space:pre-line}.cb-doc__totals{display:grid;flex:0 1 17rem;gap:.25rem;margin:0}.cb-doc__totals>div{display:flex;justify-content:space-between;gap:1rem}.cb-doc__totals dt{color:#4b5563}.cb-doc__totals dd{margin:0;font-variant-numeric:tabular-nums}.cb-doc__grand{margin-top:.25rem;padding-top:.45rem;border-top:2px solid #111827;font-size:1rem}.cb-doc__grand dt,.cb-doc__grand dd{color:#111827;font-weight:700}.cb-doc__signs{display:grid;grid-template-columns:repeat(auto-fit,minmax(10rem,1fr));gap:2rem;margin-top:2.5rem}.cb-doc__sign{display:grid;gap:.3rem;color:#4b5563;text-align:center}.cb-doc__sign-line{border-top:1px solid #111827}.cb-doc__footer{padding-top:.75rem;border-top:1px solid #e5e7eb;color:#6b7280;font-size:.7rem;text-align:center}@container (max-width: 36rem){.cb-doc{padding:1.25rem 1rem}.cb-doc__title-box{text-align:start}.cb-doc__lines thead{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}.cb-doc__lines,.cb-doc__lines tbody,.cb-doc__lines tr,.cb-doc__lines td{display:block}.cb-doc__lines tr{display:flex;flex-direction:column;padding:.55rem 0;border-bottom:1px solid #e5e7eb}.cb-doc__lines td{display:flex;justify-content:space-between;gap:1rem;padding:.1rem 0;border:0}.cb-doc__lines td:empty{display:none}.cb-doc__lines td[data-label]:before{content:attr(data-label);color:#6b7280;font-weight:400;text-align:start;white-space:normal}.cb-doc__lines .cb-doc__desc{order:-1;font-weight:600}.cb-doc__lines .cb-doc__amount{font-weight:600}.cb-doc__totals{flex-basis:100%}}@media print{.cb-doc{max-width:none;padding:0;border:0;box-shadow:none}}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
322
|
+
}
|
|
323
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: CbDocument, decorators: [{
|
|
324
|
+
type: Component,
|
|
325
|
+
args: [{ selector: 'cb-document', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.Emulated, host: { class: 'cb-document' }, template: `
|
|
326
|
+
<article #sheet class="cb-doc" [attr.aria-label]="title() + (number() ? ' ' + number() : '')">
|
|
327
|
+
<header class="cb-doc__head">
|
|
328
|
+
<div class="cb-doc__issuer">
|
|
329
|
+
@if (issuer().logo) {
|
|
330
|
+
<img class="cb-doc__logo" [src]="issuer().logo" alt="" />
|
|
331
|
+
}
|
|
332
|
+
<div>
|
|
333
|
+
<p class="cb-doc__issuer-name">{{ issuer().name }}</p>
|
|
334
|
+
@if (issuer().taxId) {
|
|
335
|
+
<p>{{ t().documentTaxId }} {{ issuer().taxId }}</p>
|
|
336
|
+
}
|
|
337
|
+
@if (issuer().address) {
|
|
338
|
+
<p>{{ issuer().address }}</p>
|
|
339
|
+
}
|
|
340
|
+
@if (issuer().phone || issuer().email) {
|
|
341
|
+
<p>{{ join(issuer().phone, issuer().email) }}</p>
|
|
342
|
+
}
|
|
343
|
+
</div>
|
|
344
|
+
</div>
|
|
345
|
+
<div class="cb-doc__title-box">
|
|
346
|
+
<h2 class="cb-doc__title">{{ title() }}</h2>
|
|
347
|
+
@if (number()) {
|
|
348
|
+
<p class="cb-doc__number">{{ number() }}</p>
|
|
349
|
+
}
|
|
350
|
+
@if (date()) {
|
|
351
|
+
<p>{{ t().documentDate }}: {{ longDate(date()!) }}</p>
|
|
352
|
+
}
|
|
353
|
+
</div>
|
|
354
|
+
</header>
|
|
355
|
+
|
|
356
|
+
@if (party() || fields().length) {
|
|
357
|
+
<section class="cb-doc__meta">
|
|
358
|
+
@if (party(); as p) {
|
|
359
|
+
<div class="cb-doc__party">
|
|
360
|
+
<p class="cb-doc__caption">{{ p.label || t().documentParty }}</p>
|
|
361
|
+
<p class="cb-doc__party-name">{{ p.name }}</p>
|
|
362
|
+
@if (p.taxId) {
|
|
363
|
+
<p>{{ t().documentTaxId }} {{ p.taxId }}</p>
|
|
364
|
+
}
|
|
365
|
+
@if (p.address) {
|
|
366
|
+
<p>{{ p.address }}</p>
|
|
367
|
+
}
|
|
368
|
+
@if (p.phone || p.email) {
|
|
369
|
+
<p>{{ join(p.phone, p.email) }}</p>
|
|
370
|
+
}
|
|
371
|
+
</div>
|
|
372
|
+
}
|
|
373
|
+
@if (fields().length) {
|
|
374
|
+
<dl class="cb-doc__fields">
|
|
375
|
+
@for (f of fields(); track f.label) {
|
|
376
|
+
<div>
|
|
377
|
+
<dt>{{ f.label }}</dt>
|
|
378
|
+
<dd>{{ f.value }}</dd>
|
|
379
|
+
</div>
|
|
380
|
+
}
|
|
381
|
+
</dl>
|
|
382
|
+
}
|
|
383
|
+
</section>
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
@if (lines().length) {
|
|
387
|
+
<table class="cb-doc__lines" role="table">
|
|
388
|
+
<thead role="rowgroup">
|
|
389
|
+
<tr role="row">
|
|
390
|
+
@if (hasCodes()) {
|
|
391
|
+
<th scope="col" role="columnheader">{{ t().documentCode }}</th>
|
|
392
|
+
}
|
|
393
|
+
<th scope="col" role="columnheader">{{ t().documentDescription }}</th>
|
|
394
|
+
<th scope="col" role="columnheader" class="cb-doc__num">{{ t().documentQuantity }}</th>
|
|
395
|
+
<th scope="col" role="columnheader" class="cb-doc__num">{{ t().documentUnitPrice }}</th>
|
|
396
|
+
@if (hasDiscounts()) {
|
|
397
|
+
<th scope="col" role="columnheader" class="cb-doc__num">{{ t().documentDiscount }}</th>
|
|
398
|
+
}
|
|
399
|
+
@if (hasTaxes()) {
|
|
400
|
+
<th scope="col" role="columnheader" class="cb-doc__num">{{ t().documentTax }}</th>
|
|
401
|
+
}
|
|
402
|
+
<th scope="col" role="columnheader" class="cb-doc__num">{{ t().documentAmount }}</th>
|
|
403
|
+
</tr>
|
|
404
|
+
</thead>
|
|
405
|
+
<tbody role="rowgroup">
|
|
406
|
+
@for (l of lines(); track $index) {
|
|
407
|
+
<tr role="row">
|
|
408
|
+
@if (hasCodes()) {
|
|
409
|
+
<td class="cb-doc__code" role="cell" [attr.data-label]="t().documentCode">{{ l.code }}</td>
|
|
410
|
+
}
|
|
411
|
+
<td class="cb-doc__desc" role="cell">{{ l.description }}</td>
|
|
412
|
+
<td class="cb-doc__num" role="cell" [attr.data-label]="t().documentQuantity">{{ qty(l.quantity) }}</td>
|
|
413
|
+
<td class="cb-doc__num" role="cell" [attr.data-label]="t().documentUnitPrice">{{ money(l.unitPrice) }}</td>
|
|
414
|
+
@if (hasDiscounts()) {
|
|
415
|
+
<td class="cb-doc__num" role="cell" [attr.data-label]="t().documentDiscount">{{ l.discount ? pct(l.discount) : '' }}</td>
|
|
416
|
+
}
|
|
417
|
+
@if (hasTaxes()) {
|
|
418
|
+
<td class="cb-doc__num" role="cell" [attr.data-label]="t().documentTax">{{ l.tax ? pct(l.tax) : '' }}</td>
|
|
419
|
+
}
|
|
420
|
+
<td class="cb-doc__num cb-doc__amount" role="cell" [attr.data-label]="t().documentAmount">{{ money(l.quantity * l.unitPrice * (1 - (l.discount ?? 0))) }}</td>
|
|
421
|
+
</tr>
|
|
422
|
+
}
|
|
423
|
+
</tbody>
|
|
424
|
+
</table>
|
|
425
|
+
|
|
426
|
+
<div class="cb-doc__bottom">
|
|
427
|
+
<div class="cb-doc__left">
|
|
428
|
+
@if (words()) {
|
|
429
|
+
<p class="cb-doc__caption">{{ t().documentInWords }}</p>
|
|
430
|
+
<p class="cb-doc__words">{{ inWords() }}</p>
|
|
431
|
+
}
|
|
432
|
+
@if (notes()) {
|
|
433
|
+
<p class="cb-doc__caption">{{ t().documentNotes }}</p>
|
|
434
|
+
<p class="cb-doc__notes">{{ notes() }}</p>
|
|
435
|
+
}
|
|
436
|
+
</div>
|
|
437
|
+
<dl class="cb-doc__totals">
|
|
438
|
+
<div>
|
|
439
|
+
<dt>{{ t().documentSubtotal }}</dt>
|
|
440
|
+
<dd>{{ money(totals().subtotal) }}</dd>
|
|
441
|
+
</div>
|
|
442
|
+
@if (totals().discount) {
|
|
443
|
+
<div>
|
|
444
|
+
<dt>{{ t().documentDiscount }}</dt>
|
|
445
|
+
<dd>{{ money(-totals().discount) }}</dd>
|
|
446
|
+
</div>
|
|
447
|
+
}
|
|
448
|
+
@for (tx of totals().taxes; track tx.rate) {
|
|
449
|
+
<div>
|
|
450
|
+
<dt>{{ taxLabel() }} {{ pct(tx.rate) }}</dt>
|
|
451
|
+
<dd>{{ money(tx.amount) }}</dd>
|
|
452
|
+
</div>
|
|
453
|
+
}
|
|
454
|
+
@for (a of totals().adjustments; track a.label) {
|
|
455
|
+
<div>
|
|
456
|
+
<dt>{{ a.label }}</dt>
|
|
457
|
+
<dd>{{ money(a.amount) }}</dd>
|
|
458
|
+
</div>
|
|
459
|
+
}
|
|
460
|
+
<div class="cb-doc__grand">
|
|
461
|
+
<dt>{{ t().documentTotal }}</dt>
|
|
462
|
+
<dd>{{ money(totals().total) }}</dd>
|
|
463
|
+
</div>
|
|
464
|
+
</dl>
|
|
465
|
+
</div>
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
<ng-content />
|
|
469
|
+
|
|
470
|
+
@if (signatures().length) {
|
|
471
|
+
<div class="cb-doc__signs">
|
|
472
|
+
@for (s of signatures(); track $index) {
|
|
473
|
+
<div class="cb-doc__sign">
|
|
474
|
+
<span class="cb-doc__sign-line"></span>
|
|
475
|
+
<span>{{ s }}</span>
|
|
476
|
+
</div>
|
|
477
|
+
}
|
|
478
|
+
</div>
|
|
479
|
+
}
|
|
480
|
+
@if (footer()) {
|
|
481
|
+
<footer class="cb-doc__footer">{{ footer() }}</footer>
|
|
482
|
+
}
|
|
483
|
+
</article>
|
|
484
|
+
`, styles: [":host{display:block;min-width:0;container-type:inline-size}.cb-doc{display:grid;gap:1.25rem;max-width:52rem;padding:2rem 2.25rem;border:1px solid var(--cb-color-border);border-radius:var(--cb-radius-md);background:#fff;box-shadow:var(--cb-shadow-md);color:#111827;font-family:var(--cb-font-sans);font-size:.8125rem;line-height:1.45}.cb-doc p{margin:0}.cb-doc__head{display:flex;flex-wrap:wrap;justify-content:space-between;gap:1rem;padding-bottom:1rem;border-bottom:2px solid #111827}.cb-doc__issuer{display:flex;gap:.85rem;color:#4b5563}.cb-doc__logo{width:3.5rem;height:3.5rem;object-fit:contain}.cb-doc__issuer-name{color:#111827;font-size:1rem;font-weight:700}.cb-doc__title-box{text-align:end;color:#4b5563}.cb-doc__title{margin:0;color:#111827;font-size:1.15rem;font-weight:700;text-transform:uppercase;letter-spacing:.03em}.cb-doc__number{color:#111827;font-size:1rem;font-variant-numeric:tabular-nums;font-weight:600}.cb-doc__meta{display:flex;flex-wrap:wrap;justify-content:space-between;gap:1rem 2rem}.cb-doc__caption{color:#6b7280;font-size:.7rem;font-weight:600;text-transform:uppercase;letter-spacing:.05em}.cb-doc__party{color:#4b5563}.cb-doc__party-name{color:#111827;font-size:.9rem;font-weight:600}.cb-doc__fields{display:grid;grid-template-columns:auto auto;gap:.2rem 1rem;margin:0}.cb-doc__fields>div{display:contents}.cb-doc__fields dt{color:#6b7280}.cb-doc__fields dd{margin:0;font-weight:500;text-align:end}.cb-doc__lines{width:100%;border-collapse:collapse}.cb-doc__lines th,.cb-doc__lines td{padding:.45rem .5rem;border-bottom:1px solid #e5e7eb;text-align:start;vertical-align:top}.cb-doc__lines thead th{border-bottom:1.5px solid #111827;color:#4b5563;font-size:.7rem;font-weight:600;text-transform:uppercase;letter-spacing:.04em}.cb-doc .cb-doc__num{text-align:end;font-variant-numeric:tabular-nums;white-space:nowrap}.cb-doc__code{color:#6b7280;font-variant-numeric:tabular-nums}.cb-doc__bottom{display:flex;flex-wrap:wrap;justify-content:space-between;gap:1.25rem 2rem}.cb-doc__left{display:grid;flex:1 1 18rem;align-content:start;gap:.2rem}.cb-doc__words{margin-bottom:.6rem!important;font-weight:600}.cb-doc__notes{color:#4b5563;white-space:pre-line}.cb-doc__totals{display:grid;flex:0 1 17rem;gap:.25rem;margin:0}.cb-doc__totals>div{display:flex;justify-content:space-between;gap:1rem}.cb-doc__totals dt{color:#4b5563}.cb-doc__totals dd{margin:0;font-variant-numeric:tabular-nums}.cb-doc__grand{margin-top:.25rem;padding-top:.45rem;border-top:2px solid #111827;font-size:1rem}.cb-doc__grand dt,.cb-doc__grand dd{color:#111827;font-weight:700}.cb-doc__signs{display:grid;grid-template-columns:repeat(auto-fit,minmax(10rem,1fr));gap:2rem;margin-top:2.5rem}.cb-doc__sign{display:grid;gap:.3rem;color:#4b5563;text-align:center}.cb-doc__sign-line{border-top:1px solid #111827}.cb-doc__footer{padding-top:.75rem;border-top:1px solid #e5e7eb;color:#6b7280;font-size:.7rem;text-align:center}@container (max-width: 36rem){.cb-doc{padding:1.25rem 1rem}.cb-doc__title-box{text-align:start}.cb-doc__lines thead{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}.cb-doc__lines,.cb-doc__lines tbody,.cb-doc__lines tr,.cb-doc__lines td{display:block}.cb-doc__lines tr{display:flex;flex-direction:column;padding:.55rem 0;border-bottom:1px solid #e5e7eb}.cb-doc__lines td{display:flex;justify-content:space-between;gap:1rem;padding:.1rem 0;border:0}.cb-doc__lines td:empty{display:none}.cb-doc__lines td[data-label]:before{content:attr(data-label);color:#6b7280;font-weight:400;text-align:start;white-space:normal}.cb-doc__lines .cb-doc__desc{order:-1;font-weight:600}.cb-doc__lines .cb-doc__amount{font-weight:600}.cb-doc__totals{flex-basis:100%}}@media print{.cb-doc{max-width:none;padding:0;border:0;box-shadow:none}}\n"] }]
|
|
485
|
+
}], propDecorators: { sheet: [{ type: i0.ViewChild, args: ['sheet', { isSignal: true }] }], title: [{ type: i0.Input, args: [{ isSignal: true, alias: "title", required: false }] }], number: [{ type: i0.Input, args: [{ isSignal: true, alias: "number", required: false }] }], date: [{ type: i0.Input, args: [{ isSignal: true, alias: "date", required: false }] }], issuer: [{ type: i0.Input, args: [{ isSignal: true, alias: "issuer", required: false }] }], party: [{ type: i0.Input, args: [{ isSignal: true, alias: "party", required: false }] }], fields: [{ type: i0.Input, args: [{ isSignal: true, alias: "fields", required: false }] }], lines: [{ type: i0.Input, args: [{ isSignal: true, alias: "lines", required: false }] }], adjustments: [{ type: i0.Input, args: [{ isSignal: true, alias: "adjustments", required: false }] }], taxLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "taxLabel", required: false }] }], words: [{ type: i0.Input, args: [{ isSignal: true, alias: "words", required: false }] }], notes: [{ type: i0.Input, args: [{ isSignal: true, alias: "notes", required: false }] }], signatures: [{ type: i0.Input, args: [{ isSignal: true, alias: "signatures", required: false }] }], footer: [{ type: i0.Input, args: [{ isSignal: true, alias: "footer", required: false }] }], currency: [{ type: i0.Input, args: [{ isSignal: true, alias: "currency", required: false }] }] } });
|
|
486
|
+
|
|
487
|
+
/*
|
|
488
|
+
* Public API Surface de @caribeng/ui/document
|
|
489
|
+
*/
|
|
490
|
+
|
|
491
|
+
/**
|
|
492
|
+
* Generated bundle index. Do not edit.
|
|
493
|
+
*/
|
|
494
|
+
|
|
495
|
+
export { CbDocument, cbPrintElement, documentTotals };
|
|
@@ -3,7 +3,7 @@ import { input, model, inject, ElementRef, computed, ViewEncapsulation, ChangeDe
|
|
|
3
3
|
import { injectCbTranslation, cbFormat } from '@caribeng/ui';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
* Dots-indicator
|
|
6
|
+
* Dots-indicator: indicador de paginación por puntos. El punto
|
|
7
7
|
* activo se alarga; cada punto es navegable.
|
|
8
8
|
*
|
|
9
9
|
* @example
|
|
@@ -43,50 +43,50 @@ class CbDotsIndicator {
|
|
|
43
43
|
this.host.nativeElement.querySelectorAll('.cb-dots-indicator__dot')[target]?.focus();
|
|
44
44
|
}
|
|
45
45
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: CbDotsIndicator, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
46
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: CbDotsIndicator, isStandalone: true, selector: "cb-dots-indicator", inputs: { count: { classPropertyName: "count", publicName: "count", isSignal: true, isRequired: false, transformFunction: null }, activeIndex: { classPropertyName: "activeIndex", publicName: "activeIndex", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { activeIndex: "activeIndexChange" }, host: { classAttribute: "cb-dots-indicator-host" }, ngImport: i0, template: `
|
|
47
|
-
<div
|
|
48
|
-
class="cb-dots-indicator"
|
|
49
|
-
role="tablist"
|
|
50
|
-
[attr.aria-label]="t().pageIndicator"
|
|
51
|
-
(keydown)="onKeydown($event)"
|
|
52
|
-
>
|
|
53
|
-
@for (idx of indices(); track idx) {
|
|
54
|
-
<button
|
|
55
|
-
type="button"
|
|
56
|
-
class="cb-dots-indicator__dot"
|
|
57
|
-
[class.cb-dots-indicator__dot--active]="activeIndex() === idx"
|
|
58
|
-
role="tab"
|
|
59
|
-
[attr.aria-selected]="activeIndex() === idx"
|
|
60
|
-
[attr.tabindex]="activeIndex() === idx ? 0 : -1"
|
|
61
|
-
[attr.aria-label]="fmt(t().page, idx + 1)"
|
|
62
|
-
(click)="activeIndex.set(idx)"
|
|
63
|
-
></button>
|
|
64
|
-
}
|
|
65
|
-
</div>
|
|
46
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: CbDotsIndicator, isStandalone: true, selector: "cb-dots-indicator", inputs: { count: { classPropertyName: "count", publicName: "count", isSignal: true, isRequired: false, transformFunction: null }, activeIndex: { classPropertyName: "activeIndex", publicName: "activeIndex", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { activeIndex: "activeIndexChange" }, host: { classAttribute: "cb-dots-indicator-host" }, ngImport: i0, template: `
|
|
47
|
+
<div
|
|
48
|
+
class="cb-dots-indicator"
|
|
49
|
+
role="tablist"
|
|
50
|
+
[attr.aria-label]="t().pageIndicator"
|
|
51
|
+
(keydown)="onKeydown($event)"
|
|
52
|
+
>
|
|
53
|
+
@for (idx of indices(); track idx) {
|
|
54
|
+
<button
|
|
55
|
+
type="button"
|
|
56
|
+
class="cb-dots-indicator__dot"
|
|
57
|
+
[class.cb-dots-indicator__dot--active]="activeIndex() === idx"
|
|
58
|
+
role="tab"
|
|
59
|
+
[attr.aria-selected]="activeIndex() === idx"
|
|
60
|
+
[attr.tabindex]="activeIndex() === idx ? 0 : -1"
|
|
61
|
+
[attr.aria-label]="fmt(t().page, idx + 1)"
|
|
62
|
+
(click)="activeIndex.set(idx)"
|
|
63
|
+
></button>
|
|
64
|
+
}
|
|
65
|
+
</div>
|
|
66
66
|
`, isInline: true, styles: [":host{display:inline-flex}.cb-dots-indicator{display:inline-flex;align-items:center;gap:var(--cb-space-2, .4rem)}.cb-dots-indicator__dot{width:.5rem;height:.5rem;padding:0;border:none;border-radius:var(--cb-radius-full, 999px);background-color:var(--cb-color-surface-300, #cbd5e1);cursor:pointer;transition:width var(--cb-duration-normal, .2s) var(--cb-ease, ease),background-color var(--cb-duration-normal, .2s) var(--cb-ease, ease)}.cb-dots-indicator__dot:hover:not(.cb-dots-indicator__dot--active){background-color:var(--cb-color-surface-400, #94a3b8)}.cb-dots-indicator__dot--active{width:1.4rem;background-color:var(--cb-color-primary-500, #10b981)}.cb-dots-indicator__dot:focus-visible{outline:2px solid var(--cb-color-focus-ring, var(--cb-color-primary-500, #10b981));outline-offset:2px}:host-context([data-theme=\"dark\"]) .cb-dots-indicator__dot{background-color:var(--cb-color-surface-600, #475569)}:host-context([data-theme=\"dark\"]) .cb-dots-indicator__dot--active{background-color:var(--cb-color-primary-500, #10b981)}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
67
67
|
}
|
|
68
68
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: CbDotsIndicator, decorators: [{
|
|
69
69
|
type: Component,
|
|
70
|
-
args: [{ selector: 'cb-dots-indicator', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.Emulated, host: { class: 'cb-dots-indicator-host' }, template: `
|
|
71
|
-
<div
|
|
72
|
-
class="cb-dots-indicator"
|
|
73
|
-
role="tablist"
|
|
74
|
-
[attr.aria-label]="t().pageIndicator"
|
|
75
|
-
(keydown)="onKeydown($event)"
|
|
76
|
-
>
|
|
77
|
-
@for (idx of indices(); track idx) {
|
|
78
|
-
<button
|
|
79
|
-
type="button"
|
|
80
|
-
class="cb-dots-indicator__dot"
|
|
81
|
-
[class.cb-dots-indicator__dot--active]="activeIndex() === idx"
|
|
82
|
-
role="tab"
|
|
83
|
-
[attr.aria-selected]="activeIndex() === idx"
|
|
84
|
-
[attr.tabindex]="activeIndex() === idx ? 0 : -1"
|
|
85
|
-
[attr.aria-label]="fmt(t().page, idx + 1)"
|
|
86
|
-
(click)="activeIndex.set(idx)"
|
|
87
|
-
></button>
|
|
88
|
-
}
|
|
89
|
-
</div>
|
|
70
|
+
args: [{ selector: 'cb-dots-indicator', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.Emulated, host: { class: 'cb-dots-indicator-host' }, template: `
|
|
71
|
+
<div
|
|
72
|
+
class="cb-dots-indicator"
|
|
73
|
+
role="tablist"
|
|
74
|
+
[attr.aria-label]="t().pageIndicator"
|
|
75
|
+
(keydown)="onKeydown($event)"
|
|
76
|
+
>
|
|
77
|
+
@for (idx of indices(); track idx) {
|
|
78
|
+
<button
|
|
79
|
+
type="button"
|
|
80
|
+
class="cb-dots-indicator__dot"
|
|
81
|
+
[class.cb-dots-indicator__dot--active]="activeIndex() === idx"
|
|
82
|
+
role="tab"
|
|
83
|
+
[attr.aria-selected]="activeIndex() === idx"
|
|
84
|
+
[attr.tabindex]="activeIndex() === idx ? 0 : -1"
|
|
85
|
+
[attr.aria-label]="fmt(t().page, idx + 1)"
|
|
86
|
+
(click)="activeIndex.set(idx)"
|
|
87
|
+
></button>
|
|
88
|
+
}
|
|
89
|
+
</div>
|
|
90
90
|
`, styles: [":host{display:inline-flex}.cb-dots-indicator{display:inline-flex;align-items:center;gap:var(--cb-space-2, .4rem)}.cb-dots-indicator__dot{width:.5rem;height:.5rem;padding:0;border:none;border-radius:var(--cb-radius-full, 999px);background-color:var(--cb-color-surface-300, #cbd5e1);cursor:pointer;transition:width var(--cb-duration-normal, .2s) var(--cb-ease, ease),background-color var(--cb-duration-normal, .2s) var(--cb-ease, ease)}.cb-dots-indicator__dot:hover:not(.cb-dots-indicator__dot--active){background-color:var(--cb-color-surface-400, #94a3b8)}.cb-dots-indicator__dot--active{width:1.4rem;background-color:var(--cb-color-primary-500, #10b981)}.cb-dots-indicator__dot:focus-visible{outline:2px solid var(--cb-color-focus-ring, var(--cb-color-primary-500, #10b981));outline-offset:2px}:host-context([data-theme=\"dark\"]) .cb-dots-indicator__dot{background-color:var(--cb-color-surface-600, #475569)}:host-context([data-theme=\"dark\"]) .cb-dots-indicator__dot--active{background-color:var(--cb-color-primary-500, #10b981)}\n"] }]
|
|
91
91
|
}], propDecorators: { count: [{ type: i0.Input, args: [{ isSignal: true, alias: "count", required: false }] }], activeIndex: [{ type: i0.Input, args: [{ isSignal: true, alias: "activeIndex", required: false }] }, { type: i0.Output, args: ["activeIndexChange"] }] } });
|
|
92
92
|
|