@dsivd/prestations-ng 14.5.23-beta6 → 14.5.23-beta9

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.
@@ -1930,8 +1930,10 @@
1930
1930
  'foehn-status-progress-bar.step3': 'Confirmation',
1931
1931
  'foehn-status-progress-bar.step3.srOnly': 'Etape 3 sur 3, Confirmation, demande transmise',
1932
1932
  'foehn-multiselect-autocomplete.selected.delete': 'Supprimer {elementLabel}',
1933
- 'foehn-multiselect-autocomplete.sr-announcement.deleted': '{elementLabel} a été supprimé, ',
1934
- 'foehn-multiselect-autocomplete.sr-announcement.added': '{elementLabel} a été ajouté, ',
1933
+ 'foehn-multiselect-autocomplete.sr-announcement.deleted': '{elementLabel} a été supprimé,',
1934
+ 'foehn-multiselect-autocomplete.sr-announcement.added': '{elementLabel} a été ajouté,',
1935
+ 'foehn-multiselect-autocomplete.sr-default-focus.no-element-to-delete': 'Aucun élément à supprimer dans la liste.',
1936
+ 'foehn-multiselect-autocomplete.sr-default-selected-element': '(sélection par défaut)',
1935
1937
  'foehn-multiselect-autocomplete.autocomplete.empty-message': 'Tous les éléments de la liste de proposition ont déjà été ajoutés.',
1936
1938
  'foehn-multiselect-autocomplete.autocomplete.screen-reader.label': 'Sélectionner un élément dans la liste de recherche' +
1937
1939
  ' ci-dessous pour l\'ajouter à votre sélection.'
@@ -8857,7 +8859,7 @@
8857
8859
  _this.dictionaryService = dictionaryService;
8858
8860
  _this.showEmptyListMessage = false;
8859
8861
  _this.srAnnouncements = '';
8860
- _this.SR_ANNOUNCEMENT_CLEAR_TIMEOUT_INTERVAL = 4000;
8862
+ _this.SR_ANNOUNCEMENT_CLEAR_TIMEOUT_INTERVAL_MS = 2000;
8861
8863
  return _this;
8862
8864
  }
8863
8865
  Object.defineProperty(FoehnMultiselectAutocompleteComponent.prototype, "defaultElementValues", {
@@ -8907,14 +8909,11 @@
8907
8909
  }
8908
8910
  }
8909
8911
  };
8910
- FoehnMultiselectAutocompleteComponent.prototype.removeItem = function (item) {
8911
- var index = this.model.indexOf(item);
8912
- if (index > -1) {
8913
- this.model.splice(index, 1);
8914
- this.triggerUserInput(this.model);
8915
- this.manageSuggestionListAndFocusAfterRemovingAnItem();
8916
- this.manageScreenReaderAnnouncement(item, true);
8917
- }
8912
+ FoehnMultiselectAutocompleteComponent.prototype.removeItem = function (item, index) {
8913
+ this.model.splice(index, 1);
8914
+ this.triggerUserInput(this.model);
8915
+ this.manageSuggestionListAndFocusAfterRemovingAnItem(index);
8916
+ this.manageScreenReaderAnnouncement(item, true);
8918
8917
  };
8919
8918
  FoehnMultiselectAutocompleteComponent.prototype.trackByFn = function (index) {
8920
8919
  return index;
@@ -8925,7 +8924,7 @@
8925
8924
  return _super.prototype.getLabel.call(this, elem);
8926
8925
  };
8927
8926
  FoehnMultiselectAutocompleteComponent.prototype.canBeDeleted = function (index) {
8928
- return !this.defaultElementValues || !this.defaultElementValues.includes(this.model[index]);
8927
+ return !this.disabled && (!this.defaultElementValues || !this.defaultElementValues.includes(this.model[index]));
8929
8928
  };
8930
8929
  FoehnMultiselectAutocompleteComponent.prototype.onAutocompleteElementsLoaded = function (elements) {
8931
8930
  var _this = this;
@@ -8945,7 +8944,7 @@
8945
8944
  FoehnMultiselectAutocompleteComponent.prototype.findElementByModelItem = function (item) {
8946
8945
  var _this = this;
8947
8946
  if (!!this.elements && !!this.elements.length) {
8948
- var itemValue_1 = typeof item === 'string' ? item : this.getValue(item);
8947
+ var itemValue_1 = typeof item !== 'object' ? item : this.getValue(item);
8949
8948
  var elem = this.elements.find(function (element) { return _this.getValue(element) === itemValue_1; });
8950
8949
  if (!!elem) {
8951
8950
  return elem;
@@ -8962,6 +8961,25 @@
8962
8961
  }
8963
8962
  return this.model;
8964
8963
  };
8964
+ FoehnMultiselectAutocompleteComponent.prototype.focusNextAreaAfterDelete = function (removedIndex) {
8965
+ // Adjust index depending on default elements that are not deletable
8966
+ if (!!this.defaultElementValues) {
8967
+ removedIndex -= this.defaultElementValues.length;
8968
+ }
8969
+ var closeButtonsElemRefArray = __spreadArray([], __read(this.selectedElemRef.toArray()));
8970
+ // Need to find an element to focus on
8971
+ if (removedIndex === closeButtonsElemRefArray.length) {
8972
+ if (!!closeButtonsElemRefArray.length) {
8973
+ return closeButtonsElemRefArray[removedIndex - 1].nativeElement.focus();
8974
+ }
8975
+ var defaultElemRefArray = __spreadArray([], __read(this.defaultElemRef.toArray()));
8976
+ if (!!defaultElemRefArray.length) {
8977
+ return defaultElemRefArray[defaultElemRefArray.length - 1].nativeElement.focus();
8978
+ }
8979
+ return this.defaultFocusArea.nativeElement.focus();
8980
+ }
8981
+ // Otherwise focus element by DOM replacement
8982
+ };
8965
8983
  FoehnMultiselectAutocompleteComponent.prototype.filterAutocompleteElements = function (elements) {
8966
8984
  var _this = this;
8967
8985
  var filteredElements = ObjectHelper.deepCopy(elements);
@@ -9007,13 +9025,18 @@
9007
9025
  });
9008
9026
  }
9009
9027
  };
