@dsivd/prestations-ng 14.5.13 → 14.5.14-beta1

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/CHANGELOG.md CHANGED
@@ -26,6 +26,16 @@ A change is considered **breaking** if you have to change your code or update yo
26
26
 
27
27
  ---
28
28
 
29
+ ## [14.5.14]
30
+
31
+ ### Added
32
+
33
+ - [foehn-table.module.ts](projects/prestations-ng/src/foehn-table/foehn-table.module.ts)
34
+ - [foehn-table.component.ts](projects/prestations-ng/src/foehn-table/foehn-table.component.ts)
35
+ - [foehn-table.component.html](projects/prestations-ng/src/foehn-table/foehn-table.component.html)
36
+ - added a paginated table
37
+ - for examples, see related page in the devtool (https://dsi-vd.github.io/prestations-ng/list#foehn_table)
38
+
29
39
  ## [14.5.13]
30
40
 
31
41
  ### Added
@@ -9712,6 +9712,199 @@
9712
9712
  return PageChangeEvent;
9713
9713
  }());
9714
9714
 
9715
+ var hasInputChanged = function (change) { return !(!change ||
9716
+ !change.currentValue ||
9717
+ change.previousValue === change.currentValue); };
9718
+ var FoehnTableComponent = /** @class */ (function () {
9719
+ function FoehnTableComponent() {
9720
+ this.itemsPerPage = 10;
9721
+ this.id = 'foehn-table';
9722
+ this.previousLabel = 'Précédent';
9723
+ this.nextLabel = 'Suivant';
9724
+ this.pageChange = new i0.EventEmitter();
9725
+ this.sortChange = new i0.EventEmitter();
9726
+ this.currentPage = 1;
9727
+ this.filteredList = [];
9728
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
9729
+ this.trackByFn = function (index, item) { return index; };
9730
+ }
9731
+ Object.defineProperty(FoehnTableComponent.prototype, "list", {
9732
+ set: function (list) {
9733
+ this._list = list;
9734
+ },
9735
+ enumerable: false,
9736
+ configurable: true
9737
+ });
9738
+ FoehnTableComponent.prototype.ngOnChanges = function (changes) {
9739
+ var itemsPerPageChange = changes.itemsPerPage;
9740
+ var listChange = changes.list;
9741
+ var fixedPageCountChange = changes.fixedPageCount;
9742
+ if (!hasInputChanged(itemsPerPageChange) &&
9743
+ !hasInputChanged(listChange) &&
9744
+ !hasInputChanged(fixedPageCountChange)) {
9745
+ return;
9746
+ }
9747
+ this.buildFilteredList();
9748
+ };
9749
+ FoehnTableComponent.prototype.previousPage = function () {
9750
+ this.currentPage = this.currentPage - 1;
9751
+ this.buildFilteredList();
9752
+ this.pageChange.next({
9753
+ previousPage: this.currentPage + 1,
9754
+ currentPage: this.currentPage,
9755
+ pageCount: this.pagesCount()
9756
+ });
9757
+ };
9758
+ FoehnTableComponent.prototype.hasPreviousPage = function () {
9759
+ return this.currentPage > 1;
9760
+ };
9761
+ FoehnTableComponent.prototype.nextPage = function () {
9762
+ this.currentPage = this.currentPage + 1;
9763
+ this.buildFilteredList();
9764
+ this.pageChange.next({
9765
+ previousPage: this.currentPage - 1,
9766
+ currentPage: this.currentPage,
9767
+ pageCount: this.pagesCount()
9768
+ });
9769
+ };
9770
+ FoehnTableComponent.prototype.hasNextPage = function () {
9771
+ return this.currentPage < this.pagesCount();
9772
+ };
9773
+ FoehnTableComponent.prototype.showPage = function (page, emitPageChangeEvent) {
9774
+ if (emitPageChangeEvent === void 0) { emitPageChangeEvent = false; }
9775
+ if (this.currentPage === page) {
9776
+ return;
9777
+ }
9778
+ var previousPage = this.currentPage;
9779
+ this.currentPage = page;
9780
+ this.buildFilteredList();
9781
+ if (emitPageChangeEvent) {
9782
+ this.pageChange.next({
9783
+ previousPage: previousPage,
9784
+ currentPage: this.currentPage,
9785
+ pageCount: this.pagesCount()
9786
+ });
9787
+ }
9788
+ };
9789
+ FoehnTableComponent.prototype.pagesCount = function () {
9790
+ if (!!this.fixedPageCount) {
9791
+ return this.fixedPageCount;
9792
+ }
9793
+ return this._list
9794
+ ? Math.ceil(this._list.length / this.itemsPerPage)
9795
+ : 0;
9796
+ };
9797
+ FoehnTableComponent.prototype.triggerSort = function (sortAttribute) {
9798
+ var sortDirection = 'DESC';
9799
+ if (this.sort.sortAttribute === sortAttribute) {
9800
+ sortDirection = this.sort.sortDirection === 'DESC' ? 'ASC' : 'DESC';
9801
+ }
9802
+ this.sortChange.next({
9803
+ sortDirection: sortDirection,
9804
+ sortAttribute: sortAttribute
9805
+ });
9806
+ };
9807
+ FoehnTableComponent.prototype.buildFilteredList = function () {
9808
+ if (!!this.fixedPageCount) {
9809
+ this.filteredList = this._list;
9810
+ return;
9811
+ }
9812
+ var currentPageExists = (this.currentPage - 1) * this.itemsPerPage <= this._list.length;
9813
+ if (!currentPageExists) {
9814
+ this.currentPage = 1;
9815
+ }
9816
+ var start = (this.currentPage - 1) * this.itemsPerPage;
9817
+ this.filteredList = this._list
9818
+ ? this._list.slice(start, start + this.itemsPerPage)
9819
+ : [];
9820
+ };
9821
+ return FoehnTableComponent;
9822
+ }());
9823
+ FoehnTableComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.4", ngImport: i0__namespace, type: FoehnTableComponent, deps: [], target: i0__namespace.ɵɵFactoryTarget.Component });
9824
+ FoehnTableComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.4", type: FoehnTableComponent, selector: "foehn-table", inputs: { itemsPerPage: "itemsPerPage", id: "id", previousLabel: "previousLabel", nextLabel: "nextLabel", totalElements: "totalElements", fixedPageCount: "fixedPageCount", columnsConfiguration: "columnsConfiguration", sort: "sort", trackByFn: "trackByFn", list: "list" }, outputs: { pageChange: "pageChange", sortChange: "sortChange" }, usesOnChanges: true, ngImport: i0__namespace, template: "<div class=\"row\" [id]=\"id\">\n <div class=\"col-12\">\n <h2 *ngIf=\"!!totalElements && totalElements === 1\">\n {{ 'list.search-criteria.totalElements.1' | fromDictionary }}\n </h2>\n <h2 *ngIf=\"!!totalElements && totalElements !== 1\">\n {{\n 'list.search-criteria.totalElements'\n | fromDictionary: { total: totalElements.toString() }\n }}\n </h2>\n </div>\n\n <div class=\"col-12 table-responsive\">\n <table class=\"table table-hover\">\n <thead class=\"vd-bg-pattern-bars-gray\">\n <tr>\n <th\n scope=\"col\"\n *ngFor=\"let col of columnsConfiguration\"\n [id]=\"col.id\"\n >\n <ng-container *ngIf=\"!col.sortAttribute\">\n <span\n [innerHTML]=\"\n col.columnLabelKey | fromDictionary\n \"\n ></span>\n </ng-container>\n\n <ng-container *ngIf=\"!!col.sortAttribute\">\n <a\n href=\"#\"\n class=\"vd-text-thin\"\n (click)=\"\n $event.preventDefault();\n triggerSort(col.sortAttribute)\n \"\n [title]=\"\n 'Trier par ' +\n (col.columnLabelKey | fromDictionary)\n \"\n >\n <span\n [innerHTML]=\"\n col.columnLabelKey | fromDictionary\n \"\n ></span>\n <ng-container\n *ngIf=\"\n sort.sortAttribute === col.sortAttribute\n \"\n >\n <span\n class=\"ml-3\"\n *ngIf=\"sort.sortDirection === 'ASC'\"\n >\n <foehn-icon-chevron-up></foehn-icon-chevron-up>\n </span>\n <span\n class=\"ml-3\"\n *ngIf=\"sort.sortDirection === 'DESC'\"\n >\n <foehn-icon-chevron-down></foehn-icon-chevron-down>\n </span>\n </ng-container>\n </a>\n </ng-container>\n </th>\n </tr>\n </thead>\n <tbody>\n <tr\n *ngFor=\"\n let item of filteredList;\n let index = index;\n trackBy: trackByFn\n \"\n >\n <td\n *ngFor=\"let col of columnsConfiguration\"\n [id]=\"col.id + '-' + index\"\n >\n <ng-container *ngIf=\"!!col.isImportant\">\n <span\n *ngIf=\"col.isImportant(item)\"\n class=\"cell-vertical-align-middle\"\n >\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"30\"\n height=\"30\"\n style=\"color: var(--red)\"\n fill=\"currentColor\"\n class=\"bi bi-exclamation\"\n viewBox=\"0 0 16 16\"\n >\n <path\n d=\"M7.002 11a1 1 0 1 1 2 0 1 1 0 0 1-2 0zM7.1 4.995a.905.905 0 1 1 1.8 0l-.35 3.507a.553.553 0 0 1-1.1 0L7.1 4.995z\"\n />\n </svg>\n </span>\n </ng-container>\n\n <ng-container *ngIf=\"!col.routerLinkGetter\">\n <span\n [innerHTML]=\"col.valueGetter(item)\"\n class=\"cell-vertical-align-middle\"\n ></span>\n </ng-container>\n\n <ng-container *ngIf=\"!!col.routerLinkGetter\">\n <a\n [routerLink]=\"col.routerLinkGetter(item)\"\n queryParamsHandling=\"merge\"\n class=\"cell-vertical-align-middle\"\n >\n <span\n [innerHTML]=\"col.valueGetter(item)\"\n ></span>\n </a>\n </ng-container>\n </td>\n </tr>\n <tr *ngIf=\"!filteredList.length\">\n <td [colSpan]=\"columnsConfiguration.length\">\n <div class=\"w-100 text-center\">Aucun r\u00E9sultat</div>\n </td>\n </tr>\n </tbody>\n </table>\n\n <div class=\"row d-flex justify-content-between p-1\">\n <div class=\"col-lg-3 col-md-3 col-sm-6 col-xs-6\">\n <nav\n class=\"vd-pagination\"\n aria-label=\"Pagination\"\n *ngIf=\"hasPreviousPage()\"\n >\n <ul class=\"vd-pagination__list\">\n <li\n class=\"vd-pagination__item vd-pagination__item--previous\"\n >\n <button\n class=\"btn-link vd-pagination__link btn-no-extra vd-pagination__link-reset\"\n (click)=\"previousPage()\"\n >\n <span class=\"vd-pagination__title\">\n <foehn-icon-chevron-left></foehn-icon-chevron-left>\n {{ previousLabel }}\n </span>\n <span class=\"sr-only\">:</span>\n <span class=\"vd-pagination__label\">\n {{ currentPage - 1 }} sur {{ pagesCount() }}\n </span>\n </button>\n </li>\n </ul>\n </nav>\n </div>\n\n <div class=\"col-lg-3 col-md-3 col-sm-6 col-xs-6\">\n <nav\n class=\"vd-pagination\"\n aria-label=\"Pagination\"\n *ngIf=\"hasNextPage()\"\n >\n <ul class=\"vd-pagination__list\">\n <li\n class=\"vd-pagination__item vd-pagination__item--next\"\n >\n <button\n class=\"btn-link vd-pagination__link btn-no-extra vd-pagination__link-reset\"\n (click)=\"nextPage()\"\n >\n <span class=\"vd-pagination__title\">\n {{ nextLabel }}\n <foehn-icon-chevron-right></foehn-icon-chevron-right>\n </span>\n <span class=\"sr-only\">:</span>\n <span class=\"vd-pagination__label\">\n {{ currentPage + 1 }} sur {{ pagesCount() }}\n </span>\n </button>\n </li>\n </ul>\n </nav>\n </div>\n </div>\n </div>\n</div>\n", styles: [".btn-no-extra{padding:0;border:none;font-weight:400;-webkit-text-decoration-line:none;text-decoration-line:none}.vd-pagination__link-reset{background:none;border:none;font-weight:inherit;-webkit-text-decoration-line:none;text-decoration-line:none;text-align:inherit;cursor:pointer}.vd-pagination__link-reset:focus{background-color:#ffbf47}.cell-vertical-align-middle{vertical-align:middle}\n"], components: [{ type: FoehnIconChevronUpComponent, selector: "foehn-icon-chevron-up" }, { type: FoehnIconChevronDownComponent, selector: "foehn-icon-chevron-down" }, { type: FoehnIconChevronLeftComponent, selector: "foehn-icon-chevron-left" }, { type: FoehnIconChevronRightComponent, selector: "foehn-icon-chevron-right" }], directives: [{ type: i3__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i3__namespace.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i1__namespace$1.RouterLinkWithHref, selector: "a[routerLink],area[routerLink]", inputs: ["routerLink", "target", "queryParams", "fragment", "queryParamsHandling", "preserveFragment", "skipLocationChange", "replaceUrl", "state", "relativeTo"] }], pipes: { "fromDictionary": SdkDictionaryPipe } });
9825
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.4", ngImport: i0__namespace, type: FoehnTableComponent, decorators: [{
9826
+ type: i0.Component,
9827
+ args: [{
9828
+ selector: 'foehn-table',
9829
+ templateUrl: './foehn-table.component.html',
9830
+ styleUrls: ['./foehn-table.component.css']
9831
+ }]
9832
+ }], propDecorators: { itemsPerPage: [{
9833
+ type: i0.Input
9834
+ }], id: [{
9835
+ type: i0.Input
9836
+ }], previousLabel: [{
9837
+ type: i0.Input
9838
+ }], nextLabel: [{
9839
+ type: i0.Input
9840
+ }], totalElements: [{
9841
+ type: i0.Input
9842
+ }], fixedPageCount: [{
9843
+ type: i0.Input
9844
+ }], columnsConfiguration: [{
9845
+ type: i0.Input
9846
+ }], pageChange: [{
9847
+ type: i0.Output
9848
+ }], sort: [{
9849
+ type: i0.Input
9850
+ }], sortChange: [{
9851
+ type: i0.Output
9852
+ }],
9853
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
9854
+ trackByFn: [{
9855
+ type: i0.Input
9856
+ }], list: [{
9857
+ type: i0.Input
9858
+ }] } });
9859
+
9860
+ var FoehnTableModule = /** @class */ (function () {
9861
+ function FoehnTableModule() {
9862
+ }
9863
+ return FoehnTableModule;
9864
+ }());
9865
+ FoehnTableModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.4", ngImport: i0__namespace, type: FoehnTableModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
9866
+ FoehnTableModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.4", ngImport: i0__namespace, type: FoehnTableModule, declarations: [FoehnTableComponent], imports: [i3.CommonModule,
9867
+ FoehnIconsModule,
9868
+ SdkDictionaryModule,
9869
+ i1$1.RouterModule], exports: [FoehnTableComponent] });
9870
+ FoehnTableModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.4", ngImport: i0__namespace, type: FoehnTableModule, imports: [[
9871
+ i3.CommonModule,
9872
+ FoehnIconsModule,
9873
+ SdkDictionaryModule,
9874
+ i1$1.RouterModule
9875
+ ]] });
9876
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.4", ngImport: i0__namespace, type: FoehnTableModule, decorators: [{
9877
+ type: i0.NgModule,
9878
+ args: [{
9879
+ imports: [
9880
+ i3.CommonModule,
9881
+ FoehnIconsModule,
9882
+ SdkDictionaryModule,
9883
+ i1$1.RouterModule
9884
+ ],
9885
+ declarations: [FoehnTableComponent],
9886
+ exports: [FoehnTableComponent]
9887
+ }]
9888
+ }] });
9889
+
9890
+ var FoehnTableColumnConfiguration = /** @class */ (function () {
9891
+ function FoehnTableColumnConfiguration() {
9892
+ }
9893
+ return FoehnTableColumnConfiguration;
9894
+ }());
9895
+
9896
+ var FoehnTablePageChangeEvent = /** @class */ (function () {
9897
+ function FoehnTablePageChangeEvent() {
9898
+ }
9899
+ return FoehnTablePageChangeEvent;
9900
+ }());
9901
+
9902
+ var TableSort = /** @class */ (function () {
9903
+ function TableSort() {
9904
+ }
9905
+ return TableSort;
9906
+ }());
9907
+
9715
9908
  var RedirectComponent = /** @class */ (function () {
9716
9909
  function RedirectComponent(iamInterceptor) {
9717
9910
  var _this = this;
@@ -13115,6 +13308,10 @@
13115
13308
  exports.FoehnRemainingAlertsSummaryModule = FoehnRemainingAlertsSummaryModule;
13116
13309
  exports.FoehnSelectComponent = FoehnSelectComponent;
13117
13310
  exports.FoehnSkipLinkComponent = FoehnSkipLinkComponent;
13311
+ exports.FoehnTableColumnConfiguration = FoehnTableColumnConfiguration;
13312
+ exports.FoehnTableComponent = FoehnTableComponent;
13313
+ exports.FoehnTableModule = FoehnTableModule;
13314
+ exports.FoehnTablePageChangeEvent = FoehnTablePageChangeEvent;
13118
13315
  exports.FoehnTimeComponent = FoehnTimeComponent;
13119
13316
  exports.FoehnUserConnectedAsComponent = FoehnUserConnectedAsComponent;
13120
13317
  exports.FoehnUserConnectedAsModule = FoehnUserConnectedAsModule;
@@ -13179,6 +13376,7 @@
13179
13376
  exports.Street = Street;
13180
13377
  exports.StreetNumber = StreetNumber;
13181
13378
  exports.THOUSANDS_SEPARATOR = THOUSANDS_SEPARATOR;
13379
+ exports.TableSort = TableSort;
13182
13380
  exports.UploaderHelper = UploaderHelper;
13183
13381
  exports.ValidationHandlerService = ValidationHandlerService;
13184
13382