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

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.
@@ -8857,6 +8857,7 @@
8857
8857
  _this.dictionaryService = dictionaryService;
8858
8858
  _this.showEmptyListMessage = false;
8859
8859
  _this.srAnnouncements = '';
8860
+ _this.SR_ANNOUNCEMENT_CLEAR_TIMEOUT_INTERVAL_MS = 2000;
8860
8861
  return _this;
8861
8862
  }
8862
8863
  Object.defineProperty(FoehnMultiselectAutocompleteComponent.prototype, "defaultElementValues", {
@@ -8924,7 +8925,7 @@
8924
8925
  return _super.prototype.getLabel.call(this, elem);
8925
8926
  };
8926
8927
  FoehnMultiselectAutocompleteComponent.prototype.canBeDeleted = function (index) {
8927
- return !this.defaultElementValues || !this.defaultElementValues.includes(this.model[index]);
8928
+ return !this.disabled && (!this.defaultElementValues || !this.defaultElementValues.includes(this.model[index]));
8928
8929
  };
8929
8930
  FoehnMultiselectAutocompleteComponent.prototype.onAutocompleteElementsLoaded = function (elements) {
8930
8931
  var _this = this;
@@ -8944,7 +8945,7 @@
8944
8945
  FoehnMultiselectAutocompleteComponent.prototype.findElementByModelItem = function (item) {
8945
8946
  var _this = this;
8946
8947
  if (!!this.elements && !!this.elements.length) {
8947
- var itemValue_1 = typeof item === 'string' ? item : this.getValue(item);
8948
+ var itemValue_1 = typeof item !== 'object' ? item : this.getValue(item);
8948
8949
  var elem = this.elements.find(function (element) { return _this.getValue(element) === itemValue_1; });
8949
8950
  if (!!elem) {
8950
8951
  return elem;
@@ -9007,12 +9008,20 @@
9007
9008
  }
9008
9009
  };
9009
9010
  FoehnMultiselectAutocompleteComponent.prototype.manageSuggestionListAndFocusAfterRemovingAnItem = function () {
9011
+ var _this = this;
9010
9012
  // Hide message saying no more suggestions to display
9011
9013
  this.showEmptyListMessage = false;
9012
9014
  // Manually show autocomplete because there is at least one suggestions to display
9013
9015
  this.autocompleteComponent.inputElement.nativeElement.hidden = false;
9014
9016
  // Add back selected item to autocomplete suggestion list
9015
9017
  this.autocompleteComponent.elements = this.filterAutocompleteElements(this.elements);
9018
+ // When deleting a selected item, check were to set focus back when no more items to delete
9019
+ this.selectedElemRef.changes.pipe(operators.first()).subscribe(function () {
9020
+ var selectedElemRefArray = __spreadArray([], __read(_this.selectedElemRef.toArray()));
9021
+ if (!selectedElemRefArray.length && !!_this.selectedItemsArea) {
9022
+ _this.selectedItemsArea.nativeElement.focus();
9023
+ }
9024
+ });
9016
9025
  };
9017
9026
  FoehnMultiselectAutocompleteComponent.prototype.showAlertMessageAndHideAutocomplete = function () {
9018
9027
  // Show a message to user indicating there is no more suggestions to display
@@ -9023,16 +9032,16 @@
9023
9032
  };
9024
9033
  FoehnMultiselectAutocompleteComponent.prototype.manageScreenReaderAnnouncement = function (element, isDelete) {
9025
9034
  var _this = this;
9026
- clearTimeout(this.srAnnouncementAutoClearTimer);
9035
+ clearTimeout(this.srAnnouncementClearTimer);
9027
9036
  if (isDelete) {
9028
9037
  this.srAnnouncements += "" + this.dictionaryService.getKeySync('foehn-multiselect-autocomplete.sr-announcement.deleted', { elementLabel: this.getLabel(element) });
9029
9038
  }
9030
9039
  else {
9031
9040
  this.srAnnouncements += "" + this.dictionaryService.getKeySync('foehn-multiselect-autocomplete.sr-announcement.added', { elementLabel: this.getLabel(element) });
9032
9041
  }
9033
- this.srAnnouncementAutoClearTimer = setTimeout(function () {
9042
+ this.srAnnouncementClearTimer = setTimeout(function () {
9034
9043
  _this.srAnnouncements = '';
9035
- }, 10000);
9044
+ }, this.SR_ANNOUNCEMENT_CLEAR_TIMEOUT_INTERVAL_MS);
9036
9045
  };
9037
9046
  return FoehnMultiselectAutocompleteComponent;
9038
9047
  }(FoehnAutocompleteComponent));
@@ -9043,7 +9052,7 @@
9043
9052
  useExisting: i0.forwardRef(function () { return FoehnMultiselectAutocompleteComponent; }),
9044
9053
  multi: true
9045
9054
  }
9046
- ], 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 } });
9055
+ ], viewQueries: [{ propertyName: "autocompleteComponent", first: true, predicate: ["autocompleteComponent"], descendants: true }, { propertyName: "alertMessageContainer", first: true, predicate: ["alertMessageContainer"], descendants: true }, { propertyName: "selectedItemsArea", first: true, predicate: ["selectedItemsArea"], descendants: true }, { propertyName: "selectedElemRef", predicate: ["selectedElemRef"], 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 #selectedItemsArea\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]=\"disabled ? -1 : 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 #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 } });
9047
9056
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.4", ngImport: i0__namespace, type: FoehnMultiselectAutocompleteComponent, decorators: [{
9048
9057
  type: i0.Component,
9049
9058
  args: [{
@@ -9064,6 +9073,12 @@
9064
9073
  }], alertMessageContainer: [{
9065
9074
  type: i0.ViewChild,
9066
9075
  args: ['alertMessageContainer']
9076
+ }], selectedElemRef: [{
9077
+ type: i0.ViewChildren,
9078
+ args: ['selectedElemRef']
9079
+ }], selectedItemsArea: [{
9080
+ type: i0.ViewChild,
9081
+ args: ['selectedItemsArea']
9067
9082
  }], defaultElementValues: [{
9068
9083
  type: i0.Input
9069
9084
  }], defaultElementValue: [{