@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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { inject, ElementRef, Injector, input, output, signal, afterNextRender, ViewEncapsulation, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
3
|
-
import { injectCbTranslation } from '@caribeng/ui';
|
|
2
|
+
import { inject, ElementRef, Injector, input, computed, output, signal, afterNextRender, ViewEncapsulation, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
3
|
+
import { injectCbTranslation, cbVisibleItems, cbRunCommand } from '@caribeng/ui';
|
|
4
4
|
import { CbIcon } from '@caribeng/ui/icon';
|
|
5
5
|
|
|
6
6
|
let nextUid = 0;
|
|
@@ -24,6 +24,9 @@ class CbMegaMenu {
|
|
|
24
24
|
/** Categorías con sus grupos de enlaces. */
|
|
25
25
|
this.items = input([], /* @ts-ignore */
|
|
26
26
|
...(ngDevMode ? [{ debugName: "items" }] : /* istanbul ignore next */ []));
|
|
27
|
+
/** Items sin los de `visible: false`. */
|
|
28
|
+
this.visibleItems = computed(() => cbVisibleItems(this.items()), /* @ts-ignore */
|
|
29
|
+
...(ngDevMode ? [{ debugName: "visibleItems" }] : /* istanbul ignore next */ []));
|
|
27
30
|
/** Nombre accesible de la navegación. Por defecto, "Categorías" del idioma activo. */
|
|
28
31
|
this.ariaLabel = input(undefined, /* @ts-ignore */
|
|
29
32
|
...(ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []));
|
|
@@ -38,6 +41,7 @@ class CbMegaMenu {
|
|
|
38
41
|
select(link) {
|
|
39
42
|
if (link.disabled)
|
|
40
43
|
return;
|
|
44
|
+
cbRunCommand(link);
|
|
41
45
|
this.itemSelect.emit(link);
|
|
42
46
|
this.close();
|
|
43
47
|
}
|
|
@@ -55,7 +59,7 @@ class CbMegaMenu {
|
|
|
55
59
|
this.close();
|
|
56
60
|
}
|
|
57
61
|
onTriggerKeydown(event, index) {
|
|
58
|
-
const count = this.
|
|
62
|
+
const count = this.visibleItems().length;
|
|
59
63
|
switch (event.key) {
|
|
60
64
|
case 'ArrowRight':
|
|
61
65
|
this.focusTrigger((index + 1) % count);
|
|
@@ -122,7 +126,7 @@ class CbMegaMenu {
|
|
|
122
126
|
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: CbMegaMenu, isStandalone: true, selector: "cb-megamenu", inputs: { items: { classPropertyName: "items", publicName: "items", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "ariaLabel", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { itemSelect: "itemSelect" }, host: { listeners: { "document:click": "onDocumentClick($event)", "focusout": "onFocusOut($event)" }, classAttribute: "cb-megamenu" }, ngImport: i0, template: `
|
|
123
127
|
<nav [attr.aria-label]="ariaLabel() ?? t().categories">
|
|
124
128
|
<ul class="cb-megamenu__bar">
|
|
125
|
-
@for (item of
|
|
129
|
+
@for (item of visibleItems(); track $index; let i = $index) {
|
|
126
130
|
<li>
|
|
127
131
|
<button
|
|
128
132
|
class="cb-megamenu__trigger"
|
|
@@ -152,10 +156,10 @@ class CbMegaMenu {
|
|
|
152
156
|
class="cb-megamenu__panel"
|
|
153
157
|
[id]="panelId"
|
|
154
158
|
role="region"
|
|
155
|
-
[attr.aria-label]="
|
|
159
|
+
[attr.aria-label]="visibleItems()[openIndex()!].label"
|
|
156
160
|
(keydown)="onPanelKeydown($event)"
|
|
157
161
|
>
|
|
158
|
-
@for (group of
|
|
162
|
+
@for (group of visibleItems()[openIndex()!].groups; track $index) {
|
|
159
163
|
<div class="cb-megamenu__group">
|
|
160
164
|
<h3>{{ group.label }}</h3>
|
|
161
165
|
<ul>
|
|
@@ -195,7 +199,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImpor
|
|
|
195
199
|
}, template: `
|
|
196
200
|
<nav [attr.aria-label]="ariaLabel() ?? t().categories">
|
|
197
201
|
<ul class="cb-megamenu__bar">
|
|
198
|
-
@for (item of
|
|
202
|
+
@for (item of visibleItems(); track $index; let i = $index) {
|
|
199
203
|
<li>
|
|
200
204
|
<button
|
|
201
205
|
class="cb-megamenu__trigger"
|
|
@@ -225,10 +229,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImpor
|
|
|
225
229
|
class="cb-megamenu__panel"
|
|
226
230
|
[id]="panelId"
|
|
227
231
|
role="region"
|
|
228
|
-
[attr.aria-label]="
|
|
232
|
+
[attr.aria-label]="visibleItems()[openIndex()!].label"
|
|
229
233
|
(keydown)="onPanelKeydown($event)"
|
|
230
234
|
>
|
|
231
|
-
@for (group of
|
|
235
|
+
@for (group of visibleItems()[openIndex()!].groups; track $index) {
|
|
232
236
|
<div class="cb-megamenu__group">
|
|
233
237
|
<h3>{{ group.label }}</h3>
|
|
234
238
|
<ul>
|
|
@@ -0,0 +1,495 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { inject, ViewContainerRef, Injector, viewChild, model, input, booleanAttribute, output, signal, computed, afterNextRender, forwardRef, ViewEncapsulation, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
3
|
+
import { NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
4
|
+
import { Overlay } from '@angular/cdk/overlay';
|
|
5
|
+
import { TemplatePortal } from '@angular/cdk/portal';
|
|
6
|
+
import { injectCbTranslation, cbFieldState, cbFormat } from '@caribeng/ui';
|
|
7
|
+
|
|
8
|
+
/** Propiedades que afectan a cómo se reparte el texto en líneas. */
|
|
9
|
+
const MIRRORED = [
|
|
10
|
+
'boxSizing',
|
|
11
|
+
'width',
|
|
12
|
+
'height',
|
|
13
|
+
'overflowX',
|
|
14
|
+
'overflowY',
|
|
15
|
+
'borderTopWidth',
|
|
16
|
+
'borderRightWidth',
|
|
17
|
+
'borderBottomWidth',
|
|
18
|
+
'borderLeftWidth',
|
|
19
|
+
'paddingTop',
|
|
20
|
+
'paddingRight',
|
|
21
|
+
'paddingBottom',
|
|
22
|
+
'paddingLeft',
|
|
23
|
+
'fontStyle',
|
|
24
|
+
'fontVariant',
|
|
25
|
+
'fontWeight',
|
|
26
|
+
'fontStretch',
|
|
27
|
+
'fontSize',
|
|
28
|
+
'lineHeight',
|
|
29
|
+
'fontFamily',
|
|
30
|
+
'textAlign',
|
|
31
|
+
'textTransform',
|
|
32
|
+
'textIndent',
|
|
33
|
+
'letterSpacing',
|
|
34
|
+
'wordSpacing',
|
|
35
|
+
'tabSize',
|
|
36
|
+
];
|
|
37
|
+
/**
|
|
38
|
+
* Posición (px, relativa al campo) del carácter `index` de un textarea o
|
|
39
|
+
* input, con un div espejo invisible que copia su tipografía y su ancho.
|
|
40
|
+
* Sirve para abrir el panel de sugerencias justo bajo lo que se escribe.
|
|
41
|
+
*/
|
|
42
|
+
function cbCaretCoordinates(field, index) {
|
|
43
|
+
const doc = field.ownerDocument;
|
|
44
|
+
const style = doc.defaultView?.getComputedStyle(field);
|
|
45
|
+
const mirror = doc.createElement('div');
|
|
46
|
+
const isInput = field.nodeName === 'INPUT';
|
|
47
|
+
mirror.style.position = 'absolute';
|
|
48
|
+
mirror.style.visibility = 'hidden';
|
|
49
|
+
mirror.style.top = '0';
|
|
50
|
+
mirror.style.left = '-9999px';
|
|
51
|
+
mirror.style.whiteSpace = isInput ? 'nowrap' : 'pre-wrap';
|
|
52
|
+
mirror.style.overflowWrap = 'break-word';
|
|
53
|
+
if (style)
|
|
54
|
+
for (const prop of MIRRORED)
|
|
55
|
+
mirror.style[prop] = style[prop];
|
|
56
|
+
mirror.textContent = field.value.slice(0, index);
|
|
57
|
+
const marker = doc.createElement('span');
|
|
58
|
+
marker.textContent = field.value.slice(index) || '.';
|
|
59
|
+
mirror.appendChild(marker);
|
|
60
|
+
doc.body.appendChild(mirror);
|
|
61
|
+
const lineHeight = parseFloat(style?.lineHeight ?? '') || parseFloat(style?.fontSize ?? '') * 1.2 || 18;
|
|
62
|
+
const result = {
|
|
63
|
+
top: marker.offsetTop + (parseFloat(style?.borderTopWidth ?? '') || 0) - field.scrollTop,
|
|
64
|
+
left: marker.offsetLeft + (parseFloat(style?.borderLeftWidth ?? '') || 0) - field.scrollLeft,
|
|
65
|
+
height: lineHeight,
|
|
66
|
+
};
|
|
67
|
+
mirror.remove();
|
|
68
|
+
return result;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
let nextUid = 0;
|
|
72
|
+
const normalize = (text) => text.normalize('NFD').replace(/[̀-ͯ]/g, '').toLowerCase();
|
|
73
|
+
/**
|
|
74
|
+
* Campo de texto con menciones de CaribeNG: al escribir `@` (u otro
|
|
75
|
+
* disparador como `#`) muestra sugerencias junto al cursor, que se filtran
|
|
76
|
+
* sin tildes y se eligen con el teclado o el ratón. Funciona con Angular Forms
|
|
77
|
+
* (el valor es el texto) y emite las menciones presentes con su `id`.
|
|
78
|
+
*
|
|
79
|
+
* @example
|
|
80
|
+
* ```html
|
|
81
|
+
* <cb-mentions label="Comentario" [suggestions]="equipo" formControlName="comentario" (mentionsChange)="menciones = $event" />
|
|
82
|
+
* ```
|
|
83
|
+
*/
|
|
84
|
+
class CbMentions {
|
|
85
|
+
constructor() {
|
|
86
|
+
/** Textos de interfaz en el idioma activo (`provideCaribeNG({ locale })`). */
|
|
87
|
+
this.t = injectCbTranslation();
|
|
88
|
+
this.overlay = inject(Overlay);
|
|
89
|
+
this.vcr = inject(ViewContainerRef);
|
|
90
|
+
this.injector = inject(Injector);
|
|
91
|
+
this.fieldEl = viewChild.required('field');
|
|
92
|
+
this.panelTpl = viewChild.required('panel');
|
|
93
|
+
this.overlayRef = null;
|
|
94
|
+
this.inputId = `cb-mentions-${++nextUid}`;
|
|
95
|
+
this.listId = `${this.inputId}-list`;
|
|
96
|
+
/** Texto (bidireccional y con Angular Forms). */
|
|
97
|
+
this.value = model('', /* @ts-ignore */
|
|
98
|
+
...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
|
|
99
|
+
/** Elementos mencionables. Cada uno puede indicar su `trigger`. */
|
|
100
|
+
this.suggestions = input([], /* @ts-ignore */
|
|
101
|
+
...(ngDevMode ? [{ debugName: "suggestions" }] : /* istanbul ignore next */ []));
|
|
102
|
+
/** Caracteres que abren las sugerencias. */
|
|
103
|
+
this.triggers = input(['@'], /* @ts-ignore */
|
|
104
|
+
...(ngDevMode ? [{ debugName: "triggers" }] : /* istanbul ignore next */ []));
|
|
105
|
+
/** Filtra `suggestions` con lo escrito. Desactívalo si llegan ya filtradas del servidor. */
|
|
106
|
+
this.filter = input(true, { ...(ngDevMode ? { debugName: "filter" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
107
|
+
/** Máximo de sugerencias visibles. */
|
|
108
|
+
this.maxResults = input(8, /* @ts-ignore */
|
|
109
|
+
...(ngDevMode ? [{ debugName: "maxResults" }] : /* istanbul ignore next */ []));
|
|
110
|
+
/** Muestra "Cargando" mientras no hay sugerencias. */
|
|
111
|
+
this.loading = input(false, { ...(ngDevMode ? { debugName: "loading" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
112
|
+
this.label = input('', /* @ts-ignore */
|
|
113
|
+
...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
|
|
114
|
+
this.hint = input('', /* @ts-ignore */
|
|
115
|
+
...(ngDevMode ? [{ debugName: "hint" }] : /* istanbul ignore next */ []));
|
|
116
|
+
this.placeholder = input('', /* @ts-ignore */
|
|
117
|
+
...(ngDevMode ? [{ debugName: "placeholder" }] : /* istanbul ignore next */ []));
|
|
118
|
+
/** Nombre accesible sin `label` visible. */
|
|
119
|
+
this.ariaLabel = input('', /* @ts-ignore */
|
|
120
|
+
...(ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []));
|
|
121
|
+
this.rows = input(3, /* @ts-ignore */
|
|
122
|
+
...(ngDevMode ? [{ debugName: "rows" }] : /* istanbul ignore next */ []));
|
|
123
|
+
this.invalid = input(false, { ...(ngDevMode ? { debugName: "invalid" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
124
|
+
this.required = input(false, { ...(ngDevMode ? { debugName: "required" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
125
|
+
this.requiredIndicator = input(undefined, /* @ts-ignore */
|
|
126
|
+
...(ngDevMode ? [{ debugName: "requiredIndicator" }] : /* istanbul ignore next */ []));
|
|
127
|
+
this.disabled = input(false, { ...(ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
128
|
+
/** Lo escrito tras el disparador (para pedir sugerencias). */
|
|
129
|
+
this.search = output();
|
|
130
|
+
/** Menciones presentes en el texto, cada vez que cambian. */
|
|
131
|
+
this.mentionsChange = output();
|
|
132
|
+
this.fieldState = cbFieldState({
|
|
133
|
+
invalid: () => this.invalid(),
|
|
134
|
+
required: () => this.required(),
|
|
135
|
+
requiredIndicator: () => this.requiredIndicator(),
|
|
136
|
+
});
|
|
137
|
+
this.cvaDisabled = signal(false, /* @ts-ignore */
|
|
138
|
+
...(ngDevMode ? [{ debugName: "cvaDisabled" }] : /* istanbul ignore next */ []));
|
|
139
|
+
this.isDisabled = computed(() => this.disabled() || this.cvaDisabled(), /* @ts-ignore */
|
|
140
|
+
...(ngDevMode ? [{ debugName: "isDisabled" }] : /* istanbul ignore next */ []));
|
|
141
|
+
this.query = signal(null, /* @ts-ignore */
|
|
142
|
+
...(ngDevMode ? [{ debugName: "query" }] : /* istanbul ignore next */ []));
|
|
143
|
+
this.open = signal(false, /* @ts-ignore */
|
|
144
|
+
...(ngDevMode ? [{ debugName: "open" }] : /* istanbul ignore next */ []));
|
|
145
|
+
this.active = signal(0, /* @ts-ignore */
|
|
146
|
+
...(ngDevMode ? [{ debugName: "active" }] : /* istanbul ignore next */ []));
|
|
147
|
+
this.announcement = signal('', /* @ts-ignore */
|
|
148
|
+
...(ngDevMode ? [{ debugName: "announcement" }] : /* istanbul ignore next */ []));
|
|
149
|
+
/** Menciones elegidas (se conservan mientras su texto siga en el campo). */
|
|
150
|
+
this.chosen = [];
|
|
151
|
+
this.lastMentions = '';
|
|
152
|
+
this.results = computed(() => {
|
|
153
|
+
const q = this.query();
|
|
154
|
+
if (!q)
|
|
155
|
+
return [];
|
|
156
|
+
const items = this.suggestions().filter((s) => (s.trigger ?? '@') === q.trigger);
|
|
157
|
+
if (!this.filter())
|
|
158
|
+
return items.slice(0, this.maxResults());
|
|
159
|
+
const needle = normalize(q.query);
|
|
160
|
+
const scored = items
|
|
161
|
+
.map((item) => {
|
|
162
|
+
const label = normalize(item.label);
|
|
163
|
+
const score = !needle ? 1 : label.startsWith(needle) ? 3 : label.split(/\s+/).some((w) => w.startsWith(needle)) ? 2 : label.includes(needle) ? 1 : 0;
|
|
164
|
+
return { item, score };
|
|
165
|
+
})
|
|
166
|
+
.filter((e) => e.score > 0)
|
|
167
|
+
.sort((a, b) => b.score - a.score);
|
|
168
|
+
return scored.slice(0, this.maxResults()).map((e) => e.item);
|
|
169
|
+
}, /* @ts-ignore */
|
|
170
|
+
...(ngDevMode ? [{ debugName: "results" }] : /* istanbul ignore next */ []));
|
|
171
|
+
this.activeId = computed(() => (this.results().length ? `${this.listId}-${this.active()}` : null), /* @ts-ignore */
|
|
172
|
+
...(ngDevMode ? [{ debugName: "activeId" }] : /* istanbul ignore next */ []));
|
|
173
|
+
this.onChange = () => { };
|
|
174
|
+
this.onTouched = () => { };
|
|
175
|
+
}
|
|
176
|
+
initials(item) {
|
|
177
|
+
return item.label
|
|
178
|
+
.split(/\s+/)
|
|
179
|
+
.filter(Boolean)
|
|
180
|
+
.slice(0, 2)
|
|
181
|
+
.map((w) => w.charAt(0).toUpperCase())
|
|
182
|
+
.join('');
|
|
183
|
+
}
|
|
184
|
+
// --- ControlValueAccessor ---------------------------------------------------
|
|
185
|
+
writeValue(value) {
|
|
186
|
+
this.value.set(value ?? '');
|
|
187
|
+
this.syncMentions(false);
|
|
188
|
+
}
|
|
189
|
+
registerOnChange(fn) {
|
|
190
|
+
this.onChange = fn;
|
|
191
|
+
}
|
|
192
|
+
registerOnTouched(fn) {
|
|
193
|
+
this.onTouched = fn;
|
|
194
|
+
}
|
|
195
|
+
setDisabledState(isDisabled) {
|
|
196
|
+
this.cvaDisabled.set(isDisabled);
|
|
197
|
+
}
|
|
198
|
+
// --- Escritura ----------------------------------------------------------------
|
|
199
|
+
onInput(event) {
|
|
200
|
+
const text = event.target.value;
|
|
201
|
+
this.value.set(text);
|
|
202
|
+
this.onChange(text);
|
|
203
|
+
this.syncMentions(true);
|
|
204
|
+
this.detect();
|
|
205
|
+
}
|
|
206
|
+
onBlur() {
|
|
207
|
+
this.onTouched();
|
|
208
|
+
this.close();
|
|
209
|
+
}
|
|
210
|
+
/** Busca un disparador justo antes del cursor y abre (o cierra) las sugerencias. */
|
|
211
|
+
detect() {
|
|
212
|
+
const el = this.fieldEl().nativeElement;
|
|
213
|
+
const caret = el.selectionStart ?? el.value.length;
|
|
214
|
+
if (el.selectionEnd !== caret)
|
|
215
|
+
return this.close();
|
|
216
|
+
const before = el.value.slice(0, caret);
|
|
217
|
+
let found = null;
|
|
218
|
+
for (const trigger of this.triggers()) {
|
|
219
|
+
const start = before.lastIndexOf(trigger);
|
|
220
|
+
if (start < 0 || (start > 0 && !/\s|[([{"'¿¡]/.test(before[start - 1])))
|
|
221
|
+
continue;
|
|
222
|
+
const query = before.slice(start + trigger.length);
|
|
223
|
+
// Admite nombres con espacios, pero no saltos de línea ni búsquedas larguísimas.
|
|
224
|
+
if (/\n/.test(query) || query.length > 40 || /\s{2}/.test(query))
|
|
225
|
+
continue;
|
|
226
|
+
if (!found || start > found.start)
|
|
227
|
+
found = { trigger, query, start };
|
|
228
|
+
}
|
|
229
|
+
if (!found)
|
|
230
|
+
return this.close();
|
|
231
|
+
const previous = this.query();
|
|
232
|
+
this.query.set(found);
|
|
233
|
+
if (previous?.query !== found.query || previous.trigger !== found.trigger) {
|
|
234
|
+
this.active.set(0);
|
|
235
|
+
this.search.emit({ trigger: found.trigger, query: found.query });
|
|
236
|
+
}
|
|
237
|
+
// Con un espacio y sin resultados, se entiende que ya no es una mención.
|
|
238
|
+
if (/\s/.test(found.query) && !this.results().length && !this.loading())
|
|
239
|
+
return this.close();
|
|
240
|
+
this.openPanel(found.start);
|
|
241
|
+
this.announcement.set(this.results().length ? cbFormat(this.t().mentionsCount, this.results().length) : this.t().noResults);
|
|
242
|
+
}
|
|
243
|
+
onKeydown(event) {
|
|
244
|
+
if (!this.open())
|
|
245
|
+
return;
|
|
246
|
+
const count = this.results().length;
|
|
247
|
+
switch (event.key) {
|
|
248
|
+
case 'ArrowDown':
|
|
249
|
+
case 'ArrowUp':
|
|
250
|
+
if (!count)
|
|
251
|
+
return;
|
|
252
|
+
event.preventDefault();
|
|
253
|
+
this.active.set((this.active() + (event.key === 'ArrowDown' ? 1 : -1) + count) % count);
|
|
254
|
+
this.scrollActiveIntoView();
|
|
255
|
+
break;
|
|
256
|
+
case 'Enter':
|
|
257
|
+
case 'Tab': {
|
|
258
|
+
const item = this.results()[this.active()];
|
|
259
|
+
if (!item)
|
|
260
|
+
return;
|
|
261
|
+
event.preventDefault();
|
|
262
|
+
this.choose(item);
|
|
263
|
+
break;
|
|
264
|
+
}
|
|
265
|
+
case 'Escape':
|
|
266
|
+
event.preventDefault();
|
|
267
|
+
event.stopPropagation();
|
|
268
|
+
this.close();
|
|
269
|
+
break;
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
/** Inserta la mención elegida en lugar de lo escrito tras el disparador. */
|
|
273
|
+
choose(item) {
|
|
274
|
+
const q = this.query();
|
|
275
|
+
const el = this.fieldEl().nativeElement;
|
|
276
|
+
if (!q)
|
|
277
|
+
return;
|
|
278
|
+
const caret = el.selectionStart ?? el.value.length;
|
|
279
|
+
const inserted = `${q.trigger}${item.label} `;
|
|
280
|
+
const text = el.value.slice(0, q.start) + inserted + el.value.slice(caret);
|
|
281
|
+
const position = q.start + inserted.length;
|
|
282
|
+
this.value.set(text);
|
|
283
|
+
el.value = text;
|
|
284
|
+
el.setSelectionRange(position, position);
|
|
285
|
+
this.chosen = [...this.chosen.filter((m) => !(m.id === item.id && m.trigger === q.trigger)), { id: item.id, label: item.label, trigger: q.trigger }];
|
|
286
|
+
this.onChange(text);
|
|
287
|
+
this.close();
|
|
288
|
+
this.syncMentions(true);
|
|
289
|
+
el.focus();
|
|
290
|
+
}
|
|
291
|
+
/** Quita las menciones cuyo texto ya no está y avisa si cambió la lista. */
|
|
292
|
+
syncMentions(emit) {
|
|
293
|
+
const text = this.value();
|
|
294
|
+
this.chosen = this.chosen.filter((m) => text.includes(`${m.trigger}${m.label}`));
|
|
295
|
+
const signature = JSON.stringify(this.chosen.map((m) => `${m.trigger}${m.id}`));
|
|
296
|
+
if (signature === this.lastMentions)
|
|
297
|
+
return;
|
|
298
|
+
this.lastMentions = signature;
|
|
299
|
+
if (emit)
|
|
300
|
+
this.mentionsChange.emit([...this.chosen]);
|
|
301
|
+
}
|
|
302
|
+
// --- Panel ---------------------------------------------------------------------
|
|
303
|
+
openPanel(start) {
|
|
304
|
+
const el = this.fieldEl().nativeElement;
|
|
305
|
+
const rect = el.getBoundingClientRect();
|
|
306
|
+
const caret = cbCaretCoordinates(el, start);
|
|
307
|
+
const origin = { x: rect.left + caret.left, y: rect.top + caret.top + caret.height };
|
|
308
|
+
if (this.overlayRef) {
|
|
309
|
+
this.overlayRef.updatePositionStrategy(this.position(origin));
|
|
310
|
+
return;
|
|
311
|
+
}
|
|
312
|
+
this.overlayRef = this.overlay.create({
|
|
313
|
+
positionStrategy: this.position(origin),
|
|
314
|
+
scrollStrategy: this.overlay.scrollStrategies.reposition(),
|
|
315
|
+
});
|
|
316
|
+
this.overlayRef.attach(new TemplatePortal(this.panelTpl(), this.vcr));
|
|
317
|
+
this.open.set(true);
|
|
318
|
+
}
|
|
319
|
+
position(origin) {
|
|
320
|
+
return this.overlay
|
|
321
|
+
.position()
|
|
322
|
+
.flexibleConnectedTo(origin)
|
|
323
|
+
.withPositions([
|
|
324
|
+
{ originX: 'start', originY: 'top', overlayX: 'start', overlayY: 'top', offsetY: 4 },
|
|
325
|
+
{ originX: 'start', originY: 'top', overlayX: 'start', overlayY: 'bottom', offsetY: -24 },
|
|
326
|
+
])
|
|
327
|
+
.withPush(true);
|
|
328
|
+
}
|
|
329
|
+
/** Cierra las sugerencias. */
|
|
330
|
+
close() {
|
|
331
|
+
this.query.set(null);
|
|
332
|
+
if (!this.overlayRef)
|
|
333
|
+
return;
|
|
334
|
+
this.overlayRef.dispose();
|
|
335
|
+
this.overlayRef = null;
|
|
336
|
+
this.open.set(false);
|
|
337
|
+
this.announcement.set('');
|
|
338
|
+
}
|
|
339
|
+
scrollActiveIntoView() {
|
|
340
|
+
const id = this.activeId();
|
|
341
|
+
afterNextRender(() => (id ? this.overlayRef?.overlayElement.querySelector(`#${id}`)?.scrollIntoView?.({ block: 'nearest' }) : null), {
|
|
342
|
+
injector: this.injector,
|
|
343
|
+
});
|
|
344
|
+
}
|
|
345
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: CbMentions, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
346
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: CbMentions, isStandalone: true, selector: "cb-mentions", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, suggestions: { classPropertyName: "suggestions", publicName: "suggestions", isSignal: true, isRequired: false, transformFunction: null }, triggers: { classPropertyName: "triggers", publicName: "triggers", isSignal: true, isRequired: false, transformFunction: null }, filter: { classPropertyName: "filter", publicName: "filter", isSignal: true, isRequired: false, transformFunction: null }, maxResults: { classPropertyName: "maxResults", publicName: "maxResults", isSignal: true, isRequired: false, transformFunction: null }, loading: { classPropertyName: "loading", publicName: "loading", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, hint: { classPropertyName: "hint", publicName: "hint", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "ariaLabel", isSignal: true, isRequired: false, transformFunction: null }, rows: { classPropertyName: "rows", publicName: "rows", isSignal: true, isRequired: false, transformFunction: null }, invalid: { classPropertyName: "invalid", publicName: "invalid", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null }, requiredIndicator: { classPropertyName: "requiredIndicator", publicName: "requiredIndicator", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange", search: "search", mentionsChange: "mentionsChange" }, host: { classAttribute: "cb-mentions" }, providers: [{ provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => CbMentions), multi: true }], viewQueries: [{ propertyName: "fieldEl", first: true, predicate: ["field"], descendants: true, isSignal: true }, { propertyName: "panelTpl", first: true, predicate: ["panel"], descendants: true, isSignal: true }], ngImport: i0, template: `
|
|
347
|
+
@if (label()) {
|
|
348
|
+
<label class="cb-mentions__label" [attr.for]="inputId">
|
|
349
|
+
{{ label() }}
|
|
350
|
+
@if (fieldState.indicator(); as mark) {
|
|
351
|
+
<span [class]="'cb-mentions__required cb-mentions__required--' + mark.kind" [attr.aria-hidden]="mark.kind === 'optional' ? null : 'true'">{{ mark.text }}</span>
|
|
352
|
+
}
|
|
353
|
+
</label>
|
|
354
|
+
}
|
|
355
|
+
<textarea
|
|
356
|
+
#field
|
|
357
|
+
class="cb-mentions__field"
|
|
358
|
+
[class.cb-is-invalid]="fieldState.invalid()"
|
|
359
|
+
[id]="inputId"
|
|
360
|
+
[rows]="rows()"
|
|
361
|
+
[value]="value()"
|
|
362
|
+
[placeholder]="placeholder()"
|
|
363
|
+
[disabled]="isDisabled()"
|
|
364
|
+
[required]="fieldState.required()"
|
|
365
|
+
aria-autocomplete="list"
|
|
366
|
+
[attr.aria-controls]="open() ? listId : null"
|
|
367
|
+
[attr.aria-activedescendant]="open() ? activeId() : null"
|
|
368
|
+
[attr.aria-invalid]="fieldState.invalid() ? 'true' : null"
|
|
369
|
+
[attr.aria-describedby]="hint() ? inputId + '-hint' : null"
|
|
370
|
+
[attr.aria-label]="label() ? null : (ariaLabel() || null)"
|
|
371
|
+
(input)="onInput($event)"
|
|
372
|
+
(keydown)="onKeydown($event)"
|
|
373
|
+
(click)="detect()"
|
|
374
|
+
(blur)="onBlur()"
|
|
375
|
+
></textarea>
|
|
376
|
+
@if (hint()) {
|
|
377
|
+
<p class="cb-mentions__hint" [id]="inputId + '-hint'">{{ hint() }}</p>
|
|
378
|
+
}
|
|
379
|
+
<div class="cb-mentions__sr" role="status">{{ announcement() }}</div>
|
|
380
|
+
|
|
381
|
+
<ng-template #panel>
|
|
382
|
+
<ul class="cb-mentions__panel" role="listbox" [id]="listId" [attr.aria-label]="label() || ariaLabel() || null">
|
|
383
|
+
@for (item of results(); track item.id; let i = $index) {
|
|
384
|
+
<li
|
|
385
|
+
class="cb-mentions__option"
|
|
386
|
+
role="option"
|
|
387
|
+
[id]="listId + '-' + i"
|
|
388
|
+
[class.cb-mentions__option--active]="i === active()"
|
|
389
|
+
[attr.aria-selected]="i === active()"
|
|
390
|
+
(mousedown)="$event.preventDefault()"
|
|
391
|
+
(mousemove)="active.set(i)"
|
|
392
|
+
(click)="choose(item)"
|
|
393
|
+
>
|
|
394
|
+
<span class="cb-mentions__avatar" aria-hidden="true">
|
|
395
|
+
@if (item.avatar) {
|
|
396
|
+
<img [src]="item.avatar" alt="" />
|
|
397
|
+
} @else {
|
|
398
|
+
{{ initials(item) }}
|
|
399
|
+
}
|
|
400
|
+
</span>
|
|
401
|
+
<span class="cb-mentions__text">
|
|
402
|
+
<span class="cb-mentions__name">{{ item.label }}</span>
|
|
403
|
+
@if (item.description) {
|
|
404
|
+
<span class="cb-mentions__description">{{ item.description }}</span>
|
|
405
|
+
}
|
|
406
|
+
</span>
|
|
407
|
+
</li>
|
|
408
|
+
} @empty {
|
|
409
|
+
<li class="cb-mentions__empty" role="presentation">{{ loading() ? t().loading : t().noResults }}</li>
|
|
410
|
+
}
|
|
411
|
+
</ul>
|
|
412
|
+
</ng-template>
|
|
413
|
+
`, isInline: true, styles: [":host{display:block;font-family:var(--cb-font-sans)}.cb-mentions__label{display:block;margin-bottom:var(--cb-space-1);font-size:var(--cb-text-sm);font-weight:var(--cb-font-weight-medium);color:var(--cb-color-text)}.cb-mentions__required{margin-left:2px;color:var(--cb-color-danger)}.cb-mentions__required--required,.cb-mentions__required--optional{margin-left:.25rem;color:var(--cb-color-text-muted);font-size:.85em;font-weight:var(--cb-font-weight-normal, 400)}.cb-mentions__field{box-sizing:border-box;display:block;width:100%;padding:var(--cb-space-2) var(--cb-space-3);border:var(--cb-border-width, 1px) solid var(--cb-color-border-strong);border-radius:var(--cb-radius-md);background-color:var(--cb-color-bg);color:var(--cb-color-text);font:inherit;font-size:var(--cb-text-base);line-height:1.5;resize:vertical;transition:border-color var(--cb-duration-fast) var(--cb-ease),box-shadow var(--cb-duration-fast) var(--cb-ease)}.cb-mentions__field::placeholder{color:var(--cb-color-text-muted)}.cb-mentions__field:hover:not(:disabled):not(:focus){border-color:var(--cb-color-text-muted)}.cb-mentions__field:focus-visible{outline:none;border-color:var(--cb-color-primary-500);box-shadow:0 0 0 3px color-mix(in srgb,var(--cb-color-primary-500) 25%,transparent)}.cb-mentions__field.cb-is-invalid{border-color:var(--cb-color-danger)}.cb-mentions__field:disabled{cursor:not-allowed;background-color:var(--cb-color-surface);color:var(--cb-color-text-muted)}.cb-mentions__hint{margin:var(--cb-space-1) 0 0;color:var(--cb-color-text-muted);font-size:var(--cb-text-sm)}.cb-mentions__sr{position:absolute;width:1px;height:1px;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap}.cb-mentions__panel{width:18rem;max-width:calc(100vw - 2rem);max-height:16rem;margin:0;padding:.375rem;overflow-y:auto;border:1px solid var(--cb-color-border);border-radius:var(--cb-radius-md);background:var(--cb-color-surface-raised);box-shadow:var(--cb-shadow-lg);color:var(--cb-color-text);font-family:var(--cb-font-sans);list-style:none}.cb-mentions__option{display:flex;align-items:center;gap:.625rem;padding:.375rem .5rem;border-radius:var(--cb-radius-sm);font-size:var(--cb-text-sm);cursor:pointer}.cb-mentions__option--active{background:var(--cb-color-surface-hover);box-shadow:inset 3px 0 0 var(--cb-color-primary)}.cb-mentions__avatar{display:inline-flex;flex:none;align-items:center;justify-content:center;width:1.75rem;height:1.75rem;overflow:hidden;border-radius:50%;background:color-mix(in srgb,var(--cb-color-primary) 14%,transparent);color:var(--cb-color-primary-text);font-size:.6875rem;font-weight:var(--cb-font-weight-semibold, 600)}.cb-mentions__avatar img{width:100%;height:100%;object-fit:cover}.cb-mentions__text{display:flex;flex-direction:column;min-width:0}.cb-mentions__name,.cb-mentions__description{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.cb-mentions__description{color:var(--cb-color-text-muted);font-size:var(--cb-text-xs)}.cb-mentions__empty{padding:.75rem;color:var(--cb-color-text-muted);font-size:var(--cb-text-sm);text-align:center}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
414
|
+
}
|
|
415
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: CbMentions, decorators: [{
|
|
416
|
+
type: Component,
|
|
417
|
+
args: [{ selector: 'cb-mentions', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.Emulated, host: { class: 'cb-mentions' }, providers: [{ provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => CbMentions), multi: true }], template: `
|
|
418
|
+
@if (label()) {
|
|
419
|
+
<label class="cb-mentions__label" [attr.for]="inputId">
|
|
420
|
+
{{ label() }}
|
|
421
|
+
@if (fieldState.indicator(); as mark) {
|
|
422
|
+
<span [class]="'cb-mentions__required cb-mentions__required--' + mark.kind" [attr.aria-hidden]="mark.kind === 'optional' ? null : 'true'">{{ mark.text }}</span>
|
|
423
|
+
}
|
|
424
|
+
</label>
|
|
425
|
+
}
|
|
426
|
+
<textarea
|
|
427
|
+
#field
|
|
428
|
+
class="cb-mentions__field"
|
|
429
|
+
[class.cb-is-invalid]="fieldState.invalid()"
|
|
430
|
+
[id]="inputId"
|
|
431
|
+
[rows]="rows()"
|
|
432
|
+
[value]="value()"
|
|
433
|
+
[placeholder]="placeholder()"
|
|
434
|
+
[disabled]="isDisabled()"
|
|
435
|
+
[required]="fieldState.required()"
|
|
436
|
+
aria-autocomplete="list"
|
|
437
|
+
[attr.aria-controls]="open() ? listId : null"
|
|
438
|
+
[attr.aria-activedescendant]="open() ? activeId() : null"
|
|
439
|
+
[attr.aria-invalid]="fieldState.invalid() ? 'true' : null"
|
|
440
|
+
[attr.aria-describedby]="hint() ? inputId + '-hint' : null"
|
|
441
|
+
[attr.aria-label]="label() ? null : (ariaLabel() || null)"
|
|
442
|
+
(input)="onInput($event)"
|
|
443
|
+
(keydown)="onKeydown($event)"
|
|
444
|
+
(click)="detect()"
|
|
445
|
+
(blur)="onBlur()"
|
|
446
|
+
></textarea>
|
|
447
|
+
@if (hint()) {
|
|
448
|
+
<p class="cb-mentions__hint" [id]="inputId + '-hint'">{{ hint() }}</p>
|
|
449
|
+
}
|
|
450
|
+
<div class="cb-mentions__sr" role="status">{{ announcement() }}</div>
|
|
451
|
+
|
|
452
|
+
<ng-template #panel>
|
|
453
|
+
<ul class="cb-mentions__panel" role="listbox" [id]="listId" [attr.aria-label]="label() || ariaLabel() || null">
|
|
454
|
+
@for (item of results(); track item.id; let i = $index) {
|
|
455
|
+
<li
|
|
456
|
+
class="cb-mentions__option"
|
|
457
|
+
role="option"
|
|
458
|
+
[id]="listId + '-' + i"
|
|
459
|
+
[class.cb-mentions__option--active]="i === active()"
|
|
460
|
+
[attr.aria-selected]="i === active()"
|
|
461
|
+
(mousedown)="$event.preventDefault()"
|
|
462
|
+
(mousemove)="active.set(i)"
|
|
463
|
+
(click)="choose(item)"
|
|
464
|
+
>
|
|
465
|
+
<span class="cb-mentions__avatar" aria-hidden="true">
|
|
466
|
+
@if (item.avatar) {
|
|
467
|
+
<img [src]="item.avatar" alt="" />
|
|
468
|
+
} @else {
|
|
469
|
+
{{ initials(item) }}
|
|
470
|
+
}
|
|
471
|
+
</span>
|
|
472
|
+
<span class="cb-mentions__text">
|
|
473
|
+
<span class="cb-mentions__name">{{ item.label }}</span>
|
|
474
|
+
@if (item.description) {
|
|
475
|
+
<span class="cb-mentions__description">{{ item.description }}</span>
|
|
476
|
+
}
|
|
477
|
+
</span>
|
|
478
|
+
</li>
|
|
479
|
+
} @empty {
|
|
480
|
+
<li class="cb-mentions__empty" role="presentation">{{ loading() ? t().loading : t().noResults }}</li>
|
|
481
|
+
}
|
|
482
|
+
</ul>
|
|
483
|
+
</ng-template>
|
|
484
|
+
`, styles: [":host{display:block;font-family:var(--cb-font-sans)}.cb-mentions__label{display:block;margin-bottom:var(--cb-space-1);font-size:var(--cb-text-sm);font-weight:var(--cb-font-weight-medium);color:var(--cb-color-text)}.cb-mentions__required{margin-left:2px;color:var(--cb-color-danger)}.cb-mentions__required--required,.cb-mentions__required--optional{margin-left:.25rem;color:var(--cb-color-text-muted);font-size:.85em;font-weight:var(--cb-font-weight-normal, 400)}.cb-mentions__field{box-sizing:border-box;display:block;width:100%;padding:var(--cb-space-2) var(--cb-space-3);border:var(--cb-border-width, 1px) solid var(--cb-color-border-strong);border-radius:var(--cb-radius-md);background-color:var(--cb-color-bg);color:var(--cb-color-text);font:inherit;font-size:var(--cb-text-base);line-height:1.5;resize:vertical;transition:border-color var(--cb-duration-fast) var(--cb-ease),box-shadow var(--cb-duration-fast) var(--cb-ease)}.cb-mentions__field::placeholder{color:var(--cb-color-text-muted)}.cb-mentions__field:hover:not(:disabled):not(:focus){border-color:var(--cb-color-text-muted)}.cb-mentions__field:focus-visible{outline:none;border-color:var(--cb-color-primary-500);box-shadow:0 0 0 3px color-mix(in srgb,var(--cb-color-primary-500) 25%,transparent)}.cb-mentions__field.cb-is-invalid{border-color:var(--cb-color-danger)}.cb-mentions__field:disabled{cursor:not-allowed;background-color:var(--cb-color-surface);color:var(--cb-color-text-muted)}.cb-mentions__hint{margin:var(--cb-space-1) 0 0;color:var(--cb-color-text-muted);font-size:var(--cb-text-sm)}.cb-mentions__sr{position:absolute;width:1px;height:1px;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap}.cb-mentions__panel{width:18rem;max-width:calc(100vw - 2rem);max-height:16rem;margin:0;padding:.375rem;overflow-y:auto;border:1px solid var(--cb-color-border);border-radius:var(--cb-radius-md);background:var(--cb-color-surface-raised);box-shadow:var(--cb-shadow-lg);color:var(--cb-color-text);font-family:var(--cb-font-sans);list-style:none}.cb-mentions__option{display:flex;align-items:center;gap:.625rem;padding:.375rem .5rem;border-radius:var(--cb-radius-sm);font-size:var(--cb-text-sm);cursor:pointer}.cb-mentions__option--active{background:var(--cb-color-surface-hover);box-shadow:inset 3px 0 0 var(--cb-color-primary)}.cb-mentions__avatar{display:inline-flex;flex:none;align-items:center;justify-content:center;width:1.75rem;height:1.75rem;overflow:hidden;border-radius:50%;background:color-mix(in srgb,var(--cb-color-primary) 14%,transparent);color:var(--cb-color-primary-text);font-size:.6875rem;font-weight:var(--cb-font-weight-semibold, 600)}.cb-mentions__avatar img{width:100%;height:100%;object-fit:cover}.cb-mentions__text{display:flex;flex-direction:column;min-width:0}.cb-mentions__name,.cb-mentions__description{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.cb-mentions__description{color:var(--cb-color-text-muted);font-size:var(--cb-text-xs)}.cb-mentions__empty{padding:.75rem;color:var(--cb-color-text-muted);font-size:var(--cb-text-sm);text-align:center}\n"] }]
|
|
485
|
+
}], propDecorators: { fieldEl: [{ type: i0.ViewChild, args: ['field', { isSignal: true }] }], panelTpl: [{ type: i0.ViewChild, args: ['panel', { isSignal: true }] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], suggestions: [{ type: i0.Input, args: [{ isSignal: true, alias: "suggestions", required: false }] }], triggers: [{ type: i0.Input, args: [{ isSignal: true, alias: "triggers", required: false }] }], filter: [{ type: i0.Input, args: [{ isSignal: true, alias: "filter", required: false }] }], maxResults: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxResults", required: false }] }], loading: [{ type: i0.Input, args: [{ isSignal: true, alias: "loading", required: false }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], hint: [{ type: i0.Input, args: [{ isSignal: true, alias: "hint", required: false }] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabel", required: false }] }], rows: [{ type: i0.Input, args: [{ isSignal: true, alias: "rows", required: false }] }], invalid: [{ type: i0.Input, args: [{ isSignal: true, alias: "invalid", required: false }] }], required: [{ type: i0.Input, args: [{ isSignal: true, alias: "required", required: false }] }], requiredIndicator: [{ type: i0.Input, args: [{ isSignal: true, alias: "requiredIndicator", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], search: [{ type: i0.Output, args: ["search"] }], mentionsChange: [{ type: i0.Output, args: ["mentionsChange"] }] } });
|
|
486
|
+
|
|
487
|
+
/*
|
|
488
|
+
* Public API Surface de @caribeng/ui/mentions
|
|
489
|
+
*/
|
|
490
|
+
|
|
491
|
+
/**
|
|
492
|
+
* Generated bundle index. Do not edit.
|
|
493
|
+
*/
|
|
494
|
+
|
|
495
|
+
export { CbMentions, cbCaretCoordinates };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { inject, ViewContainerRef, DestroyRef, input, output, viewChild, ViewEncapsulation, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
2
|
+
import { inject, ViewContainerRef, DestroyRef, input, computed, output, viewChild, ViewEncapsulation, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
3
3
|
import { Overlay } from '@angular/cdk/overlay';
|
|
4
4
|
import { TemplatePortal } from '@angular/cdk/portal';
|
|
5
5
|
import { CbIcon } from '@caribeng/ui/icon';
|
|
6
|
-
import { injectCbTranslation } from '@caribeng/ui';
|
|
6
|
+
import { injectCbTranslation, cbVisibleItems, cbRunCommand } from '@caribeng/ui';
|
|
7
7
|
|
|
8
8
|
/** Popup menu anchored to any trigger element. */
|
|
9
9
|
class CbMenu {
|
|
@@ -15,6 +15,9 @@ class CbMenu {
|
|
|
15
15
|
this.destroyRef = inject(DestroyRef);
|
|
16
16
|
this.items = input([], /* @ts-ignore */
|
|
17
17
|
...(ngDevMode ? [{ debugName: "items" }] : /* istanbul ignore next */ []));
|
|
18
|
+
/** Items sin los de `visible: false`. */
|
|
19
|
+
this.visibleItems = computed(() => cbVisibleItems(this.items()), /* @ts-ignore */
|
|
20
|
+
...(ngDevMode ? [{ debugName: "visibleItems" }] : /* istanbul ignore next */ []));
|
|
18
21
|
this.ariaLabel = input(undefined, /* @ts-ignore */
|
|
19
22
|
...(ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []));
|
|
20
23
|
this.itemSelect = output();
|
|
@@ -71,6 +74,7 @@ class CbMenu {
|
|
|
71
74
|
event.preventDefault();
|
|
72
75
|
return;
|
|
73
76
|
}
|
|
77
|
+
cbRunCommand(item, event);
|
|
74
78
|
this.itemSelect.emit(item);
|
|
75
79
|
this.hide();
|
|
76
80
|
}
|
|
@@ -100,7 +104,7 @@ class CbMenu {
|
|
|
100
104
|
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: CbMenu, isStandalone: true, selector: "cb-menu", inputs: { items: { classPropertyName: "items", publicName: "items", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "ariaLabel", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { itemSelect: "itemSelect", hidden: "hidden" }, viewQueries: [{ propertyName: "content", first: true, predicate: ["content"], descendants: true, isSignal: true }], ngImport: i0, template: `
|
|
101
105
|
<ng-template #content>
|
|
102
106
|
<div class="cb-menu__panel" role="menu" [attr.aria-label]="(ariaLabel() ?? t().menu) || null" (click)="onPanelClick($event)">
|
|
103
|
-
@for (item of
|
|
107
|
+
@for (item of visibleItems(); track $index) {
|
|
104
108
|
@if (item.separator) {
|
|
105
109
|
<div class="cb-menu__separator" role="separator"></div>
|
|
106
110
|
} @else {
|
|
@@ -140,7 +144,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImpor
|
|
|
140
144
|
args: [{ selector: 'cb-menu', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.Emulated, imports: [CbIcon], template: `
|
|
141
145
|
<ng-template #content>
|
|
142
146
|
<div class="cb-menu__panel" role="menu" [attr.aria-label]="(ariaLabel() ?? t().menu) || null" (click)="onPanelClick($event)">
|
|
143
|
-
@for (item of
|
|
147
|
+
@for (item of visibleItems(); track $index) {
|
|
144
148
|
@if (item.separator) {
|
|
145
149
|
<div class="cb-menu__separator" role="separator"></div>
|
|
146
150
|
} @else {
|