@cityway/bo-ui 1.1.0-beta024 → 1.1.0-beta026
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/cityway-bo-ui-1.1.0-beta026.tgz +0 -0
- package/docs/components/filter-bar.md +322 -202
- package/docs/components/page-header.md +250 -294
- package/docs/components/pagination.md +1 -0
- package/docs/components/table.md +286 -245
- package/docs/i18n.md +2 -2
- package/fesm2022/cityway-bo-ui.mjs +506 -166
- package/fesm2022/cityway-bo-ui.mjs.map +1 -1
- package/index.d.ts +163 -32
- package/lib/assets/i18n/common.en.json +197 -186
- package/lib/assets/i18n/common.fr.json +197 -186
- package/package.json +2 -2
- package/styles/bo-ui.styles.min.css +1 -1
- package/styles/bo-ui.styles.min.css.map +1 -1
- package/cityway-bo-ui-1.1.0-beta024.tgz +0 -0
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { input, ChangeDetectionStrategy, Component, output, effect, signal, computed, untracked, isDevMode, InjectionToken, makeEnvironmentProviders, inject, contentChild, isSignal,
|
|
2
|
+
import { input, ChangeDetectionStrategy, Component, output, effect, signal, computed, untracked, isDevMode, InjectionToken, makeEnvironmentProviders, inject, DestroyRef, contentChild, viewChild, afterNextRender, isSignal, Injector, ElementRef, viewChildren, afterRenderEffect, contentChildren } from '@angular/core';
|
|
3
3
|
import * as i1 from '@ngx-translate/core';
|
|
4
4
|
import { TranslateModule, TranslateService } from '@ngx-translate/core';
|
|
5
5
|
import * as i1$3 from '@angular/common';
|
|
6
6
|
import { DatePipe, NgClass, NgTemplateOutlet, Location, CommonModule } from '@angular/common';
|
|
7
7
|
import * as i1$1 from '@angular/cdk/drag-drop';
|
|
8
8
|
import { moveItemInArray, transferArrayItem, DragDropModule } from '@angular/cdk/drag-drop';
|
|
9
|
-
import { CardComponent, SpriteIconEnum, IconSizeEnum, BoButtonTypeEnum, ButtonPositionEnum, ButtonIconSizeEnum, AlertTypeEnum, CardTypeEnum, BadgeComponent, IconComponent, ButtonComponent, AlertComponent, FormFieldTypeEnum, FormFieldComponent, ModalsService, IconTypeEnum, IconUiTypeEnum, EmptyStateIllustrationEnum, BadgeTypeEnum, ModalsType, LoaderComponent, ImageComponent, EmptyStateComponent, ToastService, DropdownItemDirective, LoaderSizeEnum, AccordionComponent, FileDropComponent, FileToDownloadComponent } from '@cityway/basic-ui';
|
|
9
|
+
import { CardComponent, SpriteIconEnum, IconSizeEnum, BoButtonTypeEnum, ButtonPositionEnum, ButtonIconSizeEnum, AlertTypeEnum, CardTypeEnum, BadgeComponent, IconComponent, ButtonComponent, AlertComponent, FormFieldTypeEnum, FormFieldComponent, ModalsService, IconTypeEnum, IconUiTypeEnum, EmptyStateIllustrationEnum, BadgeTypeEnum, ModalsType, LoaderComponent, ImageComponent, EmptyStateComponent, DividerComponent, ToastService, DropdownItemDirective, LoaderSizeEnum, AccordionComponent, FileDropComponent, FileToDownloadComponent } from '@cityway/basic-ui';
|
|
10
|
+
import { RouterLink, Router, ActivatedRoute } from '@angular/router';
|
|
10
11
|
import { takeUntilDestroyed, toSignal, toObservable } from '@angular/core/rxjs-interop';
|
|
11
12
|
import * as i1$2 from '@angular/forms';
|
|
12
13
|
import { FormControl, ReactiveFormsModule, FormGroup } from '@angular/forms';
|
|
13
|
-
import { Router, ActivatedRoute } from '@angular/router';
|
|
14
14
|
import { switchMap, startWith, debounceTime, take, map } from 'rxjs';
|
|
15
15
|
import * as i2 from '@ng-select/ng-select';
|
|
16
16
|
import { NgSelectModule } from '@ng-select/ng-select';
|
|
@@ -151,7 +151,7 @@ class DragNDropListComponent {
|
|
|
151
151
|
this.activeItemsChange.emit(this.activeItems());
|
|
152
152
|
}
|
|
153
153
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.20", ngImport: i0, type: DragNDropListComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
154
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.20", type: DragNDropListComponent, isStandalone: true, selector: "cw-drag-n-drop-list", inputs: { availableItems: { classPropertyName: "availableItems", publicName: "availableItems", isSignal: true, isRequired: false, transformFunction: null }, activeItems: { classPropertyName: "activeItems", publicName: "activeItems", isSignal: true, isRequired: false, transformFunction: null }, adapter: { classPropertyName: "adapter", publicName: "adapter", isSignal: true, isRequired: false, transformFunction: null }, itemTemplate: { classPropertyName: "itemTemplate", publicName: "itemTemplate", isSignal: true, isRequired: false, transformFunction: null }, availableColumn: { classPropertyName: "availableColumn", publicName: "availableColumn", isSignal: true, isRequired: false, transformFunction: null }, activeColumn: { classPropertyName: "activeColumn", publicName: "activeColumn", isSignal: true, isRequired: false, transformFunction: null }, reorderOnDrop: { classPropertyName: "reorderOnDrop", publicName: "reorderOnDrop", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { availableItemsChange: "availableItemsChange", activeItemsChange: "activeItemsChange" }, ngImport: i0, template: "<div class=\"drag-drop-list row\">\n <div class=\"col-lg-6 d-flex-v gap-4xs\">\n <div class=\"fs fs-xs fw-bold\">{{ availableColumn().title | translate }}</div>\n @if (availableColumn().description; as description) {\n <p class=\"fs fs-xs\">{{ description | translate }}</p>\n }\n @if (availableColumn().descriptionRwd; as descriptionRwd) {\n <p class=\"d-sm-none fs fs-xs\" [innerHTML]=\"descriptionRwd | translate\"></p>\n }\n <ul class=\"list-unstyled drag-drop-list-column drag-drop-list-column-available\" [ngClass]=\"availableColumn().cssClass\"\n cdkDropList #availableList=\"cdkDropList\"\n [cdkDropListData]=\"_available\"\n [cdkDropListConnectedTo]=\"[activeList]\"\n (cdkDropListDropped)=\"drop($event)\">\n @for (item of _available; track item.id) {\n <li cdkDrag [cdkDragDisabled]=\"item.disabled ?? false\">\n <cw-card>\n <ng-container *ngTemplateOutlet=\"itemTemplate() || defaultTemplate; context: { $implicit: item }\"/>\n </cw-card>\n </li>\n }\n </ul>\n </div>\n\n <div class=\"col-lg-6 d-flex-v gap-4xs\">\n <div class=\"fs fs-xs fw-bold\">{{ activeColumn().title | translate }}</div>\n @if (activeColumn().description; as description) {\n <p class=\"fs fs-xs\">{{ description | translate }}</p>\n }\n @if (activeColumn().descriptionRwd; as descriptionRwd) {\n <p class=\"d-sm-none fs fs-xs\" [innerHTML]=\"descriptionRwd | translate\"></p>\n }\n <ul class=\"list-unstyled drag-drop-list-column drag-drop-list-column-active\" [ngClass]=\"activeColumn().cssClass\"\n cdkDropList #activeList=\"cdkDropList\"\n [cdkDropListData]=\"_active\"\n [cdkDropListConnectedTo]=\"[availableList]\"\n (cdkDropListDropped)=\"drop($event)\">\n @for (item of _active; track item.id) {\n <li cdkDrag [cdkDragDisabled]=\"item.disabled ?? false\">\n <cw-card>\n <ng-container *ngTemplateOutlet=\"itemTemplate() || defaultTemplate; context: { $implicit: item }\"/>\n </cw-card>\n </li>\n }\n </ul>\n </div>\n</div>\n\n<ng-template #defaultTemplate let-item>\n <div class=\"default-item d-flex justify-content-between\">\n <span>\n {{ item.label }}\n @if (item.code) { <span class=\"text-muted\">({{ item.code }})</span> }\n </span>\n @if (item.order != null) {\n <span class=\"fw-bold\">#{{ item.order }}</span>\n }\n </div>\n</ng-template>\n", dependencies: [{ kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "ngmodule", type: TranslateModule }, { kind: "ngmodule", type: DragDropModule }, { kind: "directive", type: i1$1.CdkDropList, selector: "[cdkDropList], cdk-drop-list", inputs: ["cdkDropListConnectedTo", "cdkDropListData", "cdkDropListOrientation", "id", "cdkDropListLockAxis", "cdkDropListDisabled", "cdkDropListSortingDisabled", "cdkDropListEnterPredicate", "cdkDropListSortPredicate", "cdkDropListAutoScrollDisabled", "cdkDropListAutoScrollStep", "cdkDropListElementContainer", "cdkDropListHasAnchor"], outputs: ["cdkDropListDropped", "cdkDropListEntered", "cdkDropListExited", "cdkDropListSorted"], exportAs: ["cdkDropList"] }, { kind: "directive", type: i1$1.CdkDrag, selector: "[cdkDrag]", inputs: ["cdkDragData", "cdkDragLockAxis", "cdkDragRootElement", "cdkDragBoundary", "cdkDragStartDelay", "cdkDragFreeDragPosition", "cdkDragDisabled", "cdkDragConstrainPosition", "cdkDragPreviewClass", "cdkDragPreviewContainer", "cdkDragScale"], outputs: ["cdkDragStarted", "cdkDragReleased", "cdkDragEnded", "cdkDragEntered", "cdkDragExited", "cdkDragDropped", "cdkDragMoved"], exportAs: ["cdkDrag"] }, { kind: "component", type: CardComponent, selector: "cw-card", inputs: ["title", "subtitle", "truncateSubtitle", "type", "titleRank", "cssClass", "collapsible", "collapsed", "disabled", "collapseLocked", "collapseStretched", "collapseId", "destroyOnHide", "fullHeight"], outputs: ["collapsibleChange", "destroyOnHideChange", "collapseClicked"] }, { kind: "pipe", type: i1.TranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
154
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.20", type: DragNDropListComponent, isStandalone: true, selector: "cw-drag-n-drop-list", inputs: { availableItems: { classPropertyName: "availableItems", publicName: "availableItems", isSignal: true, isRequired: false, transformFunction: null }, activeItems: { classPropertyName: "activeItems", publicName: "activeItems", isSignal: true, isRequired: false, transformFunction: null }, adapter: { classPropertyName: "adapter", publicName: "adapter", isSignal: true, isRequired: false, transformFunction: null }, itemTemplate: { classPropertyName: "itemTemplate", publicName: "itemTemplate", isSignal: true, isRequired: false, transformFunction: null }, availableColumn: { classPropertyName: "availableColumn", publicName: "availableColumn", isSignal: true, isRequired: false, transformFunction: null }, activeColumn: { classPropertyName: "activeColumn", publicName: "activeColumn", isSignal: true, isRequired: false, transformFunction: null }, reorderOnDrop: { classPropertyName: "reorderOnDrop", publicName: "reorderOnDrop", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { availableItemsChange: "availableItemsChange", activeItemsChange: "activeItemsChange" }, ngImport: i0, template: "<div class=\"drag-drop-list row\">\n <div class=\"col-lg-6 d-flex-v gap-4xs\">\n <div class=\"fs fs-xs fw-bold\">{{ availableColumn().title | translate }}</div>\n @if (availableColumn().description; as description) {\n <p class=\"fs fs-xs\">{{ description | translate }}</p>\n }\n @if (availableColumn().descriptionRwd; as descriptionRwd) {\n <p class=\"d-sm-none fs fs-xs\" [innerHTML]=\"descriptionRwd | translate\"></p>\n }\n <ul class=\"list-unstyled drag-drop-list-column drag-drop-list-column-available\" [ngClass]=\"availableColumn().cssClass\"\n cdkDropList #availableList=\"cdkDropList\"\n [cdkDropListData]=\"_available\"\n [cdkDropListConnectedTo]=\"[activeList]\"\n (cdkDropListDropped)=\"drop($event)\">\n @for (item of _available; track item.id) {\n <li cdkDrag [cdkDragDisabled]=\"item.disabled ?? false\">\n <cw-card>\n <ng-container *ngTemplateOutlet=\"itemTemplate() || defaultTemplate; context: { $implicit: item }\"/>\n </cw-card>\n </li>\n }\n </ul>\n </div>\n\n <div class=\"col-lg-6 d-flex-v gap-4xs\">\n <div class=\"fs fs-xs fw-bold\">{{ activeColumn().title | translate }}</div>\n @if (activeColumn().description; as description) {\n <p class=\"fs fs-xs\">{{ description | translate }}</p>\n }\n @if (activeColumn().descriptionRwd; as descriptionRwd) {\n <p class=\"d-sm-none fs fs-xs\" [innerHTML]=\"descriptionRwd | translate\"></p>\n }\n <ul class=\"list-unstyled drag-drop-list-column drag-drop-list-column-active\" [ngClass]=\"activeColumn().cssClass\"\n cdkDropList #activeList=\"cdkDropList\"\n [cdkDropListData]=\"_active\"\n [cdkDropListConnectedTo]=\"[availableList]\"\n (cdkDropListDropped)=\"drop($event)\">\n @for (item of _active; track item.id) {\n <li cdkDrag [cdkDragDisabled]=\"item.disabled ?? false\">\n <cw-card>\n <ng-container *ngTemplateOutlet=\"itemTemplate() || defaultTemplate; context: { $implicit: item }\"/>\n </cw-card>\n </li>\n }\n </ul>\n </div>\n</div>\n\n<ng-template #defaultTemplate let-item>\n <div class=\"default-item d-flex justify-content-between\">\n <span>\n {{ item.label }}\n @if (item.code) { <span class=\"text-muted\">({{ item.code }})</span> }\n </span>\n @if (item.order != null) {\n <span class=\"fw-bold\">#{{ item.order }}</span>\n }\n </div>\n</ng-template>\n", dependencies: [{ kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "ngmodule", type: TranslateModule }, { kind: "ngmodule", type: DragDropModule }, { kind: "directive", type: i1$1.CdkDropList, selector: "[cdkDropList], cdk-drop-list", inputs: ["cdkDropListConnectedTo", "cdkDropListData", "cdkDropListOrientation", "id", "cdkDropListLockAxis", "cdkDropListDisabled", "cdkDropListSortingDisabled", "cdkDropListEnterPredicate", "cdkDropListSortPredicate", "cdkDropListAutoScrollDisabled", "cdkDropListAutoScrollStep", "cdkDropListElementContainer", "cdkDropListHasAnchor"], outputs: ["cdkDropListDropped", "cdkDropListEntered", "cdkDropListExited", "cdkDropListSorted"], exportAs: ["cdkDropList"] }, { kind: "directive", type: i1$1.CdkDrag, selector: "[cdkDrag]", inputs: ["cdkDragData", "cdkDragLockAxis", "cdkDragRootElement", "cdkDragBoundary", "cdkDragStartDelay", "cdkDragFreeDragPosition", "cdkDragDisabled", "cdkDragConstrainPosition", "cdkDragPreviewClass", "cdkDragPreviewContainer", "cdkDragScale"], outputs: ["cdkDragStarted", "cdkDragReleased", "cdkDragEnded", "cdkDragEntered", "cdkDragExited", "cdkDragDropped", "cdkDragMoved"], exportAs: ["cdkDrag"] }, { kind: "component", type: CardComponent, selector: "cw-card", inputs: ["title", "titleId", "subtitle", "truncateSubtitle", "type", "titleRank", "cssClass", "collapsible", "collapsed", "disabled", "collapseLocked", "collapseStretched", "collapseId", "destroyOnHide", "fullHeight"], outputs: ["collapsibleChange", "destroyOnHideChange", "collapseClicked"] }, { kind: "pipe", type: i1.TranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
155
155
|
}
|
|
156
156
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.20", ngImport: i0, type: DragNDropListComponent, decorators: [{
|
|
157
157
|
type: Component,
|
|
@@ -468,7 +468,7 @@ class DragNDropNestedListComponent {
|
|
|
468
468
|
}));
|
|
469
469
|
}
|
|
470
470
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.20", ngImport: i0, type: DragNDropNestedListComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
471
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.20", type: DragNDropNestedListComponent, isStandalone: true, selector: "cw-drag-n-drop-nested-list", inputs: { items: { classPropertyName: "items", publicName: "items", isSignal: true, isRequired: false, transformFunction: null }, itemTemplate: { classPropertyName: "itemTemplate", publicName: "itemTemplate", isSignal: true, isRequired: false, transformFunction: null }, column: { classPropertyName: "column", publicName: "column", isSignal: true, isRequired: false, transformFunction: null }, reorderOnDrop: { classPropertyName: "reorderOnDrop", publicName: "reorderOnDrop", isSignal: true, isRequired: false, transformFunction: null }, maxDepth: { classPropertyName: "maxDepth", publicName: "maxDepth", isSignal: true, isRequired: false, transformFunction: null }, selectedId: { classPropertyName: "selectedId", publicName: "selectedId", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { itemsChange: "itemsChange", view: "view", edit: "edit", delete: "delete", restore: "restore", add: "add", expandedChange: "expandedChange" }, ngImport: i0, template: "<div class=\"ddn-list d-flex-v gap-md\">\n <div class=\"d-flex-h justify-between\">\n @if (column()?.title) {\n <h2>{{ column()!.title | translate }} ({{ columnCountLabel() }})</h2>\n }\n\n @if (column()?.showAddRoot) {\n <cw-button cssClass=\"ddn-list-add\" [type]=\"buttonType.link\" [withIcon]=\"spriteIcon.add\"\n [iconPosition]=\"buttonPosition.left\" [label]=\"column()?.addRootLabel ?? column()?.addLabel ?? '_COMMON._ACTION.ADD'\"\n [isDisabled]=\"isLevelFull(_items, 0)\" (btnAction)=\"onAdd(undefined, 0)\" />\n }\n </div>\n\n <ng-container *ngTemplateOutlet=\"nodeTpl; context: { $implicit: _items, depth: 0, parent: undefined }\" />\n</div>\n\n<!--\n Template r\u00E9cursif : \u00E0 chaque niveau, on rend un cdkDropList isol\u00E9\n (pas de cdkDropListConnectedTo => transfert inter-listes impossible),\n puis on r\u00E9-instancie le m\u00EAme template pour la sous-liste de chaque enfant.\n-->\n<ng-template #nodeTpl let-nodes let-depth=\"depth\" let-parent=\"parent\">\n @if (isLevelFull(nodes, depth)) {\n <cw-alert [type]=\"alertType.warning\" cssClass=\"ddn-list-max-alert\">\n {{ (column()?.maxReachedLabel ?? '_COMMON.MAX_ITEMS_REACHED') | translate:{ max: levelMax(depth) } }}\n </cw-alert>\n }\n\n <ul class=\"list-unstyled d-flex-v gap-md ms-none\" [ngClass]=\"column()?.cssClass\" [attr.data-depth]=\"depth\"\n cdkDropList [cdkDropListData]=\"nodes\" (cdkDropListDropped)=\"drop($event)\">\n\n @for (item of nodes; track item.id) {\n <li cdkDrag [cdkDragDisabled]=\"!isSortable(item) || (item.disabled ?? false) || (item.pendingDelete ?? false)\" cdkDragPreviewClass=\"ddn-list-card-preview\">\n <cw-card [cssClass]=\"cardCssClass(item, depth)\" [title]=\"(item.title ?? item.label) || ''\"\n [subtitle]=\"item.subtitle ?? ''\" [truncateSubtitle]=\"true\" [type]=\"cardType(depth)\" [collapsible]=\"isCollapsible(item, depth)\"\n [collapsed]=\"isCollapsedCard(item, depth)\" [collapseStretched]=\"false\"\n (collapseClicked)=\"onCollapseChange(item, $event)\">\n\n <!-- Poign\u00E9e de drag (\u00E0 gauche du titre) : le glisser ne d\u00E9marre que d'ici.\n Non rendue si la carte n'est pas triable (ordre non manipulable) ; `disabled`\n la garde affich\u00E9e mais inerte. -->\n @if (isSortable(item)) {\n <button header-start type=\"button\" class=\"ddn-list-handle btn btn-ghost\" cdkDragHandle\n [disabled]=\"(item.disabled ?? false) || (item.pendingDelete ?? false)\" [attr.aria-label]=\"'_COMMON._ACTION.MOVE' | translate\">\n <cw-icon [icon]=\"spriteIcon.grip\" [iconSize]=\"iconSize['md']\" />\n </button>\n }\n\n <!-- En-t\u00EAte : compteur d'enfants + badge + actions -->\n <div header-custom-area class=\"d-flex-h gap-2xs justify-end align-start\">\n @if (childrenCountLabel(item, depth); as count) {\n <span class=\"ddn-list-count fs fs-xs\">{{ count }}</span>\n }\n\n @if (item.badge) {\n <cw-badge [type]=\"item.badge.type\" [label]=\"item.badge.label\" [withIcon]=\"item.badge.icon\" />\n }\n\n <!-- Sur une carte pendingDelete, seul \u00AB Restaurer \u00BB est propos\u00E9 (view/edit masqu\u00E9s). -->\n @if (!item.pendingDelete && showAction(item, 'view')) {\n <cw-button label=\"_COMMON._ACTION.VIEW\" [withIcon]=\"spriteIcon.search\" [withOnlyIcon]=\"true\"\n [type]=\"buttonType.secondary\" [iconSize]=\"buttonIconSize.xsmall\" (btnAction)=\"view.emit(item)\" />\n }\n @if (!item.pendingDelete && showAction(item, 'edit')) {\n <cw-button label=\"_COMMON._ACTION.EDIT\" [withIcon]=\"spriteIcon.edit\" [withOnlyIcon]=\"true\"\n [type]=\"buttonType.secondary\" [iconSize]=\"buttonIconSize.xsmall\" (btnAction)=\"edit.emit(item)\" />\n }\n @if (showAction(item, 'delete')) {\n @if (item.pendingDelete) {\n <!-- Soft-delete : la corbeille bascule en \u00AB Restaurer \u00BB (d\u00E9sactiv\u00E9 si le niveau est plein). -->\n <cw-button label=\"_COMMON._ACTION.RESTORE\" [withIcon]=\"spriteIcon.toolbarRefresh\" [withOnlyIcon]=\"true\"\n [type]=\"buttonType.secondary\" cssClass=\"ddn-list-action-restore\"\n [isDisabled]=\"isRestoreBlocked(nodes, depth)\"\n [iconSize]=\"buttonIconSize.xsmall\" (btnAction)=\"restore.emit(item)\" />\n } @else {\n <cw-button label=\"_COMMON._ACTION.DELETE\" [withIcon]=\"spriteIcon.trash\" [withOnlyIcon]=\"true\"\n [type]=\"buttonType.secondary\" cssClass=\"ddn-list-action-delete\"\n [iconSize]=\"buttonIconSize.xsmall\" (btnAction)=\"delete.emit(item)\" />\n }\n }\n </div>\n\n <!-- Restauration impossible : niveau plein (mode excludePendingDeleteFromMax). -->\n @if (item.pendingDelete && isRestoreBlocked(nodes, depth)) {\n <cw-alert [type]=\"alertType.warning\" cssClass=\"ddn-list-restore-blocked-alert\">\n {{ (column()?.restoreBlockedLabel ?? '_COMMON.MAX_RESTORE_BLOCKED') | translate:{ max: levelMax(depth) } }}\n </cw-alert>\n }\n\n <!-- Corps masqu\u00E9 sur une carte pendingDelete : on n'affiche que l'en-t\u00EAte (carte compacte,\n non pliable, non d\u00E9pla\u00E7able). L'encart \u00AB restauration impossible \u00BB ci-dessus reste, lui, visible. -->\n @if (!item.pendingDelete) {\n <!-- Corps : template custom (slot). Sans slot, on ne rend que ce que l'en-t\u00EAte ne porte\n pas d\u00E9j\u00E0 (le titre vaut `title ?? label`) : le code seul, s'il existe. -->\n @if (itemTemplate(); as tpl) {\n <ng-container *ngTemplateOutlet=\"tpl; context: { $implicit: item, depth: depth }\" />\n } @else if (item.code) {\n <div class=\"default-item\"><span class=\"text-muted\">({{ item.code }})</span></div>\n }\n\n @if (item.children?.length) {\n <ng-container\n *ngTemplateOutlet=\"nodeTpl; context: { $implicit: item.children, depth: depth + 1, parent: item }\" />\n }\n\n @if (canAdd(item, depth)) {\n <div class=\"d-flex-h justify-end\">\n <cw-button class=\"ddn-list-add\" [type]=\"buttonType.link\" [withIcon]=\"spriteIcon.add\"\n [iconPosition]=\"buttonPosition.left\" [label]=\"column()?.addLabel ?? '_COMMON._ACTION.ADD'\"\n [isDisabled]=\"isLevelFull(item.children ?? [], depth + 1)\" (btnAction)=\"onAdd(item, depth + 1)\" />\n </div>\n }\n }\n </cw-card>\n </li>\n }\n\n </ul>\n</ng-template>\n", dependencies: [{ kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "ngmodule", type: TranslateModule }, { kind: "ngmodule", type: DragDropModule }, { kind: "directive", type: i1$1.CdkDropList, selector: "[cdkDropList], cdk-drop-list", inputs: ["cdkDropListConnectedTo", "cdkDropListData", "cdkDropListOrientation", "id", "cdkDropListLockAxis", "cdkDropListDisabled", "cdkDropListSortingDisabled", "cdkDropListEnterPredicate", "cdkDropListSortPredicate", "cdkDropListAutoScrollDisabled", "cdkDropListAutoScrollStep", "cdkDropListElementContainer", "cdkDropListHasAnchor"], outputs: ["cdkDropListDropped", "cdkDropListEntered", "cdkDropListExited", "cdkDropListSorted"], exportAs: ["cdkDropList"] }, { kind: "directive", type: i1$1.CdkDrag, selector: "[cdkDrag]", inputs: ["cdkDragData", "cdkDragLockAxis", "cdkDragRootElement", "cdkDragBoundary", "cdkDragStartDelay", "cdkDragFreeDragPosition", "cdkDragDisabled", "cdkDragConstrainPosition", "cdkDragPreviewClass", "cdkDragPreviewContainer", "cdkDragScale"], outputs: ["cdkDragStarted", "cdkDragReleased", "cdkDragEnded", "cdkDragEntered", "cdkDragExited", "cdkDragDropped", "cdkDragMoved"], exportAs: ["cdkDrag"] }, { kind: "directive", type: i1$1.CdkDragHandle, selector: "[cdkDragHandle]", inputs: ["cdkDragHandleDisabled"] }, { kind: "component", type: CardComponent, selector: "cw-card", inputs: ["title", "subtitle", "truncateSubtitle", "type", "titleRank", "cssClass", "collapsible", "collapsed", "disabled", "collapseLocked", "collapseStretched", "collapseId", "destroyOnHide", "fullHeight"], outputs: ["collapsibleChange", "destroyOnHideChange", "collapseClicked"] }, { kind: "component", type: BadgeComponent, selector: "cw-badge", inputs: ["type", "label", "withIcon", "iconPosition", "cssClass", "skeletonMode", "dataTest"] }, { kind: "component", type: IconComponent, selector: "cw-icon", inputs: ["icon", "label", "type", "iconSize", "iconCssClass", "iconUiType", "iconColorCustom", "spritePath"] }, { kind: "component", type: ButtonComponent, selector: "cw-button", inputs: ["type", "label", "id", "link", "isDropdown", "hideCaret", "withIcon", "withOnlyIcon", "iconSize", "iconPosition", "dropdownPosition", "isMinWidth", "isDisabled", "isLoading", "loadingAnnounce", "cssClass", "dataTest", "skeletonMode", "isPressed", "ariaDescribedBy", "withTooltip", "tooltipText", "tooltipTitle", "tooltipTrigger", "tooltipPosition", "tooltipType"], outputs: ["btnAction", "dropDownClicked"] }, { kind: "component", type: AlertComponent, selector: "cw-alert", inputs: ["type", "title", "isDismissible", "cssClass", "dataTest"], outputs: ["close"] }, { kind: "pipe", type: i1.TranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
471
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.20", type: DragNDropNestedListComponent, isStandalone: true, selector: "cw-drag-n-drop-nested-list", inputs: { items: { classPropertyName: "items", publicName: "items", isSignal: true, isRequired: false, transformFunction: null }, itemTemplate: { classPropertyName: "itemTemplate", publicName: "itemTemplate", isSignal: true, isRequired: false, transformFunction: null }, column: { classPropertyName: "column", publicName: "column", isSignal: true, isRequired: false, transformFunction: null }, reorderOnDrop: { classPropertyName: "reorderOnDrop", publicName: "reorderOnDrop", isSignal: true, isRequired: false, transformFunction: null }, maxDepth: { classPropertyName: "maxDepth", publicName: "maxDepth", isSignal: true, isRequired: false, transformFunction: null }, selectedId: { classPropertyName: "selectedId", publicName: "selectedId", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { itemsChange: "itemsChange", view: "view", edit: "edit", delete: "delete", restore: "restore", add: "add", expandedChange: "expandedChange" }, ngImport: i0, template: "<div class=\"ddn-list d-flex-v gap-md\">\n <div class=\"d-flex-h justify-between\">\n @if (column()?.title) {\n <h2>{{ column()!.title | translate }} ({{ columnCountLabel() }})</h2>\n }\n\n @if (column()?.showAddRoot) {\n <cw-button cssClass=\"ddn-list-add\" [type]=\"buttonType.link\" [withIcon]=\"spriteIcon.add\"\n [iconPosition]=\"buttonPosition.left\" [label]=\"column()?.addRootLabel ?? column()?.addLabel ?? '_COMMON._ACTION.ADD'\"\n [isDisabled]=\"isLevelFull(_items, 0)\" (btnAction)=\"onAdd(undefined, 0)\" />\n }\n </div>\n\n <ng-container *ngTemplateOutlet=\"nodeTpl; context: { $implicit: _items, depth: 0, parent: undefined }\" />\n</div>\n\n<!--\n Template r\u00E9cursif : \u00E0 chaque niveau, on rend un cdkDropList isol\u00E9\n (pas de cdkDropListConnectedTo => transfert inter-listes impossible),\n puis on r\u00E9-instancie le m\u00EAme template pour la sous-liste de chaque enfant.\n-->\n<ng-template #nodeTpl let-nodes let-depth=\"depth\" let-parent=\"parent\">\n @if (isLevelFull(nodes, depth)) {\n <cw-alert [type]=\"alertType.warning\" cssClass=\"ddn-list-max-alert\">\n {{ (column()?.maxReachedLabel ?? '_COMMON.MAX_ITEMS_REACHED') | translate:{ max: levelMax(depth) } }}\n </cw-alert>\n }\n\n <ul class=\"list-unstyled d-flex-v gap-md ms-none\" [ngClass]=\"column()?.cssClass\" [attr.data-depth]=\"depth\"\n cdkDropList [cdkDropListData]=\"nodes\" (cdkDropListDropped)=\"drop($event)\">\n\n @for (item of nodes; track item.id) {\n <li cdkDrag [cdkDragDisabled]=\"!isSortable(item) || (item.disabled ?? false) || (item.pendingDelete ?? false)\" cdkDragPreviewClass=\"ddn-list-card-preview\">\n <cw-card [cssClass]=\"cardCssClass(item, depth)\" [title]=\"(item.title ?? item.label) || ''\"\n [subtitle]=\"item.subtitle ?? ''\" [truncateSubtitle]=\"true\" [type]=\"cardType(depth)\" [collapsible]=\"isCollapsible(item, depth)\"\n [collapsed]=\"isCollapsedCard(item, depth)\" [collapseStretched]=\"false\"\n (collapseClicked)=\"onCollapseChange(item, $event)\">\n\n <!-- Poign\u00E9e de drag (\u00E0 gauche du titre) : le glisser ne d\u00E9marre que d'ici.\n Non rendue si la carte n'est pas triable (ordre non manipulable) ; `disabled`\n la garde affich\u00E9e mais inerte. -->\n @if (isSortable(item)) {\n <button header-start type=\"button\" class=\"ddn-list-handle btn btn-ghost\" cdkDragHandle\n [disabled]=\"(item.disabled ?? false) || (item.pendingDelete ?? false)\" [attr.aria-label]=\"'_COMMON._ACTION.MOVE' | translate\">\n <cw-icon [icon]=\"spriteIcon.grip\" [iconSize]=\"iconSize['md']\" />\n </button>\n }\n\n <!-- En-t\u00EAte : compteur d'enfants + badge + actions -->\n <div header-custom-area class=\"d-flex-h gap-2xs justify-end align-start\">\n @if (childrenCountLabel(item, depth); as count) {\n <span class=\"ddn-list-count fs fs-xs\">{{ count }}</span>\n }\n\n @if (item.badge) {\n <cw-badge [type]=\"item.badge.type\" [label]=\"item.badge.label\" [withIcon]=\"item.badge.icon\" />\n }\n\n <!-- Sur une carte pendingDelete, seul \u00AB Restaurer \u00BB est propos\u00E9 (view/edit masqu\u00E9s). -->\n @if (!item.pendingDelete && showAction(item, 'view')) {\n <cw-button label=\"_COMMON._ACTION.VIEW\" [withIcon]=\"spriteIcon.search\" [withOnlyIcon]=\"true\"\n [type]=\"buttonType.secondary\" [iconSize]=\"buttonIconSize.xsmall\" (btnAction)=\"view.emit(item)\" />\n }\n @if (!item.pendingDelete && showAction(item, 'edit')) {\n <cw-button label=\"_COMMON._ACTION.EDIT\" [withIcon]=\"spriteIcon.edit\" [withOnlyIcon]=\"true\"\n [type]=\"buttonType.secondary\" [iconSize]=\"buttonIconSize.xsmall\" (btnAction)=\"edit.emit(item)\" />\n }\n @if (showAction(item, 'delete')) {\n @if (item.pendingDelete) {\n <!-- Soft-delete : la corbeille bascule en \u00AB Restaurer \u00BB (d\u00E9sactiv\u00E9 si le niveau est plein). -->\n <cw-button label=\"_COMMON._ACTION.RESTORE\" [withIcon]=\"spriteIcon.toolbarRefresh\" [withOnlyIcon]=\"true\"\n [type]=\"buttonType.secondary\" cssClass=\"ddn-list-action-restore\"\n [isDisabled]=\"isRestoreBlocked(nodes, depth)\"\n [iconSize]=\"buttonIconSize.xsmall\" (btnAction)=\"restore.emit(item)\" />\n } @else {\n <cw-button label=\"_COMMON._ACTION.DELETE\" [withIcon]=\"spriteIcon.trash\" [withOnlyIcon]=\"true\"\n [type]=\"buttonType.secondary\" cssClass=\"ddn-list-action-delete\"\n [iconSize]=\"buttonIconSize.xsmall\" (btnAction)=\"delete.emit(item)\" />\n }\n }\n </div>\n\n <!-- Restauration impossible : niveau plein (mode excludePendingDeleteFromMax). -->\n @if (item.pendingDelete && isRestoreBlocked(nodes, depth)) {\n <cw-alert [type]=\"alertType.warning\" cssClass=\"ddn-list-restore-blocked-alert\">\n {{ (column()?.restoreBlockedLabel ?? '_COMMON.MAX_RESTORE_BLOCKED') | translate:{ max: levelMax(depth) } }}\n </cw-alert>\n }\n\n <!-- Corps masqu\u00E9 sur une carte pendingDelete : on n'affiche que l'en-t\u00EAte (carte compacte,\n non pliable, non d\u00E9pla\u00E7able). L'encart \u00AB restauration impossible \u00BB ci-dessus reste, lui, visible. -->\n @if (!item.pendingDelete) {\n <!-- Corps : template custom (slot). Sans slot, on ne rend que ce que l'en-t\u00EAte ne porte\n pas d\u00E9j\u00E0 (le titre vaut `title ?? label`) : le code seul, s'il existe. -->\n @if (itemTemplate(); as tpl) {\n <ng-container *ngTemplateOutlet=\"tpl; context: { $implicit: item, depth: depth }\" />\n } @else if (item.code) {\n <div class=\"default-item\"><span class=\"text-muted\">({{ item.code }})</span></div>\n }\n\n @if (item.children?.length) {\n <ng-container\n *ngTemplateOutlet=\"nodeTpl; context: { $implicit: item.children, depth: depth + 1, parent: item }\" />\n }\n\n @if (canAdd(item, depth)) {\n <div class=\"d-flex-h justify-end\">\n <cw-button class=\"ddn-list-add\" [type]=\"buttonType.link\" [withIcon]=\"spriteIcon.add\"\n [iconPosition]=\"buttonPosition.left\" [label]=\"column()?.addLabel ?? '_COMMON._ACTION.ADD'\"\n [isDisabled]=\"isLevelFull(item.children ?? [], depth + 1)\" (btnAction)=\"onAdd(item, depth + 1)\" />\n </div>\n }\n }\n </cw-card>\n </li>\n }\n\n </ul>\n</ng-template>\n", dependencies: [{ kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "ngmodule", type: TranslateModule }, { kind: "ngmodule", type: DragDropModule }, { kind: "directive", type: i1$1.CdkDropList, selector: "[cdkDropList], cdk-drop-list", inputs: ["cdkDropListConnectedTo", "cdkDropListData", "cdkDropListOrientation", "id", "cdkDropListLockAxis", "cdkDropListDisabled", "cdkDropListSortingDisabled", "cdkDropListEnterPredicate", "cdkDropListSortPredicate", "cdkDropListAutoScrollDisabled", "cdkDropListAutoScrollStep", "cdkDropListElementContainer", "cdkDropListHasAnchor"], outputs: ["cdkDropListDropped", "cdkDropListEntered", "cdkDropListExited", "cdkDropListSorted"], exportAs: ["cdkDropList"] }, { kind: "directive", type: i1$1.CdkDrag, selector: "[cdkDrag]", inputs: ["cdkDragData", "cdkDragLockAxis", "cdkDragRootElement", "cdkDragBoundary", "cdkDragStartDelay", "cdkDragFreeDragPosition", "cdkDragDisabled", "cdkDragConstrainPosition", "cdkDragPreviewClass", "cdkDragPreviewContainer", "cdkDragScale"], outputs: ["cdkDragStarted", "cdkDragReleased", "cdkDragEnded", "cdkDragEntered", "cdkDragExited", "cdkDragDropped", "cdkDragMoved"], exportAs: ["cdkDrag"] }, { kind: "directive", type: i1$1.CdkDragHandle, selector: "[cdkDragHandle]", inputs: ["cdkDragHandleDisabled"] }, { kind: "component", type: CardComponent, selector: "cw-card", inputs: ["title", "titleId", "subtitle", "truncateSubtitle", "type", "titleRank", "cssClass", "collapsible", "collapsed", "disabled", "collapseLocked", "collapseStretched", "collapseId", "destroyOnHide", "fullHeight"], outputs: ["collapsibleChange", "destroyOnHideChange", "collapseClicked"] }, { kind: "component", type: BadgeComponent, selector: "cw-badge", inputs: ["type", "label", "labelParams", "withIcon", "iconPosition", "cssClass", "skeletonMode", "dataTest"] }, { kind: "component", type: IconComponent, selector: "cw-icon", inputs: ["icon", "label", "type", "iconSize", "iconCssClass", "iconUiType", "iconColorCustom", "spritePath"] }, { kind: "component", type: ButtonComponent, selector: "cw-button", inputs: ["type", "label", "labelParams", "id", "link", "isDropdown", "hideCaret", "withIcon", "withOnlyIcon", "iconSize", "iconPosition", "dropdownPosition", "isMinWidth", "isDisabled", "isLoading", "loadingAnnounce", "cssClass", "dataTest", "skeletonMode", "isPressed", "ariaDescribedBy", "ariaLabel", "ariaExpanded", "ariaControls", "withTooltip", "tooltipText", "tooltipTitle", "tooltipTrigger", "tooltipPosition", "tooltipType"], outputs: ["btnAction", "dropDownClicked"] }, { kind: "component", type: AlertComponent, selector: "cw-alert", inputs: ["type", "title", "titleParams", "isDismissible", "cssClass", "dataTest", "live"], outputs: ["close"] }, { kind: "pipe", type: i1.TranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
472
472
|
}
|
|
473
473
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.20", ngImport: i0, type: DragNDropNestedListComponent, decorators: [{
|
|
474
474
|
type: Component,
|
|
@@ -577,7 +577,7 @@ class PaginationComponent {
|
|
|
577
577
|
});
|
|
578
578
|
}
|
|
579
579
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.20", ngImport: i0, type: PaginationComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
580
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.20", type: PaginationComponent, isStandalone: true, selector: "cw-pagination", inputs: { pagination: { classPropertyName: "pagination", publicName: "pagination", isSignal: true, isRequired: true, transformFunction: null } }, outputs: { paginationChange: "paginationChange" }, ngImport: i0, template: "@if (pagination().totalPages > 0) {\r\n<div class=\"pagination d-flex-h gap-md justify-between fs fs-sm\">\r\n\r\n <!-- LEFT PART -->\r\n <div class=\"d-flex-h gap-sm\">\r\n {{ '_COMMON._PAGINATION.RESULT_P' | translate: {total: pagination().totalItems } }}\r\n -\r\n {{ '_COMMON._PAGINATION.DISPLAY' | translate }}\r\n\r\n <cw-form-field\r\n [label]=\"'_COMMON._PAGINATION.ITEMS_PER_PAGE'\"\r\n [type]=\"typeField.select\"\r\n [control]=\"itemsPerPageControl\"\r\n [options]=\"pageSizesOptions\"\r\n [displayLabel]=\"false\"\r\n [clearable]=\"false\">\r\n </cw-form-field>\r\n\r\n {{ '_COMMON._PAGINATION.ITEMS_PER_PAGE' | translate }}\r\n </div>\r\n\r\n <!-- PAGINATION -->\r\n <ul class=\"list-unstyled d-flex-h gap-3xs\">\r\n\r\n <!-- PREVIOUS -->\r\n <li>\r\n <cw-button\r\n [type]=\"typeButton.ghost\"\r\n [withOnlyIcon]=\"true\"\r\n [withIcon]=\"spriteIcon.nextLeft\"\r\n [isDisabled]=\"pagination().currentPage <= 1\"\r\n [iconSize]=\"buttonIconSize.small\"\r\n cssClass=\"btn-pagination\"\r\n (btnAction)=\"emit(pagination().currentPage - 1)\">\r\n </cw-button>\r\n </li>\r\n\r\n <!-- PAGES -->\r\n @for (item of visiblePages(); track item) {\r\n\r\n <!-- NUMBER -->\r\n @if (typeof item === 'number') {\r\n <li>\r\n <cw-button\r\n [type]=\"typeButton.ghost\"\r\n [label]=\"item.toString()\"\r\n [cssClass]=\"item === pagination().currentPage ? 'btn-pagination btn-pagination-active' : 'btn-pagination'\"\r\n (btnAction)=\"emit(item)\">\r\n </cw-button>\r\n </li>\r\n }\r\n\r\n <!-- JUMP PREV -->\r\n @else if (item.type === 'jump-prev') {\r\n <li>\r\n <cw-button\r\n [type]=\"typeButton.ghost\"\r\n label=\"...\"\r\n cssClass=\"btn-pagination\"\r\n (btnAction)=\"emit(item.page)\">\r\n </cw-button>\r\n </li>\r\n }\r\n\r\n <!-- JUMP NEXT -->\r\n @else if (item.type === 'jump-next') {\r\n <li>\r\n <cw-button\r\n [type]=\"typeButton.ghost\"\r\n label=\"...\"\r\n cssClass=\"btn-pagination\"\r\n (btnAction)=\"emit(item.page)\">\r\n </cw-button>\r\n </li>\r\n }\r\n }\r\n\r\n <!-- NEXT -->\r\n <li>\r\n <cw-button\r\n [type]=\"typeButton.ghost\"\r\n [withOnlyIcon]=\"true\"\r\n [withIcon]=\"spriteIcon.nextRight\"\r\n [isDisabled]=\"pagination().currentPage >= pagination().totalPages\"\r\n [iconSize]=\"buttonIconSize.small\"\r\n cssClass=\"btn-pagination\"\r\n (btnAction)=\"emit(pagination().currentPage + 1)\">\r\n </cw-button>\r\n </li>\r\n\r\n </ul>\r\n</div>\r\n}\r\n", dependencies: [{ kind: "ngmodule", type: TranslateModule }, { kind: "component", type: ButtonComponent, selector: "cw-button", inputs: ["type", "label", "id", "link", "isDropdown", "hideCaret", "withIcon", "withOnlyIcon", "iconSize", "iconPosition", "dropdownPosition", "isMinWidth", "isDisabled", "isLoading", "loadingAnnounce", "cssClass", "dataTest", "skeletonMode", "isPressed", "ariaDescribedBy", "withTooltip", "tooltipText", "tooltipTitle", "tooltipTrigger", "tooltipPosition", "tooltipType"], outputs: ["btnAction", "dropDownClicked"] }, { kind: "component", type: FormFieldComponent, selector: "cw-form-field", inputs: ["control", "formGroup", "type", "label", "displayLabel", "name", "placeholder", "autocomplete", "options", "rangeOptions", "validationOptions", "autocompleteOptions", "richTextOptions", "errorMessages", "isRequired", "help", "tooltip", "addonLeft", "addonRight", "isInAddon", "isReadonly", "isDisabled", "sliderValue", "sliderOptions", "cssClass", "skeletonMode", "clearable", "appendTo", "initialCountry", "recommendedDimensions", "showPreview", "existingFile", "indeterminate"], outputs: ["refreshEvent", "fileRemoved", "textChanged", "valueChange", "phoneRegionChange"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "pipe", type: i1.TranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
580
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.20", type: PaginationComponent, isStandalone: true, selector: "cw-pagination", inputs: { pagination: { classPropertyName: "pagination", publicName: "pagination", isSignal: true, isRequired: true, transformFunction: null } }, outputs: { paginationChange: "paginationChange" }, ngImport: i0, template: "@if (pagination().totalPages > 0) {\r\n<div class=\"pagination d-flex-h gap-md justify-between fs fs-sm\">\r\n\r\n <!-- LEFT PART -->\r\n <div class=\"d-flex-h gap-sm\">\r\n {{ '_COMMON._PAGINATION.RESULT_P' | translate: {total: pagination().totalItems } }}\r\n -\r\n {{ '_COMMON._PAGINATION.DISPLAY' | translate }}\r\n\r\n <cw-form-field\r\n [label]=\"'_COMMON._PAGINATION.ITEMS_PER_PAGE'\"\r\n [type]=\"typeField.select\"\r\n [control]=\"itemsPerPageControl\"\r\n [options]=\"pageSizesOptions\"\r\n [displayLabel]=\"false\"\r\n [clearable]=\"false\">\r\n </cw-form-field>\r\n\r\n {{ '_COMMON._PAGINATION.ITEMS_PER_PAGE' | translate }}\r\n </div>\r\n\r\n <!-- PAGINATION -->\r\n <ul class=\"list-unstyled d-flex-h gap-3xs\">\r\n\r\n <!-- PREVIOUS -->\r\n <li>\r\n <cw-button\r\n [type]=\"typeButton.ghost\"\r\n [withOnlyIcon]=\"true\"\r\n [withIcon]=\"spriteIcon.nextLeft\"\r\n [isDisabled]=\"pagination().currentPage <= 1\"\r\n [iconSize]=\"buttonIconSize.small\"\r\n cssClass=\"btn-pagination\"\r\n (btnAction)=\"emit(pagination().currentPage - 1)\">\r\n </cw-button>\r\n </li>\r\n\r\n <!-- PAGES -->\r\n @for (item of visiblePages(); track item) {\r\n\r\n <!-- NUMBER -->\r\n @if (typeof item === 'number') {\r\n <li>\r\n <cw-button\r\n [type]=\"typeButton.ghost\"\r\n [label]=\"item.toString()\"\r\n [cssClass]=\"item === pagination().currentPage ? 'btn-pagination btn-pagination-active' : 'btn-pagination'\"\r\n (btnAction)=\"emit(item)\">\r\n </cw-button>\r\n </li>\r\n }\r\n\r\n <!-- JUMP PREV -->\r\n @else if (item.type === 'jump-prev') {\r\n <li>\r\n <cw-button\r\n [type]=\"typeButton.ghost\"\r\n label=\"...\"\r\n cssClass=\"btn-pagination\"\r\n (btnAction)=\"emit(item.page)\">\r\n </cw-button>\r\n </li>\r\n }\r\n\r\n <!-- JUMP NEXT -->\r\n @else if (item.type === 'jump-next') {\r\n <li>\r\n <cw-button\r\n [type]=\"typeButton.ghost\"\r\n label=\"...\"\r\n cssClass=\"btn-pagination\"\r\n (btnAction)=\"emit(item.page)\">\r\n </cw-button>\r\n </li>\r\n }\r\n }\r\n\r\n <!-- NEXT -->\r\n <li>\r\n <cw-button\r\n [type]=\"typeButton.ghost\"\r\n [withOnlyIcon]=\"true\"\r\n [withIcon]=\"spriteIcon.nextRight\"\r\n [isDisabled]=\"pagination().currentPage >= pagination().totalPages\"\r\n [iconSize]=\"buttonIconSize.small\"\r\n cssClass=\"btn-pagination\"\r\n (btnAction)=\"emit(pagination().currentPage + 1)\">\r\n </cw-button>\r\n </li>\r\n\r\n </ul>\r\n</div>\r\n}\r\n", dependencies: [{ kind: "ngmodule", type: TranslateModule }, { kind: "component", type: ButtonComponent, selector: "cw-button", inputs: ["type", "label", "labelParams", "id", "link", "isDropdown", "hideCaret", "withIcon", "withOnlyIcon", "iconSize", "iconPosition", "dropdownPosition", "isMinWidth", "isDisabled", "isLoading", "loadingAnnounce", "cssClass", "dataTest", "skeletonMode", "isPressed", "ariaDescribedBy", "ariaLabel", "ariaExpanded", "ariaControls", "withTooltip", "tooltipText", "tooltipTitle", "tooltipTrigger", "tooltipPosition", "tooltipType"], outputs: ["btnAction", "dropDownClicked"] }, { kind: "component", type: FormFieldComponent, selector: "cw-form-field", inputs: ["control", "formGroup", "type", "label", "displayLabel", "fieldTitle", "name", "placeholder", "autocomplete", "options", "rangeOptions", "validationOptions", "autocompleteOptions", "richTextOptions", "errorMessages", "isRequired", "help", "tooltip", "ariaDescribedBy", "addonLeft", "addonRight", "isInAddon", "isReadonly", "isDisabled", "sliderValue", "sliderOptions", "cssClass", "skeletonMode", "clearable", "appendTo", "initialCountry", "recommendedDimensions", "showPreview", "existingFile", "indeterminate"], outputs: ["refreshEvent", "fileRemoved", "textChanged", "valueChange", "phoneRegionChange"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "pipe", type: i1.TranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
581
581
|
}
|
|
582
582
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.20", ngImport: i0, type: PaginationComponent, decorators: [{
|
|
583
583
|
type: Component,
|
|
@@ -646,10 +646,20 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.20", ngImpo
|
|
|
646
646
|
// Compteur plutôt que Math.random() : ids déterministes, stables en test (cf. uniqueId de basic-ui, interne).
|
|
647
647
|
let nextTableId = 0;
|
|
648
648
|
class TableComponent {
|
|
649
|
+
/** `left` d'une colonne figee, `null` si elle ne l'est pas. */
|
|
650
|
+
stickyLeft(key) {
|
|
651
|
+
const index = this.stickyCellIndex().get(key);
|
|
652
|
+
return index === undefined ? null : (this.stickyOffsets()[index] ?? 0);
|
|
653
|
+
}
|
|
654
|
+
/** Derniere colonne figee : porte la separation avec la zone qui defile. */
|
|
655
|
+
isLastSticky(key) {
|
|
656
|
+
return this.stickyCellIndex().get(key) === this.stickyCellCount() - 1;
|
|
657
|
+
}
|
|
649
658
|
constructor() {
|
|
650
659
|
this.modalsService = inject(ModalsService);
|
|
651
660
|
/** Portee courante (`provideCwPageScope`) : mentionnee dans le message « pas de donnee ». */
|
|
652
661
|
this.pageScope = inject(CW_PAGE_SCOPE);
|
|
662
|
+
this.destroyRef = inject(DestroyRef);
|
|
653
663
|
/** Prefixe d'id unique par instance : evite les collisions d'id de checkbox si plusieurs tables coexistent. */
|
|
654
664
|
this.uid = `cw-table-${nextTableId++}`;
|
|
655
665
|
/**
|
|
@@ -660,10 +670,13 @@ class TableComponent {
|
|
|
660
670
|
*/
|
|
661
671
|
this.checkbox = input(false, ...(ngDevMode ? [{ debugName: "checkbox" }] : []));
|
|
662
672
|
/**
|
|
663
|
-
*
|
|
664
|
-
*
|
|
673
|
+
* Legende du tableau : CLE i18n, traduite telle quelle dans le `<caption>` (lu par les
|
|
674
|
+
* lecteurs d'ecran, masque visuellement). La lib n'ajoute aucun texte autour : la cle
|
|
675
|
+
* porte la legende complete (« Liste des utilisateurs », « Journal d'audit »...).
|
|
676
|
+
*
|
|
677
|
+
* Requis : une table sans legende annoncait un caption vide ou tronque, sans erreur.
|
|
665
678
|
*/
|
|
666
|
-
this.title = input(
|
|
679
|
+
this.title = input.required(...(ngDevMode ? [{ debugName: "title" }] : []));
|
|
667
680
|
this.columns = input([], ...(ngDevMode ? [{ debugName: "columns" }] : []));
|
|
668
681
|
/** Lignes du tableau. En mode `checkbox`, chaque ligne doit avoir un `id` unique (cf. `checkbox`). */
|
|
669
682
|
this.data = input([], ...(ngDevMode ? [{ debugName: "data" }] : []));
|
|
@@ -728,6 +741,44 @@ class TableComponent {
|
|
|
728
741
|
this.selectionCount = computed(() => this.selectedRowsMap().size, ...(ngDevMode ? [{ debugName: "selectionCount" }] : []));
|
|
729
742
|
/** Nombre de colonnes rendues (visibles + colonne de selection) — alimente le colspan des lignes loader/vide. */
|
|
730
743
|
this.visibleColumnCount = computed(() => this.columns().filter(c => !c.hidden).length + (this.checkbox() ? 1 : 0), ...(ngDevMode ? [{ debugName: "visibleColumnCount" }] : []));
|
|
744
|
+
// ----- Defilement horizontal -----
|
|
745
|
+
// Table plus large que son conteneur : le conteneur defile, une barre « proxy » collee en bas de
|
|
746
|
+
// la fenetre (sticky) remplace la barre native, pour qu'on puisse defiler sans descendre au bas
|
|
747
|
+
// de la table. Les colonnes `sticky` de tete restent figees.
|
|
748
|
+
this.scroller = viewChild.required('scroller');
|
|
749
|
+
this.scrollbarProxy = viewChild('scrollbarProxy', ...(ngDevMode ? [{ debugName: "scrollbarProxy" }] : []));
|
|
750
|
+
/** La table deborde de son conteneur. */
|
|
751
|
+
this.overflowing = signal(false, ...(ngDevMode ? [{ debugName: "overflowing" }] : []));
|
|
752
|
+
/** Largeur totale de la table (piste de la barre proxy). */
|
|
753
|
+
this.scrollWidth = signal(0, ...(ngDevMode ? [{ debugName: "scrollWidth" }] : []));
|
|
754
|
+
this.canScrollLeft = signal(false, ...(ngDevMode ? [{ debugName: "canScrollLeft" }] : []));
|
|
755
|
+
this.canScrollRight = signal(false, ...(ngDevMode ? [{ debugName: "canScrollRight" }] : []));
|
|
756
|
+
/** Decalage `left` (px) de chaque cellule figee, dans l'ordre des cellules d'une ligne. */
|
|
757
|
+
this.stickyOffsets = signal([], ...(ngDevMode ? [{ debugName: "stickyOffsets" }] : []));
|
|
758
|
+
/** Largeur cumulee des colonnes figees : l'ombre gauche demarre apres elles. */
|
|
759
|
+
this.stickyWidth = signal(0, ...(ngDevMode ? [{ debugName: "stickyWidth" }] : []));
|
|
760
|
+
/** Nombre de colonnes visibles figees en tete (la premiere non figee arrete la serie). */
|
|
761
|
+
this.stickyColumnCount = computed(() => {
|
|
762
|
+
let count = 0;
|
|
763
|
+
for (const column of this.columns().filter(c => !c.hidden)) {
|
|
764
|
+
if (!column.sticky)
|
|
765
|
+
break;
|
|
766
|
+
count++;
|
|
767
|
+
}
|
|
768
|
+
return count;
|
|
769
|
+
}, ...(ngDevMode ? [{ debugName: "stickyColumnCount" }] : []));
|
|
770
|
+
/** La case a cocher est figee des qu'une colonne l'est (sinon elle passerait sous la colonne figee). */
|
|
771
|
+
this.checkboxSticky = computed(() => this.checkbox() && this.stickyColumnCount() > 0, ...(ngDevMode ? [{ debugName: "checkboxSticky" }] : []));
|
|
772
|
+
/** Index de cellule (case a cocher comprise) des colonnes figees, par cle de colonne. */
|
|
773
|
+
this.stickyCellIndex = computed(() => {
|
|
774
|
+
const offset = this.checkbox() ? 1 : 0;
|
|
775
|
+
const map = new Map();
|
|
776
|
+
this.columns().filter(c => !c.hidden).slice(0, this.stickyColumnCount())
|
|
777
|
+
.forEach((column, i) => map.set(column.key, i + offset));
|
|
778
|
+
return map;
|
|
779
|
+
}, ...(ngDevMode ? [{ debugName: "stickyCellIndex" }] : []));
|
|
780
|
+
/** Nombre de cellules figees par ligne (case a cocher comprise). */
|
|
781
|
+
this.stickyCellCount = computed(() => this.stickyColumnCount() + (this.checkboxSticky() ? 1 : 0), ...(ngDevMode ? [{ debugName: "stickyCellCount" }] : []));
|
|
731
782
|
this.allSelected = computed(() => {
|
|
732
783
|
const rows = this.data();
|
|
733
784
|
const selected = this.selectedRowsMap();
|
|
@@ -760,6 +811,64 @@ class TableComponent {
|
|
|
760
811
|
console.warn('[cw-table] `rowActions` et `#actionsTemplate` sont fournis simultanément. `actionsTemplate` est ignoré.');
|
|
761
812
|
}
|
|
762
813
|
});
|
|
814
|
+
// Barre proxy rendue (debordement apparu) : alignee sur la position courante du conteneur.
|
|
815
|
+
effect(() => {
|
|
816
|
+
const proxy = this.scrollbarProxy()?.nativeElement;
|
|
817
|
+
if (proxy)
|
|
818
|
+
proxy.scrollLeft = this.scroller().nativeElement.scrollLeft;
|
|
819
|
+
});
|
|
820
|
+
// Mesures apres rendu, puis a chaque changement de taille du conteneur ou de la table
|
|
821
|
+
// (largeur de page, colonnes masquees, donnees chargees).
|
|
822
|
+
afterNextRender(() => {
|
|
823
|
+
if (typeof ResizeObserver === 'undefined')
|
|
824
|
+
return;
|
|
825
|
+
const scroller = this.scroller().nativeElement;
|
|
826
|
+
const observer = new ResizeObserver(() => this.measure());
|
|
827
|
+
observer.observe(scroller);
|
|
828
|
+
const table = scroller.querySelector('table');
|
|
829
|
+
if (table)
|
|
830
|
+
observer.observe(table);
|
|
831
|
+
this.destroyRef.onDestroy(() => observer.disconnect());
|
|
832
|
+
});
|
|
833
|
+
}
|
|
834
|
+
/** Debordement, largeur de piste et decalages des colonnes figees. */
|
|
835
|
+
measure() {
|
|
836
|
+
const scroller = this.scroller().nativeElement;
|
|
837
|
+
this.overflowing.set(scroller.scrollWidth > scroller.clientWidth + 1);
|
|
838
|
+
this.scrollWidth.set(scroller.scrollWidth);
|
|
839
|
+
this.updateScrollEdges();
|
|
840
|
+
const headerCells = Array.from(scroller.querySelectorAll('thead th'))
|
|
841
|
+
.slice(0, this.stickyCellCount());
|
|
842
|
+
const offsets = [];
|
|
843
|
+
let left = 0;
|
|
844
|
+
for (const cell of headerCells) {
|
|
845
|
+
offsets.push(left);
|
|
846
|
+
left += cell.offsetWidth;
|
|
847
|
+
}
|
|
848
|
+
this.stickyOffsets.set(offsets);
|
|
849
|
+
this.stickyWidth.set(left);
|
|
850
|
+
}
|
|
851
|
+
/** Ombres de bord : du contenu est masque a gauche / a droite. */
|
|
852
|
+
updateScrollEdges() {
|
|
853
|
+
const scroller = this.scroller().nativeElement;
|
|
854
|
+
const max = scroller.scrollWidth - scroller.clientWidth;
|
|
855
|
+
this.canScrollLeft.set(scroller.scrollLeft > 1);
|
|
856
|
+
this.canScrollRight.set(scroller.scrollLeft < max - 1);
|
|
857
|
+
}
|
|
858
|
+
/** Defilement du conteneur (clavier, trackpad, Maj + molette) : la barre proxy suit. */
|
|
859
|
+
onScroll() {
|
|
860
|
+
this.updateScrollEdges();
|
|
861
|
+
const proxy = this.scrollbarProxy()?.nativeElement;
|
|
862
|
+
const scrollLeft = this.scroller().nativeElement.scrollLeft;
|
|
863
|
+
if (proxy && Math.abs(proxy.scrollLeft - scrollLeft) > 1)
|
|
864
|
+
proxy.scrollLeft = scrollLeft;
|
|
865
|
+
}
|
|
866
|
+
/** Defilement par la barre proxy : le conteneur suit. */
|
|
867
|
+
onProxyScroll() {
|
|
868
|
+
const proxy = this.scrollbarProxy()?.nativeElement;
|
|
869
|
+
const scroller = this.scroller().nativeElement;
|
|
870
|
+
if (proxy && Math.abs(scroller.scrollLeft - proxy.scrollLeft) > 1)
|
|
871
|
+
scroller.scrollLeft = proxy.scrollLeft;
|
|
763
872
|
}
|
|
764
873
|
ngOnInit() {
|
|
765
874
|
const defaultColumn = this.columns().find(c => c.defaultSort);
|
|
@@ -808,7 +917,13 @@ class TableComponent {
|
|
|
808
917
|
this.cellClick.emit({ row, column });
|
|
809
918
|
}
|
|
810
919
|
isClickable(column) {
|
|
811
|
-
return column.type === 'link' || !!column.clickable;
|
|
920
|
+
return column.type === 'link' || !!column.clickable || column.link !== undefined;
|
|
921
|
+
}
|
|
922
|
+
/** Destination de la cellule si la colonne declare `link` (vraie navigation), sinon `undefined`. */
|
|
923
|
+
cellLink(row, column) {
|
|
924
|
+
if (column.link === undefined)
|
|
925
|
+
return undefined;
|
|
926
|
+
return typeof column.link === 'function' ? column.link(row) : column.link;
|
|
812
927
|
}
|
|
813
928
|
isTruthy(value) {
|
|
814
929
|
return value === true || value === 1 || value === '1' || value === 'true';
|
|
@@ -964,11 +1079,12 @@ class TableComponent {
|
|
|
964
1079
|
return typeof descriptor.link === 'function' ? descriptor.link(row) : descriptor.link;
|
|
965
1080
|
}
|
|
966
1081
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.20", ngImport: i0, type: TableComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
967
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.20", type: TableComponent, isStandalone: true, selector: "cw-table", inputs: { checkbox: { classPropertyName: "checkbox", publicName: "checkbox", isSignal: true, isRequired: false, transformFunction: null }, title: { classPropertyName: "title", publicName: "title", isSignal: true, isRequired: false, transformFunction: null }, columns: { classPropertyName: "columns", publicName: "columns", isSignal: true, isRequired: false, transformFunction: null }, data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: false, transformFunction: null }, loading: { classPropertyName: "loading", publicName: "loading", isSignal: true, isRequired: false, transformFunction: null }, rowClassFn: { classPropertyName: "rowClassFn", publicName: "rowClassFn", isSignal: true, isRequired: false, transformFunction: null }, pagination: { classPropertyName: "pagination", publicName: "pagination", isSignal: true, isRequired: false, transformFunction: null }, bulkActions: { classPropertyName: "bulkActions", publicName: "bulkActions", isSignal: true, isRequired: false, transformFunction: null }, rowActions: { classPropertyName: "rowActions", publicName: "rowActions", isSignal: true, isRequired: false, transformFunction: null }, emptyStateNoData: { classPropertyName: "emptyStateNoData", publicName: "emptyStateNoData", isSignal: true, isRequired: false, transformFunction: null }, emptyStateNoResult: { classPropertyName: "emptyStateNoResult", publicName: "emptyStateNoResult", isSignal: true, isRequired: false, transformFunction: null }, isFiltered: { classPropertyName: "isFiltered", publicName: "isFiltered", isSignal: true, isRequired: false, transformFunction: null }, showScope: { classPropertyName: "showScope", publicName: "showScope", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { cellClick: "cellClick", sortChange: "sortChange", selectionChange: "selectionChange", paginationChange: "paginationChange", bulkDelete: "bulkDelete", bulkAction: "bulkAction" }, host: { classAttribute: "cw-table" }, queries: [{ propertyName: "actionsTemplate", first: true, predicate: ["actionsTemplate"], descendants: true, isSignal: true }], ngImport: i0, template: "@if (checkbox() && selectionCount() > 0) {\n <!-- Espacement DS : gap-md = 16px = component/button/set/gap (espacement entre\n boutons d'un set). Utilitaires basic-ui (adosses a l'echelle $sizing des\n tokens) et non ceux de Bootstrap : gap-2 valait 8px. d-flex-h centre deja\n verticalement, align-items-center est donc inutile. -->\n <div class=\"table-selection-info mb-md d-flex-h gap-md flex-wrap\">\n <span class=\"flex-grow-1\">\n {{ selectionCount() }} {{ '_COMMON._TABLE._BULK_ACTION.SELECTED_ITEMS_CURRENT_PAGE' | translate }}\n </span>\n @for (action of bulkActions(); track $index) {\n <cw-button\n [type]=\"resolveVariant(action)\"\n [label]=\"action.label\"\n [withIcon]=\"action.icon\"\n [isDisabled]=\"resolveDisabled(action)\"\n (btnAction)=\"onBulkActionClick(action)\">\n </cw-button>\n }\n </div>\n}\n\n<div class=\"table-responsive\">\n <table class=\"table\">\n <caption class=\"visually-hidden\"\n [innerHTML]=\"'_COMMON._TABLE.CAPTION' | translate: { label: (title() | translate) }\"></caption>\n <thead>\n <tr>\n @if(checkbox()) {\n <th scope=\"col\" width=\"10\">\n <div class=\"field-check\">\n <input class=\"field-check-input\" type=\"checkbox\" [id]=\"uid + '-all'\" [checked]=\"allSelected()\"\n [indeterminate]=\"someSelected()\" (change)=\"toggleAll()\">\n <label class=\"field-check-label\" [for]=\"uid + '-all'\">\n <span class=\"visually-hidden\">{{ '_COMMON._TABLE._THEAD.CHECK_LINE' | translate }}</span>\n </label>\n </div>\n </th>\n }\n\n @for (column of columns(); track column.key) {\n @if (!column.hidden) {\n <th scope=\"col\" [class.p-0]=\"column.sort\" [attr.aria-sort]=\"column.sort ? getAriaSort(column.key) : null\">\n @if (column.sort) {\n <button class=\"d-flex-h gap-2xs\" [class]=\"getSortClass(column.key)\" (click)=\"setSortProperty(column.key)\">\n {{ column.label | translate}}\n <cw-icon\n [icon]=\"getSortIcon(column.key)\"\n [label]=\"'_COMMON._TABLE._SORT.LABEL' | translate\"\n [type]=\"iconType.default\"\n [iconSize]=\"iconSize['xs']\"></cw-icon>\n </button>\n }\n @else {\n {{ column.label | translate }}\n }\n </th>\n }\n }\n </tr>\n </thead>\n <tbody>\n @if (loading()) {\n <tr>\n <td [attr.colspan]=\"visibleColumnCount()\">\n <cw-loader></cw-loader>\n </td>\n </tr>\n }\n @else if (!data() || data().length === 0) {\n <tr>\n <td class=\"table-info no-result\" [attr.colspan]=\"visibleColumnCount()\">\n @if (currentEmptyState(); as empty) {\n <cw-empty-state\n [illustration]=\"empty.illustration ?? (isFiltered() ? illustrationEnum.noResult : illustrationEnum.noData)\"\n [imageSource]=\"empty.imageSource\"\n [title]=\"empty.title\"\n [titleParams]=\"empty.titleParams\"\n [titleSuffix]=\"scopeInstance() ? ('_COMMON._PAGE_SCOPE.EMPTY_FOR_INSTANCE' | translate: { instance: scopeInstance() }) : undefined\"\n [description]=\"empty.description\"\n [descriptionParams]=\"empty.descriptionParams\"\n [primaryButton]=\"empty.primaryButton\"\n [secondaryButton]=\"empty.secondaryButton\"\n (primaryClick)=\"empty.primaryButton?.click?.()\"\n (secondaryClick)=\"empty.secondaryButton?.click?.()\">\n </cw-empty-state>\n } @else {\n <!-- Meme regle que le titre du cw-empty-state : mention accolee au message. -->\n {{ ('_COMMON._TABLE.NO_RESULT' | translate) + (scopeInstance() ? ' ' + ('_COMMON._PAGE_SCOPE.EMPTY_FOR_INSTANCE' | translate: { instance: scopeInstance() }) : '') }}\n }\n </td>\n </tr>\n }\n @else {\n @for (row of data(); track row) {\n <tr [class.tr-selected]=\"isSelected(row)\" [class]=\"getRowClass(row)\">\n @if (checkbox()) {\n <td>\n <input class=\"field-check-input\" type=\"checkbox\" [checked]=\"isSelected(row)\" (change)=\"toggleRow(row)\" [id]=\"uid + '-check-' + row.id\"\n [attr.aria-label]=\"('_COMMON._TABLE._THEAD.CHECK_LINE' | translate) + ' ' + row.id\">\n <label class=\"visually-hidden\" [for]=\"uid + '-check-' + row.id\">{{ '_COMMON._TABLE._THEAD.CHECK_LINE' | translate }} {{ row.id }}</label>\n </td>\n }\n @for (column of columns(); track column.key) {\n @if (!column.hidden) {\n <td [class.text-end]=\"column.align === 'right'\" [class.text-center]=\"column.align === 'center'\"\n [class.td-actions]=\"column.type === 'actions'\">\n @switch (column.type) {\n @case ('link') {\n <button type=\"button\" class=\"btn btn-link-like\" (click)=\"onCellClick(row, column)\">\n {{ column.translate ? (row[column.key] | translate) : row[column.key] }}\n </button>\n }\n @case ('badge') {\n <cw-badge\n [type]=\"getBadge(column, row[column.key]).type\"\n [label]=\"getBadge(column, row[column.key]).label ?? row[column.key]\"\n [withIcon]=\"getBadge(column, row[column.key]).withIcon\"\n [iconPosition]=\"getBadge(column, row[column.key]).iconPosition\"></cw-badge>\n }\n @case ('icon') {\n @if (isClickable(column)) {\n <button type=\"button\" class=\"btn btn-link-like\" (click)=\"onCellClick(row, column)\" [attr.aria-label]=\"row[column.key].label\">\n <cw-icon\n [icon]=\"row[column.key].icon\"\n [label]=\"row[column.key].label\"\n [type]=\"iconType.default\"\n [iconSize]=\"iconSize['md']\"\n [iconCssClass]=\"row[column.key].iconCssClass\"\n ></cw-icon>\n </button>\n } @else {\n <cw-icon\n [icon]=\"row[column.key].icon\"\n [label]=\"row[column.key].label\"\n [type]=\"iconType.default\"\n [iconSize]=\"iconSize['md']\"\n [iconCssClass]=\"row[column.key].iconCssClass\"\n ></cw-icon>\n }\n }\n @case ('image') {\n @if (isClickable(column)) {\n <button type=\"button\" class=\"btn btn-link-like\" (click)=\"onCellClick(row, column)\" [attr.aria-label]=\"row[column.key].label\">\n <cw-image\n [source]=\"row[column.key].source\"\n [alt]=\"row[column.key].label\"\n [isAriaHidden]=\"true\"\n [cssClass]=\"row[column.key].iconCssClass\"\n width=\"32\"\n height=\"32\"\n ></cw-image>\n </button>\n } @else {\n <cw-image\n [source]=\"row[column.key].source\"\n [alt]=\"row[column.key].label\"\n [isAriaHidden]=\"true\"\n [cssClass]=\"row[column.key].iconCssClass\"\n width=\"32\"\n height=\"32\"\n ></cw-image>\n }\n }\n @case ('check') {\n @if (isTruthy(row[column.key])) {\n <cw-icon\n [icon]=\"spriteIcon.checkCircle\"\n [label]=\"'_COMMON._PRO_SENTENCE.YES' | translate\"\n [type]=\"iconType.default\"\n iconCssClass=\"text-success\"\n [iconSize]=\"iconSize['md']\"></cw-icon>\n } @else {\n <cw-icon\n [icon]=\"spriteIcon.closeCircle\"\n [label]=\"'_COMMON._PRO_SENTENCE.NO' | translate\"\n [type]=\"iconType.default\"\n iconCssClass=\"text-danger\"\n [iconSize]=\"iconSize['md']\"></cw-icon>\n }\n }\n @case ('progressbar') {\n <div class=\"td-progressbar\">\n <cw-progress-bar\n [value]=\"row[column.key]\"\n [size]=\"progressBarSize.sm\"\n [type]=\"progressBarType.information\"></cw-progress-bar>\n <span class=\"td-progressbar-value\">{{ row[column.key] }}%</span>\n </div>\n }\n @case ('actions') {\n @if (usingRowActions) {\n @let actions = getResolvedActions(row);\n @if (actions.length > 0) {\n @if (!useDropdownActions()) {\n @for (action of actions; track $index) {\n <cw-button\n [type]=\"buttonType.ghost\"\n [label]=\"action.label\"\n [withIcon]=\"action.icon\"\n [link]=\"action.link\"\n [isDisabled]=\"action.disabled\"\n [cssClass]=\"actionCssClass(action)\"\n (btnAction)=\"onRowActionClick(action, row)\">\n </cw-button>\n }\n } @else {\n <cw-button\n [label]=\"'_COMMON._TABLE.ACTIONS_MENU'\"\n [withIcon]=\"spriteIcon.menuVertical\"\n [withOnlyIcon]=\"true\"\n [type]=\"buttonType.ghost\"\n [isDropdown]=\"true\"\n [hideCaret]=\"true\">\n <ul class=\"p-0 m-0\">\n @for (action of actions; track $index) {\n <li>\n @if (action.link) {\n <cw-button\n [type]=\"buttonType.ghost\"\n [label]=\"action.label\"\n [withIcon]=\"action.icon\"\n [link]=\"action.link\"\n [isDisabled]=\"action.disabled\"\n [cssClass]=\"'dropdown-item ' + actionCssClass(action)\">\n </cw-button>\n } @else {\n <cw-button\n [type]=\"buttonType.ghost\"\n [label]=\"action.label\"\n [withIcon]=\"action.icon\"\n [isDisabled]=\"action.disabled\"\n [cssClass]=\"'dropdown-item ' + actionCssClass(action)\"\n (btnAction)=\"onRowActionClick(action, row)\">\n </cw-button>\n }\n </li>\n }\n </ul>\n </cw-button>\n }\n }\n } @else {\n <ng-container\n *ngTemplateOutlet=\"actionsTemplate(); context: { $implicit: row }\">\n </ng-container>\n }\n }\n @default {\n {{ column.translate ? (row[column.key] | translate) : row[column.key] }}\n }\n }\n </td>\n }\n }\n </tr>\n }\n }\n </tbody>\n </table>\n</div>\n\n@if (pagination()) {\n <cw-pagination\n [pagination]=\"pagination()!\"\n (paginationChange)=\"paginationChange.emit($event)\">\n </cw-pagination>\n}\n", dependencies: [{ kind: "ngmodule", type: TranslateModule }, { kind: "component", type: LoaderComponent, selector: "cw-loader", inputs: ["size", "displayText"] }, { kind: "component", type: BadgeComponent, selector: "cw-badge", inputs: ["type", "label", "withIcon", "iconPosition", "cssClass", "skeletonMode", "dataTest"] }, { kind: "component", type: ButtonComponent, selector: "cw-button", inputs: ["type", "label", "id", "link", "isDropdown", "hideCaret", "withIcon", "withOnlyIcon", "iconSize", "iconPosition", "dropdownPosition", "isMinWidth", "isDisabled", "isLoading", "loadingAnnounce", "cssClass", "dataTest", "skeletonMode", "isPressed", "ariaDescribedBy", "withTooltip", "tooltipText", "tooltipTitle", "tooltipTrigger", "tooltipPosition", "tooltipType"], outputs: ["btnAction", "dropDownClicked"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: PaginationComponent, selector: "cw-pagination", inputs: ["pagination"], outputs: ["paginationChange"] }, { kind: "component", type: IconComponent, selector: "cw-icon", inputs: ["icon", "label", "type", "iconSize", "iconCssClass", "iconUiType", "iconColorCustom", "spritePath"] }, { kind: "component", type: ImageComponent, selector: "cw-image", inputs: ["source", "alt", "isAriaHidden", "cssClass", "width", "height"] }, { kind: "component", type: EmptyStateComponent, selector: "cw-empty-state", inputs: ["illustration", "illustrationBasePath", "imageSource", "imageAlt", "title", "titleParams", "titleSuffix", "description", "descriptionParams", "primaryButton", "secondaryButton", "dataTest"], outputs: ["primaryClick", "secondaryClick"] }, { kind: "component", type: ProgressBarComponent, selector: "cw-progress-bar", inputs: ["value", "max", "size", "type", "showValue", "label", "dataTest"] }, { kind: "pipe", type: i1.TranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
1082
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.20", type: TableComponent, isStandalone: true, selector: "cw-table", inputs: { checkbox: { classPropertyName: "checkbox", publicName: "checkbox", isSignal: true, isRequired: false, transformFunction: null }, title: { classPropertyName: "title", publicName: "title", isSignal: true, isRequired: true, transformFunction: null }, columns: { classPropertyName: "columns", publicName: "columns", isSignal: true, isRequired: false, transformFunction: null }, data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: false, transformFunction: null }, loading: { classPropertyName: "loading", publicName: "loading", isSignal: true, isRequired: false, transformFunction: null }, rowClassFn: { classPropertyName: "rowClassFn", publicName: "rowClassFn", isSignal: true, isRequired: false, transformFunction: null }, pagination: { classPropertyName: "pagination", publicName: "pagination", isSignal: true, isRequired: false, transformFunction: null }, bulkActions: { classPropertyName: "bulkActions", publicName: "bulkActions", isSignal: true, isRequired: false, transformFunction: null }, rowActions: { classPropertyName: "rowActions", publicName: "rowActions", isSignal: true, isRequired: false, transformFunction: null }, emptyStateNoData: { classPropertyName: "emptyStateNoData", publicName: "emptyStateNoData", isSignal: true, isRequired: false, transformFunction: null }, emptyStateNoResult: { classPropertyName: "emptyStateNoResult", publicName: "emptyStateNoResult", isSignal: true, isRequired: false, transformFunction: null }, isFiltered: { classPropertyName: "isFiltered", publicName: "isFiltered", isSignal: true, isRequired: false, transformFunction: null }, showScope: { classPropertyName: "showScope", publicName: "showScope", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { cellClick: "cellClick", sortChange: "sortChange", selectionChange: "selectionChange", paginationChange: "paginationChange", bulkDelete: "bulkDelete", bulkAction: "bulkAction" }, host: { classAttribute: "cw-table" }, queries: [{ propertyName: "actionsTemplate", first: true, predicate: ["actionsTemplate"], descendants: true, isSignal: true }], viewQueries: [{ propertyName: "scroller", first: true, predicate: ["scroller"], descendants: true, isSignal: true }, { propertyName: "scrollbarProxy", first: true, predicate: ["scrollbarProxy"], descendants: true, isSignal: true }], ngImport: i0, template: "@if (checkbox() && selectionCount() > 0) {\r\n <!-- Espacement DS : gap-md = 16px = component/button/set/gap (espacement entre\r\n boutons d'un set). Utilitaires basic-ui (adosses a l'echelle $sizing des\r\n tokens) et non ceux de Bootstrap : gap-2 valait 8px. d-flex-h centre deja\r\n verticalement, align-items-center est donc inutile. -->\r\n <div class=\"table-selection-info mb-md d-flex-h gap-md flex-wrap\">\r\n <span class=\"flex-grow-1\">\r\n {{ selectionCount() }} {{ '_COMMON._TABLE._BULK_ACTION.SELECTED_ITEMS_CURRENT_PAGE' | translate }}\r\n </span>\r\n @for (action of bulkActions(); track $index) {\r\n <cw-button\r\n [type]=\"resolveVariant(action)\"\r\n [label]=\"action.label\"\r\n [withIcon]=\"action.icon\"\r\n [isDisabled]=\"resolveDisabled(action)\"\r\n (btnAction)=\"onBulkActionClick(action)\">\r\n </cw-button>\r\n }\r\n </div>\r\n}\r\n\r\n<!-- Defilement horizontal : ombres de bord sur le wrapper, conteneur focusable (clavier) et nomme\r\n par la legende des qu'il deborde. -->\r\n<div class=\"table-scroll p-relative\" [class.can-scroll-left]=\"canScrollLeft()\" [class.can-scroll-right]=\"canScrollRight()\"\r\n [style.--cw-table-sticky-width]=\"stickyWidth() + 'px'\">\r\n<div #scroller class=\"table-responsive\" [class.is-overflowing]=\"overflowing()\" (scroll)=\"onScroll()\"\r\n [attr.tabindex]=\"overflowing() ? 0 : null\" [attr.role]=\"overflowing() ? 'region' : null\"\r\n [attr.aria-labelledby]=\"overflowing() ? uid + '-caption' : null\">\r\n <table class=\"table\">\r\n <caption class=\"visually-hidden\" [id]=\"uid + '-caption'\">{{ title() | translate }}</caption>\r\n <thead>\r\n <tr>\r\n @if(checkbox()) {\r\n <th scope=\"col\" width=\"10\" class=\"table-check\" [class.is-sticky]=\"checkboxSticky()\"\r\n [style.left.px]=\"checkboxSticky() ? 0 : null\">\r\n <div class=\"field-check\">\r\n <input class=\"field-check-input\" type=\"checkbox\" [id]=\"uid + '-all'\" [checked]=\"allSelected()\"\r\n [indeterminate]=\"someSelected()\" (change)=\"toggleAll()\">\r\n <label class=\"field-check-label\" [for]=\"uid + '-all'\">\r\n <span class=\"visually-hidden\">{{ '_COMMON._TABLE._THEAD.CHECK_LINE' | translate }}</span>\r\n </label>\r\n </div>\r\n </th>\r\n }\r\n\r\n @for (column of columns(); track column.key) {\r\n @if (!column.hidden) {\r\n @let thLeft = stickyLeft(column.key);\r\n <th scope=\"col\" [class.p-0]=\"column.sort\" [attr.aria-sort]=\"column.sort ? getAriaSort(column.key) : null\"\r\n [class.is-sticky]=\"thLeft !== null\" [class.is-sticky-last]=\"isLastSticky(column.key)\" [style.left.px]=\"thLeft\">\r\n @if (column.sort) {\r\n <button class=\"d-flex-h gap-2xs\" [class]=\"getSortClass(column.key)\" (click)=\"setSortProperty(column.key)\">\r\n {{ column.label | translate}}\r\n <cw-icon\r\n [icon]=\"getSortIcon(column.key)\"\r\n [label]=\"'_COMMON._TABLE._SORT.LABEL' | translate\"\r\n [type]=\"iconType.default\"\r\n [iconSize]=\"iconSize['xs']\"></cw-icon>\r\n </button>\r\n }\r\n @else {\r\n {{ column.label | translate }}\r\n }\r\n </th>\r\n }\r\n }\r\n </tr>\r\n </thead>\r\n <tbody>\r\n @if (loading()) {\r\n <tr>\r\n <td [attr.colspan]=\"visibleColumnCount()\">\r\n <cw-loader></cw-loader>\r\n </td>\r\n </tr>\r\n }\r\n @else if (!data() || data().length === 0) {\r\n <tr>\r\n <td class=\"table-info no-result\" [attr.colspan]=\"visibleColumnCount()\">\r\n @if (currentEmptyState(); as empty) {\r\n <cw-empty-state\r\n [illustration]=\"empty.illustration ?? (isFiltered() ? illustrationEnum.noResult : illustrationEnum.noData)\"\r\n [imageSource]=\"empty.imageSource\"\r\n [title]=\"empty.title\"\r\n [titleParams]=\"empty.titleParams\"\r\n [titleSuffix]=\"scopeInstance() ? ('_COMMON._PAGE_SCOPE.EMPTY_FOR_INSTANCE' | translate: { instance: scopeInstance() }) : undefined\"\r\n [description]=\"empty.description\"\r\n [descriptionParams]=\"empty.descriptionParams\"\r\n [primaryButton]=\"empty.primaryButton\"\r\n [secondaryButton]=\"empty.secondaryButton\"\r\n (primaryClick)=\"empty.primaryButton?.click?.()\"\r\n (secondaryClick)=\"empty.secondaryButton?.click?.()\">\r\n </cw-empty-state>\r\n } @else {\r\n <!-- Meme regle que le titre du cw-empty-state : mention accolee au message. -->\r\n {{ ('_COMMON._TABLE.NO_RESULT' | translate) + (scopeInstance() ? ' ' + ('_COMMON._PAGE_SCOPE.EMPTY_FOR_INSTANCE' | translate: { instance: scopeInstance() }) : '') }}\r\n }\r\n </td>\r\n </tr>\r\n }\r\n @else {\r\n @for (row of data(); track row) {\r\n <tr [class.tr-selected]=\"isSelected(row)\" [class]=\"getRowClass(row)\">\r\n @if (checkbox()) {\r\n <td class=\"table-check\" [class.is-sticky]=\"checkboxSticky()\"\r\n [style.left.px]=\"checkboxSticky() ? 0 : null\">\r\n <input class=\"field-check-input\" type=\"checkbox\" [checked]=\"isSelected(row)\" (change)=\"toggleRow(row)\" [id]=\"uid + '-check-' + row.id\"\r\n [attr.aria-label]=\"('_COMMON._TABLE._THEAD.CHECK_LINE' | translate) + ' ' + row.id\">\r\n <label class=\"visually-hidden\" [for]=\"uid + '-check-' + row.id\">{{ '_COMMON._TABLE._THEAD.CHECK_LINE' | translate }} {{ row.id }}</label>\r\n </td>\r\n }\r\n @for (column of columns(); track column.key) {\r\n @if (!column.hidden) {\r\n @let tdLeft = stickyLeft(column.key);\r\n <td [class.text-end]=\"column.align === 'right'\" [class.text-center]=\"column.align === 'center'\"\r\n [class.td-actions]=\"column.type === 'actions'\"\r\n [class.is-sticky]=\"tdLeft !== null\" [class.is-sticky-last]=\"isLastSticky(column.key)\" [style.left.px]=\"tdLeft\">\r\n @switch (column.type) {\r\n @case ('link') {\r\n @let link = cellLink(row, column);\r\n <!-- `link` declare : vraie navigation (<a>). Sinon action (<button> + cellClick). -->\r\n @if (link !== undefined) {\r\n <a class=\"btn btn-link-like\" [routerLink]=\"link\">\r\n {{ column.translate ? (row[column.key] | translate) : row[column.key] }}\r\n </a>\r\n } @else {\r\n <button type=\"button\" class=\"btn btn-link-like\" (click)=\"onCellClick(row, column)\">\r\n {{ column.translate ? (row[column.key] | translate) : row[column.key] }}\r\n </button>\r\n }\r\n }\r\n @case ('badge') {\r\n <cw-badge\r\n [type]=\"getBadge(column, row[column.key]).type\"\r\n [label]=\"getBadge(column, row[column.key]).label ?? row[column.key]\"\r\n [withIcon]=\"getBadge(column, row[column.key]).withIcon\"\r\n [iconPosition]=\"getBadge(column, row[column.key]).iconPosition\"></cw-badge>\r\n }\r\n @case ('icon') {\r\n @let link = cellLink(row, column);\r\n @if (link !== undefined) {\r\n <a class=\"btn btn-link-like\" [routerLink]=\"link\" [attr.aria-label]=\"row[column.key].label\">\r\n <cw-icon\r\n [icon]=\"row[column.key].icon\"\r\n [label]=\"row[column.key].label\"\r\n [type]=\"iconType.default\"\r\n [iconSize]=\"iconSize['md']\"\r\n [iconCssClass]=\"row[column.key].iconCssClass\"\r\n ></cw-icon>\r\n </a>\r\n } @else if (isClickable(column)) {\r\n <button type=\"button\" class=\"btn btn-link-like\" (click)=\"onCellClick(row, column)\" [attr.aria-label]=\"row[column.key].label\">\r\n <cw-icon\r\n [icon]=\"row[column.key].icon\"\r\n [label]=\"row[column.key].label\"\r\n [type]=\"iconType.default\"\r\n [iconSize]=\"iconSize['md']\"\r\n [iconCssClass]=\"row[column.key].iconCssClass\"\r\n ></cw-icon>\r\n </button>\r\n } @else {\r\n <cw-icon\r\n [icon]=\"row[column.key].icon\"\r\n [label]=\"row[column.key].label\"\r\n [type]=\"iconType.default\"\r\n [iconSize]=\"iconSize['md']\"\r\n [iconCssClass]=\"row[column.key].iconCssClass\"\r\n ></cw-icon>\r\n }\r\n }\r\n @case ('image') {\r\n @let link = cellLink(row, column);\r\n @if (link !== undefined) {\r\n <a class=\"btn btn-link-like\" [routerLink]=\"link\" [attr.aria-label]=\"row[column.key].label\">\r\n <cw-image\r\n [source]=\"row[column.key].source\"\r\n [alt]=\"row[column.key].label\"\r\n [isAriaHidden]=\"true\"\r\n [cssClass]=\"row[column.key].iconCssClass\"\r\n width=\"32\"\r\n height=\"32\"\r\n ></cw-image>\r\n </a>\r\n } @else if (isClickable(column)) {\r\n <button type=\"button\" class=\"btn btn-link-like\" (click)=\"onCellClick(row, column)\" [attr.aria-label]=\"row[column.key].label\">\r\n <cw-image\r\n [source]=\"row[column.key].source\"\r\n [alt]=\"row[column.key].label\"\r\n [isAriaHidden]=\"true\"\r\n [cssClass]=\"row[column.key].iconCssClass\"\r\n width=\"32\"\r\n height=\"32\"\r\n ></cw-image>\r\n </button>\r\n } @else {\r\n <cw-image\r\n [source]=\"row[column.key].source\"\r\n [alt]=\"row[column.key].label\"\r\n [isAriaHidden]=\"true\"\r\n [cssClass]=\"row[column.key].iconCssClass\"\r\n width=\"32\"\r\n height=\"32\"\r\n ></cw-image>\r\n }\r\n }\r\n @case ('check') {\r\n @if (isTruthy(row[column.key])) {\r\n <cw-icon\r\n [icon]=\"spriteIcon.checkCircle\"\r\n [label]=\"'_COMMON._PRO_SENTENCE.YES' | translate\"\r\n [type]=\"iconType.default\"\r\n iconCssClass=\"text-success\"\r\n [iconSize]=\"iconSize['md']\"></cw-icon>\r\n } @else {\r\n <cw-icon\r\n [icon]=\"spriteIcon.closeCircle\"\r\n [label]=\"'_COMMON._PRO_SENTENCE.NO' | translate\"\r\n [type]=\"iconType.default\"\r\n iconCssClass=\"text-danger\"\r\n [iconSize]=\"iconSize['md']\"></cw-icon>\r\n }\r\n }\r\n @case ('progressbar') {\r\n <div class=\"td-progressbar\">\r\n <cw-progress-bar\r\n [value]=\"row[column.key]\"\r\n [size]=\"progressBarSize.sm\"\r\n [type]=\"progressBarType.information\"></cw-progress-bar>\r\n <span class=\"td-progressbar-value\">{{ row[column.key] }}%</span>\r\n </div>\r\n }\r\n @case ('actions') {\r\n @if (usingRowActions) {\r\n @let actions = getResolvedActions(row);\r\n @if (actions.length > 0) {\r\n @if (!useDropdownActions()) {\r\n @for (action of actions; track $index) {\r\n <cw-button\r\n [type]=\"buttonType.ghost\"\r\n [label]=\"action.label\"\r\n [withIcon]=\"action.icon\"\r\n [link]=\"action.link\"\r\n [isDisabled]=\"action.disabled\"\r\n [cssClass]=\"actionCssClass(action)\"\r\n (btnAction)=\"onRowActionClick(action, row)\">\r\n </cw-button>\r\n }\r\n } @else {\r\n <cw-button\r\n [label]=\"'_COMMON._TABLE.ACTIONS_MENU'\"\r\n [withIcon]=\"spriteIcon.menuVertical\"\r\n [withOnlyIcon]=\"true\"\r\n [type]=\"buttonType.ghost\"\r\n [isDropdown]=\"true\"\r\n [hideCaret]=\"true\">\r\n <ul class=\"p-0 m-0\">\r\n @for (action of actions; track $index) {\r\n <li>\r\n @if (action.link) {\r\n <cw-button\r\n [type]=\"buttonType.ghost\"\r\n [label]=\"action.label\"\r\n [withIcon]=\"action.icon\"\r\n [link]=\"action.link\"\r\n [isDisabled]=\"action.disabled\"\r\n [cssClass]=\"'dropdown-item ' + actionCssClass(action)\">\r\n </cw-button>\r\n } @else {\r\n <cw-button\r\n [type]=\"buttonType.ghost\"\r\n [label]=\"action.label\"\r\n [withIcon]=\"action.icon\"\r\n [isDisabled]=\"action.disabled\"\r\n [cssClass]=\"'dropdown-item ' + actionCssClass(action)\"\r\n (btnAction)=\"onRowActionClick(action, row)\">\r\n </cw-button>\r\n }\r\n </li>\r\n }\r\n </ul>\r\n </cw-button>\r\n }\r\n }\r\n } @else {\r\n <ng-container\r\n *ngTemplateOutlet=\"actionsTemplate(); context: { $implicit: row }\">\r\n </ng-container>\r\n }\r\n }\r\n @default {\r\n {{ column.translate ? (row[column.key] | translate) : row[column.key] }}\r\n }\r\n }\r\n </td>\r\n }\r\n }\r\n </tr>\r\n }\r\n }\r\n </tbody>\r\n </table>\r\n</div>\r\n</div>\r\n\r\n<!-- Barre de defilement collee en bas de la fenetre tant que la table est a l'ecran, puis posee sous\r\n la table : remplace la barre native (masquee), qui n'est visible qu'au bas de la table. Doublon\r\n du defilement du conteneur (deja accessible au clavier) : masquee aux technologies d'assistance. -->\r\n@if (overflowing()) {\r\n <div #scrollbarProxy class=\"table-scrollbar\" aria-hidden=\"true\" tabindex=\"-1\" (scroll)=\"onProxyScroll()\">\r\n <div class=\"table-scrollbar-track\" [style.width.px]=\"scrollWidth()\"></div>\r\n </div>\r\n}\r\n\r\n@if (pagination()) {\r\n <cw-pagination\r\n [pagination]=\"pagination()!\"\r\n (paginationChange)=\"paginationChange.emit($event)\">\r\n </cw-pagination>\r\n}\r\n", dependencies: [{ kind: "directive", type: RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "info", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "routerLink"] }, { kind: "ngmodule", type: TranslateModule }, { kind: "component", type: LoaderComponent, selector: "cw-loader", inputs: ["size", "displayText"] }, { kind: "component", type: BadgeComponent, selector: "cw-badge", inputs: ["type", "label", "labelParams", "withIcon", "iconPosition", "cssClass", "skeletonMode", "dataTest"] }, { kind: "component", type: ButtonComponent, selector: "cw-button", inputs: ["type", "label", "labelParams", "id", "link", "isDropdown", "hideCaret", "withIcon", "withOnlyIcon", "iconSize", "iconPosition", "dropdownPosition", "isMinWidth", "isDisabled", "isLoading", "loadingAnnounce", "cssClass", "dataTest", "skeletonMode", "isPressed", "ariaDescribedBy", "ariaLabel", "ariaExpanded", "ariaControls", "withTooltip", "tooltipText", "tooltipTitle", "tooltipTrigger", "tooltipPosition", "tooltipType"], outputs: ["btnAction", "dropDownClicked"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: PaginationComponent, selector: "cw-pagination", inputs: ["pagination"], outputs: ["paginationChange"] }, { kind: "component", type: IconComponent, selector: "cw-icon", inputs: ["icon", "label", "type", "iconSize", "iconCssClass", "iconUiType", "iconColorCustom", "spritePath"] }, { kind: "component", type: ImageComponent, selector: "cw-image", inputs: ["source", "alt", "isAriaHidden", "cssClass", "width", "height"] }, { kind: "component", type: EmptyStateComponent, selector: "cw-empty-state", inputs: ["illustration", "illustrationBasePath", "imageSource", "imageAlt", "title", "titleParams", "titleSuffix", "description", "descriptionParams", "primaryButton", "secondaryButton", "dataTest"], outputs: ["primaryClick", "secondaryClick"] }, { kind: "component", type: ProgressBarComponent, selector: "cw-progress-bar", inputs: ["value", "max", "size", "type", "showValue", "label", "dataTest"] }, { kind: "pipe", type: i1.TranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
968
1083
|
}
|
|
969
1084
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.20", ngImport: i0, type: TableComponent, decorators: [{
|
|
970
1085
|
type: Component,
|
|
971
1086
|
args: [{ selector: 'cw-table', standalone: true, host: { class: 'cw-table' }, changeDetection: ChangeDetectionStrategy.OnPush, imports: [
|
|
1087
|
+
RouterLink,
|
|
972
1088
|
TranslateModule,
|
|
973
1089
|
LoaderComponent,
|
|
974
1090
|
BadgeComponent,
|
|
@@ -979,8 +1095,194 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.20", ngImpo
|
|
|
979
1095
|
ImageComponent,
|
|
980
1096
|
EmptyStateComponent,
|
|
981
1097
|
ProgressBarComponent
|
|
982
|
-
], template: "@if (checkbox() && selectionCount() > 0) {\n <!-- Espacement DS : gap-md = 16px = component/button/set/gap (espacement entre\n boutons d'un set). Utilitaires basic-ui (adosses a l'echelle $sizing des\n tokens) et non ceux de Bootstrap : gap-2 valait 8px. d-flex-h centre deja\n verticalement, align-items-center est donc inutile. -->\n <div class=\"table-selection-info mb-md d-flex-h gap-md flex-wrap\">\n <span class=\"flex-grow-1\">\n {{ selectionCount() }} {{ '_COMMON._TABLE._BULK_ACTION.SELECTED_ITEMS_CURRENT_PAGE' | translate }}\n </span>\n @for (action of bulkActions(); track $index) {\n <cw-button\n [type]=\"resolveVariant(action)\"\n [label]=\"action.label\"\n [withIcon]=\"action.icon\"\n [isDisabled]=\"resolveDisabled(action)\"\n (btnAction)=\"onBulkActionClick(action)\">\n </cw-button>\n }\n </div>\n}\n\n<div class=\"table-responsive\">\n <table class=\"table\">\n <caption class=\"visually-hidden\"\n [innerHTML]=\"'_COMMON._TABLE.CAPTION' | translate: { label: (title() | translate) }\"></caption>\n <thead>\n <tr>\n @if(checkbox()) {\n <th scope=\"col\" width=\"10\">\n <div class=\"field-check\">\n <input class=\"field-check-input\" type=\"checkbox\" [id]=\"uid + '-all'\" [checked]=\"allSelected()\"\n [indeterminate]=\"someSelected()\" (change)=\"toggleAll()\">\n <label class=\"field-check-label\" [for]=\"uid + '-all'\">\n <span class=\"visually-hidden\">{{ '_COMMON._TABLE._THEAD.CHECK_LINE' | translate }}</span>\n </label>\n </div>\n </th>\n }\n\n @for (column of columns(); track column.key) {\n @if (!column.hidden) {\n <th scope=\"col\" [class.p-0]=\"column.sort\" [attr.aria-sort]=\"column.sort ? getAriaSort(column.key) : null\">\n @if (column.sort) {\n <button class=\"d-flex-h gap-2xs\" [class]=\"getSortClass(column.key)\" (click)=\"setSortProperty(column.key)\">\n {{ column.label | translate}}\n <cw-icon\n [icon]=\"getSortIcon(column.key)\"\n [label]=\"'_COMMON._TABLE._SORT.LABEL' | translate\"\n [type]=\"iconType.default\"\n [iconSize]=\"iconSize['xs']\"></cw-icon>\n </button>\n }\n @else {\n {{ column.label | translate }}\n }\n </th>\n }\n }\n </tr>\n </thead>\n <tbody>\n @if (loading()) {\n <tr>\n <td [attr.colspan]=\"visibleColumnCount()\">\n <cw-loader></cw-loader>\n </td>\n </tr>\n }\n @else if (!data() || data().length === 0) {\n <tr>\n <td class=\"table-info no-result\" [attr.colspan]=\"visibleColumnCount()\">\n @if (currentEmptyState(); as empty) {\n <cw-empty-state\n [illustration]=\"empty.illustration ?? (isFiltered() ? illustrationEnum.noResult : illustrationEnum.noData)\"\n [imageSource]=\"empty.imageSource\"\n [title]=\"empty.title\"\n [titleParams]=\"empty.titleParams\"\n [titleSuffix]=\"scopeInstance() ? ('_COMMON._PAGE_SCOPE.EMPTY_FOR_INSTANCE' | translate: { instance: scopeInstance() }) : undefined\"\n [description]=\"empty.description\"\n [descriptionParams]=\"empty.descriptionParams\"\n [primaryButton]=\"empty.primaryButton\"\n [secondaryButton]=\"empty.secondaryButton\"\n (primaryClick)=\"empty.primaryButton?.click?.()\"\n (secondaryClick)=\"empty.secondaryButton?.click?.()\">\n </cw-empty-state>\n } @else {\n <!-- Meme regle que le titre du cw-empty-state : mention accolee au message. -->\n {{ ('_COMMON._TABLE.NO_RESULT' | translate) + (scopeInstance() ? ' ' + ('_COMMON._PAGE_SCOPE.EMPTY_FOR_INSTANCE' | translate: { instance: scopeInstance() }) : '') }}\n }\n </td>\n </tr>\n }\n @else {\n @for (row of data(); track row) {\n <tr [class.tr-selected]=\"isSelected(row)\" [class]=\"getRowClass(row)\">\n @if (checkbox()) {\n <td>\n <input class=\"field-check-input\" type=\"checkbox\" [checked]=\"isSelected(row)\" (change)=\"toggleRow(row)\" [id]=\"uid + '-check-' + row.id\"\n [attr.aria-label]=\"('_COMMON._TABLE._THEAD.CHECK_LINE' | translate) + ' ' + row.id\">\n <label class=\"visually-hidden\" [for]=\"uid + '-check-' + row.id\">{{ '_COMMON._TABLE._THEAD.CHECK_LINE' | translate }} {{ row.id }}</label>\n </td>\n }\n @for (column of columns(); track column.key) {\n @if (!column.hidden) {\n <td [class.text-end]=\"column.align === 'right'\" [class.text-center]=\"column.align === 'center'\"\n [class.td-actions]=\"column.type === 'actions'\">\n @switch (column.type) {\n @case ('link') {\n <button type=\"button\" class=\"btn btn-link-like\" (click)=\"onCellClick(row, column)\">\n {{ column.translate ? (row[column.key] | translate) : row[column.key] }}\n </button>\n }\n @case ('badge') {\n <cw-badge\n [type]=\"getBadge(column, row[column.key]).type\"\n [label]=\"getBadge(column, row[column.key]).label ?? row[column.key]\"\n [withIcon]=\"getBadge(column, row[column.key]).withIcon\"\n [iconPosition]=\"getBadge(column, row[column.key]).iconPosition\"></cw-badge>\n }\n @case ('icon') {\n @if (isClickable(column)) {\n <button type=\"button\" class=\"btn btn-link-like\" (click)=\"onCellClick(row, column)\" [attr.aria-label]=\"row[column.key].label\">\n <cw-icon\n [icon]=\"row[column.key].icon\"\n [label]=\"row[column.key].label\"\n [type]=\"iconType.default\"\n [iconSize]=\"iconSize['md']\"\n [iconCssClass]=\"row[column.key].iconCssClass\"\n ></cw-icon>\n </button>\n } @else {\n <cw-icon\n [icon]=\"row[column.key].icon\"\n [label]=\"row[column.key].label\"\n [type]=\"iconType.default\"\n [iconSize]=\"iconSize['md']\"\n [iconCssClass]=\"row[column.key].iconCssClass\"\n ></cw-icon>\n }\n }\n @case ('image') {\n @if (isClickable(column)) {\n <button type=\"button\" class=\"btn btn-link-like\" (click)=\"onCellClick(row, column)\" [attr.aria-label]=\"row[column.key].label\">\n <cw-image\n [source]=\"row[column.key].source\"\n [alt]=\"row[column.key].label\"\n [isAriaHidden]=\"true\"\n [cssClass]=\"row[column.key].iconCssClass\"\n width=\"32\"\n height=\"32\"\n ></cw-image>\n </button>\n } @else {\n <cw-image\n [source]=\"row[column.key].source\"\n [alt]=\"row[column.key].label\"\n [isAriaHidden]=\"true\"\n [cssClass]=\"row[column.key].iconCssClass\"\n width=\"32\"\n height=\"32\"\n ></cw-image>\n }\n }\n @case ('check') {\n @if (isTruthy(row[column.key])) {\n <cw-icon\n [icon]=\"spriteIcon.checkCircle\"\n [label]=\"'_COMMON._PRO_SENTENCE.YES' | translate\"\n [type]=\"iconType.default\"\n iconCssClass=\"text-success\"\n [iconSize]=\"iconSize['md']\"></cw-icon>\n } @else {\n <cw-icon\n [icon]=\"spriteIcon.closeCircle\"\n [label]=\"'_COMMON._PRO_SENTENCE.NO' | translate\"\n [type]=\"iconType.default\"\n iconCssClass=\"text-danger\"\n [iconSize]=\"iconSize['md']\"></cw-icon>\n }\n }\n @case ('progressbar') {\n <div class=\"td-progressbar\">\n <cw-progress-bar\n [value]=\"row[column.key]\"\n [size]=\"progressBarSize.sm\"\n [type]=\"progressBarType.information\"></cw-progress-bar>\n <span class=\"td-progressbar-value\">{{ row[column.key] }}%</span>\n </div>\n }\n @case ('actions') {\n @if (usingRowActions) {\n @let actions = getResolvedActions(row);\n @if (actions.length > 0) {\n @if (!useDropdownActions()) {\n @for (action of actions; track $index) {\n <cw-button\n [type]=\"buttonType.ghost\"\n [label]=\"action.label\"\n [withIcon]=\"action.icon\"\n [link]=\"action.link\"\n [isDisabled]=\"action.disabled\"\n [cssClass]=\"actionCssClass(action)\"\n (btnAction)=\"onRowActionClick(action, row)\">\n </cw-button>\n }\n } @else {\n <cw-button\n [label]=\"'_COMMON._TABLE.ACTIONS_MENU'\"\n [withIcon]=\"spriteIcon.menuVertical\"\n [withOnlyIcon]=\"true\"\n [type]=\"buttonType.ghost\"\n [isDropdown]=\"true\"\n [hideCaret]=\"true\">\n <ul class=\"p-0 m-0\">\n @for (action of actions; track $index) {\n <li>\n @if (action.link) {\n <cw-button\n [type]=\"buttonType.ghost\"\n [label]=\"action.label\"\n [withIcon]=\"action.icon\"\n [link]=\"action.link\"\n [isDisabled]=\"action.disabled\"\n [cssClass]=\"'dropdown-item ' + actionCssClass(action)\">\n </cw-button>\n } @else {\n <cw-button\n [type]=\"buttonType.ghost\"\n [label]=\"action.label\"\n [withIcon]=\"action.icon\"\n [isDisabled]=\"action.disabled\"\n [cssClass]=\"'dropdown-item ' + actionCssClass(action)\"\n (btnAction)=\"onRowActionClick(action, row)\">\n </cw-button>\n }\n </li>\n }\n </ul>\n </cw-button>\n }\n }\n } @else {\n <ng-container\n *ngTemplateOutlet=\"actionsTemplate(); context: { $implicit: row }\">\n </ng-container>\n }\n }\n @default {\n {{ column.translate ? (row[column.key] | translate) : row[column.key] }}\n }\n }\n </td>\n }\n }\n </tr>\n }\n }\n </tbody>\n </table>\n</div>\n\n@if (pagination()) {\n <cw-pagination\n [pagination]=\"pagination()!\"\n (paginationChange)=\"paginationChange.emit($event)\">\n </cw-pagination>\n}\n" }]
|
|
983
|
-
}], ctorParameters: () => [], propDecorators: { checkbox: [{ type: i0.Input, args: [{ isSignal: true, alias: "checkbox", required: false }] }], title: [{ type: i0.Input, args: [{ isSignal: true, alias: "title", required:
|
|
1098
|
+
], template: "@if (checkbox() && selectionCount() > 0) {\r\n <!-- Espacement DS : gap-md = 16px = component/button/set/gap (espacement entre\r\n boutons d'un set). Utilitaires basic-ui (adosses a l'echelle $sizing des\r\n tokens) et non ceux de Bootstrap : gap-2 valait 8px. d-flex-h centre deja\r\n verticalement, align-items-center est donc inutile. -->\r\n <div class=\"table-selection-info mb-md d-flex-h gap-md flex-wrap\">\r\n <span class=\"flex-grow-1\">\r\n {{ selectionCount() }} {{ '_COMMON._TABLE._BULK_ACTION.SELECTED_ITEMS_CURRENT_PAGE' | translate }}\r\n </span>\r\n @for (action of bulkActions(); track $index) {\r\n <cw-button\r\n [type]=\"resolveVariant(action)\"\r\n [label]=\"action.label\"\r\n [withIcon]=\"action.icon\"\r\n [isDisabled]=\"resolveDisabled(action)\"\r\n (btnAction)=\"onBulkActionClick(action)\">\r\n </cw-button>\r\n }\r\n </div>\r\n}\r\n\r\n<!-- Defilement horizontal : ombres de bord sur le wrapper, conteneur focusable (clavier) et nomme\r\n par la legende des qu'il deborde. -->\r\n<div class=\"table-scroll p-relative\" [class.can-scroll-left]=\"canScrollLeft()\" [class.can-scroll-right]=\"canScrollRight()\"\r\n [style.--cw-table-sticky-width]=\"stickyWidth() + 'px'\">\r\n<div #scroller class=\"table-responsive\" [class.is-overflowing]=\"overflowing()\" (scroll)=\"onScroll()\"\r\n [attr.tabindex]=\"overflowing() ? 0 : null\" [attr.role]=\"overflowing() ? 'region' : null\"\r\n [attr.aria-labelledby]=\"overflowing() ? uid + '-caption' : null\">\r\n <table class=\"table\">\r\n <caption class=\"visually-hidden\" [id]=\"uid + '-caption'\">{{ title() | translate }}</caption>\r\n <thead>\r\n <tr>\r\n @if(checkbox()) {\r\n <th scope=\"col\" width=\"10\" class=\"table-check\" [class.is-sticky]=\"checkboxSticky()\"\r\n [style.left.px]=\"checkboxSticky() ? 0 : null\">\r\n <div class=\"field-check\">\r\n <input class=\"field-check-input\" type=\"checkbox\" [id]=\"uid + '-all'\" [checked]=\"allSelected()\"\r\n [indeterminate]=\"someSelected()\" (change)=\"toggleAll()\">\r\n <label class=\"field-check-label\" [for]=\"uid + '-all'\">\r\n <span class=\"visually-hidden\">{{ '_COMMON._TABLE._THEAD.CHECK_LINE' | translate }}</span>\r\n </label>\r\n </div>\r\n </th>\r\n }\r\n\r\n @for (column of columns(); track column.key) {\r\n @if (!column.hidden) {\r\n @let thLeft = stickyLeft(column.key);\r\n <th scope=\"col\" [class.p-0]=\"column.sort\" [attr.aria-sort]=\"column.sort ? getAriaSort(column.key) : null\"\r\n [class.is-sticky]=\"thLeft !== null\" [class.is-sticky-last]=\"isLastSticky(column.key)\" [style.left.px]=\"thLeft\">\r\n @if (column.sort) {\r\n <button class=\"d-flex-h gap-2xs\" [class]=\"getSortClass(column.key)\" (click)=\"setSortProperty(column.key)\">\r\n {{ column.label | translate}}\r\n <cw-icon\r\n [icon]=\"getSortIcon(column.key)\"\r\n [label]=\"'_COMMON._TABLE._SORT.LABEL' | translate\"\r\n [type]=\"iconType.default\"\r\n [iconSize]=\"iconSize['xs']\"></cw-icon>\r\n </button>\r\n }\r\n @else {\r\n {{ column.label | translate }}\r\n }\r\n </th>\r\n }\r\n }\r\n </tr>\r\n </thead>\r\n <tbody>\r\n @if (loading()) {\r\n <tr>\r\n <td [attr.colspan]=\"visibleColumnCount()\">\r\n <cw-loader></cw-loader>\r\n </td>\r\n </tr>\r\n }\r\n @else if (!data() || data().length === 0) {\r\n <tr>\r\n <td class=\"table-info no-result\" [attr.colspan]=\"visibleColumnCount()\">\r\n @if (currentEmptyState(); as empty) {\r\n <cw-empty-state\r\n [illustration]=\"empty.illustration ?? (isFiltered() ? illustrationEnum.noResult : illustrationEnum.noData)\"\r\n [imageSource]=\"empty.imageSource\"\r\n [title]=\"empty.title\"\r\n [titleParams]=\"empty.titleParams\"\r\n [titleSuffix]=\"scopeInstance() ? ('_COMMON._PAGE_SCOPE.EMPTY_FOR_INSTANCE' | translate: { instance: scopeInstance() }) : undefined\"\r\n [description]=\"empty.description\"\r\n [descriptionParams]=\"empty.descriptionParams\"\r\n [primaryButton]=\"empty.primaryButton\"\r\n [secondaryButton]=\"empty.secondaryButton\"\r\n (primaryClick)=\"empty.primaryButton?.click?.()\"\r\n (secondaryClick)=\"empty.secondaryButton?.click?.()\">\r\n </cw-empty-state>\r\n } @else {\r\n <!-- Meme regle que le titre du cw-empty-state : mention accolee au message. -->\r\n {{ ('_COMMON._TABLE.NO_RESULT' | translate) + (scopeInstance() ? ' ' + ('_COMMON._PAGE_SCOPE.EMPTY_FOR_INSTANCE' | translate: { instance: scopeInstance() }) : '') }}\r\n }\r\n </td>\r\n </tr>\r\n }\r\n @else {\r\n @for (row of data(); track row) {\r\n <tr [class.tr-selected]=\"isSelected(row)\" [class]=\"getRowClass(row)\">\r\n @if (checkbox()) {\r\n <td class=\"table-check\" [class.is-sticky]=\"checkboxSticky()\"\r\n [style.left.px]=\"checkboxSticky() ? 0 : null\">\r\n <input class=\"field-check-input\" type=\"checkbox\" [checked]=\"isSelected(row)\" (change)=\"toggleRow(row)\" [id]=\"uid + '-check-' + row.id\"\r\n [attr.aria-label]=\"('_COMMON._TABLE._THEAD.CHECK_LINE' | translate) + ' ' + row.id\">\r\n <label class=\"visually-hidden\" [for]=\"uid + '-check-' + row.id\">{{ '_COMMON._TABLE._THEAD.CHECK_LINE' | translate }} {{ row.id }}</label>\r\n </td>\r\n }\r\n @for (column of columns(); track column.key) {\r\n @if (!column.hidden) {\r\n @let tdLeft = stickyLeft(column.key);\r\n <td [class.text-end]=\"column.align === 'right'\" [class.text-center]=\"column.align === 'center'\"\r\n [class.td-actions]=\"column.type === 'actions'\"\r\n [class.is-sticky]=\"tdLeft !== null\" [class.is-sticky-last]=\"isLastSticky(column.key)\" [style.left.px]=\"tdLeft\">\r\n @switch (column.type) {\r\n @case ('link') {\r\n @let link = cellLink(row, column);\r\n <!-- `link` declare : vraie navigation (<a>). Sinon action (<button> + cellClick). -->\r\n @if (link !== undefined) {\r\n <a class=\"btn btn-link-like\" [routerLink]=\"link\">\r\n {{ column.translate ? (row[column.key] | translate) : row[column.key] }}\r\n </a>\r\n } @else {\r\n <button type=\"button\" class=\"btn btn-link-like\" (click)=\"onCellClick(row, column)\">\r\n {{ column.translate ? (row[column.key] | translate) : row[column.key] }}\r\n </button>\r\n }\r\n }\r\n @case ('badge') {\r\n <cw-badge\r\n [type]=\"getBadge(column, row[column.key]).type\"\r\n [label]=\"getBadge(column, row[column.key]).label ?? row[column.key]\"\r\n [withIcon]=\"getBadge(column, row[column.key]).withIcon\"\r\n [iconPosition]=\"getBadge(column, row[column.key]).iconPosition\"></cw-badge>\r\n }\r\n @case ('icon') {\r\n @let link = cellLink(row, column);\r\n @if (link !== undefined) {\r\n <a class=\"btn btn-link-like\" [routerLink]=\"link\" [attr.aria-label]=\"row[column.key].label\">\r\n <cw-icon\r\n [icon]=\"row[column.key].icon\"\r\n [label]=\"row[column.key].label\"\r\n [type]=\"iconType.default\"\r\n [iconSize]=\"iconSize['md']\"\r\n [iconCssClass]=\"row[column.key].iconCssClass\"\r\n ></cw-icon>\r\n </a>\r\n } @else if (isClickable(column)) {\r\n <button type=\"button\" class=\"btn btn-link-like\" (click)=\"onCellClick(row, column)\" [attr.aria-label]=\"row[column.key].label\">\r\n <cw-icon\r\n [icon]=\"row[column.key].icon\"\r\n [label]=\"row[column.key].label\"\r\n [type]=\"iconType.default\"\r\n [iconSize]=\"iconSize['md']\"\r\n [iconCssClass]=\"row[column.key].iconCssClass\"\r\n ></cw-icon>\r\n </button>\r\n } @else {\r\n <cw-icon\r\n [icon]=\"row[column.key].icon\"\r\n [label]=\"row[column.key].label\"\r\n [type]=\"iconType.default\"\r\n [iconSize]=\"iconSize['md']\"\r\n [iconCssClass]=\"row[column.key].iconCssClass\"\r\n ></cw-icon>\r\n }\r\n }\r\n @case ('image') {\r\n @let link = cellLink(row, column);\r\n @if (link !== undefined) {\r\n <a class=\"btn btn-link-like\" [routerLink]=\"link\" [attr.aria-label]=\"row[column.key].label\">\r\n <cw-image\r\n [source]=\"row[column.key].source\"\r\n [alt]=\"row[column.key].label\"\r\n [isAriaHidden]=\"true\"\r\n [cssClass]=\"row[column.key].iconCssClass\"\r\n width=\"32\"\r\n height=\"32\"\r\n ></cw-image>\r\n </a>\r\n } @else if (isClickable(column)) {\r\n <button type=\"button\" class=\"btn btn-link-like\" (click)=\"onCellClick(row, column)\" [attr.aria-label]=\"row[column.key].label\">\r\n <cw-image\r\n [source]=\"row[column.key].source\"\r\n [alt]=\"row[column.key].label\"\r\n [isAriaHidden]=\"true\"\r\n [cssClass]=\"row[column.key].iconCssClass\"\r\n width=\"32\"\r\n height=\"32\"\r\n ></cw-image>\r\n </button>\r\n } @else {\r\n <cw-image\r\n [source]=\"row[column.key].source\"\r\n [alt]=\"row[column.key].label\"\r\n [isAriaHidden]=\"true\"\r\n [cssClass]=\"row[column.key].iconCssClass\"\r\n width=\"32\"\r\n height=\"32\"\r\n ></cw-image>\r\n }\r\n }\r\n @case ('check') {\r\n @if (isTruthy(row[column.key])) {\r\n <cw-icon\r\n [icon]=\"spriteIcon.checkCircle\"\r\n [label]=\"'_COMMON._PRO_SENTENCE.YES' | translate\"\r\n [type]=\"iconType.default\"\r\n iconCssClass=\"text-success\"\r\n [iconSize]=\"iconSize['md']\"></cw-icon>\r\n } @else {\r\n <cw-icon\r\n [icon]=\"spriteIcon.closeCircle\"\r\n [label]=\"'_COMMON._PRO_SENTENCE.NO' | translate\"\r\n [type]=\"iconType.default\"\r\n iconCssClass=\"text-danger\"\r\n [iconSize]=\"iconSize['md']\"></cw-icon>\r\n }\r\n }\r\n @case ('progressbar') {\r\n <div class=\"td-progressbar\">\r\n <cw-progress-bar\r\n [value]=\"row[column.key]\"\r\n [size]=\"progressBarSize.sm\"\r\n [type]=\"progressBarType.information\"></cw-progress-bar>\r\n <span class=\"td-progressbar-value\">{{ row[column.key] }}%</span>\r\n </div>\r\n }\r\n @case ('actions') {\r\n @if (usingRowActions) {\r\n @let actions = getResolvedActions(row);\r\n @if (actions.length > 0) {\r\n @if (!useDropdownActions()) {\r\n @for (action of actions; track $index) {\r\n <cw-button\r\n [type]=\"buttonType.ghost\"\r\n [label]=\"action.label\"\r\n [withIcon]=\"action.icon\"\r\n [link]=\"action.link\"\r\n [isDisabled]=\"action.disabled\"\r\n [cssClass]=\"actionCssClass(action)\"\r\n (btnAction)=\"onRowActionClick(action, row)\">\r\n </cw-button>\r\n }\r\n } @else {\r\n <cw-button\r\n [label]=\"'_COMMON._TABLE.ACTIONS_MENU'\"\r\n [withIcon]=\"spriteIcon.menuVertical\"\r\n [withOnlyIcon]=\"true\"\r\n [type]=\"buttonType.ghost\"\r\n [isDropdown]=\"true\"\r\n [hideCaret]=\"true\">\r\n <ul class=\"p-0 m-0\">\r\n @for (action of actions; track $index) {\r\n <li>\r\n @if (action.link) {\r\n <cw-button\r\n [type]=\"buttonType.ghost\"\r\n [label]=\"action.label\"\r\n [withIcon]=\"action.icon\"\r\n [link]=\"action.link\"\r\n [isDisabled]=\"action.disabled\"\r\n [cssClass]=\"'dropdown-item ' + actionCssClass(action)\">\r\n </cw-button>\r\n } @else {\r\n <cw-button\r\n [type]=\"buttonType.ghost\"\r\n [label]=\"action.label\"\r\n [withIcon]=\"action.icon\"\r\n [isDisabled]=\"action.disabled\"\r\n [cssClass]=\"'dropdown-item ' + actionCssClass(action)\"\r\n (btnAction)=\"onRowActionClick(action, row)\">\r\n </cw-button>\r\n }\r\n </li>\r\n }\r\n </ul>\r\n </cw-button>\r\n }\r\n }\r\n } @else {\r\n <ng-container\r\n *ngTemplateOutlet=\"actionsTemplate(); context: { $implicit: row }\">\r\n </ng-container>\r\n }\r\n }\r\n @default {\r\n {{ column.translate ? (row[column.key] | translate) : row[column.key] }}\r\n }\r\n }\r\n </td>\r\n }\r\n }\r\n </tr>\r\n }\r\n }\r\n </tbody>\r\n </table>\r\n</div>\r\n</div>\r\n\r\n<!-- Barre de defilement collee en bas de la fenetre tant que la table est a l'ecran, puis posee sous\r\n la table : remplace la barre native (masquee), qui n'est visible qu'au bas de la table. Doublon\r\n du defilement du conteneur (deja accessible au clavier) : masquee aux technologies d'assistance. -->\r\n@if (overflowing()) {\r\n <div #scrollbarProxy class=\"table-scrollbar\" aria-hidden=\"true\" tabindex=\"-1\" (scroll)=\"onProxyScroll()\">\r\n <div class=\"table-scrollbar-track\" [style.width.px]=\"scrollWidth()\"></div>\r\n </div>\r\n}\r\n\r\n@if (pagination()) {\r\n <cw-pagination\r\n [pagination]=\"pagination()!\"\r\n (paginationChange)=\"paginationChange.emit($event)\">\r\n </cw-pagination>\r\n}\r\n" }]
|
|
1099
|
+
}], ctorParameters: () => [], propDecorators: { checkbox: [{ type: i0.Input, args: [{ isSignal: true, alias: "checkbox", required: false }] }], title: [{ type: i0.Input, args: [{ isSignal: true, alias: "title", required: true }] }], columns: [{ type: i0.Input, args: [{ isSignal: true, alias: "columns", required: false }] }], data: [{ type: i0.Input, args: [{ isSignal: true, alias: "data", required: false }] }], loading: [{ type: i0.Input, args: [{ isSignal: true, alias: "loading", required: false }] }], rowClassFn: [{ type: i0.Input, args: [{ isSignal: true, alias: "rowClassFn", required: false }] }], pagination: [{ type: i0.Input, args: [{ isSignal: true, alias: "pagination", required: false }] }], bulkActions: [{ type: i0.Input, args: [{ isSignal: true, alias: "bulkActions", required: false }] }], rowActions: [{ type: i0.Input, args: [{ isSignal: true, alias: "rowActions", required: false }] }], emptyStateNoData: [{ type: i0.Input, args: [{ isSignal: true, alias: "emptyStateNoData", required: false }] }], emptyStateNoResult: [{ type: i0.Input, args: [{ isSignal: true, alias: "emptyStateNoResult", required: false }] }], isFiltered: [{ type: i0.Input, args: [{ isSignal: true, alias: "isFiltered", required: false }] }], showScope: [{ type: i0.Input, args: [{ isSignal: true, alias: "showScope", required: false }] }], cellClick: [{ type: i0.Output, args: ["cellClick"] }], sortChange: [{ type: i0.Output, args: ["sortChange"] }], selectionChange: [{ type: i0.Output, args: ["selectionChange"] }], paginationChange: [{ type: i0.Output, args: ["paginationChange"] }], bulkDelete: [{ type: i0.Output, args: ["bulkDelete"] }], bulkAction: [{ type: i0.Output, args: ["bulkAction"] }], actionsTemplate: [{ type: i0.ContentChild, args: ['actionsTemplate', { isSignal: true }] }], scroller: [{ type: i0.ViewChild, args: ['scroller', { isSignal: true }] }], scrollbarProxy: [{ type: i0.ViewChild, args: ['scrollbarProxy', { isSignal: true }] }] } });
|
|
1100
|
+
|
|
1101
|
+
/** Clé par défaut de la recherche unifiée. */
|
|
1102
|
+
const FILTER_SEARCH_DEFAULT_KEY = 'keywords';
|
|
1103
|
+
|
|
1104
|
+
// Persistance de la visibilite des colonnes de `cw-table` (pilotee par le menu « Colonnes » de `cw-filter-bar`).
|
|
1105
|
+
// Une SEULE cle localStorage pour N tableaux : objet indexe par `storageKey`.
|
|
1106
|
+
// On ne stocke QUE les cles des colonnes MASQUEES (eviter de surcharger le localStorage).
|
|
1107
|
+
//
|
|
1108
|
+
// localStorage['cw-table-columns'] = {
|
|
1109
|
+
// "publictransport/events": ["col1", "col2"],
|
|
1110
|
+
// "users/list": ["createdAt"]
|
|
1111
|
+
// }
|
|
1112
|
+
const STORAGE_KEY = 'cw-table-columns';
|
|
1113
|
+
/** Acces localStorage tolerant (SSR / quota / mode prive) : ne jette jamais. */
|
|
1114
|
+
function readStore() {
|
|
1115
|
+
try {
|
|
1116
|
+
if (typeof localStorage === 'undefined')
|
|
1117
|
+
return {};
|
|
1118
|
+
const raw = localStorage.getItem(STORAGE_KEY);
|
|
1119
|
+
const parsed = raw ? JSON.parse(raw) : {};
|
|
1120
|
+
return parsed && typeof parsed === 'object' ? parsed : {};
|
|
1121
|
+
}
|
|
1122
|
+
catch {
|
|
1123
|
+
return {};
|
|
1124
|
+
}
|
|
1125
|
+
}
|
|
1126
|
+
/**
|
|
1127
|
+
* Cles des colonnes masquees memorisees pour ce tableau.
|
|
1128
|
+
* - `null` : aucune entree => l'utilisateur n'a jamais personnalise, on garde les defauts du config.
|
|
1129
|
+
* - `string[]` (meme vide) : etat autoritatif memorise (`[]` = tout visible, choisi par l'utilisateur).
|
|
1130
|
+
*/
|
|
1131
|
+
function loadHiddenColumns(storageKey) {
|
|
1132
|
+
if (!storageKey)
|
|
1133
|
+
return null;
|
|
1134
|
+
const entry = readStore()[storageKey];
|
|
1135
|
+
return Array.isArray(entry) ? entry : null;
|
|
1136
|
+
}
|
|
1137
|
+
/**
|
|
1138
|
+
* Memorise les cles des colonnes masquees pour ce tableau.
|
|
1139
|
+
* Ecrit toujours l'entree (meme vide) : sa presence marque « personnalise par l'utilisateur ».
|
|
1140
|
+
*/
|
|
1141
|
+
function saveHiddenColumns(storageKey, hiddenKeys) {
|
|
1142
|
+
if (!storageKey)
|
|
1143
|
+
return;
|
|
1144
|
+
try {
|
|
1145
|
+
if (typeof localStorage === 'undefined')
|
|
1146
|
+
return;
|
|
1147
|
+
const store = readStore();
|
|
1148
|
+
store[storageKey] = hiddenKeys;
|
|
1149
|
+
localStorage.setItem(STORAGE_KEY, JSON.stringify(store));
|
|
1150
|
+
}
|
|
1151
|
+
catch {
|
|
1152
|
+
/* localStorage indisponible : persistance silencieusement ignoree. */
|
|
1153
|
+
}
|
|
1154
|
+
}
|
|
1155
|
+
/**
|
|
1156
|
+
* Oublie la personnalisation de ce tableau (« Par defaut ») : sans entree, le tableau reprend
|
|
1157
|
+
* les `hidden` du config au prochain chargement.
|
|
1158
|
+
*/
|
|
1159
|
+
function clearHiddenColumns(storageKey) {
|
|
1160
|
+
if (!storageKey)
|
|
1161
|
+
return;
|
|
1162
|
+
try {
|
|
1163
|
+
if (typeof localStorage === 'undefined')
|
|
1164
|
+
return;
|
|
1165
|
+
const store = readStore();
|
|
1166
|
+
delete store[storageKey];
|
|
1167
|
+
localStorage.setItem(STORAGE_KEY, JSON.stringify(store));
|
|
1168
|
+
}
|
|
1169
|
+
catch {
|
|
1170
|
+
/* localStorage indisponible : rien a oublier. */
|
|
1171
|
+
}
|
|
1172
|
+
}
|
|
1173
|
+
|
|
1174
|
+
// Compteur plutot que Math.random() : ids deterministes (cf. uniqueId de basic-ui, interne).
|
|
1175
|
+
let nextColumnMenuId = 0;
|
|
1176
|
+
/**
|
|
1177
|
+
* Menu « Colonnes » : dropdown de cases a cocher pour afficher/masquer les colonnes
|
|
1178
|
+
* d'une `cw-table`, avec persistance localStorage. Interne a la lib (rendu par `cw-filter-bar`).
|
|
1179
|
+
*
|
|
1180
|
+
* Bouton « Colonnes (affichees/total) » ; liste a hauteur bornee (barre DS) ; colonnes non
|
|
1181
|
+
* masquables listees cochees et desactivees ; « Tout afficher » et « Par defaut » en pied.
|
|
1182
|
+
*/
|
|
1183
|
+
class ColumnMenuComponent {
|
|
1184
|
+
constructor() {
|
|
1185
|
+
/** Colonnes du tableau associe. */
|
|
1186
|
+
this.columns = input([], ...(ngDevMode ? [{ debugName: "columns" }] : []));
|
|
1187
|
+
/** Identifiant stable du tableau pour la persistance localStorage (ex. 'users/list'). */
|
|
1188
|
+
this.storageKey = input(...(ngDevMode ? [undefined, { debugName: "storageKey" }] : []));
|
|
1189
|
+
/** Cle i18n du libelle du bouton (suivi du compteur « (affichees/total) »). */
|
|
1190
|
+
this.label = input('_COMMON._TABLE.COLUMNS', ...(ngDevMode ? [{ debugName: "label" }] : []));
|
|
1191
|
+
/** Emis quand la visibilite des colonnes change (colonnes avec `hidden` a jour). */
|
|
1192
|
+
this.columnsChange = output();
|
|
1193
|
+
this.buttonType = BoButtonTypeEnum;
|
|
1194
|
+
this.spriteIcon = SpriteIconEnum;
|
|
1195
|
+
/** Prefixe d'id unique par instance (plusieurs tables sur une page). */
|
|
1196
|
+
this.uid = `cw-column-menu-${nextColumnMenuId++}`;
|
|
1197
|
+
/**
|
|
1198
|
+
* Visibilite par defaut (`hidden` du config), par cle, figee a la 1re apparition de chaque
|
|
1199
|
+
* colonne : base de « Par defaut ». Les valeurs recues ensuite refletent les choix de
|
|
1200
|
+
* l'utilisateur (emis puis renvoyes par le parent), pas le config.
|
|
1201
|
+
*/
|
|
1202
|
+
this.defaultHidden = new Map();
|
|
1203
|
+
/** Colonnes listees : toutes sauf `actions` (les non masquables sont affichees, desactivees). */
|
|
1204
|
+
this.listedColumns = computed(() => this.columns().filter(c => c.type !== 'actions'), ...(ngDevMode ? [{ debugName: "listedColumns" }] : []));
|
|
1205
|
+
/** Colonnes que l'utilisateur peut masquer (hors `hideable === false`). */
|
|
1206
|
+
this.toggleableColumns = computed(() => this.listedColumns().filter(c => c.hideable !== false), ...(ngDevMode ? [{ debugName: "toggleableColumns" }] : []));
|
|
1207
|
+
/** Le menu n'apparait que s'il existe au moins une colonne masquable. */
|
|
1208
|
+
this.visible = computed(() => this.toggleableColumns().length > 0, ...(ngDevMode ? [{ debugName: "visible" }] : []));
|
|
1209
|
+
/** Colonnes listees actuellement affichees (compteur du bouton). */
|
|
1210
|
+
this.visibleCount = computed(() => this.listedColumns().filter(c => !c.hidden).length, ...(ngDevMode ? [{ debugName: "visibleCount" }] : []));
|
|
1211
|
+
this.totalCount = computed(() => this.listedColumns().length, ...(ngDevMode ? [{ debugName: "totalCount" }] : []));
|
|
1212
|
+
/** « Tout afficher » sans effet : aucune colonne masquable n'est masquee. */
|
|
1213
|
+
this.allShown = computed(() => this.toggleableColumns().every(c => !c.hidden), ...(ngDevMode ? [{ debugName: "allShown" }] : []));
|
|
1214
|
+
/** « Par defaut » sans effet : la visibilite correspond deja au config. */
|
|
1215
|
+
this.isDefault = computed(() => this.toggleableColumns().every(c => !!c.hidden === (this.defaultHidden.get(c.key) ?? !!c.hidden)), ...(ngDevMode ? [{ debugName: "isDefault" }] : []));
|
|
1216
|
+
// Capture des defauts AVANT la reconciliation avec l'etat memorise (afterNextRender).
|
|
1217
|
+
effect(() => {
|
|
1218
|
+
for (const column of this.columns()) {
|
|
1219
|
+
if (!this.defaultHidden.has(column.key))
|
|
1220
|
+
this.defaultHidden.set(column.key, !!column.hidden);
|
|
1221
|
+
}
|
|
1222
|
+
});
|
|
1223
|
+
// Reconciliation au 1er rendu (navigateur) : si un etat est memorise, il prime
|
|
1224
|
+
// sur les defauts du config et est emis une fois vers le parent.
|
|
1225
|
+
afterNextRender(() => this.applyStoredVisibility());
|
|
1226
|
+
}
|
|
1227
|
+
/** Case non modifiable : colonne non masquable, ou derniere colonne affichee. */
|
|
1228
|
+
isLocked(col) {
|
|
1229
|
+
return col.hideable === false || (!col.hidden && this.visibleCount() <= 1);
|
|
1230
|
+
}
|
|
1231
|
+
/** Coche/decoche une colonne : applique le garde-fou, persiste et emet. */
|
|
1232
|
+
toggleColumn(col) {
|
|
1233
|
+
if (this.isLocked(col))
|
|
1234
|
+
return; // garde-fou : au moins une colonne affichee
|
|
1235
|
+
const updated = this.columns().map(c => (c.key === col.key ? { ...c, hidden: !col.hidden } : c));
|
|
1236
|
+
this.persistAndEmit(updated);
|
|
1237
|
+
}
|
|
1238
|
+
/** Affiche toutes les colonnes masquables. */
|
|
1239
|
+
showAll() {
|
|
1240
|
+
if (this.allShown())
|
|
1241
|
+
return;
|
|
1242
|
+
this.persistAndEmit(this.columns().map(c => (this.isToggleable(c) ? { ...c, hidden: false } : c)));
|
|
1243
|
+
}
|
|
1244
|
+
/** Revient a la visibilite du config et oublie la personnalisation memorisee. */
|
|
1245
|
+
resetToDefault() {
|
|
1246
|
+
if (this.isDefault())
|
|
1247
|
+
return;
|
|
1248
|
+
const reset = this.columns().map(c => this.isToggleable(c) ? { ...c, hidden: this.defaultHidden.get(c.key) ?? !!c.hidden } : c);
|
|
1249
|
+
clearHiddenColumns(this.storageKey() ?? '');
|
|
1250
|
+
this.columnsChange.emit(this.ensureMinVisible(reset));
|
|
1251
|
+
}
|
|
1252
|
+
isToggleable(c) {
|
|
1253
|
+
return c.type !== 'actions' && c.hideable !== false;
|
|
1254
|
+
}
|
|
1255
|
+
applyStoredVisibility() {
|
|
1256
|
+
const key = this.storageKey();
|
|
1257
|
+
if (!key)
|
|
1258
|
+
return;
|
|
1259
|
+
const stored = loadHiddenColumns(key);
|
|
1260
|
+
if (!stored)
|
|
1261
|
+
return; // jamais personnalise -> on garde les `hidden` du config
|
|
1262
|
+
const hidden = new Set(stored);
|
|
1263
|
+
const reconciled = this.columns().map(c => (this.isToggleable(c) ? { ...c, hidden: hidden.has(c.key) } : c));
|
|
1264
|
+
this.columnsChange.emit(this.ensureMinVisible(reconciled));
|
|
1265
|
+
}
|
|
1266
|
+
/** Garantit au moins une colonne listee affichee (re-affiche la 1re masquable sinon). */
|
|
1267
|
+
ensureMinVisible(cols) {
|
|
1268
|
+
const listed = cols.filter(c => c.type !== 'actions');
|
|
1269
|
+
const firstToggleable = listed.find(c => c.hideable !== false);
|
|
1270
|
+
if (!firstToggleable || listed.some(c => !c.hidden))
|
|
1271
|
+
return cols;
|
|
1272
|
+
return cols.map(c => (c.key === firstToggleable.key ? { ...c, hidden: false } : c));
|
|
1273
|
+
}
|
|
1274
|
+
persistAndEmit(cols) {
|
|
1275
|
+
const hiddenKeys = cols.filter(c => c.hidden && this.isToggleable(c)).map(c => c.key);
|
|
1276
|
+
saveHiddenColumns(this.storageKey() ?? '', hiddenKeys);
|
|
1277
|
+
this.columnsChange.emit(cols);
|
|
1278
|
+
}
|
|
1279
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.20", ngImport: i0, type: ColumnMenuComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1280
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.20", type: ColumnMenuComponent, isStandalone: true, selector: "cw-column-menu", inputs: { columns: { classPropertyName: "columns", publicName: "columns", isSignal: true, isRequired: false, transformFunction: null }, storageKey: { classPropertyName: "storageKey", publicName: "storageKey", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { columnsChange: "columnsChange" }, ngImport: i0, template: "@if (visible()) {\n <!-- Libelle + compteur \u00AB (affichees/total) \u00BB : le libelle reste en tete du nom accessible. -->\n <cw-button [type]=\"buttonType.secondary\" [label]=\"'_COMMON._TABLE.COLUMNS_COUNT'\"\n [labelParams]=\"{ label: label() | translate, visible: visibleCount(), total: totalCount() }\"\n [withIcon]=\"spriteIcon.miscNews\" [isDropdown]=\"true\">\n <div class=\"column-menu d-flex-v gap-sm p-md\">\n <!-- Groupe de cases nomme par son titre ; seule la liste defile (hauteur bornee). -->\n <fieldset class=\"m-none p-none\">\n <legend class=\"column-menu-title fs-xs fw-bold text-light\">{{ '_COMMON._TABLE.COLUMNS_DISPLAYED' | translate }}</legend>\n <ul class=\"column-menu-list scrollbar-ds d-flex-v gap-2xs m-none\">\n @for (col of listedColumns(); track col.key) {\n <li class=\"field-check\">\n <input class=\"field-check-input\" type=\"checkbox\" [id]=\"uid + '-' + col.key\"\n [checked]=\"!col.hidden\" [disabled]=\"isLocked(col)\" (change)=\"toggleColumn(col)\">\n <label class=\"field-check-label\" [for]=\"uid + '-' + col.key\">{{ col.label | translate }}</label>\n </li>\n }\n </ul>\n </fieldset>\n\n <cw-divider [decorative]=\"true\"></cw-divider>\n\n <!-- Pas de `cwDropdownItem` : le menu reste ouvert pour enchainer les reglages. -->\n <div class=\"column-menu-footer d-flex-h justify-between gap-md\">\n <cw-button [type]=\"buttonType.linkLike\" [label]=\"'_COMMON._TABLE.COLUMNS_SHOW_ALL'\"\n [isDisabled]=\"allShown()\" (btnAction)=\"showAll()\"></cw-button>\n <cw-button [type]=\"buttonType.linkLike\" [label]=\"'_COMMON._TABLE.COLUMNS_RESET'\"\n [isDisabled]=\"isDefault()\" (btnAction)=\"resetToDefault()\"></cw-button>\n </div>\n </div>\n </cw-button>\n}\n", dependencies: [{ kind: "component", type: ButtonComponent, selector: "cw-button", inputs: ["type", "label", "labelParams", "id", "link", "isDropdown", "hideCaret", "withIcon", "withOnlyIcon", "iconSize", "iconPosition", "dropdownPosition", "isMinWidth", "isDisabled", "isLoading", "loadingAnnounce", "cssClass", "dataTest", "skeletonMode", "isPressed", "ariaDescribedBy", "ariaLabel", "ariaExpanded", "ariaControls", "withTooltip", "tooltipText", "tooltipTitle", "tooltipTrigger", "tooltipPosition", "tooltipType"], outputs: ["btnAction", "dropDownClicked"] }, { kind: "component", type: DividerComponent, selector: "cw-divider", inputs: ["spaced", "decorative"] }, { kind: "ngmodule", type: TranslateModule }, { kind: "pipe", type: i1.TranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
1281
|
+
}
|
|
1282
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.20", ngImport: i0, type: ColumnMenuComponent, decorators: [{
|
|
1283
|
+
type: Component,
|
|
1284
|
+
args: [{ selector: 'cw-column-menu', changeDetection: ChangeDetectionStrategy.OnPush, imports: [ButtonComponent, DividerComponent, TranslateModule], template: "@if (visible()) {\n <!-- Libelle + compteur \u00AB (affichees/total) \u00BB : le libelle reste en tete du nom accessible. -->\n <cw-button [type]=\"buttonType.secondary\" [label]=\"'_COMMON._TABLE.COLUMNS_COUNT'\"\n [labelParams]=\"{ label: label() | translate, visible: visibleCount(), total: totalCount() }\"\n [withIcon]=\"spriteIcon.miscNews\" [isDropdown]=\"true\">\n <div class=\"column-menu d-flex-v gap-sm p-md\">\n <!-- Groupe de cases nomme par son titre ; seule la liste defile (hauteur bornee). -->\n <fieldset class=\"m-none p-none\">\n <legend class=\"column-menu-title fs-xs fw-bold text-light\">{{ '_COMMON._TABLE.COLUMNS_DISPLAYED' | translate }}</legend>\n <ul class=\"column-menu-list scrollbar-ds d-flex-v gap-2xs m-none\">\n @for (col of listedColumns(); track col.key) {\n <li class=\"field-check\">\n <input class=\"field-check-input\" type=\"checkbox\" [id]=\"uid + '-' + col.key\"\n [checked]=\"!col.hidden\" [disabled]=\"isLocked(col)\" (change)=\"toggleColumn(col)\">\n <label class=\"field-check-label\" [for]=\"uid + '-' + col.key\">{{ col.label | translate }}</label>\n </li>\n }\n </ul>\n </fieldset>\n\n <cw-divider [decorative]=\"true\"></cw-divider>\n\n <!-- Pas de `cwDropdownItem` : le menu reste ouvert pour enchainer les reglages. -->\n <div class=\"column-menu-footer d-flex-h justify-between gap-md\">\n <cw-button [type]=\"buttonType.linkLike\" [label]=\"'_COMMON._TABLE.COLUMNS_SHOW_ALL'\"\n [isDisabled]=\"allShown()\" (btnAction)=\"showAll()\"></cw-button>\n <cw-button [type]=\"buttonType.linkLike\" [label]=\"'_COMMON._TABLE.COLUMNS_RESET'\"\n [isDisabled]=\"isDefault()\" (btnAction)=\"resetToDefault()\"></cw-button>\n </div>\n </div>\n </cw-button>\n}\n" }]
|
|
1285
|
+
}], ctorParameters: () => [], propDecorators: { columns: [{ type: i0.Input, args: [{ isSignal: true, alias: "columns", required: false }] }], storageKey: [{ type: i0.Input, args: [{ isSignal: true, alias: "storageKey", required: false }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], columnsChange: [{ type: i0.Output, args: ["columnsChange"] }] } });
|
|
984
1286
|
|
|
985
1287
|
/**
|
|
986
1288
|
* Valeur du choix « Tous » d'un filtre simple. Vide = filtre inactif : la barre la retire
|
|
@@ -1048,71 +1350,136 @@ const SELECT_TYPES = new Set([
|
|
|
1048
1350
|
]);
|
|
1049
1351
|
/** Séparateur des valeurs d'un filtre multiple dans les query params de l'URL. */
|
|
1050
1352
|
const MULTIPLE_SEPARATOR = ',';
|
|
1353
|
+
/** Compteur d'instances : ids uniques quand plusieurs barres cohabitent sur la page. */
|
|
1354
|
+
let nextId = 0;
|
|
1051
1355
|
class FilterBarComponent {
|
|
1052
1356
|
constructor() {
|
|
1053
1357
|
this.destroyRef = inject(DestroyRef);
|
|
1054
1358
|
this.router = inject(Router, { optional: true });
|
|
1055
1359
|
this.route = inject(ActivatedRoute, { optional: true });
|
|
1360
|
+
this.translate = inject(TranslateService);
|
|
1361
|
+
this.injector = inject(Injector);
|
|
1362
|
+
this.host = inject((ElementRef));
|
|
1056
1363
|
this.filters = input.required(...(ngDevMode ? [{ debugName: "filters" }] : []));
|
|
1364
|
+
/** Recherche unifiée (mots-clés). Absente = comportement historique (champs isolés). */
|
|
1365
|
+
this.search = input(...(ngDevMode ? [undefined, { debugName: "search" }] : []));
|
|
1057
1366
|
this.manual = input(false, ...(ngDevMode ? [{ debugName: "manual" }] : []));
|
|
1058
1367
|
/** Synchronise l'état appliqué des filtres avec les query params de l'URL (mémorisation / partage). */
|
|
1059
1368
|
this.syncUrl = input(false, ...(ngDevMode ? [{ debugName: "syncUrl" }] : []));
|
|
1060
1369
|
this.applyLabel = input('_COMMON._ACTION.FILTER', ...(ngDevMode ? [{ debugName: "applyLabel" }] : []));
|
|
1061
1370
|
this.resetLabel = input('_COMMON._ACTION.RESET', ...(ngDevMode ? [{ debugName: "resetLabel" }] : []));
|
|
1371
|
+
// --- Menu « Colonnes » (optionnel, a droite de la barre) ---------------
|
|
1372
|
+
/** Colonnes du tableau associe. Fourni => le dropdown « Colonnes » apparait. */
|
|
1373
|
+
this.columns = input([], ...(ngDevMode ? [{ debugName: "columns" }] : []));
|
|
1374
|
+
/** Identifiant stable du tableau pour la persistance localStorage (ex. 'users/list'). */
|
|
1375
|
+
this.columnsStorageKey = input(...(ngDevMode ? [undefined, { debugName: "columnsStorageKey" }] : []));
|
|
1376
|
+
/** Cle i18n du libelle du bouton « Colonnes ». */
|
|
1377
|
+
this.columnsLabel = input('_COMMON._TABLE.COLUMNS', ...(ngDevMode ? [{ debugName: "columnsLabel" }] : []));
|
|
1062
1378
|
this.filtersApplied = output();
|
|
1063
1379
|
this.filtersReset = output();
|
|
1380
|
+
/** Emis quand la visibilite des colonnes change (colonnes avec `hidden` a jour). */
|
|
1381
|
+
this.columnsChange = output();
|
|
1064
1382
|
this.uiType = BoButtonTypeEnum;
|
|
1383
|
+
this.spriteIcon = SpriteIconEnum;
|
|
1384
|
+
this.iconSize = ButtonIconSizeEnum;
|
|
1385
|
+
this.fieldType = FormFieldTypeEnum;
|
|
1386
|
+
this.badgeType = BadgeTypeEnum;
|
|
1387
|
+
/** Préfixe des ids de la barre : uniques même avec plusieurs barres sur la page. */
|
|
1388
|
+
this.idPrefix = `cw-filter-bar-${nextId++}`;
|
|
1389
|
+
/** Id de la zone des filtres avancés (cible de l'`aria-controls` du bouton « Plus de filtres »). */
|
|
1390
|
+
this.advancedPanelId = `${this.idPrefix}-advanced`;
|
|
1065
1391
|
this.filterForm = new FormGroup({});
|
|
1392
|
+
/** Clé de la recherche unifiée dans `FilterValues` / l'URL. */
|
|
1393
|
+
this.searchKey = computed(() => this.search()?.key || FILTER_SEARCH_DEFAULT_KEY, ...(ngDevMode ? [{ debugName: "searchKey" }] : []));
|
|
1394
|
+
/** Champs couverts par la recherche unifiée (vide si la recherche n'est pas activée). */
|
|
1395
|
+
this.unifiedKeys = computed(() => new Set(this.search() ? this.search().fields ?? [] : []), ...(ngDevMode ? [{ debugName: "unifiedKeys" }] : []));
|
|
1396
|
+
/** Champs rendus dans la barre (hors avancés, hors champs fusionnés dans la recherche). */
|
|
1397
|
+
this.barFields = computed(() => this.filters().filter(f => f.placement !== 'advanced' && !this.unifiedKeys().has(f.key)), ...(ngDevMode ? [{ debugName: "barFields" }] : []));
|
|
1398
|
+
/** Champs du panneau « Recherche avancée ». */
|
|
1399
|
+
this.advancedFields = computed(() => this.filters().filter(f => f.placement === 'advanced'), ...(ngDevMode ? [{ debugName: "advancedFields" }] : []));
|
|
1400
|
+
/** Champs masqués par la recherche unifiée : retirés de l'URL pour ne pas laisser de filtre invisible. */
|
|
1401
|
+
this.unifiedHiddenFields = computed(() => this.filters().filter(f => f.placement !== 'advanced' && this.unifiedKeys().has(f.key)), ...(ngDevMode ? [{ debugName: "unifiedHiddenFields" }] : []));
|
|
1402
|
+
/** La barre a-t-elle au moins un champ (recherche comprise) ? Sinon pas de boutons Appliquer/Réinitialiser. */
|
|
1403
|
+
this.hasFields = computed(() => !!this.search() || this.filters().length > 0, ...(ngDevMode ? [{ debugName: "hasFields" }] : []));
|
|
1404
|
+
this.advancedOpen = signal(false, ...(ngDevMode ? [{ debugName: "advancedOpen" }] : []));
|
|
1405
|
+
/** Dernières valeurs émises : source des étiquettes et du compteur (en mode manuel, la saisie non appliquée n'y figure pas). */
|
|
1406
|
+
this.appliedValues = signal({}, ...(ngDevMode ? [{ debugName: "appliedValues" }] : []));
|
|
1407
|
+
/** Filtres avancés actifs, rappelés en étiquettes supprimables sous la barre. */
|
|
1408
|
+
this.advancedChips = computed(() => {
|
|
1409
|
+
const applied = this.appliedValues();
|
|
1410
|
+
return this.advancedFields()
|
|
1411
|
+
.filter(f => !this.isEmptyValue(applied[f.key]))
|
|
1412
|
+
.map(f => ({ key: f.key, label: f.label, values: this.displayValues(f, applied[f.key]) }));
|
|
1413
|
+
}, ...(ngDevMode ? [{ debugName: "advancedChips" }] : []));
|
|
1414
|
+
this.advancedLabel = computed(() => this.advancedOpen() ? '_COMMON._FILTER.LESS' : '_COMMON._FILTER.MORE', ...(ngDevMode ? [{ debugName: "advancedLabel" }] : []));
|
|
1415
|
+
this.advancedToggle = viewChild('advancedToggle', ...(ngDevMode ? [{ debugName: "advancedToggle", read: ElementRef }] : [{ read: ElementRef }]));
|
|
1066
1416
|
this.defaults = {};
|
|
1067
1417
|
effect(() => {
|
|
1068
|
-
this.buildForm(this.
|
|
1418
|
+
this.buildForm(this.barFields(), this.advancedFields(), this.search());
|
|
1069
1419
|
});
|
|
1070
1420
|
}
|
|
1071
|
-
buildForm(
|
|
1421
|
+
buildForm(barFields, advancedFields, search) {
|
|
1072
1422
|
// Ferme la souscription du form precedent : sans quoi un changement de `filters()`
|
|
1073
1423
|
// (donc un rebuild) empilerait les souscriptions -> emissions `filtersApplied` multipliees.
|
|
1074
1424
|
this.valueChangesSub?.unsubscribe();
|
|
1075
|
-
const
|
|
1425
|
+
const searchKey = search ? this.searchKey() : null;
|
|
1076
1426
|
const defaults = {};
|
|
1077
|
-
const urlValues = this.readUrlValues(
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
defaults[field.key] = { ...def };
|
|
1087
|
-
}
|
|
1088
|
-
else {
|
|
1089
|
-
const def = field.defaultValue ?? (this.isMultiple(field) ? [] : '');
|
|
1090
|
-
const init = urlValues[field.key] ?? def;
|
|
1091
|
-
group[field.key] = new FormControl(init);
|
|
1092
|
-
defaults[field.key] = Array.isArray(def) ? [...def] : def;
|
|
1093
|
-
}
|
|
1427
|
+
const urlValues = this.readUrlValues([...barFields, ...advancedFields], searchKey);
|
|
1428
|
+
// Un seul form : les champs avancés s'appliquent comme ceux de la barre (à la saisie, ou au bouton en manuel).
|
|
1429
|
+
const group = {};
|
|
1430
|
+
if (searchKey) {
|
|
1431
|
+
group[searchKey] = new FormControl(urlValues[searchKey] ?? '');
|
|
1432
|
+
defaults[searchKey] = '';
|
|
1433
|
+
}
|
|
1434
|
+
for (const field of [...barFields, ...advancedFields]) {
|
|
1435
|
+
group[field.key] = this.createControl(field, urlValues, defaults);
|
|
1094
1436
|
}
|
|
1095
1437
|
this.defaults = defaults;
|
|
1096
1438
|
this.filterForm = new FormGroup(group);
|
|
1439
|
+
this.appliedValues.set(this.filterForm.value);
|
|
1097
1440
|
if (!this.manual()) {
|
|
1098
1441
|
this.valueChangesSub = this.filterForm.valueChanges
|
|
1099
1442
|
.pipe(debounceTime(300), takeUntilDestroyed(this.destroyRef))
|
|
1100
|
-
.subscribe(
|
|
1101
|
-
this.filtersApplied.emit(values);
|
|
1102
|
-
this.syncFiltersToUrl(values);
|
|
1103
|
-
});
|
|
1443
|
+
.subscribe(() => this.emitAndSync());
|
|
1104
1444
|
}
|
|
1105
1445
|
// Restaure le filtrage présent dans l'URL au chargement.
|
|
1106
1446
|
if (Object.keys(urlValues).length > 0) {
|
|
1107
|
-
this.filtersApplied.emit(this.
|
|
1447
|
+
this.filtersApplied.emit(this.currentValues());
|
|
1108
1448
|
}
|
|
1109
1449
|
}
|
|
1110
|
-
/**
|
|
1111
|
-
|
|
1450
|
+
/** Crée le control d'un champ (sous-`FormGroup` pour une plage) et enregistre sa valeur par défaut. */
|
|
1451
|
+
createControl(field, urlValues, defaults) {
|
|
1452
|
+
if (RANGE_TYPES.has(field.type)) {
|
|
1453
|
+
const def = field.defaultValue ?? { start: '', end: '' };
|
|
1454
|
+
const init = urlValues[field.key] ?? def;
|
|
1455
|
+
defaults[field.key] = { ...def };
|
|
1456
|
+
return new FormGroup({
|
|
1457
|
+
start: new FormControl(init.start ?? ''),
|
|
1458
|
+
end: new FormControl(init.end ?? '')
|
|
1459
|
+
});
|
|
1460
|
+
}
|
|
1461
|
+
const def = field.defaultValue ?? (this.isMultiple(field) ? [] : '');
|
|
1462
|
+
defaults[field.key] = Array.isArray(def) ? [...def] : def;
|
|
1463
|
+
return new FormControl(urlValues[field.key] ?? def);
|
|
1464
|
+
}
|
|
1465
|
+
currentValues() {
|
|
1466
|
+
return this.filterForm.value;
|
|
1467
|
+
}
|
|
1468
|
+
emitAndSync() {
|
|
1469
|
+
const values = this.currentValues();
|
|
1470
|
+
this.appliedValues.set(values);
|
|
1471
|
+
this.filtersApplied.emit(values);
|
|
1472
|
+
this.syncFiltersToUrl(values);
|
|
1473
|
+
}
|
|
1474
|
+
/** Lit les valeurs de filtre (et la recherche unifiée) présentes dans les query params de l'URL. */
|
|
1475
|
+
readUrlValues(configs, searchKey) {
|
|
1112
1476
|
const values = {};
|
|
1113
1477
|
if (!this.syncUrl() || !this.route)
|
|
1114
1478
|
return values;
|
|
1115
1479
|
const params = this.route.snapshot.queryParamMap;
|
|
1480
|
+
if (searchKey && params.get(searchKey) !== null) {
|
|
1481
|
+
values[searchKey] = params.get(searchKey);
|
|
1482
|
+
}
|
|
1116
1483
|
for (const field of configs) {
|
|
1117
1484
|
if (RANGE_TYPES.has(field.type)) {
|
|
1118
1485
|
const start = params.get(`${field.key}.start`);
|
|
@@ -1137,7 +1504,10 @@ class FilterBarComponent {
|
|
|
1137
1504
|
if (!this.syncUrl() || !this.router || !this.route)
|
|
1138
1505
|
return;
|
|
1139
1506
|
const queryParams = {};
|
|
1140
|
-
|
|
1507
|
+
if (this.search()) {
|
|
1508
|
+
queryParams[this.searchKey()] = this.toParam(values[this.searchKey()]);
|
|
1509
|
+
}
|
|
1510
|
+
for (const field of [...this.barFields(), ...this.advancedFields()]) {
|
|
1141
1511
|
const value = values[field.key];
|
|
1142
1512
|
if (RANGE_TYPES.has(field.type)) {
|
|
1143
1513
|
queryParams[`${field.key}.start`] = this.toParam(value?.start);
|
|
@@ -1147,6 +1517,16 @@ class FilterBarComponent {
|
|
|
1147
1517
|
queryParams[field.key] = this.toParam(value);
|
|
1148
1518
|
}
|
|
1149
1519
|
}
|
|
1520
|
+
// Un champ fusionné dans la recherche n'a plus de saisie : on purge un éventuel ancien param.
|
|
1521
|
+
for (const field of this.unifiedHiddenFields()) {
|
|
1522
|
+
if (RANGE_TYPES.has(field.type)) {
|
|
1523
|
+
queryParams[`${field.key}.start`] = null;
|
|
1524
|
+
queryParams[`${field.key}.end`] = null;
|
|
1525
|
+
}
|
|
1526
|
+
else {
|
|
1527
|
+
queryParams[field.key] = null;
|
|
1528
|
+
}
|
|
1529
|
+
}
|
|
1150
1530
|
this.router.navigate([], {
|
|
1151
1531
|
relativeTo: this.route,
|
|
1152
1532
|
queryParams,
|
|
@@ -1162,6 +1542,37 @@ class FilterBarComponent {
|
|
|
1162
1542
|
return value.length ? value.join(MULTIPLE_SEPARATOR) : null;
|
|
1163
1543
|
return String(value);
|
|
1164
1544
|
}
|
|
1545
|
+
isEmptyValue(value) {
|
|
1546
|
+
if (value === null || value === undefined || value === '')
|
|
1547
|
+
return true;
|
|
1548
|
+
if (Array.isArray(value))
|
|
1549
|
+
return value.length === 0;
|
|
1550
|
+
if (typeof value === 'object' && 'start' in value && 'end' in value)
|
|
1551
|
+
return !value.start && !value.end;
|
|
1552
|
+
return false;
|
|
1553
|
+
}
|
|
1554
|
+
/** Valeurs lisibles d'un filtre avancé : libellés d'options pour les listes, `début – fin` pour une plage. */
|
|
1555
|
+
displayValues(field, value) {
|
|
1556
|
+
if (RANGE_TYPES.has(field.type)) {
|
|
1557
|
+
return [{ text: `${value.start || '…'} – ${value.end || '…'}`, translate: false }];
|
|
1558
|
+
}
|
|
1559
|
+
if (this.isSelect(field)) {
|
|
1560
|
+
const options = this.resolveOptions(field);
|
|
1561
|
+
return (Array.isArray(value) ? value : [value]).map(v => {
|
|
1562
|
+
const option = options.find(o => o.value === v);
|
|
1563
|
+
return option ? { text: option.label, translate: true } : { text: String(v), translate: false };
|
|
1564
|
+
});
|
|
1565
|
+
}
|
|
1566
|
+
return [{ text: String(value), translate: false }];
|
|
1567
|
+
}
|
|
1568
|
+
/** Id du champ (`name` de cw-form-field / `inputId` de cw-filter-select) : relie label et input. */
|
|
1569
|
+
fieldId(key) {
|
|
1570
|
+
return `${this.idPrefix}-${key}`;
|
|
1571
|
+
}
|
|
1572
|
+
/** Champ de saisie simple (ni liste, ni période) : son libellé est intégré au champ (cf. `.filter-field-text`). */
|
|
1573
|
+
isTextField(field) {
|
|
1574
|
+
return !this.isSelect(field) && !RANGE_TYPES.has(field.type);
|
|
1575
|
+
}
|
|
1165
1576
|
isSelect(field) {
|
|
1166
1577
|
return SELECT_TYPES.has(field.type);
|
|
1167
1578
|
}
|
|
@@ -1177,31 +1588,68 @@ class FilterBarComponent {
|
|
|
1177
1588
|
return typeof field.options === 'function' ? field.options() : field.options;
|
|
1178
1589
|
}
|
|
1179
1590
|
apply() {
|
|
1180
|
-
|
|
1181
|
-
this.filtersApplied.emit(values);
|
|
1182
|
-
this.syncFiltersToUrl(values);
|
|
1591
|
+
this.emitAndSync();
|
|
1183
1592
|
}
|
|
1184
1593
|
reset() {
|
|
1185
1594
|
this.filterForm.reset(this.defaults);
|
|
1186
1595
|
this.filtersReset.emit();
|
|
1187
1596
|
if (this.manual()) {
|
|
1188
|
-
|
|
1189
|
-
this.filtersApplied.emit(values);
|
|
1190
|
-
this.syncFiltersToUrl(values);
|
|
1597
|
+
this.emitAndSync();
|
|
1191
1598
|
}
|
|
1192
1599
|
}
|
|
1600
|
+
// --- Recherche avancée -------------------------------------------------
|
|
1601
|
+
toggleAdvanced() {
|
|
1602
|
+
this.advancedOpen.update(open => !open);
|
|
1603
|
+
}
|
|
1604
|
+
/** Retire un filtre avancé (étiquette) : effet immédiat, même en mode manuel. */
|
|
1605
|
+
removeAdvanced(key) {
|
|
1606
|
+
const index = this.advancedChips().findIndex(c => c.key === key);
|
|
1607
|
+
// Sans emitEvent, le valueChanges (auto) ne ré-émet pas après coup : une seule émission.
|
|
1608
|
+
this.filterForm.get(key)?.reset(this.defaults[key], { emitEvent: false });
|
|
1609
|
+
this.emitAndSync();
|
|
1610
|
+
// Focus sur l'étiquette suivante (désormais au même index), la précédente si c'était la dernière,
|
|
1611
|
+
// sinon sur « Plus de filtres » : le focus ne doit pas retomber sur <body>.
|
|
1612
|
+
afterNextRender(() => {
|
|
1613
|
+
const buttons = this.host.nativeElement.querySelectorAll('.filter-bar-chips button');
|
|
1614
|
+
const next = buttons[Math.min(index, buttons.length - 1)];
|
|
1615
|
+
next ? next.focus() : this.focusAdvancedToggle();
|
|
1616
|
+
}, { injector: this.injector });
|
|
1617
|
+
}
|
|
1618
|
+
/** Nom accessible de la recherche unifiée : `search.label`, sinon « Rechercher (Nom, Email) » d'après les champs couverts. */
|
|
1619
|
+
searchLabel() {
|
|
1620
|
+
const config = this.search();
|
|
1621
|
+
if (config?.label)
|
|
1622
|
+
return config.label;
|
|
1623
|
+
const labels = this.filters().filter(f => this.unifiedKeys().has(f.key)).map(f => this.translate.instant(f.label));
|
|
1624
|
+
return labels.length
|
|
1625
|
+
? this.translate.instant('_COMMON._FILTER.KEYWORDS_IN', { fields: labels.join(', ') })
|
|
1626
|
+
: '_COMMON._FILTER.KEYWORDS';
|
|
1627
|
+
}
|
|
1628
|
+
/** Valeur(s) lisible(s) d'une étiquette (libellés d'options traduits). */
|
|
1629
|
+
chipText(chip) {
|
|
1630
|
+
return chip.values.map(v => (v.translate ? this.translate.instant(v.text) : v.text)).join(', ');
|
|
1631
|
+
}
|
|
1632
|
+
/** L'étiquette disparaît : le focus revient sur le bouton « Plus de filtres ». */
|
|
1633
|
+
focusAdvancedToggle() {
|
|
1634
|
+
this.advancedToggle()?.nativeElement?.querySelector('button')?.focus();
|
|
1635
|
+
}
|
|
1193
1636
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.20", ngImport: i0, type: FilterBarComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1194
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.20", type: FilterBarComponent, isStandalone: true, selector: "cw-filter-bar", inputs: { filters: { classPropertyName: "filters", publicName: "filters", isSignal: true, isRequired: true, transformFunction: null }, manual: { classPropertyName: "manual", publicName: "manual", isSignal: true, isRequired: false, transformFunction: null }, syncUrl: { classPropertyName: "syncUrl", publicName: "syncUrl", isSignal: true, isRequired: false, transformFunction: null }, applyLabel: { classPropertyName: "applyLabel", publicName: "applyLabel", isSignal: true, isRequired: false, transformFunction: null }, resetLabel: { classPropertyName: "resetLabel", publicName: "resetLabel", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { filtersApplied: "filtersApplied", filtersReset: "filtersReset" }, ngImport: i0, template: "<!-- Cl\u00E9s i18n pass\u00E9es telles quelles : cw-form-field et cw-button traduisent label et placeholder eux-m\u00EAmes. -->\n<form [formGroup]=\"filterForm\" (ngSubmit)=\"apply()\" class=\"filter-bar\">\n <div class=\"d-flex-h flex-wrap gap-md\">\n @for (field of filters(); track field.key) {\n <div class=\"filter-field\" [class]=\"field.colClass ?? ''\">\n @if (isSelect(field)) {\n <cw-filter-select\n [label]=\"field.label\"\n [options]=\"resolveOptions(field)\"\n [multiple]=\"isMultiple(field)\"\n [allLabel]=\"field.allLabel === undefined ? '_COMMON._FILTER.ALL' : field.allLabel\"\n [inputId]=\"'filter-' + field.key\"\n [control]=\"$any(getControl(field.key))\">\n </cw-filter-select>\n } @else {\n <cw-form-field\n [label]=\"field.label\"\n [displayLabel]=\"false\"\n [type]=\"field.type\"\n [placeholder]=\"field.placeholder ?? ''\"\n [options]=\"resolveOptions(field)\"\n [control]=\"getControl(field.key)\">\n </cw-form-field>\n }\n </div>\n }\n <div class=\"d-flex-h gap-md\">\n @if (manual()) {\n <cw-button\n [label]=\"applyLabel()\"\n [type]=\"uiType.link\"\n (btnAction)=\"apply()\">\n </cw-button>\n }\n <cw-button\n [label]=\"resetLabel()\"\n [type]=\"uiType.link\"\n (btnAction)=\"reset()\">\n </cw-button>\n </div>\n </div>\n</form>\n", dependencies: [{ kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1$2.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1$2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1$2.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "component", type: FormFieldComponent, selector: "cw-form-field", inputs: ["control", "formGroup", "type", "label", "displayLabel", "name", "placeholder", "autocomplete", "options", "rangeOptions", "validationOptions", "autocompleteOptions", "richTextOptions", "errorMessages", "isRequired", "help", "tooltip", "addonLeft", "addonRight", "isInAddon", "isReadonly", "isDisabled", "sliderValue", "sliderOptions", "cssClass", "skeletonMode", "clearable", "appendTo", "initialCountry", "recommendedDimensions", "showPreview", "existingFile", "indeterminate"], outputs: ["refreshEvent", "fileRemoved", "textChanged", "valueChange", "phoneRegionChange"] }, { kind: "component", type: FilterSelectComponent, selector: "cw-filter-select", inputs: ["control", "label", "options", "multiple", "allLabel", "inputId", "readonly", "appendTo"] }, { kind: "component", type: ButtonComponent, selector: "cw-button", inputs: ["type", "label", "id", "link", "isDropdown", "hideCaret", "withIcon", "withOnlyIcon", "iconSize", "iconPosition", "dropdownPosition", "isMinWidth", "isDisabled", "isLoading", "loadingAnnounce", "cssClass", "dataTest", "skeletonMode", "isPressed", "ariaDescribedBy", "withTooltip", "tooltipText", "tooltipTitle", "tooltipTrigger", "tooltipPosition", "tooltipType"], outputs: ["btnAction", "dropDownClicked"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
1637
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.20", type: FilterBarComponent, isStandalone: true, selector: "cw-filter-bar", inputs: { filters: { classPropertyName: "filters", publicName: "filters", isSignal: true, isRequired: true, transformFunction: null }, search: { classPropertyName: "search", publicName: "search", isSignal: true, isRequired: false, transformFunction: null }, manual: { classPropertyName: "manual", publicName: "manual", isSignal: true, isRequired: false, transformFunction: null }, syncUrl: { classPropertyName: "syncUrl", publicName: "syncUrl", isSignal: true, isRequired: false, transformFunction: null }, applyLabel: { classPropertyName: "applyLabel", publicName: "applyLabel", isSignal: true, isRequired: false, transformFunction: null }, resetLabel: { classPropertyName: "resetLabel", publicName: "resetLabel", isSignal: true, isRequired: false, transformFunction: null }, columns: { classPropertyName: "columns", publicName: "columns", isSignal: true, isRequired: false, transformFunction: null }, columnsStorageKey: { classPropertyName: "columnsStorageKey", publicName: "columnsStorageKey", isSignal: true, isRequired: false, transformFunction: null }, columnsLabel: { classPropertyName: "columnsLabel", publicName: "columnsLabel", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { filtersApplied: "filtersApplied", filtersReset: "filtersReset", columnsChange: "columnsChange" }, viewQueries: [{ propertyName: "advancedToggle", first: true, predicate: ["advancedToggle"], descendants: true, read: ElementRef, isSignal: true }], ngImport: i0, template: "<!-- Cl\u00E9s i18n pass\u00E9es telles quelles : cw-form-field et cw-button traduisent label et placeholder eux-m\u00EAmes. -->\r\n<form [formGroup]=\"filterForm\" (ngSubmit)=\"apply()\" class=\"filter-bar d-flex-v gap-md\">\r\n <div class=\"d-flex-h gap-md items-start justify-between\">\r\n <div class=\"d-flex-h flex-wrap gap-md items-center\">\r\n @if (search(); as searchConfig) {\r\n <!-- Recherche unifi\u00E9e : remplace les champs list\u00E9s dans `search.fields`. Label masqu\u00E9\r\n (la loupe + le placeholder l'identifient visuellement) et repris en title au survol. -->\r\n <div class=\"filter-field\" [class]=\"searchConfig.colClass ?? ''\">\r\n <cw-form-field\r\n [name]=\"fieldId(searchKey())\"\r\n [label]=\"searchLabel()\"\r\n [displayLabel]=\"false\"\r\n [fieldTitle]=\"searchLabel()\"\r\n [type]=\"fieldType.text\"\r\n [placeholder]=\"searchConfig.placeholder ?? '_COMMON._FILTER.KEYWORDS'\"\r\n [addonLeft]=\"searchIcon\"\r\n [control]=\"getControl(searchKey())\">\r\n </cw-form-field>\r\n </div>\r\n }\r\n @for (field of barFields(); track field.key) {\r\n <div class=\"filter-field\" [class]=\"field.colClass ?? ''\" [class.filter-field-text]=\"isTextField(field)\">\r\n <ng-container\r\n [ngTemplateOutlet]=\"fieldTpl\"\r\n [ngTemplateOutletContext]=\"{ $implicit: field, control: getControl(field.key) }\">\r\n </ng-container>\r\n </div>\r\n }\r\n @if (advancedFields().length) {\r\n <div class=\"d-flex-h items-center gap-5xs\">\r\n <cw-button #advancedToggle\r\n [label]=\"advancedLabel()\"\r\n [type]=\"uiType.link\"\r\n [ariaExpanded]=\"advancedOpen()\"\r\n [ariaControls]=\"advancedPanelId\"\r\n [ariaLabel]=\"!advancedOpen() && advancedChips().length ? '_COMMON._FILTER.MORE_COUNT' : undefined\"\r\n [labelParams]=\"{ count: advancedChips().length }\"\r\n (btnAction)=\"toggleAdvanced()\">\r\n </cw-button>\r\n @if (!advancedOpen() && advancedChips().length; as count) {\r\n <!-- Compteur (repli\u00E9 seulement : d\u00E9pli\u00E9, les champs montrent d\u00E9j\u00E0 les valeurs) ;\r\n d\u00E9coratif : le nombre est dans le nom accessible du bouton (\u00AB Plus de filtres, 2 actifs \u00BB). -->\r\n <cw-badge [type]=\"badgeType.lightLight\" [label]=\"'' + count\" aria-hidden=\"true\" />\r\n }\r\n </div>\r\n }\r\n @if (hasFields()) {\r\n <div class=\"d-flex-h gap-md\">\r\n @if (manual()) {\r\n <cw-button\r\n [label]=\"applyLabel()\"\r\n [type]=\"uiType.link\"\r\n (btnAction)=\"apply()\">\r\n </cw-button>\r\n }\r\n <cw-button\r\n [label]=\"resetLabel()\"\r\n [type]=\"uiType.link\"\r\n (btnAction)=\"reset()\">\r\n </cw-button>\r\n </div>\r\n }\r\n </div>\r\n <!-- Menu \u00AB Colonnes \u00BB a droite ; ne s'affiche que si `columns` contient une colonne masquable. -->\r\n <cw-column-menu\r\n [columns]=\"columns()\"\r\n [storageKey]=\"columnsStorageKey()\"\r\n [label]=\"columnsLabel()\"\r\n (columnsChange)=\"columnsChange.emit($event)\">\r\n </cw-column-menu>\r\n </div>\r\n\r\n @if (advancedFields().length) {\r\n <!-- Champs avanc\u00E9s : appliqu\u00E9s comme ceux de la barre (\u00E0 la saisie, ou au bouton en mode manuel).\r\n Toujours dans le DOM (cible de aria-controls), masqu\u00E9s par `hidden` quand repli\u00E9s. -->\r\n <div class=\"d-flex-h flex-wrap gap-md\" role=\"group\" [id]=\"advancedPanelId\" [hidden]=\"!advancedOpen()\"\r\n [attr.aria-label]=\"'_COMMON._FILTER.ADVANCED' | translate\">\r\n @for (field of advancedFields(); track field.key) {\r\n <div class=\"filter-field\" [class]=\"field.colClass ?? ''\" [class.filter-field-text]=\"isTextField(field)\">\r\n <ng-container\r\n [ngTemplateOutlet]=\"fieldTpl\"\r\n [ngTemplateOutletContext]=\"{ $implicit: field, control: getControl(field.key) }\">\r\n </ng-container>\r\n </div>\r\n }\r\n </div>\r\n }\r\n\r\n <!-- \u00C9tiquettes : seulement repli\u00E9, sinon doublon avec les champs avanc\u00E9s affich\u00E9s. -->\r\n @if (!advancedOpen() && advancedChips().length) {\r\n <ul class=\"filter-bar-chips list-unstyled d-flex-h flex-wrap gap-sm items-center\" [attr.aria-label]=\"'_COMMON._FILTER.ACTIVE' | translate\">\r\n @for (chip of advancedChips(); track chip.key) {\r\n <li class=\"badge badge-light-light d-flex-h items-center gap-5xs\">\r\n <span>\r\n {{ chip.label | translate }} : {{ chipText(chip) }}\r\n </span>\r\n <cw-button\r\n [label]=\"'_COMMON._FILTER.REMOVE'\"\r\n [labelParams]=\"{ label: (chip.label | translate), value: chipText(chip) }\"\r\n [type]=\"uiType.ghost\"\r\n [withIcon]=\"spriteIcon.close\"\r\n [withOnlyIcon]=\"true\"\r\n [iconSize]=\"iconSize.xsmall\"\r\n (btnAction)=\"removeAdvanced(chip.key)\">\r\n </cw-button>\r\n </li>\r\n }\r\n </ul>\r\n }\r\n</form>\r\n\r\n<!-- Addon gauche de la recherche unifi\u00E9e : loupe d\u00E9corative (le nom accessible reste le label du champ). -->\r\n<ng-template #searchIcon>\r\n <cw-icon [icon]=\"spriteIcon.search\" />\r\n</ng-template>\r\n\r\n<!-- Rendu d'un champ de filtre, partag\u00E9 par la barre et les champs avanc\u00E9s. -->\r\n<ng-template #fieldTpl let-field let-control=\"control\">\r\n @if (isSelect(field)) {\r\n <cw-filter-select\r\n [label]=\"field.label\"\r\n [options]=\"resolveOptions(field)\"\r\n [multiple]=\"isMultiple(field)\"\r\n [allLabel]=\"field.allLabel === undefined ? '_COMMON._FILTER.ALL' : field.allLabel\"\r\n [inputId]=\"fieldId(field.key)\"\r\n [control]=\"$any(control)\">\r\n </cw-filter-select>\r\n } @else {\r\n <cw-form-field\r\n [name]=\"fieldId(field.key)\"\r\n [label]=\"field.label\"\r\n [displayLabel]=\"isTextField(field)\"\r\n [fieldTitle]=\"isTextField(field) ? undefined : field.label\"\r\n [type]=\"field.type\"\r\n [placeholder]=\"field.placeholder ?? ''\"\r\n [options]=\"resolveOptions(field)\"\r\n [control]=\"control\">\r\n </cw-form-field>\r\n }\r\n</ng-template>\r\n", dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1$2.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1$2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1$2.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "ngmodule", type: TranslateModule }, { kind: "component", type: BadgeComponent, selector: "cw-badge", inputs: ["type", "label", "labelParams", "withIcon", "iconPosition", "cssClass", "skeletonMode", "dataTest"] }, { kind: "component", type: IconComponent, selector: "cw-icon", inputs: ["icon", "label", "type", "iconSize", "iconCssClass", "iconUiType", "iconColorCustom", "spritePath"] }, { kind: "component", type: FormFieldComponent, selector: "cw-form-field", inputs: ["control", "formGroup", "type", "label", "displayLabel", "fieldTitle", "name", "placeholder", "autocomplete", "options", "rangeOptions", "validationOptions", "autocompleteOptions", "richTextOptions", "errorMessages", "isRequired", "help", "tooltip", "ariaDescribedBy", "addonLeft", "addonRight", "isInAddon", "isReadonly", "isDisabled", "sliderValue", "sliderOptions", "cssClass", "skeletonMode", "clearable", "appendTo", "initialCountry", "recommendedDimensions", "showPreview", "existingFile", "indeterminate"], outputs: ["refreshEvent", "fileRemoved", "textChanged", "valueChange", "phoneRegionChange"] }, { kind: "component", type: FilterSelectComponent, selector: "cw-filter-select", inputs: ["control", "label", "options", "multiple", "allLabel", "inputId", "readonly", "appendTo"] }, { kind: "component", type: ButtonComponent, selector: "cw-button", inputs: ["type", "label", "labelParams", "id", "link", "isDropdown", "hideCaret", "withIcon", "withOnlyIcon", "iconSize", "iconPosition", "dropdownPosition", "isMinWidth", "isDisabled", "isLoading", "loadingAnnounce", "cssClass", "dataTest", "skeletonMode", "isPressed", "ariaDescribedBy", "ariaLabel", "ariaExpanded", "ariaControls", "withTooltip", "tooltipText", "tooltipTitle", "tooltipTrigger", "tooltipPosition", "tooltipType"], outputs: ["btnAction", "dropDownClicked"] }, { kind: "component", type: ColumnMenuComponent, selector: "cw-column-menu", inputs: ["columns", "storageKey", "label"], outputs: ["columnsChange"] }, { kind: "pipe", type: i1.TranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
1195
1638
|
}
|
|
1196
1639
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.20", ngImport: i0, type: FilterBarComponent, decorators: [{
|
|
1197
1640
|
type: Component,
|
|
1198
1641
|
args: [{ selector: 'cw-filter-bar', changeDetection: ChangeDetectionStrategy.OnPush, imports: [
|
|
1642
|
+
NgTemplateOutlet,
|
|
1199
1643
|
ReactiveFormsModule,
|
|
1644
|
+
TranslateModule,
|
|
1645
|
+
BadgeComponent,
|
|
1646
|
+
IconComponent,
|
|
1200
1647
|
FormFieldComponent,
|
|
1201
1648
|
FilterSelectComponent,
|
|
1202
|
-
ButtonComponent
|
|
1203
|
-
|
|
1204
|
-
|
|
1649
|
+
ButtonComponent,
|
|
1650
|
+
ColumnMenuComponent
|
|
1651
|
+
], template: "<!-- Cl\u00E9s i18n pass\u00E9es telles quelles : cw-form-field et cw-button traduisent label et placeholder eux-m\u00EAmes. -->\r\n<form [formGroup]=\"filterForm\" (ngSubmit)=\"apply()\" class=\"filter-bar d-flex-v gap-md\">\r\n <div class=\"d-flex-h gap-md items-start justify-between\">\r\n <div class=\"d-flex-h flex-wrap gap-md items-center\">\r\n @if (search(); as searchConfig) {\r\n <!-- Recherche unifi\u00E9e : remplace les champs list\u00E9s dans `search.fields`. Label masqu\u00E9\r\n (la loupe + le placeholder l'identifient visuellement) et repris en title au survol. -->\r\n <div class=\"filter-field\" [class]=\"searchConfig.colClass ?? ''\">\r\n <cw-form-field\r\n [name]=\"fieldId(searchKey())\"\r\n [label]=\"searchLabel()\"\r\n [displayLabel]=\"false\"\r\n [fieldTitle]=\"searchLabel()\"\r\n [type]=\"fieldType.text\"\r\n [placeholder]=\"searchConfig.placeholder ?? '_COMMON._FILTER.KEYWORDS'\"\r\n [addonLeft]=\"searchIcon\"\r\n [control]=\"getControl(searchKey())\">\r\n </cw-form-field>\r\n </div>\r\n }\r\n @for (field of barFields(); track field.key) {\r\n <div class=\"filter-field\" [class]=\"field.colClass ?? ''\" [class.filter-field-text]=\"isTextField(field)\">\r\n <ng-container\r\n [ngTemplateOutlet]=\"fieldTpl\"\r\n [ngTemplateOutletContext]=\"{ $implicit: field, control: getControl(field.key) }\">\r\n </ng-container>\r\n </div>\r\n }\r\n @if (advancedFields().length) {\r\n <div class=\"d-flex-h items-center gap-5xs\">\r\n <cw-button #advancedToggle\r\n [label]=\"advancedLabel()\"\r\n [type]=\"uiType.link\"\r\n [ariaExpanded]=\"advancedOpen()\"\r\n [ariaControls]=\"advancedPanelId\"\r\n [ariaLabel]=\"!advancedOpen() && advancedChips().length ? '_COMMON._FILTER.MORE_COUNT' : undefined\"\r\n [labelParams]=\"{ count: advancedChips().length }\"\r\n (btnAction)=\"toggleAdvanced()\">\r\n </cw-button>\r\n @if (!advancedOpen() && advancedChips().length; as count) {\r\n <!-- Compteur (repli\u00E9 seulement : d\u00E9pli\u00E9, les champs montrent d\u00E9j\u00E0 les valeurs) ;\r\n d\u00E9coratif : le nombre est dans le nom accessible du bouton (\u00AB Plus de filtres, 2 actifs \u00BB). -->\r\n <cw-badge [type]=\"badgeType.lightLight\" [label]=\"'' + count\" aria-hidden=\"true\" />\r\n }\r\n </div>\r\n }\r\n @if (hasFields()) {\r\n <div class=\"d-flex-h gap-md\">\r\n @if (manual()) {\r\n <cw-button\r\n [label]=\"applyLabel()\"\r\n [type]=\"uiType.link\"\r\n (btnAction)=\"apply()\">\r\n </cw-button>\r\n }\r\n <cw-button\r\n [label]=\"resetLabel()\"\r\n [type]=\"uiType.link\"\r\n (btnAction)=\"reset()\">\r\n </cw-button>\r\n </div>\r\n }\r\n </div>\r\n <!-- Menu \u00AB Colonnes \u00BB a droite ; ne s'affiche que si `columns` contient une colonne masquable. -->\r\n <cw-column-menu\r\n [columns]=\"columns()\"\r\n [storageKey]=\"columnsStorageKey()\"\r\n [label]=\"columnsLabel()\"\r\n (columnsChange)=\"columnsChange.emit($event)\">\r\n </cw-column-menu>\r\n </div>\r\n\r\n @if (advancedFields().length) {\r\n <!-- Champs avanc\u00E9s : appliqu\u00E9s comme ceux de la barre (\u00E0 la saisie, ou au bouton en mode manuel).\r\n Toujours dans le DOM (cible de aria-controls), masqu\u00E9s par `hidden` quand repli\u00E9s. -->\r\n <div class=\"d-flex-h flex-wrap gap-md\" role=\"group\" [id]=\"advancedPanelId\" [hidden]=\"!advancedOpen()\"\r\n [attr.aria-label]=\"'_COMMON._FILTER.ADVANCED' | translate\">\r\n @for (field of advancedFields(); track field.key) {\r\n <div class=\"filter-field\" [class]=\"field.colClass ?? ''\" [class.filter-field-text]=\"isTextField(field)\">\r\n <ng-container\r\n [ngTemplateOutlet]=\"fieldTpl\"\r\n [ngTemplateOutletContext]=\"{ $implicit: field, control: getControl(field.key) }\">\r\n </ng-container>\r\n </div>\r\n }\r\n </div>\r\n }\r\n\r\n <!-- \u00C9tiquettes : seulement repli\u00E9, sinon doublon avec les champs avanc\u00E9s affich\u00E9s. -->\r\n @if (!advancedOpen() && advancedChips().length) {\r\n <ul class=\"filter-bar-chips list-unstyled d-flex-h flex-wrap gap-sm items-center\" [attr.aria-label]=\"'_COMMON._FILTER.ACTIVE' | translate\">\r\n @for (chip of advancedChips(); track chip.key) {\r\n <li class=\"badge badge-light-light d-flex-h items-center gap-5xs\">\r\n <span>\r\n {{ chip.label | translate }} : {{ chipText(chip) }}\r\n </span>\r\n <cw-button\r\n [label]=\"'_COMMON._FILTER.REMOVE'\"\r\n [labelParams]=\"{ label: (chip.label | translate), value: chipText(chip) }\"\r\n [type]=\"uiType.ghost\"\r\n [withIcon]=\"spriteIcon.close\"\r\n [withOnlyIcon]=\"true\"\r\n [iconSize]=\"iconSize.xsmall\"\r\n (btnAction)=\"removeAdvanced(chip.key)\">\r\n </cw-button>\r\n </li>\r\n }\r\n </ul>\r\n }\r\n</form>\r\n\r\n<!-- Addon gauche de la recherche unifi\u00E9e : loupe d\u00E9corative (le nom accessible reste le label du champ). -->\r\n<ng-template #searchIcon>\r\n <cw-icon [icon]=\"spriteIcon.search\" />\r\n</ng-template>\r\n\r\n<!-- Rendu d'un champ de filtre, partag\u00E9 par la barre et les champs avanc\u00E9s. -->\r\n<ng-template #fieldTpl let-field let-control=\"control\">\r\n @if (isSelect(field)) {\r\n <cw-filter-select\r\n [label]=\"field.label\"\r\n [options]=\"resolveOptions(field)\"\r\n [multiple]=\"isMultiple(field)\"\r\n [allLabel]=\"field.allLabel === undefined ? '_COMMON._FILTER.ALL' : field.allLabel\"\r\n [inputId]=\"fieldId(field.key)\"\r\n [control]=\"$any(control)\">\r\n </cw-filter-select>\r\n } @else {\r\n <cw-form-field\r\n [name]=\"fieldId(field.key)\"\r\n [label]=\"field.label\"\r\n [displayLabel]=\"isTextField(field)\"\r\n [fieldTitle]=\"isTextField(field) ? undefined : field.label\"\r\n [type]=\"field.type\"\r\n [placeholder]=\"field.placeholder ?? ''\"\r\n [options]=\"resolveOptions(field)\"\r\n [control]=\"control\">\r\n </cw-form-field>\r\n }\r\n</ng-template>\r\n" }]
|
|
1652
|
+
}], ctorParameters: () => [], propDecorators: { filters: [{ type: i0.Input, args: [{ isSignal: true, alias: "filters", required: true }] }], search: [{ type: i0.Input, args: [{ isSignal: true, alias: "search", required: false }] }], manual: [{ type: i0.Input, args: [{ isSignal: true, alias: "manual", required: false }] }], syncUrl: [{ type: i0.Input, args: [{ isSignal: true, alias: "syncUrl", required: false }] }], applyLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "applyLabel", required: false }] }], resetLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "resetLabel", required: false }] }], columns: [{ type: i0.Input, args: [{ isSignal: true, alias: "columns", required: false }] }], columnsStorageKey: [{ type: i0.Input, args: [{ isSignal: true, alias: "columnsStorageKey", required: false }] }], columnsLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "columnsLabel", required: false }] }], filtersApplied: [{ type: i0.Output, args: ["filtersApplied"] }], filtersReset: [{ type: i0.Output, args: ["filtersReset"] }], columnsChange: [{ type: i0.Output, args: ["columnsChange"] }], advancedToggle: [{ type: i0.ViewChild, args: ['advancedToggle', { ...{ read: ElementRef }, isSignal: true }] }] } });
|
|
1205
1653
|
|
|
1206
1654
|
// Type nominal des cles de traduction, partage par tous les composants de la lib.
|
|
1207
1655
|
//
|
|
@@ -1384,7 +1832,7 @@ class ExportButtonComponent {
|
|
|
1384
1832
|
});
|
|
1385
1833
|
}
|
|
1386
1834
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.20", ngImport: i0, type: ExportButtonComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1387
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.20", type: ExportButtonComponent, isStandalone: true, selector: "cw-export-button", inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: true, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, errorKey: { classPropertyName: "errorKey", publicName: "errorKey", isSignal: true, isRequired: false, transformFunction: null }, successKey: { classPropertyName: "successKey", publicName: "successKey", isSignal: true, isRequired: false, transformFunction: null } }, host: { classAttribute: "cw-export-button" }, ngImport: i0, template: "@if (isMenu()) {\n <cw-button [type]=\"buttonType.secondary\" [label]=\"label()\" [isDropdown]=\"true\" [isDisabled]=\"allDisabled()\"\n [isLoading]=\"running()\" [loadingAnnounce]=\"false\">\n <!-- Motif documente de basic-ui : `<button cwDropdownItem>` en direct, et non un\n `cw-button` imbrique. La directive pose la classe `dropdown-item` sur la CIBLE du\n clic, seule condition pour que `cw-button` referme son menu apres la selection. -->\n <ul>\n @for (option of options(); track $index) {\n <li>\n <button type=\"button\" class=\"btn btn-ghost\" cwDropdownItem [disabled]=\"option.disabled\" (click)=\"run(option)\">\n {{ option.label | translate }}\n </button>\n </li>\n }\n </ul>\n </cw-button>\n} @else {\n <!-- Option unique : c'est le libelle de L'OPTION qui nomme le bouton, pas `label()`.\n L'inverse rendait `ExportOption.label` obligatoire mais mort dans ce mode \u2014 l'hote\n ecrivait un libelle qui n'apparaissait nulle part. `label()` reste le libelle du\n declencheur de MENU, ou les options sont nommees une a une. -->\n <cw-button [type]=\"buttonType.secondary\" [label]=\"options()[0].label\" [isDisabled]=\"!!options()[0].disabled\"\n [isLoading]=\"running()\" [loadingAnnounce]=\"false\" (btnAction)=\"run(options()[0])\">\n </cw-button>\n}\n\n<!-- Region live PERMANENTE : seul son contenu change. La creer et la detruire avec le\n message ferait manquer l'annonce aux technologies d'assistance, qui doivent avoir\n observe la region AVANT sa mise a jour. -->\n<span class=\"visually-hidden\" role=\"status\">\n @if (liveMessage(); as message) {\n {{ message.key | translate: message.params }}\n }\n</span>\n", dependencies: [{ kind: "component", type: ButtonComponent, selector: "cw-button", inputs: ["type", "label", "id", "link", "isDropdown", "hideCaret", "withIcon", "withOnlyIcon", "iconSize", "iconPosition", "dropdownPosition", "isMinWidth", "isDisabled", "isLoading", "loadingAnnounce", "cssClass", "dataTest", "skeletonMode", "isPressed", "ariaDescribedBy", "withTooltip", "tooltipText", "tooltipTitle", "tooltipTrigger", "tooltipPosition", "tooltipType"], outputs: ["btnAction", "dropDownClicked"] }, { kind: "directive", type: DropdownItemDirective, selector: "[cwDropdownItem]" }, { kind: "ngmodule", type: TranslateModule }, { kind: "pipe", type: i1.TranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
1835
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.20", type: ExportButtonComponent, isStandalone: true, selector: "cw-export-button", inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: true, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, errorKey: { classPropertyName: "errorKey", publicName: "errorKey", isSignal: true, isRequired: false, transformFunction: null }, successKey: { classPropertyName: "successKey", publicName: "successKey", isSignal: true, isRequired: false, transformFunction: null } }, host: { classAttribute: "cw-export-button" }, ngImport: i0, template: "@if (isMenu()) {\n <cw-button [type]=\"buttonType.secondary\" [label]=\"label()\" [isDropdown]=\"true\" [isDisabled]=\"allDisabled()\"\n [isLoading]=\"running()\" [loadingAnnounce]=\"false\">\n <!-- Motif documente de basic-ui : `<button cwDropdownItem>` en direct, et non un\n `cw-button` imbrique. La directive pose la classe `dropdown-item` sur la CIBLE du\n clic, seule condition pour que `cw-button` referme son menu apres la selection. -->\n <ul>\n @for (option of options(); track $index) {\n <li>\n <button type=\"button\" class=\"btn btn-ghost\" cwDropdownItem [disabled]=\"option.disabled\" (click)=\"run(option)\">\n {{ option.label | translate }}\n </button>\n </li>\n }\n </ul>\n </cw-button>\n} @else {\n <!-- Option unique : c'est le libelle de L'OPTION qui nomme le bouton, pas `label()`.\n L'inverse rendait `ExportOption.label` obligatoire mais mort dans ce mode \u2014 l'hote\n ecrivait un libelle qui n'apparaissait nulle part. `label()` reste le libelle du\n declencheur de MENU, ou les options sont nommees une a une. -->\n <cw-button [type]=\"buttonType.secondary\" [label]=\"options()[0].label\" [isDisabled]=\"!!options()[0].disabled\"\n [isLoading]=\"running()\" [loadingAnnounce]=\"false\" (btnAction)=\"run(options()[0])\">\n </cw-button>\n}\n\n<!-- Region live PERMANENTE : seul son contenu change. La creer et la detruire avec le\n message ferait manquer l'annonce aux technologies d'assistance, qui doivent avoir\n observe la region AVANT sa mise a jour. -->\n<span class=\"visually-hidden\" role=\"status\">\n @if (liveMessage(); as message) {\n {{ message.key | translate: message.params }}\n }\n</span>\n", dependencies: [{ kind: "component", type: ButtonComponent, selector: "cw-button", inputs: ["type", "label", "labelParams", "id", "link", "isDropdown", "hideCaret", "withIcon", "withOnlyIcon", "iconSize", "iconPosition", "dropdownPosition", "isMinWidth", "isDisabled", "isLoading", "loadingAnnounce", "cssClass", "dataTest", "skeletonMode", "isPressed", "ariaDescribedBy", "ariaLabel", "ariaExpanded", "ariaControls", "withTooltip", "tooltipText", "tooltipTitle", "tooltipTrigger", "tooltipPosition", "tooltipType"], outputs: ["btnAction", "dropDownClicked"] }, { kind: "directive", type: DropdownItemDirective, selector: "[cwDropdownItem]" }, { kind: "ngmodule", type: TranslateModule }, { kind: "pipe", type: i1.TranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
1388
1836
|
}
|
|
1389
1837
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.20", ngImport: i0, type: ExportButtonComponent, decorators: [{
|
|
1390
1838
|
type: Component,
|
|
@@ -2043,7 +2491,7 @@ class ImportWizardComponent {
|
|
|
2043
2491
|
}));
|
|
2044
2492
|
}
|
|
2045
2493
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.20", ngImport: i0, type: ImportWizardComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2046
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.20", type: ImportWizardComponent, isStandalone: true, selector: "cw-import-wizard", inputs: { config: { classPropertyName: "config", publicName: "config", isSignal: true, isRequired: true, transformFunction: null } }, outputs: { completed: "completed" }, host: { classAttribute: "cw-import-wizard" }, viewQueries: [{ propertyName: "panels", predicate: ["stepPanel"], descendants: true, read: CardComponent, isSignal: true }, { propertyName: "selectionTarget", first: true, predicate: ["selectionTarget"], descendants: true, isSignal: true }, { propertyName: "analysisStatus", first: true, predicate: ["analysisStatus"], descendants: true, isSignal: true }, { propertyName: "analysisOutcome", first: true, predicate: ["analysisOutcome"], descendants: true, isSignal: true }, { propertyName: "executionStatus", first: true, predicate: ["executionStatus"], descendants: true, isSignal: true }, { propertyName: "cancellingStatus", first: true, predicate: ["cancellingStatus"], descendants: true, isSignal: true }, { propertyName: "reportOutcome", first: true, predicate: ["reportOutcome"], descendants: true, isSignal: true }, { propertyName: "interruptedOutcome", first: true, predicate: ["interruptedOutcome"], descendants: true, isSignal: true }], ngImport: i0, template: "<!-- Pastille d'etape : icone ronde verte (terminee) / rouge (echec), sinon le numero.\r\n Rendue dans [header-start] pour etre AVANT le titre, comme sur les maquettes.\r\n Le numero seul n'etant pas parlant a l'oreille, le statut est double en visually-hidden --\r\n et c'est LUI qui distingue \u00AB en cours \u00BB de \u00AB a venir \u00BB pour qui ne voit pas la couleur. -->\r\n<ng-template #badge let-stepKey=\"stepKey\" let-number=\"number\">\r\n @if (stateOf(stepKey) === stepState.done) {\r\n <cw-icon [icon]=\"spriteIcon.check\" [type]=\"iconType.circular\" [iconSize]=\"iconSize['sm']\"\r\n [iconUiType]=\"iconUiType.success\" [label]=\"stepStatusLabel(stepKey) | translate\"></cw-icon>\r\n }\r\n @else if (stateOf(stepKey) === stepState.error) {\r\n <cw-icon [icon]=\"spriteIcon.close\" [type]=\"iconType.circular\" [iconSize]=\"iconSize['sm']\"\r\n [iconUiType]=\"iconUiType.danger\" [label]=\"stepStatusLabel(stepKey) | translate\"></cw-icon>\r\n }\r\n @else {\r\n <div class=\"icon-circular icon-circular-sm\" [class]=\"'icon-circular-' + badgeVariant(stepKey)\">\r\n <span aria-hidden=\"true\">{{ number }}</span>\r\n <span class=\"visually-hidden\">{{ stepStatusLabel(stepKey) | translate }}</span>\r\n </div>\r\n }\r\n</ng-template>\r\n\r\n<ng-template #counts let-rows=\"rows\">\r\n <ul class=\"list-unstyled d-flex-h gap-md\">\r\n @for (row of rows; track row.key) {\r\n <li>\r\n <span class=\"fs-lg fw-bold\" [class]=\"'text-' + row.tone\">{{ row.count }}</span> {{ row.key | translate: row.params }}\r\n </li>\r\n }\r\n </ul>\r\n</ng-template>\r\n\r\n<cw-accordion [closeOthers]=\"true\" [destroyOnHide]=\"false\">\r\n\r\n <!-- Etape 1 : fichier + type d'import -->\r\n <cw-card\r\n #stepPanel\r\n [title]=\"'_COMMON._IMPORT._STEP.SELECT'\"\r\n [collapseId]=\"'import-step-select'\"\r\n [collapsed]=\"!isPanelOpen(step.select)\"\r\n [collapseLocked]=\"stateOf(step.select) === stepState.done\"\r\n [disabled]=\"stateOf(step.select) === stepState.todo\"\r\n [collapseStretched]=\"false\">\r\n\r\n <ng-container ngProjectAs=\"[header-start]\">\r\n <ng-container *ngTemplateOutlet=\"badge; context: { stepKey: step.select, number: 1 }\"></ng-container>\r\n </ng-container>\r\n\r\n <div class=\"d-flex-v gap-md\">\r\n <div class=\"row\">\r\n <div class=\"col-lg-6\">\r\n <!-- Retour depuis une analyse non conforme : cible de focus. Le bouton qui declenche\r\n ce retour disparait avec le repli du panneau 2, le focus retomberait sur <body>. -->\r\n @if (selectionReopened()) {\r\n <h3 class=\"visually-hidden\" tabindex=\"-1\" #selectionTarget>\r\n {{ '_COMMON._IMPORT._A11Y.SELECTION' | translate }}\r\n </h3>\r\n }\r\n\r\n <cw-file-drop\r\n [formControl]=\"file\"\r\n [accept]=\"config().accept\"\r\n [acceptLabel]=\"config().acceptLabel\"\r\n [maxSizeMb]=\"maxSizeMb()\"\r\n [label]=\"'_COMMON._IMPORT.FILE_TO_IMPORT' | translate\">\r\n </cw-file-drop>\r\n\r\n @if (config().helpText; as helpText) {\r\n <p class=\"mt-2xs\">{{ helpText | translate }}</p>\r\n }\r\n </div>\r\n\r\n @if (config().templateFile) {\r\n <div class=\"col-lg-6\">\r\n <cw-card [type]=\"cardType.light\">\r\n <strong>{{ '_COMMON._IMPORT._TEMPLATE.TITLE' | translate }}</strong>\r\n <span>{{ '_COMMON._IMPORT._TEMPLATE.TEXT' | translate }}</span>\r\n <cw-file-to-download [attachments]=\"templateAttachments()\"></cw-file-to-download>\r\n </cw-card>\r\n </div>\r\n }\r\n </div>\r\n\r\n <!-- Mode IMPOSE : aucun champ, et pas davantage de ligne \u00AB Type d'import : ... \u00BB \u2014 la\r\n maquette ne rend que l'alerte de portee ci-dessous, qui informe deja du mode retenu.\r\n Le champ cle de rapprochement y est replie (voir l'alerte).\r\n Choix LIBRE : groupe radio, dont la selection est REQUISE (pas de preselection). -->\r\n @if (!isModeImposed()) {\r\n <cw-form-field\r\n [type]=\"fieldType.radio\"\r\n [control]=\"mode\"\r\n [name]=\"'importMode'\"\r\n [label]=\"'_COMMON._IMPORT._MODE.LABEL'\"\r\n [options]=\"modeOptions()\"\r\n [isRequired]=\"true\"\r\n [help]=\"selectedKeyFieldHint()\">\r\n </cw-form-field>\r\n }\r\n\r\n <!-- Portee du mode retenu (destructif ou non) : exigence SFD \u00AB l'utilisateur est\r\n informe du type d'import selectionne ou impose \u00BB. Rien tant qu'aucun mode n'est\r\n retenu : l'alerte ne decrit jamais un mode que l'utilisateur n'a pas choisi. -->\r\n @if (modeNotice(); as notice) {\r\n <cw-alert [type]=\"modeNoticeType()\">\r\n {{ notice.lead | translate }}\r\n @if (notice.items.length) {\r\n <ul class=\"mb-none\">\r\n @for (item of notice.items; track $index) {\r\n <li>{{ item | translate }}</li>\r\n }\r\n </ul>\r\n }\r\n <!-- Mode impose : l'alerte est le SEUL endroit qui reste pour dire sur quoi porte\r\n le rapprochement. En choix libre, c'est l'aide du groupe radio qui le porte. -->\r\n @if (isModeImposed() && selectedKeyFieldHint(); as keyFieldHint) {\r\n <p class=\"mb-none\">{{ keyFieldHint | translate }}</p>\r\n }\r\n </cw-alert>\r\n }\r\n\r\n <!-- Un bouton desactive muet est un cul-de-sac : ce texte dit ce qui manque, et il est\r\n place AVANT le bouton, seul chemin possible puisqu'un bouton desactive n'est pas\r\n focusable (donc pas d'aria-describedby exploitable). Pas de classe de couleur\r\n atenuee : c'est une information necessaire, elle garde le contraste du corps. -->\r\n <div class=\"d-flex-h justify-end gap-md\">\r\n @if (missingRequirementKey(); as missing) {\r\n <p class=\"mb-none fs-xs\">{{ missing | translate }}</p>\r\n }\r\n\r\n <cw-button\r\n [type]=\"buttonType.primary\"\r\n [label]=\"'_COMMON._IMPORT.CONTINUE'\"\r\n [dataTest]=\"'btn-import-continue'\"\r\n [isDisabled]=\"!canContinue()\"\r\n (btnAction)=\"continueToAnalysis()\">\r\n </cw-button>\r\n </div>\r\n </div>\r\n </cw-card>\r\n\r\n <!-- Etape 2 : analyse a blanc -->\r\n <cw-card\r\n #stepPanel\r\n [title]=\"'_COMMON._IMPORT._STEP.ANALYSIS'\"\r\n [collapseId]=\"'import-step-analysis'\"\r\n [collapsed]=\"!isPanelOpen(step.analysis)\"\r\n [collapseLocked]=\"stateOf(step.analysis) === stepState.done\"\r\n [disabled]=\"stateOf(step.analysis) === stepState.todo\"\r\n [collapseStretched]=\"false\">\r\n\r\n <ng-container ngProjectAs=\"[header-start]\">\r\n <ng-container *ngTemplateOutlet=\"badge; context: { stepKey: step.analysis, number: 2 }\"></ng-container>\r\n </ng-container>\r\n\r\n <div class=\"d-flex-v gap-md\">\r\n @if (analyzing()) {\r\n <!-- Cible de focus : ce texte EST le message d'etat, il est donc lu une fois et une\r\n seule (aucune region live en doublon). -->\r\n <span tabindex=\"-1\" #analysisStatus>{{ '_COMMON._IMPORT.ANALYSIS_IN_PROGRESS' | translate }}</span>\r\n }\r\n @else if (analysis(); as result) {\r\n <!-- Cible de focus a l'arrivee du resultat : libelle de section, pas une reprise du\r\n message, pour que la lecture enchaine sur l'alerte puis les compteurs. -->\r\n <h3 class=\"visually-hidden\" tabindex=\"-1\" #analysisOutcome>\r\n {{ '_COMMON._IMPORT._A11Y.ANALYSIS_RESULT' | translate }}\r\n </h3>\r\n\r\n @if (result.valid) {\r\n <cw-alert [type]=\"alertType.success\">\r\n {{ '_COMMON._IMPORT.ANALYSIS_OK' | translate }}\r\n </cw-alert>\r\n\r\n <!-- scope=list : previsualisation chiffree. scope=singleConfig : le message ci-dessus suffit. -->\r\n @if (isList() && previewRows().length) {\r\n <ng-container *ngTemplateOutlet=\"counts; context: { rows: previewRows() }\"></ng-container>\r\n }\r\n\r\n <div class=\"list-unstyled d-flex-h justify-end\">\r\n <cw-button\r\n [type]=\"buttonType.primary\"\r\n [label]=\"'_COMMON._IMPORT.START'\"\r\n [dataTest]=\"'btn-import-start'\"\r\n (btnAction)=\"startImport()\">\r\n </cw-button>\r\n </div>\r\n }\r\n @else {\r\n <cw-alert [type]=\"alertType.danger\">\r\n {{ '_COMMON._IMPORT.ANALYSIS_KO' | translate }}\r\n </cw-alert>\r\n\r\n @if (errorCountRow(); as errorCount) {\r\n <p class=\"mb-none\">\r\n <span class=\"fs-lg fw-bold\" [class]=\"'text-' + errorCount.tone\">{{ errorCount.count }}</span>\r\n {{ errorCount.key | translate }}\r\n </p>\r\n\r\n <!-- Une alerte par anomalie, et non une liste a puces : c'est le rendu de la\r\n maquette, et chaque message reste lisible isolement. -->\r\n @for (issue of errors(); track $index) {\r\n <cw-alert [type]=\"alertType.danger\">\r\n @if (issue.line !== undefined) {\r\n <strong>{{ '_COMMON._IMPORT.ERROR_LINE' | translate: { line: issue.line } }}</strong>\r\n }\r\n {{ issue.messageKey ? (issue.messageKey | translate: issue.messageParams) : issue.message }}\r\n </cw-alert>\r\n }\r\n }\r\n\r\n <div class=\"d-flex-h justify-end\">\r\n <cw-button\r\n [type]=\"buttonType.secondary\"\r\n [label]=\"'_COMMON._IMPORT.BACK_TO_SELECTION'\"\r\n [dataTest]=\"'btn-import-back'\"\r\n (btnAction)=\"backToSelection()\">\r\n </cw-button>\r\n </div>\r\n }\r\n }\r\n </div>\r\n </cw-card>\r\n\r\n <!-- Etape 3 : import -->\r\n <cw-card\r\n #stepPanel\r\n [title]=\"'_COMMON._IMPORT._STEP.EXECUTION'\"\r\n [collapseId]=\"'import-step-execution'\"\r\n [collapsed]=\"!isPanelOpen(step.execution)\"\r\n [disabled]=\"stateOf(step.execution) === stepState.todo\"\r\n [collapseStretched]=\"false\">\r\n\r\n <ng-container ngProjectAs=\"[header-start]\">\r\n <ng-container *ngTemplateOutlet=\"badge; context: { stepKey: step.execution, number: 3 }\"></ng-container>\r\n </ng-container>\r\n\r\n <div class=\"d-flex-v gap-md\">\r\n @if (isImporting) {\r\n <div class=\"d-flex-v gap-2xs\">\r\n <!-- Cible de focus. Le bouton \u00AB Arreter l'import \u00BB est le focusable suivant. -->\r\n <span tabindex=\"-1\" #executionStatus>{{ '_COMMON._IMPORT.IN_PROGRESS' | translate }}</span>\r\n @if (progress()?.remainingLabel; as remaining) {\r\n <span>{{ '_COMMON._IMPORT.REMAINING' | translate: { value: remaining } }}</span>\r\n }\r\n </div>\r\n\r\n <!-- Avancement connu => barre deterministe. Aucune progression recue => spinner\r\n indetermine, plutot qu'une barre figee a 0 %. La bascule se fait a la premiere\r\n emission `ImportProgress` : une source qui n'en emet jamais reste sur le spinner.\r\n `displayText` a false : le libelle \u00AB Import en cours \u00BB est deja au-dessus. -->\r\n @if (progress(); as current) {\r\n <cw-progress-bar\r\n [value]=\"current.percent\"\r\n [type]=\"progressType.information\"\r\n [label]=\"'_COMMON._IMPORT.IN_PROGRESS' | translate\">\r\n </cw-progress-bar>\r\n }\r\n @else {\r\n <cw-loader [size]=\"loaderSize.sm\" [displayText]=\"false\"></cw-loader>\r\n }\r\n\r\n <!-- Pas de bouton d'arret quand l'objet declare l'import non interruptible : un\r\n bouton qui ne peut rien arreter serait pire que son absence. -->\r\n @if (canInterrupt()) {\r\n <div class=\"d-flex-h justify-end\">\r\n <cw-button\r\n [type]=\"buttonType.dangerOutline\"\r\n [label]=\"'_COMMON._IMPORT.STOP'\"\r\n [dataTest]=\"'btn-import-stop'\"\r\n (btnAction)=\"stopImport()\">\r\n </cw-button>\r\n </div>\r\n }\r\n }\r\n @else if (cancelling()) {\r\n <!-- Annulation demandee au serveur, reponse en attente. Cible de focus. -->\r\n <span tabindex=\"-1\" #cancellingStatus>{{ '_COMMON._IMPORT.CANCELLING' | translate }}</span>\r\n\r\n <cw-loader [size]=\"loaderSize.sm\" [displayText]=\"false\"></cw-loader>\r\n\r\n <!-- Sortie de secours : aucun delai n'etant defendable depuis la lib, c'est\r\n l'utilisateur qui decide d'arreter d'attendre. Conclut en \u00AB etat incertain \u00BB. -->\r\n <div class=\"d-flex-h justify-end\">\r\n <cw-button\r\n [type]=\"buttonType.secondary\"\r\n [label]=\"'_COMMON._IMPORT.STOP_WAITING'\"\r\n [dataTest]=\"'btn-import-stop-waiting'\"\r\n (btnAction)=\"stopWaiting()\">\r\n </cw-button>\r\n </div>\r\n }\r\n @else if (interruptionMessageKey(); as interruptionMessage) {\r\n <h3 class=\"visually-hidden\" tabindex=\"-1\" #interruptedOutcome>\r\n {{ '_COMMON._IMPORT._A11Y.IMPORT_RESULT' | translate }}\r\n </h3>\r\n\r\n <cw-alert [type]=\"interruptionAlertType()\">\r\n {{ interruptionMessage | translate }}\r\n </cw-alert>\r\n }\r\n @else if (report(); as result) {\r\n <h3 class=\"visually-hidden\" tabindex=\"-1\" #reportOutcome>\r\n {{ '_COMMON._IMPORT._A11Y.IMPORT_RESULT' | translate }}\r\n </h3>\r\n\r\n @if (result.success) {\r\n <cw-alert [type]=\"alertType.success\">\r\n {{ '_COMMON._IMPORT.SUCCESS' | translate }}\r\n </cw-alert>\r\n\r\n @if (isList() && reportRows().length) {\r\n <ng-container *ngTemplateOutlet=\"counts; context: { rows: reportRows() }\"></ng-container>\r\n }\r\n }\r\n @else {\r\n <!-- Le message generique ne promet l'absence d'ecriture que si l'atomicite est\r\n declaree (cf. `failureMessageKey`). -->\r\n <cw-alert [type]=\"alertType.danger\">\r\n {{ result.errorMessage ?? (failureMessageKey() | translate) }}\r\n </cw-alert>\r\n }\r\n }\r\n </div>\r\n </cw-card>\r\n\r\n</cw-accordion>\r\n", dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1$2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "ngmodule", type: TranslateModule }, { kind: "component", type: AccordionComponent, selector: "cw-accordion", inputs: ["closeOthers", "allowMultiple", "destroyOnHide"], outputs: ["panelOpened", "panelClosed"] }, { kind: "component", type: AlertComponent, selector: "cw-alert", inputs: ["type", "title", "isDismissible", "cssClass", "dataTest"], outputs: ["close"] }, { kind: "component", type: ButtonComponent, selector: "cw-button", inputs: ["type", "label", "id", "link", "isDropdown", "hideCaret", "withIcon", "withOnlyIcon", "iconSize", "iconPosition", "dropdownPosition", "isMinWidth", "isDisabled", "isLoading", "loadingAnnounce", "cssClass", "dataTest", "skeletonMode", "isPressed", "ariaDescribedBy", "withTooltip", "tooltipText", "tooltipTitle", "tooltipTrigger", "tooltipPosition", "tooltipType"], outputs: ["btnAction", "dropDownClicked"] }, { kind: "component", type: CardComponent, selector: "cw-card", inputs: ["title", "subtitle", "truncateSubtitle", "type", "titleRank", "cssClass", "collapsible", "collapsed", "disabled", "collapseLocked", "collapseStretched", "collapseId", "destroyOnHide", "fullHeight"], outputs: ["collapsibleChange", "destroyOnHideChange", "collapseClicked"] }, { kind: "component", type: FileDropComponent, selector: "cw-file-drop", inputs: ["mode", "multiple", "maxFiles", "accept", "acceptLabel", "maxSizeMb", "recommendedDimensions", "label", "isDisabled", "errorMessage", "dataTest"], outputs: ["filesChange", "rejected", "retry"] }, { kind: "component", type: FileToDownloadComponent, selector: "cw-file-to-download", inputs: ["attachments"] }, { kind: "component", type: FormFieldComponent, selector: "cw-form-field", inputs: ["control", "formGroup", "type", "label", "displayLabel", "name", "placeholder", "autocomplete", "options", "rangeOptions", "validationOptions", "autocompleteOptions", "richTextOptions", "errorMessages", "isRequired", "help", "tooltip", "addonLeft", "addonRight", "isInAddon", "isReadonly", "isDisabled", "sliderValue", "sliderOptions", "cssClass", "skeletonMode", "clearable", "appendTo", "initialCountry", "recommendedDimensions", "showPreview", "existingFile", "indeterminate"], outputs: ["refreshEvent", "fileRemoved", "textChanged", "valueChange", "phoneRegionChange"] }, { kind: "component", type: IconComponent, selector: "cw-icon", inputs: ["icon", "label", "type", "iconSize", "iconCssClass", "iconUiType", "iconColorCustom", "spritePath"] }, { kind: "component", type: LoaderComponent, selector: "cw-loader", inputs: ["size", "displayText"] }, { kind: "component", type: ProgressBarComponent, selector: "cw-progress-bar", inputs: ["value", "max", "size", "type", "showValue", "label", "dataTest"] }, { kind: "pipe", type: i1.TranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
2494
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.20", type: ImportWizardComponent, isStandalone: true, selector: "cw-import-wizard", inputs: { config: { classPropertyName: "config", publicName: "config", isSignal: true, isRequired: true, transformFunction: null } }, outputs: { completed: "completed" }, host: { classAttribute: "cw-import-wizard" }, viewQueries: [{ propertyName: "panels", predicate: ["stepPanel"], descendants: true, read: CardComponent, isSignal: true }, { propertyName: "selectionTarget", first: true, predicate: ["selectionTarget"], descendants: true, isSignal: true }, { propertyName: "analysisStatus", first: true, predicate: ["analysisStatus"], descendants: true, isSignal: true }, { propertyName: "analysisOutcome", first: true, predicate: ["analysisOutcome"], descendants: true, isSignal: true }, { propertyName: "executionStatus", first: true, predicate: ["executionStatus"], descendants: true, isSignal: true }, { propertyName: "cancellingStatus", first: true, predicate: ["cancellingStatus"], descendants: true, isSignal: true }, { propertyName: "reportOutcome", first: true, predicate: ["reportOutcome"], descendants: true, isSignal: true }, { propertyName: "interruptedOutcome", first: true, predicate: ["interruptedOutcome"], descendants: true, isSignal: true }], ngImport: i0, template: "<!-- Pastille d'etape : icone ronde verte (terminee) / rouge (echec), sinon le numero.\r\n Rendue dans [header-start] pour etre AVANT le titre, comme sur les maquettes.\r\n Le numero seul n'etant pas parlant a l'oreille, le statut est double en visually-hidden --\r\n et c'est LUI qui distingue \u00AB en cours \u00BB de \u00AB a venir \u00BB pour qui ne voit pas la couleur. -->\r\n<ng-template #badge let-stepKey=\"stepKey\" let-number=\"number\">\r\n @if (stateOf(stepKey) === stepState.done) {\r\n <cw-icon [icon]=\"spriteIcon.check\" [type]=\"iconType.circular\" [iconSize]=\"iconSize['sm']\"\r\n [iconUiType]=\"iconUiType.success\" [label]=\"stepStatusLabel(stepKey) | translate\"></cw-icon>\r\n }\r\n @else if (stateOf(stepKey) === stepState.error) {\r\n <cw-icon [icon]=\"spriteIcon.close\" [type]=\"iconType.circular\" [iconSize]=\"iconSize['sm']\"\r\n [iconUiType]=\"iconUiType.danger\" [label]=\"stepStatusLabel(stepKey) | translate\"></cw-icon>\r\n }\r\n @else {\r\n <div class=\"icon-circular icon-circular-sm\" [class]=\"'icon-circular-' + badgeVariant(stepKey)\">\r\n <span aria-hidden=\"true\">{{ number }}</span>\r\n <span class=\"visually-hidden\">{{ stepStatusLabel(stepKey) | translate }}</span>\r\n </div>\r\n }\r\n</ng-template>\r\n\r\n<ng-template #counts let-rows=\"rows\">\r\n <ul class=\"list-unstyled d-flex-h gap-md\">\r\n @for (row of rows; track row.key) {\r\n <li>\r\n <span class=\"fs-lg fw-bold\" [class]=\"'text-' + row.tone\">{{ row.count }}</span> {{ row.key | translate: row.params }}\r\n </li>\r\n }\r\n </ul>\r\n</ng-template>\r\n\r\n<cw-accordion [closeOthers]=\"true\" [destroyOnHide]=\"false\">\r\n\r\n <!-- Etape 1 : fichier + type d'import -->\r\n <cw-card\r\n #stepPanel\r\n [title]=\"'_COMMON._IMPORT._STEP.SELECT'\"\r\n [collapseId]=\"'import-step-select'\"\r\n [collapsed]=\"!isPanelOpen(step.select)\"\r\n [collapseLocked]=\"stateOf(step.select) === stepState.done\"\r\n [disabled]=\"stateOf(step.select) === stepState.todo\"\r\n [collapseStretched]=\"false\">\r\n\r\n <ng-container ngProjectAs=\"[header-start]\">\r\n <ng-container *ngTemplateOutlet=\"badge; context: { stepKey: step.select, number: 1 }\"></ng-container>\r\n </ng-container>\r\n\r\n <div class=\"d-flex-v gap-md\">\r\n <div class=\"row\">\r\n <div class=\"col-lg-6\">\r\n <!-- Retour depuis une analyse non conforme : cible de focus. Le bouton qui declenche\r\n ce retour disparait avec le repli du panneau 2, le focus retomberait sur <body>. -->\r\n @if (selectionReopened()) {\r\n <h3 class=\"visually-hidden\" tabindex=\"-1\" #selectionTarget>\r\n {{ '_COMMON._IMPORT._A11Y.SELECTION' | translate }}\r\n </h3>\r\n }\r\n\r\n <cw-file-drop\r\n [formControl]=\"file\"\r\n [accept]=\"config().accept\"\r\n [acceptLabel]=\"config().acceptLabel\"\r\n [maxSizeMb]=\"maxSizeMb()\"\r\n [label]=\"'_COMMON._IMPORT.FILE_TO_IMPORT' | translate\">\r\n </cw-file-drop>\r\n\r\n @if (config().helpText; as helpText) {\r\n <p class=\"mt-2xs\">{{ helpText | translate }}</p>\r\n }\r\n </div>\r\n\r\n @if (config().templateFile) {\r\n <div class=\"col-lg-6\">\r\n <cw-card [type]=\"cardType.light\">\r\n <strong>{{ '_COMMON._IMPORT._TEMPLATE.TITLE' | translate }}</strong>\r\n <span>{{ '_COMMON._IMPORT._TEMPLATE.TEXT' | translate }}</span>\r\n <cw-file-to-download [attachments]=\"templateAttachments()\"></cw-file-to-download>\r\n </cw-card>\r\n </div>\r\n }\r\n </div>\r\n\r\n <!-- Mode IMPOSE : aucun champ, et pas davantage de ligne \u00AB Type d'import : ... \u00BB \u2014 la\r\n maquette ne rend que l'alerte de portee ci-dessous, qui informe deja du mode retenu.\r\n Le champ cle de rapprochement y est replie (voir l'alerte).\r\n Choix LIBRE : groupe radio, dont la selection est REQUISE (pas de preselection). -->\r\n @if (!isModeImposed()) {\r\n <cw-form-field\r\n [type]=\"fieldType.radio\"\r\n [control]=\"mode\"\r\n [name]=\"'importMode'\"\r\n [label]=\"'_COMMON._IMPORT._MODE.LABEL'\"\r\n [options]=\"modeOptions()\"\r\n [isRequired]=\"true\"\r\n [help]=\"selectedKeyFieldHint()\">\r\n </cw-form-field>\r\n }\r\n\r\n <!-- Portee du mode retenu (destructif ou non) : exigence SFD \u00AB l'utilisateur est\r\n informe du type d'import selectionne ou impose \u00BB. Rien tant qu'aucun mode n'est\r\n retenu : l'alerte ne decrit jamais un mode que l'utilisateur n'a pas choisi. -->\r\n @if (modeNotice(); as notice) {\r\n <cw-alert [type]=\"modeNoticeType()\">\r\n {{ notice.lead | translate }}\r\n @if (notice.items.length) {\r\n <ul class=\"mb-none\">\r\n @for (item of notice.items; track $index) {\r\n <li>{{ item | translate }}</li>\r\n }\r\n </ul>\r\n }\r\n <!-- Mode impose : l'alerte est le SEUL endroit qui reste pour dire sur quoi porte\r\n le rapprochement. En choix libre, c'est l'aide du groupe radio qui le porte. -->\r\n @if (isModeImposed() && selectedKeyFieldHint(); as keyFieldHint) {\r\n <p class=\"mb-none\">{{ keyFieldHint | translate }}</p>\r\n }\r\n </cw-alert>\r\n }\r\n\r\n <!-- Un bouton desactive muet est un cul-de-sac : ce texte dit ce qui manque, et il est\r\n place AVANT le bouton, seul chemin possible puisqu'un bouton desactive n'est pas\r\n focusable (donc pas d'aria-describedby exploitable). Pas de classe de couleur\r\n atenuee : c'est une information necessaire, elle garde le contraste du corps. -->\r\n <div class=\"d-flex-h justify-end gap-md\">\r\n @if (missingRequirementKey(); as missing) {\r\n <p class=\"mb-none fs-xs\">{{ missing | translate }}</p>\r\n }\r\n\r\n <cw-button\r\n [type]=\"buttonType.primary\"\r\n [label]=\"'_COMMON._IMPORT.CONTINUE'\"\r\n [dataTest]=\"'btn-import-continue'\"\r\n [isDisabled]=\"!canContinue()\"\r\n (btnAction)=\"continueToAnalysis()\">\r\n </cw-button>\r\n </div>\r\n </div>\r\n </cw-card>\r\n\r\n <!-- Etape 2 : analyse a blanc -->\r\n <cw-card\r\n #stepPanel\r\n [title]=\"'_COMMON._IMPORT._STEP.ANALYSIS'\"\r\n [collapseId]=\"'import-step-analysis'\"\r\n [collapsed]=\"!isPanelOpen(step.analysis)\"\r\n [collapseLocked]=\"stateOf(step.analysis) === stepState.done\"\r\n [disabled]=\"stateOf(step.analysis) === stepState.todo\"\r\n [collapseStretched]=\"false\">\r\n\r\n <ng-container ngProjectAs=\"[header-start]\">\r\n <ng-container *ngTemplateOutlet=\"badge; context: { stepKey: step.analysis, number: 2 }\"></ng-container>\r\n </ng-container>\r\n\r\n <div class=\"d-flex-v gap-md\">\r\n @if (analyzing()) {\r\n <!-- Cible de focus : ce texte EST le message d'etat, il est donc lu une fois et une\r\n seule (aucune region live en doublon). -->\r\n <span tabindex=\"-1\" #analysisStatus>{{ '_COMMON._IMPORT.ANALYSIS_IN_PROGRESS' | translate }}</span>\r\n }\r\n @else if (analysis(); as result) {\r\n <!-- Cible de focus a l'arrivee du resultat : libelle de section, pas une reprise du\r\n message, pour que la lecture enchaine sur l'alerte puis les compteurs. -->\r\n <h3 class=\"visually-hidden\" tabindex=\"-1\" #analysisOutcome>\r\n {{ '_COMMON._IMPORT._A11Y.ANALYSIS_RESULT' | translate }}\r\n </h3>\r\n\r\n @if (result.valid) {\r\n <cw-alert [type]=\"alertType.success\">\r\n {{ '_COMMON._IMPORT.ANALYSIS_OK' | translate }}\r\n </cw-alert>\r\n\r\n <!-- scope=list : previsualisation chiffree. scope=singleConfig : le message ci-dessus suffit. -->\r\n @if (isList() && previewRows().length) {\r\n <ng-container *ngTemplateOutlet=\"counts; context: { rows: previewRows() }\"></ng-container>\r\n }\r\n\r\n <div class=\"list-unstyled d-flex-h justify-end\">\r\n <cw-button\r\n [type]=\"buttonType.primary\"\r\n [label]=\"'_COMMON._IMPORT.START'\"\r\n [dataTest]=\"'btn-import-start'\"\r\n (btnAction)=\"startImport()\">\r\n </cw-button>\r\n </div>\r\n }\r\n @else {\r\n <cw-alert [type]=\"alertType.danger\">\r\n {{ '_COMMON._IMPORT.ANALYSIS_KO' | translate }}\r\n </cw-alert>\r\n\r\n @if (errorCountRow(); as errorCount) {\r\n <p class=\"mb-none\">\r\n <span class=\"fs-lg fw-bold\" [class]=\"'text-' + errorCount.tone\">{{ errorCount.count }}</span>\r\n {{ errorCount.key | translate }}\r\n </p>\r\n\r\n <!-- Une alerte par anomalie, et non une liste a puces : c'est le rendu de la\r\n maquette, et chaque message reste lisible isolement. -->\r\n @for (issue of errors(); track $index) {\r\n <cw-alert [type]=\"alertType.danger\">\r\n @if (issue.line !== undefined) {\r\n <strong>{{ '_COMMON._IMPORT.ERROR_LINE' | translate: { line: issue.line } }}</strong>\r\n }\r\n {{ issue.messageKey ? (issue.messageKey | translate: issue.messageParams) : issue.message }}\r\n </cw-alert>\r\n }\r\n }\r\n\r\n <div class=\"d-flex-h justify-end\">\r\n <cw-button\r\n [type]=\"buttonType.secondary\"\r\n [label]=\"'_COMMON._IMPORT.BACK_TO_SELECTION'\"\r\n [dataTest]=\"'btn-import-back'\"\r\n (btnAction)=\"backToSelection()\">\r\n </cw-button>\r\n </div>\r\n }\r\n }\r\n </div>\r\n </cw-card>\r\n\r\n <!-- Etape 3 : import -->\r\n <cw-card\r\n #stepPanel\r\n [title]=\"'_COMMON._IMPORT._STEP.EXECUTION'\"\r\n [collapseId]=\"'import-step-execution'\"\r\n [collapsed]=\"!isPanelOpen(step.execution)\"\r\n [disabled]=\"stateOf(step.execution) === stepState.todo\"\r\n [collapseStretched]=\"false\">\r\n\r\n <ng-container ngProjectAs=\"[header-start]\">\r\n <ng-container *ngTemplateOutlet=\"badge; context: { stepKey: step.execution, number: 3 }\"></ng-container>\r\n </ng-container>\r\n\r\n <div class=\"d-flex-v gap-md\">\r\n @if (isImporting) {\r\n <div class=\"d-flex-v gap-2xs\">\r\n <!-- Cible de focus. Le bouton \u00AB Arreter l'import \u00BB est le focusable suivant. -->\r\n <span tabindex=\"-1\" #executionStatus>{{ '_COMMON._IMPORT.IN_PROGRESS' | translate }}</span>\r\n @if (progress()?.remainingLabel; as remaining) {\r\n <span>{{ '_COMMON._IMPORT.REMAINING' | translate: { value: remaining } }}</span>\r\n }\r\n </div>\r\n\r\n <!-- Avancement connu => barre deterministe. Aucune progression recue => spinner\r\n indetermine, plutot qu'une barre figee a 0 %. La bascule se fait a la premiere\r\n emission `ImportProgress` : une source qui n'en emet jamais reste sur le spinner.\r\n `displayText` a false : le libelle \u00AB Import en cours \u00BB est deja au-dessus. -->\r\n @if (progress(); as current) {\r\n <cw-progress-bar\r\n [value]=\"current.percent\"\r\n [type]=\"progressType.information\"\r\n [label]=\"'_COMMON._IMPORT.IN_PROGRESS' | translate\">\r\n </cw-progress-bar>\r\n }\r\n @else {\r\n <cw-loader [size]=\"loaderSize.sm\" [displayText]=\"false\"></cw-loader>\r\n }\r\n\r\n <!-- Pas de bouton d'arret quand l'objet declare l'import non interruptible : un\r\n bouton qui ne peut rien arreter serait pire que son absence. -->\r\n @if (canInterrupt()) {\r\n <div class=\"d-flex-h justify-end\">\r\n <cw-button\r\n [type]=\"buttonType.dangerOutline\"\r\n [label]=\"'_COMMON._IMPORT.STOP'\"\r\n [dataTest]=\"'btn-import-stop'\"\r\n (btnAction)=\"stopImport()\">\r\n </cw-button>\r\n </div>\r\n }\r\n }\r\n @else if (cancelling()) {\r\n <!-- Annulation demandee au serveur, reponse en attente. Cible de focus. -->\r\n <span tabindex=\"-1\" #cancellingStatus>{{ '_COMMON._IMPORT.CANCELLING' | translate }}</span>\r\n\r\n <cw-loader [size]=\"loaderSize.sm\" [displayText]=\"false\"></cw-loader>\r\n\r\n <!-- Sortie de secours : aucun delai n'etant defendable depuis la lib, c'est\r\n l'utilisateur qui decide d'arreter d'attendre. Conclut en \u00AB etat incertain \u00BB. -->\r\n <div class=\"d-flex-h justify-end\">\r\n <cw-button\r\n [type]=\"buttonType.secondary\"\r\n [label]=\"'_COMMON._IMPORT.STOP_WAITING'\"\r\n [dataTest]=\"'btn-import-stop-waiting'\"\r\n (btnAction)=\"stopWaiting()\">\r\n </cw-button>\r\n </div>\r\n }\r\n @else if (interruptionMessageKey(); as interruptionMessage) {\r\n <h3 class=\"visually-hidden\" tabindex=\"-1\" #interruptedOutcome>\r\n {{ '_COMMON._IMPORT._A11Y.IMPORT_RESULT' | translate }}\r\n </h3>\r\n\r\n <cw-alert [type]=\"interruptionAlertType()\">\r\n {{ interruptionMessage | translate }}\r\n </cw-alert>\r\n }\r\n @else if (report(); as result) {\r\n <h3 class=\"visually-hidden\" tabindex=\"-1\" #reportOutcome>\r\n {{ '_COMMON._IMPORT._A11Y.IMPORT_RESULT' | translate }}\r\n </h3>\r\n\r\n @if (result.success) {\r\n <cw-alert [type]=\"alertType.success\">\r\n {{ '_COMMON._IMPORT.SUCCESS' | translate }}\r\n </cw-alert>\r\n\r\n @if (isList() && reportRows().length) {\r\n <ng-container *ngTemplateOutlet=\"counts; context: { rows: reportRows() }\"></ng-container>\r\n }\r\n }\r\n @else {\r\n <!-- Le message generique ne promet l'absence d'ecriture que si l'atomicite est\r\n declaree (cf. `failureMessageKey`). -->\r\n <cw-alert [type]=\"alertType.danger\">\r\n {{ result.errorMessage ?? (failureMessageKey() | translate) }}\r\n </cw-alert>\r\n }\r\n }\r\n </div>\r\n </cw-card>\r\n\r\n</cw-accordion>\r\n", dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1$2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "ngmodule", type: TranslateModule }, { kind: "component", type: AccordionComponent, selector: "cw-accordion", inputs: ["closeOthers", "allowMultiple", "destroyOnHide"], outputs: ["panelOpened", "panelClosed"] }, { kind: "component", type: AlertComponent, selector: "cw-alert", inputs: ["type", "title", "titleParams", "isDismissible", "cssClass", "dataTest", "live"], outputs: ["close"] }, { kind: "component", type: ButtonComponent, selector: "cw-button", inputs: ["type", "label", "labelParams", "id", "link", "isDropdown", "hideCaret", "withIcon", "withOnlyIcon", "iconSize", "iconPosition", "dropdownPosition", "isMinWidth", "isDisabled", "isLoading", "loadingAnnounce", "cssClass", "dataTest", "skeletonMode", "isPressed", "ariaDescribedBy", "ariaLabel", "ariaExpanded", "ariaControls", "withTooltip", "tooltipText", "tooltipTitle", "tooltipTrigger", "tooltipPosition", "tooltipType"], outputs: ["btnAction", "dropDownClicked"] }, { kind: "component", type: CardComponent, selector: "cw-card", inputs: ["title", "titleId", "subtitle", "truncateSubtitle", "type", "titleRank", "cssClass", "collapsible", "collapsed", "disabled", "collapseLocked", "collapseStretched", "collapseId", "destroyOnHide", "fullHeight"], outputs: ["collapsibleChange", "destroyOnHideChange", "collapseClicked"] }, { kind: "component", type: FileDropComponent, selector: "cw-file-drop", inputs: ["mode", "multiple", "maxFiles", "accept", "acceptLabel", "maxSizeMb", "recommendedDimensions", "label", "isDisabled", "errorMessage", "dataTest"], outputs: ["filesChange", "rejected", "retry"] }, { kind: "component", type: FileToDownloadComponent, selector: "cw-file-to-download", inputs: ["attachments"] }, { kind: "component", type: FormFieldComponent, selector: "cw-form-field", inputs: ["control", "formGroup", "type", "label", "displayLabel", "fieldTitle", "name", "placeholder", "autocomplete", "options", "rangeOptions", "validationOptions", "autocompleteOptions", "richTextOptions", "errorMessages", "isRequired", "help", "tooltip", "ariaDescribedBy", "addonLeft", "addonRight", "isInAddon", "isReadonly", "isDisabled", "sliderValue", "sliderOptions", "cssClass", "skeletonMode", "clearable", "appendTo", "initialCountry", "recommendedDimensions", "showPreview", "existingFile", "indeterminate"], outputs: ["refreshEvent", "fileRemoved", "textChanged", "valueChange", "phoneRegionChange"] }, { kind: "component", type: IconComponent, selector: "cw-icon", inputs: ["icon", "label", "type", "iconSize", "iconCssClass", "iconUiType", "iconColorCustom", "spritePath"] }, { kind: "component", type: LoaderComponent, selector: "cw-loader", inputs: ["size", "displayText"] }, { kind: "component", type: ProgressBarComponent, selector: "cw-progress-bar", inputs: ["value", "max", "size", "type", "showValue", "label", "dataTest"] }, { kind: "pipe", type: i1.TranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
2047
2495
|
}
|
|
2048
2496
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.20", ngImport: i0, type: ImportWizardComponent, decorators: [{
|
|
2049
2497
|
type: Component,
|
|
@@ -2117,7 +2565,7 @@ class ImportButtonComponent {
|
|
|
2117
2565
|
ref.result.then(emitClosed, emitClosed);
|
|
2118
2566
|
}
|
|
2119
2567
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.20", ngImport: i0, type: ImportButtonComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2120
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "20.3.20", type: ImportButtonComponent, isStandalone: true, selector: "cw-import-button", inputs: { config: { classPropertyName: "config", publicName: "config", isSignal: true, isRequired: true, transformFunction: null }, modalTitle: { classPropertyName: "modalTitle", publicName: "modalTitle", isSignal: true, isRequired: true, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { closed: "closed", completed: "completed" }, host: { classAttribute: "cw-import-button" }, viewQueries: [{ propertyName: "bodyTemplate", first: true, predicate: ["bodyTemplate"], descendants: true, isSignal: true }], ngImport: i0, template: "<cw-button [type]=\"buttonType.secondary\" [label]=\"label()\" [isDisabled]=\"disabled()\" (btnAction)=\"open()\">\n</cw-button>\n\n<!-- L'assistant n'est que le CORPS de la modale : titre, croix et bouton \u00AB Fermer \u00BB du\n pied viennent de `ModalsService`. Le composant ne ferme jamais la modale lui-meme. -->\n<ng-template #bodyTemplate>\n <cw-import-wizard [config]=\"config()\" (completed)=\"completed.emit($event)\"></cw-import-wizard>\n</ng-template>\n", dependencies: [{ kind: "component", type: ButtonComponent, selector: "cw-button", inputs: ["type", "label", "id", "link", "isDropdown", "hideCaret", "withIcon", "withOnlyIcon", "iconSize", "iconPosition", "dropdownPosition", "isMinWidth", "isDisabled", "isLoading", "loadingAnnounce", "cssClass", "dataTest", "skeletonMode", "isPressed", "ariaDescribedBy", "withTooltip", "tooltipText", "tooltipTitle", "tooltipTrigger", "tooltipPosition", "tooltipType"], outputs: ["btnAction", "dropDownClicked"] }, { kind: "component", type: ImportWizardComponent, selector: "cw-import-wizard", inputs: ["config"], outputs: ["completed"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
2568
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "20.3.20", type: ImportButtonComponent, isStandalone: true, selector: "cw-import-button", inputs: { config: { classPropertyName: "config", publicName: "config", isSignal: true, isRequired: true, transformFunction: null }, modalTitle: { classPropertyName: "modalTitle", publicName: "modalTitle", isSignal: true, isRequired: true, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { closed: "closed", completed: "completed" }, host: { classAttribute: "cw-import-button" }, viewQueries: [{ propertyName: "bodyTemplate", first: true, predicate: ["bodyTemplate"], descendants: true, isSignal: true }], ngImport: i0, template: "<cw-button [type]=\"buttonType.secondary\" [label]=\"label()\" [isDisabled]=\"disabled()\" (btnAction)=\"open()\">\n</cw-button>\n\n<!-- L'assistant n'est que le CORPS de la modale : titre, croix et bouton \u00AB Fermer \u00BB du\n pied viennent de `ModalsService`. Le composant ne ferme jamais la modale lui-meme. -->\n<ng-template #bodyTemplate>\n <cw-import-wizard [config]=\"config()\" (completed)=\"completed.emit($event)\"></cw-import-wizard>\n</ng-template>\n", dependencies: [{ kind: "component", type: ButtonComponent, selector: "cw-button", inputs: ["type", "label", "labelParams", "id", "link", "isDropdown", "hideCaret", "withIcon", "withOnlyIcon", "iconSize", "iconPosition", "dropdownPosition", "isMinWidth", "isDisabled", "isLoading", "loadingAnnounce", "cssClass", "dataTest", "skeletonMode", "isPressed", "ariaDescribedBy", "ariaLabel", "ariaExpanded", "ariaControls", "withTooltip", "tooltipText", "tooltipTitle", "tooltipTrigger", "tooltipPosition", "tooltipType"], outputs: ["btnAction", "dropDownClicked"] }, { kind: "component", type: ImportWizardComponent, selector: "cw-import-wizard", inputs: ["config"], outputs: ["completed"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
2121
2569
|
}
|
|
2122
2570
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.20", ngImport: i0, type: ImportButtonComponent, decorators: [{
|
|
2123
2571
|
type: Component,
|
|
@@ -2140,58 +2588,6 @@ var PageHeaderActionEnum;
|
|
|
2140
2588
|
PageHeaderActionEnum["reset"] = "reset";
|
|
2141
2589
|
})(PageHeaderActionEnum || (PageHeaderActionEnum = {}));
|
|
2142
2590
|
|
|
2143
|
-
// Persistance de la visibilite des colonnes de `cw-table` (pilotee par `cw-page-header`).
|
|
2144
|
-
// Une SEULE cle localStorage pour N tableaux : objet indexe par `storageKey`.
|
|
2145
|
-
// On ne stocke QUE les cles des colonnes MASQUEES (eviter de surcharger le localStorage).
|
|
2146
|
-
//
|
|
2147
|
-
// localStorage['cw-table-columns'] = {
|
|
2148
|
-
// "publictransport/events": ["col1", "col2"],
|
|
2149
|
-
// "users/list": ["createdAt"]
|
|
2150
|
-
// }
|
|
2151
|
-
const STORAGE_KEY = 'cw-table-columns';
|
|
2152
|
-
/** Acces localStorage tolerant (SSR / quota / mode prive) : ne jette jamais. */
|
|
2153
|
-
function readStore() {
|
|
2154
|
-
try {
|
|
2155
|
-
if (typeof localStorage === 'undefined')
|
|
2156
|
-
return {};
|
|
2157
|
-
const raw = localStorage.getItem(STORAGE_KEY);
|
|
2158
|
-
const parsed = raw ? JSON.parse(raw) : {};
|
|
2159
|
-
return parsed && typeof parsed === 'object' ? parsed : {};
|
|
2160
|
-
}
|
|
2161
|
-
catch {
|
|
2162
|
-
return {};
|
|
2163
|
-
}
|
|
2164
|
-
}
|
|
2165
|
-
/**
|
|
2166
|
-
* Cles des colonnes masquees memorisees pour ce tableau.
|
|
2167
|
-
* - `null` : aucune entree => l'utilisateur n'a jamais personnalise, on garde les defauts du config.
|
|
2168
|
-
* - `string[]` (meme vide) : etat autoritatif memorise (`[]` = tout visible, choisi par l'utilisateur).
|
|
2169
|
-
*/
|
|
2170
|
-
function loadHiddenColumns(storageKey) {
|
|
2171
|
-
if (!storageKey)
|
|
2172
|
-
return null;
|
|
2173
|
-
const entry = readStore()[storageKey];
|
|
2174
|
-
return Array.isArray(entry) ? entry : null;
|
|
2175
|
-
}
|
|
2176
|
-
/**
|
|
2177
|
-
* Memorise les cles des colonnes masquees pour ce tableau.
|
|
2178
|
-
* Ecrit toujours l'entree (meme vide) : sa presence marque « personnalise par l'utilisateur ».
|
|
2179
|
-
*/
|
|
2180
|
-
function saveHiddenColumns(storageKey, hiddenKeys) {
|
|
2181
|
-
if (!storageKey)
|
|
2182
|
-
return;
|
|
2183
|
-
try {
|
|
2184
|
-
if (typeof localStorage === 'undefined')
|
|
2185
|
-
return;
|
|
2186
|
-
const store = readStore();
|
|
2187
|
-
store[storageKey] = hiddenKeys;
|
|
2188
|
-
localStorage.setItem(STORAGE_KEY, JSON.stringify(store));
|
|
2189
|
-
}
|
|
2190
|
-
catch {
|
|
2191
|
-
/* localStorage indisponible : persistance silencieusement ignoree. */
|
|
2192
|
-
}
|
|
2193
|
-
}
|
|
2194
|
-
|
|
2195
2591
|
class PageHeaderComponent {
|
|
2196
2592
|
constructor() {
|
|
2197
2593
|
this.location = inject(Location);
|
|
@@ -2205,16 +2601,7 @@ class PageHeaderComponent {
|
|
|
2205
2601
|
this.isDisabled = input({}, ...(ngDevMode ? [{ debugName: "isDisabled" }] : []));
|
|
2206
2602
|
/** Opt-out du badge de portee, pour une page qui porte elle-meme sa portee. */
|
|
2207
2603
|
this.showScope = input(true, ...(ngDevMode ? [{ debugName: "showScope" }] : []));
|
|
2208
|
-
// --- Menu « Colonnes » -------------------------------------------------
|
|
2209
|
-
/** Colonnes du tableau associe. Fourni => le dropdown « Colonnes » apparait. */
|
|
2210
|
-
this.columns = input([], ...(ngDevMode ? [{ debugName: "columns" }] : []));
|
|
2211
|
-
/** Identifiant stable du tableau pour la persistance localStorage (ex. 'users/list'). */
|
|
2212
|
-
this.storageKey = input(...(ngDevMode ? [undefined, { debugName: "storageKey" }] : []));
|
|
2213
|
-
/** Cle i18n du libelle du bouton « Colonnes ». */
|
|
2214
|
-
this.columnsLabel = input('_COMMON._TABLE.COLUMNS', ...(ngDevMode ? [{ debugName: "columnsLabel" }] : []));
|
|
2215
2604
|
this.action = output();
|
|
2216
|
-
/** Emis quand la visibilite des colonnes change (colonnes avec `hidden` a jour). */
|
|
2217
|
-
this.columnsChange = output();
|
|
2218
2605
|
this.buttonType = BoButtonTypeEnum;
|
|
2219
2606
|
this.iconSize = ButtonIconSizeEnum;
|
|
2220
2607
|
this.spriteIcon = SpriteIconEnum;
|
|
@@ -2224,53 +2611,6 @@ class PageHeaderComponent {
|
|
|
2224
2611
|
this.showReset = computed(() => this.actions().includes(PageHeaderActionEnum.reset), ...(ngDevMode ? [{ debugName: "showReset" }] : []));
|
|
2225
2612
|
this.showAdd = computed(() => this.actions().includes(PageHeaderActionEnum.add), ...(ngDevMode ? [{ debugName: "showAdd" }] : []));
|
|
2226
2613
|
this.showSave = computed(() => this.actions().includes(PageHeaderActionEnum.save), ...(ngDevMode ? [{ debugName: "showSave" }] : []));
|
|
2227
|
-
/** Colonnes masquables (hors `actions` et hors `hideable === false`). */
|
|
2228
|
-
this.toggleableColumns = computed(() => this.columns().filter(c => c.type !== 'actions' && c.hideable !== false), ...(ngDevMode ? [{ debugName: "toggleableColumns" }] : []));
|
|
2229
|
-
/** Le dropdown « Colonnes » n'apparait que s'il existe au moins une colonne masquable. */
|
|
2230
|
-
this.showColumns = computed(() => this.toggleableColumns().length > 0, ...(ngDevMode ? [{ debugName: "showColumns" }] : []));
|
|
2231
|
-
/** Nombre de colonnes masquables actuellement visibles. */
|
|
2232
|
-
this.visibleToggleableCount = computed(() => this.toggleableColumns().filter(c => !c.hidden).length, ...(ngDevMode ? [{ debugName: "visibleToggleableCount" }] : []));
|
|
2233
|
-
// Reconciliation au 1er rendu (navigateur) : si un etat est memorise, il prime
|
|
2234
|
-
// sur les defauts du config et est emis une fois vers le parent.
|
|
2235
|
-
afterNextRender(() => this.applyStoredVisibility());
|
|
2236
|
-
}
|
|
2237
|
-
/** Une colonne visible est « la derniere » si la masquer laisserait 0 colonne visible. */
|
|
2238
|
-
isLastVisible(col) {
|
|
2239
|
-
return !col.hidden && this.visibleToggleableCount() <= 1;
|
|
2240
|
-
}
|
|
2241
|
-
/** Coche/decoche une colonne : applique le garde-fou, persiste et emet. */
|
|
2242
|
-
toggleColumn(col) {
|
|
2243
|
-
const willHide = !col.hidden;
|
|
2244
|
-
if (willHide && this.visibleToggleableCount() <= 1)
|
|
2245
|
-
return; // garde-fou : min 1 visible
|
|
2246
|
-
const updated = this.columns().map(c => (c.key === col.key ? { ...c, hidden: willHide } : c));
|
|
2247
|
-
this.persistAndEmit(updated);
|
|
2248
|
-
}
|
|
2249
|
-
applyStoredVisibility() {
|
|
2250
|
-
const key = this.storageKey();
|
|
2251
|
-
if (!key)
|
|
2252
|
-
return;
|
|
2253
|
-
const stored = loadHiddenColumns(key);
|
|
2254
|
-
if (!stored)
|
|
2255
|
-
return; // jamais personnalise -> on garde les `hidden` du config
|
|
2256
|
-
const hidden = new Set(stored);
|
|
2257
|
-
const reconciled = this.columns().map(c => c.type === 'actions' || c.hideable === false ? c : { ...c, hidden: hidden.has(c.key) });
|
|
2258
|
-
this.columnsChange.emit(this.ensureMinVisible(reconciled));
|
|
2259
|
-
}
|
|
2260
|
-
/** Garantit au moins une colonne masquable visible (re-affiche la 1re sinon). */
|
|
2261
|
-
ensureMinVisible(cols) {
|
|
2262
|
-
const toggleable = cols.filter(c => c.type !== 'actions' && c.hideable !== false);
|
|
2263
|
-
if (toggleable.length === 0 || toggleable.some(c => !c.hidden))
|
|
2264
|
-
return cols;
|
|
2265
|
-
const firstKey = toggleable[0].key;
|
|
2266
|
-
return cols.map(c => (c.key === firstKey ? { ...c, hidden: false } : c));
|
|
2267
|
-
}
|
|
2268
|
-
persistAndEmit(cols) {
|
|
2269
|
-
const hiddenKeys = cols
|
|
2270
|
-
.filter(c => c.hidden && c.type !== 'actions' && c.hideable !== false)
|
|
2271
|
-
.map(c => c.key);
|
|
2272
|
-
saveHiddenColumns(this.storageKey() ?? '', hiddenKeys);
|
|
2273
|
-
this.columnsChange.emit(cols);
|
|
2274
2614
|
}
|
|
2275
2615
|
goBack() {
|
|
2276
2616
|
this.location.back();
|
|
@@ -2285,7 +2625,7 @@ class PageHeaderComponent {
|
|
|
2285
2625
|
return !!this.isDisabled()[action];
|
|
2286
2626
|
}
|
|
2287
2627
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.20", ngImport: i0, type: PageHeaderComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2288
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.20", type: PageHeaderComponent, isStandalone: true, selector: "cw-page-header", inputs: { title: { classPropertyName: "title", publicName: "title", isSignal: true, isRequired: true, transformFunction: null }, description: { classPropertyName: "description", publicName: "description", isSignal: true, isRequired: false, transformFunction: null }, showBack: { classPropertyName: "showBack", publicName: "showBack", isSignal: true, isRequired: false, transformFunction: null }, actions: { classPropertyName: "actions", publicName: "actions", isSignal: true, isRequired: false, transformFunction: null }, isLoading: { classPropertyName: "isLoading", publicName: "isLoading", isSignal: true, isRequired: false, transformFunction: null }, isDisabled: { classPropertyName: "isDisabled", publicName: "isDisabled", isSignal: true, isRequired: false, transformFunction: null }, showScope: { classPropertyName: "showScope", publicName: "showScope", isSignal: true, isRequired: false, transformFunction: null }
|
|
2628
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.20", type: PageHeaderComponent, isStandalone: true, selector: "cw-page-header", inputs: { title: { classPropertyName: "title", publicName: "title", isSignal: true, isRequired: true, transformFunction: null }, description: { classPropertyName: "description", publicName: "description", isSignal: true, isRequired: false, transformFunction: null }, showBack: { classPropertyName: "showBack", publicName: "showBack", isSignal: true, isRequired: false, transformFunction: null }, actions: { classPropertyName: "actions", publicName: "actions", isSignal: true, isRequired: false, transformFunction: null }, isLoading: { classPropertyName: "isLoading", publicName: "isLoading", isSignal: true, isRequired: false, transformFunction: null }, isDisabled: { classPropertyName: "isDisabled", publicName: "isDisabled", isSignal: true, isRequired: false, transformFunction: null }, showScope: { classPropertyName: "showScope", publicName: "showScope", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { action: "action" }, ngImport: i0, template: "<div class=\"page-header d-flex-v gap-2xs\">\r\n @if (showBack()) {\r\n <cw-button [type]=\"buttonType.ghost\" [label]=\"'_COMMON._FORM.BACK'\" [withIcon]=\"spriteIcon.left1\"\r\n (btnAction)=\"goBack()\" />\r\n }\r\n <div class=\"d-flex-h gap-md items-start justify-between flex-wrap\">\r\n <div class=\"d-flex-v\">\r\n <!-- Badge de portee HORS du <h1> : le nom accessible du titre reste le titre. -->\r\n <div class=\"page-header-heading d-flex-h gap-sm flex-wrap items-center\">\r\n <h1 class=\"page-header-title\">{{ title() | translate}}</h1>\r\n @if (showScope() && pageScope(); as scope) {\r\n @if (scope.kind === 'instance') {\r\n <!-- Badge maison : structure `.badge` de basic-ui, couleurs et logo propres (cf. _page-header.scss). -->\r\n <span class=\"badge page-header-scope-instance\">\r\n @if (scope.imageUrl; as img) {\r\n <img class=\"page-header-scope-logo\" [src]=\"img\" alt=\"\" />\r\n } @else {\r\n <cw-icon [icon]=\"spriteIcon.poiCompany\" aria-hidden=\"true\" />\r\n }\r\n <span class=\"visually-hidden\">{{ '_COMMON._PAGE_SCOPE.INSTANCE_PREFIX' | translate }}</span>\r\n <span>{{ scope.label }}</span>\r\n </span>\r\n } @else {\r\n <cw-badge [type]=\"badgeType.lightInfo\" [label]=\"'_COMMON._PAGE_SCOPE.ALL_INSTANCES'\"\r\n [withIcon]=\"spriteIcon.mapWorld\" />\r\n }\r\n }\r\n </div>\r\n @if (description(); as desc) {\r\n <p class=\"fs-md page-header-description\" [innerHTML]=\"desc | translate\"></p>\r\n }\r\n </div>\r\n\r\n <div class=\"d-flex-v gap-2xs\">\r\n <div class=\"page-header-actions d-flex-h gap-md flex-wrap items-center justify-end\">\r\n <!-- Slot de l'import : `<cw-import-button cwPageHeaderImport \u2026>`. Projete plutot que\r\n rendu, pour que `cw-page-header` ne reference pas `cw-import-wizard`. -->\r\n <ng-content select=\"[cwPageHeaderImport]\"></ng-content>\r\n\r\n <!-- Slot de l'export : `<cw-export-button cwPageHeaderExport \u2026>`. -->\r\n <ng-content select=\"[cwPageHeaderExport]\"></ng-content>\r\n\r\n <!-- Slot libre, inchange : tout ce qui n'est marque ni import ni export atterrit ici.\r\n C'est l'echappatoire d'un hote qui veut piloter son propre bouton. -->\r\n <ng-content></ng-content>\r\n\r\n @if (showReset()) {\r\n <cw-button [type]=\"buttonType.secondary\" [label]=\"'_COMMON._ACTION.RESET'\"\r\n [isDisabled]=\"disabled(actionEnum.reset)\" [isLoading]=\"loading(actionEnum.reset)\"\r\n (btnAction)=\"emit(actionEnum.reset)\">\r\n </cw-button>\r\n }\r\n\r\n @if (showAdd()) {\r\n <cw-button [type]=\"buttonType.primary\" [label]=\"'_COMMON._ACTION.ADD'\" [withIcon]=\"spriteIcon.add\"\r\n [isDisabled]=\"disabled(actionEnum.add)\" [isLoading]=\"loading(actionEnum.add)\"\r\n (btnAction)=\"emit(actionEnum.add)\">\r\n </cw-button>\r\n }\r\n\r\n @if (showSave()) {\r\n <cw-button [type]=\"buttonType.primary\" [label]=\"'_COMMON._ACTION.SAVE'\" [isDisabled]=\"disabled(actionEnum.save)\"\r\n [isLoading]=\"loading(actionEnum.save)\" (btnAction)=\"emit(actionEnum.save)\">\r\n </cw-button>\r\n }\r\n </div>\r\n </div>\r\n </div>\r\n\r\n</div>\r\n", dependencies: [{ kind: "component", type: BadgeComponent, selector: "cw-badge", inputs: ["type", "label", "labelParams", "withIcon", "iconPosition", "cssClass", "skeletonMode", "dataTest"] }, { kind: "component", type: ButtonComponent, selector: "cw-button", inputs: ["type", "label", "labelParams", "id", "link", "isDropdown", "hideCaret", "withIcon", "withOnlyIcon", "iconSize", "iconPosition", "dropdownPosition", "isMinWidth", "isDisabled", "isLoading", "loadingAnnounce", "cssClass", "dataTest", "skeletonMode", "isPressed", "ariaDescribedBy", "ariaLabel", "ariaExpanded", "ariaControls", "withTooltip", "tooltipText", "tooltipTitle", "tooltipTrigger", "tooltipPosition", "tooltipType"], outputs: ["btnAction", "dropDownClicked"] }, { kind: "component", type: IconComponent, selector: "cw-icon", inputs: ["icon", "label", "type", "iconSize", "iconCssClass", "iconUiType", "iconColorCustom", "spritePath"] }, { kind: "ngmodule", type: TranslateModule }, { kind: "pipe", type: i1.TranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
2289
2629
|
}
|
|
2290
2630
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.20", ngImport: i0, type: PageHeaderComponent, decorators: [{
|
|
2291
2631
|
type: Component,
|
|
@@ -2294,8 +2634,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.20", ngImpo
|
|
|
2294
2634
|
ButtonComponent,
|
|
2295
2635
|
IconComponent,
|
|
2296
2636
|
TranslateModule
|
|
2297
|
-
], template: "<div class=\"page-header d-flex-v gap-2xs\">\r\n @if (showBack()) {\r\n <cw-button [type]=\"buttonType.ghost\" [label]=\"'_COMMON._FORM.BACK'\" [withIcon]=\"spriteIcon.left1\"\r\n (btnAction)=\"goBack()\" />\r\n }\r\n <div class=\"d-flex-h gap-md items-start justify-between flex-wrap\">\r\n <div class=\"d-flex-v\">\r\n <!-- Badge de portee HORS du <h1> : le nom accessible du titre reste le titre. -->\r\n <div class=\"page-header-heading d-flex-h gap-sm flex-wrap items-center\">\r\n <h1 class=\"page-header-title\">{{ title() | translate}}</h1>\r\n @if (showScope() && pageScope(); as scope) {\r\n @if (scope.kind === 'instance') {\r\n <!-- Badge maison : structure `.badge` de basic-ui, couleurs et logo propres (cf. _page-header.scss). -->\r\n <span class=\"badge page-header-scope-instance\">\r\n @if (scope.imageUrl; as img) {\r\n <img class=\"page-header-scope-logo\" [src]=\"img\" alt=\"\" />\r\n } @else {\r\n <cw-icon [icon]=\"spriteIcon.poiCompany\" aria-hidden=\"true\" />\r\n }\r\n <span class=\"visually-hidden\">{{ '_COMMON._PAGE_SCOPE.INSTANCE_PREFIX' | translate }}</span>\r\n <span>{{ scope.label }}</span>\r\n </span>\r\n } @else {\r\n <cw-badge [type]=\"badgeType.lightInfo\" [label]=\"'_COMMON._PAGE_SCOPE.ALL_INSTANCES'\"\r\n [withIcon]=\"spriteIcon.mapWorld\" />\r\n }\r\n }\r\n </div>\r\n @if (description(); as desc) {\r\n <p class=\"fs-md page-header-description\" [innerHTML]=\"desc | translate\"></p>\r\n }\r\n </div>\r\n\r\n <div class=\"d-flex-v gap-2xs\">\r\n <div class=\"page-header-actions d-flex-h gap-md flex-wrap items-center justify-end\">\r\n
|
|
2298
|
-
}],
|
|
2637
|
+
], template: "<div class=\"page-header d-flex-v gap-2xs\">\r\n @if (showBack()) {\r\n <cw-button [type]=\"buttonType.ghost\" [label]=\"'_COMMON._FORM.BACK'\" [withIcon]=\"spriteIcon.left1\"\r\n (btnAction)=\"goBack()\" />\r\n }\r\n <div class=\"d-flex-h gap-md items-start justify-between flex-wrap\">\r\n <div class=\"d-flex-v\">\r\n <!-- Badge de portee HORS du <h1> : le nom accessible du titre reste le titre. -->\r\n <div class=\"page-header-heading d-flex-h gap-sm flex-wrap items-center\">\r\n <h1 class=\"page-header-title\">{{ title() | translate}}</h1>\r\n @if (showScope() && pageScope(); as scope) {\r\n @if (scope.kind === 'instance') {\r\n <!-- Badge maison : structure `.badge` de basic-ui, couleurs et logo propres (cf. _page-header.scss). -->\r\n <span class=\"badge page-header-scope-instance\">\r\n @if (scope.imageUrl; as img) {\r\n <img class=\"page-header-scope-logo\" [src]=\"img\" alt=\"\" />\r\n } @else {\r\n <cw-icon [icon]=\"spriteIcon.poiCompany\" aria-hidden=\"true\" />\r\n }\r\n <span class=\"visually-hidden\">{{ '_COMMON._PAGE_SCOPE.INSTANCE_PREFIX' | translate }}</span>\r\n <span>{{ scope.label }}</span>\r\n </span>\r\n } @else {\r\n <cw-badge [type]=\"badgeType.lightInfo\" [label]=\"'_COMMON._PAGE_SCOPE.ALL_INSTANCES'\"\r\n [withIcon]=\"spriteIcon.mapWorld\" />\r\n }\r\n }\r\n </div>\r\n @if (description(); as desc) {\r\n <p class=\"fs-md page-header-description\" [innerHTML]=\"desc | translate\"></p>\r\n }\r\n </div>\r\n\r\n <div class=\"d-flex-v gap-2xs\">\r\n <div class=\"page-header-actions d-flex-h gap-md flex-wrap items-center justify-end\">\r\n <!-- Slot de l'import : `<cw-import-button cwPageHeaderImport \u2026>`. Projete plutot que\r\n rendu, pour que `cw-page-header` ne reference pas `cw-import-wizard`. -->\r\n <ng-content select=\"[cwPageHeaderImport]\"></ng-content>\r\n\r\n <!-- Slot de l'export : `<cw-export-button cwPageHeaderExport \u2026>`. -->\r\n <ng-content select=\"[cwPageHeaderExport]\"></ng-content>\r\n\r\n <!-- Slot libre, inchange : tout ce qui n'est marque ni import ni export atterrit ici.\r\n C'est l'echappatoire d'un hote qui veut piloter son propre bouton. -->\r\n <ng-content></ng-content>\r\n\r\n @if (showReset()) {\r\n <cw-button [type]=\"buttonType.secondary\" [label]=\"'_COMMON._ACTION.RESET'\"\r\n [isDisabled]=\"disabled(actionEnum.reset)\" [isLoading]=\"loading(actionEnum.reset)\"\r\n (btnAction)=\"emit(actionEnum.reset)\">\r\n </cw-button>\r\n }\r\n\r\n @if (showAdd()) {\r\n <cw-button [type]=\"buttonType.primary\" [label]=\"'_COMMON._ACTION.ADD'\" [withIcon]=\"spriteIcon.add\"\r\n [isDisabled]=\"disabled(actionEnum.add)\" [isLoading]=\"loading(actionEnum.add)\"\r\n (btnAction)=\"emit(actionEnum.add)\">\r\n </cw-button>\r\n }\r\n\r\n @if (showSave()) {\r\n <cw-button [type]=\"buttonType.primary\" [label]=\"'_COMMON._ACTION.SAVE'\" [isDisabled]=\"disabled(actionEnum.save)\"\r\n [isLoading]=\"loading(actionEnum.save)\" (btnAction)=\"emit(actionEnum.save)\">\r\n </cw-button>\r\n }\r\n </div>\r\n </div>\r\n </div>\r\n\r\n</div>\r\n" }]
|
|
2638
|
+
}], propDecorators: { title: [{ type: i0.Input, args: [{ isSignal: true, alias: "title", required: true }] }], description: [{ type: i0.Input, args: [{ isSignal: true, alias: "description", required: false }] }], showBack: [{ type: i0.Input, args: [{ isSignal: true, alias: "showBack", required: false }] }], actions: [{ type: i0.Input, args: [{ isSignal: true, alias: "actions", required: false }] }], isLoading: [{ type: i0.Input, args: [{ isSignal: true, alias: "isLoading", required: false }] }], isDisabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "isDisabled", required: false }] }], showScope: [{ type: i0.Input, args: [{ isSignal: true, alias: "showScope", required: false }] }], action: [{ type: i0.Output, args: ["action"] }] } });
|
|
2299
2639
|
|
|
2300
2640
|
class WizardStepComponent {
|
|
2301
2641
|
constructor() {
|
|
@@ -2422,5 +2762,5 @@ function buildFilterParams(filters, keyMap) {
|
|
|
2422
2762
|
* Generated bundle index. Do not edit.
|
|
2423
2763
|
*/
|
|
2424
2764
|
|
|
2425
|
-
export { ArrayAdapter, CW_PAGE_SCOPE, CustomListComponent, DragNDropListComponent, DragNDropNestedListComponent, ExportButtonComponent, FILTER_ALL_VALUE, FilterBarComponent, FilterSelectComponent, FormArrayAdapter, IMPORT_WIZARD_STEPS, ImportButtonComponent, ImportEventKindEnum, ImportInterruptionEnum, ImportInterruptionStateEnum, ImportModeEnum, ImportObjectGenderEnum, ImportScopeEnum, ImportWizardComponent, ImportWizardStepEnum, ImportWizardStepStateEnum, PageHeaderActionEnum, PageHeaderComponent, PaginationComponent, ProgressBarComponent, ProgressBarSizeEnum, ProgressBarTypeEnum, TableComponent, WizardStepComponent, WizardStepperComponent, buildFilename, buildFilterParams, downloadBlob, formatCount, i18nKey, importWizardStepRank, jsonBlob, loadHiddenColumns, pluralizedCountKey, provideCwPageScope, saveHiddenColumns, todayIsoDate };
|
|
2765
|
+
export { ArrayAdapter, CW_PAGE_SCOPE, CustomListComponent, DragNDropListComponent, DragNDropNestedListComponent, ExportButtonComponent, FILTER_ALL_VALUE, FILTER_SEARCH_DEFAULT_KEY, FilterBarComponent, FilterSelectComponent, FormArrayAdapter, IMPORT_WIZARD_STEPS, ImportButtonComponent, ImportEventKindEnum, ImportInterruptionEnum, ImportInterruptionStateEnum, ImportModeEnum, ImportObjectGenderEnum, ImportScopeEnum, ImportWizardComponent, ImportWizardStepEnum, ImportWizardStepStateEnum, PageHeaderActionEnum, PageHeaderComponent, PaginationComponent, ProgressBarComponent, ProgressBarSizeEnum, ProgressBarTypeEnum, TableComponent, WizardStepComponent, WizardStepperComponent, buildFilename, buildFilterParams, clearHiddenColumns, downloadBlob, formatCount, i18nKey, importWizardStepRank, jsonBlob, loadHiddenColumns, pluralizedCountKey, provideCwPageScope, saveHiddenColumns, todayIsoDate };
|
|
2426
2766
|
//# sourceMappingURL=cityway-bo-ui.mjs.map
|