@nettyapps/ntyuxv2 0.0.0-stage → 21.0.1
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/README.md +88 -2
- package/fesm2022/nettyapps-ntyuxv2.mjs +1424 -0
- package/fesm2022/nettyapps-ntyuxv2.mjs.map +1 -0
- package/package.json +39 -3
- package/types/nettyapps-ntyuxv2.d.ts +359 -0
|
@@ -0,0 +1,1424 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { Component, inject, Injectable, input, output, ViewContainerRef, ViewChild, Input, ViewEncapsulation, signal, effect, computed, forwardRef, ChangeDetectionStrategy, model, ElementRef, Renderer2, EventEmitter, Output, Directive, Injector, afterNextRender } from '@angular/core';
|
|
3
|
+
import * as i1$1 from '@angular/material/form-field';
|
|
4
|
+
import { MatFormFieldModule } from '@angular/material/form-field';
|
|
5
|
+
import * as i2$1 from '@angular/material/autocomplete';
|
|
6
|
+
import { MatAutocompleteModule, MatAutocompleteTrigger } from '@angular/material/autocomplete';
|
|
7
|
+
import * as i1$2 from '@angular/forms';
|
|
8
|
+
import { FormsModule, NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
9
|
+
import * as i4 from '@angular/material/input';
|
|
10
|
+
import { MatInputModule } from '@angular/material/input';
|
|
11
|
+
import * as i2 from '@angular/material/icon';
|
|
12
|
+
import { MatIconModule } from '@angular/material/icon';
|
|
13
|
+
import { UiBase, NettyUINumberInput, NettyUISearchInput, NettyUIButton } from '@nettyapps/ntyui';
|
|
14
|
+
import { AlertService, Guid, AuthenticationService, NettyMenuService, CommonService, CredentialsService, NettyImageService, PageTitle, RightSidenavService } from '@nettyapps/ntybasev2';
|
|
15
|
+
import { HttpClient } from '@angular/common/http';
|
|
16
|
+
import { EnvironmentProxy } from '@nettyapps/ntycontractv2';
|
|
17
|
+
import { MAT_DIALOG_DATA, MatDialog, MatDialogConfig, MatDialogModule } from '@angular/material/dialog';
|
|
18
|
+
import * as i1 from '@angular/common';
|
|
19
|
+
import { CommonModule, Location, TitleCasePipe } from '@angular/common';
|
|
20
|
+
import * as i3 from '@ngx-translate/core';
|
|
21
|
+
import { TranslateModule, TranslateService } from '@ngx-translate/core';
|
|
22
|
+
import { Clipboard } from '@angular/cdk/clipboard';
|
|
23
|
+
import * as i5 from '@angular/router';
|
|
24
|
+
import { Router, RouterLink, RouterModule, RouterOutlet } from '@angular/router';
|
|
25
|
+
import * as i3$1 from '@angular/material/list';
|
|
26
|
+
import { MatListModule } from '@angular/material/list';
|
|
27
|
+
import * as i4$1 from '@angular/material/menu';
|
|
28
|
+
import { MatMenuModule, MatMenuTrigger } from '@angular/material/menu';
|
|
29
|
+
import * as i3$2 from '@angular/material/toolbar';
|
|
30
|
+
import { MatToolbarModule } from '@angular/material/toolbar';
|
|
31
|
+
import { I18nService } from '@nettyapps/ntyi18n';
|
|
32
|
+
import * as i2$2 from '@angular/material/button';
|
|
33
|
+
import { MatButtonModule } from '@angular/material/button';
|
|
34
|
+
import * as i1$3 from '@angular/material/card';
|
|
35
|
+
import { MatCardModule } from '@angular/material/card';
|
|
36
|
+
import * as i1$4 from '@angular/material/sidenav';
|
|
37
|
+
import { MatSidenavModule } from '@angular/material/sidenav';
|
|
38
|
+
import * as i1$5 from '@angular/cdk/drag-drop';
|
|
39
|
+
import { DragDropModule } from '@angular/cdk/drag-drop';
|
|
40
|
+
|
|
41
|
+
class Ntyuxv2 {
|
|
42
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: Ntyuxv2, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
43
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.1.2", type: Ntyuxv2, isStandalone: true, selector: "lib-ntyuxv2", ngImport: i0, template: `
|
|
44
|
+
<p>
|
|
45
|
+
ntyuxv2 works!
|
|
46
|
+
</p>
|
|
47
|
+
`, isInline: true, styles: [""] });
|
|
48
|
+
}
|
|
49
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: Ntyuxv2, decorators: [{
|
|
50
|
+
type: Component,
|
|
51
|
+
args: [{ selector: 'lib-ntyuxv2', imports: [], template: `
|
|
52
|
+
<p>
|
|
53
|
+
ntyuxv2 works!
|
|
54
|
+
</p>
|
|
55
|
+
` }]
|
|
56
|
+
}] });
|
|
57
|
+
|
|
58
|
+
class AutoCompleteProxy {
|
|
59
|
+
http = inject(HttpClient);
|
|
60
|
+
environmentProxy = inject(EnvironmentProxy);
|
|
61
|
+
getAutocompleteDataFilter(searchTable, endpoint, searchData) {
|
|
62
|
+
let functionUrl = this.environmentProxy.getServerLink(searchTable + '/' + endpoint);
|
|
63
|
+
return this.http.post(functionUrl, searchData);
|
|
64
|
+
}
|
|
65
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: AutoCompleteProxy, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
66
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: AutoCompleteProxy, providedIn: 'root' });
|
|
67
|
+
}
|
|
68
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: AutoCompleteProxy, decorators: [{
|
|
69
|
+
type: Injectable,
|
|
70
|
+
args: [{
|
|
71
|
+
providedIn: 'root',
|
|
72
|
+
}]
|
|
73
|
+
}] });
|
|
74
|
+
|
|
75
|
+
class NtyAutoCompleteFilter {
|
|
76
|
+
coid = null;
|
|
77
|
+
searchString = null;
|
|
78
|
+
fields = null;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* This component can load and display any container which is provided dynamically during run time
|
|
83
|
+
* The only requirement is the component that will be displayed should extend NettyGridBase
|
|
84
|
+
*/
|
|
85
|
+
class AutoCompleteLookup {
|
|
86
|
+
data = inject(MAT_DIALOG_DATA);
|
|
87
|
+
container;
|
|
88
|
+
component = input(...(ngDevMode ? [undefined, { debugName: "component" }] : []));
|
|
89
|
+
filterField = input(null, ...(ngDevMode ? [{ debugName: "filterField" }] : []));
|
|
90
|
+
filterFieldValue = input(null, ...(ngDevMode ? [{ debugName: "filterFieldValue" }] : []));
|
|
91
|
+
filterFieldNumeric = input(false, ...(ngDevMode ? [{ debugName: "filterFieldNumeric" }] : []));
|
|
92
|
+
filterFieldEquality = input('=', ...(ngDevMode ? [{ debugName: "filterFieldEquality" }] : []));
|
|
93
|
+
// Output
|
|
94
|
+
selectedElement = output();
|
|
95
|
+
ngOnInit() {
|
|
96
|
+
this.initializeComponent();
|
|
97
|
+
}
|
|
98
|
+
ngOnChanges(changes) {
|
|
99
|
+
if (this.isComponentConfigChanged(changes)) {
|
|
100
|
+
this.initializeComponent();
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
isComponentConfigChanged(changes) {
|
|
104
|
+
return (!!changes['component'] ||
|
|
105
|
+
!!changes['filterField'] ||
|
|
106
|
+
!!changes['filterFieldValue'] ||
|
|
107
|
+
!!changes['filterFieldNumeric'] ||
|
|
108
|
+
!!changes['filterFieldEquality']);
|
|
109
|
+
}
|
|
110
|
+
initializeComponent() {
|
|
111
|
+
const config = this.data || this.getInputConfig();
|
|
112
|
+
this.loadComponent(config);
|
|
113
|
+
}
|
|
114
|
+
getInputConfig() {
|
|
115
|
+
return {
|
|
116
|
+
component: this.component(),
|
|
117
|
+
filterField: this.filterField(),
|
|
118
|
+
filterFieldValue: this.filterFieldValue(),
|
|
119
|
+
filterFieldNumeric: this.filterFieldNumeric(),
|
|
120
|
+
filterFieldEquality: this.filterFieldEquality(),
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
loadComponent(config) {
|
|
124
|
+
if (!config?.component)
|
|
125
|
+
return;
|
|
126
|
+
this.container.clear();
|
|
127
|
+
const componentRef = this.container.createComponent(config.component);
|
|
128
|
+
componentRef.setInput('embedded', true);
|
|
129
|
+
componentRef.setInput('popupValid', true);
|
|
130
|
+
if (config.filterField !== undefined) {
|
|
131
|
+
componentRef.setInput('filterField', config.filterField);
|
|
132
|
+
}
|
|
133
|
+
if (config.filterFieldValue !== undefined) {
|
|
134
|
+
componentRef.setInput('filterFieldValue', config.filterFieldValue);
|
|
135
|
+
}
|
|
136
|
+
if (config.filterFieldEquality !== undefined) {
|
|
137
|
+
componentRef.setInput('filterFieldEquality', config.filterFieldEquality);
|
|
138
|
+
}
|
|
139
|
+
if (config.filterFieldNumeric !== undefined) {
|
|
140
|
+
componentRef.setInput('filterFieldNumeric', config.filterFieldNumeric);
|
|
141
|
+
}
|
|
142
|
+
const sub = componentRef.instance.selectedElement.subscribe((data) => {
|
|
143
|
+
this.selectedElement.emit(data);
|
|
144
|
+
});
|
|
145
|
+
componentRef.onDestroy(() => sub.unsubscribe());
|
|
146
|
+
}
|
|
147
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: AutoCompleteLookup, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
148
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.1.2", type: AutoCompleteLookup, isStandalone: true, selector: "ntybase-auto-complete-lookup", inputs: { component: { classPropertyName: "component", publicName: "component", isSignal: true, isRequired: false, transformFunction: null }, filterField: { classPropertyName: "filterField", publicName: "filterField", isSignal: true, isRequired: false, transformFunction: null }, filterFieldValue: { classPropertyName: "filterFieldValue", publicName: "filterFieldValue", isSignal: true, isRequired: false, transformFunction: null }, filterFieldNumeric: { classPropertyName: "filterFieldNumeric", publicName: "filterFieldNumeric", isSignal: true, isRequired: false, transformFunction: null }, filterFieldEquality: { classPropertyName: "filterFieldEquality", publicName: "filterFieldEquality", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { selectedElement: "selectedElement" }, viewQueries: [{ propertyName: "container", first: true, predicate: ["container"], descendants: true, read: ViewContainerRef, static: true }], usesOnChanges: true, ngImport: i0, template: ` <ng-template #container></ng-template> `, isInline: true });
|
|
149
|
+
}
|
|
150
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: AutoCompleteLookup, decorators: [{
|
|
151
|
+
type: Component,
|
|
152
|
+
args: [{
|
|
153
|
+
selector: 'ntybase-auto-complete-lookup',
|
|
154
|
+
imports: [],
|
|
155
|
+
template: ` <ng-template #container></ng-template> `,
|
|
156
|
+
}]
|
|
157
|
+
}], propDecorators: { container: [{
|
|
158
|
+
type: ViewChild,
|
|
159
|
+
args: ['container', { read: ViewContainerRef, static: true }]
|
|
160
|
+
}], component: [{ type: i0.Input, args: [{ isSignal: true, alias: "component", required: false }] }], filterField: [{ type: i0.Input, args: [{ isSignal: true, alias: "filterField", required: false }] }], filterFieldValue: [{ type: i0.Input, args: [{ isSignal: true, alias: "filterFieldValue", required: false }] }], filterFieldNumeric: [{ type: i0.Input, args: [{ isSignal: true, alias: "filterFieldNumeric", required: false }] }], filterFieldEquality: [{ type: i0.Input, args: [{ isSignal: true, alias: "filterFieldEquality", required: false }] }], selectedElement: [{ type: i0.Output, args: ["selectedElement"] }] } });
|
|
161
|
+
|
|
162
|
+
class AutoCompletePopupMenu {
|
|
163
|
+
field = '';
|
|
164
|
+
recordGuid;
|
|
165
|
+
fieldDisabled = false;
|
|
166
|
+
componentPath = '';
|
|
167
|
+
inputValue = '';
|
|
168
|
+
Result = output();
|
|
169
|
+
clipboard = inject(Clipboard);
|
|
170
|
+
alertService = inject(AlertService);
|
|
171
|
+
environment = inject(EnvironmentProxy);
|
|
172
|
+
ngOnInit() { }
|
|
173
|
+
gotoNew() {
|
|
174
|
+
if (!this.componentPath)
|
|
175
|
+
return;
|
|
176
|
+
// Split the component path into segments
|
|
177
|
+
const pathSegments = this.componentPath.split('/').filter((p) => p);
|
|
178
|
+
this.gotoNewTab(pathSegments, '', 'new');
|
|
179
|
+
this.Result.emit('New');
|
|
180
|
+
}
|
|
181
|
+
gotoMain() {
|
|
182
|
+
if (!this.componentPath || !this.recordGuid)
|
|
183
|
+
return;
|
|
184
|
+
// Split the component path into segments
|
|
185
|
+
const pathSegments = this.componentPath.split('/').filter((p) => p);
|
|
186
|
+
this.gotoNewTab(pathSegments, this.recordGuid, 'edit');
|
|
187
|
+
this.Result.emit('Main');
|
|
188
|
+
}
|
|
189
|
+
gotoLookup() {
|
|
190
|
+
if (!this.fieldDisabled) {
|
|
191
|
+
this.Result.emit('Lookup');
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
gotoNewTab(target, params, type) {
|
|
195
|
+
if (!target || target.length === 0)
|
|
196
|
+
return;
|
|
197
|
+
const origin = window.location.origin;
|
|
198
|
+
let baseHref = this.environment.getBaseHref();
|
|
199
|
+
baseHref = baseHref.replace(/\/$/, "").replace(/^\//, "");
|
|
200
|
+
const path = target.join('/');
|
|
201
|
+
let url;
|
|
202
|
+
url = `${origin}/${baseHref}/${path}`;
|
|
203
|
+
const queryParams = [];
|
|
204
|
+
if (params) {
|
|
205
|
+
queryParams.push(`parameters=${encodeURIComponent(JSON.stringify(params))}`);
|
|
206
|
+
}
|
|
207
|
+
if (type) {
|
|
208
|
+
queryParams.push(`type=${type}`);
|
|
209
|
+
}
|
|
210
|
+
queryParams.push('isNewTab=true');
|
|
211
|
+
url += `?${queryParams.join('&')}`;
|
|
212
|
+
window.open(url, '_blank');
|
|
213
|
+
}
|
|
214
|
+
copyToClipboard() {
|
|
215
|
+
if (this.inputValue) {
|
|
216
|
+
this.clipboard.copy(this.inputValue);
|
|
217
|
+
this.alertService.showAlert('@copiedToClipboard');
|
|
218
|
+
this.Result.emit('Copy');
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: AutoCompletePopupMenu, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
222
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.1.2", type: AutoCompletePopupMenu, isStandalone: true, selector: "ntybase-auto-complete-popup-menu", inputs: { field: "field", recordGuid: "recordGuid", fieldDisabled: "fieldDisabled", componentPath: "componentPath", inputValue: "inputValue" }, outputs: { Result: "Result" }, ngImport: i0, template: "<div class=\"dialogbase\">\n <div class=\"menu\">\n <ul class=\"list-group\">\n <li\n class=\"list-group-item list-group-item-action d-flex justify-content-between align-items-center menu-item\"\n >\n <span (click)=\"copyToClipboard()\" class=\"align-line\"\n ><mat-icon>content_copy</mat-icon>{{'@copy'| translate}}</span\n >\n </li>\n <li\n class=\"list-group-item list-group-item-action d-flex justify-content-between align-items-center menu-item\"\n >\n <span (click)=\"gotoMain()\" class=\"align-line\"\n ><mat-icon>edit</mat-icon>{{'@popupGotoRecordDefinition'|\n translate}}</span\n >\n </li>\n <li\n class=\"list-group-item list-group-item-action d-flex justify-content-between align-items-center menu-item\"\n >\n <span (click)=\"gotoNew()\" class=\"align-line\"\n ><mat-icon>add</mat-icon>{{'@popupNewRecord'| translate}}</span\n >\n </li>\n <li\n class=\"list-group-item list-group-item-action d-flex justify-content-between align-items-center\"\n [ngClass]=\"{'menu-item':!fieldDisabled , 'menu-item-disabled':fieldDisabled }\"\n >\n <span (click)=\"gotoLookup()\" class=\"align-line\"\n ><mat-icon>search</mat-icon>{{'@popupSelectFromList'|translate}}</span\n >\n </li>\n </ul>\n </div>\n</div>\n", styles: [".dialogbase{background:#0000001a;padding:0;border-radius:12px;overflow:hidden;box-shadow:0 4px 20px #00000026}.menu{background:var(--mat-sys-primary-container);padding:0;display:flex;border-radius:inherit}.align-line{display:flex;vertical-align:middle;align-items:center;gap:12px;padding:0 8px}.menu-item{padding:12px 16px;display:flex;vertical-align:middle;cursor:pointer;transition:all .2s ease-out;border-radius:8px;margin:4px;color:var(--mat-sys-on-primary-container)}.menu-item:hover{background:var(--mat-sys-on-primary-fixed);color:var(--mat-sys-on-primary);transform:translateY(-2px);box-shadow:0 2px 8px #0000001a}.menu-item:hover .mat-icon{color:var(--mat-sys-on-primary);transform:scale(1.05)}.menu-item-disabled,.menu-item-disabled:hover{background:var(--mat-sys-on-primary-fixed);color:var(--mat-sys-on-primary);font-style:italic;opacity:.7;cursor:not-allowed}.menu-item-disabled .mat-icon,.menu-item-disabled:hover .mat-icon{color:var(--mat-sys-on-primary)}.mat-icon{transition:all .2s ease-out;font-size:20px;width:20px;height:20px}.list-group{list-style:none;padding:8px;margin:0;width:100%}.list-group-item{background-position:bottom;background-size:100% 1px;background-repeat:no-repeat;padding-bottom:12px;margin-bottom:4px}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i2.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: TranslateModule }, { kind: "pipe", type: i3.TranslatePipe, name: "translate" }], encapsulation: i0.ViewEncapsulation.None });
|
|
223
|
+
}
|
|
224
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: AutoCompletePopupMenu, decorators: [{
|
|
225
|
+
type: Component,
|
|
226
|
+
args: [{ selector: 'ntybase-auto-complete-popup-menu', imports: [CommonModule, MatIconModule, TranslateModule], encapsulation: ViewEncapsulation.None, template: "<div class=\"dialogbase\">\n <div class=\"menu\">\n <ul class=\"list-group\">\n <li\n class=\"list-group-item list-group-item-action d-flex justify-content-between align-items-center menu-item\"\n >\n <span (click)=\"copyToClipboard()\" class=\"align-line\"\n ><mat-icon>content_copy</mat-icon>{{'@copy'| translate}}</span\n >\n </li>\n <li\n class=\"list-group-item list-group-item-action d-flex justify-content-between align-items-center menu-item\"\n >\n <span (click)=\"gotoMain()\" class=\"align-line\"\n ><mat-icon>edit</mat-icon>{{'@popupGotoRecordDefinition'|\n translate}}</span\n >\n </li>\n <li\n class=\"list-group-item list-group-item-action d-flex justify-content-between align-items-center menu-item\"\n >\n <span (click)=\"gotoNew()\" class=\"align-line\"\n ><mat-icon>add</mat-icon>{{'@popupNewRecord'| translate}}</span\n >\n </li>\n <li\n class=\"list-group-item list-group-item-action d-flex justify-content-between align-items-center\"\n [ngClass]=\"{'menu-item':!fieldDisabled , 'menu-item-disabled':fieldDisabled }\"\n >\n <span (click)=\"gotoLookup()\" class=\"align-line\"\n ><mat-icon>search</mat-icon>{{'@popupSelectFromList'|translate}}</span\n >\n </li>\n </ul>\n </div>\n</div>\n", styles: [".dialogbase{background:#0000001a;padding:0;border-radius:12px;overflow:hidden;box-shadow:0 4px 20px #00000026}.menu{background:var(--mat-sys-primary-container);padding:0;display:flex;border-radius:inherit}.align-line{display:flex;vertical-align:middle;align-items:center;gap:12px;padding:0 8px}.menu-item{padding:12px 16px;display:flex;vertical-align:middle;cursor:pointer;transition:all .2s ease-out;border-radius:8px;margin:4px;color:var(--mat-sys-on-primary-container)}.menu-item:hover{background:var(--mat-sys-on-primary-fixed);color:var(--mat-sys-on-primary);transform:translateY(-2px);box-shadow:0 2px 8px #0000001a}.menu-item:hover .mat-icon{color:var(--mat-sys-on-primary);transform:scale(1.05)}.menu-item-disabled,.menu-item-disabled:hover{background:var(--mat-sys-on-primary-fixed);color:var(--mat-sys-on-primary);font-style:italic;opacity:.7;cursor:not-allowed}.menu-item-disabled .mat-icon,.menu-item-disabled:hover .mat-icon{color:var(--mat-sys-on-primary)}.mat-icon{transition:all .2s ease-out;font-size:20px;width:20px;height:20px}.list-group{list-style:none;padding:8px;margin:0;width:100%}.list-group-item{background-position:bottom;background-size:100% 1px;background-repeat:no-repeat;padding-bottom:12px;margin-bottom:4px}\n"] }]
|
|
227
|
+
}], propDecorators: { field: [{
|
|
228
|
+
type: Input
|
|
229
|
+
}], recordGuid: [{
|
|
230
|
+
type: Input
|
|
231
|
+
}], fieldDisabled: [{
|
|
232
|
+
type: Input
|
|
233
|
+
}], componentPath: [{
|
|
234
|
+
type: Input
|
|
235
|
+
}], inputValue: [{
|
|
236
|
+
type: Input
|
|
237
|
+
}], Result: [{ type: i0.Output, args: ["Result"] }] } });
|
|
238
|
+
|
|
239
|
+
class SelectionItem {
|
|
240
|
+
name = null;
|
|
241
|
+
value = null;
|
|
242
|
+
constructor(_value = null, _name = null) {
|
|
243
|
+
this.name = _name;
|
|
244
|
+
this.value = _value;
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
class AutoComplete extends UiBase {
|
|
248
|
+
// Input parameters
|
|
249
|
+
tableName = input('', ...(ngDevMode ? [{ debugName: "tableName" }] : []));
|
|
250
|
+
apiEndpoint = input('', ...(ngDevMode ? [{ debugName: "apiEndpoint" }] : []));
|
|
251
|
+
showSearchButton = input(true, ...(ngDevMode ? [{ debugName: "showSearchButton" }] : []));
|
|
252
|
+
searchAfter = input(3, ...(ngDevMode ? [{ debugName: "searchAfter" }] : []));
|
|
253
|
+
fieldCode = input(null, ...(ngDevMode ? [{ debugName: "fieldCode" }] : []));
|
|
254
|
+
fieldName = input(null, ...(ngDevMode ? [{ debugName: "fieldName" }] : []));
|
|
255
|
+
lookupComponent = input(null, ...(ngDevMode ? [{ debugName: "lookupComponent" }] : []));
|
|
256
|
+
lookupComponentPath = input(null, ...(ngDevMode ? [{ debugName: "lookupComponentPath" }] : []));
|
|
257
|
+
filterField = input(null, ...(ngDevMode ? [{ debugName: "filterField" }] : []));
|
|
258
|
+
filterFieldValue = input(null, ...(ngDevMode ? [{ debugName: "filterFieldValue" }] : []));
|
|
259
|
+
filterFieldNumeric = input(false, ...(ngDevMode ? [{ debugName: "filterFieldNumeric" }] : []));
|
|
260
|
+
filterFieldEquality = input('=', ...(ngDevMode ? [{ debugName: "filterFieldEquality" }] : []));
|
|
261
|
+
debounceTime = input(500, ...(ngDevMode ? [{ debugName: "debounceTime" }] : []));
|
|
262
|
+
searchOnFocus = input(false, ...(ngDevMode ? [{ debugName: "searchOnFocus" }] : []));
|
|
263
|
+
staticData = input(null, ...(ngDevMode ? [{ debugName: "staticData" }] : []));
|
|
264
|
+
apiPrefix = input('', ...(ngDevMode ? [{ debugName: "apiPrefix" }] : []));
|
|
265
|
+
internalTableName = signal('', ...(ngDevMode ? [{ debugName: "internalTableName" }] : []));
|
|
266
|
+
// Inject dependencies
|
|
267
|
+
autoCompleteService = inject(AutoCompleteProxy);
|
|
268
|
+
dialog = inject(MatDialog);
|
|
269
|
+
autoCompleteTrigger;
|
|
270
|
+
inputField;
|
|
271
|
+
// Signal parameters
|
|
272
|
+
searchText = signal('', ...(ngDevMode ? [{ debugName: "searchText" }] : []));
|
|
273
|
+
selectedOption = signal(null, ...(ngDevMode ? [{ debugName: "selectedOption" }] : []));
|
|
274
|
+
loadedOptions = signal([], ...(ngDevMode ? [{ debugName: "loadedOptions" }] : []));
|
|
275
|
+
searchSignal = signal('', ...(ngDevMode ? [{ debugName: "searchSignal" }] : []));
|
|
276
|
+
debounceTimeout;
|
|
277
|
+
constructor() {
|
|
278
|
+
super();
|
|
279
|
+
effect(() => {
|
|
280
|
+
const prefix = this.apiPrefix();
|
|
281
|
+
const table = this.tableName();
|
|
282
|
+
if (table) {
|
|
283
|
+
console.warn(`'tableName' yerine artık 'apiPrefix' kullanımı önerilir.`);
|
|
284
|
+
this.internalTableName.set(table);
|
|
285
|
+
}
|
|
286
|
+
else if (prefix) {
|
|
287
|
+
this.internalTableName.set(prefix);
|
|
288
|
+
}
|
|
289
|
+
});
|
|
290
|
+
// Sync form control with selected option
|
|
291
|
+
effect(() => {
|
|
292
|
+
const option = this.selectedOption();
|
|
293
|
+
if (option) {
|
|
294
|
+
this.searchText.set(option.name || '');
|
|
295
|
+
}
|
|
296
|
+
else if (this.value() && !this.selectedOption()) {
|
|
297
|
+
const found = this.loadedOptions().find((opt) => opt.value === this.value());
|
|
298
|
+
if (found) {
|
|
299
|
+
this.selectedOption.set(found);
|
|
300
|
+
this.searchText.set(found.name || '');
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
});
|
|
304
|
+
// Then watch the debounced signal:
|
|
305
|
+
effect((onCleanup) => {
|
|
306
|
+
const searchValue = this.searchSignal();
|
|
307
|
+
clearTimeout(this.debounceTimeout);
|
|
308
|
+
this.debounceTimeout = setTimeout(() => {
|
|
309
|
+
if (this.shouldTriggerSearch(searchValue)) {
|
|
310
|
+
this.loadAutoCompleteData(searchValue);
|
|
311
|
+
}
|
|
312
|
+
else {
|
|
313
|
+
this.loadedOptions.set([]);
|
|
314
|
+
}
|
|
315
|
+
}, this.debounceTime());
|
|
316
|
+
onCleanup(() => {
|
|
317
|
+
clearTimeout(this.debounceTimeout);
|
|
318
|
+
});
|
|
319
|
+
});
|
|
320
|
+
effect(() => {
|
|
321
|
+
const currentValue = this.value();
|
|
322
|
+
if (!currentValue || currentValue === Guid.empty) {
|
|
323
|
+
this.searchText.set('');
|
|
324
|
+
this.selectedOption.set(null);
|
|
325
|
+
if (this.inputField?.nativeElement) {
|
|
326
|
+
this.inputField.nativeElement.value = '';
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
});
|
|
330
|
+
}
|
|
331
|
+
shouldTriggerSearch(searchValue) {
|
|
332
|
+
return searchValue.length >= this.searchAfter();
|
|
333
|
+
}
|
|
334
|
+
hasValue = computed(() => {
|
|
335
|
+
const val = this.value();
|
|
336
|
+
return val !== null && val !== undefined && val !== '' && val !== Guid.empty;
|
|
337
|
+
}, ...(ngDevMode ? [{ debugName: "hasValue" }] : []));
|
|
338
|
+
hasClearableValue = computed(() => {
|
|
339
|
+
return this.hasValue() || this.searchText().length > 0;
|
|
340
|
+
}, ...(ngDevMode ? [{ debugName: "hasClearableValue" }] : []));
|
|
341
|
+
filteredData = computed(() => {
|
|
342
|
+
return this.loadedOptions();
|
|
343
|
+
}, ...(ngDevMode ? [{ debugName: "filteredData" }] : []));
|
|
344
|
+
onInputChanged(event) {
|
|
345
|
+
const value = event.target.value;
|
|
346
|
+
this.searchText.set(value);
|
|
347
|
+
this.onTouched();
|
|
348
|
+
// Clear selection if text doesn't match
|
|
349
|
+
if (this.selectedOption() && this.selectedOption()?.name !== value) {
|
|
350
|
+
this.selectedOption.set(null);
|
|
351
|
+
this.value.set(''); // Clear value to alert parent form
|
|
352
|
+
}
|
|
353
|
+
if (value.length === 0) {
|
|
354
|
+
this.clearInput();
|
|
355
|
+
return;
|
|
356
|
+
}
|
|
357
|
+
this.searchSignal.set(value);
|
|
358
|
+
this.autoCompleteTrigger.closePanel();
|
|
359
|
+
}
|
|
360
|
+
handleDataArrival(options) {
|
|
361
|
+
this.loadedOptions.set(options);
|
|
362
|
+
if (options.length === 1) {
|
|
363
|
+
this.selectedOption.set(options[0]);
|
|
364
|
+
this.value.set(options[0].value);
|
|
365
|
+
this.searchText.set(options[0].name || '');
|
|
366
|
+
}
|
|
367
|
+
else if (options.length > 1) {
|
|
368
|
+
this.autoCompleteTrigger.openPanel();
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
loadAutoCompleteData(searchValue) {
|
|
372
|
+
const term = searchValue.toLowerCase().trim();
|
|
373
|
+
const staticItems = this.staticData();
|
|
374
|
+
if (staticItems && staticItems.length > 0) {
|
|
375
|
+
const filtered = staticItems.filter(item => item.name?.toLowerCase().includes(term));
|
|
376
|
+
this.handleDataArrival(filtered);
|
|
377
|
+
return;
|
|
378
|
+
}
|
|
379
|
+
this.loadedOptions.set([]);
|
|
380
|
+
const filter = new NtyAutoCompleteFilter();
|
|
381
|
+
filter.searchString =
|
|
382
|
+
searchValue.trim() === '' && searchValue.length >= this.searchAfter()
|
|
383
|
+
? ''
|
|
384
|
+
: searchValue;
|
|
385
|
+
filter.fields = [];
|
|
386
|
+
if (this.filterField() && this.filterField().trim().length > 0) {
|
|
387
|
+
const fields = {
|
|
388
|
+
equalitySign: this.filterFieldEquality(),
|
|
389
|
+
fieldName: this.filterField(),
|
|
390
|
+
fieldValue: this.filterFieldValue(),
|
|
391
|
+
numeric: this.filterFieldNumeric(),
|
|
392
|
+
};
|
|
393
|
+
filter.fields?.push(fields);
|
|
394
|
+
}
|
|
395
|
+
const endpoint = this.apiEndpoint() || 'AutoCompleteFilter';
|
|
396
|
+
this.autoCompleteService
|
|
397
|
+
.getAutocompleteDataFilter(this.internalTableName(), endpoint, filter)
|
|
398
|
+
.subscribe({
|
|
399
|
+
next: (data) => {
|
|
400
|
+
if (data && Array.isArray(data)) {
|
|
401
|
+
const options = data.map((item) => ({
|
|
402
|
+
name: item.text,
|
|
403
|
+
value: item.guidValue,
|
|
404
|
+
}));
|
|
405
|
+
this.loadedOptions.set(options);
|
|
406
|
+
if (options.length === 1) {
|
|
407
|
+
this.selectedOption.set(options[0]);
|
|
408
|
+
this.value.set(options[0].value);
|
|
409
|
+
this.searchText.set(options[0].name || '');
|
|
410
|
+
}
|
|
411
|
+
else if (options.length > 1) {
|
|
412
|
+
this.autoCompleteTrigger.openPanel();
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
},
|
|
416
|
+
error: (err) => {
|
|
417
|
+
this.alertService.showAlert(err.message);
|
|
418
|
+
},
|
|
419
|
+
});
|
|
420
|
+
}
|
|
421
|
+
clearInput() {
|
|
422
|
+
clearTimeout(this.debounceTimeout);
|
|
423
|
+
const clearedValue = this.required() ? null : Guid.empty;
|
|
424
|
+
this.selectedOption.set(null);
|
|
425
|
+
this.value.set(clearedValue);
|
|
426
|
+
this.searchText.set('');
|
|
427
|
+
this.searchSignal.set('');
|
|
428
|
+
this.loadedOptions.set([]);
|
|
429
|
+
if (this.inputField?.nativeElement) {
|
|
430
|
+
this.inputField.nativeElement.value = '';
|
|
431
|
+
}
|
|
432
|
+
this.autoCompleteTrigger?.closePanel();
|
|
433
|
+
this.onTouched();
|
|
434
|
+
}
|
|
435
|
+
onPaste(event) {
|
|
436
|
+
const clipboardData = event.clipboardData;
|
|
437
|
+
if (!clipboardData)
|
|
438
|
+
return;
|
|
439
|
+
const pastedText = clipboardData.getData('text');
|
|
440
|
+
this.searchText.set(pastedText);
|
|
441
|
+
this.searchSignal.set(pastedText);
|
|
442
|
+
}
|
|
443
|
+
displayFn(item) {
|
|
444
|
+
return this.searchText();
|
|
445
|
+
}
|
|
446
|
+
optionSelected(event) {
|
|
447
|
+
const selectedValue = event.option.value;
|
|
448
|
+
const selected = this.loadedOptions().find((opt) => opt.value === selectedValue);
|
|
449
|
+
if (selected) {
|
|
450
|
+
this.selectedOption.set(selected);
|
|
451
|
+
this.value.set(selected.value);
|
|
452
|
+
this.searchText.set(selected.name || '');
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
writeValue(value) {
|
|
456
|
+
this.value.set(value);
|
|
457
|
+
if (!value || value === Guid.empty) {
|
|
458
|
+
this.selectedOption.set(null);
|
|
459
|
+
this.searchText.set('');
|
|
460
|
+
return;
|
|
461
|
+
}
|
|
462
|
+
if (this.fieldCode()) {
|
|
463
|
+
this.selectedOption.set({ value, name: this.fieldCode() });
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
onLookup() {
|
|
467
|
+
if (!this.lookupComponent())
|
|
468
|
+
return;
|
|
469
|
+
const dialogRef = this.dialog.open(AutoCompleteLookup, {
|
|
470
|
+
height: 'auto',
|
|
471
|
+
width: '100%',
|
|
472
|
+
maxWidth: '100%',
|
|
473
|
+
maxHeight: 'auto',
|
|
474
|
+
data: {
|
|
475
|
+
component: this.lookupComponent(),
|
|
476
|
+
...(this.filterField() && {
|
|
477
|
+
filterField: this.filterField(),
|
|
478
|
+
filterFieldValue: this.filterFieldValue(),
|
|
479
|
+
filterFieldEquality: this.filterFieldEquality(),
|
|
480
|
+
filterFieldNumeric: this.filterFieldNumeric(),
|
|
481
|
+
}),
|
|
482
|
+
},
|
|
483
|
+
});
|
|
484
|
+
dialogRef.componentInstance.selectedElement.subscribe((data) => {
|
|
485
|
+
if (data) {
|
|
486
|
+
const selection = new SelectionItem(data.value, data.text);
|
|
487
|
+
this.selectedOption.set(selection);
|
|
488
|
+
this.value.set(selection.value);
|
|
489
|
+
this.searchText.set(selection.name || '');
|
|
490
|
+
}
|
|
491
|
+
dialogRef.close();
|
|
492
|
+
});
|
|
493
|
+
}
|
|
494
|
+
/** Popup screen to goto main table
|
|
495
|
+
*
|
|
496
|
+
* @param event
|
|
497
|
+
* @returns
|
|
498
|
+
*/
|
|
499
|
+
rightClick(event) {
|
|
500
|
+
event.stopPropagation();
|
|
501
|
+
const dialogConfig = new MatDialogConfig();
|
|
502
|
+
dialogConfig.position = {
|
|
503
|
+
top: event.clientY + 'px',
|
|
504
|
+
left: event.clientX + 'px',
|
|
505
|
+
};
|
|
506
|
+
dialogConfig.height = 'auto';
|
|
507
|
+
dialogConfig.width = 'auto';
|
|
508
|
+
dialogConfig.panelClass = 'foo';
|
|
509
|
+
const dialogRef = this.dialog.open(AutoCompletePopupMenu, dialogConfig);
|
|
510
|
+
dialogRef.componentInstance.field = this.tableName();
|
|
511
|
+
dialogRef.componentInstance.recordGuid = this.value();
|
|
512
|
+
dialogRef.componentInstance.fieldDisabled = this.disabled();
|
|
513
|
+
dialogRef.componentInstance.componentPath = this.lookupComponentPath();
|
|
514
|
+
dialogRef.componentInstance.inputValue = this.searchText();
|
|
515
|
+
dialogRef.componentInstance.Result.subscribe((result) => {
|
|
516
|
+
switch (result) {
|
|
517
|
+
case 'Lookup':
|
|
518
|
+
dialogRef.close();
|
|
519
|
+
this.onLookup();
|
|
520
|
+
break;
|
|
521
|
+
default:
|
|
522
|
+
dialogRef.close();
|
|
523
|
+
break;
|
|
524
|
+
}
|
|
525
|
+
});
|
|
526
|
+
return false;
|
|
527
|
+
}
|
|
528
|
+
onFocus() {
|
|
529
|
+
if (this.searchOnFocus() && !this.disabled()) {
|
|
530
|
+
const currentValue = this.inputField.nativeElement.value || '';
|
|
531
|
+
const isAlreadySelected = this.selectedOption()?.name === currentValue;
|
|
532
|
+
const hasValue = this.hasValue();
|
|
533
|
+
if (isAlreadySelected || hasValue) {
|
|
534
|
+
return;
|
|
535
|
+
}
|
|
536
|
+
this.loadAutoCompleteData(currentValue);
|
|
537
|
+
}
|
|
538
|
+
}
|
|
539
|
+
// Validation
|
|
540
|
+
updateValidators() {
|
|
541
|
+
if (!this.ngModel?.control)
|
|
542
|
+
return;
|
|
543
|
+
const validators = [];
|
|
544
|
+
if (this.required()) {
|
|
545
|
+
validators.push(() => {
|
|
546
|
+
const val = this.value();
|
|
547
|
+
const isInvalid = val === null || val === undefined || val === '' || val === Guid.empty;
|
|
548
|
+
return isInvalid ? { required: true } : null;
|
|
549
|
+
});
|
|
550
|
+
}
|
|
551
|
+
if (this.disabled()) {
|
|
552
|
+
this.ngModel.control.disable({ emitEvent: false });
|
|
553
|
+
}
|
|
554
|
+
else {
|
|
555
|
+
this.ngModel.control.enable({ emitEvent: false });
|
|
556
|
+
}
|
|
557
|
+
this.ngModel.control.setValidators(validators);
|
|
558
|
+
this.ngModel.control.updateValueAndValidity({ emitEvent: false });
|
|
559
|
+
}
|
|
560
|
+
getErrorMessage() {
|
|
561
|
+
if (!this.ngModel?.control)
|
|
562
|
+
return undefined;
|
|
563
|
+
if (this.ngModel.control.hasError('required')) {
|
|
564
|
+
return this.errorMessages()?.['required'] || 'Bu alan zorunludur.';
|
|
565
|
+
}
|
|
566
|
+
return super.getErrorMessage();
|
|
567
|
+
}
|
|
568
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: AutoComplete, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
569
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.1.2", type: AutoComplete, isStandalone: true, selector: "ntyux-auto-complete", inputs: { tableName: { classPropertyName: "tableName", publicName: "tableName", isSignal: true, isRequired: false, transformFunction: null }, apiEndpoint: { classPropertyName: "apiEndpoint", publicName: "apiEndpoint", isSignal: true, isRequired: false, transformFunction: null }, showSearchButton: { classPropertyName: "showSearchButton", publicName: "showSearchButton", isSignal: true, isRequired: false, transformFunction: null }, searchAfter: { classPropertyName: "searchAfter", publicName: "searchAfter", isSignal: true, isRequired: false, transformFunction: null }, fieldCode: { classPropertyName: "fieldCode", publicName: "fieldCode", isSignal: true, isRequired: false, transformFunction: null }, fieldName: { classPropertyName: "fieldName", publicName: "fieldName", isSignal: true, isRequired: false, transformFunction: null }, lookupComponent: { classPropertyName: "lookupComponent", publicName: "lookupComponent", isSignal: true, isRequired: false, transformFunction: null }, lookupComponentPath: { classPropertyName: "lookupComponentPath", publicName: "lookupComponentPath", isSignal: true, isRequired: false, transformFunction: null }, filterField: { classPropertyName: "filterField", publicName: "filterField", isSignal: true, isRequired: false, transformFunction: null }, filterFieldValue: { classPropertyName: "filterFieldValue", publicName: "filterFieldValue", isSignal: true, isRequired: false, transformFunction: null }, filterFieldNumeric: { classPropertyName: "filterFieldNumeric", publicName: "filterFieldNumeric", isSignal: true, isRequired: false, transformFunction: null }, filterFieldEquality: { classPropertyName: "filterFieldEquality", publicName: "filterFieldEquality", isSignal: true, isRequired: false, transformFunction: null }, debounceTime: { classPropertyName: "debounceTime", publicName: "debounceTime", isSignal: true, isRequired: false, transformFunction: null }, searchOnFocus: { classPropertyName: "searchOnFocus", publicName: "searchOnFocus", isSignal: true, isRequired: false, transformFunction: null }, staticData: { classPropertyName: "staticData", publicName: "staticData", isSignal: true, isRequired: false, transformFunction: null }, apiPrefix: { classPropertyName: "apiPrefix", publicName: "apiPrefix", isSignal: true, isRequired: false, transformFunction: null } }, providers: [
|
|
570
|
+
{
|
|
571
|
+
provide: NG_VALUE_ACCESSOR,
|
|
572
|
+
useExisting: forwardRef(() => AutoComplete),
|
|
573
|
+
multi: true,
|
|
574
|
+
},
|
|
575
|
+
], viewQueries: [{ propertyName: "autoCompleteTrigger", first: true, predicate: MatAutocompleteTrigger, descendants: true }, { propertyName: "inputField", first: true, predicate: ["autoCompleteInput"], descendants: true }], usesInheritance: true, ngImport: i0, template: "<mat-form-field class=\"example-full-width\" [appearance]=\"appearance()\" [class.required-field]=\"required()\"\n [class.required-with-value]=\"required() && hasValue()\">\n @if (label()) {\n <mat-label>{{ label() }}</mat-label>\n }\n\n <input type=\"text\" #autoCompleteInput matInput #inputModel=\"ngModel\" [matAutocomplete]=\"auto\" [ngModel]=\"searchText()\" \n [placeholder]=\"requiredPlaceholder()\" (input)=\"onInputChanged($event)\" \n (paste)=\"onPaste($event)\" (contextmenu)=\"rightClick($event)\" (focus)=\"onFocus()\" />\n\n @if (hasClearableValue() && !disabled()) {\n <button mat-icon-button matSuffix type=\"button\" (click)=\"clearInput()\" aria-label=\"Clear\"\n class=\"clear-btn number-clear-btn\">\n <mat-icon>cancel</mat-icon>\n </button>\n } @if (showSearchButton()) {\n <button mat-icon-button matSuffix type=\"button\" aria-label=\"Search\" (click)=\"onLookup()\" class=\"search-btn\"\n [disabled]=\"disabled()\">\n <mat-icon>search</mat-icon>\n </button>\n }\n <mat-autocomplete #auto=\"matAutocomplete\" [displayWith]=\"displayFn.bind(this)\"\n (optionSelected)=\"optionSelected($event)\">\n @for (option of filteredData(); track option.value) {\n <mat-option [value]=\"option.value\"> {{ option.name }} </mat-option>\n }\n </mat-autocomplete>\n\n @if (inputModel?.invalid && (inputModel?.dirty || inputModel?.touched)) {\n <mat-error>{{ getErrorMessage() }}</mat-error>\n }\n</mat-form-field>", styles: [".example-full-width{width:100%;max-width:500px}::ng-deep .mat-mdc-form-field-subscript-wrapper{width:auto;height:0}.clear-btn{background:none;border:none;box-shadow:none;cursor:pointer}.search-icon{background:none;border:none;box-shadow:none;opacity:1;cursor:pointer}.search-icon:hover,.clear-btn:hover{color:var(--mat-sys-primary)}.required-field{background-color:var(--mat-sys-required)!important}.required-with-value{background-color:transparent!important}\n"], dependencies: [{ kind: "ngmodule", type: MatFormFieldModule }, { kind: "component", type: i1$1.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i1$1.MatLabel, selector: "mat-label" }, { kind: "directive", type: i1$1.MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "directive", type: i1$1.MatSuffix, selector: "[matSuffix], [matIconSuffix], [matTextSuffix]", inputs: ["matTextSuffix"] }, { kind: "ngmodule", type: MatAutocompleteModule }, { kind: "component", type: i2$1.MatAutocomplete, selector: "mat-autocomplete", inputs: ["aria-label", "aria-labelledby", "displayWith", "autoActiveFirstOption", "autoSelectActiveOption", "requireSelection", "panelWidth", "disableRipple", "class", "hideSingleSelectionIndicator"], outputs: ["optionSelected", "opened", "closed", "optionActivated"], exportAs: ["matAutocomplete"] }, { kind: "component", type: i2$1.MatOption, selector: "mat-option", inputs: ["value", "id", "disabled"], outputs: ["onSelectionChange"], exportAs: ["matOption"] }, { kind: "directive", type: i2$1.MatAutocompleteTrigger, selector: "input[matAutocomplete], textarea[matAutocomplete]", inputs: ["matAutocomplete", "matAutocompletePosition", "matAutocompleteConnectedTo", "autocomplete", "matAutocompleteDisabled"], exportAs: ["matAutocompleteTrigger"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1$2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1$2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "ngmodule", type: MatInputModule }, { kind: "directive", type: i4.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly", "disabledInteractive"], exportAs: ["matInput"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i2.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: MatDialogModule }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
576
|
+
}
|
|
577
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: AutoComplete, decorators: [{
|
|
578
|
+
type: Component,
|
|
579
|
+
args: [{ selector: 'ntyux-auto-complete', imports: [MatFormFieldModule, MatAutocompleteModule, FormsModule, MatInputModule, MatIconModule, MatDialogModule], providers: [
|
|
580
|
+
{
|
|
581
|
+
provide: NG_VALUE_ACCESSOR,
|
|
582
|
+
useExisting: forwardRef(() => AutoComplete),
|
|
583
|
+
multi: true,
|
|
584
|
+
},
|
|
585
|
+
], changeDetection: ChangeDetectionStrategy.OnPush, template: "<mat-form-field class=\"example-full-width\" [appearance]=\"appearance()\" [class.required-field]=\"required()\"\n [class.required-with-value]=\"required() && hasValue()\">\n @if (label()) {\n <mat-label>{{ label() }}</mat-label>\n }\n\n <input type=\"text\" #autoCompleteInput matInput #inputModel=\"ngModel\" [matAutocomplete]=\"auto\" [ngModel]=\"searchText()\" \n [placeholder]=\"requiredPlaceholder()\" (input)=\"onInputChanged($event)\" \n (paste)=\"onPaste($event)\" (contextmenu)=\"rightClick($event)\" (focus)=\"onFocus()\" />\n\n @if (hasClearableValue() && !disabled()) {\n <button mat-icon-button matSuffix type=\"button\" (click)=\"clearInput()\" aria-label=\"Clear\"\n class=\"clear-btn number-clear-btn\">\n <mat-icon>cancel</mat-icon>\n </button>\n } @if (showSearchButton()) {\n <button mat-icon-button matSuffix type=\"button\" aria-label=\"Search\" (click)=\"onLookup()\" class=\"search-btn\"\n [disabled]=\"disabled()\">\n <mat-icon>search</mat-icon>\n </button>\n }\n <mat-autocomplete #auto=\"matAutocomplete\" [displayWith]=\"displayFn.bind(this)\"\n (optionSelected)=\"optionSelected($event)\">\n @for (option of filteredData(); track option.value) {\n <mat-option [value]=\"option.value\"> {{ option.name }} </mat-option>\n }\n </mat-autocomplete>\n\n @if (inputModel?.invalid && (inputModel?.dirty || inputModel?.touched)) {\n <mat-error>{{ getErrorMessage() }}</mat-error>\n }\n</mat-form-field>", styles: [".example-full-width{width:100%;max-width:500px}::ng-deep .mat-mdc-form-field-subscript-wrapper{width:auto;height:0}.clear-btn{background:none;border:none;box-shadow:none;cursor:pointer}.search-icon{background:none;border:none;box-shadow:none;opacity:1;cursor:pointer}.search-icon:hover,.clear-btn:hover{color:var(--mat-sys-primary)}.required-field{background-color:var(--mat-sys-required)!important}.required-with-value{background-color:transparent!important}\n"] }]
|
|
586
|
+
}], ctorParameters: () => [], propDecorators: { tableName: [{ type: i0.Input, args: [{ isSignal: true, alias: "tableName", required: false }] }], apiEndpoint: [{ type: i0.Input, args: [{ isSignal: true, alias: "apiEndpoint", required: false }] }], showSearchButton: [{ type: i0.Input, args: [{ isSignal: true, alias: "showSearchButton", required: false }] }], searchAfter: [{ type: i0.Input, args: [{ isSignal: true, alias: "searchAfter", required: false }] }], fieldCode: [{ type: i0.Input, args: [{ isSignal: true, alias: "fieldCode", required: false }] }], fieldName: [{ type: i0.Input, args: [{ isSignal: true, alias: "fieldName", required: false }] }], lookupComponent: [{ type: i0.Input, args: [{ isSignal: true, alias: "lookupComponent", required: false }] }], lookupComponentPath: [{ type: i0.Input, args: [{ isSignal: true, alias: "lookupComponentPath", required: false }] }], filterField: [{ type: i0.Input, args: [{ isSignal: true, alias: "filterField", required: false }] }], filterFieldValue: [{ type: i0.Input, args: [{ isSignal: true, alias: "filterFieldValue", required: false }] }], filterFieldNumeric: [{ type: i0.Input, args: [{ isSignal: true, alias: "filterFieldNumeric", required: false }] }], filterFieldEquality: [{ type: i0.Input, args: [{ isSignal: true, alias: "filterFieldEquality", required: false }] }], debounceTime: [{ type: i0.Input, args: [{ isSignal: true, alias: "debounceTime", required: false }] }], searchOnFocus: [{ type: i0.Input, args: [{ isSignal: true, alias: "searchOnFocus", required: false }] }], staticData: [{ type: i0.Input, args: [{ isSignal: true, alias: "staticData", required: false }] }], apiPrefix: [{ type: i0.Input, args: [{ isSignal: true, alias: "apiPrefix", required: false }] }], autoCompleteTrigger: [{
|
|
587
|
+
type: ViewChild,
|
|
588
|
+
args: [MatAutocompleteTrigger]
|
|
589
|
+
}], inputField: [{
|
|
590
|
+
type: ViewChild,
|
|
591
|
+
args: ['autoCompleteInput']
|
|
592
|
+
}] } });
|
|
593
|
+
|
|
594
|
+
class NettyFilter {
|
|
595
|
+
value;
|
|
596
|
+
text;
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
class NtyAutoCompleteFilterFields {
|
|
600
|
+
fieldName = null;
|
|
601
|
+
fieldValue = null;
|
|
602
|
+
numeric = false;
|
|
603
|
+
equalitySign = '=';
|
|
604
|
+
}
|
|
605
|
+
|
|
606
|
+
class ValueUnitInput extends UiBase {
|
|
607
|
+
// AutoComplete Parameters
|
|
608
|
+
apiPrefix = input('', ...(ngDevMode ? [{ debugName: "apiPrefix" }] : []));
|
|
609
|
+
apiEndpoint = input('', ...(ngDevMode ? [{ debugName: "apiEndpoint" }] : []));
|
|
610
|
+
showSearchButton = input(true, ...(ngDevMode ? [{ debugName: "showSearchButton" }] : []));
|
|
611
|
+
searchAfter = input(3, ...(ngDevMode ? [{ debugName: "searchAfter" }] : []));
|
|
612
|
+
fieldCode = input(null, ...(ngDevMode ? [{ debugName: "fieldCode" }] : []));
|
|
613
|
+
fieldName = input(null, ...(ngDevMode ? [{ debugName: "fieldName" }] : []));
|
|
614
|
+
lookupComponent = input(null, ...(ngDevMode ? [{ debugName: "lookupComponent" }] : []));
|
|
615
|
+
lookupComponentPath = input(null, ...(ngDevMode ? [{ debugName: "lookupComponentPath" }] : []));
|
|
616
|
+
filterField = input(null, ...(ngDevMode ? [{ debugName: "filterField" }] : []));
|
|
617
|
+
filterFieldValue = input(null, ...(ngDevMode ? [{ debugName: "filterFieldValue" }] : []));
|
|
618
|
+
filterFieldNumeric = input(false, ...(ngDevMode ? [{ debugName: "filterFieldNumeric" }] : []));
|
|
619
|
+
filterFieldEquality = input('=', ...(ngDevMode ? [{ debugName: "filterFieldEquality" }] : []));
|
|
620
|
+
// Unit Parameters
|
|
621
|
+
// UiBase'den gelen 'disabled()' her ikisini birden kapatmak için kullanılır
|
|
622
|
+
unitValue = model('', ...(ngDevMode ? [{ debugName: "unitValue" }] : []));
|
|
623
|
+
unitLabel = input('', ...(ngDevMode ? [{ debugName: "unitLabel" }] : []));
|
|
624
|
+
unitPlaceholder = input('', ...(ngDevMode ? [{ debugName: "unitPlaceholder" }] : []));
|
|
625
|
+
unitDisabled = input(false, ...(ngDevMode ? [{ debugName: "unitDisabled" }] : []));
|
|
626
|
+
constructor() {
|
|
627
|
+
super();
|
|
628
|
+
effect(() => {
|
|
629
|
+
const val = this.value();
|
|
630
|
+
const unit = this.unitValue();
|
|
631
|
+
if (this.required()) {
|
|
632
|
+
if (!val || !unit) {
|
|
633
|
+
this.ngModel?.control.setErrors({ required: true });
|
|
634
|
+
}
|
|
635
|
+
else {
|
|
636
|
+
this.ngModel?.control.setErrors(null);
|
|
637
|
+
}
|
|
638
|
+
}
|
|
639
|
+
});
|
|
640
|
+
}
|
|
641
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: ValueUnitInput, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
642
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.1.2", type: ValueUnitInput, isStandalone: true, selector: "ntyux-value-unit-input", inputs: { apiPrefix: { classPropertyName: "apiPrefix", publicName: "apiPrefix", isSignal: true, isRequired: false, transformFunction: null }, apiEndpoint: { classPropertyName: "apiEndpoint", publicName: "apiEndpoint", isSignal: true, isRequired: false, transformFunction: null }, showSearchButton: { classPropertyName: "showSearchButton", publicName: "showSearchButton", isSignal: true, isRequired: false, transformFunction: null }, searchAfter: { classPropertyName: "searchAfter", publicName: "searchAfter", isSignal: true, isRequired: false, transformFunction: null }, fieldCode: { classPropertyName: "fieldCode", publicName: "fieldCode", isSignal: true, isRequired: false, transformFunction: null }, fieldName: { classPropertyName: "fieldName", publicName: "fieldName", isSignal: true, isRequired: false, transformFunction: null }, lookupComponent: { classPropertyName: "lookupComponent", publicName: "lookupComponent", isSignal: true, isRequired: false, transformFunction: null }, lookupComponentPath: { classPropertyName: "lookupComponentPath", publicName: "lookupComponentPath", isSignal: true, isRequired: false, transformFunction: null }, filterField: { classPropertyName: "filterField", publicName: "filterField", isSignal: true, isRequired: false, transformFunction: null }, filterFieldValue: { classPropertyName: "filterFieldValue", publicName: "filterFieldValue", isSignal: true, isRequired: false, transformFunction: null }, filterFieldNumeric: { classPropertyName: "filterFieldNumeric", publicName: "filterFieldNumeric", isSignal: true, isRequired: false, transformFunction: null }, filterFieldEquality: { classPropertyName: "filterFieldEquality", publicName: "filterFieldEquality", isSignal: true, isRequired: false, transformFunction: null }, unitValue: { classPropertyName: "unitValue", publicName: "unitValue", isSignal: true, isRequired: false, transformFunction: null }, unitLabel: { classPropertyName: "unitLabel", publicName: "unitLabel", isSignal: true, isRequired: false, transformFunction: null }, unitPlaceholder: { classPropertyName: "unitPlaceholder", publicName: "unitPlaceholder", isSignal: true, isRequired: false, transformFunction: null }, unitDisabled: { classPropertyName: "unitDisabled", publicName: "unitDisabled", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { unitValue: "unitValueChange" }, providers: [
|
|
643
|
+
{
|
|
644
|
+
provide: NG_VALUE_ACCESSOR,
|
|
645
|
+
useExisting: forwardRef(() => ValueUnitInput),
|
|
646
|
+
multi: true,
|
|
647
|
+
},
|
|
648
|
+
], usesInheritance: true, ngImport: i0, template: "<div class=\"combined-container\">\n <div class=\"value\">\n <ntyui-number-input\n #inputModel=\"ngModel\"\n [label]=\"label()\"\n [placeholder]=\"placeholder()\"\n [required]=\"required()\"\n [(ngModel)]=\"value\"\n [disabled]=\"disabled()\"\n >\n </ntyui-number-input>\n </div>\n\n <div class=\"unit\">\n <ntyux-auto-complete\n #inputModel=\"ngModel\"\n [label]=\"unitLabel()\"\n [placeholder]=\"unitPlaceholder()\"\n [required]=\"required()\"\n [(ngModel)]=\"unitValue\"\n [apiPrefix]=\"apiPrefix()\"\n [apiEndpoint]=\"apiEndpoint()\"\n [lookupComponent]=\"lookupComponent()\"\n [lookupComponentPath]=\"lookupComponentPath()\"\n [showSearchButton]=\"showSearchButton()\"\n [searchAfter]=\"searchAfter()\"\n [filterField]=\"filterField()\"\n [fieldCode]=\"fieldCode()\"\n [filterFieldValue]=\"filterFieldValue()\"\n [disabled]=\"disabled() || unitDisabled()\"\n >\n </ntyux-auto-complete>\n </div>\n</div>\n@if (getErrorMessage()) {\n<mat-error class=\"error-message\">{{ getErrorMessage() }}</mat-error>\n}\n", styles: [".combined-container{display:flex;width:100%}.error-message{display:block;text-align:center;width:100%;margin-top:4px;font-size:14px}\n"], dependencies: [{ kind: "component", type: NettyUINumberInput, selector: "ntyui-number-input", inputs: ["min", "max"] }, { kind: "component", type: AutoComplete, selector: "ntyux-auto-complete", inputs: ["tableName", "apiEndpoint", "showSearchButton", "searchAfter", "fieldCode", "fieldName", "lookupComponent", "lookupComponentPath", "filterField", "filterFieldValue", "filterFieldNumeric", "filterFieldEquality", "debounceTime", "searchOnFocus", "staticData", "apiPrefix"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1$2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$2.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i1$2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "ngmodule", type: MatInputModule }, { kind: "directive", type: i1$1.MatError, selector: "mat-error, [matError]", inputs: ["id"] }] });
|
|
649
|
+
}
|
|
650
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: ValueUnitInput, decorators: [{
|
|
651
|
+
type: Component,
|
|
652
|
+
args: [{ selector: 'ntyux-value-unit-input', imports: [NettyUINumberInput, AutoComplete, FormsModule, MatInputModule], providers: [
|
|
653
|
+
{
|
|
654
|
+
provide: NG_VALUE_ACCESSOR,
|
|
655
|
+
useExisting: forwardRef(() => ValueUnitInput),
|
|
656
|
+
multi: true,
|
|
657
|
+
},
|
|
658
|
+
], template: "<div class=\"combined-container\">\n <div class=\"value\">\n <ntyui-number-input\n #inputModel=\"ngModel\"\n [label]=\"label()\"\n [placeholder]=\"placeholder()\"\n [required]=\"required()\"\n [(ngModel)]=\"value\"\n [disabled]=\"disabled()\"\n >\n </ntyui-number-input>\n </div>\n\n <div class=\"unit\">\n <ntyux-auto-complete\n #inputModel=\"ngModel\"\n [label]=\"unitLabel()\"\n [placeholder]=\"unitPlaceholder()\"\n [required]=\"required()\"\n [(ngModel)]=\"unitValue\"\n [apiPrefix]=\"apiPrefix()\"\n [apiEndpoint]=\"apiEndpoint()\"\n [lookupComponent]=\"lookupComponent()\"\n [lookupComponentPath]=\"lookupComponentPath()\"\n [showSearchButton]=\"showSearchButton()\"\n [searchAfter]=\"searchAfter()\"\n [filterField]=\"filterField()\"\n [fieldCode]=\"fieldCode()\"\n [filterFieldValue]=\"filterFieldValue()\"\n [disabled]=\"disabled() || unitDisabled()\"\n >\n </ntyux-auto-complete>\n </div>\n</div>\n@if (getErrorMessage()) {\n<mat-error class=\"error-message\">{{ getErrorMessage() }}</mat-error>\n}\n", styles: [".combined-container{display:flex;width:100%}.error-message{display:block;text-align:center;width:100%;margin-top:4px;font-size:14px}\n"] }]
|
|
659
|
+
}], ctorParameters: () => [], propDecorators: { apiPrefix: [{ type: i0.Input, args: [{ isSignal: true, alias: "apiPrefix", required: false }] }], apiEndpoint: [{ type: i0.Input, args: [{ isSignal: true, alias: "apiEndpoint", required: false }] }], showSearchButton: [{ type: i0.Input, args: [{ isSignal: true, alias: "showSearchButton", required: false }] }], searchAfter: [{ type: i0.Input, args: [{ isSignal: true, alias: "searchAfter", required: false }] }], fieldCode: [{ type: i0.Input, args: [{ isSignal: true, alias: "fieldCode", required: false }] }], fieldName: [{ type: i0.Input, args: [{ isSignal: true, alias: "fieldName", required: false }] }], lookupComponent: [{ type: i0.Input, args: [{ isSignal: true, alias: "lookupComponent", required: false }] }], lookupComponentPath: [{ type: i0.Input, args: [{ isSignal: true, alias: "lookupComponentPath", required: false }] }], filterField: [{ type: i0.Input, args: [{ isSignal: true, alias: "filterField", required: false }] }], filterFieldValue: [{ type: i0.Input, args: [{ isSignal: true, alias: "filterFieldValue", required: false }] }], filterFieldNumeric: [{ type: i0.Input, args: [{ isSignal: true, alias: "filterFieldNumeric", required: false }] }], filterFieldEquality: [{ type: i0.Input, args: [{ isSignal: true, alias: "filterFieldEquality", required: false }] }], unitValue: [{ type: i0.Input, args: [{ isSignal: true, alias: "unitValue", required: false }] }, { type: i0.Output, args: ["unitValueChange"] }], unitLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "unitLabel", required: false }] }], unitPlaceholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "unitPlaceholder", required: false }] }], unitDisabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "unitDisabled", required: false }] }] } });
|
|
660
|
+
|
|
661
|
+
class HttpError403 {
|
|
662
|
+
attemptedUrl = '';
|
|
663
|
+
routeSubscription;
|
|
664
|
+
router = inject(Router);
|
|
665
|
+
location = inject(Location);
|
|
666
|
+
constructor() {
|
|
667
|
+
const navigation = this.router.currentNavigation();
|
|
668
|
+
this.attemptedUrl = navigation?.extras.state?.['attemptedUrl'] || '';
|
|
669
|
+
if (!this.attemptedUrl) {
|
|
670
|
+
this.attemptedUrl = this.getCleanUrlPath();
|
|
671
|
+
}
|
|
672
|
+
this.routeSubscription = this.router.events.subscribe(() => {
|
|
673
|
+
this.updateAttemptedUrl();
|
|
674
|
+
});
|
|
675
|
+
}
|
|
676
|
+
ngOnInit() {
|
|
677
|
+
this.cleanUrlFromFragments();
|
|
678
|
+
this.updateAttemptedUrl();
|
|
679
|
+
}
|
|
680
|
+
ngOnDestroy() {
|
|
681
|
+
if (this.routeSubscription) {
|
|
682
|
+
this.routeSubscription.unsubscribe();
|
|
683
|
+
}
|
|
684
|
+
}
|
|
685
|
+
cleanUrlFromFragments() {
|
|
686
|
+
const currentUrl = this.router.url;
|
|
687
|
+
const cleanUrl = currentUrl.split('(')[0];
|
|
688
|
+
if (currentUrl !== cleanUrl) {
|
|
689
|
+
this.router.navigateByUrl(cleanUrl, {
|
|
690
|
+
replaceUrl: true,
|
|
691
|
+
skipLocationChange: false,
|
|
692
|
+
});
|
|
693
|
+
}
|
|
694
|
+
}
|
|
695
|
+
updateAttemptedUrl() {
|
|
696
|
+
this.attemptedUrl = this.getCleanUrlPath();
|
|
697
|
+
}
|
|
698
|
+
getCleanUrlPath() {
|
|
699
|
+
return this.router.url.split('?')[0].split('(')[0];
|
|
700
|
+
}
|
|
701
|
+
goHome() {
|
|
702
|
+
this.router.navigate(['/'], { replaceUrl: true });
|
|
703
|
+
}
|
|
704
|
+
goBack() {
|
|
705
|
+
this.location.back();
|
|
706
|
+
}
|
|
707
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: HttpError403, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
708
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.1.2", type: HttpError403, isStandalone: true, selector: "ntybase-http-error403", ngImport: i0, template: "<div class=\"error-container\">\n <div class=\"error-page\">\n <h1>403 - Eri\u015Fim Engellendi</h1>\n\n <p>\n <strong>\u00DCzg\u00FCn\u00FCz, {{ attemptedUrl }}</strong> sayfas\u0131na eri\u015Fim izniniz\n bulunmamaktad\u0131r.\n </p>\n\n <p class=\"error-detail\">\n Bu sayfay\u0131 g\u00F6r\u00FCnt\u00FClemek i\u00E7in gerekli yetkilere sahip de\u011Filsiniz. E\u011Fer bu\n bir hata oldu\u011Funu d\u00FC\u015F\u00FCn\u00FCyorsan\u0131z, l\u00FCtfen sistem y\u00F6neticinizle ileti\u015Fime\n ge\u00E7in.\n </p>\n <button mat-raised-button (click)=\"goHome()\" color=\"primary\" routerLink=\"/\">\n Ana Sayfaya D\u00F6n\n </button>\n <button mat-raised-button (click)=\"goBack()\" color=\"primary\" routerLink=\"/\">\n Geri D\u00F6n\n </button>\n </div>\n</div>\n", styles: [".error-container{background-image:var(--httperror403-bg-image, linear-gradient(rgba(0, 0, 0, .6), rgba(0, 0, 0, .6)), url(https://images.unsplash.com/photo-1519681393784-d120267933ba?ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=1124&q=100));background-blend-mode:overlay;height:100vh;width:100%;background-position:center;background-repeat:no-repeat;background-size:cover;display:flex;justify-content:center;align-items:center;color:#fff;font-family:Segoe UI,Tahoma,Geneva,Verdana,sans-serif}.error-page{text-align:center;padding:3rem;max-width:650px;margin:0 auto;background-color:#000000b3;border-radius:16px;-webkit-backdrop-filter:blur(8px);backdrop-filter:blur(8px);box-shadow:0 8px 32px #0000004d;animation:fadeIn .8s ease-in-out}.error-page h1{font-size:6rem;margin:0;color:var(--mat-sys-primary-container);text-shadow:0 4px 8px rgba(0,0,0,.3);font-weight:700}.error-page h3{font-size:1.8rem;margin-top:0;margin-bottom:1.5rem;color:#f8f9fa}.error-page p{margin:1.5rem 0;font-size:1.1rem;line-height:1.6;color:#e9ecef}.error-page strong{word-break:break-all;color:#ff6b6b;font-weight:500}button{margin:.5rem;padding:.8rem 2rem;font-size:1rem;font-weight:500;border-radius:50px;transition:all .3s ease;background-color:var(--mat-sys-primary);color:var(--mat-sys-on-primary)}button:hover{transform:translateY(-2px);box-shadow:0 6px 12px #00000026}button:active{transform:translateY(0)}@keyframes fadeIn{0%{opacity:0;transform:translateY(20px)}to{opacity:1;transform:translateY(0)}}@media(max-width:600px){.error-page{padding:2rem;width:90%}.error-page h1{font-size:4rem}.error-page h3{font-size:1.5rem}button{display:block;width:100%;margin:.5rem 0}}\n"] });
|
|
709
|
+
}
|
|
710
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: HttpError403, decorators: [{
|
|
711
|
+
type: Component,
|
|
712
|
+
args: [{ selector: 'ntybase-http-error403', imports: [], template: "<div class=\"error-container\">\n <div class=\"error-page\">\n <h1>403 - Eri\u015Fim Engellendi</h1>\n\n <p>\n <strong>\u00DCzg\u00FCn\u00FCz, {{ attemptedUrl }}</strong> sayfas\u0131na eri\u015Fim izniniz\n bulunmamaktad\u0131r.\n </p>\n\n <p class=\"error-detail\">\n Bu sayfay\u0131 g\u00F6r\u00FCnt\u00FClemek i\u00E7in gerekli yetkilere sahip de\u011Filsiniz. E\u011Fer bu\n bir hata oldu\u011Funu d\u00FC\u015F\u00FCn\u00FCyorsan\u0131z, l\u00FCtfen sistem y\u00F6neticinizle ileti\u015Fime\n ge\u00E7in.\n </p>\n <button mat-raised-button (click)=\"goHome()\" color=\"primary\" routerLink=\"/\">\n Ana Sayfaya D\u00F6n\n </button>\n <button mat-raised-button (click)=\"goBack()\" color=\"primary\" routerLink=\"/\">\n Geri D\u00F6n\n </button>\n </div>\n</div>\n", styles: [".error-container{background-image:var(--httperror403-bg-image, linear-gradient(rgba(0, 0, 0, .6), rgba(0, 0, 0, .6)), url(https://images.unsplash.com/photo-1519681393784-d120267933ba?ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=1124&q=100));background-blend-mode:overlay;height:100vh;width:100%;background-position:center;background-repeat:no-repeat;background-size:cover;display:flex;justify-content:center;align-items:center;color:#fff;font-family:Segoe UI,Tahoma,Geneva,Verdana,sans-serif}.error-page{text-align:center;padding:3rem;max-width:650px;margin:0 auto;background-color:#000000b3;border-radius:16px;-webkit-backdrop-filter:blur(8px);backdrop-filter:blur(8px);box-shadow:0 8px 32px #0000004d;animation:fadeIn .8s ease-in-out}.error-page h1{font-size:6rem;margin:0;color:var(--mat-sys-primary-container);text-shadow:0 4px 8px rgba(0,0,0,.3);font-weight:700}.error-page h3{font-size:1.8rem;margin-top:0;margin-bottom:1.5rem;color:#f8f9fa}.error-page p{margin:1.5rem 0;font-size:1.1rem;line-height:1.6;color:#e9ecef}.error-page strong{word-break:break-all;color:#ff6b6b;font-weight:500}button{margin:.5rem;padding:.8rem 2rem;font-size:1rem;font-weight:500;border-radius:50px;transition:all .3s ease;background-color:var(--mat-sys-primary);color:var(--mat-sys-on-primary)}button:hover{transform:translateY(-2px);box-shadow:0 6px 12px #00000026}button:active{transform:translateY(0)}@keyframes fadeIn{0%{opacity:0;transform:translateY(20px)}to{opacity:1;transform:translateY(0)}}@media(max-width:600px){.error-page{padding:2rem;width:90%}.error-page h1{font-size:4rem}.error-page h3{font-size:1.5rem}button{display:block;width:100%;margin:.5rem 0}}\n"] }]
|
|
713
|
+
}], ctorParameters: () => [] });
|
|
714
|
+
|
|
715
|
+
class HttpError404 {
|
|
716
|
+
attemptedUrl = '';
|
|
717
|
+
routeSubscription;
|
|
718
|
+
router = inject(Router);
|
|
719
|
+
location = inject(Location);
|
|
720
|
+
constructor() {
|
|
721
|
+
this.routeSubscription = this.router.events.subscribe(() => {
|
|
722
|
+
this.updateAttemptedUrl();
|
|
723
|
+
});
|
|
724
|
+
}
|
|
725
|
+
ngOnInit() {
|
|
726
|
+
this.cleanUrlFromFragments();
|
|
727
|
+
this.updateAttemptedUrl();
|
|
728
|
+
}
|
|
729
|
+
ngOnDestroy() {
|
|
730
|
+
if (this.routeSubscription) {
|
|
731
|
+
this.routeSubscription.unsubscribe();
|
|
732
|
+
}
|
|
733
|
+
}
|
|
734
|
+
cleanUrlFromFragments() {
|
|
735
|
+
const currentUrl = this.router.url;
|
|
736
|
+
const cleanUrl = currentUrl.split('(')[0];
|
|
737
|
+
if (currentUrl !== cleanUrl) {
|
|
738
|
+
this.router.navigateByUrl(cleanUrl, {
|
|
739
|
+
replaceUrl: true,
|
|
740
|
+
skipLocationChange: false,
|
|
741
|
+
});
|
|
742
|
+
}
|
|
743
|
+
}
|
|
744
|
+
getCleanUrlPath() {
|
|
745
|
+
return this.router.url.split('?')[0].split('(')[0];
|
|
746
|
+
}
|
|
747
|
+
updateAttemptedUrl() {
|
|
748
|
+
this.attemptedUrl = this.getCleanUrlPath();
|
|
749
|
+
}
|
|
750
|
+
goHome() {
|
|
751
|
+
this.router.navigate(['/'], { replaceUrl: true });
|
|
752
|
+
}
|
|
753
|
+
goBack() {
|
|
754
|
+
this.location.back();
|
|
755
|
+
}
|
|
756
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: HttpError404, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
757
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.1.2", type: HttpError404, isStandalone: true, selector: "ntybase-http-error404", ngImport: i0, template: "<div class=\"error-container\">\n <div class=\"error-page\">\n <h1>404</h1>\n <h3>Sayfa Bulunamad\u0131</h3>\n <p><strong>{{ attemptedUrl }}</strong> adresi bulunamad\u0131.</p>\n <p>Bu i\u00E7erik ta\u015F\u0131nm\u0131\u015F veya silinmi\u015F olabilir.</p>\n <button mat-raised-button (click)=\"goHome()\" color=\"primary\" routerLink=\"/\">\n Ana Sayfaya D\u00F6n\n </button>\n <button mat-raised-button (click)=\"goBack()\" color=\"primary\" routerLink=\"/\">\n Geri D\u00F6n\n </button>\n </div>\n</div>\n", styles: [".error-container{background-image:var(--httperror404-bg-image, linear-gradient(rgba(0, 0, 0, .6), rgba(0, 0, 0, .6)), url(https://images.unsplash.com/photo-1519681393784-d120267933ba?ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=1124&q=100));background-blend-mode:overlay;height:100vh;width:100%;background-position:center;background-repeat:no-repeat;background-size:cover;display:flex;justify-content:center;align-items:center;color:#fff;font-family:Segoe UI,Tahoma,Geneva,Verdana,sans-serif}.error-page{text-align:center;padding:3rem;max-width:650px;margin:0 auto;background-color:#000000b3;border-radius:16px;-webkit-backdrop-filter:blur(8px);backdrop-filter:blur(8px);box-shadow:0 8px 32px #0000004d;animation:fadeIn .8s ease-in-out}.error-page h1{font-size:6rem;margin:0;color:var(--mat-sys-primary-container);text-shadow:0 4px 8px rgba(0,0,0,.3);font-weight:700}.error-page h3{font-size:1.8rem;margin-top:0;margin-bottom:1.5rem;color:#f8f9fa}.error-page p{margin:1.5rem 0;font-size:1.1rem;line-height:1.6;color:#e9ecef}.error-page strong{word-break:break-all;color:#ff6b6b;font-weight:500}button{margin:.5rem;padding:.8rem 2rem;font-size:1rem;font-weight:500;border-radius:50px;transition:all .3s ease;background-color:var(--mat-sys-primary);color:var(--mat-sys-on-primary)}button:hover{transform:translateY(-2px);box-shadow:0 6px 12px #00000026}button:active{transform:translateY(0)}@keyframes fadeIn{0%{opacity:0;transform:translateY(20px)}to{opacity:1;transform:translateY(0)}}@media(max-width:600px){.error-page{padding:2rem;width:90%}.error-page h1{font-size:4rem}.error-page h3{font-size:1.5rem}button{display:block;width:100%;margin:.5rem 0}}\n"] });
|
|
758
|
+
}
|
|
759
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: HttpError404, decorators: [{
|
|
760
|
+
type: Component,
|
|
761
|
+
args: [{ selector: 'ntybase-http-error404', imports: [], template: "<div class=\"error-container\">\n <div class=\"error-page\">\n <h1>404</h1>\n <h3>Sayfa Bulunamad\u0131</h3>\n <p><strong>{{ attemptedUrl }}</strong> adresi bulunamad\u0131.</p>\n <p>Bu i\u00E7erik ta\u015F\u0131nm\u0131\u015F veya silinmi\u015F olabilir.</p>\n <button mat-raised-button (click)=\"goHome()\" color=\"primary\" routerLink=\"/\">\n Ana Sayfaya D\u00F6n\n </button>\n <button mat-raised-button (click)=\"goBack()\" color=\"primary\" routerLink=\"/\">\n Geri D\u00F6n\n </button>\n </div>\n</div>\n", styles: [".error-container{background-image:var(--httperror404-bg-image, linear-gradient(rgba(0, 0, 0, .6), rgba(0, 0, 0, .6)), url(https://images.unsplash.com/photo-1519681393784-d120267933ba?ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=1124&q=100));background-blend-mode:overlay;height:100vh;width:100%;background-position:center;background-repeat:no-repeat;background-size:cover;display:flex;justify-content:center;align-items:center;color:#fff;font-family:Segoe UI,Tahoma,Geneva,Verdana,sans-serif}.error-page{text-align:center;padding:3rem;max-width:650px;margin:0 auto;background-color:#000000b3;border-radius:16px;-webkit-backdrop-filter:blur(8px);backdrop-filter:blur(8px);box-shadow:0 8px 32px #0000004d;animation:fadeIn .8s ease-in-out}.error-page h1{font-size:6rem;margin:0;color:var(--mat-sys-primary-container);text-shadow:0 4px 8px rgba(0,0,0,.3);font-weight:700}.error-page h3{font-size:1.8rem;margin-top:0;margin-bottom:1.5rem;color:#f8f9fa}.error-page p{margin:1.5rem 0;font-size:1.1rem;line-height:1.6;color:#e9ecef}.error-page strong{word-break:break-all;color:#ff6b6b;font-weight:500}button{margin:.5rem;padding:.8rem 2rem;font-size:1rem;font-weight:500;border-radius:50px;transition:all .3s ease;background-color:var(--mat-sys-primary);color:var(--mat-sys-on-primary)}button:hover{transform:translateY(-2px);box-shadow:0 6px 12px #00000026}button:active{transform:translateY(0)}@keyframes fadeIn{0%{opacity:0;transform:translateY(20px)}to{opacity:1;transform:translateY(0)}}@media(max-width:600px){.error-page{padding:2rem;width:90%}.error-page h1{font-size:4rem}.error-page h3{font-size:1.5rem}button{display:block;width:100%;margin:.5rem 0}}\n"] }]
|
|
762
|
+
}], ctorParameters: () => [] });
|
|
763
|
+
|
|
764
|
+
class LeftSidenav {
|
|
765
|
+
authService = inject(AuthenticationService);
|
|
766
|
+
router = inject(Router);
|
|
767
|
+
menuService = inject(NettyMenuService);
|
|
768
|
+
commonService = inject(CommonService);
|
|
769
|
+
environmentProxy = inject(EnvironmentProxy);
|
|
770
|
+
credentialsService = inject(CredentialsService);
|
|
771
|
+
imageService = inject(NettyImageService);
|
|
772
|
+
alertService = inject(AlertService);
|
|
773
|
+
elementRef = inject(ElementRef);
|
|
774
|
+
username = signal('', ...(ngDevMode ? [{ debugName: "username" }] : []));
|
|
775
|
+
profileImage = signal('', ...(ngDevMode ? [{ debugName: "profileImage" }] : []));
|
|
776
|
+
version = this.environmentProxy.version();
|
|
777
|
+
isMinimized = input(false, ...(ngDevMode ? [{ debugName: "isMinimized" }] : []));
|
|
778
|
+
toggleMinimize = output();
|
|
779
|
+
onToggleMinimize() {
|
|
780
|
+
this.toggleMinimize.emit();
|
|
781
|
+
}
|
|
782
|
+
logout() {
|
|
783
|
+
this.authService.logout().subscribe({
|
|
784
|
+
next: (success) => {
|
|
785
|
+
if (success) {
|
|
786
|
+
const cleanUrl = this.commonService.getCleanUrlPath();
|
|
787
|
+
this.router.navigateByUrl(cleanUrl, { replaceUrl: true }).then(() => {
|
|
788
|
+
this.router.navigate(['/login']);
|
|
789
|
+
});
|
|
790
|
+
}
|
|
791
|
+
},
|
|
792
|
+
error: (err) => {
|
|
793
|
+
this.alertService.showError('Logout failed:', err);
|
|
794
|
+
},
|
|
795
|
+
});
|
|
796
|
+
}
|
|
797
|
+
// Menu Search
|
|
798
|
+
menuItems = signal([], ...(ngDevMode ? [{ debugName: "menuItems" }] : []));
|
|
799
|
+
searchTerm = signal('', ...(ngDevMode ? [{ debugName: "searchTerm" }] : []));
|
|
800
|
+
originalMenuItems = signal([], ...(ngDevMode ? [{ debugName: "originalMenuItems" }] : []));
|
|
801
|
+
constructor() {
|
|
802
|
+
effect(() => {
|
|
803
|
+
const fetchedMenu = this.menuService.menu();
|
|
804
|
+
if (fetchedMenu) {
|
|
805
|
+
const processedItems = this.processMenuItems(fetchedMenu);
|
|
806
|
+
this.originalMenuItems.set(processedItems);
|
|
807
|
+
}
|
|
808
|
+
else {
|
|
809
|
+
this.originalMenuItems.set([]);
|
|
810
|
+
}
|
|
811
|
+
});
|
|
812
|
+
this.loadUserInfo();
|
|
813
|
+
}
|
|
814
|
+
ngOnInit() {
|
|
815
|
+
// Application name gelene kadar 3 kez dene
|
|
816
|
+
this.trySetMenuName(0);
|
|
817
|
+
}
|
|
818
|
+
trySetMenuName(attempt) {
|
|
819
|
+
const appName = this.environmentProxy.getApplicationName();
|
|
820
|
+
if (appName && appName.trim()) {
|
|
821
|
+
// Application name geldi, menüyü yükle
|
|
822
|
+
this.menuService.setMenuName(appName);
|
|
823
|
+
}
|
|
824
|
+
else if (attempt < 3) {
|
|
825
|
+
// Henüz gelmedi, 300ms sonra tekrar dene
|
|
826
|
+
setTimeout(() => {
|
|
827
|
+
this.trySetMenuName(attempt + 1);
|
|
828
|
+
}, 300);
|
|
829
|
+
}
|
|
830
|
+
else {
|
|
831
|
+
// 3 denemeden sonra hala gelmedi, boş string ile dene
|
|
832
|
+
console.warn('Application name not found, using empty string');
|
|
833
|
+
this.menuService.setMenuName('');
|
|
834
|
+
}
|
|
835
|
+
}
|
|
836
|
+
ngAfterViewInit() {
|
|
837
|
+
setTimeout(() => {
|
|
838
|
+
this.loadUserInfo();
|
|
839
|
+
}, 100);
|
|
840
|
+
}
|
|
841
|
+
loadUserInfo() {
|
|
842
|
+
const credentials = this.credentialsService.getCredentials();
|
|
843
|
+
if (credentials && credentials.username) {
|
|
844
|
+
this.username.set(credentials.username);
|
|
845
|
+
this.generateProfileImage(credentials.username);
|
|
846
|
+
}
|
|
847
|
+
}
|
|
848
|
+
generateProfileImage(username) {
|
|
849
|
+
const initials = this.getInitials(username);
|
|
850
|
+
const primaryColor = this.getCssVariableValue('--mat-sys-primary');
|
|
851
|
+
const imageUrl = this.imageService.generateTextImage(initials, 40, 40, primaryColor || '#4ECDC4', '#FFFFFF', 'rgba(0, 0, 0, 0.2)');
|
|
852
|
+
this.profileImage.set(imageUrl);
|
|
853
|
+
}
|
|
854
|
+
getCssVariableValue(variableName) {
|
|
855
|
+
if (typeof window === 'undefined')
|
|
856
|
+
return null;
|
|
857
|
+
const element = this.elementRef.nativeElement;
|
|
858
|
+
return (getComputedStyle(element).getPropertyValue(variableName).trim() || null);
|
|
859
|
+
}
|
|
860
|
+
getInitials(username) {
|
|
861
|
+
if (!username)
|
|
862
|
+
return 'U';
|
|
863
|
+
const names = username.trim().split(' ');
|
|
864
|
+
if (names.length === 1) {
|
|
865
|
+
return names[0].charAt(0).toUpperCase();
|
|
866
|
+
}
|
|
867
|
+
else {
|
|
868
|
+
return (names[0].charAt(0) + names[names.length - 1].charAt(0)).toUpperCase();
|
|
869
|
+
}
|
|
870
|
+
}
|
|
871
|
+
processMenuItems(apiResponse) {
|
|
872
|
+
if (!apiResponse || !Array.isArray(apiResponse)) {
|
|
873
|
+
return [];
|
|
874
|
+
}
|
|
875
|
+
return apiResponse.map((item) => ({
|
|
876
|
+
name: item.label || item.name,
|
|
877
|
+
icon: item.icon || '',
|
|
878
|
+
link: item.route || item.link || '#',
|
|
879
|
+
expanded: false,
|
|
880
|
+
children: item.children ? this.processMenuItems(item.children) : [],
|
|
881
|
+
}));
|
|
882
|
+
}
|
|
883
|
+
filteredMenuItems = computed(() => {
|
|
884
|
+
const term = this.commonService.normalizeTurkish(this.searchTerm());
|
|
885
|
+
if (!term)
|
|
886
|
+
return this.originalMenuItems();
|
|
887
|
+
return this.filterMenuItems(this.originalMenuItems(), term);
|
|
888
|
+
}, ...(ngDevMode ? [{ debugName: "filteredMenuItems" }] : []));
|
|
889
|
+
filterMenuItems(items, term) {
|
|
890
|
+
const normalizedTerm = this.commonService.normalizeTurkish(term);
|
|
891
|
+
console.log(normalizedTerm);
|
|
892
|
+
return items
|
|
893
|
+
.map((item) => {
|
|
894
|
+
const filteredChildren = item.children
|
|
895
|
+
? this.filterMenuItems(item.children, term)
|
|
896
|
+
: [];
|
|
897
|
+
const normalizedName = this.commonService.normalizeTurkish(item.name);
|
|
898
|
+
const matches = normalizedName.includes(normalizedTerm) ||
|
|
899
|
+
filteredChildren.length > 0;
|
|
900
|
+
return matches
|
|
901
|
+
? {
|
|
902
|
+
...item,
|
|
903
|
+
children: filteredChildren,
|
|
904
|
+
expanded: matches || filteredChildren.length > 0,
|
|
905
|
+
}
|
|
906
|
+
: null;
|
|
907
|
+
})
|
|
908
|
+
.filter((item) => item !== null);
|
|
909
|
+
}
|
|
910
|
+
toggleSubMenu(item) {
|
|
911
|
+
item.expanded = !item.expanded;
|
|
912
|
+
}
|
|
913
|
+
onSearch(term) {
|
|
914
|
+
this.searchTerm.set(term);
|
|
915
|
+
}
|
|
916
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: LeftSidenav, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
917
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.1.2", type: LeftSidenav, isStandalone: true, selector: "ntybase-left-sidenav", inputs: { isMinimized: { classPropertyName: "isMinimized", publicName: "isMinimized", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { toggleMinimize: "toggleMinimize" }, ngImport: i0, template: "<div class=\"sidenav-content-wrapper\">\n <!-- Minimize Icon -->\n <button mat-icon-button (click)=\"onToggleMinimize()\" class=\"minimize-button\">\n <mat-icon class=\"minimize-icon\">\n {{ isMinimized() ? \"chevron_right\" : \"chevron_left\" }}\n </mat-icon>\n </button>\n\n <!-- Profile -->\n <div class=\"profile-section\">\n <button mat-button [matMenuTriggerFor]=\"profileMenu\" class=\"profile-button\">\n <img [src]=\"profileImage()\" [alt]=\"username()\" class=\"profile-image\" />\n @if(!isMinimized()){\n <div class=\"profile-info\">\n <p class=\"profile-name\">{{ username() }}</p>\n </div>\n }\n </button>\n\n <mat-menu #profileMenu=\"matMenu\" xPosition=\"before\">\n <button mat-menu-item disabled>\n <mat-icon>account_circle</mat-icon>\n <span>{{ '@profile' | translate }}</span>\n </button>\n <button mat-menu-item mat-button disabled>\n <mat-icon>swap_horiz</mat-icon>\n <span>{{ '@changeCompany' | translate }}</span>\n </button>\n <button mat-menu-item mat-button (click)=\"logout()\">\n <mat-icon>logout</mat-icon>\n <span>{{ '@logout' | translate }}</span>\n </button>\n </mat-menu>\n </div>\n\n <!-- Search Input -->\n @if (!isMinimized()){\n <ntyui-search-input\n class=\"search-input\"\n [label]=\"'@search' | translate\"\n [placeholder]=\"'@placeholderSearch' | translate\"\n [appearance]=\"'outline'\"\n (search)=\"onSearch($event)\"\n >\n </ntyui-search-input>\n }\n\n <!-- Menu -->\n @if (!isMinimized()) {\n <mat-nav-list>\n <div class=\"sidebar\">\n <ul>\n <!-- Recursive menu render -->\n @let items = filteredMenuItems(); @let level = 0;\n <ng-container\n [ngTemplateOutlet]=\"menuItemsTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: items, level: level }\"\n ></ng-container>\n </ul>\n </div>\n </mat-nav-list>\n }\n\n <!-- Footer -->\n <div class=\"sidenav-footer\">\n <button mat-button [matMenuTriggerFor]=\"footerMenu\" class=\"footer-button\">\n @if (!isMinimized()) {\n <div class=\"footer-text\">\n <div class=\"company-name\">\n <p>© 2025 AXIS</p>\n </div>\n </div>\n }\n </button>\n <div class=\"version\">\n <span class=\"version\">v{{version}}</span>\n </div>\n </div>\n\n <mat-menu #footerMenu=\"matMenu\" xPosition=\"before\">\n <button mat-menu-item disabled>\n <mat-icon>swap_horiz</mat-icon>\n {{ '@changeCompany' | translate }}\n </button>\n <button mat-menu-item mat-button (click)=\"logout()\">\n <mat-icon>logout</mat-icon>\n <span>{{ '@logout' | translate }}</span>\n </button>\n </mat-menu>\n</div>\n\n<!-- Recursive Menu Template -->\n<ng-template #menuItemsTemplate let-items let-level=\"level\">\n @for (item of items; track item.name) {\n <li [class]=\"'menu-level-' + level\">\n <!-- Leaf node (no children) -->\n @if (!item.children || item.children.length === 0) {\n <a\n [routerLink]=\"item.link\"\n routerLinkActive=\"active\"\n [class]=\"'menu-link level-' + level\"\n >\n <mat-icon>{{ item.icon }}</mat-icon>\n <span>{{ item.name }}</span>\n </a>\n }\n\n <!-- Parent node with children -->\n @if (item.children && item.children.length > 0) {\n <a\n (click)=\"toggleSubMenu(item)\"\n [class.expanded]=\"item.expanded\"\n [class]=\"'menu-link has-children level-' + level\"\n >\n <mat-icon>{{ item.icon }}</mat-icon>\n <span>{{ item.name }}</span>\n <mat-icon [class.rotated]=\"item.expanded\" class=\"expand-icon\">\n {{ item.expanded ? 'expand_less' : 'expand_more' }}\n </mat-icon>\n </a>\n }\n\n <!-- Recursive submenu -->\n @if (item.children && item.children.length > 0 && item.expanded) {\n <ul [class]=\"'submenu level-' + (level + 1)\">\n <ng-container\n *ngTemplateOutlet=\"menuItemsTemplate; context: { $implicit: item.children, level: level + 1 }\"\n ></ng-container>\n </ul>\n }\n </li>\n }\n</ng-template>\n", styles: [".profile-section{text-align:center;cursor:pointer;transition:all .3s ease;display:flex;align-items:center;flex-direction:column;position:relative}.profile-section:hover{transform:scale(.98)}.profile-section .profile-button{display:flex;flex-direction:column;align-items:center;background:none;border:none;padding:0;cursor:pointer;width:100%}.profile-image{width:60px;height:60px;border-radius:50%;object-fit:cover;margin:0 auto 8px;display:block;border:2px solid white;box-shadow:0 2px 4px #0000001a;transition:all .3s ease}.profile-name{font-weight:500;font-size:1rem;color:inherit;transition:opacity .3s ease;margin-top:8px}:host-context(.minimized) .profile-section{padding:10px 0}:host-context(.minimized) .profile-image{width:40px;height:40px;margin:0 auto}.sidenav-footer{position:static;bottom:0;left:0;right:0;padding:16px;color:inherit;font-size:12px;border-top:1px solid rgba(0,0,0,.1);transition:all .3s ease;display:flex;align-items:center;justify-content:space-between;margin-top:auto}.sidenav-footer .version{font-size:10px;margin-top:4px}.footer-button{border:none;background:none;cursor:pointer}:host-context(.minimized) .version{margin-right:7px}:host-context(.minimized) .sidenav-content-wrapper{overflow:hidden}.sidenav-content-wrapper{position:relative;height:100%;display:flex;flex-direction:column;overflow-x:hidden}.sidebar{flex:1;overflow:auto}.sidebar ul{list-style:none;padding:0;margin:0}.sidebar li{margin-bottom:4px;position:relative}.sidebar li a{display:flex;align-items:center;padding:5px 0;border-radius:6px;color:var(--mat-sys-primary);text-decoration:none;transition:all .2s ease;position:relative;overflow:hidden}.sidebar li a:hover{background-color:var(--mat-nty-save-record-header-bar);color:var(--mat-nty-save-record-identifier)}.sidebar li a.active{background-color:var(--mat-nty-save-record-header-bar);color:var(--mat-nty-save-record-identifier);font-weight:500}.sidebar li a.active:before{content:\"\";position:absolute;left:0;top:0;bottom:0;width:3px;background-color:var(--mat-nty-save-record-header-bar);border-radius:3px 0 0 3px}.sidebar mat-icon{font-size:20px;width:20px;height:20px;color:inherit}.sidebar span{font-size:.875rem;white-space:nowrap}.menu-link.level-2{margin-left:20px;font-size:.82rem}.menu-link.level-3{margin-left:20px;font-size:.8rem}.menu-link.level-4{margin-left:20px;font-size:.78rem}.submenu{padding-left:12px;margin-top:4px}.submenu li a{padding:5px 16px 5px 20px}.submenu mat-icon{font-size:18px}.sidebar li a mat-icon:last-child{margin-left:auto;margin-right:0;font-size:18px;color:#5f6368}:host-context(.minimized) .sidebar li a{justify-content:center;padding:12px 0}:host-context(.minimized) .sidenav-content-wrapper button[mat-icon-button]{position:absolute;right:-8px;top:50%;z-index:999}:host-context(.minimized) .sidebar mat-icon{margin-right:0}:host-context(.minimized) .sidebar span,:host-context(.minimized) .sidebar li a mat-icon:last-child{display:none}:host-context(.minimized) .submenu{display:none}.sidenav-content-wrapper button[mat-icon-button]{position:absolute;right:-8px;top:1px;z-index:999}.search-input{margin-top:10px}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i2.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: MatListModule }, { kind: "component", type: i3$1.MatNavList, selector: "mat-nav-list", exportAs: ["matNavList"] }, { kind: "ngmodule", type: MatMenuModule }, { kind: "component", type: i4$1.MatMenu, selector: "mat-menu", inputs: ["backdropClass", "aria-label", "aria-labelledby", "aria-describedby", "xPosition", "yPosition", "overlapTrigger", "hasBackdrop", "class", "classList"], outputs: ["closed", "close"], exportAs: ["matMenu"] }, { kind: "component", type: i4$1.MatMenuItem, selector: "[mat-menu-item]", inputs: ["role", "disabled", "disableRipple"], exportAs: ["matMenuItem"] }, { kind: "directive", type: i4$1.MatMenuTrigger, selector: "[mat-menu-trigger-for], [matMenuTriggerFor]", inputs: ["mat-menu-trigger-for", "matMenuTriggerFor", "matMenuTriggerData", "matMenuTriggerRestoreFocus"], outputs: ["menuOpened", "onMenuOpen", "menuClosed", "onMenuClose"], exportAs: ["matMenuTrigger"] }, { kind: "directive", type: RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "info", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "routerLink"] }, { kind: "ngmodule", type: RouterModule }, { kind: "directive", type: i5.RouterLinkActive, selector: "[routerLinkActive]", inputs: ["routerLinkActiveOptions", "ariaCurrentWhenActive", "routerLinkActive"], outputs: ["isActiveChange"], exportAs: ["routerLinkActive"] }, { kind: "component", type: NettyUISearchInput, selector: "ntyui-search-input", outputs: ["search"] }, { kind: "ngmodule", type: TranslateModule }, { kind: "pipe", type: i3.TranslatePipe, name: "translate" }] });
|
|
918
|
+
}
|
|
919
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: LeftSidenav, decorators: [{
|
|
920
|
+
type: Component,
|
|
921
|
+
args: [{ selector: 'ntybase-left-sidenav', imports: [CommonModule, MatIconModule, MatListModule, MatMenuModule, MatMenuTrigger, RouterLink, RouterModule, NettyUISearchInput, TranslateModule], template: "<div class=\"sidenav-content-wrapper\">\n <!-- Minimize Icon -->\n <button mat-icon-button (click)=\"onToggleMinimize()\" class=\"minimize-button\">\n <mat-icon class=\"minimize-icon\">\n {{ isMinimized() ? \"chevron_right\" : \"chevron_left\" }}\n </mat-icon>\n </button>\n\n <!-- Profile -->\n <div class=\"profile-section\">\n <button mat-button [matMenuTriggerFor]=\"profileMenu\" class=\"profile-button\">\n <img [src]=\"profileImage()\" [alt]=\"username()\" class=\"profile-image\" />\n @if(!isMinimized()){\n <div class=\"profile-info\">\n <p class=\"profile-name\">{{ username() }}</p>\n </div>\n }\n </button>\n\n <mat-menu #profileMenu=\"matMenu\" xPosition=\"before\">\n <button mat-menu-item disabled>\n <mat-icon>account_circle</mat-icon>\n <span>{{ '@profile' | translate }}</span>\n </button>\n <button mat-menu-item mat-button disabled>\n <mat-icon>swap_horiz</mat-icon>\n <span>{{ '@changeCompany' | translate }}</span>\n </button>\n <button mat-menu-item mat-button (click)=\"logout()\">\n <mat-icon>logout</mat-icon>\n <span>{{ '@logout' | translate }}</span>\n </button>\n </mat-menu>\n </div>\n\n <!-- Search Input -->\n @if (!isMinimized()){\n <ntyui-search-input\n class=\"search-input\"\n [label]=\"'@search' | translate\"\n [placeholder]=\"'@placeholderSearch' | translate\"\n [appearance]=\"'outline'\"\n (search)=\"onSearch($event)\"\n >\n </ntyui-search-input>\n }\n\n <!-- Menu -->\n @if (!isMinimized()) {\n <mat-nav-list>\n <div class=\"sidebar\">\n <ul>\n <!-- Recursive menu render -->\n @let items = filteredMenuItems(); @let level = 0;\n <ng-container\n [ngTemplateOutlet]=\"menuItemsTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: items, level: level }\"\n ></ng-container>\n </ul>\n </div>\n </mat-nav-list>\n }\n\n <!-- Footer -->\n <div class=\"sidenav-footer\">\n <button mat-button [matMenuTriggerFor]=\"footerMenu\" class=\"footer-button\">\n @if (!isMinimized()) {\n <div class=\"footer-text\">\n <div class=\"company-name\">\n <p>© 2025 AXIS</p>\n </div>\n </div>\n }\n </button>\n <div class=\"version\">\n <span class=\"version\">v{{version}}</span>\n </div>\n </div>\n\n <mat-menu #footerMenu=\"matMenu\" xPosition=\"before\">\n <button mat-menu-item disabled>\n <mat-icon>swap_horiz</mat-icon>\n {{ '@changeCompany' | translate }}\n </button>\n <button mat-menu-item mat-button (click)=\"logout()\">\n <mat-icon>logout</mat-icon>\n <span>{{ '@logout' | translate }}</span>\n </button>\n </mat-menu>\n</div>\n\n<!-- Recursive Menu Template -->\n<ng-template #menuItemsTemplate let-items let-level=\"level\">\n @for (item of items; track item.name) {\n <li [class]=\"'menu-level-' + level\">\n <!-- Leaf node (no children) -->\n @if (!item.children || item.children.length === 0) {\n <a\n [routerLink]=\"item.link\"\n routerLinkActive=\"active\"\n [class]=\"'menu-link level-' + level\"\n >\n <mat-icon>{{ item.icon }}</mat-icon>\n <span>{{ item.name }}</span>\n </a>\n }\n\n <!-- Parent node with children -->\n @if (item.children && item.children.length > 0) {\n <a\n (click)=\"toggleSubMenu(item)\"\n [class.expanded]=\"item.expanded\"\n [class]=\"'menu-link has-children level-' + level\"\n >\n <mat-icon>{{ item.icon }}</mat-icon>\n <span>{{ item.name }}</span>\n <mat-icon [class.rotated]=\"item.expanded\" class=\"expand-icon\">\n {{ item.expanded ? 'expand_less' : 'expand_more' }}\n </mat-icon>\n </a>\n }\n\n <!-- Recursive submenu -->\n @if (item.children && item.children.length > 0 && item.expanded) {\n <ul [class]=\"'submenu level-' + (level + 1)\">\n <ng-container\n *ngTemplateOutlet=\"menuItemsTemplate; context: { $implicit: item.children, level: level + 1 }\"\n ></ng-container>\n </ul>\n }\n </li>\n }\n</ng-template>\n", styles: [".profile-section{text-align:center;cursor:pointer;transition:all .3s ease;display:flex;align-items:center;flex-direction:column;position:relative}.profile-section:hover{transform:scale(.98)}.profile-section .profile-button{display:flex;flex-direction:column;align-items:center;background:none;border:none;padding:0;cursor:pointer;width:100%}.profile-image{width:60px;height:60px;border-radius:50%;object-fit:cover;margin:0 auto 8px;display:block;border:2px solid white;box-shadow:0 2px 4px #0000001a;transition:all .3s ease}.profile-name{font-weight:500;font-size:1rem;color:inherit;transition:opacity .3s ease;margin-top:8px}:host-context(.minimized) .profile-section{padding:10px 0}:host-context(.minimized) .profile-image{width:40px;height:40px;margin:0 auto}.sidenav-footer{position:static;bottom:0;left:0;right:0;padding:16px;color:inherit;font-size:12px;border-top:1px solid rgba(0,0,0,.1);transition:all .3s ease;display:flex;align-items:center;justify-content:space-between;margin-top:auto}.sidenav-footer .version{font-size:10px;margin-top:4px}.footer-button{border:none;background:none;cursor:pointer}:host-context(.minimized) .version{margin-right:7px}:host-context(.minimized) .sidenav-content-wrapper{overflow:hidden}.sidenav-content-wrapper{position:relative;height:100%;display:flex;flex-direction:column;overflow-x:hidden}.sidebar{flex:1;overflow:auto}.sidebar ul{list-style:none;padding:0;margin:0}.sidebar li{margin-bottom:4px;position:relative}.sidebar li a{display:flex;align-items:center;padding:5px 0;border-radius:6px;color:var(--mat-sys-primary);text-decoration:none;transition:all .2s ease;position:relative;overflow:hidden}.sidebar li a:hover{background-color:var(--mat-nty-save-record-header-bar);color:var(--mat-nty-save-record-identifier)}.sidebar li a.active{background-color:var(--mat-nty-save-record-header-bar);color:var(--mat-nty-save-record-identifier);font-weight:500}.sidebar li a.active:before{content:\"\";position:absolute;left:0;top:0;bottom:0;width:3px;background-color:var(--mat-nty-save-record-header-bar);border-radius:3px 0 0 3px}.sidebar mat-icon{font-size:20px;width:20px;height:20px;color:inherit}.sidebar span{font-size:.875rem;white-space:nowrap}.menu-link.level-2{margin-left:20px;font-size:.82rem}.menu-link.level-3{margin-left:20px;font-size:.8rem}.menu-link.level-4{margin-left:20px;font-size:.78rem}.submenu{padding-left:12px;margin-top:4px}.submenu li a{padding:5px 16px 5px 20px}.submenu mat-icon{font-size:18px}.sidebar li a mat-icon:last-child{margin-left:auto;margin-right:0;font-size:18px;color:#5f6368}:host-context(.minimized) .sidebar li a{justify-content:center;padding:12px 0}:host-context(.minimized) .sidenav-content-wrapper button[mat-icon-button]{position:absolute;right:-8px;top:50%;z-index:999}:host-context(.minimized) .sidebar mat-icon{margin-right:0}:host-context(.minimized) .sidebar span,:host-context(.minimized) .sidebar li a mat-icon:last-child{display:none}:host-context(.minimized) .submenu{display:none}.sidenav-content-wrapper button[mat-icon-button]{position:absolute;right:-8px;top:1px;z-index:999}.search-input{margin-top:10px}\n"] }]
|
|
922
|
+
}], ctorParameters: () => [], propDecorators: { isMinimized: [{ type: i0.Input, args: [{ isSignal: true, alias: "isMinimized", required: false }] }], toggleMinimize: [{ type: i0.Output, args: ["toggleMinimize"] }] } });
|
|
923
|
+
|
|
924
|
+
class Theme {
|
|
925
|
+
appTheme = signal('light', ...(ngDevMode ? [{ debugName: "appTheme" }] : []));
|
|
926
|
+
themes = [
|
|
927
|
+
{ name: 'light', icon: 'light_mode' },
|
|
928
|
+
{ name: 'dark', icon: 'dark_mode' },
|
|
929
|
+
];
|
|
930
|
+
selectedTheme = computed(() => this.themes.find((theme) => theme.name === this.appTheme()), ...(ngDevMode ? [{ debugName: "selectedTheme" }] : []));
|
|
931
|
+
getThemes() {
|
|
932
|
+
return this.themes;
|
|
933
|
+
}
|
|
934
|
+
setTheme(theme) {
|
|
935
|
+
this.appTheme.set(theme);
|
|
936
|
+
}
|
|
937
|
+
constructor() {
|
|
938
|
+
effect(() => {
|
|
939
|
+
const appTheme = this.appTheme();
|
|
940
|
+
document.body.style.setProperty('color-scheme', appTheme);
|
|
941
|
+
document.body.setAttribute('data-ag-theme-mode', appTheme);
|
|
942
|
+
});
|
|
943
|
+
}
|
|
944
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: Theme, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
945
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: Theme, providedIn: 'root' });
|
|
946
|
+
}
|
|
947
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: Theme, decorators: [{
|
|
948
|
+
type: Injectable,
|
|
949
|
+
args: [{
|
|
950
|
+
providedIn: 'root',
|
|
951
|
+
}]
|
|
952
|
+
}], ctorParameters: () => [] });
|
|
953
|
+
|
|
954
|
+
class ColorPalette {
|
|
955
|
+
THEME_STORAGE_KEY = 'selected-theme';
|
|
956
|
+
themes = [];
|
|
957
|
+
themeService = inject(Theme);
|
|
958
|
+
currentTheme = signal(null, ...(ngDevMode ? [{ debugName: "currentTheme" }] : []));
|
|
959
|
+
setThemes(customThemes) {
|
|
960
|
+
this.themes = customThemes;
|
|
961
|
+
const savedThemeId = this.getSavedTheme();
|
|
962
|
+
const themeToSet = savedThemeId
|
|
963
|
+
? this.themes.find((t) => t.id === savedThemeId)
|
|
964
|
+
: this.themes[0];
|
|
965
|
+
if (themeToSet) {
|
|
966
|
+
this.currentTheme.set(themeToSet);
|
|
967
|
+
}
|
|
968
|
+
}
|
|
969
|
+
setTheme(themeId) {
|
|
970
|
+
const theme = this.themes.find((t) => t.id === themeId);
|
|
971
|
+
if (theme) {
|
|
972
|
+
this.currentTheme.set(theme);
|
|
973
|
+
this.saveTheme(themeId);
|
|
974
|
+
}
|
|
975
|
+
}
|
|
976
|
+
getThemes() {
|
|
977
|
+
return this.themes;
|
|
978
|
+
}
|
|
979
|
+
getCurrentTheme() {
|
|
980
|
+
return this.currentTheme();
|
|
981
|
+
}
|
|
982
|
+
getSavedTheme() {
|
|
983
|
+
if (typeof window !== 'undefined' && window.localStorage) {
|
|
984
|
+
return localStorage.getItem(this.THEME_STORAGE_KEY);
|
|
985
|
+
}
|
|
986
|
+
return null;
|
|
987
|
+
}
|
|
988
|
+
saveTheme(themeId) {
|
|
989
|
+
try {
|
|
990
|
+
localStorage.setItem(this.THEME_STORAGE_KEY, themeId);
|
|
991
|
+
}
|
|
992
|
+
catch (error) {
|
|
993
|
+
console.error('Error saving theme:', error);
|
|
994
|
+
}
|
|
995
|
+
}
|
|
996
|
+
updateThemeClass = effect(() => {
|
|
997
|
+
const theme = this.currentTheme();
|
|
998
|
+
if (theme) {
|
|
999
|
+
document.body.classList.remove(...this.themes.map((t) => `${t.id}-theme`));
|
|
1000
|
+
document.body.classList.add(`${theme.id}-theme`);
|
|
1001
|
+
this.themeService.setTheme(theme.type);
|
|
1002
|
+
}
|
|
1003
|
+
}, ...(ngDevMode ? [{ debugName: "updateThemeClass" }] : []));
|
|
1004
|
+
loadCustomThemes(customThemes = [], defaultTheme = 'deep-blue') {
|
|
1005
|
+
if (!customThemes || customThemes.length === 0) {
|
|
1006
|
+
customThemes = [
|
|
1007
|
+
{ id: 'deep-blue', primary: '#1976D2', displayName: 'Deep Blue', type: 'light' },
|
|
1008
|
+
{ id: 'green', primary: '#00796B', displayName: 'Green', type: 'light' },
|
|
1009
|
+
{ id: 'orange', primary: '#E65100', displayName: 'Orange', type: 'light' },
|
|
1010
|
+
{ id: 'purple', primary: '#6200EE', displayName: 'Purple', type: 'light' },
|
|
1011
|
+
{ id: 'red', primary: '#C2185B', displayName: 'Red', type: 'light' },
|
|
1012
|
+
{ id: 'gray', primary: '#555', displayName: 'Gray', type: 'light' },
|
|
1013
|
+
{ id: 'netty', primary: 'rgb(0 103 126)', displayName: 'Netty', type: 'dark' },
|
|
1014
|
+
];
|
|
1015
|
+
}
|
|
1016
|
+
this.setThemes(customThemes);
|
|
1017
|
+
// Default theme
|
|
1018
|
+
if (!defaultTheme || defaultTheme.length === 0) {
|
|
1019
|
+
defaultTheme = 'deep-blue';
|
|
1020
|
+
}
|
|
1021
|
+
var lastTheme = this.getSavedTheme();
|
|
1022
|
+
if (!lastTheme || lastTheme.length == 0) {
|
|
1023
|
+
lastTheme = defaultTheme;
|
|
1024
|
+
}
|
|
1025
|
+
this.setTheme(lastTheme);
|
|
1026
|
+
}
|
|
1027
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: ColorPalette, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1028
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: ColorPalette, providedIn: 'root' });
|
|
1029
|
+
}
|
|
1030
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: ColorPalette, decorators: [{
|
|
1031
|
+
type: Injectable,
|
|
1032
|
+
args: [{
|
|
1033
|
+
providedIn: 'root',
|
|
1034
|
+
}]
|
|
1035
|
+
}] });
|
|
1036
|
+
|
|
1037
|
+
class Toolbar {
|
|
1038
|
+
// Services
|
|
1039
|
+
themeService = inject(Theme);
|
|
1040
|
+
colorPaletteService = inject(ColorPalette);
|
|
1041
|
+
i18nService = inject(I18nService);
|
|
1042
|
+
pageTitleService = inject(PageTitle);
|
|
1043
|
+
router = inject(Router);
|
|
1044
|
+
// State Management
|
|
1045
|
+
toggleSidenav = output();
|
|
1046
|
+
onToggleSidenav() {
|
|
1047
|
+
this.toggleSidenav.emit();
|
|
1048
|
+
}
|
|
1049
|
+
// Language
|
|
1050
|
+
icon = model(false, ...(ngDevMode ? [{ debugName: "icon" }] : []));
|
|
1051
|
+
get currentLanguage() {
|
|
1052
|
+
return this.i18nService.language;
|
|
1053
|
+
}
|
|
1054
|
+
get languages() {
|
|
1055
|
+
return this.i18nService.supportedLanguages;
|
|
1056
|
+
}
|
|
1057
|
+
setLanguage(language) {
|
|
1058
|
+
this.i18nService.language = language;
|
|
1059
|
+
setTimeout(() => {
|
|
1060
|
+
window.location.reload();
|
|
1061
|
+
}, 100);
|
|
1062
|
+
}
|
|
1063
|
+
getCurrentLanguageIcon() {
|
|
1064
|
+
switch (this.i18nService.language) {
|
|
1065
|
+
case 'Türkçe':
|
|
1066
|
+
return 'fi fi-tr';
|
|
1067
|
+
case 'English':
|
|
1068
|
+
return 'fi fi-us';
|
|
1069
|
+
default:
|
|
1070
|
+
return 'fi fi-tr';
|
|
1071
|
+
}
|
|
1072
|
+
}
|
|
1073
|
+
getLanguageIcon(language) {
|
|
1074
|
+
switch (language) {
|
|
1075
|
+
case 'Türkçe':
|
|
1076
|
+
return 'fi fi-tr';
|
|
1077
|
+
case 'English':
|
|
1078
|
+
return 'fi fi-us';
|
|
1079
|
+
default:
|
|
1080
|
+
return 'fi fi-tr';
|
|
1081
|
+
}
|
|
1082
|
+
}
|
|
1083
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: Toolbar, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1084
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.1.2", type: Toolbar, isStandalone: true, selector: "ntybase-toolbar", inputs: { icon: { classPropertyName: "icon", publicName: "icon", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { toggleSidenav: "toggleSidenav", icon: "iconChange" }, ngImport: i0, template: "<mat-toolbar class=\"sidenav-header\">\n <div class=\"left-section\">\n <button mat-icon-button (click)=\"onToggleSidenav()\" class=\"menu-button\">\n <mat-icon>menu</mat-icon>\n </button>\n <span>{{'app_name' | translate }}</span>\n\n <!-- Language Selection -->\n <div class=\"language-toggle\">\n @if (icon()) {\n <button mat-icon-button [matMenuTriggerFor]=\"languageMenu\">\n <span class=\"{{ getCurrentLanguageIcon() }}\"></span>\n </button>\n } @else {\n <button mat-raised-button color=\"primary\" [matMenuTriggerFor]=\"languageMenu\">\n {{ currentLanguage }}\n </button>\n }\n </div>\n\n <!-- Language Menu -->\n <mat-menu #languageMenu=\"matMenu\">\n @for (language of languages; track language) {\n <button mat-menu-item (click)=\"setLanguage(language)\">\n <span class=\"{{ getLanguageIcon(language) }}\"></span>\n {{ language }}\n </button>\n }\n </mat-menu>\n\n\n <div class=\"header-title\">\n @if (pageTitleService.title()) {\n <span class=\"page-divider\">/</span>\n <span class=\"page-title\">{{ pageTitleService.title() }}</span>\n }\n </div>\n </div>\n\n <div class=\"spacer\"></div>\n\n <div class=\"flex-stretch\"></div>\n <mat-menu #themeMenu=\"matMenu\">\n @for (theme of themeService.getThemes(); track theme.name) {\n <button [class.selected-theme]=\"themeService.selectedTheme()?.name === theme.name\" mat-menu-item\n (click)=\"themeService.setTheme(theme.name)\">\n <mat-icon>{{ theme.icon }}</mat-icon>\n <span>{{ theme.name | titlecase }}</span>\n </button>\n }\n </mat-menu>\n <button mat-icon-button [matMenuTriggerFor]=\"customThemeMenu\" class=\"custom-theme-button\">\n <mat-icon>format_color_fill</mat-icon>\n </button>\n <mat-menu #customThemeMenu=\"matMenu\">\n @for (customTheme of colorPaletteService.getThemes(); track customTheme.id)\n {\n <button mat-menu-item (click)=\"colorPaletteService.setTheme(customTheme.id)\">\n <div class=\"theme-menu-item\">\n <div class=\"color-preview\" [style.background-color]=\"customTheme.primary\"></div>\n <span>{{ customTheme.displayName }}</span>\n </div>\n </button>\n }\n </mat-menu>\n</mat-toolbar>", styles: ["mat-toolbar{position:fixed;top:0;left:0;right:0;z-index:3;box-shadow:0 1px 5px #0000001a;display:flex;align-items:center}.sidenav-header{display:flex;justify-content:space-between;align-items:center;padding:16px;margin:0;font-weight:500}.sidenav-header .left-section{display:flex;align-items:center;gap:16px}.sidenav-header .spacer{flex:1 1 auto}.flex-stretch{flex:1 0 auto}.theme-menu-item{display:flex;align-items:center;gap:12px}.color-preview{width:24px;height:24px;border-radius:50%}::ng-deep .theme-button{border:none;background:none;margin-right:15px;cursor:pointer}::ng-deep .custom-theme-button{border:none;background:none;cursor:pointer}::ng-deep .menu-button{border:none;background:none;cursor:pointer}.language-button{margin:0 auto}::ng-deep button{border:none;background:none;cursor:pointer}.header-title{display:flex;align-items:center;gap:8px}\n"], dependencies: [{ kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i2.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: MatMenuModule }, { kind: "component", type: i4$1.MatMenu, selector: "mat-menu", inputs: ["backdropClass", "aria-label", "aria-labelledby", "aria-describedby", "xPosition", "yPosition", "overlapTrigger", "hasBackdrop", "class", "classList"], outputs: ["closed", "close"], exportAs: ["matMenu"] }, { kind: "component", type: i4$1.MatMenuItem, selector: "[mat-menu-item]", inputs: ["role", "disabled", "disableRipple"], exportAs: ["matMenuItem"] }, { kind: "directive", type: i4$1.MatMenuTrigger, selector: "[mat-menu-trigger-for], [matMenuTriggerFor]", inputs: ["mat-menu-trigger-for", "matMenuTriggerFor", "matMenuTriggerData", "matMenuTriggerRestoreFocus"], outputs: ["menuOpened", "onMenuOpen", "menuClosed", "onMenuClose"], exportAs: ["matMenuTrigger"] }, { kind: "ngmodule", type: MatToolbarModule }, { kind: "component", type: i3$2.MatToolbar, selector: "mat-toolbar", inputs: ["color"], exportAs: ["matToolbar"] }, { kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: TranslateModule }, { kind: "pipe", type: i1.TitleCasePipe, name: "titlecase" }, { kind: "pipe", type: i3.TranslatePipe, name: "translate" }] });
|
|
1085
|
+
}
|
|
1086
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: Toolbar, decorators: [{
|
|
1087
|
+
type: Component,
|
|
1088
|
+
args: [{ selector: 'ntybase-toolbar', imports: [MatIconModule, MatMenuModule, MatToolbarModule, CommonModule, TitleCasePipe, TranslateModule], template: "<mat-toolbar class=\"sidenav-header\">\n <div class=\"left-section\">\n <button mat-icon-button (click)=\"onToggleSidenav()\" class=\"menu-button\">\n <mat-icon>menu</mat-icon>\n </button>\n <span>{{'app_name' | translate }}</span>\n\n <!-- Language Selection -->\n <div class=\"language-toggle\">\n @if (icon()) {\n <button mat-icon-button [matMenuTriggerFor]=\"languageMenu\">\n <span class=\"{{ getCurrentLanguageIcon() }}\"></span>\n </button>\n } @else {\n <button mat-raised-button color=\"primary\" [matMenuTriggerFor]=\"languageMenu\">\n {{ currentLanguage }}\n </button>\n }\n </div>\n\n <!-- Language Menu -->\n <mat-menu #languageMenu=\"matMenu\">\n @for (language of languages; track language) {\n <button mat-menu-item (click)=\"setLanguage(language)\">\n <span class=\"{{ getLanguageIcon(language) }}\"></span>\n {{ language }}\n </button>\n }\n </mat-menu>\n\n\n <div class=\"header-title\">\n @if (pageTitleService.title()) {\n <span class=\"page-divider\">/</span>\n <span class=\"page-title\">{{ pageTitleService.title() }}</span>\n }\n </div>\n </div>\n\n <div class=\"spacer\"></div>\n\n <div class=\"flex-stretch\"></div>\n <mat-menu #themeMenu=\"matMenu\">\n @for (theme of themeService.getThemes(); track theme.name) {\n <button [class.selected-theme]=\"themeService.selectedTheme()?.name === theme.name\" mat-menu-item\n (click)=\"themeService.setTheme(theme.name)\">\n <mat-icon>{{ theme.icon }}</mat-icon>\n <span>{{ theme.name | titlecase }}</span>\n </button>\n }\n </mat-menu>\n <button mat-icon-button [matMenuTriggerFor]=\"customThemeMenu\" class=\"custom-theme-button\">\n <mat-icon>format_color_fill</mat-icon>\n </button>\n <mat-menu #customThemeMenu=\"matMenu\">\n @for (customTheme of colorPaletteService.getThemes(); track customTheme.id)\n {\n <button mat-menu-item (click)=\"colorPaletteService.setTheme(customTheme.id)\">\n <div class=\"theme-menu-item\">\n <div class=\"color-preview\" [style.background-color]=\"customTheme.primary\"></div>\n <span>{{ customTheme.displayName }}</span>\n </div>\n </button>\n }\n </mat-menu>\n</mat-toolbar>", styles: ["mat-toolbar{position:fixed;top:0;left:0;right:0;z-index:3;box-shadow:0 1px 5px #0000001a;display:flex;align-items:center}.sidenav-header{display:flex;justify-content:space-between;align-items:center;padding:16px;margin:0;font-weight:500}.sidenav-header .left-section{display:flex;align-items:center;gap:16px}.sidenav-header .spacer{flex:1 1 auto}.flex-stretch{flex:1 0 auto}.theme-menu-item{display:flex;align-items:center;gap:12px}.color-preview{width:24px;height:24px;border-radius:50%}::ng-deep .theme-button{border:none;background:none;margin-right:15px;cursor:pointer}::ng-deep .custom-theme-button{border:none;background:none;cursor:pointer}::ng-deep .menu-button{border:none;background:none;cursor:pointer}.language-button{margin:0 auto}::ng-deep button{border:none;background:none;cursor:pointer}.header-title{display:flex;align-items:center;gap:8px}\n"] }]
|
|
1089
|
+
}], propDecorators: { toggleSidenav: [{ type: i0.Output, args: ["toggleSidenav"] }], icon: [{ type: i0.Input, args: [{ isSignal: true, alias: "icon", required: false }] }, { type: i0.Output, args: ["iconChange"] }] } });
|
|
1090
|
+
|
|
1091
|
+
class NettyUXFilterCard extends UiBase {
|
|
1092
|
+
Title = input("", ...(ngDevMode ? [{ debugName: "Title" }] : []));
|
|
1093
|
+
SubTitle = input("", ...(ngDevMode ? [{ debugName: "SubTitle" }] : []));
|
|
1094
|
+
isExportVisible = input(true, ...(ngDevMode ? [{ debugName: "isExportVisible" }] : []));
|
|
1095
|
+
isFormValid = input(true, ...(ngDevMode ? [{ debugName: "isFormValid" }] : []));
|
|
1096
|
+
onExport = output();
|
|
1097
|
+
onReset = output();
|
|
1098
|
+
onApply = output();
|
|
1099
|
+
resetButtonLabel = input("", ...(ngDevMode ? [{ debugName: "resetButtonLabel" }] : []));
|
|
1100
|
+
applyButtonLabel = input("", ...(ngDevMode ? [{ debugName: "applyButtonLabel" }] : []));
|
|
1101
|
+
exportButtonLabel = input("", ...(ngDevMode ? [{ debugName: "exportButtonLabel" }] : []));
|
|
1102
|
+
translateService = inject(TranslateService);
|
|
1103
|
+
getResetButtonLabel() {
|
|
1104
|
+
return this.resetButtonLabel() || this.translateService.instant("@resetButtonLabel");
|
|
1105
|
+
}
|
|
1106
|
+
getApplyButtonLabel() {
|
|
1107
|
+
return this.applyButtonLabel() || this.translateService.instant("@applyButtonLabel");
|
|
1108
|
+
}
|
|
1109
|
+
getExportButtonLabel() {
|
|
1110
|
+
return this.exportButtonLabel() || this.translateService.instant("@exportButtonLabel");
|
|
1111
|
+
}
|
|
1112
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: NettyUXFilterCard, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
1113
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.1.2", type: NettyUXFilterCard, isStandalone: true, selector: "ntyux-filter-card", inputs: { Title: { classPropertyName: "Title", publicName: "Title", isSignal: true, isRequired: false, transformFunction: null }, SubTitle: { classPropertyName: "SubTitle", publicName: "SubTitle", isSignal: true, isRequired: false, transformFunction: null }, isExportVisible: { classPropertyName: "isExportVisible", publicName: "isExportVisible", isSignal: true, isRequired: false, transformFunction: null }, isFormValid: { classPropertyName: "isFormValid", publicName: "isFormValid", isSignal: true, isRequired: false, transformFunction: null }, resetButtonLabel: { classPropertyName: "resetButtonLabel", publicName: "resetButtonLabel", isSignal: true, isRequired: false, transformFunction: null }, applyButtonLabel: { classPropertyName: "applyButtonLabel", publicName: "applyButtonLabel", isSignal: true, isRequired: false, transformFunction: null }, exportButtonLabel: { classPropertyName: "exportButtonLabel", publicName: "exportButtonLabel", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { onExport: "onExport", onReset: "onReset", onApply: "onApply" }, usesInheritance: true, ngImport: i0, template: "<mat-card class=\"filter-card\" apperance=\"outlined\">\n <mat-card-title>{{Title()}}</mat-card-title>\n <mat-card-subtitle>{{SubTitle()}}</mat-card-subtitle>\n <mat-card-content>\n <ng-content>\n No content provided\n </ng-content>\n </mat-card-content>\n <mat-card-actions class=\"mat-card-actions\">\n <button class=\"nty-button\" matButton=\"outlined\" (click)=\"onReset.emit()\">{{getResetButtonLabel()}}</button>\n @if (isExportVisible()) {\n <button class=\"nty-button\" matButton=\"outlined\" [disabled]=\"!isFormValid()\"\n (click)=\"onExport.emit()\">{{getExportButtonLabel()}}</button>\n }\n <button class=\"nty-button\" matButton=\"filled\" [disabled]=\"!isFormValid()\"\n (click)=\"onApply.emit()\">{{getApplyButtonLabel()}}</button>\n </mat-card-actions>\n</mat-card>", styles: [".filter-card{padding:1rem 1rem 0}.mat-card-actions{justify-content:flex-end}.nty-button{margin-left:.5rem}\n"], dependencies: [{ kind: "ngmodule", type: MatCardModule }, { kind: "component", type: i1$3.MatCard, selector: "mat-card", inputs: ["appearance"], exportAs: ["matCard"] }, { kind: "directive", type: i1$3.MatCardActions, selector: "mat-card-actions", inputs: ["align"], exportAs: ["matCardActions"] }, { kind: "directive", type: i1$3.MatCardContent, selector: "mat-card-content" }, { kind: "directive", type: i1$3.MatCardSubtitle, selector: "mat-card-subtitle, [mat-card-subtitle], [matCardSubtitle]" }, { kind: "directive", type: i1$3.MatCardTitle, selector: "mat-card-title, [mat-card-title], [matCardTitle]" }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i2$2.MatButton, selector: " button[matButton], a[matButton], button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button], a[mat-button], a[mat-raised-button], a[mat-flat-button], a[mat-stroked-button] ", inputs: ["matButton"], exportAs: ["matButton", "matAnchor"] }, { kind: "ngmodule", type: FormsModule }] });
|
|
1114
|
+
}
|
|
1115
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: NettyUXFilterCard, decorators: [{
|
|
1116
|
+
type: Component,
|
|
1117
|
+
args: [{ selector: 'ntyux-filter-card', imports: [MatCardModule, MatButtonModule, FormsModule], template: "<mat-card class=\"filter-card\" apperance=\"outlined\">\n <mat-card-title>{{Title()}}</mat-card-title>\n <mat-card-subtitle>{{SubTitle()}}</mat-card-subtitle>\n <mat-card-content>\n <ng-content>\n No content provided\n </ng-content>\n </mat-card-content>\n <mat-card-actions class=\"mat-card-actions\">\n <button class=\"nty-button\" matButton=\"outlined\" (click)=\"onReset.emit()\">{{getResetButtonLabel()}}</button>\n @if (isExportVisible()) {\n <button class=\"nty-button\" matButton=\"outlined\" [disabled]=\"!isFormValid()\"\n (click)=\"onExport.emit()\">{{getExportButtonLabel()}}</button>\n }\n <button class=\"nty-button\" matButton=\"filled\" [disabled]=\"!isFormValid()\"\n (click)=\"onApply.emit()\">{{getApplyButtonLabel()}}</button>\n </mat-card-actions>\n</mat-card>", styles: [".filter-card{padding:1rem 1rem 0}.mat-card-actions{justify-content:flex-end}.nty-button{margin-left:.5rem}\n"] }]
|
|
1118
|
+
}], propDecorators: { Title: [{ type: i0.Input, args: [{ isSignal: true, alias: "Title", required: false }] }], SubTitle: [{ type: i0.Input, args: [{ isSignal: true, alias: "SubTitle", required: false }] }], isExportVisible: [{ type: i0.Input, args: [{ isSignal: true, alias: "isExportVisible", required: false }] }], isFormValid: [{ type: i0.Input, args: [{ isSignal: true, alias: "isFormValid", required: false }] }], onExport: [{ type: i0.Output, args: ["onExport"] }], onReset: [{ type: i0.Output, args: ["onReset"] }], onApply: [{ type: i0.Output, args: ["onApply"] }], resetButtonLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "resetButtonLabel", required: false }] }], applyButtonLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "applyButtonLabel", required: false }] }], exportButtonLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "exportButtonLabel", required: false }] }] } });
|
|
1119
|
+
|
|
1120
|
+
class NtySidenavResizableDirective {
|
|
1121
|
+
el = inject(ElementRef);
|
|
1122
|
+
renderer = inject(Renderer2);
|
|
1123
|
+
//private sidenav = inject(MatSidenav, { host: true, optional: true });
|
|
1124
|
+
side = 'left';
|
|
1125
|
+
minWidth = 100;
|
|
1126
|
+
maxWidth = 1200;
|
|
1127
|
+
widthChange = new EventEmitter();
|
|
1128
|
+
isResizing = false;
|
|
1129
|
+
startX = 0;
|
|
1130
|
+
startWidth = 0;
|
|
1131
|
+
dragCleanup = [];
|
|
1132
|
+
handle = null;
|
|
1133
|
+
ngOnInit() {
|
|
1134
|
+
this.createHandle();
|
|
1135
|
+
}
|
|
1136
|
+
ngOnDestroy() {
|
|
1137
|
+
this.stopResize();
|
|
1138
|
+
if (this.handle) {
|
|
1139
|
+
this.handle.remove();
|
|
1140
|
+
}
|
|
1141
|
+
}
|
|
1142
|
+
createHandle() {
|
|
1143
|
+
this.handle = this.renderer.createElement('div');
|
|
1144
|
+
this.renderer.addClass(this.handle, 'sidenav-resize-handle');
|
|
1145
|
+
this.renderer.addClass(this.handle, `handle-${this.side}`);
|
|
1146
|
+
// Ensure handle is always on top
|
|
1147
|
+
this.renderer.setStyle(this.handle, 'z-index', '99999');
|
|
1148
|
+
this.renderer.setStyle(this.handle, 'pointer-events', 'auto');
|
|
1149
|
+
this.renderer.appendChild(this.el.nativeElement, this.handle);
|
|
1150
|
+
this.renderer.listen(this.handle, 'mousedown', (event) => this.initResize(event));
|
|
1151
|
+
}
|
|
1152
|
+
initResize(event) {
|
|
1153
|
+
event.preventDefault();
|
|
1154
|
+
event.stopPropagation();
|
|
1155
|
+
this.isResizing = true;
|
|
1156
|
+
this.startX = event.clientX;
|
|
1157
|
+
this.startWidth = this.el.nativeElement.offsetWidth;
|
|
1158
|
+
this.dragCleanup.push(this.renderer.listen('window', 'mousemove', (e) => this.resize(e)));
|
|
1159
|
+
this.dragCleanup.push(this.renderer.listen('window', 'mouseup', () => this.stopResize()));
|
|
1160
|
+
}
|
|
1161
|
+
resize(event) {
|
|
1162
|
+
if (!this.isResizing)
|
|
1163
|
+
return;
|
|
1164
|
+
let newWidth;
|
|
1165
|
+
if (this.side === 'left') {
|
|
1166
|
+
// Dragging left edge of a right-aligned sidenav
|
|
1167
|
+
newWidth = this.startWidth + (this.startX - event.clientX);
|
|
1168
|
+
}
|
|
1169
|
+
else {
|
|
1170
|
+
// Dragging right edge of a left-aligned sidenav
|
|
1171
|
+
newWidth = this.startWidth + (event.clientX - this.startX);
|
|
1172
|
+
}
|
|
1173
|
+
if (newWidth >= this.minWidth && newWidth <= this.maxWidth) {
|
|
1174
|
+
this.renderer.setStyle(this.el.nativeElement, 'width', `${newWidth}px`);
|
|
1175
|
+
this.renderer.setStyle(this.el.nativeElement, 'max-width', 'none');
|
|
1176
|
+
this.renderer.setStyle(this.el.nativeElement, 'min-width', '0');
|
|
1177
|
+
this.widthChange.emit(newWidth);
|
|
1178
|
+
// Trigger window resize event to notify grid components to recalculate their size
|
|
1179
|
+
window.dispatchEvent(new Event('resize'));
|
|
1180
|
+
}
|
|
1181
|
+
}
|
|
1182
|
+
stopResize() {
|
|
1183
|
+
this.isResizing = false;
|
|
1184
|
+
this.dragCleanup.forEach(cleanup => cleanup());
|
|
1185
|
+
this.dragCleanup = [];
|
|
1186
|
+
}
|
|
1187
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: NtySidenavResizableDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
1188
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.1.2", type: NtySidenavResizableDirective, isStandalone: true, selector: "[ntySidenavResizable]", inputs: { side: "side", minWidth: "minWidth", maxWidth: "maxWidth" }, outputs: { widthChange: "widthChange" }, ngImport: i0 });
|
|
1189
|
+
}
|
|
1190
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: NtySidenavResizableDirective, decorators: [{
|
|
1191
|
+
type: Directive,
|
|
1192
|
+
args: [{
|
|
1193
|
+
selector: '[ntySidenavResizable]',
|
|
1194
|
+
standalone: true
|
|
1195
|
+
}]
|
|
1196
|
+
}], propDecorators: { side: [{
|
|
1197
|
+
type: Input
|
|
1198
|
+
}], minWidth: [{
|
|
1199
|
+
type: Input
|
|
1200
|
+
}], maxWidth: [{
|
|
1201
|
+
type: Input
|
|
1202
|
+
}], widthChange: [{
|
|
1203
|
+
type: Output
|
|
1204
|
+
}] } });
|
|
1205
|
+
|
|
1206
|
+
class RightSidenav {
|
|
1207
|
+
rightSidenavService = inject(RightSidenavService);
|
|
1208
|
+
injector = inject(Injector);
|
|
1209
|
+
container;
|
|
1210
|
+
constructor() {
|
|
1211
|
+
afterNextRender(() => {
|
|
1212
|
+
effect(() => {
|
|
1213
|
+
const comp = this.rightSidenavService.component();
|
|
1214
|
+
const data = this.rightSidenavService.panelData();
|
|
1215
|
+
this.container.clear();
|
|
1216
|
+
if (comp) {
|
|
1217
|
+
const ref = this.container.createComponent(comp);
|
|
1218
|
+
if (data) {
|
|
1219
|
+
ref.setInput('panelData', data);
|
|
1220
|
+
}
|
|
1221
|
+
}
|
|
1222
|
+
}, { injector: this.injector, allowSignalWrites: true });
|
|
1223
|
+
});
|
|
1224
|
+
}
|
|
1225
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: RightSidenav, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1226
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.1.2", type: RightSidenav, isStandalone: true, selector: "ntyux-right-sidenav", viewQueries: [{ propertyName: "container", first: true, predicate: ["container"], descendants: true, read: ViewContainerRef, static: true }], ngImport: i0, template: "<ng-container #container></ng-container>", styles: [""] });
|
|
1227
|
+
}
|
|
1228
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: RightSidenav, decorators: [{
|
|
1229
|
+
type: Component,
|
|
1230
|
+
args: [{ selector: 'ntyux-right-sidenav', imports: [], template: "<ng-container #container></ng-container>" }]
|
|
1231
|
+
}], ctorParameters: () => [], propDecorators: { container: [{
|
|
1232
|
+
type: ViewChild,
|
|
1233
|
+
args: ['container', { read: ViewContainerRef, static: true }]
|
|
1234
|
+
}] } });
|
|
1235
|
+
|
|
1236
|
+
class NtyUXLayout {
|
|
1237
|
+
// Services
|
|
1238
|
+
rightSidenavService = inject(RightSidenavService);
|
|
1239
|
+
// Left sidenav
|
|
1240
|
+
leftSidenavOpen = signal(true, ...(ngDevMode ? [{ debugName: "leftSidenavOpen" }] : []));
|
|
1241
|
+
isMinimized = signal(false, ...(ngDevMode ? [{ debugName: "isMinimized" }] : []));
|
|
1242
|
+
currentSidenavWidth = signal(350, ...(ngDevMode ? [{ debugName: "currentSidenavWidth" }] : []));
|
|
1243
|
+
toggleLeftSidenav() {
|
|
1244
|
+
this.leftSidenavOpen.update(v => !v);
|
|
1245
|
+
}
|
|
1246
|
+
// Minimize fixed
|
|
1247
|
+
drawerWidth = computed(() => {
|
|
1248
|
+
return this.isMinimized() ? '80px' : `${this.currentSidenavWidth()}px`;
|
|
1249
|
+
}, ...(ngDevMode ? [{ debugName: "drawerWidth" }] : []));
|
|
1250
|
+
toggleMinimize() {
|
|
1251
|
+
this.isMinimized.update(v => !v);
|
|
1252
|
+
}
|
|
1253
|
+
onSidenavResize(width) {
|
|
1254
|
+
this.currentSidenavWidth.set(width);
|
|
1255
|
+
}
|
|
1256
|
+
// Right sidenav
|
|
1257
|
+
onRightSidenavClosed() {
|
|
1258
|
+
this.rightSidenavService.close();
|
|
1259
|
+
}
|
|
1260
|
+
rightSidenavOpen = computed(() => this.rightSidenavService.isOpen(), ...(ngDevMode ? [{ debugName: "rightSidenavOpen" }] : []));
|
|
1261
|
+
// Language
|
|
1262
|
+
showIcon = signal(true, ...(ngDevMode ? [{ debugName: "showIcon" }] : []));
|
|
1263
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: NtyUXLayout, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1264
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.1.2", type: NtyUXLayout, isStandalone: true, selector: "app-layout", ngImport: i0, template: "<ntybase-toolbar [(icon)]=\"showIcon\" (toggleSidenav)=\"toggleLeftSidenav()\"></ntybase-toolbar>\n\n<mat-sidenav-container class=\"netty-sidenav-container\" [autosize]=\"true\">\n <!-- Left Sidenav -->\n <mat-sidenav #leftSidenav mode=\"side\" [opened]=\"leftSidenavOpen()\" position=\"start\" [class.minimized]=\"isMinimized()\"\n ntySidenavResizable side=\"right\" (widthChange)=\"onSidenavResize($event)\">\n <ntybase-left-sidenav [isMinimized]=\"isMinimized()\" (toggleMinimize)=\"toggleMinimize()\">\n </ntybase-left-sidenav>\n </mat-sidenav>\n\n <!-- Main Content -->\n <mat-sidenav-content [style.margin-left]=\"leftSidenavOpen() ? drawerWidth() : '0'\">\n <router-outlet></router-outlet>\n </mat-sidenav-content>\n\n <!-- Right Sidenav -->\n <mat-sidenav #rightSidenav mode=\"side\" position=\"end\" [opened]=\"rightSidenavOpen()\" class=\"netty-right-sidenav\"\n ntySidenavResizable side=\"left\">\n <ntyux-right-sidenav></ntyux-right-sidenav>\n </mat-sidenav>\n</mat-sidenav-container>", styles: [":host ::ng-deep .sidenav-resize-handle{position:absolute;top:0;bottom:0;width:10px;background-color:transparent;z-index:99999!important;transition:background-color .2s;pointer-events:auto}:host ::ng-deep .sidenav-resize-handle:hover{background-color:#0000000d;cursor:ew-resize!important}:host ::ng-deep .sidenav-resize-handle.handle-left{left:0}:host ::ng-deep .sidenav-resize-handle.handle-right{right:0}\n"], dependencies: [{ kind: "directive", type: RouterOutlet, selector: "router-outlet", inputs: ["name", "routerOutletData"], outputs: ["activate", "deactivate", "attach", "detach"], exportAs: ["outlet"] }, { kind: "ngmodule", type: MatSidenavModule }, { kind: "component", type: i1$4.MatSidenav, selector: "mat-sidenav", inputs: ["fixedInViewport", "fixedTopGap", "fixedBottomGap"], exportAs: ["matSidenav"] }, { kind: "component", type: i1$4.MatSidenavContainer, selector: "mat-sidenav-container", exportAs: ["matSidenavContainer"] }, { kind: "component", type: i1$4.MatSidenavContent, selector: "mat-sidenav-content" }, { kind: "component", type: Toolbar, selector: "ntybase-toolbar", inputs: ["icon"], outputs: ["toggleSidenav", "iconChange"] }, { kind: "component", type: LeftSidenav, selector: "ntybase-left-sidenav", inputs: ["isMinimized"], outputs: ["toggleMinimize"] }, { kind: "directive", type: NtySidenavResizableDirective, selector: "[ntySidenavResizable]", inputs: ["side", "minWidth", "maxWidth"], outputs: ["widthChange"] }, { kind: "component", type: RightSidenav, selector: "ntyux-right-sidenav" }] });
|
|
1265
|
+
}
|
|
1266
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: NtyUXLayout, decorators: [{
|
|
1267
|
+
type: Component,
|
|
1268
|
+
args: [{ selector: 'app-layout', imports: [RouterOutlet, MatSidenavModule, Toolbar, LeftSidenav, NtySidenavResizableDirective, RightSidenav], template: "<ntybase-toolbar [(icon)]=\"showIcon\" (toggleSidenav)=\"toggleLeftSidenav()\"></ntybase-toolbar>\n\n<mat-sidenav-container class=\"netty-sidenav-container\" [autosize]=\"true\">\n <!-- Left Sidenav -->\n <mat-sidenav #leftSidenav mode=\"side\" [opened]=\"leftSidenavOpen()\" position=\"start\" [class.minimized]=\"isMinimized()\"\n ntySidenavResizable side=\"right\" (widthChange)=\"onSidenavResize($event)\">\n <ntybase-left-sidenav [isMinimized]=\"isMinimized()\" (toggleMinimize)=\"toggleMinimize()\">\n </ntybase-left-sidenav>\n </mat-sidenav>\n\n <!-- Main Content -->\n <mat-sidenav-content [style.margin-left]=\"leftSidenavOpen() ? drawerWidth() : '0'\">\n <router-outlet></router-outlet>\n </mat-sidenav-content>\n\n <!-- Right Sidenav -->\n <mat-sidenav #rightSidenav mode=\"side\" position=\"end\" [opened]=\"rightSidenavOpen()\" class=\"netty-right-sidenav\"\n ntySidenavResizable side=\"left\">\n <ntyux-right-sidenav></ntyux-right-sidenav>\n </mat-sidenav>\n</mat-sidenav-container>", styles: [":host ::ng-deep .sidenav-resize-handle{position:absolute;top:0;bottom:0;width:10px;background-color:transparent;z-index:99999!important;transition:background-color .2s;pointer-events:auto}:host ::ng-deep .sidenav-resize-handle:hover{background-color:#0000000d;cursor:ew-resize!important}:host ::ng-deep .sidenav-resize-handle.handle-left{left:0}:host ::ng-deep .sidenav-resize-handle.handle-right{right:0}\n"] }]
|
|
1269
|
+
}] });
|
|
1270
|
+
|
|
1271
|
+
class NtyResizableDirective {
|
|
1272
|
+
el = inject(ElementRef);
|
|
1273
|
+
renderer = inject(Renderer2);
|
|
1274
|
+
isEnabled = true;
|
|
1275
|
+
isResizing = false;
|
|
1276
|
+
startX = 0;
|
|
1277
|
+
startY = 0;
|
|
1278
|
+
startWidth = 0;
|
|
1279
|
+
startHeight = 0;
|
|
1280
|
+
dragCleanup = [];
|
|
1281
|
+
handle = null;
|
|
1282
|
+
ngOnInit() {
|
|
1283
|
+
if (this.isEnabled) {
|
|
1284
|
+
this.createHandle();
|
|
1285
|
+
}
|
|
1286
|
+
}
|
|
1287
|
+
ngOnDestroy() {
|
|
1288
|
+
this.stopResize();
|
|
1289
|
+
if (this.handle) {
|
|
1290
|
+
this.handle.remove();
|
|
1291
|
+
}
|
|
1292
|
+
}
|
|
1293
|
+
createHandle() {
|
|
1294
|
+
this.handle = this.renderer.createElement('div');
|
|
1295
|
+
this.renderer.addClass(this.handle, 'resize-handle');
|
|
1296
|
+
const icon = this.renderer.createElement('mat-icon');
|
|
1297
|
+
this.renderer.addClass(icon, 'mat-icon');
|
|
1298
|
+
this.renderer.addClass(icon, 'material-icons');
|
|
1299
|
+
const iconText = this.renderer.createText('open_with');
|
|
1300
|
+
this.renderer.appendChild(icon, iconText);
|
|
1301
|
+
this.renderer.appendChild(this.handle, icon);
|
|
1302
|
+
this.renderer.appendChild(this.el.nativeElement, this.handle);
|
|
1303
|
+
this.renderer.listen(this.handle, 'mousedown', (event) => this.initResize(event));
|
|
1304
|
+
}
|
|
1305
|
+
initResize(event) {
|
|
1306
|
+
event.preventDefault();
|
|
1307
|
+
event.stopPropagation();
|
|
1308
|
+
this.isResizing = true;
|
|
1309
|
+
this.startX = event.clientX;
|
|
1310
|
+
this.startY = event.clientY;
|
|
1311
|
+
const dialogContainer = this.el.nativeElement.closest('.cdk-overlay-pane');
|
|
1312
|
+
if (!dialogContainer)
|
|
1313
|
+
return;
|
|
1314
|
+
const rect = dialogContainer.getBoundingClientRect();
|
|
1315
|
+
this.startWidth = rect.width;
|
|
1316
|
+
this.startHeight = rect.height;
|
|
1317
|
+
this.dragCleanup.push(this.renderer.listen('window', 'mousemove', (e) => this.resize(e)));
|
|
1318
|
+
this.dragCleanup.push(this.renderer.listen('window', 'mouseup', () => this.stopResize()));
|
|
1319
|
+
}
|
|
1320
|
+
resize(event) {
|
|
1321
|
+
if (!this.isResizing)
|
|
1322
|
+
return;
|
|
1323
|
+
const dx = event.clientX - this.startX;
|
|
1324
|
+
const dy = event.clientY - this.startY;
|
|
1325
|
+
const dialogContainer = this.el.nativeElement.closest('.cdk-overlay-pane');
|
|
1326
|
+
if (dialogContainer) {
|
|
1327
|
+
this.renderer.setStyle(dialogContainer, 'width', `${this.startWidth + dx}px`);
|
|
1328
|
+
this.renderer.setStyle(dialogContainer, 'height', `${this.startHeight + dy}px`);
|
|
1329
|
+
this.renderer.setStyle(dialogContainer, 'max-width', 'unset');
|
|
1330
|
+
this.renderer.setStyle(dialogContainer, 'max-height', 'unset');
|
|
1331
|
+
}
|
|
1332
|
+
}
|
|
1333
|
+
stopResize() {
|
|
1334
|
+
this.isResizing = false;
|
|
1335
|
+
this.dragCleanup.forEach(cleanup => cleanup());
|
|
1336
|
+
this.dragCleanup = [];
|
|
1337
|
+
}
|
|
1338
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: NtyResizableDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
1339
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.1.2", type: NtyResizableDirective, isStandalone: true, selector: "[ntyResizable]", inputs: { isEnabled: ["ntyResizable", "isEnabled"] }, ngImport: i0 });
|
|
1340
|
+
}
|
|
1341
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: NtyResizableDirective, decorators: [{
|
|
1342
|
+
type: Directive,
|
|
1343
|
+
args: [{
|
|
1344
|
+
selector: '[ntyResizable]',
|
|
1345
|
+
standalone: true
|
|
1346
|
+
}]
|
|
1347
|
+
}], propDecorators: { isEnabled: [{
|
|
1348
|
+
type: Input,
|
|
1349
|
+
args: ['ntyResizable']
|
|
1350
|
+
}] } });
|
|
1351
|
+
|
|
1352
|
+
class NtyUXSaveLayout {
|
|
1353
|
+
title = input('', ...(ngDevMode ? [{ debugName: "title" }] : []));
|
|
1354
|
+
identifier = input('', ...(ngDevMode ? [{ debugName: "identifier" }] : []));
|
|
1355
|
+
viewMode = input('dialog', ...(ngDevMode ? [{ debugName: "viewMode" }] : []));
|
|
1356
|
+
saveDisabled = input(false, ...(ngDevMode ? [{ debugName: "saveDisabled" }] : []));
|
|
1357
|
+
showClose = input(true, ...(ngDevMode ? [{ debugName: "showClose" }] : []));
|
|
1358
|
+
showSave = input(true, ...(ngDevMode ? [{ debugName: "showSave" }] : []));
|
|
1359
|
+
save = output();
|
|
1360
|
+
cancel = output();
|
|
1361
|
+
onSave() {
|
|
1362
|
+
this.save.emit();
|
|
1363
|
+
}
|
|
1364
|
+
onCancel() {
|
|
1365
|
+
this.cancel.emit();
|
|
1366
|
+
}
|
|
1367
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: NtyUXSaveLayout, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1368
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.1.2", type: NtyUXSaveLayout, isStandalone: true, selector: "ntyux-save-layout", inputs: { title: { classPropertyName: "title", publicName: "title", isSignal: true, isRequired: false, transformFunction: null }, identifier: { classPropertyName: "identifier", publicName: "identifier", isSignal: true, isRequired: false, transformFunction: null }, viewMode: { classPropertyName: "viewMode", publicName: "viewMode", isSignal: true, isRequired: false, transformFunction: null }, saveDisabled: { classPropertyName: "saveDisabled", publicName: "saveDisabled", isSignal: true, isRequired: false, transformFunction: null }, showClose: { classPropertyName: "showClose", publicName: "showClose", isSignal: true, isRequired: false, transformFunction: null }, showSave: { classPropertyName: "showSave", publicName: "showSave", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { save: "save", cancel: "cancel" }, ngImport: i0, template: "<div\n [class.fullscreen-container]=\"viewMode() === 'fullscreen'\"\n [class.sidenav-container]=\"viewMode() === 'sidenav'\"\n [class.popup-container]=\"viewMode() === 'dialog'\"\n [class.dialog-drag-container]=\"viewMode() === 'dialog'\"\n cdkDrag\n [cdkDragDisabled]=\"viewMode() !== 'dialog'\"\n cdkDragRootElement=\".cdk-overlay-pane\"\n [ntyResizable]=\"viewMode() === 'dialog'\"\n>\n <div class=\"menu-button\">\n <ntyui-button\n type=\"menu\"\n icon=\"arrow_back\"\n [disableOnClick]=\"true\"\n [disableDuration]=\"6\"\n (clicked)=\"onCancel()\"\n />\n @if(showSave()){\n <ntyui-button\n type=\"menu\"\n icon=\"save\"\n [disableOnClick]=\"true\"\n [disableDuration]=\"6\"\n (clicked)=\"onSave()\"\n />\n }\n <ng-content select=\"[additional-menu-item]\"></ng-content>\n @if(viewMode() === 'dialog' && showClose()){\n <ng-container>\n <ntyui-button\n type=\"close\"\n class=\"list-close-button\"\n [toolTip]=\"'@close'| translate\"\n (clicked)=\"onCancel()\"\n />\n </ng-container>\n }\n </div>\n\n <!-- Header -->\n <div class=\"nettybase-save-record-header-bar\" cdkDragHandle>\n <div class=\"nettybase-save-record-title-info\">\n <span class=\"nettybase-save-record-identifier\">\n {{ title() }}: {{ identifier() }}\n </span>\n </div>\n </div>\n\n <!-- Scrollable Content Area -->\n <div class=\"nettybase-container\">\n <ng-content></ng-content>\n </div>\n\n <!-- Footer Buttons -->\n <div class=\"nettybase-save-button-container\">\n @if(showSave()){\n <ntyui-button\n [label]=\"'@btnSave' | translate\"\n class=\"ntyui-form-button-save\"\n isFilled=\"true\"\n icon=\"save\"\n type=\"regular\"\n (clicked)=\"onSave()\"\n [disabled]=\"saveDisabled()\"\n />\n }\n\n <ntyui-button\n [label]=\"'@btnCancel' | translate\"\n class=\"ntyui-form-button-cancel\"\n icon=\"close\"\n type=\"regular\"\n (clicked)=\"onCancel()\"\n />\n </div>\n</div>\n", styles: [":host{display:block;height:100%;width:100%}.fullscreen-container,.sidenav-container,.popup-container{height:100%;display:flex;flex-direction:column;overflow:hidden}.nettybase-container{padding:16px;flex:1;overflow-y:auto}.resize-handle{position:absolute;right:1px;bottom:1px;width:24px;height:24px;cursor:nwse-resize;display:flex;align-items:center;justify-content:center;z-index:9999;color:#0006;transition:color .2s,transform .2s;background:transparent;pointer-events:auto}.resize-handle:hover{color:#000c;transform:scale(1.1)}.resize-handle mat-icon{font-size:20px;width:20px;height:20px}:host-context(.cdk-overlay-pane){display:flex!important;flex-direction:column!important;height:100%!important;width:100%!important;margin:0!important;padding:0!important;overflow:hidden!important;border-radius:8px}:host-context(.cdk-overlay-pane) form{height:100%!important;display:flex!important;flex-direction:column!important;overflow:hidden!important;margin:0}:host-context(.cdk-overlay-pane) .popup-container{flex:1!important;display:flex!important;flex-direction:column!important;overflow:hidden!important;position:relative!important;height:100%!important;background:#fff}:host-context(.cdk-overlay-pane) .nettybase-container{flex:1!important;overflow-y:auto!important;overflow-x:hidden!important;padding:16px;position:relative}:host-context(.cdk-overlay-pane) .nettybase-save-button-container{flex-shrink:0!important;padding:12px 16px;background:#f8f9fa;border-top:1px solid #eee;display:flex;justify-content:flex-end;gap:8px}:host-context(.cdk-overlay-pane) .nettybase-save-record-header-bar{flex-shrink:0!important}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: TranslateModule }, { kind: "ngmodule", type: DragDropModule }, { kind: "directive", type: i1$5.CdkDrag, selector: "[cdkDrag]", inputs: ["cdkDragData", "cdkDragLockAxis", "cdkDragRootElement", "cdkDragBoundary", "cdkDragStartDelay", "cdkDragFreeDragPosition", "cdkDragDisabled", "cdkDragConstrainPosition", "cdkDragPreviewClass", "cdkDragPreviewContainer", "cdkDragScale"], outputs: ["cdkDragStarted", "cdkDragReleased", "cdkDragEnded", "cdkDragEntered", "cdkDragExited", "cdkDragDropped", "cdkDragMoved"], exportAs: ["cdkDrag"] }, { kind: "directive", type: i1$5.CdkDragHandle, selector: "[cdkDragHandle]", inputs: ["cdkDragHandleDisabled"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: NettyUIButton, selector: "ntyui-button", inputs: ["icon", "isFilled", "menuReference", "disableOnClick", "disableDuration", "waitingText", "type", "toolTip"], outputs: ["clicked"] }, { kind: "directive", type: NtyResizableDirective, selector: "[ntyResizable]", inputs: ["ntyResizable"] }, { kind: "pipe", type: i3.TranslatePipe, name: "translate" }] });
|
|
1369
|
+
}
|
|
1370
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: NtyUXSaveLayout, decorators: [{
|
|
1371
|
+
type: Component,
|
|
1372
|
+
args: [{ selector: 'ntyux-save-layout', standalone: true, imports: [CommonModule, TranslateModule, DragDropModule, MatIconModule, NettyUIButton, NtyResizableDirective], template: "<div\n [class.fullscreen-container]=\"viewMode() === 'fullscreen'\"\n [class.sidenav-container]=\"viewMode() === 'sidenav'\"\n [class.popup-container]=\"viewMode() === 'dialog'\"\n [class.dialog-drag-container]=\"viewMode() === 'dialog'\"\n cdkDrag\n [cdkDragDisabled]=\"viewMode() !== 'dialog'\"\n cdkDragRootElement=\".cdk-overlay-pane\"\n [ntyResizable]=\"viewMode() === 'dialog'\"\n>\n <div class=\"menu-button\">\n <ntyui-button\n type=\"menu\"\n icon=\"arrow_back\"\n [disableOnClick]=\"true\"\n [disableDuration]=\"6\"\n (clicked)=\"onCancel()\"\n />\n @if(showSave()){\n <ntyui-button\n type=\"menu\"\n icon=\"save\"\n [disableOnClick]=\"true\"\n [disableDuration]=\"6\"\n (clicked)=\"onSave()\"\n />\n }\n <ng-content select=\"[additional-menu-item]\"></ng-content>\n @if(viewMode() === 'dialog' && showClose()){\n <ng-container>\n <ntyui-button\n type=\"close\"\n class=\"list-close-button\"\n [toolTip]=\"'@close'| translate\"\n (clicked)=\"onCancel()\"\n />\n </ng-container>\n }\n </div>\n\n <!-- Header -->\n <div class=\"nettybase-save-record-header-bar\" cdkDragHandle>\n <div class=\"nettybase-save-record-title-info\">\n <span class=\"nettybase-save-record-identifier\">\n {{ title() }}: {{ identifier() }}\n </span>\n </div>\n </div>\n\n <!-- Scrollable Content Area -->\n <div class=\"nettybase-container\">\n <ng-content></ng-content>\n </div>\n\n <!-- Footer Buttons -->\n <div class=\"nettybase-save-button-container\">\n @if(showSave()){\n <ntyui-button\n [label]=\"'@btnSave' | translate\"\n class=\"ntyui-form-button-save\"\n isFilled=\"true\"\n icon=\"save\"\n type=\"regular\"\n (clicked)=\"onSave()\"\n [disabled]=\"saveDisabled()\"\n />\n }\n\n <ntyui-button\n [label]=\"'@btnCancel' | translate\"\n class=\"ntyui-form-button-cancel\"\n icon=\"close\"\n type=\"regular\"\n (clicked)=\"onCancel()\"\n />\n </div>\n</div>\n", styles: [":host{display:block;height:100%;width:100%}.fullscreen-container,.sidenav-container,.popup-container{height:100%;display:flex;flex-direction:column;overflow:hidden}.nettybase-container{padding:16px;flex:1;overflow-y:auto}.resize-handle{position:absolute;right:1px;bottom:1px;width:24px;height:24px;cursor:nwse-resize;display:flex;align-items:center;justify-content:center;z-index:9999;color:#0006;transition:color .2s,transform .2s;background:transparent;pointer-events:auto}.resize-handle:hover{color:#000c;transform:scale(1.1)}.resize-handle mat-icon{font-size:20px;width:20px;height:20px}:host-context(.cdk-overlay-pane){display:flex!important;flex-direction:column!important;height:100%!important;width:100%!important;margin:0!important;padding:0!important;overflow:hidden!important;border-radius:8px}:host-context(.cdk-overlay-pane) form{height:100%!important;display:flex!important;flex-direction:column!important;overflow:hidden!important;margin:0}:host-context(.cdk-overlay-pane) .popup-container{flex:1!important;display:flex!important;flex-direction:column!important;overflow:hidden!important;position:relative!important;height:100%!important;background:#fff}:host-context(.cdk-overlay-pane) .nettybase-container{flex:1!important;overflow-y:auto!important;overflow-x:hidden!important;padding:16px;position:relative}:host-context(.cdk-overlay-pane) .nettybase-save-button-container{flex-shrink:0!important;padding:12px 16px;background:#f8f9fa;border-top:1px solid #eee;display:flex;justify-content:flex-end;gap:8px}:host-context(.cdk-overlay-pane) .nettybase-save-record-header-bar{flex-shrink:0!important}\n"] }]
|
|
1373
|
+
}], propDecorators: { title: [{ type: i0.Input, args: [{ isSignal: true, alias: "title", required: false }] }], identifier: [{ type: i0.Input, args: [{ isSignal: true, alias: "identifier", required: false }] }], viewMode: [{ type: i0.Input, args: [{ isSignal: true, alias: "viewMode", required: false }] }], saveDisabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "saveDisabled", required: false }] }], showClose: [{ type: i0.Input, args: [{ isSignal: true, alias: "showClose", required: false }] }], showSave: [{ type: i0.Input, args: [{ isSignal: true, alias: "showSave", required: false }] }], save: [{ type: i0.Output, args: ["save"] }], cancel: [{ type: i0.Output, args: ["cancel"] }] } });
|
|
1374
|
+
|
|
1375
|
+
class NtyUXCounterCard {
|
|
1376
|
+
quantity = model(0, ...(ngDevMode ? [{ debugName: "quantity" }] : []));
|
|
1377
|
+
min = input(0, ...(ngDevMode ? [{ debugName: "min" }] : []));
|
|
1378
|
+
max = input(Infinity, ...(ngDevMode ? [{ debugName: "max" }] : []));
|
|
1379
|
+
step = input(1, ...(ngDevMode ? [{ debugName: "step" }] : []));
|
|
1380
|
+
canIncrease = input(true, ...(ngDevMode ? [{ debugName: "canIncrease" }] : []));
|
|
1381
|
+
isEdit = input(false, ...(ngDevMode ? [{ debugName: "isEdit" }] : []));
|
|
1382
|
+
isMinusDisabled = computed(() => this.quantity() <= this.min(), ...(ngDevMode ? [{ debugName: "isMinusDisabled" }] : []));
|
|
1383
|
+
isPlusDisabled = computed(() => !this.canIncrease() || this.quantity() >= this.max(), ...(ngDevMode ? [{ debugName: "isPlusDisabled" }] : []));
|
|
1384
|
+
update(change) {
|
|
1385
|
+
const nextValue = this.quantity() + change;
|
|
1386
|
+
this.applyValue(nextValue, change > 0);
|
|
1387
|
+
}
|
|
1388
|
+
onInputChange(event) {
|
|
1389
|
+
const inputElement = event.target;
|
|
1390
|
+
let newValue = parseFloat(inputElement.value);
|
|
1391
|
+
if (isNaN(newValue)) {
|
|
1392
|
+
newValue = this.min();
|
|
1393
|
+
}
|
|
1394
|
+
this.applyValue(newValue, true);
|
|
1395
|
+
inputElement.value = this.quantity().toString();
|
|
1396
|
+
}
|
|
1397
|
+
applyValue(value, isIncreasing) {
|
|
1398
|
+
if (value < this.min())
|
|
1399
|
+
value = this.min();
|
|
1400
|
+
if (value > this.max())
|
|
1401
|
+
value = this.max();
|
|
1402
|
+
if (isIncreasing && !this.canIncrease() && value > this.quantity()) {
|
|
1403
|
+
return;
|
|
1404
|
+
}
|
|
1405
|
+
this.quantity.set(value);
|
|
1406
|
+
}
|
|
1407
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: NtyUXCounterCard, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1408
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.1.2", type: NtyUXCounterCard, isStandalone: true, selector: "ntyux-counter-card", inputs: { quantity: { classPropertyName: "quantity", publicName: "quantity", isSignal: true, isRequired: false, transformFunction: null }, min: { classPropertyName: "min", publicName: "min", isSignal: true, isRequired: false, transformFunction: null }, max: { classPropertyName: "max", publicName: "max", isSignal: true, isRequired: false, transformFunction: null }, step: { classPropertyName: "step", publicName: "step", isSignal: true, isRequired: false, transformFunction: null }, canIncrease: { classPropertyName: "canIncrease", publicName: "canIncrease", isSignal: true, isRequired: false, transformFunction: null }, isEdit: { classPropertyName: "isEdit", publicName: "isEdit", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { quantity: "quantityChange" }, ngImport: i0, template: "<div class=\"stepper-card\">\n <button class=\"step-btn minus\" (click)=\"update(-step())\" [disabled]=\"isMinusDisabled()\">\n <i class=\"fas fa-minus\"></i> -\n </button>\n\n <div class=\"card-content\">\n <ng-content select=\"[card-body]\"></ng-content>\n\n <div class=\"quantity-display\">\n <ng-content select=\"[card-label]\"></ng-content>\n\n @if (isEdit()) {\n <input type=\"number\" class=\"value-input\" [ngModel]=\"quantity()\" (change)=\"onInputChange($event)\"\n [min]=\"min()\" [max]=\"max()\" [step]=\"step()\" />\n } @else {\n <span class=\"value\">{{ quantity() }}</span>\n }\n </div>\n </div>\n\n <button class=\"step-btn plus\" (click)=\"update(step())\" [disabled]=\"isPlusDisabled()\">\n <i class=\"fas fa-plus\"></i> +\n </button>\n</div>", styles: [".stepper-card{display:flex;background:#fff;border-radius:12px;border:1px solid #e0e6ed;overflow:hidden;height:160px;box-shadow:0 2px 8px #0000000d;transition:transform .2s}.stepper-card .step-btn{width:50px;border:none;background:#f8f9fa;font-size:1.5rem;font-weight:700;cursor:pointer;transition:all .2s;display:flex;align-items:center;justify-content:center}.stepper-card .step-btn:hover:not(:disabled){background:#e2e6ea}.stepper-card .step-btn:disabled{cursor:not-allowed;color:#ccc;background:#f0f0f0}.stepper-card .step-btn.minus{color:#d32f2f;border-right:1px solid #eee}.stepper-card .step-btn.plus{color:#2e7d32;border-left:1px solid #eee}.stepper-card .step-btn:not(:disabled).minus{background-color:#d32f2f;color:#fff;border-right:1px solid #eee}.stepper-card .step-btn:not(:disabled).plus{background-color:#48a111;color:#fff;border-left:1px solid #eee}.stepper-card .card-content{flex:1;display:flex;flex-direction:column;padding:10px;text-align:center;justify-content:space-between}.stepper-card .card-content .quantity-display{display:flex;align-items:center;justify-content:center;gap:10px;border-top:1px solid #f0f0f0;padding-top:5px}.stepper-card .card-content .quantity-display .label{display:inline-block;font-size:.85rem;color:#333;margin-bottom:0}.stepper-card .card-content .quantity-display .value{font-size:.9rem;font-weight:500;color:var(--mat-sys-primary-container-surface)}.stepper-card .card-content .quantity-display .value-input{width:60px;border:1px solid #ddd;border-radius:4px;padding:4px;text-align:center;font-size:1rem;font-weight:700;color:#48a111;outline:none}.stepper-card .card-content .quantity-display .value-input:focus{border-color:#48a111;box-shadow:0 0 0 2px #48a1111a}\n"], dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1$2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1$2.NumberValueAccessor, selector: "input[type=number][formControlName],input[type=number][formControl],input[type=number][ngModel]" }, { kind: "directive", type: i1$2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$2.MinValidator, selector: "input[type=number][min][formControlName],input[type=number][min][formControl],input[type=number][min][ngModel]", inputs: ["min"] }, { kind: "directive", type: i1$2.MaxValidator, selector: "input[type=number][max][formControlName],input[type=number][max][formControl],input[type=number][max][ngModel]", inputs: ["max"] }, { kind: "directive", type: i1$2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }] });
|
|
1409
|
+
}
|
|
1410
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: NtyUXCounterCard, decorators: [{
|
|
1411
|
+
type: Component,
|
|
1412
|
+
args: [{ selector: 'ntyux-counter-card', imports: [FormsModule], template: "<div class=\"stepper-card\">\n <button class=\"step-btn minus\" (click)=\"update(-step())\" [disabled]=\"isMinusDisabled()\">\n <i class=\"fas fa-minus\"></i> -\n </button>\n\n <div class=\"card-content\">\n <ng-content select=\"[card-body]\"></ng-content>\n\n <div class=\"quantity-display\">\n <ng-content select=\"[card-label]\"></ng-content>\n\n @if (isEdit()) {\n <input type=\"number\" class=\"value-input\" [ngModel]=\"quantity()\" (change)=\"onInputChange($event)\"\n [min]=\"min()\" [max]=\"max()\" [step]=\"step()\" />\n } @else {\n <span class=\"value\">{{ quantity() }}</span>\n }\n </div>\n </div>\n\n <button class=\"step-btn plus\" (click)=\"update(step())\" [disabled]=\"isPlusDisabled()\">\n <i class=\"fas fa-plus\"></i> +\n </button>\n</div>", styles: [".stepper-card{display:flex;background:#fff;border-radius:12px;border:1px solid #e0e6ed;overflow:hidden;height:160px;box-shadow:0 2px 8px #0000000d;transition:transform .2s}.stepper-card .step-btn{width:50px;border:none;background:#f8f9fa;font-size:1.5rem;font-weight:700;cursor:pointer;transition:all .2s;display:flex;align-items:center;justify-content:center}.stepper-card .step-btn:hover:not(:disabled){background:#e2e6ea}.stepper-card .step-btn:disabled{cursor:not-allowed;color:#ccc;background:#f0f0f0}.stepper-card .step-btn.minus{color:#d32f2f;border-right:1px solid #eee}.stepper-card .step-btn.plus{color:#2e7d32;border-left:1px solid #eee}.stepper-card .step-btn:not(:disabled).minus{background-color:#d32f2f;color:#fff;border-right:1px solid #eee}.stepper-card .step-btn:not(:disabled).plus{background-color:#48a111;color:#fff;border-left:1px solid #eee}.stepper-card .card-content{flex:1;display:flex;flex-direction:column;padding:10px;text-align:center;justify-content:space-between}.stepper-card .card-content .quantity-display{display:flex;align-items:center;justify-content:center;gap:10px;border-top:1px solid #f0f0f0;padding-top:5px}.stepper-card .card-content .quantity-display .label{display:inline-block;font-size:.85rem;color:#333;margin-bottom:0}.stepper-card .card-content .quantity-display .value{font-size:.9rem;font-weight:500;color:var(--mat-sys-primary-container-surface)}.stepper-card .card-content .quantity-display .value-input{width:60px;border:1px solid #ddd;border-radius:4px;padding:4px;text-align:center;font-size:1rem;font-weight:700;color:#48a111;outline:none}.stepper-card .card-content .quantity-display .value-input:focus{border-color:#48a111;box-shadow:0 0 0 2px #48a1111a}\n"] }]
|
|
1413
|
+
}], propDecorators: { quantity: [{ type: i0.Input, args: [{ isSignal: true, alias: "quantity", required: false }] }, { type: i0.Output, args: ["quantityChange"] }], min: [{ type: i0.Input, args: [{ isSignal: true, alias: "min", required: false }] }], max: [{ type: i0.Input, args: [{ isSignal: true, alias: "max", required: false }] }], step: [{ type: i0.Input, args: [{ isSignal: true, alias: "step", required: false }] }], canIncrease: [{ type: i0.Input, args: [{ isSignal: true, alias: "canIncrease", required: false }] }], isEdit: [{ type: i0.Input, args: [{ isSignal: true, alias: "isEdit", required: false }] }] } });
|
|
1414
|
+
|
|
1415
|
+
/*
|
|
1416
|
+
* Public API Surface of ntyuxv2
|
|
1417
|
+
*/
|
|
1418
|
+
|
|
1419
|
+
/**
|
|
1420
|
+
* Generated bundle index. Do not edit.
|
|
1421
|
+
*/
|
|
1422
|
+
|
|
1423
|
+
export { AutoComplete, ColorPalette, HttpError403, HttpError404, LeftSidenav, NettyFilter, NettyUXFilterCard, NtyAutoCompleteFilter, NtyAutoCompleteFilterFields, NtyResizableDirective, NtySidenavResizableDirective, NtyUXCounterCard, NtyUXLayout, NtyUXSaveLayout, Ntyuxv2, RightSidenav, SelectionItem, Theme, Toolbar, ValueUnitInput };
|
|
1424
|
+
//# sourceMappingURL=nettyapps-ntyuxv2.mjs.map
|