@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
|
@@ -0,0 +1,386 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { input, model, booleanAttribute, output, signal, computed, ViewEncapsulation, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
3
|
+
import { injectCbTranslation, cbFormat, injectCbAmount } from '@caribeng/ui';
|
|
4
|
+
import { CbButton } from '@caribeng/ui/button';
|
|
5
|
+
import { CbIcon } from '@caribeng/ui/icon';
|
|
6
|
+
|
|
7
|
+
const cents = (n) => Math.round(n * 100);
|
|
8
|
+
function dayOf(value) {
|
|
9
|
+
const d = value instanceof Date ? value : new Date(+value.slice(0, 4), +value.slice(5, 7) - 1, +value.slice(8, 10));
|
|
10
|
+
return Math.round(new Date(d.getFullYear(), d.getMonth(), d.getDate()).getTime() / 86400000);
|
|
11
|
+
}
|
|
12
|
+
function sumAmounts(items) {
|
|
13
|
+
return cents(items.reduce((t, i) => t + i.amount, 0)) / 100;
|
|
14
|
+
}
|
|
15
|
+
/** Ids ya emparejados de cada lado. */
|
|
16
|
+
function matchedIds(matches) {
|
|
17
|
+
return { statement: new Set(matches.flatMap((m) => m.statement)), ledger: new Set(matches.flatMap((m) => m.ledger)) };
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Empareja solo, uno a uno, los movimientos pendientes con el mismo valor y una
|
|
21
|
+
* fecha cercana (`toleranceDays`): primero los de igual referencia, después los
|
|
22
|
+
* de fecha más próxima.
|
|
23
|
+
*/
|
|
24
|
+
function autoMatch(statement, ledger, existing, toleranceDays = 3) {
|
|
25
|
+
const used = matchedIds(existing);
|
|
26
|
+
const free = ledger.filter((l) => !used.ledger.has(l.id));
|
|
27
|
+
const out = [];
|
|
28
|
+
const pending = statement.filter((s) => !used.statement.has(s.id)).sort((a, b) => dayOf(a.date) - dayOf(b.date));
|
|
29
|
+
for (const s of pending) {
|
|
30
|
+
const candidates = free.filter((l) => cents(l.amount) === cents(s.amount) && Math.abs(dayOf(l.date) - dayOf(s.date)) <= toleranceDays);
|
|
31
|
+
if (!candidates.length)
|
|
32
|
+
continue;
|
|
33
|
+
const ref = (x) => (x.reference ?? '').trim().toLowerCase();
|
|
34
|
+
candidates.sort((a, b) => {
|
|
35
|
+
const ra = ref(s) && ref(a) === ref(s) ? 0 : 1;
|
|
36
|
+
const rb = ref(s) && ref(b) === ref(s) ? 0 : 1;
|
|
37
|
+
return ra - rb || Math.abs(dayOf(a.date) - dayOf(s.date)) - Math.abs(dayOf(b.date) - dayOf(s.date));
|
|
38
|
+
});
|
|
39
|
+
const best = candidates[0];
|
|
40
|
+
free.splice(free.indexOf(best), 1);
|
|
41
|
+
out.push({ statement: [s.id], ledger: [best.id] });
|
|
42
|
+
}
|
|
43
|
+
return out;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
let nextUid = 0;
|
|
47
|
+
/**
|
|
48
|
+
* Conciliación bancaria de CaribeNG: el extracto del banco frente a los
|
|
49
|
+
* movimientos en libros, para emparejarlos y ver qué queda pendiente.
|
|
50
|
+
*
|
|
51
|
+
* - «Conciliar automáticamente» empareja los de igual valor y fecha cercana
|
|
52
|
+
* (`toleranceDays`), dando prioridad a la misma referencia.
|
|
53
|
+
* - Se marcan movimientos de cada lado y «Emparejar» los une cuando sus sumas
|
|
54
|
+
* coinciden (uno con uno, uno con varios o varios con uno).
|
|
55
|
+
* - Resumen con los pendientes de cada lado y la diferencia; `createEntry` sirve
|
|
56
|
+
* para registrar en libros un movimiento del extracto (comisiones, intereses).
|
|
57
|
+
*
|
|
58
|
+
* @example
|
|
59
|
+
* ```html
|
|
60
|
+
* <cb-reconciliation [statement]="extracto" [ledger]="libros" [(matches)]="conciliados" />
|
|
61
|
+
* ```
|
|
62
|
+
*/
|
|
63
|
+
class CbReconciliation {
|
|
64
|
+
constructor() {
|
|
65
|
+
this.t = injectCbTranslation();
|
|
66
|
+
this.fmt = cbFormat;
|
|
67
|
+
this.amount = injectCbAmount();
|
|
68
|
+
this.uid = `cb-reconciliation-${++nextUid}`;
|
|
69
|
+
this.sides = ['statement', 'ledger'];
|
|
70
|
+
/** Movimientos del extracto bancario. */
|
|
71
|
+
this.statement = input([], /* @ts-ignore */
|
|
72
|
+
...(ngDevMode ? [{ debugName: "statement" }] : /* istanbul ignore next */ []));
|
|
73
|
+
/** Movimientos en libros (cuenta de bancos). */
|
|
74
|
+
this.ledger = input([], /* @ts-ignore */
|
|
75
|
+
...(ngDevMode ? [{ debugName: "ledger" }] : /* istanbul ignore next */ []));
|
|
76
|
+
/** Emparejamientos (bidireccional). */
|
|
77
|
+
this.matches = model([], /* @ts-ignore */
|
|
78
|
+
...(ngDevMode ? [{ debugName: "matches" }] : /* istanbul ignore next */ []));
|
|
79
|
+
/** Días de diferencia admitidos al conciliar automáticamente. */
|
|
80
|
+
this.toleranceDays = input(3, /* @ts-ignore */
|
|
81
|
+
...(ngDevMode ? [{ debugName: "toleranceDays" }] : /* istanbul ignore next */ []));
|
|
82
|
+
this.statementLabel = input('', /* @ts-ignore */
|
|
83
|
+
...(ngDevMode ? [{ debugName: "statementLabel" }] : /* istanbul ignore next */ []));
|
|
84
|
+
this.ledgerLabel = input('', /* @ts-ignore */
|
|
85
|
+
...(ngDevMode ? [{ debugName: "ledgerLabel" }] : /* istanbul ignore next */ []));
|
|
86
|
+
/** Botón «Crear asiento» en los movimientos del extracto sin pareja. */
|
|
87
|
+
this.allowCreate = input(false, { ...(ngDevMode ? { debugName: "allowCreate" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
88
|
+
this.readonly = input(false, { ...(ngDevMode ? { debugName: "readonly" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
89
|
+
this.currency = input(undefined, /* @ts-ignore */
|
|
90
|
+
...(ngDevMode ? [{ debugName: "currency" }] : /* istanbul ignore next */ []));
|
|
91
|
+
/** Registrar en libros un movimiento del extracto. */
|
|
92
|
+
this.createEntry = output();
|
|
93
|
+
this.onlyPending = signal(false, /* @ts-ignore */
|
|
94
|
+
...(ngDevMode ? [{ debugName: "onlyPending" }] : /* istanbul ignore next */ []));
|
|
95
|
+
this.selection = signal({ statement: new Set(), ledger: new Set() }, /* @ts-ignore */
|
|
96
|
+
...(ngDevMode ? [{ debugName: "selection" }] : /* istanbul ignore next */ []));
|
|
97
|
+
this.announcement = signal('', /* @ts-ignore */
|
|
98
|
+
...(ngDevMode ? [{ debugName: "announcement" }] : /* istanbul ignore next */ []));
|
|
99
|
+
this.matched = computed(() => matchedIds(this.matches()), /* @ts-ignore */
|
|
100
|
+
...(ngDevMode ? [{ debugName: "matched" }] : /* istanbul ignore next */ []));
|
|
101
|
+
this.progress = computed(() => {
|
|
102
|
+
const all = this.statement().length + this.ledger().length;
|
|
103
|
+
return all ? (this.matched().statement.size + this.matched().ledger.size) / all : 0;
|
|
104
|
+
}, /* @ts-ignore */
|
|
105
|
+
...(ngDevMode ? [{ debugName: "progress" }] : /* istanbul ignore next */ []));
|
|
106
|
+
this.hasSelection = computed(() => this.selection().statement.size + this.selection().ledger.size > 0, /* @ts-ignore */
|
|
107
|
+
...(ngDevMode ? [{ debugName: "hasSelection" }] : /* istanbul ignore next */ []));
|
|
108
|
+
this.selectionDiff = computed(() => Math.round((this.selectedSum('statement') - this.selectedSum('ledger')) * 100) / 100, /* @ts-ignore */
|
|
109
|
+
...(ngDevMode ? [{ debugName: "selectionDiff" }] : /* istanbul ignore next */ []));
|
|
110
|
+
/** Se puede emparejar: hay de los dos lados, nada ya emparejado y las sumas coinciden. */
|
|
111
|
+
this.canMatch = computed(() => {
|
|
112
|
+
const s = this.selectedItems('statement');
|
|
113
|
+
const l = this.selectedItems('ledger');
|
|
114
|
+
return s.length > 0 && l.length > 0 && this.selectionDiff() === 0 && !s.some((i) => this.isMatched('statement', i)) && !l.some((i) => this.isMatched('ledger', i));
|
|
115
|
+
}, /* @ts-ignore */
|
|
116
|
+
...(ngDevMode ? [{ debugName: "canMatch" }] : /* istanbul ignore next */ []));
|
|
117
|
+
this.selectedMatched = computed(() => this.sides.some((side) => this.selectedItems(side).some((i) => this.isMatched(side, i))), /* @ts-ignore */
|
|
118
|
+
...(ngDevMode ? [{ debugName: "selectedMatched" }] : /* istanbul ignore next */ []));
|
|
119
|
+
}
|
|
120
|
+
items(side) {
|
|
121
|
+
return side === 'statement' ? this.statement() : this.ledger();
|
|
122
|
+
}
|
|
123
|
+
visible(side) {
|
|
124
|
+
const list = [...this.items(side)].sort((a, b) => dayOf(a.date) - dayOf(b.date));
|
|
125
|
+
return this.onlyPending() ? list.filter((i) => !this.isMatched(side, i)) : list;
|
|
126
|
+
}
|
|
127
|
+
pending(side) {
|
|
128
|
+
return this.items(side).filter((i) => !this.isMatched(side, i));
|
|
129
|
+
}
|
|
130
|
+
pendingSum(side) {
|
|
131
|
+
return sumAmounts(this.pending(side));
|
|
132
|
+
}
|
|
133
|
+
total(side) {
|
|
134
|
+
return sumAmounts(this.items(side));
|
|
135
|
+
}
|
|
136
|
+
isMatched(side, item) {
|
|
137
|
+
return this.matched()[side].has(item.id);
|
|
138
|
+
}
|
|
139
|
+
isSelected(side, item) {
|
|
140
|
+
return this.selection()[side].has(item.id);
|
|
141
|
+
}
|
|
142
|
+
selectedItems(side) {
|
|
143
|
+
return this.items(side).filter((i) => this.selection()[side].has(i.id));
|
|
144
|
+
}
|
|
145
|
+
selectedSum(side) {
|
|
146
|
+
return sumAmounts(this.selectedItems(side));
|
|
147
|
+
}
|
|
148
|
+
money(value) {
|
|
149
|
+
return this.amount(value, this.currency() ? { currency: this.currency() } : {});
|
|
150
|
+
}
|
|
151
|
+
pct(value) {
|
|
152
|
+
return new Intl.NumberFormat(this.t().intlLocale, { style: 'percent', maximumFractionDigits: 0 }).format(value);
|
|
153
|
+
}
|
|
154
|
+
shortDate(value) {
|
|
155
|
+
const d = value instanceof Date ? value : new Date(+value.slice(0, 4), +value.slice(5, 7) - 1, +value.slice(8, 10));
|
|
156
|
+
return new Intl.DateTimeFormat(this.t().intlLocale, { day: '2-digit', month: 'short' }).format(d).replace(/\./g, '');
|
|
157
|
+
}
|
|
158
|
+
toggle(side, item) {
|
|
159
|
+
this.selection.update((sel) => {
|
|
160
|
+
const next = new Set(sel[side]);
|
|
161
|
+
if (next.has(item.id))
|
|
162
|
+
next.delete(item.id);
|
|
163
|
+
else
|
|
164
|
+
next.add(item.id);
|
|
165
|
+
return { ...sel, [side]: next };
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
/** Empareja los movimientos pendientes de igual valor y fecha cercana. */
|
|
169
|
+
runAuto() {
|
|
170
|
+
const found = autoMatch(this.statement(), this.ledger(), this.matches(), this.toleranceDays());
|
|
171
|
+
if (found.length)
|
|
172
|
+
this.matches.update((m) => [...m, ...found]);
|
|
173
|
+
this.say(cbFormat(this.t().reconAutoDone, found.length));
|
|
174
|
+
}
|
|
175
|
+
/** Une lo seleccionado de los dos lados (si sus sumas coinciden). */
|
|
176
|
+
matchSelection() {
|
|
177
|
+
if (!this.canMatch())
|
|
178
|
+
return;
|
|
179
|
+
const match = { statement: this.selectedItems('statement').map((i) => i.id), ledger: this.selectedItems('ledger').map((i) => i.id) };
|
|
180
|
+
this.matches.update((m) => [...m, match]);
|
|
181
|
+
this.clearSelection();
|
|
182
|
+
this.say(this.t().reconMatchedDone);
|
|
183
|
+
}
|
|
184
|
+
/** Deshace los emparejamientos que tocan lo seleccionado. */
|
|
185
|
+
unmatchSelection() {
|
|
186
|
+
const sel = this.selection();
|
|
187
|
+
const keep = this.matches().filter((m) => !m.statement.some((id) => sel.statement.has(id)) && !m.ledger.some((id) => sel.ledger.has(id)));
|
|
188
|
+
const removed = this.matches().length - keep.length;
|
|
189
|
+
this.matches.set(keep);
|
|
190
|
+
this.clearSelection();
|
|
191
|
+
this.say(cbFormat(this.t().reconUnmatchedDone, removed));
|
|
192
|
+
}
|
|
193
|
+
clearSelection() {
|
|
194
|
+
this.selection.set({ statement: new Set(), ledger: new Set() });
|
|
195
|
+
}
|
|
196
|
+
say(message) {
|
|
197
|
+
this.announcement.set('');
|
|
198
|
+
queueMicrotask(() => this.announcement.set(message));
|
|
199
|
+
}
|
|
200
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: CbReconciliation, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
201
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: CbReconciliation, isStandalone: true, selector: "cb-reconciliation", inputs: { statement: { classPropertyName: "statement", publicName: "statement", isSignal: true, isRequired: false, transformFunction: null }, ledger: { classPropertyName: "ledger", publicName: "ledger", isSignal: true, isRequired: false, transformFunction: null }, matches: { classPropertyName: "matches", publicName: "matches", isSignal: true, isRequired: false, transformFunction: null }, toleranceDays: { classPropertyName: "toleranceDays", publicName: "toleranceDays", isSignal: true, isRequired: false, transformFunction: null }, statementLabel: { classPropertyName: "statementLabel", publicName: "statementLabel", isSignal: true, isRequired: false, transformFunction: null }, ledgerLabel: { classPropertyName: "ledgerLabel", publicName: "ledgerLabel", isSignal: true, isRequired: false, transformFunction: null }, allowCreate: { classPropertyName: "allowCreate", publicName: "allowCreate", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, currency: { classPropertyName: "currency", publicName: "currency", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { matches: "matchesChange", createEntry: "createEntry" }, host: { classAttribute: "cb-reconciliation" }, ngImport: i0, template: `
|
|
202
|
+
<div class="cb-rc__summary">
|
|
203
|
+
<div class="cb-rc__stat">
|
|
204
|
+
<span class="cb-rc__stat-label">{{ t().reconStatementPending }}</span>
|
|
205
|
+
<span class="cb-rc__stat-value">{{ money(pendingSum('statement')) }}</span>
|
|
206
|
+
<span class="cb-rc__stat-sub">{{ fmt(t().reconItems, pending('statement').length) }}</span>
|
|
207
|
+
</div>
|
|
208
|
+
<div class="cb-rc__stat">
|
|
209
|
+
<span class="cb-rc__stat-label">{{ t().reconLedgerPending }}</span>
|
|
210
|
+
<span class="cb-rc__stat-value">{{ money(pendingSum('ledger')) }}</span>
|
|
211
|
+
<span class="cb-rc__stat-sub">{{ fmt(t().reconItems, pending('ledger').length) }}</span>
|
|
212
|
+
</div>
|
|
213
|
+
<div class="cb-rc__stat">
|
|
214
|
+
<span class="cb-rc__stat-label">{{ t().reconProgress }}</span>
|
|
215
|
+
<span class="cb-rc__stat-value">{{ pct(progress()) }}</span>
|
|
216
|
+
<span class="cb-rc__progress" aria-hidden="true"><span [style.width.%]="progress() * 100"></span></span>
|
|
217
|
+
</div>
|
|
218
|
+
</div>
|
|
219
|
+
|
|
220
|
+
<div class="cb-rc__toolbar" role="toolbar" [attr.aria-label]="t().reconToolbar">
|
|
221
|
+
@if (!readonly()) {
|
|
222
|
+
<cb-button size="sm" variant="outlined" (click)="runAuto()">
|
|
223
|
+
<cb-icon name="sparkles" [size]="15" aria-hidden="true" />
|
|
224
|
+
{{ t().reconAuto }}
|
|
225
|
+
</cb-button>
|
|
226
|
+
<cb-button size="sm" [disabled]="!canMatch()" (click)="matchSelection()">
|
|
227
|
+
<cb-icon name="merge" [size]="15" aria-hidden="true" />
|
|
228
|
+
{{ t().reconMatch }}
|
|
229
|
+
</cb-button>
|
|
230
|
+
<cb-button size="sm" variant="text" severity="secondary" [disabled]="!selectedMatched()" (click)="unmatchSelection()">{{ t().reconUnmatch }}</cb-button>
|
|
231
|
+
}
|
|
232
|
+
<span class="cb-rc__spacer"></span>
|
|
233
|
+
@if (hasSelection()) {
|
|
234
|
+
<span class="cb-rc__selection" [class.cb-rc__selection--ok]="selectionDiff() === 0" aria-live="polite">
|
|
235
|
+
{{ fmt(t().reconSelection, money(selectedSum('statement')), money(selectedSum('ledger'))) }}
|
|
236
|
+
@if (selectionDiff() !== 0) {
|
|
237
|
+
· {{ fmt(t().reconDiff, money(selectionDiff())) }}
|
|
238
|
+
}
|
|
239
|
+
</span>
|
|
240
|
+
}
|
|
241
|
+
<label class="cb-rc__filter">
|
|
242
|
+
<input type="checkbox" [checked]="onlyPending()" (change)="onlyPending.set($any($event.target).checked)" />
|
|
243
|
+
{{ t().reconOnlyPending }}
|
|
244
|
+
</label>
|
|
245
|
+
</div>
|
|
246
|
+
|
|
247
|
+
<div class="cb-rc__sides">
|
|
248
|
+
@for (side of sides; track side) {
|
|
249
|
+
<section class="cb-rc__side" [attr.aria-labelledby]="uid + '-' + side">
|
|
250
|
+
<header class="cb-rc__side-head">
|
|
251
|
+
<h3 [id]="uid + '-' + side">{{ side === 'statement' ? statementLabel() || t().reconStatement : ledgerLabel() || t().reconLedger }}</h3>
|
|
252
|
+
<span>{{ money(total(side)) }}</span>
|
|
253
|
+
</header>
|
|
254
|
+
<ul class="cb-rc__list">
|
|
255
|
+
@for (item of visible(side); track item.id) {
|
|
256
|
+
<li class="cb-rc__item" [class.cb-rc__item--matched]="isMatched(side, item)" [class.cb-rc__item--selected]="isSelected(side, item)">
|
|
257
|
+
<label class="cb-rc__label">
|
|
258
|
+
<input type="checkbox" [checked]="isSelected(side, item)" [disabled]="readonly()" (change)="toggle(side, item)" />
|
|
259
|
+
<span class="cb-rc__date">{{ shortDate(item.date) }}</span>
|
|
260
|
+
<span class="cb-rc__desc">
|
|
261
|
+
{{ item.description }}
|
|
262
|
+
@if (item.reference) {
|
|
263
|
+
<span class="cb-rc__ref">{{ item.reference }}</span>
|
|
264
|
+
}
|
|
265
|
+
</span>
|
|
266
|
+
<span class="cb-rc__amount" [class.cb-rc__amount--out]="item.amount < 0">{{ money(item.amount) }}</span>
|
|
267
|
+
@if (isMatched(side, item)) {
|
|
268
|
+
<cb-icon class="cb-rc__linked" name="check" [size]="14" aria-hidden="true" />
|
|
269
|
+
<span class="cb-rc__sr">{{ t().reconMatched }}</span>
|
|
270
|
+
}
|
|
271
|
+
</label>
|
|
272
|
+
@if (side === 'statement' && allowCreate() && !isMatched(side, item) && !readonly()) {
|
|
273
|
+
<button type="button" class="cb-rc__create" [attr.aria-label]="fmt(t().reconCreateFor, item.description)" [title]="t().reconCreate" (click)="createEntry.emit(item)">
|
|
274
|
+
<cb-icon name="plus" [size]="14" aria-hidden="true" />
|
|
275
|
+
</button>
|
|
276
|
+
}
|
|
277
|
+
</li>
|
|
278
|
+
} @empty {
|
|
279
|
+
<li class="cb-rc__empty">{{ onlyPending() ? t().reconNothingPending : t().noData }}</li>
|
|
280
|
+
}
|
|
281
|
+
</ul>
|
|
282
|
+
</section>
|
|
283
|
+
}
|
|
284
|
+
</div>
|
|
285
|
+
<div class="cb-rc__sr" role="status">{{ announcement() }}</div>
|
|
286
|
+
`, isInline: true, styles: [":host{display:grid;gap:var(--cb-space-4, 1rem);width:100%;min-width:0;container-type:inline-size;color:var(--cb-color-text);font-family:var(--cb-font-sans);font-size:var(--cb-text-sm, .875rem)}.cb-rc__summary{display:grid;grid-template-columns:repeat(auto-fit,minmax(12rem,1fr));gap:.75rem}.cb-rc__stat{display:grid;gap:.15rem;padding:.75rem 1rem;border:1px solid var(--cb-color-border);border-radius:var(--cb-radius-md);background:var(--cb-color-surface-subtle)}.cb-rc__stat-label,.cb-rc__stat-sub{color:var(--cb-color-text-muted);font-size:var(--cb-text-xs, .75rem)}.cb-rc__stat-value{font-size:var(--cb-text-lg, 1.125rem);font-variant-numeric:tabular-nums;font-weight:var(--cb-font-weight-semibold, 600)}.cb-rc__progress{display:block;height:.4rem;overflow:hidden;border-radius:999px;background:var(--cb-color-border)}.cb-rc__progress span{display:block;height:100%;background:var(--cb-color-success-500, #10b981)}.cb-rc__toolbar{display:flex;flex-wrap:wrap;align-items:center;gap:.5rem}.cb-rc__spacer{flex:1}.cb-rc__selection{padding:.25rem .65rem;border-radius:999px;background:color-mix(in srgb,var(--cb-color-warning-500, #f59e0b) 15%,transparent);font-variant-numeric:tabular-nums}.cb-rc__selection--ok{background:color-mix(in srgb,var(--cb-color-success-500, #10b981) 15%,transparent)}.cb-rc__filter{display:inline-flex;align-items:center;gap:.35rem;cursor:pointer}.cb-rc__sides{display:grid;grid-template-columns:1fr 1fr;gap:1rem}@container (max-width: 44rem){.cb-rc__sides{grid-template-columns:1fr}}.cb-rc__side{min-width:0;border:1px solid var(--cb-color-border);border-radius:var(--cb-radius-md);overflow:hidden}.cb-rc__side-head{display:flex;align-items:baseline;justify-content:space-between;padding:.6rem .85rem;border-bottom:1px solid var(--cb-color-border);background:var(--cb-color-surface-subtle)}.cb-rc__side-head h3{margin:0;font-size:var(--cb-text-sm, .875rem);font-weight:var(--cb-font-weight-semibold, 600)}.cb-rc__side-head span{font-variant-numeric:tabular-nums;font-weight:var(--cb-font-weight-semibold, 600)}.cb-rc__list{max-height:26rem;margin:0;padding:0;overflow-y:auto;list-style:none}.cb-rc__item{display:flex;align-items:center;gap:.5rem;padding-right:.5rem;border-bottom:1px solid var(--cb-color-border)}.cb-rc__item--matched{background:color-mix(in srgb,var(--cb-color-success-500, #10b981) 6%,transparent);color:var(--cb-color-text-muted)}.cb-rc__item--selected{background:color-mix(in srgb,var(--cb-color-primary-500) 12%,transparent)}.cb-rc__label{display:grid;flex:1;grid-template-columns:auto 3.5rem 1fr auto auto;align-items:center;gap:.6rem;min-width:0;padding:.5rem .85rem;cursor:pointer}.cb-rc__label>input{inline-size:1.125rem;block-size:1.125rem;margin:0}.cb-rc__date{color:var(--cb-color-text-muted);font-variant-numeric:tabular-nums}.cb-rc__desc{min-width:0;overflow-wrap:break-word;line-height:1.3}.cb-rc__ref{margin-left:.35rem;padding:0 .35rem;border-radius:4px;background:var(--cb-color-surface-subtle);color:var(--cb-color-text-muted);font-size:var(--cb-text-xs, .75rem)}.cb-rc__amount{font-variant-numeric:tabular-nums;font-weight:var(--cb-font-weight-medium, 500);text-align:end;white-space:nowrap}.cb-rc__amount--out{color:var(--cb-color-danger-text, #dc2626)}.cb-rc__item--matched .cb-rc__amount--out{color:inherit}.cb-rc__linked{color:var(--cb-color-success-text, #059669)}.cb-rc__create{display:inline-flex;flex:none;align-items:center;justify-content:center;width:1.75rem;height:1.75rem;padding:0;border:1px solid var(--cb-color-border-strong);border-radius:var(--cb-radius-sm, 4px);background:var(--cb-color-bg);color:var(--cb-color-text);font:inherit;font-size:var(--cb-text-xs, .75rem);cursor:pointer}.cb-rc__create:focus-visible{outline:2px solid var(--cb-color-focus-ring);outline-offset:1px}.cb-rc__empty{padding:1.5rem 1rem;color:var(--cb-color-text-muted);text-align:center}@container (max-width: 30rem){.cb-rc__label{grid-template-columns:auto auto 1fr auto;grid-template-areas:\"check date amount linked\" \". desc desc desc\";row-gap:.15rem}.cb-rc__label>input{grid-area:check}.cb-rc__date{grid-area:date}.cb-rc__desc{grid-area:desc}.cb-rc__amount{grid-area:amount}.cb-rc__linked{grid-area:linked}}.cb-rc__sr{position:absolute;width:1px;height:1px;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap}\n"], dependencies: [{ kind: "component", type: CbButton, selector: "cb-button", inputs: ["severity", "variant", "size", "disabled", "loading", "fullWidth", "type", "ariaLabel", "ariaHaspopup", "ariaExpanded", "ariaControls"] }, { kind: "component", type: CbIcon, selector: "cb-icon", inputs: ["name", "size", "spin", "ariaLabel"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
287
|
+
}
|
|
288
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: CbReconciliation, decorators: [{
|
|
289
|
+
type: Component,
|
|
290
|
+
args: [{ selector: 'cb-reconciliation', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.Emulated, imports: [CbButton, CbIcon], host: { class: 'cb-reconciliation' }, template: `
|
|
291
|
+
<div class="cb-rc__summary">
|
|
292
|
+
<div class="cb-rc__stat">
|
|
293
|
+
<span class="cb-rc__stat-label">{{ t().reconStatementPending }}</span>
|
|
294
|
+
<span class="cb-rc__stat-value">{{ money(pendingSum('statement')) }}</span>
|
|
295
|
+
<span class="cb-rc__stat-sub">{{ fmt(t().reconItems, pending('statement').length) }}</span>
|
|
296
|
+
</div>
|
|
297
|
+
<div class="cb-rc__stat">
|
|
298
|
+
<span class="cb-rc__stat-label">{{ t().reconLedgerPending }}</span>
|
|
299
|
+
<span class="cb-rc__stat-value">{{ money(pendingSum('ledger')) }}</span>
|
|
300
|
+
<span class="cb-rc__stat-sub">{{ fmt(t().reconItems, pending('ledger').length) }}</span>
|
|
301
|
+
</div>
|
|
302
|
+
<div class="cb-rc__stat">
|
|
303
|
+
<span class="cb-rc__stat-label">{{ t().reconProgress }}</span>
|
|
304
|
+
<span class="cb-rc__stat-value">{{ pct(progress()) }}</span>
|
|
305
|
+
<span class="cb-rc__progress" aria-hidden="true"><span [style.width.%]="progress() * 100"></span></span>
|
|
306
|
+
</div>
|
|
307
|
+
</div>
|
|
308
|
+
|
|
309
|
+
<div class="cb-rc__toolbar" role="toolbar" [attr.aria-label]="t().reconToolbar">
|
|
310
|
+
@if (!readonly()) {
|
|
311
|
+
<cb-button size="sm" variant="outlined" (click)="runAuto()">
|
|
312
|
+
<cb-icon name="sparkles" [size]="15" aria-hidden="true" />
|
|
313
|
+
{{ t().reconAuto }}
|
|
314
|
+
</cb-button>
|
|
315
|
+
<cb-button size="sm" [disabled]="!canMatch()" (click)="matchSelection()">
|
|
316
|
+
<cb-icon name="merge" [size]="15" aria-hidden="true" />
|
|
317
|
+
{{ t().reconMatch }}
|
|
318
|
+
</cb-button>
|
|
319
|
+
<cb-button size="sm" variant="text" severity="secondary" [disabled]="!selectedMatched()" (click)="unmatchSelection()">{{ t().reconUnmatch }}</cb-button>
|
|
320
|
+
}
|
|
321
|
+
<span class="cb-rc__spacer"></span>
|
|
322
|
+
@if (hasSelection()) {
|
|
323
|
+
<span class="cb-rc__selection" [class.cb-rc__selection--ok]="selectionDiff() === 0" aria-live="polite">
|
|
324
|
+
{{ fmt(t().reconSelection, money(selectedSum('statement')), money(selectedSum('ledger'))) }}
|
|
325
|
+
@if (selectionDiff() !== 0) {
|
|
326
|
+
· {{ fmt(t().reconDiff, money(selectionDiff())) }}
|
|
327
|
+
}
|
|
328
|
+
</span>
|
|
329
|
+
}
|
|
330
|
+
<label class="cb-rc__filter">
|
|
331
|
+
<input type="checkbox" [checked]="onlyPending()" (change)="onlyPending.set($any($event.target).checked)" />
|
|
332
|
+
{{ t().reconOnlyPending }}
|
|
333
|
+
</label>
|
|
334
|
+
</div>
|
|
335
|
+
|
|
336
|
+
<div class="cb-rc__sides">
|
|
337
|
+
@for (side of sides; track side) {
|
|
338
|
+
<section class="cb-rc__side" [attr.aria-labelledby]="uid + '-' + side">
|
|
339
|
+
<header class="cb-rc__side-head">
|
|
340
|
+
<h3 [id]="uid + '-' + side">{{ side === 'statement' ? statementLabel() || t().reconStatement : ledgerLabel() || t().reconLedger }}</h3>
|
|
341
|
+
<span>{{ money(total(side)) }}</span>
|
|
342
|
+
</header>
|
|
343
|
+
<ul class="cb-rc__list">
|
|
344
|
+
@for (item of visible(side); track item.id) {
|
|
345
|
+
<li class="cb-rc__item" [class.cb-rc__item--matched]="isMatched(side, item)" [class.cb-rc__item--selected]="isSelected(side, item)">
|
|
346
|
+
<label class="cb-rc__label">
|
|
347
|
+
<input type="checkbox" [checked]="isSelected(side, item)" [disabled]="readonly()" (change)="toggle(side, item)" />
|
|
348
|
+
<span class="cb-rc__date">{{ shortDate(item.date) }}</span>
|
|
349
|
+
<span class="cb-rc__desc">
|
|
350
|
+
{{ item.description }}
|
|
351
|
+
@if (item.reference) {
|
|
352
|
+
<span class="cb-rc__ref">{{ item.reference }}</span>
|
|
353
|
+
}
|
|
354
|
+
</span>
|
|
355
|
+
<span class="cb-rc__amount" [class.cb-rc__amount--out]="item.amount < 0">{{ money(item.amount) }}</span>
|
|
356
|
+
@if (isMatched(side, item)) {
|
|
357
|
+
<cb-icon class="cb-rc__linked" name="check" [size]="14" aria-hidden="true" />
|
|
358
|
+
<span class="cb-rc__sr">{{ t().reconMatched }}</span>
|
|
359
|
+
}
|
|
360
|
+
</label>
|
|
361
|
+
@if (side === 'statement' && allowCreate() && !isMatched(side, item) && !readonly()) {
|
|
362
|
+
<button type="button" class="cb-rc__create" [attr.aria-label]="fmt(t().reconCreateFor, item.description)" [title]="t().reconCreate" (click)="createEntry.emit(item)">
|
|
363
|
+
<cb-icon name="plus" [size]="14" aria-hidden="true" />
|
|
364
|
+
</button>
|
|
365
|
+
}
|
|
366
|
+
</li>
|
|
367
|
+
} @empty {
|
|
368
|
+
<li class="cb-rc__empty">{{ onlyPending() ? t().reconNothingPending : t().noData }}</li>
|
|
369
|
+
}
|
|
370
|
+
</ul>
|
|
371
|
+
</section>
|
|
372
|
+
}
|
|
373
|
+
</div>
|
|
374
|
+
<div class="cb-rc__sr" role="status">{{ announcement() }}</div>
|
|
375
|
+
`, styles: [":host{display:grid;gap:var(--cb-space-4, 1rem);width:100%;min-width:0;container-type:inline-size;color:var(--cb-color-text);font-family:var(--cb-font-sans);font-size:var(--cb-text-sm, .875rem)}.cb-rc__summary{display:grid;grid-template-columns:repeat(auto-fit,minmax(12rem,1fr));gap:.75rem}.cb-rc__stat{display:grid;gap:.15rem;padding:.75rem 1rem;border:1px solid var(--cb-color-border);border-radius:var(--cb-radius-md);background:var(--cb-color-surface-subtle)}.cb-rc__stat-label,.cb-rc__stat-sub{color:var(--cb-color-text-muted);font-size:var(--cb-text-xs, .75rem)}.cb-rc__stat-value{font-size:var(--cb-text-lg, 1.125rem);font-variant-numeric:tabular-nums;font-weight:var(--cb-font-weight-semibold, 600)}.cb-rc__progress{display:block;height:.4rem;overflow:hidden;border-radius:999px;background:var(--cb-color-border)}.cb-rc__progress span{display:block;height:100%;background:var(--cb-color-success-500, #10b981)}.cb-rc__toolbar{display:flex;flex-wrap:wrap;align-items:center;gap:.5rem}.cb-rc__spacer{flex:1}.cb-rc__selection{padding:.25rem .65rem;border-radius:999px;background:color-mix(in srgb,var(--cb-color-warning-500, #f59e0b) 15%,transparent);font-variant-numeric:tabular-nums}.cb-rc__selection--ok{background:color-mix(in srgb,var(--cb-color-success-500, #10b981) 15%,transparent)}.cb-rc__filter{display:inline-flex;align-items:center;gap:.35rem;cursor:pointer}.cb-rc__sides{display:grid;grid-template-columns:1fr 1fr;gap:1rem}@container (max-width: 44rem){.cb-rc__sides{grid-template-columns:1fr}}.cb-rc__side{min-width:0;border:1px solid var(--cb-color-border);border-radius:var(--cb-radius-md);overflow:hidden}.cb-rc__side-head{display:flex;align-items:baseline;justify-content:space-between;padding:.6rem .85rem;border-bottom:1px solid var(--cb-color-border);background:var(--cb-color-surface-subtle)}.cb-rc__side-head h3{margin:0;font-size:var(--cb-text-sm, .875rem);font-weight:var(--cb-font-weight-semibold, 600)}.cb-rc__side-head span{font-variant-numeric:tabular-nums;font-weight:var(--cb-font-weight-semibold, 600)}.cb-rc__list{max-height:26rem;margin:0;padding:0;overflow-y:auto;list-style:none}.cb-rc__item{display:flex;align-items:center;gap:.5rem;padding-right:.5rem;border-bottom:1px solid var(--cb-color-border)}.cb-rc__item--matched{background:color-mix(in srgb,var(--cb-color-success-500, #10b981) 6%,transparent);color:var(--cb-color-text-muted)}.cb-rc__item--selected{background:color-mix(in srgb,var(--cb-color-primary-500) 12%,transparent)}.cb-rc__label{display:grid;flex:1;grid-template-columns:auto 3.5rem 1fr auto auto;align-items:center;gap:.6rem;min-width:0;padding:.5rem .85rem;cursor:pointer}.cb-rc__label>input{inline-size:1.125rem;block-size:1.125rem;margin:0}.cb-rc__date{color:var(--cb-color-text-muted);font-variant-numeric:tabular-nums}.cb-rc__desc{min-width:0;overflow-wrap:break-word;line-height:1.3}.cb-rc__ref{margin-left:.35rem;padding:0 .35rem;border-radius:4px;background:var(--cb-color-surface-subtle);color:var(--cb-color-text-muted);font-size:var(--cb-text-xs, .75rem)}.cb-rc__amount{font-variant-numeric:tabular-nums;font-weight:var(--cb-font-weight-medium, 500);text-align:end;white-space:nowrap}.cb-rc__amount--out{color:var(--cb-color-danger-text, #dc2626)}.cb-rc__item--matched .cb-rc__amount--out{color:inherit}.cb-rc__linked{color:var(--cb-color-success-text, #059669)}.cb-rc__create{display:inline-flex;flex:none;align-items:center;justify-content:center;width:1.75rem;height:1.75rem;padding:0;border:1px solid var(--cb-color-border-strong);border-radius:var(--cb-radius-sm, 4px);background:var(--cb-color-bg);color:var(--cb-color-text);font:inherit;font-size:var(--cb-text-xs, .75rem);cursor:pointer}.cb-rc__create:focus-visible{outline:2px solid var(--cb-color-focus-ring);outline-offset:1px}.cb-rc__empty{padding:1.5rem 1rem;color:var(--cb-color-text-muted);text-align:center}@container (max-width: 30rem){.cb-rc__label{grid-template-columns:auto auto 1fr auto;grid-template-areas:\"check date amount linked\" \". desc desc desc\";row-gap:.15rem}.cb-rc__label>input{grid-area:check}.cb-rc__date{grid-area:date}.cb-rc__desc{grid-area:desc}.cb-rc__amount{grid-area:amount}.cb-rc__linked{grid-area:linked}}.cb-rc__sr{position:absolute;width:1px;height:1px;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap}\n"] }]
|
|
376
|
+
}], propDecorators: { statement: [{ type: i0.Input, args: [{ isSignal: true, alias: "statement", required: false }] }], ledger: [{ type: i0.Input, args: [{ isSignal: true, alias: "ledger", required: false }] }], matches: [{ type: i0.Input, args: [{ isSignal: true, alias: "matches", required: false }] }, { type: i0.Output, args: ["matchesChange"] }], toleranceDays: [{ type: i0.Input, args: [{ isSignal: true, alias: "toleranceDays", required: false }] }], statementLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "statementLabel", required: false }] }], ledgerLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "ledgerLabel", required: false }] }], allowCreate: [{ type: i0.Input, args: [{ isSignal: true, alias: "allowCreate", required: false }] }], readonly: [{ type: i0.Input, args: [{ isSignal: true, alias: "readonly", required: false }] }], currency: [{ type: i0.Input, args: [{ isSignal: true, alias: "currency", required: false }] }], createEntry: [{ type: i0.Output, args: ["createEntry"] }] } });
|
|
377
|
+
|
|
378
|
+
/*
|
|
379
|
+
* Public API Surface de @caribeng/ui/reconciliation
|
|
380
|
+
*/
|
|
381
|
+
|
|
382
|
+
/**
|
|
383
|
+
* Generated bundle index. Do not edit.
|
|
384
|
+
*/
|
|
385
|
+
|
|
386
|
+
export { CbReconciliation, autoMatch, matchedIds, sumAmounts };
|
|
@@ -15,6 +15,8 @@ class CbRippleDirective {
|
|
|
15
15
|
onPointerDown(event) {
|
|
16
16
|
if (this.cbRippleDisabled())
|
|
17
17
|
return;
|
|
18
|
+
if (this.hostRef.nativeElement.ownerDocument.defaultView?.matchMedia?.('(prefers-reduced-motion: reduce)').matches)
|
|
19
|
+
return;
|
|
18
20
|
const host = this.hostRef.nativeElement;
|
|
19
21
|
const rect = host.getBoundingClientRect();
|
|
20
22
|
const size = Math.max(rect.width, rect.height, 48);
|