@caribeng/ui 22.1.1 → 22.2.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 +48 -8
- package/fesm2022/caribeng-ui-accordion.mjs +2 -2
- package/fesm2022/caribeng-ui-anchor.mjs +169 -0
- package/fesm2022/caribeng-ui-autocomplete.mjs +10 -8
- package/fesm2022/caribeng-ui-avatargroup.mjs +9 -3
- package/fesm2022/caribeng-ui-blockui.mjs +12 -4
- package/fesm2022/caribeng-ui-breadcrumb.mjs +5 -2
- package/fesm2022/caribeng-ui-button.mjs +22 -2
- package/fesm2022/caribeng-ui-caribe-alert.mjs +5 -2
- package/fesm2022/caribeng-ui-caribe-animation-lottie.mjs +6 -3
- package/fesm2022/caribeng-ui-caribe-button-group.mjs +6 -3
- package/fesm2022/caribeng-ui-caribe-calendar.mjs +11 -6
- package/fesm2022/caribeng-ui-caribe-card-content.mjs +6 -3
- package/fesm2022/caribeng-ui-caribe-card-move.mjs +29 -7
- package/fesm2022/caribeng-ui-caribe-card-select.mjs +56 -14
- package/fesm2022/caribeng-ui-caribe-circle-loading.mjs +10 -7
- package/fesm2022/caribeng-ui-caribe-coachmark.mjs +42 -19
- package/fesm2022/caribeng-ui-caribe-data-table.mjs +15 -9
- package/fesm2022/caribeng-ui-caribe-dots-indicator.mjs +38 -5
- package/fesm2022/caribeng-ui-caribe-expansion-panel.mjs +16 -5
- package/fesm2022/caribeng-ui-caribe-fab-menu.mjs +56 -7
- package/fesm2022/caribeng-ui-caribe-file-download.mjs +68 -27
- package/fesm2022/caribeng-ui-caribe-file-select.mjs +22 -17
- package/fesm2022/caribeng-ui-caribe-float-menu.mjs +6 -3
- package/fesm2022/caribeng-ui-caribe-footer.mjs +8 -4
- package/fesm2022/caribeng-ui-caribe-header.mjs +6 -3
- package/fesm2022/caribeng-ui-caribe-icon-button.mjs +6 -3
- package/fesm2022/caribeng-ui-caribe-illustration.mjs +6 -3
- package/fesm2022/caribeng-ui-caribe-inline-alert.mjs +5 -2
- package/fesm2022/caribeng-ui-caribe-input-search.mjs +14 -10
- package/fesm2022/caribeng-ui-caribe-input-select.mjs +12 -10
- package/fesm2022/caribeng-ui-caribe-input-token.mjs +61 -11
- package/fesm2022/caribeng-ui-caribe-link.mjs +7 -2
- package/fesm2022/caribeng-ui-caribe-loader.mjs +8 -5
- package/fesm2022/caribeng-ui-caribe-modal.mjs +32 -16
- package/fesm2022/caribeng-ui-caribe-off-canvas.mjs +26 -12
- package/fesm2022/caribeng-ui-caribe-onboarding.mjs +44 -19
- package/fesm2022/caribeng-ui-caribe-pictogram.mjs +6 -3
- package/fesm2022/caribeng-ui-caribe-pop-over.mjs +34 -10
- package/fesm2022/caribeng-ui-caribe-preloader.mjs +9 -6
- package/fesm2022/caribeng-ui-caribe-progress-bar.mjs +5 -2
- package/fesm2022/caribeng-ui-caribe-shortcut.mjs +8 -3
- package/fesm2022/caribeng-ui-caribe-step-indicator.mjs +12 -5
- package/fesm2022/caribeng-ui-caribe-stroke.mjs +6 -3
- package/fesm2022/caribeng-ui-caribe-switch.mjs +5 -3
- package/fesm2022/caribeng-ui-caribe-tag-button.mjs +1 -1
- package/fesm2022/caribeng-ui-caribe-tracker.mjs +5 -2
- package/fesm2022/caribeng-ui-caribe-transaction-status.mjs +1 -1
- package/fesm2022/caribeng-ui-caribe-voucher.mjs +11 -8
- package/fesm2022/caribeng-ui-carousel.mjs +49 -14
- package/fesm2022/caribeng-ui-cascadeselect.mjs +22 -8
- package/fesm2022/caribeng-ui-chart.mjs +2598 -303
- package/fesm2022/caribeng-ui-chip.mjs +9 -4
- package/fesm2022/caribeng-ui-chips.mjs +9 -5
- package/fesm2022/caribeng-ui-colorpicker.mjs +9 -7
- package/fesm2022/caribeng-ui-confirmdialog.mjs +74 -9
- package/fesm2022/caribeng-ui-confirmpopup.mjs +134 -9
- package/fesm2022/caribeng-ui-contextmenu.mjs +6 -3
- package/fesm2022/caribeng-ui-dataview.mjs +211 -6
- package/fesm2022/caribeng-ui-datepicker.mjs +1630 -393
- package/fesm2022/caribeng-ui-descriptions.mjs +124 -0
- package/fesm2022/caribeng-ui-dialog.mjs +10 -7
- package/fesm2022/caribeng-ui-dock.mjs +6 -3
- package/fesm2022/caribeng-ui-drawer.mjs +10 -7
- package/fesm2022/caribeng-ui-dynamicdialog.mjs +210 -6
- package/fesm2022/caribeng-ui-editor.mjs +4392 -243
- package/fesm2022/caribeng-ui-empty.mjs +80 -0
- package/fesm2022/caribeng-ui-file-card.mjs +2 -2
- package/fesm2022/caribeng-ui-fileupload.mjs +96 -19
- package/fesm2022/caribeng-ui-floatlabel.mjs +4 -2
- package/fesm2022/caribeng-ui-folder-card.mjs +10 -3
- package/fesm2022/caribeng-ui-galleria.mjs +76 -45
- package/fesm2022/caribeng-ui-image.mjs +52 -29
- package/fesm2022/caribeng-ui-inplace.mjs +22 -6
- package/fesm2022/caribeng-ui-input-number.mjs +9 -7
- package/fesm2022/caribeng-ui-inputgroup.mjs +2 -2
- package/fesm2022/caribeng-ui-inputmask.mjs +14 -11
- package/fesm2022/caribeng-ui-inputotp.mjs +12 -6
- package/fesm2022/caribeng-ui-keyfilter.mjs +72 -0
- package/fesm2022/caribeng-ui-listbox.mjs +13 -11
- package/fesm2022/caribeng-ui-megamenu.mjs +222 -30
- package/fesm2022/caribeng-ui-menu.mjs +11 -5
- package/fesm2022/caribeng-ui-menubar.mjs +10 -5
- package/fesm2022/caribeng-ui-message.mjs +7 -4
- package/fesm2022/caribeng-ui-metergroup.mjs +29 -11
- package/fesm2022/caribeng-ui-multiselect.mjs +399 -97
- package/fesm2022/caribeng-ui-orderlist.mjs +230 -11
- package/fesm2022/caribeng-ui-organizationchart.mjs +12 -7
- package/fesm2022/caribeng-ui-paginator.mjs +18 -15
- package/fesm2022/caribeng-ui-panel.mjs +5 -2
- package/fesm2022/caribeng-ui-panelmenu.mjs +6 -3
- package/fesm2022/caribeng-ui-password.mjs +8 -6
- package/fesm2022/caribeng-ui-pdfviewer.mjs +1553 -0
- package/fesm2022/caribeng-ui-picklist.mjs +251 -14
- package/fesm2022/caribeng-ui-pricing.mjs +17 -14
- package/fesm2022/caribeng-ui-rating.mjs +7 -3
- package/fesm2022/caribeng-ui-repeater.mjs +223 -0
- package/fesm2022/caribeng-ui-result.mjs +91 -0
- package/fesm2022/caribeng-ui-scrollpanel.mjs +6 -3
- package/fesm2022/caribeng-ui-scrolltop.mjs +6 -3
- package/fesm2022/caribeng-ui-select.mjs +379 -87
- package/fesm2022/caribeng-ui-selectbutton.mjs +2 -2
- package/fesm2022/caribeng-ui-slider.mjs +171 -75
- package/fesm2022/caribeng-ui-speeddial.mjs +7 -4
- package/fesm2022/caribeng-ui-spinner.mjs +5 -2
- package/fesm2022/caribeng-ui-splitbutton.mjs +163 -0
- package/fesm2022/caribeng-ui-splitter.mjs +5 -2
- package/fesm2022/caribeng-ui-statistic.mjs +183 -0
- package/fesm2022/caribeng-ui-stepper.mjs +8 -5
- package/fesm2022/caribeng-ui-steps.mjs +6 -3
- package/fesm2022/caribeng-ui-table.mjs +708 -82
- package/fesm2022/caribeng-ui-tabmenu.mjs +6 -3
- package/fesm2022/caribeng-ui-tag.mjs +2 -2
- package/fesm2022/caribeng-ui-terminal.mjs +45 -9
- package/fesm2022/caribeng-ui-themetoggle.mjs +82 -0
- package/fesm2022/caribeng-ui-tieredmenu.mjs +9 -6
- package/fesm2022/caribeng-ui-timeline.mjs +175 -6
- package/fesm2022/caribeng-ui-toast.mjs +7 -4
- package/fesm2022/caribeng-ui-togglebutton.mjs +8 -6
- package/fesm2022/caribeng-ui-toolbar.mjs +6 -3
- package/fesm2022/caribeng-ui-tree.mjs +302 -6
- package/fesm2022/caribeng-ui-treeselect.mjs +26 -10
- package/fesm2022/caribeng-ui-treetable.mjs +269 -6
- package/fesm2022/caribeng-ui-virtualscroller.mjs +123 -10
- package/fesm2022/caribeng-ui.mjs +829 -6
- package/package.json +53 -3
- package/schematics/collection.json +10 -0
- package/schematics/ng-add/index.js +125 -0
- package/schematics/ng-add/schema.js +2 -0
- package/schematics/ng-add/schema.json +66 -0
- package/styles/caribeng.css +380 -0
- package/styles/scss/_mixins.scss +46 -0
- package/styles/scss/_overlay.scss +15 -0
- package/styles/scss/_tokens.scss +267 -0
- package/styles/scss/_utilities.scss +73 -0
- package/styles/scss/_variables.scss +33 -0
- package/styles/scss/index.scss +16 -0
- package/types/caribeng-ui-anchor.d.ts +50 -0
- package/types/caribeng-ui-autocomplete.d.ts +4 -2
- package/types/caribeng-ui-avatargroup.d.ts +3 -1
- package/types/caribeng-ui-blockui.d.ts +9 -4
- package/types/caribeng-ui-breadcrumb.d.ts +3 -0
- package/types/caribeng-ui-button.d.ts +9 -1
- package/types/caribeng-ui-caribe-alert.d.ts +3 -0
- package/types/caribeng-ui-caribe-animation-lottie.d.ts +4 -1
- package/types/caribeng-ui-caribe-button-group.d.ts +4 -1
- package/types/caribeng-ui-caribe-calendar.d.ts +5 -1
- package/types/caribeng-ui-caribe-card-content.d.ts +4 -1
- package/types/caribeng-ui-caribe-card-move.d.ts +13 -13
- package/types/caribeng-ui-caribe-card-select.d.ts +10 -1
- package/types/caribeng-ui-caribe-circle-loading.d.ts +4 -1
- package/types/caribeng-ui-caribe-coachmark.d.ts +6 -0
- package/types/caribeng-ui-caribe-data-table.d.ts +7 -2
- package/types/caribeng-ui-caribe-dots-indicator.d.ts +9 -0
- package/types/caribeng-ui-caribe-expansion-panel.d.ts +7 -10
- package/types/caribeng-ui-caribe-fab-menu.d.ts +10 -1
- package/types/caribeng-ui-caribe-file-download.d.ts +8 -10
- package/types/caribeng-ui-caribe-file-select.d.ts +7 -1
- package/types/caribeng-ui-caribe-float-menu.d.ts +4 -1
- package/types/caribeng-ui-caribe-header.d.ts +3 -0
- package/types/caribeng-ui-caribe-icon-button.d.ts +4 -1
- package/types/caribeng-ui-caribe-illustration.d.ts +4 -1
- package/types/caribeng-ui-caribe-inline-alert.d.ts +3 -0
- package/types/caribeng-ui-caribe-input-search.d.ts +4 -2
- package/types/caribeng-ui-caribe-input-select.d.ts +4 -2
- package/types/caribeng-ui-caribe-input-token.d.ts +16 -1
- package/types/caribeng-ui-caribe-link.d.ts +3 -0
- package/types/caribeng-ui-caribe-loader.d.ts +4 -1
- package/types/caribeng-ui-caribe-modal.d.ts +7 -10
- package/types/caribeng-ui-caribe-off-canvas.d.ts +6 -1
- package/types/caribeng-ui-caribe-onboarding.d.ts +6 -0
- package/types/caribeng-ui-caribe-pictogram.d.ts +4 -1
- package/types/caribeng-ui-caribe-pop-over.d.ts +7 -10
- package/types/caribeng-ui-caribe-preloader.d.ts +4 -1
- package/types/caribeng-ui-caribe-progress-bar.d.ts +3 -0
- package/types/caribeng-ui-caribe-shortcut.d.ts +3 -1
- package/types/caribeng-ui-caribe-step-indicator.d.ts +6 -0
- package/types/caribeng-ui-caribe-stroke.d.ts +4 -1
- package/types/caribeng-ui-caribe-switch.d.ts +3 -1
- package/types/caribeng-ui-caribe-tracker.d.ts +3 -0
- package/types/caribeng-ui-caribe-voucher.d.ts +5 -2
- package/types/caribeng-ui-carousel.d.ts +10 -1
- package/types/caribeng-ui-cascadeselect.d.ts +7 -2
- package/types/caribeng-ui-chart.d.ts +469 -44
- package/types/caribeng-ui-chip.d.ts +6 -0
- package/types/caribeng-ui-chips.d.ts +6 -2
- package/types/caribeng-ui-colorpicker.d.ts +3 -1
- package/types/caribeng-ui-confirmdialog.d.ts +25 -6
- package/types/caribeng-ui-confirmpopup.d.ts +37 -5
- package/types/caribeng-ui-contextmenu.d.ts +4 -1
- package/types/caribeng-ui-dataview.d.ts +63 -5
- package/types/caribeng-ui-datepicker.d.ts +186 -21
- package/types/caribeng-ui-descriptions.d.ts +63 -0
- package/types/caribeng-ui-dialog.d.ts +4 -1
- package/types/caribeng-ui-dock.d.ts +4 -1
- package/types/caribeng-ui-drawer.d.ts +4 -1
- package/types/caribeng-ui-dynamicdialog.d.ts +93 -3
- package/types/caribeng-ui-editor.d.ts +486 -13
- package/types/caribeng-ui-empty.d.ts +34 -0
- package/types/caribeng-ui-file-card.d.ts +1 -1
- package/types/caribeng-ui-fileupload.d.ts +27 -4
- package/types/caribeng-ui-folder-card.d.ts +4 -1
- package/types/caribeng-ui-galleria.d.ts +9 -0
- package/types/caribeng-ui-image.d.ts +10 -0
- package/types/caribeng-ui-inplace.d.ts +8 -0
- package/types/caribeng-ui-input-number.d.ts +3 -1
- package/types/caribeng-ui-inputmask.d.ts +5 -0
- package/types/caribeng-ui-inputotp.d.ts +7 -2
- package/types/caribeng-ui-keyfilter.d.ts +30 -0
- package/types/caribeng-ui-listbox.d.ts +5 -3
- package/types/caribeng-ui-megamenu.d.ts +26 -2
- package/types/caribeng-ui-menu.d.ts +7 -2
- package/types/caribeng-ui-menubar.d.ts +5 -1
- package/types/caribeng-ui-message.d.ts +3 -0
- package/types/caribeng-ui-metergroup.d.ts +9 -1
- package/types/caribeng-ui-multiselect.d.ts +71 -10
- package/types/caribeng-ui-orderlist.d.ts +58 -6
- package/types/caribeng-ui-organizationchart.d.ts +7 -1
- package/types/caribeng-ui-paginator.d.ts +3 -0
- package/types/caribeng-ui-panel.d.ts +3 -0
- package/types/caribeng-ui-panelmenu.d.ts +4 -1
- package/types/caribeng-ui-password.d.ts +4 -2
- package/types/caribeng-ui-pdfviewer.d.ts +258 -0
- package/types/caribeng-ui-picklist.d.ts +67 -7
- package/types/caribeng-ui-pricing.d.ts +8 -5
- package/types/caribeng-ui-rating.d.ts +6 -2
- package/types/caribeng-ui-repeater.d.ts +79 -0
- package/types/caribeng-ui-result.d.ts +35 -0
- package/types/caribeng-ui-scrollpanel.d.ts +4 -1
- package/types/caribeng-ui-scrolltop.d.ts +4 -1
- package/types/caribeng-ui-select.d.ts +73 -9
- package/types/caribeng-ui-slider.d.ts +63 -10
- package/types/caribeng-ui-speeddial.d.ts +5 -2
- package/types/caribeng-ui-spinner.d.ts +3 -0
- package/types/caribeng-ui-splitbutton.d.ts +49 -0
- package/types/caribeng-ui-splitter.d.ts +3 -0
- package/types/caribeng-ui-statistic.d.ts +65 -0
- package/types/caribeng-ui-stepper.d.ts +3 -0
- package/types/caribeng-ui-steps.d.ts +4 -1
- package/types/caribeng-ui-table.d.ts +184 -16
- package/types/caribeng-ui-tabmenu.d.ts +4 -1
- package/types/caribeng-ui-terminal.d.ts +10 -0
- package/types/caribeng-ui-themetoggle.d.ts +32 -0
- package/types/caribeng-ui-tieredmenu.d.ts +5 -2
- package/types/caribeng-ui-timeline.d.ts +63 -4
- package/types/caribeng-ui-toast.d.ts +3 -0
- package/types/caribeng-ui-togglebutton.d.ts +5 -3
- package/types/caribeng-ui-toolbar.d.ts +7 -4
- package/types/caribeng-ui-tree.d.ts +76 -4
- package/types/caribeng-ui-treeselect.d.ts +10 -2
- package/types/caribeng-ui-treetable.d.ts +68 -4
- package/types/caribeng-ui-virtualscroller.d.ts +45 -5
- package/types/caribeng-ui.d.ts +501 -12
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { input, inject, TemplateRef, Directive, contentChildren, booleanAttribute, ViewEncapsulation, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
3
|
+
import { NgTemplateOutlet } from '@angular/common';
|
|
4
|
+
|
|
5
|
+
/** Plantilla del valor de un elemento: `<ng-template cbDescriptionsValue="estado" let-valor>`. */
|
|
6
|
+
class CbDescriptionsValue {
|
|
7
|
+
constructor() {
|
|
8
|
+
this.cbDescriptionsValue = input.required(/* @ts-ignore */
|
|
9
|
+
...(ngDevMode ? [{ debugName: "cbDescriptionsValue" }] : /* istanbul ignore next */ []));
|
|
10
|
+
this.template = inject(TemplateRef);
|
|
11
|
+
}
|
|
12
|
+
static ngTemplateContextGuard(_dir, ctx) {
|
|
13
|
+
return true;
|
|
14
|
+
}
|
|
15
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: CbDescriptionsValue, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
16
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.5", type: CbDescriptionsValue, isStandalone: true, selector: "ng-template[cbDescriptionsValue]", inputs: { cbDescriptionsValue: { classPropertyName: "cbDescriptionsValue", publicName: "cbDescriptionsValue", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0 }); }
|
|
17
|
+
}
|
|
18
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: CbDescriptionsValue, decorators: [{
|
|
19
|
+
type: Directive,
|
|
20
|
+
args: [{
|
|
21
|
+
selector: 'ng-template[cbDescriptionsValue]',
|
|
22
|
+
standalone: true,
|
|
23
|
+
}]
|
|
24
|
+
}], propDecorators: { cbDescriptionsValue: [{ type: i0.Input, args: [{ isSignal: true, alias: "cbDescriptionsValue", required: true }] }] } });
|
|
25
|
+
let nextId = 0;
|
|
26
|
+
/**
|
|
27
|
+
* Descriptions de CaribeNG: lista de pares etiqueta / valor (detalle de un
|
|
28
|
+
* cliente, de una transacción…) en una o varias columnas, sobre una lista de
|
|
29
|
+
* descripción (`<dl>`) nativa.
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* ```html
|
|
33
|
+
* <cb-descriptions title="Detalle de la transferencia" [columns]="2" [items]="[
|
|
34
|
+
* { label: 'Origen', value: 'Ahorros **** 1234' },
|
|
35
|
+
* { label: 'Valor', value: '$ 250.000' },
|
|
36
|
+
* { label: 'Estado', key: 'estado', value: 'Aprobada' },
|
|
37
|
+
* ]">
|
|
38
|
+
* <ng-template cbDescriptionsValue="estado" let-estado><cb-tag [value]="estado" severity="success" /></ng-template>
|
|
39
|
+
* </cb-descriptions>
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
class CbDescriptions {
|
|
43
|
+
constructor() {
|
|
44
|
+
this.valueTemplates = contentChildren(CbDescriptionsValue, /* @ts-ignore */
|
|
45
|
+
...(ngDevMode ? [{ debugName: "valueTemplates" }] : /* istanbul ignore next */ []));
|
|
46
|
+
this.titleId = `cb-descriptions-${++nextId}-title`;
|
|
47
|
+
this.items = input([], /* @ts-ignore */
|
|
48
|
+
...(ngDevMode ? [{ debugName: "items" }] : /* istanbul ignore next */ []));
|
|
49
|
+
/** Título del bloque (se anuncia como encabezado). */
|
|
50
|
+
this.title = input('', /* @ts-ignore */
|
|
51
|
+
...(ngDevMode ? [{ debugName: "title" }] : /* istanbul ignore next */ []));
|
|
52
|
+
/** Nivel del encabezado del título (por defecto 3). */
|
|
53
|
+
this.headingLevel = input(3, /* @ts-ignore */
|
|
54
|
+
...(ngDevMode ? [{ debugName: "headingLevel" }] : /* istanbul ignore next */ []));
|
|
55
|
+
/** Columnas en pantallas anchas (en móvil siempre 1). */
|
|
56
|
+
this.columns = input(2, /* @ts-ignore */
|
|
57
|
+
...(ngDevMode ? [{ debugName: "columns" }] : /* istanbul ignore next */ []));
|
|
58
|
+
/** Etiqueta encima del valor (`vertical`) o a su lado (`horizontal`). */
|
|
59
|
+
this.layout = input('vertical', /* @ts-ignore */
|
|
60
|
+
...(ngDevMode ? [{ debugName: "layout" }] : /* istanbul ignore next */ []));
|
|
61
|
+
/** Bordes entre elementos. */
|
|
62
|
+
this.bordered = input(false, { ...(ngDevMode ? { debugName: "bordered" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
63
|
+
}
|
|
64
|
+
valueTemplate(item) {
|
|
65
|
+
return item.key ? this.valueTemplates().find((t) => t.cbDescriptionsValue() === item.key) : undefined;
|
|
66
|
+
}
|
|
67
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: CbDescriptions, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
68
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: CbDescriptions, isStandalone: true, selector: "cb-descriptions", inputs: { items: { classPropertyName: "items", publicName: "items", isSignal: true, isRequired: false, transformFunction: null }, title: { classPropertyName: "title", publicName: "title", isSignal: true, isRequired: false, transformFunction: null }, headingLevel: { classPropertyName: "headingLevel", publicName: "headingLevel", isSignal: true, isRequired: false, transformFunction: null }, columns: { classPropertyName: "columns", publicName: "columns", isSignal: true, isRequired: false, transformFunction: null }, layout: { classPropertyName: "layout", publicName: "layout", isSignal: true, isRequired: false, transformFunction: null }, bordered: { classPropertyName: "bordered", publicName: "bordered", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class.cb-descriptions--bordered": "bordered()", "class.cb-descriptions--vertical": "layout() === 'vertical'", "style.--cb-descriptions-columns": "columns()" }, classAttribute: "cb-descriptions" }, queries: [{ propertyName: "valueTemplates", predicate: CbDescriptionsValue, isSignal: true }], ngImport: i0, template: `
|
|
69
|
+
@if (title()) {
|
|
70
|
+
<div class="cb-descriptions__title" role="heading" [attr.aria-level]="headingLevel()" [id]="titleId">{{ title() }}</div>
|
|
71
|
+
}
|
|
72
|
+
<dl class="cb-descriptions__list" [attr.aria-labelledby]="title() ? titleId : null">
|
|
73
|
+
@for (item of items(); track $index) {
|
|
74
|
+
<div class="cb-descriptions__item" [style.grid-column]="item.span && item.span > 1 ? 'span ' + item.span : null">
|
|
75
|
+
<dt class="cb-descriptions__label">{{ item.label }}</dt>
|
|
76
|
+
<dd class="cb-descriptions__value">
|
|
77
|
+
@if (valueTemplate(item); as tpl) {
|
|
78
|
+
<ng-container [ngTemplateOutlet]="tpl.template" [ngTemplateOutletContext]="{ $implicit: item.value, item }" />
|
|
79
|
+
} @else {
|
|
80
|
+
{{ item.value ?? '—' }}
|
|
81
|
+
}
|
|
82
|
+
</dd>
|
|
83
|
+
</div>
|
|
84
|
+
}
|
|
85
|
+
</dl>
|
|
86
|
+
`, isInline: true, styles: [":host{display:block;font-family:var(--cb-font-sans, inherit);color:var(--cb-color-text)}.cb-descriptions__title{margin:0 0 var(--cb-space-3, .75rem);font-size:var(--cb-text-base, 1rem);font-weight:var(--cb-font-weight-semibold, 600);color:var(--cb-color-text-strong)}.cb-descriptions__list{display:grid;grid-template-columns:repeat(var(--cb-descriptions-columns, 2),minmax(0,1fr));gap:var(--cb-space-4, 1rem) var(--cb-space-6, 1.5rem);margin:0}.cb-descriptions__item{display:flex;flex-direction:column;gap:.15rem;min-width:0}:host(:not(.cb-descriptions--vertical)) .cb-descriptions__item{flex-direction:row;align-items:baseline;gap:var(--cb-space-2, .5rem)}.cb-descriptions__label{font-size:var(--cb-text-xs, .75rem);color:var(--cb-color-text-muted)}:host(:not(.cb-descriptions--vertical)) .cb-descriptions__label{flex:none;font-size:var(--cb-text-sm, .875rem)}:host(:not(.cb-descriptions--vertical)) .cb-descriptions__label:after{content:\":\"}.cb-descriptions__value{margin:0;font-size:var(--cb-text-sm, .875rem);font-weight:var(--cb-font-weight-medium, 500);color:var(--cb-color-text-strong);overflow-wrap:anywhere}:host(.cb-descriptions--bordered) .cb-descriptions__list{gap:0;overflow:hidden;border:1px solid var(--cb-color-border);border-radius:var(--cb-radius-md, .5rem)}:host(.cb-descriptions--bordered) .cb-descriptions__item{padding:var(--cb-space-3, .75rem) var(--cb-space-4, 1rem);border-right:1px solid var(--cb-color-border);border-bottom:1px solid var(--cb-color-border);margin:0 -1px -1px 0}:host(.cb-descriptions--bordered) .cb-descriptions__label{font-weight:var(--cb-font-weight-medium, 500)}@media(max-width:600px){.cb-descriptions__list{grid-template-columns:minmax(0,1fr)}.cb-descriptions__item{grid-column:auto!important}}\n"], dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
87
|
+
}
|
|
88
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: CbDescriptions, decorators: [{
|
|
89
|
+
type: Component,
|
|
90
|
+
args: [{ selector: 'cb-descriptions', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.Emulated, imports: [NgTemplateOutlet], host: {
|
|
91
|
+
class: 'cb-descriptions',
|
|
92
|
+
'[class.cb-descriptions--bordered]': 'bordered()',
|
|
93
|
+
'[class.cb-descriptions--vertical]': "layout() === 'vertical'",
|
|
94
|
+
'[style.--cb-descriptions-columns]': 'columns()',
|
|
95
|
+
}, template: `
|
|
96
|
+
@if (title()) {
|
|
97
|
+
<div class="cb-descriptions__title" role="heading" [attr.aria-level]="headingLevel()" [id]="titleId">{{ title() }}</div>
|
|
98
|
+
}
|
|
99
|
+
<dl class="cb-descriptions__list" [attr.aria-labelledby]="title() ? titleId : null">
|
|
100
|
+
@for (item of items(); track $index) {
|
|
101
|
+
<div class="cb-descriptions__item" [style.grid-column]="item.span && item.span > 1 ? 'span ' + item.span : null">
|
|
102
|
+
<dt class="cb-descriptions__label">{{ item.label }}</dt>
|
|
103
|
+
<dd class="cb-descriptions__value">
|
|
104
|
+
@if (valueTemplate(item); as tpl) {
|
|
105
|
+
<ng-container [ngTemplateOutlet]="tpl.template" [ngTemplateOutletContext]="{ $implicit: item.value, item }" />
|
|
106
|
+
} @else {
|
|
107
|
+
{{ item.value ?? '—' }}
|
|
108
|
+
}
|
|
109
|
+
</dd>
|
|
110
|
+
</div>
|
|
111
|
+
}
|
|
112
|
+
</dl>
|
|
113
|
+
`, styles: [":host{display:block;font-family:var(--cb-font-sans, inherit);color:var(--cb-color-text)}.cb-descriptions__title{margin:0 0 var(--cb-space-3, .75rem);font-size:var(--cb-text-base, 1rem);font-weight:var(--cb-font-weight-semibold, 600);color:var(--cb-color-text-strong)}.cb-descriptions__list{display:grid;grid-template-columns:repeat(var(--cb-descriptions-columns, 2),minmax(0,1fr));gap:var(--cb-space-4, 1rem) var(--cb-space-6, 1.5rem);margin:0}.cb-descriptions__item{display:flex;flex-direction:column;gap:.15rem;min-width:0}:host(:not(.cb-descriptions--vertical)) .cb-descriptions__item{flex-direction:row;align-items:baseline;gap:var(--cb-space-2, .5rem)}.cb-descriptions__label{font-size:var(--cb-text-xs, .75rem);color:var(--cb-color-text-muted)}:host(:not(.cb-descriptions--vertical)) .cb-descriptions__label{flex:none;font-size:var(--cb-text-sm, .875rem)}:host(:not(.cb-descriptions--vertical)) .cb-descriptions__label:after{content:\":\"}.cb-descriptions__value{margin:0;font-size:var(--cb-text-sm, .875rem);font-weight:var(--cb-font-weight-medium, 500);color:var(--cb-color-text-strong);overflow-wrap:anywhere}:host(.cb-descriptions--bordered) .cb-descriptions__list{gap:0;overflow:hidden;border:1px solid var(--cb-color-border);border-radius:var(--cb-radius-md, .5rem)}:host(.cb-descriptions--bordered) .cb-descriptions__item{padding:var(--cb-space-3, .75rem) var(--cb-space-4, 1rem);border-right:1px solid var(--cb-color-border);border-bottom:1px solid var(--cb-color-border);margin:0 -1px -1px 0}:host(.cb-descriptions--bordered) .cb-descriptions__label{font-weight:var(--cb-font-weight-medium, 500)}@media(max-width:600px){.cb-descriptions__list{grid-template-columns:minmax(0,1fr)}.cb-descriptions__item{grid-column:auto!important}}\n"] }]
|
|
114
|
+
}], propDecorators: { valueTemplates: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => CbDescriptionsValue), { isSignal: true }] }], items: [{ type: i0.Input, args: [{ isSignal: true, alias: "items", required: false }] }], title: [{ type: i0.Input, args: [{ isSignal: true, alias: "title", required: false }] }], headingLevel: [{ type: i0.Input, args: [{ isSignal: true, alias: "headingLevel", required: false }] }], columns: [{ type: i0.Input, args: [{ isSignal: true, alias: "columns", required: false }] }], layout: [{ type: i0.Input, args: [{ isSignal: true, alias: "layout", required: false }] }], bordered: [{ type: i0.Input, args: [{ isSignal: true, alias: "bordered", required: false }] }] } });
|
|
115
|
+
|
|
116
|
+
/*
|
|
117
|
+
* Public API Surface de @caribeng/ui/descriptions
|
|
118
|
+
*/
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Generated bundle index. Do not edit.
|
|
122
|
+
*/
|
|
123
|
+
|
|
124
|
+
export { CbDescriptions, CbDescriptionsValue };
|
|
@@ -6,6 +6,7 @@ import { A11yModule } from '@angular/cdk/a11y';
|
|
|
6
6
|
import { Overlay } from '@angular/cdk/overlay';
|
|
7
7
|
import { TemplatePortal } from '@angular/cdk/portal';
|
|
8
8
|
import { CbIcon } from '@caribeng/ui/icon';
|
|
9
|
+
import { injectCbTranslation } from '@caribeng/ui';
|
|
9
10
|
|
|
10
11
|
let nextUid = 0;
|
|
11
12
|
/**
|
|
@@ -26,6 +27,8 @@ let nextUid = 0;
|
|
|
26
27
|
*/
|
|
27
28
|
class CbDialog {
|
|
28
29
|
constructor() {
|
|
30
|
+
/** Textos de interfaz en el idioma activo (`provideCaribeNG({ locale })`). */
|
|
31
|
+
this.t = injectCbTranslation();
|
|
29
32
|
this.overlay = inject(Overlay);
|
|
30
33
|
this.vcr = inject(ViewContainerRef);
|
|
31
34
|
this.document = inject(DOCUMENT);
|
|
@@ -45,7 +48,7 @@ class CbDialog {
|
|
|
45
48
|
this.width = input('32rem', /* @ts-ignore */
|
|
46
49
|
...(ngDevMode ? [{ debugName: "width" }] : /* istanbul ignore next */ []));
|
|
47
50
|
/** Nombre accesible cuando no hay `header`. */
|
|
48
|
-
this.ariaLabel = input(
|
|
51
|
+
this.ariaLabel = input(undefined, /* @ts-ignore */
|
|
49
52
|
...(ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []));
|
|
50
53
|
/** Se emite cuando el diálogo se cierra. */
|
|
51
54
|
this.onHide = output();
|
|
@@ -114,7 +117,7 @@ class CbDialog {
|
|
|
114
117
|
role="dialog"
|
|
115
118
|
aria-modal="true"
|
|
116
119
|
[attr.aria-labelledby]="header() ? titleId : null"
|
|
117
|
-
[attr.aria-label]="header() ? null : ariaLabel()"
|
|
120
|
+
[attr.aria-label]="header() ? null : (ariaLabel() ?? t().dialog)"
|
|
118
121
|
[style.width]="width()"
|
|
119
122
|
cdkTrapFocus
|
|
120
123
|
cdkTrapFocusAutoCapture
|
|
@@ -128,7 +131,7 @@ class CbDialog {
|
|
|
128
131
|
<button
|
|
129
132
|
type="button"
|
|
130
133
|
class="cb-dialog__close"
|
|
131
|
-
aria-label="
|
|
134
|
+
[attr.aria-label]="t().close"
|
|
132
135
|
(click)="close()"
|
|
133
136
|
>
|
|
134
137
|
<cb-icon name="x" size="sm" />
|
|
@@ -145,7 +148,7 @@ class CbDialog {
|
|
|
145
148
|
</div>
|
|
146
149
|
</div>
|
|
147
150
|
</ng-template>
|
|
148
|
-
`, isInline: true, styles: [".cb-dialog__mask{display:contents}.cb-dialog{display:flex;flex-direction:column;box-sizing:border-box;max-width:calc(100vw - 2 * var(--cb-space-4));max-height:calc(100vh - 2 * var(--cb-space-6));background:var(--cb-color-surface-raised);color:var(--cb-color-text);border:1px solid var(--cb-color-border);border-radius:var(--cb-radius-lg);box-shadow:var(--cb-shadow-lg);font-family:var(--cb-font-sans);overflow:hidden;animation:cb-dialog-in var(--cb-duration-normal) var(--cb-ease-out)}.cb-dialog__header{display:flex;align-items:center;justify-content:space-between;gap:var(--cb-space-4);padding:var(--cb-space-5) var(--cb-space-6);border-bottom:1px solid var(--cb-color-border)}.cb-dialog__title{margin:0;font-size:var(--cb-text-lg);font-weight:var(--cb-font-weight-semibold);color:var(--cb-color-text-strong)}.cb-dialog__close{flex:none;display:grid;place-items:center;width:2rem;height:2rem;border-radius:var(--cb-radius-md);border:none;background:transparent;color:var(--cb-color-text-muted);font-size:var(--cb-text-base);cursor:pointer;transition:background var(--cb-duration-fast) var(--cb-ease)}.cb-dialog__close:hover{background:var(--cb-color-surface-
|
|
151
|
+
`, isInline: true, styles: [".cb-dialog__mask{display:contents}.cb-dialog{display:flex;flex-direction:column;box-sizing:border-box;max-width:calc(100vw - 2 * var(--cb-space-4));max-height:calc(100vh - 2 * var(--cb-space-6));background:var(--cb-color-surface-raised);color:var(--cb-color-text);border:1px solid var(--cb-color-border);border-radius:var(--cb-radius-lg);box-shadow:var(--cb-shadow-lg);font-family:var(--cb-font-sans);overflow:hidden;animation:cb-dialog-in var(--cb-duration-normal) var(--cb-ease-out)}.cb-dialog__header{display:flex;align-items:center;justify-content:space-between;gap:var(--cb-space-4);padding:var(--cb-space-5) var(--cb-space-6);border-bottom:1px solid var(--cb-color-border)}.cb-dialog__title{margin:0;font-size:var(--cb-text-lg);font-weight:var(--cb-font-weight-semibold);color:var(--cb-color-text-strong)}.cb-dialog__close{flex:none;display:grid;place-items:center;width:2rem;height:2rem;border-radius:var(--cb-radius-md);border:none;background:transparent;color:var(--cb-color-text-muted);font-size:var(--cb-text-base);cursor:pointer;transition:background var(--cb-duration-fast) var(--cb-ease)}.cb-dialog__close:hover{background:var(--cb-color-surface-hover);color:var(--cb-color-text)}.cb-dialog__close:focus-visible{outline:2px solid var(--cb-color-focus-ring);outline-offset:2px}.cb-dialog__body{padding:var(--cb-space-6);overflow-y:auto}.cb-dialog__footer{display:flex;align-items:center;justify-content:flex-end;gap:var(--cb-space-3);padding:var(--cb-space-4) var(--cb-space-6);border-top:1px solid var(--cb-color-border)}.cb-dialog__footer:empty{display:none}@keyframes cb-dialog-in{0%{opacity:0;transform:translateY(8px) scale(.98)}to{opacity:1;transform:translateY(0) scale(1)}}@media(prefers-reduced-motion:reduce){.cb-dialog{animation:none}}\n"], dependencies: [{ kind: "ngmodule", type: A11yModule }, { kind: "directive", type: i1.CdkTrapFocus, selector: "[cdkTrapFocus]", inputs: ["cdkTrapFocus", "cdkTrapFocusAutoCapture"], exportAs: ["cdkTrapFocus"] }, { kind: "component", type: CbIcon, selector: "cb-icon", inputs: ["name", "size", "spin", "ariaLabel"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
149
152
|
}
|
|
150
153
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: CbDialog, decorators: [{
|
|
151
154
|
type: Component,
|
|
@@ -157,7 +160,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImpor
|
|
|
157
160
|
role="dialog"
|
|
158
161
|
aria-modal="true"
|
|
159
162
|
[attr.aria-labelledby]="header() ? titleId : null"
|
|
160
|
-
[attr.aria-label]="header() ? null : ariaLabel()"
|
|
163
|
+
[attr.aria-label]="header() ? null : (ariaLabel() ?? t().dialog)"
|
|
161
164
|
[style.width]="width()"
|
|
162
165
|
cdkTrapFocus
|
|
163
166
|
cdkTrapFocusAutoCapture
|
|
@@ -171,7 +174,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImpor
|
|
|
171
174
|
<button
|
|
172
175
|
type="button"
|
|
173
176
|
class="cb-dialog__close"
|
|
174
|
-
aria-label="
|
|
177
|
+
[attr.aria-label]="t().close"
|
|
175
178
|
(click)="close()"
|
|
176
179
|
>
|
|
177
180
|
<cb-icon name="x" size="sm" />
|
|
@@ -188,7 +191,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImpor
|
|
|
188
191
|
</div>
|
|
189
192
|
</div>
|
|
190
193
|
</ng-template>
|
|
191
|
-
`, styles: [".cb-dialog__mask{display:contents}.cb-dialog{display:flex;flex-direction:column;box-sizing:border-box;max-width:calc(100vw - 2 * var(--cb-space-4));max-height:calc(100vh - 2 * var(--cb-space-6));background:var(--cb-color-surface-raised);color:var(--cb-color-text);border:1px solid var(--cb-color-border);border-radius:var(--cb-radius-lg);box-shadow:var(--cb-shadow-lg);font-family:var(--cb-font-sans);overflow:hidden;animation:cb-dialog-in var(--cb-duration-normal) var(--cb-ease-out)}.cb-dialog__header{display:flex;align-items:center;justify-content:space-between;gap:var(--cb-space-4);padding:var(--cb-space-5) var(--cb-space-6);border-bottom:1px solid var(--cb-color-border)}.cb-dialog__title{margin:0;font-size:var(--cb-text-lg);font-weight:var(--cb-font-weight-semibold);color:var(--cb-color-text-strong)}.cb-dialog__close{flex:none;display:grid;place-items:center;width:2rem;height:2rem;border-radius:var(--cb-radius-md);border:none;background:transparent;color:var(--cb-color-text-muted);font-size:var(--cb-text-base);cursor:pointer;transition:background var(--cb-duration-fast) var(--cb-ease)}.cb-dialog__close:hover{background:var(--cb-color-surface-
|
|
194
|
+
`, styles: [".cb-dialog__mask{display:contents}.cb-dialog{display:flex;flex-direction:column;box-sizing:border-box;max-width:calc(100vw - 2 * var(--cb-space-4));max-height:calc(100vh - 2 * var(--cb-space-6));background:var(--cb-color-surface-raised);color:var(--cb-color-text);border:1px solid var(--cb-color-border);border-radius:var(--cb-radius-lg);box-shadow:var(--cb-shadow-lg);font-family:var(--cb-font-sans);overflow:hidden;animation:cb-dialog-in var(--cb-duration-normal) var(--cb-ease-out)}.cb-dialog__header{display:flex;align-items:center;justify-content:space-between;gap:var(--cb-space-4);padding:var(--cb-space-5) var(--cb-space-6);border-bottom:1px solid var(--cb-color-border)}.cb-dialog__title{margin:0;font-size:var(--cb-text-lg);font-weight:var(--cb-font-weight-semibold);color:var(--cb-color-text-strong)}.cb-dialog__close{flex:none;display:grid;place-items:center;width:2rem;height:2rem;border-radius:var(--cb-radius-md);border:none;background:transparent;color:var(--cb-color-text-muted);font-size:var(--cb-text-base);cursor:pointer;transition:background var(--cb-duration-fast) var(--cb-ease)}.cb-dialog__close:hover{background:var(--cb-color-surface-hover);color:var(--cb-color-text)}.cb-dialog__close:focus-visible{outline:2px solid var(--cb-color-focus-ring);outline-offset:2px}.cb-dialog__body{padding:var(--cb-space-6);overflow-y:auto}.cb-dialog__footer{display:flex;align-items:center;justify-content:flex-end;gap:var(--cb-space-3);padding:var(--cb-space-4) var(--cb-space-6);border-top:1px solid var(--cb-color-border)}.cb-dialog__footer:empty{display:none}@keyframes cb-dialog-in{0%{opacity:0;transform:translateY(8px) scale(.98)}to{opacity:1;transform:translateY(0) scale(1)}}@media(prefers-reduced-motion:reduce){.cb-dialog{animation:none}}\n"] }]
|
|
192
195
|
}], ctorParameters: () => [], propDecorators: { visible: [{ type: i0.Input, args: [{ isSignal: true, alias: "visible", required: false }] }, { type: i0.Output, args: ["visibleChange"] }], header: [{ type: i0.Input, args: [{ isSignal: true, alias: "header", required: false }] }], closable: [{ type: i0.Input, args: [{ isSignal: true, alias: "closable", required: false }] }], dismissableMask: [{ type: i0.Input, args: [{ isSignal: true, alias: "dismissableMask", required: false }] }], closeOnEscape: [{ type: i0.Input, args: [{ isSignal: true, alias: "closeOnEscape", required: false }] }], width: [{ type: i0.Input, args: [{ isSignal: true, alias: "width", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabel", required: false }] }], onHide: [{ type: i0.Output, args: ["onHide"] }], onShow: [{ type: i0.Output, args: ["onShow"] }], tpl: [{ type: i0.ViewChild, args: ['tpl', { isSignal: true }] }] } });
|
|
193
196
|
function toBoolean(value) {
|
|
194
197
|
return value !== false && value != null && `${value}` !== 'false';
|
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
2
|
import { input, output, ViewEncapsulation, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
3
3
|
import { CbIcon } from '@caribeng/ui/icon';
|
|
4
|
+
import { injectCbTranslation } from '@caribeng/ui';
|
|
4
5
|
|
|
5
6
|
/** Compact application launcher with configurable orientation. */
|
|
6
7
|
class CbDock {
|
|
7
8
|
constructor() {
|
|
9
|
+
/** Textos de interfaz en el idioma activo (`provideCaribeNG({ locale })`). */
|
|
10
|
+
this.t = injectCbTranslation();
|
|
8
11
|
this.items = input([], /* @ts-ignore */
|
|
9
12
|
...(ngDevMode ? [{ debugName: "items" }] : /* istanbul ignore next */ []));
|
|
10
13
|
this.position = input('bottom', /* @ts-ignore */
|
|
11
14
|
...(ngDevMode ? [{ debugName: "position" }] : /* istanbul ignore next */ []));
|
|
12
|
-
this.ariaLabel = input(
|
|
15
|
+
this.ariaLabel = input(undefined, /* @ts-ignore */
|
|
13
16
|
...(ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []));
|
|
14
17
|
this.itemSelect = output();
|
|
15
18
|
}
|
|
@@ -17,7 +20,7 @@ class CbDock {
|
|
|
17
20
|
this.itemSelect.emit(item); }
|
|
18
21
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: CbDock, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
19
22
|
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: CbDock, isStandalone: true, selector: "cb-dock", inputs: { items: { classPropertyName: "items", publicName: "items", isSignal: true, isRequired: false, transformFunction: null }, position: { classPropertyName: "position", publicName: "position", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "ariaLabel", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { itemSelect: "itemSelect" }, host: { properties: { "class.cb-dock--top": "position() === \"top\"", "class.cb-dock--right": "position() === \"right\"", "class.cb-dock--bottom": "position() === \"bottom\"", "class.cb-dock--left": "position() === \"left\"" }, classAttribute: "cb-dock" }, ngImport: i0, template: `
|
|
20
|
-
<nav [attr.aria-label]="ariaLabel()">
|
|
23
|
+
<nav [attr.aria-label]="(ariaLabel() ?? t().appDock)">
|
|
21
24
|
<ul class="cb-dock__list" role="toolbar" [attr.aria-orientation]="position() === 'left' || position() === 'right' ? 'vertical' : 'horizontal'">
|
|
22
25
|
@for (item of items(); track $index) {
|
|
23
26
|
<li>
|
|
@@ -41,7 +44,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImpor
|
|
|
41
44
|
'[class.cb-dock--bottom]': 'position() === "bottom"',
|
|
42
45
|
'[class.cb-dock--left]': 'position() === "left"',
|
|
43
46
|
}, template: `
|
|
44
|
-
<nav [attr.aria-label]="ariaLabel()">
|
|
47
|
+
<nav [attr.aria-label]="(ariaLabel() ?? t().appDock)">
|
|
45
48
|
<ul class="cb-dock__list" role="toolbar" [attr.aria-orientation]="position() === 'left' || position() === 'right' ? 'vertical' : 'horizontal'">
|
|
46
49
|
@for (item of items(); track $index) {
|
|
47
50
|
<li>
|
|
@@ -6,6 +6,7 @@ import { A11yModule } from '@angular/cdk/a11y';
|
|
|
6
6
|
import { Overlay } from '@angular/cdk/overlay';
|
|
7
7
|
import { TemplatePortal } from '@angular/cdk/portal';
|
|
8
8
|
import { CbIcon } from '@caribeng/ui/icon';
|
|
9
|
+
import { injectCbTranslation } from '@caribeng/ui';
|
|
9
10
|
|
|
10
11
|
/**
|
|
11
12
|
* Drawer (panel lateral) de CaribeNG sobre CDK Overlay: se desliza desde un
|
|
@@ -21,6 +22,8 @@ import { CbIcon } from '@caribeng/ui/icon';
|
|
|
21
22
|
*/
|
|
22
23
|
class CbDrawer {
|
|
23
24
|
constructor() {
|
|
25
|
+
/** Textos de interfaz en el idioma activo (`provideCaribeNG({ locale })`). */
|
|
26
|
+
this.t = injectCbTranslation();
|
|
24
27
|
this.overlay = inject(Overlay);
|
|
25
28
|
this.vcr = inject(ViewContainerRef);
|
|
26
29
|
this.document = inject(DOCUMENT);
|
|
@@ -33,7 +36,7 @@ class CbDrawer {
|
|
|
33
36
|
this.closable = input(true, { ...(ngDevMode ? { debugName: "closable" } : /* istanbul ignore next */ {}), transform: toBoolean });
|
|
34
37
|
this.dismissableMask = input(true, { ...(ngDevMode ? { debugName: "dismissableMask" } : /* istanbul ignore next */ {}), transform: toBoolean });
|
|
35
38
|
this.closeOnEscape = input(true, { ...(ngDevMode ? { debugName: "closeOnEscape" } : /* istanbul ignore next */ {}), transform: toBoolean });
|
|
36
|
-
this.ariaLabel = input(
|
|
39
|
+
this.ariaLabel = input(undefined, /* @ts-ignore */
|
|
37
40
|
...(ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []));
|
|
38
41
|
this.onShow = output();
|
|
39
42
|
this.onHide = output();
|
|
@@ -104,7 +107,7 @@ class CbDrawer {
|
|
|
104
107
|
role="dialog"
|
|
105
108
|
aria-modal="true"
|
|
106
109
|
[attr.aria-labelledby]="header() ? titleId : null"
|
|
107
|
-
[attr.aria-label]="header() ? null : ariaLabel()"
|
|
110
|
+
[attr.aria-label]="header() ? null : (ariaLabel() ?? t().panel)"
|
|
108
111
|
cdkTrapFocus
|
|
109
112
|
cdkTrapFocusAutoCapture
|
|
110
113
|
>
|
|
@@ -114,7 +117,7 @@ class CbDrawer {
|
|
|
114
117
|
<h2 class="cb-drawer__title" [id]="titleId">{{ header() }}</h2>
|
|
115
118
|
}
|
|
116
119
|
@if (closable()) {
|
|
117
|
-
<button type="button" class="cb-drawer__close" aria-label="
|
|
120
|
+
<button type="button" class="cb-drawer__close" [attr.aria-label]="t().close" (click)="close()">
|
|
118
121
|
<cb-icon name="x" [size]="18" aria-hidden="true" />
|
|
119
122
|
</button>
|
|
120
123
|
}
|
|
@@ -124,7 +127,7 @@ class CbDrawer {
|
|
|
124
127
|
<footer class="cb-drawer__footer"><ng-content select="[cb-drawer-footer]" /></footer>
|
|
125
128
|
</div>
|
|
126
129
|
</ng-template>
|
|
127
|
-
`, isInline: true, styles: [".cb-drawer{display:flex;flex-direction:column;box-sizing:border-box;background-color:var(--cb-color-surface-raised);color:var(--cb-color-text);font-family:var(--cb-font-sans);box-shadow:var(--cb-shadow-lg);overflow:hidden}.cb-drawer--left,.cb-drawer--right{width:min(22rem,100vw);height:100vh}.cb-drawer--top,.cb-drawer--bottom{width:100vw;height:min(18rem,100vh)}.cb-drawer--right{animation:cb-drawer-right var(--cb-duration-normal, .22s) var(--cb-ease, ease)}.cb-drawer--left{animation:cb-drawer-left var(--cb-duration-normal, .22s) var(--cb-ease, ease)}.cb-drawer--top{animation:cb-drawer-top var(--cb-duration-normal, .22s) var(--cb-ease, ease)}.cb-drawer--bottom{animation:cb-drawer-bottom var(--cb-duration-normal, .22s) var(--cb-ease, ease)}@keyframes cb-drawer-right{0%{transform:translate(100%)}to{transform:translate(0)}}@keyframes cb-drawer-left{0%{transform:translate(-100%)}to{transform:translate(0)}}@keyframes cb-drawer-top{0%{transform:translateY(-100%)}to{transform:translateY(0)}}@keyframes cb-drawer-bottom{0%{transform:translateY(100%)}to{transform:translateY(0)}}@media(prefers-reduced-motion:reduce){.cb-drawer{animation:none!important}}.cb-drawer__header{display:flex;align-items:center;justify-content:space-between;gap:var(--cb-space-3);padding:var(--cb-space-4) var(--cb-space-5);border-bottom:1px solid var(--cb-color-border)}.cb-drawer__title{margin:0;font-size:var(--cb-text-lg);font-weight:var(--cb-font-weight-semibold)}.cb-drawer__close{flex:none;display:grid;place-items:center;width:2rem;height:2rem;border:none;border-radius:var(--cb-radius-md);background:transparent;color:var(--cb-color-text-muted);cursor:pointer;transition:background var(--cb-duration-fast) var(--cb-ease)}.cb-drawer__close:hover{background:var(--cb-color-surface-
|
|
130
|
+
`, isInline: true, styles: [".cb-drawer{display:flex;flex-direction:column;box-sizing:border-box;background-color:var(--cb-color-surface-raised);color:var(--cb-color-text);font-family:var(--cb-font-sans);box-shadow:var(--cb-shadow-lg);overflow:hidden}.cb-drawer--left,.cb-drawer--right{width:min(22rem,100vw);height:100vh}.cb-drawer--top,.cb-drawer--bottom{width:100vw;height:min(18rem,100vh)}.cb-drawer--right{animation:cb-drawer-right var(--cb-duration-normal, .22s) var(--cb-ease, ease)}.cb-drawer--left{animation:cb-drawer-left var(--cb-duration-normal, .22s) var(--cb-ease, ease)}.cb-drawer--top{animation:cb-drawer-top var(--cb-duration-normal, .22s) var(--cb-ease, ease)}.cb-drawer--bottom{animation:cb-drawer-bottom var(--cb-duration-normal, .22s) var(--cb-ease, ease)}@keyframes cb-drawer-right{0%{transform:translate(100%)}to{transform:translate(0)}}@keyframes cb-drawer-left{0%{transform:translate(-100%)}to{transform:translate(0)}}@keyframes cb-drawer-top{0%{transform:translateY(-100%)}to{transform:translateY(0)}}@keyframes cb-drawer-bottom{0%{transform:translateY(100%)}to{transform:translateY(0)}}@media(prefers-reduced-motion:reduce){.cb-drawer{animation:none!important}}.cb-drawer__header{display:flex;align-items:center;justify-content:space-between;gap:var(--cb-space-3);padding:var(--cb-space-4) var(--cb-space-5);border-bottom:1px solid var(--cb-color-border)}.cb-drawer__title{margin:0;font-size:var(--cb-text-lg);font-weight:var(--cb-font-weight-semibold)}.cb-drawer__close{flex:none;display:grid;place-items:center;width:2rem;height:2rem;border:none;border-radius:var(--cb-radius-md);background:transparent;color:var(--cb-color-text-muted);cursor:pointer;transition:background var(--cb-duration-fast) var(--cb-ease)}.cb-drawer__close:hover{background:var(--cb-color-surface-hover);color:var(--cb-color-text)}.cb-drawer__close:focus-visible{outline:2px solid var(--cb-color-focus-ring);outline-offset:2px}.cb-drawer__body{flex:1 1 auto;padding:var(--cb-space-5);overflow-y:auto}.cb-drawer__footer{display:flex;align-items:center;justify-content:flex-end;gap:var(--cb-space-3);padding:var(--cb-space-4) var(--cb-space-5)}.cb-drawer__footer:empty{display:none}\n"], dependencies: [{ kind: "ngmodule", type: A11yModule }, { kind: "directive", type: i1.CdkTrapFocus, selector: "[cdkTrapFocus]", inputs: ["cdkTrapFocus", "cdkTrapFocusAutoCapture"], exportAs: ["cdkTrapFocus"] }, { kind: "component", type: CbIcon, selector: "cb-icon", inputs: ["name", "size", "spin", "ariaLabel"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
128
131
|
}
|
|
129
132
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: CbDrawer, decorators: [{
|
|
130
133
|
type: Component,
|
|
@@ -136,7 +139,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImpor
|
|
|
136
139
|
role="dialog"
|
|
137
140
|
aria-modal="true"
|
|
138
141
|
[attr.aria-labelledby]="header() ? titleId : null"
|
|
139
|
-
[attr.aria-label]="header() ? null : ariaLabel()"
|
|
142
|
+
[attr.aria-label]="header() ? null : (ariaLabel() ?? t().panel)"
|
|
140
143
|
cdkTrapFocus
|
|
141
144
|
cdkTrapFocusAutoCapture
|
|
142
145
|
>
|
|
@@ -146,7 +149,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImpor
|
|
|
146
149
|
<h2 class="cb-drawer__title" [id]="titleId">{{ header() }}</h2>
|
|
147
150
|
}
|
|
148
151
|
@if (closable()) {
|
|
149
|
-
<button type="button" class="cb-drawer__close" aria-label="
|
|
152
|
+
<button type="button" class="cb-drawer__close" [attr.aria-label]="t().close" (click)="close()">
|
|
150
153
|
<cb-icon name="x" [size]="18" aria-hidden="true" />
|
|
151
154
|
</button>
|
|
152
155
|
}
|
|
@@ -156,7 +159,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImpor
|
|
|
156
159
|
<footer class="cb-drawer__footer"><ng-content select="[cb-drawer-footer]" /></footer>
|
|
157
160
|
</div>
|
|
158
161
|
</ng-template>
|
|
159
|
-
`, styles: [".cb-drawer{display:flex;flex-direction:column;box-sizing:border-box;background-color:var(--cb-color-surface-raised);color:var(--cb-color-text);font-family:var(--cb-font-sans);box-shadow:var(--cb-shadow-lg);overflow:hidden}.cb-drawer--left,.cb-drawer--right{width:min(22rem,100vw);height:100vh}.cb-drawer--top,.cb-drawer--bottom{width:100vw;height:min(18rem,100vh)}.cb-drawer--right{animation:cb-drawer-right var(--cb-duration-normal, .22s) var(--cb-ease, ease)}.cb-drawer--left{animation:cb-drawer-left var(--cb-duration-normal, .22s) var(--cb-ease, ease)}.cb-drawer--top{animation:cb-drawer-top var(--cb-duration-normal, .22s) var(--cb-ease, ease)}.cb-drawer--bottom{animation:cb-drawer-bottom var(--cb-duration-normal, .22s) var(--cb-ease, ease)}@keyframes cb-drawer-right{0%{transform:translate(100%)}to{transform:translate(0)}}@keyframes cb-drawer-left{0%{transform:translate(-100%)}to{transform:translate(0)}}@keyframes cb-drawer-top{0%{transform:translateY(-100%)}to{transform:translateY(0)}}@keyframes cb-drawer-bottom{0%{transform:translateY(100%)}to{transform:translateY(0)}}@media(prefers-reduced-motion:reduce){.cb-drawer{animation:none!important}}.cb-drawer__header{display:flex;align-items:center;justify-content:space-between;gap:var(--cb-space-3);padding:var(--cb-space-4) var(--cb-space-5);border-bottom:1px solid var(--cb-color-border)}.cb-drawer__title{margin:0;font-size:var(--cb-text-lg);font-weight:var(--cb-font-weight-semibold)}.cb-drawer__close{flex:none;display:grid;place-items:center;width:2rem;height:2rem;border:none;border-radius:var(--cb-radius-md);background:transparent;color:var(--cb-color-text-muted);cursor:pointer;transition:background var(--cb-duration-fast) var(--cb-ease)}.cb-drawer__close:hover{background:var(--cb-color-surface-
|
|
162
|
+
`, styles: [".cb-drawer{display:flex;flex-direction:column;box-sizing:border-box;background-color:var(--cb-color-surface-raised);color:var(--cb-color-text);font-family:var(--cb-font-sans);box-shadow:var(--cb-shadow-lg);overflow:hidden}.cb-drawer--left,.cb-drawer--right{width:min(22rem,100vw);height:100vh}.cb-drawer--top,.cb-drawer--bottom{width:100vw;height:min(18rem,100vh)}.cb-drawer--right{animation:cb-drawer-right var(--cb-duration-normal, .22s) var(--cb-ease, ease)}.cb-drawer--left{animation:cb-drawer-left var(--cb-duration-normal, .22s) var(--cb-ease, ease)}.cb-drawer--top{animation:cb-drawer-top var(--cb-duration-normal, .22s) var(--cb-ease, ease)}.cb-drawer--bottom{animation:cb-drawer-bottom var(--cb-duration-normal, .22s) var(--cb-ease, ease)}@keyframes cb-drawer-right{0%{transform:translate(100%)}to{transform:translate(0)}}@keyframes cb-drawer-left{0%{transform:translate(-100%)}to{transform:translate(0)}}@keyframes cb-drawer-top{0%{transform:translateY(-100%)}to{transform:translateY(0)}}@keyframes cb-drawer-bottom{0%{transform:translateY(100%)}to{transform:translateY(0)}}@media(prefers-reduced-motion:reduce){.cb-drawer{animation:none!important}}.cb-drawer__header{display:flex;align-items:center;justify-content:space-between;gap:var(--cb-space-3);padding:var(--cb-space-4) var(--cb-space-5);border-bottom:1px solid var(--cb-color-border)}.cb-drawer__title{margin:0;font-size:var(--cb-text-lg);font-weight:var(--cb-font-weight-semibold)}.cb-drawer__close{flex:none;display:grid;place-items:center;width:2rem;height:2rem;border:none;border-radius:var(--cb-radius-md);background:transparent;color:var(--cb-color-text-muted);cursor:pointer;transition:background var(--cb-duration-fast) var(--cb-ease)}.cb-drawer__close:hover{background:var(--cb-color-surface-hover);color:var(--cb-color-text)}.cb-drawer__close:focus-visible{outline:2px solid var(--cb-color-focus-ring);outline-offset:2px}.cb-drawer__body{flex:1 1 auto;padding:var(--cb-space-5);overflow-y:auto}.cb-drawer__footer{display:flex;align-items:center;justify-content:flex-end;gap:var(--cb-space-3);padding:var(--cb-space-4) var(--cb-space-5)}.cb-drawer__footer:empty{display:none}\n"] }]
|
|
160
163
|
}], ctorParameters: () => [], propDecorators: { visible: [{ type: i0.Input, args: [{ isSignal: true, alias: "visible", required: false }] }, { type: i0.Output, args: ["visibleChange"] }], header: [{ type: i0.Input, args: [{ isSignal: true, alias: "header", required: false }] }], position: [{ type: i0.Input, args: [{ isSignal: true, alias: "position", required: false }] }], closable: [{ type: i0.Input, args: [{ isSignal: true, alias: "closable", required: false }] }], dismissableMask: [{ type: i0.Input, args: [{ isSignal: true, alias: "dismissableMask", required: false }] }], closeOnEscape: [{ type: i0.Input, args: [{ isSignal: true, alias: "closeOnEscape", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabel", required: false }] }], onShow: [{ type: i0.Output, args: ["onShow"] }], onHide: [{ type: i0.Output, args: ["onHide"] }], tpl: [{ type: i0.ViewChild, args: ['tpl', { isSignal: true }] }] } });
|
|
161
164
|
let uid = 0;
|
|
162
165
|
function nextUid() {
|
|
@@ -1,27 +1,231 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { model, input, output, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
2
|
+
import { model, input, output, ViewEncapsulation, ChangeDetectionStrategy, Component, InjectionToken, inject, Injector, Injectable } from '@angular/core';
|
|
3
|
+
import { injectCbTranslation } from '@caribeng/ui';
|
|
4
|
+
import { CbDialog } from '@caribeng/ui/dialog';
|
|
5
|
+
import { NgComponentOutlet, DOCUMENT } from '@angular/common';
|
|
6
|
+
import * as i1 from '@angular/cdk/a11y';
|
|
7
|
+
import { A11yModule } from '@angular/cdk/a11y';
|
|
8
|
+
import { Overlay } from '@angular/cdk/overlay';
|
|
9
|
+
import { ComponentPortal } from '@angular/cdk/portal';
|
|
10
|
+
import { Subject } from 'rxjs';
|
|
11
|
+
import { CbIcon } from '@caribeng/ui/icon';
|
|
3
12
|
|
|
13
|
+
/**
|
|
14
|
+
* Variante declarativa del diálogo dinámico: un `cb-dialog` con título y
|
|
15
|
+
* texto, para casos simples. Para abrir **componentes** con datos y recibir un
|
|
16
|
+
* resultado, usa `CbDialogService.open()`.
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```html
|
|
20
|
+
* <cb-dynamic-dialog [(visible)]="visible" header="Detalle" content="Tu solicitud fue enviada." />
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
4
23
|
class CbDynamicDialog {
|
|
5
24
|
constructor() {
|
|
25
|
+
this.t = injectCbTranslation();
|
|
26
|
+
/** Visibilidad (two-way). */
|
|
6
27
|
this.visible = model(false, /* @ts-ignore */
|
|
7
28
|
...(ngDevMode ? [{ debugName: "visible" }] : /* istanbul ignore next */ []));
|
|
8
|
-
|
|
29
|
+
/** Título. Por defecto, "Diálogo" del idioma activo. */
|
|
30
|
+
this.header = input(undefined, /* @ts-ignore */
|
|
9
31
|
...(ngDevMode ? [{ debugName: "header" }] : /* istanbul ignore next */ []));
|
|
32
|
+
/** Texto del cuerpo (también se puede proyectar contenido). */
|
|
10
33
|
this.content = input('', /* @ts-ignore */
|
|
11
34
|
...(ngDevMode ? [{ debugName: "content" }] : /* istanbul ignore next */ []));
|
|
35
|
+
/** Se emite al cerrarse. */
|
|
12
36
|
this.closed = output();
|
|
13
37
|
}
|
|
14
|
-
close() { this.visible.set(false); this.closed.emit(); }
|
|
15
38
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: CbDynamicDialog, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
16
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: CbDynamicDialog, isStandalone: true, selector: "cb-dynamic-dialog", inputs: { visible: { classPropertyName: "visible", publicName: "visible", isSignal: true, isRequired: false, transformFunction: null }, header: { classPropertyName: "header", publicName: "header", isSignal: true, isRequired: false, transformFunction: null }, content: { classPropertyName: "content", publicName: "content", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { visible: "visibleChange", closed: "closed" },
|
|
39
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: CbDynamicDialog, isStandalone: true, selector: "cb-dynamic-dialog", inputs: { visible: { classPropertyName: "visible", publicName: "visible", isSignal: true, isRequired: false, transformFunction: null }, header: { classPropertyName: "header", publicName: "header", isSignal: true, isRequired: false, transformFunction: null }, content: { classPropertyName: "content", publicName: "content", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { visible: "visibleChange", closed: "closed" }, host: { styleAttribute: "display: contents" }, ngImport: i0, template: `
|
|
40
|
+
<cb-dialog [(visible)]="visible" [header]="header() ?? t().dialog" (onHide)="closed.emit()">
|
|
41
|
+
@if (content()) {
|
|
42
|
+
<p class="cb-dynamic-dialog__text">{{ content() }}</p>
|
|
43
|
+
}
|
|
44
|
+
<ng-content />
|
|
45
|
+
</cb-dialog>
|
|
46
|
+
`, isInline: true, styles: [".cb-dynamic-dialog__text{margin:0}\n"], dependencies: [{ kind: "component", type: CbDialog, selector: "cb-dialog", inputs: ["visible", "header", "closable", "dismissableMask", "closeOnEscape", "width", "ariaLabel"], outputs: ["visibleChange", "onHide", "onShow"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
17
47
|
}
|
|
18
48
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: CbDynamicDialog, decorators: [{
|
|
19
49
|
type: Component,
|
|
20
|
-
args: [{ selector: 'cb-dynamic-dialog',
|
|
50
|
+
args: [{ selector: 'cb-dynamic-dialog', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.Emulated, imports: [CbDialog], host: { style: 'display: contents' }, template: `
|
|
51
|
+
<cb-dialog [(visible)]="visible" [header]="header() ?? t().dialog" (onHide)="closed.emit()">
|
|
52
|
+
@if (content()) {
|
|
53
|
+
<p class="cb-dynamic-dialog__text">{{ content() }}</p>
|
|
54
|
+
}
|
|
55
|
+
<ng-content />
|
|
56
|
+
</cb-dialog>
|
|
57
|
+
`, styles: [".cb-dynamic-dialog__text{margin:0}\n"] }]
|
|
21
58
|
}], propDecorators: { visible: [{ type: i0.Input, args: [{ isSignal: true, alias: "visible", required: false }] }, { type: i0.Output, args: ["visibleChange"] }], header: [{ type: i0.Input, args: [{ isSignal: true, alias: "header", required: false }] }], content: [{ type: i0.Input, args: [{ isSignal: true, alias: "content", required: false }] }], closed: [{ type: i0.Output, args: ["closed"] }] } });
|
|
22
59
|
|
|
60
|
+
/** Datos pasados en `config.data`, para inyectar en el componente abierto. */
|
|
61
|
+
const CB_DYNAMIC_DIALOG_DATA = new InjectionToken('CB_DYNAMIC_DIALOG_DATA');
|
|
62
|
+
/**
|
|
63
|
+
* Referencia a un diálogo abierto con `CbDialogService`. El componente abierto
|
|
64
|
+
* puede inyectarla para cerrarse devolviendo un resultado.
|
|
65
|
+
*/
|
|
66
|
+
class CbDynamicDialogRef {
|
|
67
|
+
/** @internal */
|
|
68
|
+
constructor(dispose) {
|
|
69
|
+
this.dispose = dispose;
|
|
70
|
+
this.closed$ = new Subject();
|
|
71
|
+
this.isClosed = false;
|
|
72
|
+
/** Emite el resultado (o `undefined` si se cerró sin él) y completa. */
|
|
73
|
+
this.onClose = this.closed$.asObservable();
|
|
74
|
+
}
|
|
75
|
+
/** Cierra el diálogo devolviendo un resultado opcional. */
|
|
76
|
+
close(result) {
|
|
77
|
+
if (this.isClosed)
|
|
78
|
+
return;
|
|
79
|
+
this.isClosed = true;
|
|
80
|
+
this.dispose();
|
|
81
|
+
this.closed$.next(result);
|
|
82
|
+
this.closed$.complete();
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
let nextUid = 0;
|
|
86
|
+
/** @internal */
|
|
87
|
+
const CbDynamicDialogConfigToken = new InjectionToken('CbDynamicDialogConfig');
|
|
88
|
+
/** @internal */
|
|
89
|
+
const CbDynamicDialogComponentToken = new InjectionToken('CbDynamicDialogComponent');
|
|
90
|
+
/** Contenedor visual del diálogo dinámico (uso interno de CbDialogService). */
|
|
91
|
+
class CbDynamicDialogContainer {
|
|
92
|
+
constructor() {
|
|
93
|
+
this.t = injectCbTranslation();
|
|
94
|
+
this.config = inject(CbDynamicDialogConfigToken);
|
|
95
|
+
this.ref = inject(CbDynamicDialogRef);
|
|
96
|
+
this.component = inject(CbDynamicDialogComponentToken);
|
|
97
|
+
this.injector = inject(Injector);
|
|
98
|
+
this.titleId = `cb-dynamic-dialog-${++nextUid}-title`;
|
|
99
|
+
}
|
|
100
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: CbDynamicDialogContainer, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
101
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: CbDynamicDialogContainer, isStandalone: true, selector: "cb-dynamic-dialog-container", ngImport: i0, template: `
|
|
102
|
+
<div
|
|
103
|
+
class="cb-dynamic-dialog"
|
|
104
|
+
role="dialog"
|
|
105
|
+
aria-modal="true"
|
|
106
|
+
[attr.aria-labelledby]="config.header ? titleId : null"
|
|
107
|
+
[attr.aria-label]="config.header ? null : config.ariaLabel || t().dialog"
|
|
108
|
+
[style.width]="config.width || '32rem'"
|
|
109
|
+
cdkTrapFocus
|
|
110
|
+
cdkTrapFocusAutoCapture
|
|
111
|
+
>
|
|
112
|
+
@if (config.header || config.closable !== false) {
|
|
113
|
+
<header class="cb-dynamic-dialog__header">
|
|
114
|
+
@if (config.header) {
|
|
115
|
+
<h2 class="cb-dynamic-dialog__title" [id]="titleId">{{ config.header }}</h2>
|
|
116
|
+
}
|
|
117
|
+
@if (config.closable !== false) {
|
|
118
|
+
<button type="button" class="cb-dynamic-dialog__close" [attr.aria-label]="t().close" (click)="ref.close()">
|
|
119
|
+
<cb-icon name="x" [size]="16" aria-hidden="true" />
|
|
120
|
+
</button>
|
|
121
|
+
}
|
|
122
|
+
</header>
|
|
123
|
+
}
|
|
124
|
+
<div class="cb-dynamic-dialog__body">
|
|
125
|
+
<ng-container *ngComponentOutlet="component; injector: injector" />
|
|
126
|
+
</div>
|
|
127
|
+
</div>
|
|
128
|
+
`, isInline: true, styles: [".cb-dynamic-dialog{display:flex;flex-direction:column;box-sizing:border-box;max-width:calc(100vw - 2 * var(--cb-space-4, 1rem));max-height:calc(100vh - 2 * var(--cb-space-6, 1.5rem));background:var(--cb-color-surface-raised);color:var(--cb-color-text);border:1px solid var(--cb-color-border);border-radius:var(--cb-radius-lg, .75rem);box-shadow:var(--cb-shadow-lg);font-family:var(--cb-font-sans);overflow:hidden}.cb-dynamic-dialog__header{display:flex;align-items:center;justify-content:space-between;gap:var(--cb-space-4, 1rem);padding:var(--cb-space-5, 1.25rem) var(--cb-space-6, 1.5rem);border-bottom:1px solid var(--cb-color-border)}.cb-dynamic-dialog__title{margin:0;font-size:var(--cb-text-lg, 1.125rem);font-weight:var(--cb-font-weight-semibold, 600);color:var(--cb-color-text-strong)}.cb-dynamic-dialog__close{flex:none;display:grid;place-items:center;width:2rem;height:2rem;margin-inline-start:auto;border:none;border-radius:var(--cb-radius-md, .5rem);background:transparent;color:var(--cb-color-text-muted);cursor:pointer}.cb-dynamic-dialog__close:hover{background:color-mix(in srgb,var(--cb-color-text) 8%,transparent);color:var(--cb-color-text)}.cb-dynamic-dialog__close:focus-visible{outline:2px solid var(--cb-color-focus-ring, var(--cb-color-primary-500));outline-offset:2px}.cb-dynamic-dialog__body{padding:var(--cb-space-5, 1.25rem) var(--cb-space-6, 1.5rem);overflow-y:auto}\n"], dependencies: [{ kind: "ngmodule", type: A11yModule }, { kind: "directive", type: i1.CdkTrapFocus, selector: "[cdkTrapFocus]", inputs: ["cdkTrapFocus", "cdkTrapFocusAutoCapture"], exportAs: ["cdkTrapFocus"] }, { kind: "directive", type: NgComponentOutlet, selector: "[ngComponentOutlet]", inputs: ["ngComponentOutlet", "ngComponentOutletInputs", "ngComponentOutletInjector", "ngComponentOutletEnvironmentInjector", "ngComponentOutletContent", "ngComponentOutletNgModule"], exportAs: ["ngComponentOutlet"] }, { kind: "component", type: CbIcon, selector: "cb-icon", inputs: ["name", "size", "spin", "ariaLabel"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
129
|
+
}
|
|
130
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: CbDynamicDialogContainer, decorators: [{
|
|
131
|
+
type: Component,
|
|
132
|
+
args: [{ selector: 'cb-dynamic-dialog-container', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.Emulated, imports: [A11yModule, NgComponentOutlet, CbIcon], template: `
|
|
133
|
+
<div
|
|
134
|
+
class="cb-dynamic-dialog"
|
|
135
|
+
role="dialog"
|
|
136
|
+
aria-modal="true"
|
|
137
|
+
[attr.aria-labelledby]="config.header ? titleId : null"
|
|
138
|
+
[attr.aria-label]="config.header ? null : config.ariaLabel || t().dialog"
|
|
139
|
+
[style.width]="config.width || '32rem'"
|
|
140
|
+
cdkTrapFocus
|
|
141
|
+
cdkTrapFocusAutoCapture
|
|
142
|
+
>
|
|
143
|
+
@if (config.header || config.closable !== false) {
|
|
144
|
+
<header class="cb-dynamic-dialog__header">
|
|
145
|
+
@if (config.header) {
|
|
146
|
+
<h2 class="cb-dynamic-dialog__title" [id]="titleId">{{ config.header }}</h2>
|
|
147
|
+
}
|
|
148
|
+
@if (config.closable !== false) {
|
|
149
|
+
<button type="button" class="cb-dynamic-dialog__close" [attr.aria-label]="t().close" (click)="ref.close()">
|
|
150
|
+
<cb-icon name="x" [size]="16" aria-hidden="true" />
|
|
151
|
+
</button>
|
|
152
|
+
}
|
|
153
|
+
</header>
|
|
154
|
+
}
|
|
155
|
+
<div class="cb-dynamic-dialog__body">
|
|
156
|
+
<ng-container *ngComponentOutlet="component; injector: injector" />
|
|
157
|
+
</div>
|
|
158
|
+
</div>
|
|
159
|
+
`, styles: [".cb-dynamic-dialog{display:flex;flex-direction:column;box-sizing:border-box;max-width:calc(100vw - 2 * var(--cb-space-4, 1rem));max-height:calc(100vh - 2 * var(--cb-space-6, 1.5rem));background:var(--cb-color-surface-raised);color:var(--cb-color-text);border:1px solid var(--cb-color-border);border-radius:var(--cb-radius-lg, .75rem);box-shadow:var(--cb-shadow-lg);font-family:var(--cb-font-sans);overflow:hidden}.cb-dynamic-dialog__header{display:flex;align-items:center;justify-content:space-between;gap:var(--cb-space-4, 1rem);padding:var(--cb-space-5, 1.25rem) var(--cb-space-6, 1.5rem);border-bottom:1px solid var(--cb-color-border)}.cb-dynamic-dialog__title{margin:0;font-size:var(--cb-text-lg, 1.125rem);font-weight:var(--cb-font-weight-semibold, 600);color:var(--cb-color-text-strong)}.cb-dynamic-dialog__close{flex:none;display:grid;place-items:center;width:2rem;height:2rem;margin-inline-start:auto;border:none;border-radius:var(--cb-radius-md, .5rem);background:transparent;color:var(--cb-color-text-muted);cursor:pointer}.cb-dynamic-dialog__close:hover{background:color-mix(in srgb,var(--cb-color-text) 8%,transparent);color:var(--cb-color-text)}.cb-dynamic-dialog__close:focus-visible{outline:2px solid var(--cb-color-focus-ring, var(--cb-color-primary-500));outline-offset:2px}.cb-dynamic-dialog__body{padding:var(--cb-space-5, 1.25rem) var(--cb-space-6, 1.5rem);overflow-y:auto}\n"] }]
|
|
160
|
+
}] });
|
|
161
|
+
/**
|
|
162
|
+
* Abre componentes dentro de un diálogo modal (como `DialogService` de PrimeNG):
|
|
163
|
+
* trampa de foco, cierre con Escape y fondo, y devolución del foco al cerrar.
|
|
164
|
+
*
|
|
165
|
+
* @example
|
|
166
|
+
* ```ts
|
|
167
|
+
* const ref = inject(CbDialogService).open(EditarCliente, {
|
|
168
|
+
* header: 'Editar cliente',
|
|
169
|
+
* data: { id: 42 },
|
|
170
|
+
* });
|
|
171
|
+
* ref.onClose.subscribe((guardado) => { … });
|
|
172
|
+
*
|
|
173
|
+
* // Dentro de EditarCliente:
|
|
174
|
+
* readonly data = inject<{ id: number }>(CB_DYNAMIC_DIALOG_DATA);
|
|
175
|
+
* readonly ref = inject(CbDynamicDialogRef);
|
|
176
|
+
* guardar() { this.ref.close(true); }
|
|
177
|
+
* ```
|
|
178
|
+
*/
|
|
179
|
+
class CbDialogService {
|
|
180
|
+
constructor() {
|
|
181
|
+
this.overlay = inject(Overlay);
|
|
182
|
+
this.injector = inject(Injector);
|
|
183
|
+
this.document = inject(DOCUMENT);
|
|
184
|
+
}
|
|
185
|
+
open(component, config = {}) {
|
|
186
|
+
const previouslyFocused = this.document.activeElement;
|
|
187
|
+
const overlayRef = this.overlay.create({
|
|
188
|
+
hasBackdrop: true,
|
|
189
|
+
backdropClass: 'cb-dialog-backdrop',
|
|
190
|
+
scrollStrategy: this.overlay.scrollStrategies.block(),
|
|
191
|
+
positionStrategy: this.overlay.position().global().centerHorizontally().centerVertically(),
|
|
192
|
+
});
|
|
193
|
+
const ref = new CbDynamicDialogRef(() => {
|
|
194
|
+
overlayRef.dispose();
|
|
195
|
+
previouslyFocused?.focus?.();
|
|
196
|
+
});
|
|
197
|
+
const injector = Injector.create({
|
|
198
|
+
parent: this.injector,
|
|
199
|
+
providers: [
|
|
200
|
+
{ provide: CbDynamicDialogRef, useValue: ref },
|
|
201
|
+
{ provide: CB_DYNAMIC_DIALOG_DATA, useValue: config.data },
|
|
202
|
+
{ provide: CbDynamicDialogConfigToken, useValue: config },
|
|
203
|
+
{ provide: CbDynamicDialogComponentToken, useValue: component },
|
|
204
|
+
],
|
|
205
|
+
});
|
|
206
|
+
overlayRef.attach(new ComponentPortal(CbDynamicDialogContainer, null, injector));
|
|
207
|
+
overlayRef.backdropClick().subscribe(() => {
|
|
208
|
+
if (config.dismissableMask !== false)
|
|
209
|
+
ref.close();
|
|
210
|
+
});
|
|
211
|
+
overlayRef.keydownEvents().subscribe((event) => {
|
|
212
|
+
if (event.key === 'Escape' && config.closeOnEscape !== false) {
|
|
213
|
+
event.preventDefault();
|
|
214
|
+
ref.close();
|
|
215
|
+
}
|
|
216
|
+
});
|
|
217
|
+
return ref;
|
|
218
|
+
}
|
|
219
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: CbDialogService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
220
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: CbDialogService, providedIn: 'root' }); }
|
|
221
|
+
}
|
|
222
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: CbDialogService, decorators: [{
|
|
223
|
+
type: Injectable,
|
|
224
|
+
args: [{ providedIn: 'root' }]
|
|
225
|
+
}] });
|
|
226
|
+
|
|
23
227
|
/**
|
|
24
228
|
* Generated bundle index. Do not edit.
|
|
25
229
|
*/
|
|
26
230
|
|
|
27
|
-
export { CbDynamicDialog };
|
|
231
|
+
export { CB_DYNAMIC_DIALOG_DATA, CbDialogService, CbDynamicDialog, CbDynamicDialogContainer, CbDynamicDialogRef };
|