@yuuvis/app-templates 1.0.0-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +41 -0
- package/extensions/README.md +3 -0
- package/extensions/index.d.ts +1 -0
- package/extensions/lib/actions/apply.action.d.ts +16 -0
- package/extensions/lib/actions/apply.component.d.ts +28 -0
- package/extensions/lib/assets/i18n/de.json +11 -0
- package/extensions/lib/assets/i18n/en.json +11 -0
- package/extensions/lib/extensions.service.d.ts +14 -0
- package/fesm2022/yuuvis-app-templates-extensions.mjs +182 -0
- package/fesm2022/yuuvis-app-templates-extensions.mjs.map +1 -0
- package/fesm2022/yuuvis-app-templates.mjs +544 -0
- package/fesm2022/yuuvis-app-templates.mjs.map +1 -0
- package/index.d.ts +4 -0
- package/lib/app-templates.component.d.ts +7 -0
- package/lib/app-templates.schema.d.ts +42 -0
- package/lib/app-templates.service.d.ts +24 -0
- package/lib/assets/i18n/de.json +24 -0
- package/lib/assets/i18n/en.json +24 -0
- package/lib/components/template-details/template-details.component.d.ts +7 -0
- package/lib/lib.routes.d.ts +2 -0
- package/lib/overlays/create-template/create-template.component.d.ts +18 -0
- package/lib/pages/management/template-management.component.d.ts +45 -0
- package/package.json +28 -0
- package/yuv-manifest.json +10 -0
|
@@ -0,0 +1,544 @@
|
|
|
1
|
+
import { HttpParams } from '@angular/common/http';
|
|
2
|
+
import * as i0 from '@angular/core';
|
|
3
|
+
import { inject, signal, Injectable, Component, Input, linkedSignal, viewChild, HostBinding } from '@angular/core';
|
|
4
|
+
import * as i2 from '@yuuvis/client-core';
|
|
5
|
+
import { BaseObjectTypeField, Logger, BackendService, DmsService, TranslateService, SystemService, ContentStreamAllowed, ApiBase, TranslateModule, DeviceService, NotificationService } from '@yuuvis/client-core';
|
|
6
|
+
import { ReplaySubject, catchError, throwError, map, tap, switchMap, of } from 'rxjs';
|
|
7
|
+
import { ConfirmService, BusyOverlayDirective, DialogComponent } from '@yuuvis/client-framework/common';
|
|
8
|
+
import * as i1$2 from '@angular/common';
|
|
9
|
+
import { CommonModule, DOCUMENT } from '@angular/common';
|
|
10
|
+
import * as i1 from '@angular/router';
|
|
11
|
+
import { RouterModule } from '@angular/router';
|
|
12
|
+
import { AppLogoComponent } from '@yuuvis/client-shell';
|
|
13
|
+
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
14
|
+
import { ListComponent, ListItemDirective } from '@yuuvis/client-framework/list';
|
|
15
|
+
import * as i5 from '@yuuvis/client-framework/master-details';
|
|
16
|
+
import { YuvMasterDetailsModule } from '@yuuvis/client-framework/master-details';
|
|
17
|
+
import * as i4$1 from '@yuuvis/client-framework/overflow-menu';
|
|
18
|
+
import { YuvOverflowMenuModule } from '@yuuvis/client-framework/overflow-menu';
|
|
19
|
+
import { PaginationComponent } from '@yuuvis/client-framework/pagination';
|
|
20
|
+
import * as i7 from '@angular/material/button';
|
|
21
|
+
import { MatButtonModule } from '@angular/material/button';
|
|
22
|
+
import { MatDialogRef, MatDialog } from '@angular/material/dialog';
|
|
23
|
+
import * as i6 from '@angular/material/icon';
|
|
24
|
+
import { MatIconModule } from '@angular/material/icon';
|
|
25
|
+
import * as i8 from '@angular/material/tooltip';
|
|
26
|
+
import { MatTooltipModule } from '@angular/material/tooltip';
|
|
27
|
+
import { ObjectPreviewComponent } from '@yuuvis/client-framework/object-preview';
|
|
28
|
+
import * as i1$1 from '@angular/forms';
|
|
29
|
+
import { ReactiveFormsModule, FormBuilder, Validators } from '@angular/forms';
|
|
30
|
+
import * as i3 from '@angular/material/form-field';
|
|
31
|
+
import { MatFormFieldModule } from '@angular/material/form-field';
|
|
32
|
+
import * as i4 from '@angular/material/select';
|
|
33
|
+
import { MatSelectModule } from '@angular/material/select';
|
|
34
|
+
import { StringComponent } from '@yuuvis/client-framework/forms';
|
|
35
|
+
import { YmtButtonDirective } from '@yuuvis/material';
|
|
36
|
+
|
|
37
|
+
const APP_ID = 'io.yuuvis.app.templates';
|
|
38
|
+
const APP_ICONS = {
|
|
39
|
+
close: 'close',
|
|
40
|
+
refresh: 'refresh',
|
|
41
|
+
actionApplyTemplate: 'article_shortcut',
|
|
42
|
+
actionCreateNewTemplate: 'add_notes',
|
|
43
|
+
actionToggleStateToPublished: 'input_circle',
|
|
44
|
+
actionToggleStateToUnpublished: 'unpublished',
|
|
45
|
+
actionDeleteTemplate: 'delete',
|
|
46
|
+
actionDownloadTemplateContent: 'download',
|
|
47
|
+
actionReplaceTemplateContent: 'upload_file',
|
|
48
|
+
toggleRight: 'dock_to_left',
|
|
49
|
+
};
|
|
50
|
+
const APP_ACTIONS = {
|
|
51
|
+
apply: APP_ID + 'action.apply',
|
|
52
|
+
};
|
|
53
|
+
const APP_SCHEMA = {
|
|
54
|
+
id: APP_ID,
|
|
55
|
+
name: 'yuuvis Templates',
|
|
56
|
+
icon: 'library_books',
|
|
57
|
+
types: {},
|
|
58
|
+
flavors: []
|
|
59
|
+
};
|
|
60
|
+
const TEMPLATE_FILE_MIME_TYPE = 'application/vnd.openxmlformats-officedocument.wordprocessingml.document';
|
|
61
|
+
class TemplateObject {
|
|
62
|
+
constructor(obj) {
|
|
63
|
+
this.id = obj.properties[BaseObjectTypeField.OBJECT_ID].value;
|
|
64
|
+
this.name = obj.properties["appTemplates:name"].value;
|
|
65
|
+
this.description = obj.properties["appTemplates:description"]?.value;
|
|
66
|
+
this.published = obj.properties["appTemplates:published"].value;
|
|
67
|
+
this.dataObjectType = obj.properties["appTemplates:dataObjects"].value[0][1];
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
var TemplateManagementEventType;
|
|
71
|
+
(function (TemplateManagementEventType) {
|
|
72
|
+
TemplateManagementEventType["TEMPLATE_OBJECT_CREATED"] = "io.yuuvis.app.templates.object.created";
|
|
73
|
+
TemplateManagementEventType["TEMPLATE_OBJECT_UPDATED"] = "io.yuuvis.app.templates.object.updated";
|
|
74
|
+
TemplateManagementEventType["TEMPLATE_OBJECT_DELETED"] = "io.yuuvis.app.templates.object.deleted";
|
|
75
|
+
})(TemplateManagementEventType || (TemplateManagementEventType = {}));
|
|
76
|
+
|
|
77
|
+
var _a;
|
|
78
|
+
class TemplateService {
|
|
79
|
+
static { this.PAGE_SIZE = 20; }
|
|
80
|
+
#logger;
|
|
81
|
+
#backendService;
|
|
82
|
+
#dmsService;
|
|
83
|
+
#confirmService;
|
|
84
|
+
#translateService;
|
|
85
|
+
#systemService;
|
|
86
|
+
constructor() {
|
|
87
|
+
this.#logger = inject(Logger);
|
|
88
|
+
this.#backendService = inject(BackendService);
|
|
89
|
+
this.#dmsService = inject(DmsService);
|
|
90
|
+
this.#confirmService = inject(ConfirmService);
|
|
91
|
+
this.#translateService = inject(TranslateService);
|
|
92
|
+
this.#systemService = inject(SystemService);
|
|
93
|
+
this.templatesDataSource = new ReplaySubject(1);
|
|
94
|
+
this.templates$ = this.templatesDataSource.asObservable();
|
|
95
|
+
this.busyDataSource = signal(false);
|
|
96
|
+
this.busy$ = this.busyDataSource.asReadonly();
|
|
97
|
+
}
|
|
98
|
+
getAvailableDataObjectTypes() {
|
|
99
|
+
return this.#systemService.getObjectTypes().filter((ot) => !ot.isFolder && ot.contentStreamAllowed !== ContentStreamAllowed.NOT_ALLOWED);
|
|
100
|
+
}
|
|
101
|
+
getPage(page) {
|
|
102
|
+
this.busyDataSource.set(true);
|
|
103
|
+
this.#fetchTemplates(page)
|
|
104
|
+
.subscribe({
|
|
105
|
+
next: (res) => {
|
|
106
|
+
this.templates = res;
|
|
107
|
+
this.templatesDataSource.next(this.templates);
|
|
108
|
+
},
|
|
109
|
+
error: (e) => {
|
|
110
|
+
this.#logger.error('Failed to fetch templates', e);
|
|
111
|
+
},
|
|
112
|
+
})
|
|
113
|
+
.add(() => this.busyDataSource.set(false));
|
|
114
|
+
}
|
|
115
|
+
createTemplate(name, description, dataObjectType) {
|
|
116
|
+
let requestParams = {
|
|
117
|
+
name: name,
|
|
118
|
+
description: description,
|
|
119
|
+
dataObjects: { objectData: dataObjectType },
|
|
120
|
+
};
|
|
121
|
+
return this.#backendService
|
|
122
|
+
.post(`/template-service/api/objects/`, requestParams, ApiBase.none)
|
|
123
|
+
.pipe(catchError((e) => {
|
|
124
|
+
this.#logger.error('Failed to create template', e);
|
|
125
|
+
return throwError(() => new Error(e.message));
|
|
126
|
+
}), map((res) => ({
|
|
127
|
+
id: res.properties[BaseObjectTypeField.OBJECT_ID].value,
|
|
128
|
+
})), tap((res) => this.refreshTemplates()));
|
|
129
|
+
}
|
|
130
|
+
downloadTemplateContent(template) {
|
|
131
|
+
return this.#backendService.download(this.#dmsService.getContentPath(template.id, undefined));
|
|
132
|
+
}
|
|
133
|
+
replaceTemplateContent(template, file) {
|
|
134
|
+
if (file.type != TEMPLATE_FILE_MIME_TYPE) {
|
|
135
|
+
return throwError(() => new Error(this.#translateService.instant('yuv.app.templates.action.replaceContent.error.unsupportedFileType')));
|
|
136
|
+
}
|
|
137
|
+
return this.#dmsService
|
|
138
|
+
.uploadContent(template.id, file)
|
|
139
|
+
.pipe(tap(() => this.refreshTemplates()));
|
|
140
|
+
}
|
|
141
|
+
toggleTemplateState(template) {
|
|
142
|
+
let requestParams = {
|
|
143
|
+
published: !template.published,
|
|
144
|
+
};
|
|
145
|
+
return this.#confirmService
|
|
146
|
+
.confirm(template.published
|
|
147
|
+
? {
|
|
148
|
+
title: this.#translateService.instant('yuv.app.templates.action.unpublish.label'),
|
|
149
|
+
message: this.#translateService.instant('yuv.app.templates.action.unpublish.confirm.message', { template: template.name }),
|
|
150
|
+
}
|
|
151
|
+
: {
|
|
152
|
+
title: this.#translateService.instant('yuv.app.templates.action.publish.label'),
|
|
153
|
+
message: this.#translateService.instant('yuv.app.templates.action.publish.confirm.message', { template: template.name }),
|
|
154
|
+
})
|
|
155
|
+
.pipe(switchMap((confirmed) => {
|
|
156
|
+
if (confirmed) {
|
|
157
|
+
return this.#backendService
|
|
158
|
+
.patch(`/template-service/api/objects/${template.id}`, requestParams, ApiBase.none)
|
|
159
|
+
.pipe(map(() => true), tap(() => this.refreshTemplates()));
|
|
160
|
+
}
|
|
161
|
+
else
|
|
162
|
+
return of(false);
|
|
163
|
+
}));
|
|
164
|
+
}
|
|
165
|
+
deleteTemplate(template) {
|
|
166
|
+
return this.#confirmService
|
|
167
|
+
.confirm({
|
|
168
|
+
title: this.#translateService.instant('yuv.app.templates.action.delete.label'),
|
|
169
|
+
message: template.published
|
|
170
|
+
? this.#translateService.instant('yuv.app.templates.action.delete.public.confirm.message', { template: template.name })
|
|
171
|
+
: this.#translateService.instant('yuv.app.templates.action.delete.confirm.message', { template: template.name }),
|
|
172
|
+
})
|
|
173
|
+
.pipe(switchMap((confirmed) => {
|
|
174
|
+
if (confirmed) {
|
|
175
|
+
return this.#backendService
|
|
176
|
+
.delete(`/dms/objects/${template.id}`, ApiBase.core)
|
|
177
|
+
.pipe(map(() => true), tap(() => this.refreshTemplates()));
|
|
178
|
+
}
|
|
179
|
+
else
|
|
180
|
+
return of(false);
|
|
181
|
+
}));
|
|
182
|
+
}
|
|
183
|
+
refreshTemplates() {
|
|
184
|
+
this.getPage(this.templates?.pageNumber);
|
|
185
|
+
}
|
|
186
|
+
#fetchTemplates(pageNumber = 0) {
|
|
187
|
+
let filterParams = new HttpParams()
|
|
188
|
+
.set('page', pageNumber)
|
|
189
|
+
.set('size', _a.PAGE_SIZE)
|
|
190
|
+
.set('sort', 'name%2Casc');
|
|
191
|
+
return this.#backendService
|
|
192
|
+
.get(`/template-service/api/objects/?${filterParams}`, ApiBase.none)
|
|
193
|
+
.pipe(map((res) => ({
|
|
194
|
+
pageNumber: pageNumber,
|
|
195
|
+
pageSize: _a.PAGE_SIZE,
|
|
196
|
+
totalNumItems: res.totalNumItems,
|
|
197
|
+
items: res.objects.map((obj) => new TemplateObject(obj)),
|
|
198
|
+
})));
|
|
199
|
+
}
|
|
200
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.13", ngImport: i0, type: TemplateService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
201
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.13", ngImport: i0, type: TemplateService, providedIn: 'root' }); }
|
|
202
|
+
}
|
|
203
|
+
_a = TemplateService;
|
|
204
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.13", ngImport: i0, type: TemplateService, decorators: [{
|
|
205
|
+
type: Injectable,
|
|
206
|
+
args: [{
|
|
207
|
+
providedIn: 'root',
|
|
208
|
+
}]
|
|
209
|
+
}], ctorParameters: () => [] });
|
|
210
|
+
|
|
211
|
+
const components$3 = [AppLogoComponent];
|
|
212
|
+
const module = [CommonModule, TranslateModule, RouterModule];
|
|
213
|
+
class YuvTemplatesComponent {
|
|
214
|
+
constructor() {
|
|
215
|
+
this.appName = APP_SCHEMA.name;
|
|
216
|
+
this.appIcon = APP_SCHEMA.icon;
|
|
217
|
+
}
|
|
218
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.13", ngImport: i0, type: YuvTemplatesComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
219
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.13", type: YuvTemplatesComponent, isStandalone: true, selector: "ymtmpl-app-templates", ngImport: i0, template: `
|
|
220
|
+
<header>
|
|
221
|
+
<yuv-app-logo [label]="appName" routerLink="management"></yuv-app-logo>
|
|
222
|
+
</header>
|
|
223
|
+
<main><router-outlet></router-outlet></main>
|
|
224
|
+
`, isInline: true, styles: [":host{display:flex;flex-flow:column;height:100%}:host header{flex:0 0 auto;display:flex;padding-block-end:var(--ymt-spacing-xs)}:host main{flex:1;overflow-y:auto}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: TranslateModule }, { kind: "ngmodule", type: RouterModule }, { kind: "directive", type: i1.RouterOutlet, selector: "router-outlet", inputs: ["name", "routerOutletData"], outputs: ["activate", "deactivate", "attach", "detach"], exportAs: ["outlet"] }, { kind: "directive", type: i1.RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "info", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "routerLink"] }, { kind: "component", type: AppLogoComponent, selector: "yuv-app-logo", inputs: ["icon", "label"] }] }); }
|
|
225
|
+
}
|
|
226
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.13", ngImport: i0, type: YuvTemplatesComponent, decorators: [{
|
|
227
|
+
type: Component,
|
|
228
|
+
args: [{ selector: 'ymtmpl-app-templates', standalone: true, imports: [...module, ...components$3], template: `
|
|
229
|
+
<header>
|
|
230
|
+
<yuv-app-logo [label]="appName" routerLink="management"></yuv-app-logo>
|
|
231
|
+
</header>
|
|
232
|
+
<main><router-outlet></router-outlet></main>
|
|
233
|
+
`, styles: [":host{display:flex;flex-flow:column;height:100%}:host header{flex:0 0 auto;display:flex;padding-block-end:var(--ymt-spacing-xs)}:host main{flex:1;overflow-y:auto}\n"] }]
|
|
234
|
+
}] });
|
|
235
|
+
|
|
236
|
+
const components$2 = [
|
|
237
|
+
ObjectPreviewComponent
|
|
238
|
+
];
|
|
239
|
+
const modules$2 = [
|
|
240
|
+
CommonModule
|
|
241
|
+
];
|
|
242
|
+
class TemplateDetailsComponent {
|
|
243
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.13", ngImport: i0, type: TemplateDetailsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
244
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.13", type: TemplateDetailsComponent, isStandalone: true, selector: "ymtmpl-template-details", inputs: { templateObject: "templateObject" }, ngImport: i0, template: "<yuv-object-preview [objectId]=\"templateObject.id\"></yuv-object-preview>", styles: [":host{display:flex;flex-flow:column;height:100%;overflow:hidden}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "component", type: ObjectPreviewComponent, selector: "yuv-object-preview", inputs: ["objectId", "dmsObject", "version"] }] }); }
|
|
245
|
+
}
|
|
246
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.13", ngImport: i0, type: TemplateDetailsComponent, decorators: [{
|
|
247
|
+
type: Component,
|
|
248
|
+
args: [{ selector: 'ymtmpl-template-details', standalone: true, imports: [...modules$2, ...components$2], template: "<yuv-object-preview [objectId]=\"templateObject.id\"></yuv-object-preview>", styles: [":host{display:flex;flex-flow:column;height:100%;overflow:hidden}\n"] }]
|
|
249
|
+
}], propDecorators: { templateObject: [{
|
|
250
|
+
type: Input
|
|
251
|
+
}] } });
|
|
252
|
+
|
|
253
|
+
const components$1 = [BusyOverlayDirective, StringComponent, YmtButtonDirective, DialogComponent];
|
|
254
|
+
const modules$1 = [
|
|
255
|
+
CommonModule,
|
|
256
|
+
ReactiveFormsModule,
|
|
257
|
+
TranslateModule,
|
|
258
|
+
MatFormFieldModule,
|
|
259
|
+
MatSelectModule
|
|
260
|
+
];
|
|
261
|
+
class CreateTemplateComponent {
|
|
262
|
+
#fb;
|
|
263
|
+
#templateService;
|
|
264
|
+
#dialogRef;
|
|
265
|
+
constructor() {
|
|
266
|
+
this.#fb = inject(FormBuilder);
|
|
267
|
+
this.#templateService = inject(TemplateService);
|
|
268
|
+
this.#dialogRef = inject((MatDialogRef));
|
|
269
|
+
this.busy = signal(false);
|
|
270
|
+
this.error = signal(undefined);
|
|
271
|
+
this.form = this.#fb.group({
|
|
272
|
+
name: ['New template', Validators.required],
|
|
273
|
+
description: [''],
|
|
274
|
+
dataObjectType: ['system:document', Validators.required]
|
|
275
|
+
});
|
|
276
|
+
this.dataObjectTypes = signal([]);
|
|
277
|
+
this.changedInput = signal(undefined);
|
|
278
|
+
this.disabledSubmit = linkedSignal({
|
|
279
|
+
source: this.changedInput,
|
|
280
|
+
computation: () => {
|
|
281
|
+
return this.busy() || this.form.invalid || !this.form.value.name;
|
|
282
|
+
}
|
|
283
|
+
});
|
|
284
|
+
this.#loadDataObjectTypes();
|
|
285
|
+
}
|
|
286
|
+
#loadDataObjectTypes() {
|
|
287
|
+
this.dataObjectTypes.set(this.#templateService.getAvailableDataObjectTypes().sort((ot1, ot2) => ot1.id > ot2.id ? 1 : -1));
|
|
288
|
+
}
|
|
289
|
+
createTemplate() {
|
|
290
|
+
let createParams = this.form.value;
|
|
291
|
+
this.busy.set(true);
|
|
292
|
+
this.error.set(undefined);
|
|
293
|
+
this.#templateService
|
|
294
|
+
.createTemplate(createParams.name, createParams.description, createParams.dataObjectType)
|
|
295
|
+
.subscribe({
|
|
296
|
+
error: (e) => {
|
|
297
|
+
this.error.set(e);
|
|
298
|
+
this.busy.set(false);
|
|
299
|
+
},
|
|
300
|
+
complete: () => {
|
|
301
|
+
this.close();
|
|
302
|
+
},
|
|
303
|
+
});
|
|
304
|
+
}
|
|
305
|
+
close() {
|
|
306
|
+
this.#dialogRef.close();
|
|
307
|
+
}
|
|
308
|
+
ngAfterViewInit() {
|
|
309
|
+
this.form.valueChanges.subscribe((value) => {
|
|
310
|
+
this.changedInput.set(value);
|
|
311
|
+
});
|
|
312
|
+
}
|
|
313
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.13", ngImport: i0, type: CreateTemplateComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
314
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.13", type: CreateTemplateComponent, isStandalone: true, selector: "ymtmpl-create-template", host: { properties: { "class.busy": "!busy()" } }, ngImport: i0, template: "<yuv-dialog [yuvBusyOverlay]=\"busy()\" [headertitel]=\"'yuv.app.templates.action.create.headline' | translate\">\n <main>\n <form [formGroup]=\"form\">\n <mat-form-field class=\"yuv-form-field\">\n <mat-label>{{\"yuv.app.templates.object.property.name\" | translate }}</mat-label>\n <yuv-string [required]=\"true\" formControlName=\"name\"></yuv-string>\n </mat-form-field>\n <mat-form-field class=\"yuv-form-field\">\n <mat-label>{{\"yuv.app.templates.object.property.description\" | translate}}</mat-label>\n <yuv-string formControlName=\"description\"></yuv-string>\n </mat-form-field>\n <mat-form-field class=\"yuv-form-field\">\n <mat-label>{{\"yuv.app.templates.object.property.dataObjectType\" | translate}}</mat-label>\n <mat-select formControlName=\"dataObjectType\">\n @for (dataObjectType of dataObjectTypes(); track dataObjectType) {\n <mat-option [value]=\"dataObjectType.id\">{{ dataObjectType.id }}</mat-option>\n }\n </mat-select>\n </mat-form-field>\n @if (error()) {\n <p class=\"error\">{{ error() }}</p>\n }\n </form>\n </main>\n <footer>\n <button ymtButton=\"secondary\" [disabled]=\"busy()\" (click)=\"close()\">\n {{ \"yuv.app.templates.action.create.button.cancel\" | translate }}\n </button>\n <button ymtButton=\"primary\" [disabled]=\"disabledSubmit()\" (click)=\"createTemplate()\">\n {{ 'yuv.object-flavor.apply-flavor.button.apply' | translate }}\n </button>\n </footer>\n</yuv-dialog>\n", styles: [":host{display:block;position:relative}:host mat-form-field{width:100%}:host main form{padding:var(--ymt-spacing-m)}:host main form mat-form-field{width:100%}:host main form .error{color:var(--ymt-on-danger-container);background-color:var(--ymt-danger-container);padding:var(--ymt-spacing-m);border-radius:var(--ymt-corner-xs)}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1$1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1$1.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i1$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1$1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "ngmodule", type: TranslateModule }, { kind: "pipe", type: i2.TranslatePipe, name: "translate" }, { kind: "ngmodule", type: MatFormFieldModule }, { kind: "component", type: i3.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i3.MatLabel, selector: "mat-label" }, { kind: "ngmodule", type: MatSelectModule }, { kind: "component", type: i4.MatSelect, selector: "mat-select", inputs: ["aria-describedby", "panelClass", "disabled", "disableRipple", "tabIndex", "hideSingleSelectionIndicator", "placeholder", "required", "multiple", "disableOptionCentering", "compareWith", "value", "aria-label", "aria-labelledby", "errorStateMatcher", "typeaheadDebounceInterval", "sortComparator", "id", "panelWidth", "canSelectNullableOptions"], outputs: ["openedChange", "opened", "closed", "selectionChange", "valueChange"], exportAs: ["matSelect"] }, { kind: "component", type: i4.MatOption, selector: "mat-option", inputs: ["value", "id", "disabled"], outputs: ["onSelectionChange"], exportAs: ["matOption"] }, { kind: "directive", type: BusyOverlayDirective, selector: "[yuvBusyOverlay]", inputs: ["yuvBusyOverlay"] }, { kind: "component", type: StringComponent, selector: "yuv-string", inputs: ["multiselect", "rows", "readonly", "autofocus", "classifications", "situation", "regex", "minLength", "maxLength"] }, { kind: "directive", type: YmtButtonDirective, selector: "button[ymtButton], a[ymtButton]", inputs: ["ymtButton", "disabled", "aria-disabled", "disableRipple", "disabledInteractive", "button-size"] }, { kind: "component", type: DialogComponent, selector: "yuv-dialog", inputs: ["headertitel"] }] }); }
|
|
315
|
+
}
|
|
316
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.13", ngImport: i0, type: CreateTemplateComponent, decorators: [{
|
|
317
|
+
type: Component,
|
|
318
|
+
args: [{ selector: 'ymtmpl-create-template', standalone: true, imports: [...modules$1, ...components$1], host: {
|
|
319
|
+
'[class.busy]': '!busy()',
|
|
320
|
+
}, template: "<yuv-dialog [yuvBusyOverlay]=\"busy()\" [headertitel]=\"'yuv.app.templates.action.create.headline' | translate\">\n <main>\n <form [formGroup]=\"form\">\n <mat-form-field class=\"yuv-form-field\">\n <mat-label>{{\"yuv.app.templates.object.property.name\" | translate }}</mat-label>\n <yuv-string [required]=\"true\" formControlName=\"name\"></yuv-string>\n </mat-form-field>\n <mat-form-field class=\"yuv-form-field\">\n <mat-label>{{\"yuv.app.templates.object.property.description\" | translate}}</mat-label>\n <yuv-string formControlName=\"description\"></yuv-string>\n </mat-form-field>\n <mat-form-field class=\"yuv-form-field\">\n <mat-label>{{\"yuv.app.templates.object.property.dataObjectType\" | translate}}</mat-label>\n <mat-select formControlName=\"dataObjectType\">\n @for (dataObjectType of dataObjectTypes(); track dataObjectType) {\n <mat-option [value]=\"dataObjectType.id\">{{ dataObjectType.id }}</mat-option>\n }\n </mat-select>\n </mat-form-field>\n @if (error()) {\n <p class=\"error\">{{ error() }}</p>\n }\n </form>\n </main>\n <footer>\n <button ymtButton=\"secondary\" [disabled]=\"busy()\" (click)=\"close()\">\n {{ \"yuv.app.templates.action.create.button.cancel\" | translate }}\n </button>\n <button ymtButton=\"primary\" [disabled]=\"disabledSubmit()\" (click)=\"createTemplate()\">\n {{ 'yuv.object-flavor.apply-flavor.button.apply' | translate }}\n </button>\n </footer>\n</yuv-dialog>\n", styles: [":host{display:block;position:relative}:host mat-form-field{width:100%}:host main form{padding:var(--ymt-spacing-m)}:host main form mat-form-field{width:100%}:host main form .error{color:var(--ymt-on-danger-container);background-color:var(--ymt-danger-container);padding:var(--ymt-spacing-m);border-radius:var(--ymt-corner-xs)}\n"] }]
|
|
321
|
+
}], ctorParameters: () => [] });
|
|
322
|
+
|
|
323
|
+
const components = [
|
|
324
|
+
ListComponent,
|
|
325
|
+
ListItemDirective,
|
|
326
|
+
PaginationComponent,
|
|
327
|
+
TemplateDetailsComponent,
|
|
328
|
+
];
|
|
329
|
+
const modules = [
|
|
330
|
+
CommonModule,
|
|
331
|
+
TranslateModule,
|
|
332
|
+
RouterModule,
|
|
333
|
+
YuvOverflowMenuModule,
|
|
334
|
+
YuvMasterDetailsModule,
|
|
335
|
+
MatIconModule,
|
|
336
|
+
MatButtonModule,
|
|
337
|
+
MatTooltipModule,
|
|
338
|
+
];
|
|
339
|
+
class TemplateManagementComponent {
|
|
340
|
+
#logger;
|
|
341
|
+
#document;
|
|
342
|
+
#deviceService;
|
|
343
|
+
#notificationService;
|
|
344
|
+
#dialog;
|
|
345
|
+
#templateService;
|
|
346
|
+
#translateService;
|
|
347
|
+
#templates;
|
|
348
|
+
constructor() {
|
|
349
|
+
this.layoutSettingsID = 'template-management.layout.settings';
|
|
350
|
+
this.#logger = inject(Logger);
|
|
351
|
+
this.#document = inject(DOCUMENT);
|
|
352
|
+
this.#deviceService = inject(DeviceService);
|
|
353
|
+
this.#notificationService = inject(NotificationService);
|
|
354
|
+
this.#dialog = inject(MatDialog);
|
|
355
|
+
this.#templateService = inject(TemplateService);
|
|
356
|
+
this.#translateService = inject(TranslateService);
|
|
357
|
+
this.busy = this.#templateService.busy$;
|
|
358
|
+
this.icons = {
|
|
359
|
+
...APP_ICONS,
|
|
360
|
+
};
|
|
361
|
+
this.selectedTemplate = signal(undefined);
|
|
362
|
+
this.smallScreenLayout = signal(false);
|
|
363
|
+
this.layoutOptions = signal({
|
|
364
|
+
masterSize: 40,
|
|
365
|
+
detailsSize: 60,
|
|
366
|
+
});
|
|
367
|
+
this.actions = [];
|
|
368
|
+
this.#templates = [];
|
|
369
|
+
this.templates$ = this.#templateService.templates$.pipe(tap((response) => {
|
|
370
|
+
this.#templates = response.items;
|
|
371
|
+
const selectedTemplate = this.selectedTemplate();
|
|
372
|
+
if (selectedTemplate) {
|
|
373
|
+
// check if the selected template is still in the list
|
|
374
|
+
const found = this.#templates.find((t) => t.id === selectedTemplate.id);
|
|
375
|
+
if (found) {
|
|
376
|
+
// update the selected template instance and the actions
|
|
377
|
+
this.selectedTemplate.set(found);
|
|
378
|
+
this.#updateActions(this.selectedTemplate());
|
|
379
|
+
}
|
|
380
|
+
// if not, set selected template to undefined
|
|
381
|
+
else
|
|
382
|
+
this.selectedTemplate.set(undefined);
|
|
383
|
+
}
|
|
384
|
+
this.pagination =
|
|
385
|
+
response && response.totalNumItems > response.pageSize
|
|
386
|
+
? {
|
|
387
|
+
total: response.totalNumItems,
|
|
388
|
+
page: response.pageNumber + 1,
|
|
389
|
+
pages: Math.ceil(response.totalNumItems / response.pageSize),
|
|
390
|
+
}
|
|
391
|
+
: undefined;
|
|
392
|
+
}));
|
|
393
|
+
this.templateListComponent = viewChild.required(ListComponent);
|
|
394
|
+
this.enableDetails = signal(true);
|
|
395
|
+
this.#deviceService.screenChange$
|
|
396
|
+
.pipe(takeUntilDestroyed())
|
|
397
|
+
.subscribe((s) => {
|
|
398
|
+
this.smallScreenLayout.set(s.size === 's' && s.orientation === 'portrait');
|
|
399
|
+
});
|
|
400
|
+
}
|
|
401
|
+
#updateActions(obj) {
|
|
402
|
+
this.actions = obj
|
|
403
|
+
? [
|
|
404
|
+
{
|
|
405
|
+
id: 'yuv.app.templates.action.replaceContent',
|
|
406
|
+
icon: APP_ICONS.actionReplaceTemplateContent,
|
|
407
|
+
label: this.#translateService.instant('yuv.app.templates.action.replaceContent.label'),
|
|
408
|
+
callback: () => this.replaceCurrentContent(),
|
|
409
|
+
},
|
|
410
|
+
{
|
|
411
|
+
id: 'yuv.app.templates.action.downloadContent',
|
|
412
|
+
icon: APP_ICONS.actionDownloadTemplateContent,
|
|
413
|
+
label: this.#translateService.instant('yuv.app.templates.action.downloadContent.label'),
|
|
414
|
+
callback: () => this.downloadCurrentContent(),
|
|
415
|
+
},
|
|
416
|
+
{
|
|
417
|
+
id: 'yuv.app.templates.action.delete',
|
|
418
|
+
icon: APP_ICONS.actionDeleteTemplate,
|
|
419
|
+
label: this.#translateService.instant('yuv.app.templates.action.delete.label'),
|
|
420
|
+
callback: () => this.deleteCurrent(),
|
|
421
|
+
},
|
|
422
|
+
{
|
|
423
|
+
id: 'yuv.app.templates.action.toggleState',
|
|
424
|
+
icon: this.selectedTemplate()?.published
|
|
425
|
+
? APP_ICONS.actionToggleStateToUnpublished
|
|
426
|
+
: APP_ICONS.actionToggleStateToPublished,
|
|
427
|
+
label: this.#translateService.instant(this.selectedTemplate()?.published
|
|
428
|
+
? 'yuv.app.templates.action.unpublish.label'
|
|
429
|
+
: 'yuv.app.templates.action.publish.label'),
|
|
430
|
+
callback: () => this.toggleCurrentState(),
|
|
431
|
+
},
|
|
432
|
+
]
|
|
433
|
+
: [];
|
|
434
|
+
}
|
|
435
|
+
createNewTemplate() {
|
|
436
|
+
this.#logger.debug('Create new template ...');
|
|
437
|
+
this.#dialog.open(CreateTemplateComponent, {
|
|
438
|
+
width: '400px',
|
|
439
|
+
maxWidth: '90vw',
|
|
440
|
+
});
|
|
441
|
+
}
|
|
442
|
+
downloadCurrentContent() {
|
|
443
|
+
const template = this.selectedTemplate();
|
|
444
|
+
if (template) {
|
|
445
|
+
this.#templateService.downloadTemplateContent(template);
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
replaceCurrentContent() {
|
|
449
|
+
const template = this.selectedTemplate();
|
|
450
|
+
if (template) {
|
|
451
|
+
this.#logger.debug('Replace content of template ' + template.id + ' ...');
|
|
452
|
+
const fileInput = this.#document.createElement('input');
|
|
453
|
+
fileInput.type = 'file';
|
|
454
|
+
fileInput.multiple = false;
|
|
455
|
+
fileInput.accept = TEMPLATE_FILE_MIME_TYPE;
|
|
456
|
+
fileInput.onchange = (e) => {
|
|
457
|
+
const file = e.target.files?.[0];
|
|
458
|
+
if (file) {
|
|
459
|
+
this.#templateService
|
|
460
|
+
.replaceTemplateContent(template, file)
|
|
461
|
+
.subscribe({
|
|
462
|
+
next: () => {
|
|
463
|
+
this.#notificationService.success(this.#translateService.instant('yuv.app.templates.action.replaceContent.success'));
|
|
464
|
+
},
|
|
465
|
+
error: (err) => {
|
|
466
|
+
this.#notificationService.error(err);
|
|
467
|
+
},
|
|
468
|
+
complete: () => {
|
|
469
|
+
this.#logger.debug('Template content replaced!');
|
|
470
|
+
},
|
|
471
|
+
});
|
|
472
|
+
}
|
|
473
|
+
};
|
|
474
|
+
fileInput.click();
|
|
475
|
+
fileInput.remove();
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
toggleCurrentState() {
|
|
479
|
+
const template = this.selectedTemplate();
|
|
480
|
+
if (template) {
|
|
481
|
+
this.#templateService
|
|
482
|
+
.toggleTemplateState(template)
|
|
483
|
+
.subscribe((res) => {
|
|
484
|
+
if (res) {
|
|
485
|
+
this.#logger.info('Template published state chenged!');
|
|
486
|
+
this.#updateActions(template);
|
|
487
|
+
}
|
|
488
|
+
});
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
deleteCurrent() {
|
|
492
|
+
const template = this.selectedTemplate();
|
|
493
|
+
if (template) {
|
|
494
|
+
this.#logger.debug('Delete template ' + template.id + ' ...');
|
|
495
|
+
this.#templateService.deleteTemplate(template).subscribe((res) => {
|
|
496
|
+
if (res) {
|
|
497
|
+
this.#logger.debug('Template deleted!');
|
|
498
|
+
}
|
|
499
|
+
});
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
goToPage(pageNumber) {
|
|
503
|
+
this.#templateService.getPage(pageNumber - 1);
|
|
504
|
+
}
|
|
505
|
+
onItemSelect(idx) {
|
|
506
|
+
const item = this.#templates[idx[0]];
|
|
507
|
+
if (item.id === this.selectedTemplate()?.id)
|
|
508
|
+
return;
|
|
509
|
+
this.selectedTemplate.set(item);
|
|
510
|
+
this.#updateActions(this.selectedTemplate());
|
|
511
|
+
}
|
|
512
|
+
ngOnInit() {
|
|
513
|
+
this.#templateService.refreshTemplates();
|
|
514
|
+
}
|
|
515
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.13", ngImport: i0, type: TemplateManagementComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
516
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.13", type: TemplateManagementComponent, isStandalone: true, selector: "ymtmpl-templates-management", host: { attributes: { "class.smallScreen": "smallScreenLayout()" }, properties: { "class.pagination": "this.pagination" } }, viewQueries: [{ propertyName: "templateListComponent", first: true, predicate: ListComponent, descendants: true, isSignal: true }], ngImport: i0, template: "<header>\n <nav [attr.aria-label]=\"'yuv.app.templates.naviagtion.aria.label' | translate\">\n <div class=\"primary-actions\">\n <button mat-mini-fab (click)=\"createNewTemplate()\" [matTooltip]=\"'yuv.app.templates.action.create.label' | translate\">\n <mat-icon>{{icons.actionCreateNewTemplate}}</mat-icon> \n </button>\n </div>\n <div class=\"template-actions\">\n <yuv-overflow-menu [menuItems]=\"actions\"></yuv-overflow-menu>\n </div>\n <div class=\"secondary-actions\">\n @if (!smallScreenLayout()) {\n <button mat-icon-button [ngClass]=\"{ enabled: enableDetails() }\" title=\"{{ 'yuv.app.templates.toggledetails.tooltip' | translate }}\" (click)=\"enableDetails.set(!enableDetails())\">\n <mat-icon>{{icons.toggleRight}}</mat-icon>\n </button>\n }\n </div>\n </nav>\n</header>\n\n<yuv-master-details\n [gutterSize]=\"1\"\n [detailsActive]=\"smallScreenLayout() ? !!selectedTemplate() : enableDetails()\"\n [layoutOptions]=\"layoutOptions()\"\n [layoutSettingsID]=\"layoutSettingsID\">\n \n <ng-template #yuvMasterPane>\n @let templateObjects = (templates$ | async)?.items;\n @if (templateObjects?.length) {\n <yuv-list (itemSelect)=\"onItemSelect($event)\">\n @for (t of templateObjects; track t.id) {\n <div class=\"item\" [ngClass]=\"[t.published ? 'public' : '']\" yuvListItem [style.--i]=\"$index\">\n <mat-icon class=\"icon\">{{t.published ? 'export_notes' : 'article'}}</mat-icon>\n <div class=\"name\">{{ t.name }}</div>\n <div class=\"description\">{{ t.description }}</div>\n <div class=\"id\">{{ t.id.toUpperCase( ) }}</div>\n <div class=\"dataObjectType\">{{ t.dataObjectType }}</div> \n </div>\n }\n </yuv-list>\n @if (pagination) { <yuv-pagination [pagination]=\"pagination\" (pageChange)=\"goToPage($event)\"></yuv-pagination> }\n } @else {\n <div class=\"empty\">\n <p>{{ 'yuv.app.templates.list.empty' | translate }}</p>\n </div>\n }\n </ng-template>\n\n <ng-template #yuvDetailsPane>\n @let templateObject = selectedTemplate();\n @if (templateObject) {\n <div class=\"details\">\n @if (smallScreenLayout()) {\n <div class=\"toolbar\">\n <button (click)=\"selectedTemplate.set(undefined)\"> \n <mat-icon>{{icons.close}}</mat-icon> \n </button>\n </div>\n }\n <ymtmpl-template-details [templateObject]=\"templateObject\"></ymtmpl-template-details>\n </div>\n } @else {\n <div class=\"empty nothing-selected\">\n <h2>{{ 'yuv.app.templates.list.selection.empty' | translate }}</h2>\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M14 2H6C4.89 2 4 2.9 4 4V20C4 21.11 4.89 22 6 22H18C19.11 22 20 21.11 20 20V8L14 2M18 20H6V4H13V9H18V20M17.35 10L15.25 19H13.85L12.05 12.21L10.25 19H8.85L6.65 10H8.15L9.55 16.81L11.35 10H12.65L14.45 16.81L15.85 10H17.35Z\" /></svg>\n </div>\n }\n </ng-template>\n\n</yuv-master-details>\n\n<router-outlet name=\"modal\"></router-outlet>", styles: [":host{--split-gutter-background-color: var(--ymt-outline-variant);display:flex;height:100%;overflow:hidden;flex-flow:column;box-sizing:border-box}:host header{flex:0 0 auto}:host header>nav{flex:0 0 auto;display:grid;grid-template-columns:auto 1fr auto;grid-template-areas:\"primary actions sort secondary\";align-items:center;gap:var(--ymt-spacing-s);border-block-end:1px solid var(--ymt-outline-variant);position:relative;padding:var(--ymt-spacing-xs) var(--ymt-spacing-s)}:host header>nav .primary-actions{grid-area:primary;overflow-x:auto}:host header>nav .secondary-actions{grid-area:secondary;overflow-x:auto}:host header>nav .template-actions{grid-area:actions;align-self:stretch;overflow-x:auto;border-color:var(--ymt-outline-variant);border-width:0 1px 0 1px;border-style:solid;display:grid;grid-template-rows:1fr;grid-template-columns:1fr;align-items:center}:host yuv-master-details{flex:1;box-sizing:border-box;overflow:hidden;background-color:var(--ymt-surface)}:host yuv-master-details yuv-list{flex:1}:host yuv-master-details yuv-list [yuvListItem]{--icon-size: 32px;--list-item-hover-background: var(--ymt-focus-background);display:grid;padding:var(--ymt-spacing-s) var(--ymt-spacing-m);border-block-end:1px solid var(--ymt-outline-variant);grid-template-columns:var(--icon-size) 1fr auto;grid-template-rows:repeat(2,auto);grid-template-areas:\"icon name name\" \"icon description description\" \"icon id dataObjectType\";align-items:center;column-gap:var(--ymt-spacing-m);row-gap:var(--ymt-spacing-2xs);cursor:pointer}:host yuv-master-details yuv-list [yuvListItem] .icon{grid-area:icon;color:var(--ymt-text-color-subtle)}:host yuv-master-details yuv-list [yuvListItem] .id{grid-area:id;color:var(--ymt-text-color-subtle);font:var(--ymt-font-body-subtle)}:host yuv-master-details yuv-list [yuvListItem] .name{grid-area:name;color:var(--ymt-text-color-body);font:var(--ymt-font-body)}:host yuv-master-details yuv-list [yuvListItem] .description{grid-area:description;color:var(--ymt-text-color-subtle);font:var(--ymt-font-body)}:host yuv-master-details yuv-list [yuvListItem] .dataObjectType{grid-area:dataObjectType;color:var(--ymt-text-color-subtle);font:var(--ymt-font-body-subtle)}:host yuv-master-details yuv-list [yuvListItem]:not(:last-child){border-block-end:1px solid var(--ymt-outline-variant)}:host yuv-master-details yuv-pagination{flex:0 0 auto;border-block-start:1px solid var(--ymt-outline-variant)}:host yuv-master-details .details{display:flex;flex-flow:column-reverse;height:100%;gap:var(--ymt-spacing-xxs);background-color:var(--ymt-surface)}:host yuv-master-details .details .toolbar{flex:0 0 auto}:host yuv-master-details .details ymtmpl-template-details{height:100%}:host yuv-master-details .empty.nothing-selected{display:flex;flex-flow:column;justify-content:center;align-items:center;height:100%;margin:0}:host yuv-master-details .empty.nothing-selected svg{width:150px;height:150px;opacity:.5;fill:var(--ymt-text-color-subtle)}:host.smallScreen{--border-radius: 0}:host.smallScreen yuv-master-details{padding:0}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1$2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "pipe", type: i1$2.AsyncPipe, name: "async" }, { kind: "ngmodule", type: TranslateModule }, { kind: "pipe", type: i2.TranslatePipe, name: "translate" }, { kind: "ngmodule", type: RouterModule }, { kind: "directive", type: i1.RouterOutlet, selector: "router-outlet", inputs: ["name", "routerOutletData"], outputs: ["activate", "deactivate", "attach", "detach"], exportAs: ["outlet"] }, { kind: "ngmodule", type: YuvOverflowMenuModule }, { kind: "component", type: i4$1.OverflowMenuComponent, selector: "yuv-overflow-menu", inputs: ["overflowIcon", "groupLabels", "menuItems"] }, { kind: "ngmodule", type: YuvMasterDetailsModule }, { kind: "component", type: i5.YuvMasterDetailsComponent, selector: "yuv-master-details", inputs: ["detailsActive", "layoutSettingsID", "layoutOptions", "undockableDetails", "panelStyle", "gutterSize", "mode"], outputs: ["detailsActiveChange"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i6.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i7.MatIconButton, selector: "button[mat-icon-button]", exportAs: ["matButton"] }, { kind: "component", type: i7.MatMiniFabButton, selector: "button[mat-mini-fab]", exportAs: ["matButton"] }, { kind: "ngmodule", type: MatTooltipModule }, { kind: "directive", type: i8.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "component", type: ListComponent, selector: "yuv-list", inputs: ["multiselect", "selfHandleSelection", "disableSelection"], outputs: ["itemSelect", "itemFocus"] }, { kind: "directive", type: ListItemDirective, selector: "[yuvListItem]", inputs: ["disabled", "active", "selected"] }, { kind: "component", type: PaginationComponent, selector: "yuv-pagination", inputs: ["pagination"], outputs: ["pageChange"] }, { kind: "component", type: TemplateDetailsComponent, selector: "ymtmpl-template-details", inputs: ["templateObject"] }] }); }
|
|
517
|
+
}
|
|
518
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.13", ngImport: i0, type: TemplateManagementComponent, decorators: [{
|
|
519
|
+
type: Component,
|
|
520
|
+
args: [{ selector: 'ymtmpl-templates-management', standalone: true, imports: [...modules, ...components], host: {
|
|
521
|
+
'class.smallScreen': 'smallScreenLayout()',
|
|
522
|
+
}, template: "<header>\n <nav [attr.aria-label]=\"'yuv.app.templates.naviagtion.aria.label' | translate\">\n <div class=\"primary-actions\">\n <button mat-mini-fab (click)=\"createNewTemplate()\" [matTooltip]=\"'yuv.app.templates.action.create.label' | translate\">\n <mat-icon>{{icons.actionCreateNewTemplate}}</mat-icon> \n </button>\n </div>\n <div class=\"template-actions\">\n <yuv-overflow-menu [menuItems]=\"actions\"></yuv-overflow-menu>\n </div>\n <div class=\"secondary-actions\">\n @if (!smallScreenLayout()) {\n <button mat-icon-button [ngClass]=\"{ enabled: enableDetails() }\" title=\"{{ 'yuv.app.templates.toggledetails.tooltip' | translate }}\" (click)=\"enableDetails.set(!enableDetails())\">\n <mat-icon>{{icons.toggleRight}}</mat-icon>\n </button>\n }\n </div>\n </nav>\n</header>\n\n<yuv-master-details\n [gutterSize]=\"1\"\n [detailsActive]=\"smallScreenLayout() ? !!selectedTemplate() : enableDetails()\"\n [layoutOptions]=\"layoutOptions()\"\n [layoutSettingsID]=\"layoutSettingsID\">\n \n <ng-template #yuvMasterPane>\n @let templateObjects = (templates$ | async)?.items;\n @if (templateObjects?.length) {\n <yuv-list (itemSelect)=\"onItemSelect($event)\">\n @for (t of templateObjects; track t.id) {\n <div class=\"item\" [ngClass]=\"[t.published ? 'public' : '']\" yuvListItem [style.--i]=\"$index\">\n <mat-icon class=\"icon\">{{t.published ? 'export_notes' : 'article'}}</mat-icon>\n <div class=\"name\">{{ t.name }}</div>\n <div class=\"description\">{{ t.description }}</div>\n <div class=\"id\">{{ t.id.toUpperCase( ) }}</div>\n <div class=\"dataObjectType\">{{ t.dataObjectType }}</div> \n </div>\n }\n </yuv-list>\n @if (pagination) { <yuv-pagination [pagination]=\"pagination\" (pageChange)=\"goToPage($event)\"></yuv-pagination> }\n } @else {\n <div class=\"empty\">\n <p>{{ 'yuv.app.templates.list.empty' | translate }}</p>\n </div>\n }\n </ng-template>\n\n <ng-template #yuvDetailsPane>\n @let templateObject = selectedTemplate();\n @if (templateObject) {\n <div class=\"details\">\n @if (smallScreenLayout()) {\n <div class=\"toolbar\">\n <button (click)=\"selectedTemplate.set(undefined)\"> \n <mat-icon>{{icons.close}}</mat-icon> \n </button>\n </div>\n }\n <ymtmpl-template-details [templateObject]=\"templateObject\"></ymtmpl-template-details>\n </div>\n } @else {\n <div class=\"empty nothing-selected\">\n <h2>{{ 'yuv.app.templates.list.selection.empty' | translate }}</h2>\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M14 2H6C4.89 2 4 2.9 4 4V20C4 21.11 4.89 22 6 22H18C19.11 22 20 21.11 20 20V8L14 2M18 20H6V4H13V9H18V20M17.35 10L15.25 19H13.85L12.05 12.21L10.25 19H8.85L6.65 10H8.15L9.55 16.81L11.35 10H12.65L14.45 16.81L15.85 10H17.35Z\" /></svg>\n </div>\n }\n </ng-template>\n\n</yuv-master-details>\n\n<router-outlet name=\"modal\"></router-outlet>", styles: [":host{--split-gutter-background-color: var(--ymt-outline-variant);display:flex;height:100%;overflow:hidden;flex-flow:column;box-sizing:border-box}:host header{flex:0 0 auto}:host header>nav{flex:0 0 auto;display:grid;grid-template-columns:auto 1fr auto;grid-template-areas:\"primary actions sort secondary\";align-items:center;gap:var(--ymt-spacing-s);border-block-end:1px solid var(--ymt-outline-variant);position:relative;padding:var(--ymt-spacing-xs) var(--ymt-spacing-s)}:host header>nav .primary-actions{grid-area:primary;overflow-x:auto}:host header>nav .secondary-actions{grid-area:secondary;overflow-x:auto}:host header>nav .template-actions{grid-area:actions;align-self:stretch;overflow-x:auto;border-color:var(--ymt-outline-variant);border-width:0 1px 0 1px;border-style:solid;display:grid;grid-template-rows:1fr;grid-template-columns:1fr;align-items:center}:host yuv-master-details{flex:1;box-sizing:border-box;overflow:hidden;background-color:var(--ymt-surface)}:host yuv-master-details yuv-list{flex:1}:host yuv-master-details yuv-list [yuvListItem]{--icon-size: 32px;--list-item-hover-background: var(--ymt-focus-background);display:grid;padding:var(--ymt-spacing-s) var(--ymt-spacing-m);border-block-end:1px solid var(--ymt-outline-variant);grid-template-columns:var(--icon-size) 1fr auto;grid-template-rows:repeat(2,auto);grid-template-areas:\"icon name name\" \"icon description description\" \"icon id dataObjectType\";align-items:center;column-gap:var(--ymt-spacing-m);row-gap:var(--ymt-spacing-2xs);cursor:pointer}:host yuv-master-details yuv-list [yuvListItem] .icon{grid-area:icon;color:var(--ymt-text-color-subtle)}:host yuv-master-details yuv-list [yuvListItem] .id{grid-area:id;color:var(--ymt-text-color-subtle);font:var(--ymt-font-body-subtle)}:host yuv-master-details yuv-list [yuvListItem] .name{grid-area:name;color:var(--ymt-text-color-body);font:var(--ymt-font-body)}:host yuv-master-details yuv-list [yuvListItem] .description{grid-area:description;color:var(--ymt-text-color-subtle);font:var(--ymt-font-body)}:host yuv-master-details yuv-list [yuvListItem] .dataObjectType{grid-area:dataObjectType;color:var(--ymt-text-color-subtle);font:var(--ymt-font-body-subtle)}:host yuv-master-details yuv-list [yuvListItem]:not(:last-child){border-block-end:1px solid var(--ymt-outline-variant)}:host yuv-master-details yuv-pagination{flex:0 0 auto;border-block-start:1px solid var(--ymt-outline-variant)}:host yuv-master-details .details{display:flex;flex-flow:column-reverse;height:100%;gap:var(--ymt-spacing-xxs);background-color:var(--ymt-surface)}:host yuv-master-details .details .toolbar{flex:0 0 auto}:host yuv-master-details .details ymtmpl-template-details{height:100%}:host yuv-master-details .empty.nothing-selected{display:flex;flex-flow:column;justify-content:center;align-items:center;height:100%;margin:0}:host yuv-master-details .empty.nothing-selected svg{width:150px;height:150px;opacity:.5;fill:var(--ymt-text-color-subtle)}:host.smallScreen{--border-radius: 0}:host.smallScreen yuv-master-details{padding:0}\n"] }]
|
|
523
|
+
}], ctorParameters: () => [], propDecorators: { pagination: [{
|
|
524
|
+
type: HostBinding,
|
|
525
|
+
args: ['class.pagination']
|
|
526
|
+
}] } });
|
|
527
|
+
|
|
528
|
+
const YuvTemplateManagerRoutes = [
|
|
529
|
+
{
|
|
530
|
+
path: '',
|
|
531
|
+
component: YuvTemplatesComponent,
|
|
532
|
+
children: [
|
|
533
|
+
{ path: 'management', component: TemplateManagementComponent },
|
|
534
|
+
{ path: '', redirectTo: 'management', pathMatch: 'full' },
|
|
535
|
+
]
|
|
536
|
+
},
|
|
537
|
+
];
|
|
538
|
+
|
|
539
|
+
/**
|
|
540
|
+
* Generated bundle index. Do not edit.
|
|
541
|
+
*/
|
|
542
|
+
|
|
543
|
+
export { APP_ACTIONS, APP_ICONS, APP_ID, APP_SCHEMA, TEMPLATE_FILE_MIME_TYPE, TemplateManagementEventType, TemplateObject, TemplateService, YuvTemplateManagerRoutes, YuvTemplatesComponent };
|
|
544
|
+
//# sourceMappingURL=yuuvis-app-templates.mjs.map
|