@dsivd/prestations-ng 14.5.23-beta2 → 14.5.23-beta5

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.
@@ -1448,12 +1448,8 @@ const DEFAULT_DICTIONARY = {
1448
1448
  'foehn-status-progress-bar.step3': 'Confirmation',
1449
1449
  'foehn-status-progress-bar.step3.srOnly': 'Etape 3 sur 3, Confirmation, demande transmise',
1450
1450
  'foehn-multiselect-autocomplete.selected.delete': 'Supprimer {elementLabel}',
1451
- 'foehn-multiselect-autocomplete.selected.delete.aria-label': 'Supprimer {elementLabel} de la liste intitulée: {componentLabel}',
1452
- 'foehn-multiselect-autocomplete.selected.screen-reader.default-value': 'Élément sélectionné par défaut non supprimable :',
1453
- 'foehn-multiselect-autocomplete.selected.screen-reader.selected-value': 'Élément sélectionné:',
1454
- 'foehn-multiselect-autocomplete.list-of-selected-items': 'Liste des éléments sélectionnés:',
1455
- 'foehn-multiselect-autocomplete.list-of-selected-items.screen-reader.helper': 'En mode application, Utilisez les flèches ' +
1456
- 'gauche et droite pour naviguer dans la liste.',
1451
+ 'foehn-multiselect-autocomplete.sr-announcement.deleted': '{elementLabel} a été supprimé, ',
1452
+ 'foehn-multiselect-autocomplete.sr-announcement.added': '{elementLabel} a été ajouté, ',
1457
1453
  'foehn-multiselect-autocomplete.autocomplete.empty-message': 'Tous les éléments de la liste de proposition ont déjà été ajoutés.',
1458
1454
  'foehn-multiselect-autocomplete.autocomplete.screen-reader.label': 'Sélectionner un élément dans la liste de recherche' +
1459
1455
  ' ci-dessous pour l\'ajouter à votre sélection.'
@@ -7822,7 +7818,7 @@ class FoehnMultiselectAutocompleteComponent extends FoehnAutocompleteComponent {
7822
7818
  super(ngZone);
7823
7819
  this.dictionaryService = dictionaryService;
7824
7820
  this.showEmptyListMessage = false;
7825
- this.keyboardNavigationAllowed = false;
7821
+ this.srAnnouncements = '';
7826
7822
  }
7827
7823
  set defaultElementValues(items) {
7828
7824
  this.defaultElementValues_ = [...items];
@@ -7836,11 +7832,6 @@ class FoehnMultiselectAutocompleteComponent extends FoehnAutocompleteComponent {
7836
7832
  set defaultElementValue(item) {
7837
7833
  this.defaultElementValues = [item];
7838
7834
  }
7839
- handleKeyboardDownEvent(event) {
7840
- if (this.keyboardNavigationAllowed) {
7841
- this.onKeyDownSelectedInner(event);
7842
- }
7843
- }
7844
7835
  updateMultiselectAutocomplete() {
7845
7836
  const validValue = this.getValidValue();
7846
7837
  if (typeof validValue !== 'undefined') {
@@ -7864,6 +7855,7 @@ class FoehnMultiselectAutocompleteComponent extends FoehnAutocompleteComponent {
7864
7855
  this.updateMultiselectAutocomplete();
7865
7856
  this.handleUserInput();
7866
7857
  this.manageSuggestionListAndFocusAfterAddingAnItem();
7858
+ this.manageScreenReaderAnnouncement(item, false);
7867
7859
  }
7868
7860
  }
7869
7861
  }
@@ -7873,6 +7865,7 @@ class FoehnMultiselectAutocompleteComponent extends FoehnAutocompleteComponent {
7873
7865
  this.model.splice(index, 1);
7874
7866
  this.triggerUserInput(this.model);
7875
7867
  this.manageSuggestionListAndFocusAfterRemovingAnItem();
7868
+ this.manageScreenReaderAnnouncement(item, true);
7876
7869
  }
7877
7870
  }
7878
7871
  trackByFn(index) {
@@ -7883,29 +7876,9 @@ class FoehnMultiselectAutocompleteComponent extends FoehnAutocompleteComponent {
7883
7876
  const elem = this.findElementByModelItem(value);
7884
7877
  return super.getLabel(elem);
7885
7878
  }
7886
- getSelectedElementTabIndex(index) {
7887
- let firstIndexFocusable = 0;
7888
- if (!!this.defaultElementValues) {
7889
- firstIndexFocusable = this.model.findIndex((selected) => !this.defaultElementValues.includes(selected));
7890
- }
7891
- if (index !== firstIndexFocusable) {
7892
- return -1;
7893
- }
7894
- return 0;
7895
- }
7896
- isSelectedItemFocusable(index) {
7897
- return !this.disabled && !!this.defaultElementValues && this.defaultElementValues.includes(this.model[index]);
7898
- }
7899
7879
  canBeDeleted(index) {
7900
7880
  return !this.defaultElementValues || !this.defaultElementValues.includes(this.model[index]);
7901
7881
  }
7902
- onSelectedItemsFocusin() {
7903
- this.keyboardNavigationAllowed = true;
7904
- this.currentFocusedElem = document.activeElement;
7905
- }
7906
- onSelectedItemsFocusout() {
7907
- this.keyboardNavigationAllowed = false;
7908
- }
7909
7882
  onAutocompleteElementsLoaded(elements) {
7910
7883
  // Need to wait for childView to be loaded
7911
7884
  setTimeout(() => {
@@ -7918,10 +7891,7 @@ class FoehnMultiselectAutocompleteComponent extends FoehnAutocompleteComponent {
7918
7891
  });
7919
7892
  }
7920
7893
  getDeleteButtonAriaLabel(element) {
7921
- return `${this.dictionaryService.getKeySync('foehn-multiselect-autocomplete.selected.delete.aria-label', { elementLabel: this.getLabel(element), componentLabel: this.label })}`;
7922
- }
7923
- getSelectedListAriaLabel() {
7924
- return `${this.label}: ${this.dictionaryService.getKeySync('foehn-multiselect-autocomplete.list-of-selected-items')}`;
7894
+ return `${this.dictionaryService.getKeySync('foehn-multiselect-autocomplete.selected.delete', { elementLabel: this.getLabel(element) })}`;
7925
7895
  }
7926
7896
  findElementByModelItem(item) {
7927
7897
  if (!!this.elements && !!this.elements.length) {
@@ -7942,55 +7912,6 @@ class FoehnMultiselectAutocompleteComponent extends FoehnAutocompleteComponent {
7942
7912
  }
7943
7913
  return this.model;
7944
7914
  }
7945
- getFirstDeleteButtonToFocus() {
7946
- const closeButtonsElemRefArray = [...this.closeButtonsElemRef.toArray()];
7947
- if (!!closeButtonsElemRefArray.length) {
7948
- return closeButtonsElemRefArray[0].nativeElement;
7949
- }
7950
- return null;
7951
- }
7952
- navigateSelectedList(offset) {
7953
- if (!this.disabled) {
7954
- const closeButtonsElemRefArray = this.getDefaultSelectedElements().concat([...this.closeButtonsElemRef.toArray()]);
7955
- if (!!closeButtonsElemRefArray.length) {
7956
- const focusIndex = closeButtonsElemRefArray.findIndex(value => this.currentFocusedElem === value.nativeElement);
7957
- let newIndex = focusIndex + offset;
7958
- if (newIndex >= closeButtonsElemRefArray.length) {
7959
- newIndex = 0;
7960
- }
7961
- if (newIndex < 0) {
7962
- newIndex = closeButtonsElemRefArray.length - 1;
7963
- }
7964
- const elemRef = closeButtonsElemRefArray[newIndex];
7965
- if (!!elemRef) {
7966
- elemRef.nativeElement.focus();
7967
- }
7968
- }
7969
- }
7970
- }
7971
- getDefaultSelectedElements() {
7972
- return [...this.selectedElemRef.toArray()].filter(value => value.nativeElement.getAttribute('is-default') === 'true');
7973
- }
7974
- onKeyDownSelectedInner(keyEvent) {
7975
- // IE doesn't support keyEvent.code, and has different values
7976
- // in keyEvent.key (Down instead of ArrowDown for instance), hence the multi-support.
7977
- const ie11CompatibleCode = keyEvent.code || keyEvent.key;
7978
- switch (ie11CompatibleCode) {
7979
- case 'Right':
7980
- case 'ArrowRight':
7981
- this.navigateSelectedList(1);
7982
- break;
7983
- case 'Left':
7984
- case 'ArrowLeft':
7985
- this.navigateSelectedList(-1);
7986
- break;
7987
- default:
7988
- return true;
7989
- }
7990
- keyEvent.preventDefault();
7991
- keyEvent.stopPropagation();
7992
- return false;
7993
- }
7994
7915
  filterAutocompleteElements(elements) {
7995
7916
  const filteredElements = ObjectHelper.deepCopy(elements);
7996
7917
  if (!!this.model && !!this.model.length) {
@@ -8007,8 +7928,8 @@ class FoehnMultiselectAutocompleteComponent extends FoehnAutocompleteComponent {
8007
7928
  return filteredElements;
8008
7929
  }
8009
7930
  manageSuggestionListAndFocusAfterAddingAnItem() {
8010
- // Highlight selected suggestion in input so screen reader knows there is still some text in input
8011
- this.autocompleteComponent.inputElement.nativeElement.select();
7931
+ // Empty autocomplete input
7932
+ this.autocompleteInputValue = null;
8012
7933
  // Remove selected item from autocomplete suggestion list
8013
7934
  this.autocompleteComponent.elements = this.filterAutocompleteElements(this.elements);
8014
7935
  // Check if we still have suggestions to display
@@ -8030,17 +7951,6 @@ class FoehnMultiselectAutocompleteComponent extends FoehnAutocompleteComponent {
8030
7951
  this.autocompleteComponent.inputElement.nativeElement.hidden = false;
8031
7952
  // Add back selected item to autocomplete suggestion list
8032
7953
  this.autocompleteComponent.elements = this.filterAutocompleteElements(this.elements);
8033
- // When deleting a selected item, check were to set focus back
8034
- this.closeButtonsElemRef.changes.pipe(first()).subscribe(() => {
8035
- const buttonToFocus = this.getFirstDeleteButtonToFocus();
8036
- if (!!buttonToFocus) {
8037
- buttonToFocus.focus();
8038
- }
8039
- else {
8040
- this.autocompleteComponent.setFocusOnInput();
8041
- this.autocompleteComponent.onInputFocus();
8042
- }
8043
- });
8044
7954
  }
8045
7955
  showAlertMessageAndHideAutocomplete() {
8046
7956
  // Show a message to user indicating there is no more suggestions to display
@@ -8049,15 +7959,27 @@ class FoehnMultiselectAutocompleteComponent extends FoehnAutocompleteComponent {
8049
7959
  this.autocompleteInputValue = null;
8050
7960
  this.autocompleteComponent.inputElement.nativeElement.hidden = true;
8051
7961
  }
7962
+ manageScreenReaderAnnouncement(element, isDelete) {
7963
+ clearTimeout(this.srAnnouncementAutoClearTimer);
7964
+ if (isDelete) {
7965
+ this.srAnnouncements += `${this.dictionaryService.getKeySync('foehn-multiselect-autocomplete.sr-announcement.deleted', { elementLabel: this.getLabel(element) })}`;
7966
+ }
7967
+ else {
7968
+ this.srAnnouncements += `${this.dictionaryService.getKeySync('foehn-multiselect-autocomplete.sr-announcement.added', { elementLabel: this.getLabel(element) })}`;
7969
+ }
7970
+ this.srAnnouncementAutoClearTimer = setTimeout(() => {
7971
+ this.srAnnouncements = '';
7972
+ }, 10000);
7973
+ }
8052
7974
  }
8053
7975
  FoehnMultiselectAutocompleteComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.4", ngImport: i0, type: FoehnMultiselectAutocompleteComponent, deps: [{ token: i0.NgZone }, { token: SdkDictionaryService }], target: i0.ɵɵFactoryTarget.Component });
8054
- FoehnMultiselectAutocompleteComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.4", type: FoehnMultiselectAutocompleteComponent, selector: "foehn-multiselect-autocomplete", inputs: { defaultElementValues: "defaultElementValues", defaultElementValue: "defaultElementValue" }, host: { listeners: { "keydown": "handleKeyboardDownEvent($event)" } }, providers: [
7976
+ FoehnMultiselectAutocompleteComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.4", type: FoehnMultiselectAutocompleteComponent, selector: "foehn-multiselect-autocomplete", inputs: { defaultElementValues: "defaultElementValues", defaultElementValue: "defaultElementValue" }, providers: [
8055
7977
  {
8056
7978
  provide: FoehnInputComponent,
8057
7979
  useExisting: forwardRef(() => FoehnMultiselectAutocompleteComponent),
8058
7980
  multi: true
8059
7981
  }
8060
- ], viewQueries: [{ propertyName: "autocompleteComponent", first: true, predicate: ["autocompleteComponent"], descendants: true }, { propertyName: "alertMessageContainer", first: true, predicate: ["alertMessageContainer"], descendants: true }, { propertyName: "closeButtonsElemRef", predicate: ["closeButtonsElemRef"], descendants: true }, { propertyName: "selectedElemRef", predicate: ["selectedElemRef"], descendants: true }], usesInheritance: true, ngImport: i0, template: "<foehn-autocomplete\n #autocompleteComponent\n [name]=\"name\"\n [label]=\"label\"\n [elements]=\"elements\"\n [elementsUrl]=\"elementsUrl\"\n [elementValue]=\"elementValue\"\n [elementLabel]=\"elementLabel\"\n [elementValueIdentity]=\"elementValueIdentity\"\n [elementDisabled]=\"elementDisabled\"\n [allElementDisabled]=\"allElementDisabled\"\n [elementGroup]=\"elementGroup\"\n [allowCustomValue]=\"false\"\n [searchValueMinCharsCount]=\"searchValueMinCharsCount\"\n [customValueModelGenerator]=\"customValueModelGenerator\"\n [required]=\"required\"\n [disabled]=\"disabled\"\n (userInput)=\"addItem($event)\"\n [(model)]=\"autocompleteInputValue\"\n (elementsLoaded)=\"onAutocompleteElementsLoaded($event)\"\n>\n <div\n [attr.role]=\"!disabled ? 'application' : null\"\n (focusin)=\"onSelectedItemsFocusin()\"\n (focusout)=\"onSelectedItemsFocusout()\"\n [tabindex]=\"(!!model && !!model.length) ? 0 : -1\"\n class=\"selected-list-container\"\n >\n <div class=\"sr-only\">\n {{'foehn-multiselect-autocomplete.list-of-selected-items.screen-reader.helper' | fromDictionary}}\n </div>\n <ul\n [id]=\"buildChildId() + 'SelectedItemsList'\"\n class=\"list-unstyled mb-1 d-flex align-content-stretch flex-wrap\"\n aria-live=\"polite\"\n aria-atomic=\"true\"\n aria-orientation=\"horizontal\"\n [attr.aria-label]=\"getSelectedListAriaLabel()\"\n >\n <li\n *ngFor=\"let element of model; let index = index; trackBy: trackByFn\"\n class=\"badge badge-pill badge-secondary mr-1 mb-1 py-2 px-3 d-flex align-items-center\"\n [tabindex]=\"isSelectedItemFocusable(index) ? 0 : -1\"\n [attr.is-default]=\"!canBeDeleted(index)\"\n #selectedElemRef\n >\n <ng-container *ngIf=\"!disabled\">\n <span *ngIf=\"!canBeDeleted(index)\" class=\"sr-only\">{{ 'foehn-multiselect-autocomplete.selected.screen-reader.default-value' | fromDictionary }}</span>\n <span *ngIf=\"canBeDeleted(index)\" class=\"sr-only\">{{ 'foehn-multiselect-autocomplete.selected.screen-reader.selected-value' | fromDictionary }}</span>\n </ng-container>\n\n <span [innerHtml]=\"getLabel(element)\"></span>\n\n <button\n *ngIf=\"!disabled && canBeDeleted(index)\"\n type=\"button\"\n class=\"btn btn-link ml-2\"\n [tabindex]=\"getSelectedElementTabIndex(index)\"\n (click)=\"removeItem(element)\"\n [attr.aria-label]=\"getDeleteButtonAriaLabel(element)\"\n #closeButtonsElemRef\n >\n <foehn-icon-times\n title=\"{{ 'foehn-multiselect-autocomplete.selected.delete' | fromDictionary: {elementLabel: getLabel(element)} }}\"\n ></foehn-icon-times>\n </button>\n </li>\n </ul>\n </div>\n\n <small\n *ngIf=\"!showEmptyListMessage\"\n [attr.id]=\"buildChildId() + 'Help'\"\n class=\"form-text text-secondary\"\n [innerHTML]=\"helpText ? helpText : 'foehn-multiselect-autocomplete.autocomplete.screen-reader.label' | fromDictionary\"\n ></small>\n\n <div\n [id]=\"buildChildId() + 'AlertMessageContainer'\"\n role=\"status\"\n tabindex=\"-1\"\n #alertMessageContainer\n >\n <p\n *ngIf=\"showEmptyListMessage\"\n class=\"alert alert-info\"\n tabindex=\"0\"\n >{{'foehn-multiselect-autocomplete.autocomplete.empty-message' | fromDictionary}}</p>\n </div>\n</foehn-autocomplete>\n", styles: [".selected-list-container button>.btn,.btn-link{line-height:inherit;padding:0}.selected-list-container li:focus{outline:0;box-shadow:inset 0 1px 1px #00000013,0 0 0 .2rem #ffbf47}.selected-list-container:focus{outline:0;box-shadow:inset 0 1px 1px #00000013,0 0 0 .2rem #ffbf47}foehn-autocomplete p.alert:focus{outline:0;box-shadow:inset 0 1px 1px #00000013,0 0 0 .2rem #ffbf47}\n"], components: [{ type: FoehnAutocompleteComponent, selector: "foehn-autocomplete", inputs: ["searchValueMinCharsCount", "allowCustomValue", "customValueModelGenerator"] }, { type: FoehnIconTimesComponent, selector: "foehn-icon-times" }], directives: [{ type: i3.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], pipes: { "fromDictionary": SdkDictionaryPipe } });
7982
+ ], viewQueries: [{ propertyName: "autocompleteComponent", first: true, predicate: ["autocompleteComponent"], descendants: true }, { propertyName: "alertMessageContainer", first: true, predicate: ["alertMessageContainer"], descendants: true }], usesInheritance: true, ngImport: i0, template: "<foehn-autocomplete\n #autocompleteComponent\n [name]=\"name\"\n [label]=\"label\"\n [elements]=\"elements\"\n [elementsUrl]=\"elementsUrl\"\n [elementValue]=\"elementValue\"\n [elementLabel]=\"elementLabel\"\n [elementValueIdentity]=\"elementValueIdentity\"\n [elementDisabled]=\"elementDisabled\"\n [allElementDisabled]=\"allElementDisabled\"\n [elementGroup]=\"elementGroup\"\n [allowCustomValue]=\"false\"\n [searchValueMinCharsCount]=\"searchValueMinCharsCount\"\n [customValueModelGenerator]=\"customValueModelGenerator\"\n [required]=\"required\"\n [disabled]=\"disabled\"\n (userInput)=\"addItem($event)\"\n [(model)]=\"autocompleteInputValue\"\n (elementsLoaded)=\"onAutocompleteElementsLoaded($event)\"\n>\n <small\n *ngIf=\"!showEmptyListMessage\"\n [attr.id]=\"buildChildId('Help')\"\n class=\"form-text text-secondary\"\n [innerHTML]=\"helpText ? helpText : 'foehn-multiselect-autocomplete.autocomplete.screen-reader.label' | fromDictionary\"\n ></small>\n\n <div\n [id]=\"buildChildId('AlertMessageContainer')\"\n role=\"status\"\n #alertMessageContainer\n >\n <p\n *ngIf=\"showEmptyListMessage\"\n class=\"alert alert-info\"\n tabindex=\"0\"\n >{{'foehn-multiselect-autocomplete.autocomplete.empty-message' | fromDictionary}}</p>\n </div>\n</foehn-autocomplete>\n\n<p\n class=\"sr-only\"\n aria-live=\"polite\"\n aria-atomic=\"true\"\n>\n {{srAnnouncements}}\n</p>\n\n<div\n role=\"presentation\"\n class=\"selected-list-container d-flex align-content-stretch flex-wrap\"\n [ngClass]=\"!!model && !!model.length ? 'mb-2' : 'mb-0'\"\n>\n <ng-container *ngFor=\"let element of model; let index = index; trackBy: trackByFn\">\n <span\n *ngIf=\"!canBeDeleted(index)\"\n class=\"badge badge-pill badge-secondary mr-1 mb-1 py-2 px-3 d-flex align-items-center\"\n [tabindex]=\"0\"\n [attr.aria-describedby]=\"buildChildId('Label')\"\n >\n {{getLabel(element)}}\n </span>\n <button\n *ngIf=\"canBeDeleted(index)\"\n class=\"btn btn-secondary badge badge-pill mr-1 mb-1 py-2 px-3 d-flex align-items-center\"\n [tabindex]=\"0\"\n [attr.aria-label]=\"getDeleteButtonAriaLabel(element)\"\n [attr.aria-describedby]=\"buildChildId('Label')\"\n [title]=\"getDeleteButtonAriaLabel(element)\"\n (click)=\"removeItem(element)\"\n >\n {{getLabel(element)}}\n <foehn-icon-times\n aria-hidden=\"true\"\n class=\"ml-2\"\n [title]=\"getDeleteButtonAriaLabel(element)\"\n ></foehn-icon-times>\n </button>\n </ng-container>\n</div>\n", styles: ["foehn-autocomplete p.alert:focus{outline:0;box-shadow:inset 0 1px 1px #00000013,0 0 0 .2rem #ffbf47}.selected-list-container button>.btn,.btn-link{line-height:inherit;padding:0}.selected-list-container .btn{text-transform:none}.selected-list-container span.badge-pill:focus{outline:0;box-shadow:inset 0 1px 1px #00000013,0 0 0 .2rem #ffbf47}\n"], components: [{ type: FoehnAutocompleteComponent, selector: "foehn-autocomplete", inputs: ["searchValueMinCharsCount", "allowCustomValue", "customValueModelGenerator"] }, { type: FoehnIconTimesComponent, selector: "foehn-icon-times" }], directives: [{ type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i3.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i3.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }], pipes: { "fromDictionary": SdkDictionaryPipe } });
8061
7983
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.4", ngImport: i0, type: FoehnMultiselectAutocompleteComponent, decorators: [{
8062
7984
  type: Component,
8063
7985
  args: [{
@@ -8078,19 +8000,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.4", ngImpor
8078
8000
  }], alertMessageContainer: [{
8079
8001
  type: ViewChild,
8080
8002
  args: ['alertMessageContainer']
8081
- }], closeButtonsElemRef: [{
8082
- type: ViewChildren,
8083
- args: ['closeButtonsElemRef']
8084
- }], selectedElemRef: [{
8085
- type: ViewChildren,
8086
- args: ['selectedElemRef']
8087
8003
  }], defaultElementValues: [{
8088
8004
  type: Input
8089
8005
  }], defaultElementValue: [{
8090
8006
  type: Input
8091
- }], handleKeyboardDownEvent: [{
8092
- type: HostListener,
8093
- args: ['keydown', ['$event']]
8094
8007
  }] } });
8095
8008
 
8096
8009
  class FoehnMultiselectAutocompleteModule {