Commit 0ac23b54 authored by LAVENIER's avatar LAVENIER
Browse files

Release v0.13.1

[fix] Editor: move subscriptions to formButtonsBar and toolbar, into the afterViewInit() function
parent 030d36ed
{
"name": "@sumaris-net/ngx-components",
"description": "SUMARiS Angular components",
"version": "0.13.0",
"version": "0.13.1",
"author": "contact@e-is.pro",
"license": "AGPL-3.0",
"readmeFilename": "README.md",
......
import {Directive, Input, OnDestroy, OnInit, Optional, ViewChild} from '@angular/core';
import { AfterViewInit, Directive, Input, OnDestroy, OnInit, Optional, ViewChild } from '@angular/core';
import {ActivatedRoute, Params, Router} from '@angular/router';
import {MatTabChangeEvent, MatTabGroup} from '@angular/material/tabs';
import {AlertController, IonContent, ToastController} from '@ionic/angular';
......@@ -40,7 +40,7 @@ export class AppTabEditorOptions {
@Directive()
// eslint-disable-next-line @angular-eslint/directive-class-suffix
export abstract class AppTabEditor<T = any, ID = number, O = any> implements IAppEditor, OnInit, OnDestroy {
export abstract class AppTabEditor<T = any, ID = number, O = any> implements IAppEditor, OnInit, OnDestroy, AfterViewInit {
private _children: IAppForm[];
private _subscription = new Subscription();
......@@ -138,7 +138,6 @@ export abstract class AppTabEditor<T = any, ID = number, O = any> implements IAp
}
ngOnInit() {
this.queryTabIndexParamName = this.queryTabIndexParamName || 'tab';
// Read the selected tab index, from path query params
......@@ -160,7 +159,9 @@ export abstract class AppTabEditor<T = any, ID = number, O = any> implements IAp
setTimeout(() => this.tabGroup.realignInkBar(), 500);
}));
}
}
ngAfterViewInit() {
// Catch back click events
if (this.toolbar) {
this.registerSubscription(this.toolbar.onBackClick.subscribe(event => this.onBackClick(event)));
......
......@@ -179,6 +179,8 @@ export abstract class AppEntityEditor<
}
ngAfterViewInit() {
super.ngAfterViewInit();
// Load data
if (this._autoLoad) {
setTimeout(() => this.loadFromRoute(), this._autoLoadDelay);
......
......@@ -6,22 +6,26 @@
<ion-col size="auto">
<ion-button fill="clear" color="dark" (click)="onBack.emit($event)" (keyup.enter)="onBack.emit($event)" *ngIf="onBack.observers.length">
<!-- close (go back) -->
<ion-button fill="clear" color="dark" (click)="onBack.emit($event)" (keyup.enter)="onBack.emit($event)" *ngIf="onBack.observers | isNotEmptyArray">
<ion-label translate>COMMON.BTN_CLOSE</ion-label>
</ion-button>
<!-- reload -->
<ion-button fill="clear" color="dark" (click)="onCancel.emit($event)" (keyup.enter)="onCancel.emit($event)" [disabled]="disabledCancel">
<ion-icon slot="start" name="refresh"></ion-icon>
<ion-label translate>COMMON.BTN_RESET</ion-label>
</ion-button>
<ion-button fill="solid" (click)="onNext.emit($event)" (keyup.enter)="onNext.emit($event)" *ngIf="onNext.observers.length">
<!-- next -->
<ion-button fill="solid" (click)="onNext.emit($event)" (keyup.enter)="onNext.emit($event)" *ngIf="onNext.observers | isNotEmptyArray">
<ion-label translate>COMMON.BTN_NEXT</ion-label>
<ion-icon slot="end" name="arrow-forward"></ion-icon>
</ion-button>
<ion-button [fill]="disabled? 'clear' : 'solid'" (click)="onSave.emit($event)" (keyup.enter)="onSave.emit($event)" color="danger" [disabled]="disabled">
<!-- save -->
<ion-button [fill]="disabled ? 'clear' : 'solid'" (click)="onSave.emit($event)" (keyup.enter)="onSave.emit($event)" color="danger"
[disabled]="disabled">
<ion-label [innerHTML]="'COMMON.BTN_SAVE_WITH_SHORTCUT'|translate" [title]="'COMMON.BTN_SAVE_WITH_SHORTCUT_HELP'|translate"></ion-label>
</ion-button>
</ion-col>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment