@tetacom/ng-components 1.5.5 → 1.6.0
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.
|
@@ -1,19 +1,21 @@
|
|
|
1
|
-
import { OnInit } from '@angular/core';
|
|
2
1
|
import { CurrentModal } from '../model/current-modal';
|
|
3
|
-
import {
|
|
2
|
+
import { DialogButtonType } from '../model/dialog-data';
|
|
4
3
|
import * as i0 from "@angular/core";
|
|
5
|
-
export declare class DialogComponent
|
|
4
|
+
export declare class DialogComponent {
|
|
6
5
|
modal: CurrentModal;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
6
|
+
title: string;
|
|
7
|
+
private _text;
|
|
8
|
+
get text(): string;
|
|
9
|
+
set text(value: string);
|
|
10
|
+
private _confirm;
|
|
11
|
+
get confirm(): DialogButtonType;
|
|
12
|
+
set confirm(value: DialogButtonType);
|
|
13
|
+
private _decline;
|
|
14
|
+
get decline(): null | DialogButtonType;
|
|
15
|
+
set decline(value: null | DialogButtonType);
|
|
16
|
+
constructor(modal: CurrentModal);
|
|
14
17
|
cancel(): void;
|
|
15
18
|
ok(): void;
|
|
16
|
-
ngOnInit(): void;
|
|
17
19
|
static ɵfac: i0.ɵɵFactoryDeclaration<DialogComponent, never>;
|
|
18
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<DialogComponent, "teta-dialog", never, { "
|
|
20
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<DialogComponent, "teta-dialog", never, { "title": { "alias": "title"; "required": true; }; "text": { "alias": "text"; "required": false; }; "confirm": { "alias": "confirm"; "required": false; }; "decline": { "alias": "decline"; "required": false; }; }, {}, never, never, true, never>;
|
|
19
21
|
}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { ModalService } from './modal.service';
|
|
2
2
|
import { Observable } from 'rxjs';
|
|
3
|
+
import { DialogDataType } from './model/dialog-data';
|
|
3
4
|
import * as i0 from "@angular/core";
|
|
4
5
|
export declare class DialogService {
|
|
5
6
|
private _modal;
|
|
6
7
|
constructor(_modal: ModalService);
|
|
7
|
-
alert(
|
|
8
|
-
confirm(
|
|
8
|
+
alert(title: string): void;
|
|
9
|
+
confirm(confirmDialogData: DialogDataType): Observable<boolean>;
|
|
9
10
|
private createDialog;
|
|
10
11
|
static ɵfac: i0.ɵɵFactoryDeclaration<DialogService, never>;
|
|
11
12
|
static ɵprov: i0.ɵɵInjectableDeclaration<DialogService>;
|
|
@@ -3836,6 +3836,7 @@ class OnlyNumberDirective {
|
|
|
3836
3836
|
return;
|
|
3837
3837
|
}
|
|
3838
3838
|
this.validateValue(e.clipboardData.getData('text/plain'));
|
|
3839
|
+
this._elementRef.nativeElement.dispatchEvent(new Event('input'));
|
|
3839
3840
|
e.preventDefault();
|
|
3840
3841
|
}
|
|
3841
3842
|
onKeyDown(e) {
|
|
@@ -5093,9 +5094,26 @@ class CurrentModal {
|
|
|
5093
5094
|
}
|
|
5094
5095
|
|
|
5095
5096
|
class DialogComponent {
|
|
5096
|
-
|
|
5097
|
+
get text() {
|
|
5098
|
+
return this._text;
|
|
5099
|
+
}
|
|
5100
|
+
set text(value) {
|
|
5101
|
+
this._text = value || '';
|
|
5102
|
+
}
|
|
5103
|
+
get confirm() {
|
|
5104
|
+
return this._confirm;
|
|
5105
|
+
}
|
|
5106
|
+
set confirm(value) {
|
|
5107
|
+
this._confirm = value || { text: 'common.ok', palette: 'primary' };
|
|
5108
|
+
}
|
|
5109
|
+
get decline() {
|
|
5110
|
+
return this._decline;
|
|
5111
|
+
}
|
|
5112
|
+
set decline(value) {
|
|
5113
|
+
this._decline = value !== undefined ? value : { text: 'common.cancel', palette: 'text' };
|
|
5114
|
+
}
|
|
5115
|
+
constructor(modal) {
|
|
5097
5116
|
this.modal = modal;
|
|
5098
|
-
this.data = data;
|
|
5099
5117
|
}
|
|
5100
5118
|
cancel() {
|
|
5101
5119
|
this.modal.close({
|
|
@@ -5107,22 +5125,20 @@ class DialogComponent {
|
|
|
5107
5125
|
reason: ModalCloseReason.resolve,
|
|
5108
5126
|
});
|
|
5109
5127
|
}
|
|
5110
|
-
|
|
5111
|
-
static { this.ɵ
|
|
5112
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.5", type: DialogComponent, isStandalone: true, selector: "teta-dialog", inputs: { message: "message", buttonText: "buttonText", buttonIcon: "buttonIcon", buttonPalette: "buttonPalette", showCancelButton: "showCancelButton" }, ngImport: i0, template: "<div class=\"padding-2 font-body-2\">\n {{ message | transloco }}\n</div>\n<teta-toolbar class=\"justify-content-end\">\n @if (showCancelButton) {\n <button teta-button (click)=\"cancel()\" [palette]=\"'text'\" [view]=\"'ghost'\">\n {{ 'common.cancel' | transloco }}\n </button>\n }\n\n <button teta-button (click)=\"ok()\" [square]=\"!buttonText?.length\" [palette]=\"buttonPalette\">\n @if (buttonIcon) {\n <teta-icon [name]=\"buttonIcon\"></teta-icon>\n }\n @if (buttonText?.length > 0) {\n {{ buttonText | transloco }}\n }\n </button>\n</teta-toolbar>\n", styles: [":host{display:flex;flex-direction:column;width:300px}\n"], dependencies: [{ kind: "component", type: ToolbarComponent, selector: "teta-toolbar", inputs: ["palette", "class"] }, { kind: "component", type: ButtonComponent, selector: "button[teta-button], teta-button", inputs: ["palette", "class", "view", "square", "viewType", "size"] }, { kind: "component", type: IconComponent, selector: "teta-icon", inputs: ["name", "size", "palette", "class"] }, { kind: "ngmodule", type: TranslocoModule }, { kind: "pipe", type: i1$2.TranslocoPipe, name: "transloco" }] }); }
|
|
5128
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: DialogComponent, deps: [{ token: CurrentModal }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
5129
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.5", type: DialogComponent, isStandalone: true, selector: "teta-dialog", inputs: { title: "title", text: "text", confirm: "confirm", decline: "decline" }, ngImport: i0, template: "<h3 class=\"padding-2 font-title-2\">\n {{ title | transloco }}\n</h3>\n\n@if (text) {\n <p class=\"padding-2 font-body-3\">\n {{ text | transloco }}\n </p>\n}\n\n<teta-toolbar class=\"justify-content-end\">\n @if (decline) {\n <button teta-button (click)=\"cancel()\" [palette]=\"decline?.palette || 'text'\" [view]=\"'ghost'\">\n @if (decline?.icon) {\n <teta-icon [name]=\"decline.icon\"></teta-icon>\n }\n @if (decline.text) {\n {{ decline.text | transloco }}\n }\n </button>\n }\n\n <button teta-button (click)=\"ok()\" [palette]=\"confirm?.palette || 'primary'\">\n @if (confirm?.icon) {\n <teta-icon [name]=\"confirm.icon\"></teta-icon>\n }\n @if (confirm.text) {\n {{ confirm.text | transloco }}\n }\n </button>\n</teta-toolbar>\n", styles: [":host{display:flex;flex-direction:column;width:300px}\n"], dependencies: [{ kind: "component", type: ToolbarComponent, selector: "teta-toolbar", inputs: ["palette", "class"] }, { kind: "component", type: ButtonComponent, selector: "button[teta-button], teta-button", inputs: ["palette", "class", "view", "square", "viewType", "size"] }, { kind: "component", type: IconComponent, selector: "teta-icon", inputs: ["name", "size", "palette", "class"] }, { kind: "ngmodule", type: TranslocoModule }, { kind: "pipe", type: i1$2.TranslocoPipe, name: "transloco" }] }); }
|
|
5113
5130
|
}
|
|
5114
5131
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: DialogComponent, decorators: [{
|
|
5115
5132
|
type: Component,
|
|
5116
|
-
args: [{ selector: 'teta-dialog', imports: [ToolbarComponent, ButtonComponent, IconComponent, TranslocoModule], template: "<
|
|
5117
|
-
}], ctorParameters: () => [{ type: CurrentModal }
|
|
5118
|
-
type: Input
|
|
5119
|
-
|
|
5120
|
-
|
|
5121
|
-
}], buttonIcon: [{
|
|
5133
|
+
args: [{ selector: 'teta-dialog', imports: [ToolbarComponent, ButtonComponent, IconComponent, TranslocoModule], template: "<h3 class=\"padding-2 font-title-2\">\n {{ title | transloco }}\n</h3>\n\n@if (text) {\n <p class=\"padding-2 font-body-3\">\n {{ text | transloco }}\n </p>\n}\n\n<teta-toolbar class=\"justify-content-end\">\n @if (decline) {\n <button teta-button (click)=\"cancel()\" [palette]=\"decline?.palette || 'text'\" [view]=\"'ghost'\">\n @if (decline?.icon) {\n <teta-icon [name]=\"decline.icon\"></teta-icon>\n }\n @if (decline.text) {\n {{ decline.text | transloco }}\n }\n </button>\n }\n\n <button teta-button (click)=\"ok()\" [palette]=\"confirm?.palette || 'primary'\">\n @if (confirm?.icon) {\n <teta-icon [name]=\"confirm.icon\"></teta-icon>\n }\n @if (confirm.text) {\n {{ confirm.text | transloco }}\n }\n </button>\n</teta-toolbar>\n", styles: [":host{display:flex;flex-direction:column;width:300px}\n"] }]
|
|
5134
|
+
}], ctorParameters: () => [{ type: CurrentModal }], propDecorators: { title: [{
|
|
5135
|
+
type: Input,
|
|
5136
|
+
args: [{ required: true }]
|
|
5137
|
+
}], text: [{
|
|
5122
5138
|
type: Input
|
|
5123
|
-
}],
|
|
5139
|
+
}], confirm: [{
|
|
5124
5140
|
type: Input
|
|
5125
|
-
}],
|
|
5141
|
+
}], decline: [{
|
|
5126
5142
|
type: Input
|
|
5127
5143
|
}] } });
|
|
5128
5144
|
|
|
@@ -5300,19 +5316,19 @@ class DialogService {
|
|
|
5300
5316
|
constructor(_modal) {
|
|
5301
5317
|
this._modal = _modal;
|
|
5302
5318
|
}
|
|
5303
|
-
alert(
|
|
5304
|
-
this.createDialog(
|
|
5319
|
+
alert(title) {
|
|
5320
|
+
this.createDialog({ title, decline: null });
|
|
5305
5321
|
}
|
|
5306
|
-
confirm(
|
|
5307
|
-
return this.createDialog(
|
|
5322
|
+
confirm(confirmDialogData) {
|
|
5323
|
+
return this.createDialog(confirmDialogData).pipe(map((result) => result.reason === ModalCloseReason.resolve));
|
|
5308
5324
|
}
|
|
5309
|
-
createDialog(
|
|
5325
|
+
createDialog(dialogData) {
|
|
5326
|
+
const { title, text, confirm, decline } = dialogData;
|
|
5310
5327
|
const dialog = this._modal.create(DialogComponent, {
|
|
5311
|
-
|
|
5312
|
-
|
|
5313
|
-
|
|
5314
|
-
|
|
5315
|
-
showCancelButton,
|
|
5328
|
+
title,
|
|
5329
|
+
text,
|
|
5330
|
+
confirm,
|
|
5331
|
+
decline,
|
|
5316
5332
|
}, {
|
|
5317
5333
|
esc: true,
|
|
5318
5334
|
backdrop: true,
|