9010
- FoehnMultiselectAutocompleteComponent.prototype.manageSuggestionListAndFocusAfterRemovingAnItem = function () {
9028
+ FoehnMultiselectAutocompleteComponent.prototype.manageSuggestionListAndFocusAfterRemovingAnItem = function (removedIndex) {
9029
+ var _this = this;
9011
9030
  // Hide message saying no more suggestions to display
9012
9031
  this.showEmptyListMessage = false;
9013
9032
  // Manually show autocomplete because there is at least one suggestions to display
9014
9033
  this.autocompleteComponent.inputElement.nativeElement.hidden = false;
9015
9034
  // Add back selected item to autocomplete suggestion list
9016
9035
  this.autocompleteComponent.elements = this.filterAutocompleteElements(this.elements);
9036
+ // When deleting a selected item, check were to set focus back when no more items to delete
9037
+ this.selectedElemRef.changes.pipe(operators.first()).subscribe(function () {
9038
+ _this.focusNextAreaAfterDelete(removedIndex);
9039
+ });
9017
9040
  };
9018
9041
  FoehnMultiselectAutocompleteComponent.prototype.showAlertMessageAndHideAutocomplete = function () {
9019
9042
  // Show a message to user indicating there is no more suggestions to display
@@ -9033,7 +9056,7 @@
9033
9056
  }
9034
9057
  this.srAnnouncementClearTimer = setTimeout(function () {
9035
9058
  _this.srAnnouncements = '';
9036
- }, this.SR_ANNOUNCEMENT_CLEAR_TIMEOUT_INTERVAL);
9059
+ }, this.SR_ANNOUNCEMENT_CLEAR_TIMEOUT_INTERVAL_MS);
9037
9060
  };
9038
9061
  return FoehnMultiselectAutocompleteComponent;
9039
9062
  }(FoehnAutocompleteComponent));
@@ -9044,7 +9067,7 @@
9044
9067
  useExisting: i0.forwardRef(function () { return FoehnMultiselectAutocompleteComponent; }),
9045
9068
  multi: true
9046
9069
  }
9047
- ], viewQueries: [{ propertyName: "autocompleteComponent", first: true, predicate: ["autocompleteComponent"], descendants: true }, { propertyName: "alertMessageContainer", first: true, predicate: ["alertMessageContainer"], descendants: true }], usesInheritance: true, ngImport: i0__namespace, 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__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i3__namespace.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i3__namespace.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }], pipes: { "fromDictionary": SdkDictionaryPipe } });
9070
+ ], viewQueries: [{ propertyName: "autocompleteComponent", first: true, predicate: ["autocompleteComponent"], descendants: true }, { propertyName: "alertMessageContainer", first: true, predicate: ["alertMessageContainer"], descendants: true }, { propertyName: "defaultFocusArea", first: true, predicate: ["defaultFocusArea"], descendants: true }, { propertyName: "selectedElemRef", predicate: ["selectedElemRef"], descendants: true }, { propertyName: "defaultElemRef", predicate: ["defaultElemRef"], descendants: true }], usesInheritance: true, ngImport: i0__namespace, 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 <span\n *ngIf=\"(!defaultElementValues || !defaultElementValues.length) && (!model || !model.length)\"\n class=\"sr-only\"\n [tabindex]=\"disabled ? -1 : 0\"\n [innerHTML]=\"'foehn-multiselect-autocomplete.sr-default-focus.no-element-to-delete' | fromDictionary\"\n #defaultFocusArea\n ></span>\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]=\"disabled ? -1 : 0\"\n [attr.aria-describedby]=\"buildChildId('Label')\"\n #defaultElemRef\n >\n {{getLabel(element)}}\n <span class=\"sr-only\">\n {{'foehn-multiselect-autocomplete.sr-default-selected-element' | fromDictionary}}\n </span>\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, index)\"\n #selectedElemRef\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__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i3__namespace.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i3__namespace.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }], pipes: { "fromDictionary": SdkDictionaryPipe } });
9048
9071
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.4", ngImport: i0__namespace, type: FoehnMultiselectAutocompleteComponent, decorators: [{
9049
9072
  type: i0.Component,
9050
9073
  args: [{
@@ -9065,6 +9088,15 @@
9065
9088
  }], alertMessageContainer: [{
9066
9089
  type: i0.ViewChild,
9067
9090
  args: ['alertMessageContainer']
9091
+ }], selectedElemRef: [{
9092
+ type: i0.ViewChildren,
9093
+ args: ['selectedElemRef']
9094
+ }], defaultElemRef: [{
9095
+ type: i0.ViewChildren,
9096
+ args: ['defaultElemRef']
9097
+ }], defaultFocusArea: [{
9098
+ type: i0.ViewChild,
9099
+ args: ['defaultFocusArea']
9068
9100
  }], defaultElementValues: [{
9069
9101
  type: i0.Input
9070
9102
  }], defaultElementValue: [{