@myrmidon/cadmus-item-editor 16.1.3 → 16.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { Injectable, ChangeDetectionStrategy, Component,
|
|
2
|
+
import { Injectable, ChangeDetectionStrategy, Component, computed, input, output, effect, Inject, signal, Pipe } from '@angular/core';
|
|
3
3
|
import { BehaviorSubject, forkJoin } from 'rxjs';
|
|
4
4
|
import * as i1 from '@myrmidon/cadmus-state';
|
|
5
5
|
import * as i7 from '@myrmidon/cadmus-api';
|
|
6
|
-
import {
|
|
6
|
+
import { DatePipe } from '@angular/common';
|
|
7
|
+
import { toSignal } from '@angular/core/rxjs-interop';
|
|
7
8
|
import { MatTooltip } from '@angular/material/tooltip';
|
|
8
9
|
import * as i1$1 from '@angular/forms';
|
|
9
10
|
import { Validators, ReactiveFormsModule } from '@angular/forms';
|
|
10
11
|
import { take } from 'rxjs/operators';
|
|
11
|
-
import { MatCard,
|
|
12
|
+
import { MatCard, MatCardContent } from '@angular/material/card';
|
|
12
13
|
import { CdkCopyToClipboard } from '@angular/cdk/clipboard';
|
|
13
14
|
import { MatProgressBar } from '@angular/material/progress-bar';
|
|
14
15
|
import { MatTabGroup, MatTab } from '@angular/material/tabs';
|
|
@@ -16,14 +17,15 @@ import { MatFormField, MatLabel, MatError, MatHint } from '@angular/material/for
|
|
|
16
17
|
import { MatInput } from '@angular/material/input';
|
|
17
18
|
import { MatSelect } from '@angular/material/select';
|
|
18
19
|
import { MatOption } from '@angular/material/core';
|
|
19
|
-
import { MatCheckbox } from '@angular/material/checkbox';
|
|
20
20
|
import { MatButton, MatIconButton } from '@angular/material/button';
|
|
21
21
|
import { MatIcon } from '@angular/material/icon';
|
|
22
22
|
import { MatDivider } from '@angular/material/divider';
|
|
23
23
|
import { MatExpansionPanel, MatExpansionPanelHeader, MatExpansionPanelTitle, MatExpansionPanelDescription } from '@angular/material/expansion';
|
|
24
|
+
import { FlagSetComponent } from '@myrmidon/cadmus-ui-flag-set';
|
|
24
25
|
import { MESSAGE_ITEM_LIST_REPOSITORY_RESET } from '@myrmidon/cadmus-item-list';
|
|
25
26
|
import * as i5 from '@myrmidon/cadmus-ui';
|
|
26
27
|
import { CustomValidators, PartBadgeComponent, getPartIdName } from '@myrmidon/cadmus-ui';
|
|
28
|
+
import { MatCheckbox } from '@angular/material/checkbox';
|
|
27
29
|
import * as i3 from '@myrmidon/ngx-mat-tools';
|
|
28
30
|
import * as i2 from '@angular/material/dialog';
|
|
29
31
|
import { MAT_DIALOG_DATA } from '@angular/material/dialog';
|
|
@@ -346,44 +348,62 @@ class EditedItemRepository {
|
|
|
346
348
|
});
|
|
347
349
|
});
|
|
348
350
|
}
|
|
349
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.
|
|
350
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.
|
|
351
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.6", ngImport: i0, type: EditedItemRepository, deps: [{ token: i1.AppRepository }, { token: i7.ItemService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
352
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.6", ngImport: i0, type: EditedItemRepository, providedIn: 'root' });
|
|
351
353
|
}
|
|
352
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.
|
|
354
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.6", ngImport: i0, type: EditedItemRepository, decorators: [{
|
|
353
355
|
type: Injectable,
|
|
354
356
|
args: [{ providedIn: 'root' }]
|
|
355
357
|
}], ctorParameters: () => [{ type: i1.AppRepository }, { type: i7.ItemService }] });
|
|
356
358
|
|
|
357
359
|
class CurrentItemBarComponent {
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
this._repository = _repository;
|
|
362
|
-
this.item$ = this._repository.item$;
|
|
360
|
+
item;
|
|
361
|
+
constructor(repository) {
|
|
362
|
+
this.item = toSignal(repository.item$);
|
|
363
363
|
}
|
|
364
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.
|
|
365
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.
|
|
364
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.6", ngImport: i0, type: CurrentItemBarComponent, deps: [{ token: EditedItemRepository }], target: i0.ɵɵFactoryTarget.Component });
|
|
365
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.6", type: CurrentItemBarComponent, isStandalone: true, selector: "cadmus-current-item-bar", ngImport: i0, template: "@if (item(); as item) {\n <div class=\"item-bar\">\n <span class=\"title\">{{ item.title }}</span>\n <span class=\"id\">{{ item.id }}</span>\n ⬤\n <span class=\"dsc\">\n {{ item.description }} ⬤\n <span matTooltip=\"Created\"\n >{{ item.timeCreated | date: \"yyyy-MM-dd HH:mm:ss\" }}\n {{ item.creatorId }}</span\n >\n ⬤\n <span matTooltip=\"Last saved\"\n >{{ item.timeModified | date: \"yyyy-MM-dd HH:mm:ss\" }}\n {{ item.userId }}</span\n >\n </span>\n </div>\n}\n", styles: ["div.item-bar{border:1px solid var(--mat-sys-on-surface-variant);border-radius:4px;background-color:var(--mat-sys-surface-container);color:var(--mat-sys-on-primary-container);margin:6px;padding:8px}.title{font-size:1.2em;font-weight:700;margin-right:.5em}.id{font-size:.8em;font-family:Courier New,Courier,monospace;margin-right:.5em}.dsc{font-size:.9em}\n"], dependencies: [{ kind: "directive", type: MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "pipe", type: DatePipe, name: "date" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
366
366
|
}
|
|
367
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.
|
|
367
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.6", ngImport: i0, type: CurrentItemBarComponent, decorators: [{
|
|
368
368
|
type: Component,
|
|
369
|
-
args: [{ selector: 'cadmus-current-item-bar', changeDetection: ChangeDetectionStrategy.OnPush, imports: [
|
|
369
|
+
args: [{ selector: 'cadmus-current-item-bar', changeDetection: ChangeDetectionStrategy.OnPush, imports: [DatePipe, MatTooltip], template: "@if (item(); as item) {\n <div class=\"item-bar\">\n <span class=\"title\">{{ item.title }}</span>\n <span class=\"id\">{{ item.id }}</span>\n ⬤\n <span class=\"dsc\">\n {{ item.description }} ⬤\n <span matTooltip=\"Created\"\n >{{ item.timeCreated | date: \"yyyy-MM-dd HH:mm:ss\" }}\n {{ item.creatorId }}</span\n >\n ⬤\n <span matTooltip=\"Last saved\"\n >{{ item.timeModified | date: \"yyyy-MM-dd HH:mm:ss\" }}\n {{ item.userId }}</span\n >\n </span>\n </div>\n}\n", styles: ["div.item-bar{border:1px solid var(--mat-sys-on-surface-variant);border-radius:4px;background-color:var(--mat-sys-surface-container);color:var(--mat-sys-on-primary-container);margin:6px;padding:8px}.title{font-size:1.2em;font-weight:700;margin-right:.5em}.id{font-size:.8em;font-family:Courier New,Courier,monospace;margin-right:.5em}.dsc{font-size:.9em}\n"] }]
|
|
370
370
|
}], ctorParameters: () => [{ type: EditedItemRepository }] });
|
|
371
371
|
|
|
372
372
|
class CurrentLayerPartBarComponent {
|
|
373
373
|
_appRepository;
|
|
374
374
|
_editedItemRepository;
|
|
375
|
-
_editedLayerRepository;
|
|
376
375
|
_facetService;
|
|
377
|
-
|
|
378
|
-
|
|
376
|
+
_facet;
|
|
377
|
+
_part;
|
|
378
|
+
typeId;
|
|
379
|
+
roleId;
|
|
380
|
+
color;
|
|
381
|
+
constructor(_appRepository, _editedItemRepository, editedLayerRepository, _facetService) {
|
|
379
382
|
this._appRepository = _appRepository;
|
|
380
383
|
this._editedItemRepository = _editedItemRepository;
|
|
381
|
-
this._editedLayerRepository = _editedLayerRepository;
|
|
382
384
|
this._facetService = _facetService;
|
|
385
|
+
this._facet = toSignal(this._editedItemRepository.facet$);
|
|
386
|
+
this._part = toSignal(editedLayerRepository.part$);
|
|
387
|
+
this.typeId = computed(() => {
|
|
388
|
+
const part = this._part();
|
|
389
|
+
if (!part)
|
|
390
|
+
return undefined;
|
|
391
|
+
return this.getTypeIdName(part.typeId);
|
|
392
|
+
}, ...(ngDevMode ? [{ debugName: "typeId" }] : /* istanbul ignore next */ []));
|
|
393
|
+
this.roleId = computed(() => {
|
|
394
|
+
const part = this._part();
|
|
395
|
+
if (!part)
|
|
396
|
+
return undefined;
|
|
397
|
+
return this.getRoleIdName(part.roleId);
|
|
398
|
+
}, ...(ngDevMode ? [{ debugName: "roleId" }] : /* istanbul ignore next */ []));
|
|
399
|
+
this.color = computed(() => {
|
|
400
|
+
const part = this._part();
|
|
401
|
+
this._facet(); // declare dependency so color recomputes on facet change
|
|
402
|
+
if (!part)
|
|
403
|
+
return undefined;
|
|
404
|
+
return this.getPartColor(part.typeId, part.roleId);
|
|
405
|
+
}, ...(ngDevMode ? [{ debugName: "color" }] : /* istanbul ignore next */ []));
|
|
383
406
|
}
|
|
384
|
-
typeId = signal(undefined, ...(ngDevMode ? [{ debugName: "typeId" }] : /* istanbul ignore next */ []));
|
|
385
|
-
roleId = signal(undefined, ...(ngDevMode ? [{ debugName: "roleId" }] : /* istanbul ignore next */ []));
|
|
386
|
-
color = signal(undefined, ...(ngDevMode ? [{ debugName: "color" }] : /* istanbul ignore next */ []));
|
|
387
407
|
getTypeIdName(typeId) {
|
|
388
408
|
const typeThesaurus = this._appRepository.getTypeThesaurus();
|
|
389
409
|
if (!typeThesaurus) {
|
|
@@ -407,37 +427,10 @@ class CurrentLayerPartBarComponent {
|
|
|
407
427
|
const facet = this._editedItemRepository.getFacet();
|
|
408
428
|
return this._facetService.getPartColor(typeId, roleId, facet);
|
|
409
429
|
}
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
if (!part) {
|
|
413
|
-
this.typeId.set(undefined);
|
|
414
|
-
this.roleId.set(undefined);
|
|
415
|
-
this.color.set(undefined);
|
|
416
|
-
return;
|
|
417
|
-
}
|
|
418
|
-
else {
|
|
419
|
-
this.typeId.set(this.getTypeIdName(part.typeId));
|
|
420
|
-
this.roleId.set(this.getRoleIdName(part.roleId));
|
|
421
|
-
this.color.set(this.getPartColor(part.typeId, part.roleId));
|
|
422
|
-
}
|
|
423
|
-
}
|
|
424
|
-
ngOnInit() {
|
|
425
|
-
this._subs.push(this._editedItemRepository.facet$.subscribe((_) => {
|
|
426
|
-
this.updateLabels();
|
|
427
|
-
}));
|
|
428
|
-
this._subs.push(this._editedLayerRepository.part$.subscribe((_) => {
|
|
429
|
-
this.updateLabels();
|
|
430
|
-
}));
|
|
431
|
-
// ensure app data is loaded
|
|
432
|
-
this._appRepository.load();
|
|
433
|
-
}
|
|
434
|
-
ngOnDestroy() {
|
|
435
|
-
this._subs.forEach((s) => s.unsubscribe());
|
|
436
|
-
}
|
|
437
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CurrentLayerPartBarComponent, deps: [{ token: i1.AppRepository }, { token: EditedItemRepository }, { token: i1.EditedLayerRepository }, { token: i7.FacetService }], target: i0.ɵɵFactoryTarget.Component });
|
|
438
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.4", type: CurrentLayerPartBarComponent, isStandalone: true, selector: "cadmus-current-layer-part-bar", ngImport: i0, template: "<div>\n <span class=\"type-id\" [style.background-color]=\"color()\">{{ typeId() }}</span>\n <span class=\"role-id\">{{ roleId() }}</span>\n</div>\n", styles: ["span.type-id{padding:4px;border-radius:6px}span.role-id{padding:4px}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
430
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.6", ngImport: i0, type: CurrentLayerPartBarComponent, deps: [{ token: i1.AppRepository }, { token: EditedItemRepository }, { token: i1.EditedLayerRepository }, { token: i7.FacetService }], target: i0.ɵɵFactoryTarget.Component });
|
|
431
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.6", type: CurrentLayerPartBarComponent, isStandalone: true, selector: "cadmus-current-layer-part-bar", ngImport: i0, template: "<div>\n <span class=\"type-id\" [style.background-color]=\"color()\">{{ typeId() }}</span>\n <span class=\"role-id\">{{ roleId() }}</span>\n</div>\n", styles: ["span.type-id{padding:4px;border-radius:6px}span.role-id{padding:4px}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
439
432
|
}
|
|
440
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.
|
|
433
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.6", ngImport: i0, type: CurrentLayerPartBarComponent, decorators: [{
|
|
441
434
|
type: Component,
|
|
442
435
|
args: [{ selector: 'cadmus-current-layer-part-bar', changeDetection: ChangeDetectionStrategy.OnPush, template: "<div>\n <span class=\"type-id\" [style.background-color]=\"color()\">{{ typeId() }}</span>\n <span class=\"role-id\">{{ roleId() }}</span>\n</div>\n", styles: ["span.type-id{padding:4px;border-radius:6px}span.role-id{padding:4px}\n"] }]
|
|
443
436
|
}], ctorParameters: () => [{ type: i1.AppRepository }, { type: EditedItemRepository }, { type: i1.EditedLayerRepository }, { type: i7.FacetService }] });
|
|
@@ -454,7 +447,6 @@ class PartsScopeEditorComponent {
|
|
|
454
447
|
_appRepository;
|
|
455
448
|
_colorService;
|
|
456
449
|
_editedItemRepository;
|
|
457
|
-
_sub;
|
|
458
450
|
parts = input(...(ngDevMode ? [undefined, { debugName: "parts" }] : /* istanbul ignore next */ []));
|
|
459
451
|
readonly = input(...(ngDevMode ? [undefined, { debugName: "readonly" }] : /* istanbul ignore next */ []));
|
|
460
452
|
setScopeRequest = output();
|
|
@@ -469,9 +461,6 @@ class PartsScopeEditorComponent {
|
|
|
469
461
|
this._colorService = _colorService;
|
|
470
462
|
this._editedItemRepository = _editedItemRepository;
|
|
471
463
|
this.checks = _formBuilder.array([], CustomValidators.minChecked(1));
|
|
472
|
-
this._sub = this.checks.valueChanges.subscribe(() => {
|
|
473
|
-
this.form.updateValueAndValidity();
|
|
474
|
-
});
|
|
475
464
|
this.scope = _formBuilder.control(null, [
|
|
476
465
|
Validators.maxLength(50),
|
|
477
466
|
Validators.pattern(/^[-a-zA-Z0-9_]+$/),
|
|
@@ -486,9 +475,6 @@ class PartsScopeEditorComponent {
|
|
|
486
475
|
this.updateForm(this.parts());
|
|
487
476
|
});
|
|
488
477
|
}
|
|
489
|
-
ngOnDestroy() {
|
|
490
|
-
this._sub.unsubscribe();
|
|
491
|
-
}
|
|
492
478
|
updateForm(parts) {
|
|
493
479
|
this.checks.clear();
|
|
494
480
|
if (!parts?.length) {
|
|
@@ -554,10 +540,10 @@ class PartsScopeEditorComponent {
|
|
|
554
540
|
});
|
|
555
541
|
});
|
|
556
542
|
}
|
|
557
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.
|
|
558
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.
|
|
543
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.6", ngImport: i0, type: PartsScopeEditorComponent, deps: [{ token: i1$1.FormBuilder }, { token: i7.FacetService }, { token: i3.DialogService }, { token: i1.AppRepository }, { token: i5.ColorService }, { token: EditedItemRepository }], target: i0.ɵɵFactoryTarget.Component });
|
|
544
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.6", type: PartsScopeEditorComponent, isStandalone: true, selector: "cadmus-parts-scope-editor", inputs: { parts: { classPropertyName: "parts", publicName: "parts", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { setScopeRequest: "setScopeRequest" }, ngImport: i0, template: "<form [formGroup]=\"form\" (submit)=\"submit()\">\n <table id=\"parts\" formArrayName=\"checks\">\n <thead>\n <tr>\n <th aria-label=\"select\"></th>\n <th>type</th>\n <th>role</th>\n <th>scope</th>\n <th>modified</th>\n <th>user</th>\n </tr>\n </thead>\n <tbody>\n @for (\n part of parts() ?? [];\n track part.typeId + \":\" + (part.roleId ?? \"\");\n let i = $index\n ) {\n <tr>\n <td class=\"fit-width\">\n <mat-checkbox [formControlName]=\"i\" (change)=\"onCheckChanged()\" />\n </td>\n <td>\n <span\n class=\"model-type\"\n [style.background-color]=\"getPartColor(part.typeId, part.roleId)\"\n [style.color]=\"getContrastColor(part.typeId, part.roleId)\"\n >{{ getTypeIdName(part.typeId) }}</span\n >\n </td>\n <td>{{ getRoleIdName(part.roleId ?? \"\") }}</td>\n <td>{{ part.thesaurusScope }}</td>\n <td>{{ part.timeModified | date: \"yyyy-MM-dd HH:mm:ss\" }}</td>\n <td>{{ part.userId }}</td>\n </tr>\n }\n </tbody>\n </table>\n <div class=\"form-row\">\n <mat-form-field>\n <mat-label>scope</mat-label>\n <input matInput formControlName=\"scope\" />\n @if (scope.hasError(\"maxLength\") && (scope.dirty || scope.touched)) {\n <mat-error>too long</mat-error>\n }\n @if (scope.hasError(\"pattern\") && (scope.dirty || scope.touched)) {\n <mat-error>invalid scope</mat-error>\n }\n </mat-form-field>\n <button\n mat-flat-button\n class=\"mat-primary\"\n type=\"submit\"\n [disabled]=\"form.invalid || readonly()\"\n matTooltip=\"Assign the scope to the checked parts\"\n >\n assign\n </button>\n </div>\n</form>\n", styles: ["table{width:100%;border-collapse:collapse;color:var(--mat-sys-on-surface-variant)}tbody tr:nth-child(odd){background-color:var(--mat-sys-surface-container)}th{text-align:left;font-weight:400;color:var(--mat-sys-on-surface-variant)}tbody tr:hover{background-color:var(--mat-sys-surface-container-high)}td.fit-width{width:1px;white-space:nowrap}tbody tr.selected{background-color:var(--mat-sys-secondary-container);color:var(--mat-sys-on-secondary-container)}span.model-type{padding:4px;border-radius:6px}table#parts{border-collapse:separate;border-spacing:0 8px}.form-row{display:flex;gap:8px;align-items:center;flex-wrap:wrap}.form-row *{flex:0 0 auto}\n"], dependencies: [{ kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1$1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1$1.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$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],[formArray],form:not([ngNoForm]),[ngForm]" }, { 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: "directive", type: i1$1.FormArrayName, selector: "[formArrayName]", inputs: ["formArrayName"] }, { kind: "component", type: MatCheckbox, selector: "mat-checkbox", inputs: ["aria-label", "aria-labelledby", "aria-describedby", "aria-expanded", "aria-controls", "aria-owns", "id", "required", "labelPosition", "name", "value", "disableRipple", "tabIndex", "color", "disabledInteractive", "checked", "disabled", "indeterminate"], outputs: ["change", "indeterminateChange"], exportAs: ["matCheckbox"] }, { kind: "component", type: MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: MatLabel, selector: "mat-label" }, { kind: "directive", type: 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: "directive", type: MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "component", type: 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: "directive", type: MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "pipe", type: DatePipe, name: "date" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
559
545
|
}
|
|
560
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.
|
|
546
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.6", ngImport: i0, type: PartsScopeEditorComponent, decorators: [{
|
|
561
547
|
type: Component,
|
|
562
548
|
args: [{ selector: 'cadmus-parts-scope-editor', changeDetection: ChangeDetectionStrategy.OnPush, imports: [
|
|
563
549
|
ReactiveFormsModule,
|
|
@@ -569,7 +555,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
569
555
|
MatButton,
|
|
570
556
|
MatTooltip,
|
|
571
557
|
DatePipe,
|
|
572
|
-
], template: "<form [formGroup]=\"form\" (submit)=\"submit()\">\
|
|
558
|
+
], template: "<form [formGroup]=\"form\" (submit)=\"submit()\">\n <table id=\"parts\" formArrayName=\"checks\">\n <thead>\n <tr>\n <th aria-label=\"select\"></th>\n <th>type</th>\n <th>role</th>\n <th>scope</th>\n <th>modified</th>\n <th>user</th>\n </tr>\n </thead>\n <tbody>\n @for (\n part of parts() ?? [];\n track part.typeId + \":\" + (part.roleId ?? \"\");\n let i = $index\n ) {\n <tr>\n <td class=\"fit-width\">\n <mat-checkbox [formControlName]=\"i\" (change)=\"onCheckChanged()\" />\n </td>\n <td>\n <span\n class=\"model-type\"\n [style.background-color]=\"getPartColor(part.typeId, part.roleId)\"\n [style.color]=\"getContrastColor(part.typeId, part.roleId)\"\n >{{ getTypeIdName(part.typeId) }}</span\n >\n </td>\n <td>{{ getRoleIdName(part.roleId ?? \"\") }}</td>\n <td>{{ part.thesaurusScope }}</td>\n <td>{{ part.timeModified | date: \"yyyy-MM-dd HH:mm:ss\" }}</td>\n <td>{{ part.userId }}</td>\n </tr>\n }\n </tbody>\n </table>\n <div class=\"form-row\">\n <mat-form-field>\n <mat-label>scope</mat-label>\n <input matInput formControlName=\"scope\" />\n @if (scope.hasError(\"maxLength\") && (scope.dirty || scope.touched)) {\n <mat-error>too long</mat-error>\n }\n @if (scope.hasError(\"pattern\") && (scope.dirty || scope.touched)) {\n <mat-error>invalid scope</mat-error>\n }\n </mat-form-field>\n <button\n mat-flat-button\n class=\"mat-primary\"\n type=\"submit\"\n [disabled]=\"form.invalid || readonly()\"\n matTooltip=\"Assign the scope to the checked parts\"\n >\n assign\n </button>\n </div>\n</form>\n", styles: ["table{width:100%;border-collapse:collapse;color:var(--mat-sys-on-surface-variant)}tbody tr:nth-child(odd){background-color:var(--mat-sys-surface-container)}th{text-align:left;font-weight:400;color:var(--mat-sys-on-surface-variant)}tbody tr:hover{background-color:var(--mat-sys-surface-container-high)}td.fit-width{width:1px;white-space:nowrap}tbody tr.selected{background-color:var(--mat-sys-secondary-container);color:var(--mat-sys-on-secondary-container)}span.model-type{padding:4px;border-radius:6px}table#parts{border-collapse:separate;border-spacing:0 8px}.form-row{display:flex;gap:8px;align-items:center;flex-wrap:wrap}.form-row *{flex:0 0 auto}\n"] }]
|
|
573
559
|
}], ctorParameters: () => [{ type: i1$1.FormBuilder }, { type: i7.FacetService }, { type: i3.DialogService }, { type: i1.AppRepository }, { type: i5.ColorService }, { type: EditedItemRepository }], propDecorators: { parts: [{ type: i0.Input, args: [{ isSignal: true, alias: "parts", required: false }] }], readonly: [{ type: i0.Input, args: [{ isSignal: true, alias: "readonly", required: false }] }], setScopeRequest: [{ type: i0.Output, args: ["setScopeRequest"] }] } });
|
|
574
560
|
|
|
575
561
|
/**
|
|
@@ -591,10 +577,10 @@ class ItemLookupDialogComponent {
|
|
|
591
577
|
onItemLookupChange(value) {
|
|
592
578
|
this.dialogRef.close(value);
|
|
593
579
|
}
|
|
594
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.
|
|
595
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.
|
|
580
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.6", ngImport: i0, type: ItemLookupDialogComponent, deps: [{ token: i2.MatDialogRef }, { token: MAT_DIALOG_DATA }, { token: i2$1.ItemRefLookupService }], target: i0.ɵɵFactoryTarget.Component });
|
|
581
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.6", type: ItemLookupDialogComponent, isStandalone: true, selector: "cadmus-item-lookup-dialog", ngImport: i0, template: "<div id=\"container\">\r\n <h3>Select Item</h3>\r\n <cadmus-refs-lookup\r\n [service]=\"itemLookupService\"\r\n label=\"item\"\r\n (itemChange)=\"onItemLookupChange($event)\"\r\n />\r\n</div>\r\n", styles: ["#container{padding:16px}\n"], dependencies: [{ kind: "component", type: RefLookupComponent, selector: "cadmus-refs-lookup", inputs: ["label", "limit", "baseFilter", "service", "item", "itemId", "required", "hasMore", "linkTemplate", "optDialog", "options", "lookupProviderOptions"], outputs: ["itemChange", "optionsChange", "moreRequest"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
596
582
|
}
|
|
597
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.
|
|
583
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.6", ngImport: i0, type: ItemLookupDialogComponent, decorators: [{
|
|
598
584
|
type: Component,
|
|
599
585
|
args: [{ selector: 'cadmus-item-lookup-dialog', changeDetection: ChangeDetectionStrategy.OnPush, imports: [RefLookupComponent], template: "<div id=\"container\">\r\n <h3>Select Item</h3>\r\n <cadmus-refs-lookup\r\n [service]=\"itemLookupService\"\r\n label=\"item\"\r\n (itemChange)=\"onItemLookupChange($event)\"\r\n />\r\n</div>\r\n", styles: ["#container{padding:16px}\n"] }]
|
|
600
586
|
}], ctorParameters: () => [{ type: i2.MatDialogRef }, { type: i2.MatDialogConfig, decorators: [{
|
|
@@ -648,10 +634,10 @@ class ItemGenerateDialogComponent {
|
|
|
648
634
|
flags: flags,
|
|
649
635
|
});
|
|
650
636
|
}
|
|
651
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.
|
|
652
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.
|
|
637
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.6", ngImport: i0, type: ItemGenerateDialogComponent, deps: [{ token: i1$1.FormBuilder }, { token: i2.MatDialogRef }, { token: MAT_DIALOG_DATA }], target: i0.ɵɵFactoryTarget.Component });
|
|
638
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.6", type: ItemGenerateDialogComponent, isStandalone: true, selector: "cadmus-item-generate-dialog", ngImport: i0, template: "<div id=\"container\">\n <h3>Generate Items</h3>\n <form [formGroup]=\"form\" (submit)=\"apply()\">\n <!-- count -->\n <div>\n <mat-form-field class=\"input-nr\">\n <mat-label>count</mat-label>\n <input matInput type=\"number\" min=\"1\" [formControl]=\"itemCount\" />\n <mat-hint>number of items to generate</mat-hint>\n @if (\n itemCount.errors?.[\"required\"] && (itemCount.dirty || itemCount.touched)\n ) {\n <mat-error>count required</mat-error>\n }\n @if (\n itemCount.errors?.[\"min\"] && (itemCount.dirty || itemCount.touched)\n ) {\n <mat-error>count too low</mat-error>\n }\n @if (\n itemCount.errors?.[\"max\"] && (itemCount.dirty || itemCount.touched)\n ) {\n <mat-error>count too high</mat-error>\n }\n </mat-form-field>\n </div>\n\n <!-- title -->\n <div>\n <mat-form-field>\n <mat-label>title</mat-label>\n <input matInput [formControl]=\"itemTitle\" />\n <mat-hint>title template ({{ \"{0}\" }}=N)</mat-hint>\n @if (\n itemTitle.errors?.[\"required\"] &&\n (itemTitle.dirty || itemTitle.touched)\n ) {\n <mat-error>title required</mat-error>\n }\n @if (\n itemTitle.errors?.[\"maxlength\"] &&\n (itemTitle.dirty || itemTitle.touched)\n ) {\n <mat-error>title too long</mat-error>\n }\n </mat-form-field>\n </div>\n\n <!-- flags -->\n @if (flags().length) {\n <div>\n <mat-form-field>\n <mat-label>flags</mat-label>\n <mat-select [formControl]=\"itemFlags\" multiple>\n @for (flag of flags(); track flag.id) {\n <mat-option [value]=\"flag\">\n <span class=\"flag-bullet\" [style.color]=\"'#' + flag.colorKey\"\n >⬤</span\n >\n {{ flag.label }}\n </mat-option>\n }\n </mat-select>\n </mat-form-field>\n </div>\n }\n\n <!-- apply button -->\n <div>\n <button\n mat-flat-button\n class=\"mat-primary\"\n type=\"submit\"\n [disabled]=\"form.invalid\"\n >\n generate\n </button>\n </div>\n </form>\n</div>\n", styles: ["#container{padding:16px}.flag-bullet{margin-right:.5em}.input-nr{width:5em}\n"], dependencies: [{ kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1$1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1$1.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$1.NumberValueAccessor, selector: "input[type=number][formControlName],input[type=number][formControl],input[type=number][ngModel]" }, { kind: "directive", type: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],[formArray],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1$1.MinValidator, selector: "input[type=number][min][formControlName],input[type=number][min][formControl],input[type=number][min][ngModel]", inputs: ["min"] }, { kind: "directive", type: i1$1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "directive", type: i1$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "component", type: MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: MatLabel, selector: "mat-label" }, { kind: "directive", type: 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: "directive", type: MatHint, selector: "mat-hint", inputs: ["align", "id"] }, { kind: "directive", type: MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "component", type: 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: MatOption, selector: "mat-option", inputs: ["value", "id", "disabled"], outputs: ["onSelectionChange"], exportAs: ["matOption"] }, { kind: "component", type: 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"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
653
639
|
}
|
|
654
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.
|
|
640
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.6", ngImport: i0, type: ItemGenerateDialogComponent, decorators: [{
|
|
655
641
|
type: Component,
|
|
656
642
|
args: [{ selector: 'cadmus-item-generate-dialog', changeDetection: ChangeDetectionStrategy.OnPush, imports: [
|
|
657
643
|
ReactiveFormsModule,
|
|
@@ -663,7 +649,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
663
649
|
MatSelect,
|
|
664
650
|
MatOption,
|
|
665
651
|
MatButton,
|
|
666
|
-
], template: "<div id=\"container\">\
|
|
652
|
+
], template: "<div id=\"container\">\n <h3>Generate Items</h3>\n <form [formGroup]=\"form\" (submit)=\"apply()\">\n <!-- count -->\n <div>\n <mat-form-field class=\"input-nr\">\n <mat-label>count</mat-label>\n <input matInput type=\"number\" min=\"1\" [formControl]=\"itemCount\" />\n <mat-hint>number of items to generate</mat-hint>\n @if (\n itemCount.errors?.[\"required\"] && (itemCount.dirty || itemCount.touched)\n ) {\n <mat-error>count required</mat-error>\n }\n @if (\n itemCount.errors?.[\"min\"] && (itemCount.dirty || itemCount.touched)\n ) {\n <mat-error>count too low</mat-error>\n }\n @if (\n itemCount.errors?.[\"max\"] && (itemCount.dirty || itemCount.touched)\n ) {\n <mat-error>count too high</mat-error>\n }\n </mat-form-field>\n </div>\n\n <!-- title -->\n <div>\n <mat-form-field>\n <mat-label>title</mat-label>\n <input matInput [formControl]=\"itemTitle\" />\n <mat-hint>title template ({{ \"{0}\" }}=N)</mat-hint>\n @if (\n itemTitle.errors?.[\"required\"] &&\n (itemTitle.dirty || itemTitle.touched)\n ) {\n <mat-error>title required</mat-error>\n }\n @if (\n itemTitle.errors?.[\"maxlength\"] &&\n (itemTitle.dirty || itemTitle.touched)\n ) {\n <mat-error>title too long</mat-error>\n }\n </mat-form-field>\n </div>\n\n <!-- flags -->\n @if (flags().length) {\n <div>\n <mat-form-field>\n <mat-label>flags</mat-label>\n <mat-select [formControl]=\"itemFlags\" multiple>\n @for (flag of flags(); track flag.id) {\n <mat-option [value]=\"flag\">\n <span class=\"flag-bullet\" [style.color]=\"'#' + flag.colorKey\"\n >⬤</span\n >\n {{ flag.label }}\n </mat-option>\n }\n </mat-select>\n </mat-form-field>\n </div>\n }\n\n <!-- apply button -->\n <div>\n <button\n mat-flat-button\n class=\"mat-primary\"\n type=\"submit\"\n [disabled]=\"form.invalid\"\n >\n generate\n </button>\n </div>\n </form>\n</div>\n", styles: ["#container{padding:16px}.flag-bullet{margin-right:.5em}.input-nr{width:5em}\n"] }]
|
|
667
653
|
}], ctorParameters: () => [{ type: i1$1.FormBuilder }, { type: i2.MatDialogRef }, { type: i2.MatDialogConfig, decorators: [{
|
|
668
654
|
type: Inject,
|
|
669
655
|
args: [MAT_DIALOG_DATA]
|
|
@@ -709,12 +695,12 @@ class MissingPartsComponent {
|
|
|
709
695
|
requestAddPart(definition) {
|
|
710
696
|
this.addRequest.emit(definition);
|
|
711
697
|
}
|
|
712
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.
|
|
713
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.
|
|
698
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.6", ngImport: i0, type: MissingPartsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
699
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.6", type: MissingPartsComponent, isStandalone: true, selector: "cadmus-missing-parts", inputs: { facetDefinition: { classPropertyName: "facetDefinition", publicName: "facetDefinition", isSignal: true, isRequired: false, transformFunction: null }, partDefinitions: { classPropertyName: "partDefinitions", publicName: "partDefinitions", isSignal: true, isRequired: false, transformFunction: null }, parts: { classPropertyName: "parts", publicName: "parts", isSignal: true, isRequired: false, transformFunction: null }, typeThesaurus: { classPropertyName: "typeThesaurus", publicName: "typeThesaurus", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { addRequest: "addRequest" }, ngImport: i0, template: "@if (missingDefinitions().length) {\n <div>\n <fieldset>\n <legend>\n <mat-icon class=\"mat-warn\">warning</mat-icon> Missing Parts\n </legend>\n <table>\n <tbody>\n @for (\n def of missingDefinitions();\n track def.typeId + \":\" + (def.roleId ?? \"\")\n ) {\n <tr>\n <td>\n <button\n type=\"button\"\n mat-icon-button\n matTooltip=\"Add this part\"\n (click)=\"requestAddPart(def)\"\n >\n <mat-icon>add_circle</mat-icon>\n </button>\n </td>\n <td [matTooltip]=\"def.description\">\n <cadmus-part-badge\n [partTypeIds]=\"def\"\n [facetDefinition]=\"facetDefinition()\"\n [typeThesaurus]=\"typeThesaurus()\"\n />\n </td>\n </tr>\n }\n </tbody>\n </table>\n </fieldset>\n </div>\n}\n", styles: ["fieldset{border:1px solid var(--mat-sys-on-surface-variant);border-radius:6px;padding:6px}legend{color:var(--mat-sys-on-surface-variant)}\n"], dependencies: [{ kind: "component", type: MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: MatIconButton, selector: "button[mat-icon-button], a[mat-icon-button], button[matIconButton], a[matIconButton]", exportAs: ["matButton", "matAnchor"] }, { kind: "directive", type: MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "component", type: PartBadgeComponent, selector: "cadmus-part-badge", inputs: ["badgeType", "typeThesaurus", "facetDefinition", "partTypeIds"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
714
700
|
}
|
|
715
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.
|
|
701
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.6", ngImport: i0, type: MissingPartsComponent, decorators: [{
|
|
716
702
|
type: Component,
|
|
717
|
-
args: [{ selector: 'cadmus-missing-parts', changeDetection: ChangeDetectionStrategy.OnPush, imports: [MatIcon, MatIconButton, MatTooltip, PartBadgeComponent], template: "@if (missingDefinitions().length) {\
|
|
703
|
+
args: [{ selector: 'cadmus-missing-parts', changeDetection: ChangeDetectionStrategy.OnPush, imports: [MatIcon, MatIconButton, MatTooltip, PartBadgeComponent], template: "@if (missingDefinitions().length) {\n <div>\n <fieldset>\n <legend>\n <mat-icon class=\"mat-warn\">warning</mat-icon> Missing Parts\n </legend>\n <table>\n <tbody>\n @for (\n def of missingDefinitions();\n track def.typeId + \":\" + (def.roleId ?? \"\")\n ) {\n <tr>\n <td>\n <button\n type=\"button\"\n mat-icon-button\n matTooltip=\"Add this part\"\n (click)=\"requestAddPart(def)\"\n >\n <mat-icon>add_circle</mat-icon>\n </button>\n </td>\n <td [matTooltip]=\"def.description\">\n <cadmus-part-badge\n [partTypeIds]=\"def\"\n [facetDefinition]=\"facetDefinition()\"\n [typeThesaurus]=\"typeThesaurus()\"\n />\n </td>\n </tr>\n }\n </tbody>\n </table>\n </fieldset>\n </div>\n}\n", styles: ["fieldset{border:1px solid var(--mat-sys-on-surface-variant);border-radius:6px;padding:6px}legend{color:var(--mat-sys-on-surface-variant)}\n"] }]
|
|
718
704
|
}], ctorParameters: () => [], propDecorators: { facetDefinition: [{ type: i0.Input, args: [{ isSignal: true, alias: "facetDefinition", required: false }] }], partDefinitions: [{ type: i0.Input, args: [{ isSignal: true, alias: "partDefinitions", required: false }] }], parts: [{ type: i0.Input, args: [{ isSignal: true, alias: "parts", required: false }] }], typeThesaurus: [{ type: i0.Input, args: [{ isSignal: true, alias: "typeThesaurus", required: false }] }], addRequest: [{ type: i0.Output, args: ["addRequest"] }] } });
|
|
719
705
|
|
|
720
706
|
/**
|
|
@@ -752,10 +738,10 @@ class HasPreviewPipe {
|
|
|
752
738
|
const key = value.roleId ? `${value.typeId}|${value.roleId}` : value.typeId;
|
|
753
739
|
return rKeys?.find((k) => k === key) ? true : false;
|
|
754
740
|
}
|
|
755
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.
|
|
756
|
-
static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "21.2.
|
|
741
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.6", ngImport: i0, type: HasPreviewPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
742
|
+
static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "21.2.6", ngImport: i0, type: HasPreviewPipe, isStandalone: true, name: "hasPreview" });
|
|
757
743
|
}
|
|
758
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.
|
|
744
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.6", ngImport: i0, type: HasPreviewPipe, decorators: [{
|
|
759
745
|
type: Pipe,
|
|
760
746
|
args: [{ name: 'hasPreview' }]
|
|
761
747
|
}] });
|
|
@@ -779,25 +765,32 @@ class ItemEditorComponent {
|
|
|
779
765
|
_authService;
|
|
780
766
|
_userLevelService;
|
|
781
767
|
_messaging;
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
768
|
+
// signals from edited-item repository
|
|
769
|
+
item;
|
|
770
|
+
parts;
|
|
771
|
+
partGroups;
|
|
772
|
+
layerPartInfos;
|
|
773
|
+
facet;
|
|
774
|
+
newPartDefinitions;
|
|
775
|
+
// signals from app repository
|
|
776
|
+
facets;
|
|
777
|
+
typeThesaurus;
|
|
778
|
+
previewJKeys;
|
|
779
|
+
previewFKeys;
|
|
780
|
+
flagDefinitions;
|
|
786
781
|
id = signal(undefined, ...(ngDevMode ? [{ debugName: "id" }] : /* istanbul ignore next */ []));
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
layerPartInfos$;
|
|
791
|
-
user = signal(undefined, ...(ngDevMode ? [{ debugName: "user" }] : /* istanbul ignore next */ []));
|
|
792
|
-
userLevel = signal(0, ...(ngDevMode ? [{ debugName: "userLevel" }] : /* istanbul ignore next */ []));
|
|
782
|
+
_currentUser;
|
|
783
|
+
user;
|
|
784
|
+
userLevel;
|
|
793
785
|
busy = signal(false, ...(ngDevMode ? [{ debugName: "busy" }] : /* istanbul ignore next */ []));
|
|
794
|
-
//
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
786
|
+
// flag-set signals
|
|
787
|
+
_flagsValue;
|
|
788
|
+
/** Flags adapted for FlagSetComponent; admin flags excluded for non-admins. */
|
|
789
|
+
flagSetFlags;
|
|
790
|
+
/** Admin-only flags shown read-only to non-admin users. */
|
|
791
|
+
adminFlagDefs;
|
|
792
|
+
/** Currently checked flag IDs derived from the flags form control value. */
|
|
793
|
+
checkedFlagIds;
|
|
801
794
|
// new part form
|
|
802
795
|
newPartType;
|
|
803
796
|
newPart;
|
|
@@ -805,10 +798,9 @@ class ItemEditorComponent {
|
|
|
805
798
|
title;
|
|
806
799
|
sortKey;
|
|
807
800
|
description;
|
|
808
|
-
|
|
801
|
+
facetCtrl;
|
|
809
802
|
group;
|
|
810
803
|
flags;
|
|
811
|
-
flagChecks;
|
|
812
804
|
metadata;
|
|
813
805
|
constructor(itemLookupService, dialog, _router, _route, _snackbar, _appRepository, _repository, _itemService, _libraryRouteService, _dialogService, _authService, _userLevelService, _messaging, _formBuilder) {
|
|
814
806
|
this.itemLookupService = itemLookupService;
|
|
@@ -824,7 +816,6 @@ class ItemEditorComponent {
|
|
|
824
816
|
this._authService = _authService;
|
|
825
817
|
this._userLevelService = _userLevelService;
|
|
826
818
|
this._messaging = _messaging;
|
|
827
|
-
this._formBuilder = _formBuilder;
|
|
828
819
|
this.id.set(this._route.snapshot.params['id']);
|
|
829
820
|
if (this.id() === 'new') {
|
|
830
821
|
this.id.set(undefined);
|
|
@@ -834,7 +825,7 @@ class ItemEditorComponent {
|
|
|
834
825
|
this.newPart = _formBuilder.group({
|
|
835
826
|
newPartType: this.newPartType,
|
|
836
827
|
});
|
|
837
|
-
// item
|
|
828
|
+
// item metadata form
|
|
838
829
|
this.title = _formBuilder.control(null, [
|
|
839
830
|
Validators.required,
|
|
840
831
|
Validators.maxLength(500),
|
|
@@ -848,123 +839,123 @@ class ItemEditorComponent {
|
|
|
848
839
|
Validators.required,
|
|
849
840
|
Validators.maxLength(1000),
|
|
850
841
|
]);
|
|
851
|
-
this.
|
|
842
|
+
this.facetCtrl = _formBuilder.control(null, Validators.required);
|
|
852
843
|
this.group = _formBuilder.control(null, Validators.maxLength(100));
|
|
853
844
|
this.flags = _formBuilder.control(0, { nonNullable: true });
|
|
854
|
-
this.flagChecks = _formBuilder.array([]);
|
|
855
845
|
this.metadata = _formBuilder.group({
|
|
856
846
|
title: this.title,
|
|
857
847
|
sortKey: this.sortKey,
|
|
858
848
|
description: this.description,
|
|
859
|
-
facet: this.
|
|
849
|
+
facet: this.facetCtrl,
|
|
860
850
|
group: this.group,
|
|
861
|
-
|
|
851
|
+
flags: this.flags,
|
|
852
|
+
});
|
|
853
|
+
// signals from repositories
|
|
854
|
+
this.item = toSignal(this._repository.item$);
|
|
855
|
+
this.parts = toSignal(this._repository.parts$, { requireSync: true });
|
|
856
|
+
this.partGroups = toSignal(this._repository.partGroups$, {
|
|
857
|
+
requireSync: true,
|
|
858
|
+
});
|
|
859
|
+
this.layerPartInfos = toSignal(this._repository.layers$, {
|
|
860
|
+
requireSync: true,
|
|
861
|
+
});
|
|
862
|
+
this.facet = toSignal(this._repository.facet$);
|
|
863
|
+
this.newPartDefinitions = toSignal(this._repository.newPartDefinitions$, {
|
|
864
|
+
requireSync: true,
|
|
865
|
+
});
|
|
866
|
+
this.facets = toSignal(this._appRepository.facets$, {
|
|
867
|
+
requireSync: true,
|
|
868
|
+
});
|
|
869
|
+
this.typeThesaurus = toSignal(this._appRepository.typeThesaurus$);
|
|
870
|
+
this.previewJKeys = toSignal(this._appRepository.previewJKeys$, {
|
|
871
|
+
requireSync: true,
|
|
872
|
+
});
|
|
873
|
+
this.previewFKeys = toSignal(this._appRepository.previewFKeys$, {
|
|
874
|
+
requireSync: true,
|
|
875
|
+
});
|
|
876
|
+
this.flagDefinitions = toSignal(this._appRepository.flags$, {
|
|
877
|
+
requireSync: true,
|
|
878
|
+
});
|
|
879
|
+
// user signals
|
|
880
|
+
this._currentUser = toSignal(this._authService.currentUser$, {
|
|
881
|
+
initialValue: null,
|
|
882
|
+
});
|
|
883
|
+
this.user = computed(() => this._currentUser() ?? undefined, ...(ngDevMode ? [{ debugName: "user" }] : /* istanbul ignore next */ []));
|
|
884
|
+
this.userLevel = computed(() => {
|
|
885
|
+
// track user changes so userLevel is recomputed on login/logout
|
|
886
|
+
this._currentUser();
|
|
887
|
+
return this._userLevelService.getCurrentUserLevel();
|
|
888
|
+
}, ...(ngDevMode ? [{ debugName: "userLevel" }] : /* istanbul ignore next */ []));
|
|
889
|
+
// flags signal (tracks the flags form control value)
|
|
890
|
+
this._flagsValue = toSignal(this.flags.valueChanges, { initialValue: 0 });
|
|
891
|
+
// flags for FlagSetComponent: exclude admin flags for non-admins
|
|
892
|
+
this.flagSetFlags = computed(() => this.flagDefinitions()
|
|
893
|
+
.filter((def) => this.userLevel() >= 4 || !def.isAdmin)
|
|
894
|
+
.map((def) => ({
|
|
895
|
+
id: String(def.id),
|
|
896
|
+
label: def.label,
|
|
897
|
+
color: '#' + def.colorKey,
|
|
898
|
+
})), ...(ngDevMode ? [{ debugName: "flagSetFlags" }] : /* istanbul ignore next */ []));
|
|
899
|
+
// admin-only flags shown read-only when user is not admin
|
|
900
|
+
this.adminFlagDefs = computed(() => {
|
|
901
|
+
if (this.userLevel() >= 4)
|
|
902
|
+
return [];
|
|
903
|
+
return this.flagDefinitions().filter((def) => def.isAdmin === true);
|
|
904
|
+
}, ...(ngDevMode ? [{ debugName: "adminFlagDefs" }] : /* istanbul ignore next */ []));
|
|
905
|
+
// checked flag IDs derived from the bitmask value
|
|
906
|
+
this.checkedFlagIds = computed(() => {
|
|
907
|
+
const value = this._flagsValue();
|
|
908
|
+
return this.flagDefinitions()
|
|
909
|
+
.filter((def) => (value & def.id) !== 0)
|
|
910
|
+
.map((def) => String(def.id));
|
|
911
|
+
}, ...(ngDevMode ? [{ debugName: "checkedFlagIds" }] : /* istanbul ignore next */ []));
|
|
912
|
+
// update the metadata form whenever the item changes
|
|
913
|
+
effect(() => {
|
|
914
|
+
this.updateMetadataForm(this.item());
|
|
862
915
|
});
|
|
863
|
-
this.item$ = this._repository.item$;
|
|
864
|
-
this.parts$ = this._repository.parts$;
|
|
865
|
-
this.partGroups$ = this._repository.partGroups$;
|
|
866
|
-
this.layerPartInfos$ = this._repository.layers$;
|
|
867
|
-
this.facet$ = this._repository.facet$;
|
|
868
|
-
this.newPartDefinitions$ = this._repository.newPartDefinitions$;
|
|
869
|
-
// app
|
|
870
|
-
this.facets$ = this._appRepository.facets$;
|
|
871
|
-
this.typeThesaurus$ = this._appRepository.typeThesaurus$;
|
|
872
|
-
this.previewJKeys$ = this._appRepository.previewJKeys$;
|
|
873
|
-
this.previewFKeys$ = this._appRepository.previewFKeys$;
|
|
874
916
|
}
|
|
875
|
-
|
|
876
|
-
this._subs.push(this._authService.currentUser$.subscribe((user) => {
|
|
877
|
-
this.user.set(user || undefined);
|
|
878
|
-
this.userLevel.set(this._userLevelService.getCurrentUserLevel());
|
|
879
|
-
}));
|
|
880
|
-
// rebuild the flags controls array when flags definitions change
|
|
881
|
-
this._subs.push(this._appRepository.flags$.subscribe((defs) => {
|
|
882
|
-
this.flagDefinitions.set(defs);
|
|
883
|
-
this.buildFlagsControls();
|
|
884
|
-
}));
|
|
885
|
-
// when flags controls values change, update the flags value
|
|
886
|
-
this._subs.push(this.flagChecks.valueChanges.subscribe((_) => {
|
|
887
|
-
if (!this._flagsFrozen) {
|
|
888
|
-
this.flags.setValue(this.getFlagsValue());
|
|
889
|
-
}
|
|
890
|
-
}));
|
|
891
|
-
// update the metadata form when item changes (e.g. saved)
|
|
892
|
-
this._subs.push(this.item$.subscribe((item) => {
|
|
893
|
-
this.updateMetadataForm(item);
|
|
894
|
-
}));
|
|
895
|
-
// load the item (if any) and its lookup
|
|
917
|
+
ngOnInit() {
|
|
896
918
|
this._repository.load(this.id());
|
|
897
919
|
}
|
|
898
|
-
ngOnDestroy() {
|
|
899
|
-
for (const sub of this._subs) {
|
|
900
|
-
sub.unsubscribe();
|
|
901
|
-
}
|
|
902
|
-
}
|
|
903
920
|
canDeactivate() {
|
|
904
921
|
return !this.metadata.dirty;
|
|
905
922
|
}
|
|
906
|
-
/**
|
|
907
|
-
* Builds the array of flags controls according to the current flags
|
|
908
|
-
* definitions and the current flags value.
|
|
909
|
-
*/
|
|
910
|
-
buildFlagsControls() {
|
|
911
|
-
this._flagsFrozen = true;
|
|
912
|
-
this.flagChecks.clear();
|
|
913
|
-
for (const def of this.flagDefinitions()) {
|
|
914
|
-
const flagValue = def.id;
|
|
915
|
-
// tslint:disable-next-line: no-bitwise
|
|
916
|
-
const checked = (this.flags.value & flagValue) !== 0;
|
|
917
|
-
this.flagChecks.push(this._formBuilder.control(checked));
|
|
918
|
-
}
|
|
919
|
-
this._flagsFrozen = false;
|
|
920
|
-
}
|
|
921
|
-
/**
|
|
922
|
-
* Update the flags controls from the current flags value.
|
|
923
|
-
*/
|
|
924
|
-
updateFlagControls() {
|
|
925
|
-
if (!this.flagDefinitions()?.length) {
|
|
926
|
-
return;
|
|
927
|
-
}
|
|
928
|
-
this._flagsFrozen = true;
|
|
929
|
-
const value = this.flags.value;
|
|
930
|
-
for (let i = 0; i < this.flagDefinitions().length; i++) {
|
|
931
|
-
const flagValue = this.flagDefinitions()[i].id;
|
|
932
|
-
// tslint:disable-next-line: no-bitwise
|
|
933
|
-
const checked = (value & flagValue) !== 0;
|
|
934
|
-
this.flagChecks.at(i).setValue(checked);
|
|
935
|
-
}
|
|
936
|
-
this._flagsFrozen = false;
|
|
937
|
-
}
|
|
938
|
-
/**
|
|
939
|
-
* Get the flags value from the flags controls.
|
|
940
|
-
*/
|
|
941
|
-
getFlagsValue() {
|
|
942
|
-
let flagsValue = 0;
|
|
943
|
-
for (let i = 0; i < this.flagDefinitions()?.length; i++) {
|
|
944
|
-
const flagValue = this.flagDefinitions()[i].id;
|
|
945
|
-
if (this.flagChecks.at(i)?.value) {
|
|
946
|
-
// tslint:disable-next-line: no-bitwise
|
|
947
|
-
flagsValue |= flagValue;
|
|
948
|
-
}
|
|
949
|
-
}
|
|
950
|
-
return flagsValue;
|
|
951
|
-
}
|
|
952
923
|
updateMetadataForm(item) {
|
|
953
924
|
if (!item) {
|
|
954
925
|
this.metadata.reset();
|
|
955
|
-
this.updateFlagControls();
|
|
956
926
|
}
|
|
957
927
|
else {
|
|
958
928
|
this.title.setValue(item.title);
|
|
959
929
|
this.sortKey.setValue(item.sortKey);
|
|
960
930
|
this.description.setValue(item.description);
|
|
961
|
-
this.
|
|
962
|
-
this.group.setValue(item.groupId);
|
|
931
|
+
this.facetCtrl.setValue(item.facetId ?? null);
|
|
932
|
+
this.group.setValue(item.groupId ?? null);
|
|
963
933
|
this.flags.setValue(item.flags);
|
|
964
|
-
this.updateFlagControls();
|
|
965
934
|
this.metadata.markAsPristine();
|
|
966
935
|
}
|
|
967
936
|
}
|
|
937
|
+
/**
|
|
938
|
+
* Called when the FlagSetComponent emits new checked flag IDs.
|
|
939
|
+
* Converts the string IDs back to a bitmask integer and updates
|
|
940
|
+
* the flags form control, preserving admin-flag bits for non-admins.
|
|
941
|
+
*/
|
|
942
|
+
onFlagCheckedIdsChange(ids) {
|
|
943
|
+
let value = 0;
|
|
944
|
+
// non-admins cannot change admin flags: preserve their current bits
|
|
945
|
+
if (this.userLevel() < 4) {
|
|
946
|
+
const current = this.flags.value;
|
|
947
|
+
for (const def of this.flagDefinitions()) {
|
|
948
|
+
if (def.isAdmin && (current & def.id) !== 0) {
|
|
949
|
+
value |= def.id;
|
|
950
|
+
}
|
|
951
|
+
}
|
|
952
|
+
}
|
|
953
|
+
for (const id of ids) {
|
|
954
|
+
value |= Number(id);
|
|
955
|
+
}
|
|
956
|
+
this.flags.setValue(value);
|
|
957
|
+
this.flags.markAsDirty();
|
|
958
|
+
}
|
|
968
959
|
getTypeIdName(typeId) {
|
|
969
960
|
const typeThesaurus = this._appRepository.getTypeThesaurus();
|
|
970
961
|
if (!typeThesaurus) {
|
|
@@ -988,26 +979,29 @@ class ItemEditorComponent {
|
|
|
988
979
|
if (this.busy() || !this.metadata.valid) {
|
|
989
980
|
return;
|
|
990
981
|
}
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
if (!item) {
|
|
982
|
+
const currentItem = this._repository.getItem();
|
|
983
|
+
if (!currentItem) {
|
|
994
984
|
return;
|
|
995
985
|
}
|
|
996
|
-
item
|
|
997
|
-
item.
|
|
998
|
-
item.
|
|
999
|
-
item.
|
|
1000
|
-
item.
|
|
986
|
+
const item = { ...currentItem };
|
|
987
|
+
item.title = this.title.value?.trim() || '';
|
|
988
|
+
item.sortKey = this.sortKey.value?.trim() || '';
|
|
989
|
+
item.description = this.description.value?.trim() || '';
|
|
990
|
+
item.facetId = this.facetCtrl.value?.trim() || '';
|
|
991
|
+
item.groupId = this.group.value?.trim() || '';
|
|
1001
992
|
item.flags = this.flags.value;
|
|
1002
|
-
// save: this will trigger a change in the store's item, reflected here
|
|
1003
|
-
// by updating the metadata form
|
|
1004
993
|
this.busy.set(true);
|
|
1005
994
|
this._repository
|
|
1006
995
|
.save(item)
|
|
1007
996
|
.then((saved) => {
|
|
1008
997
|
this._messaging.sendMessage(MESSAGE_ITEM_LIST_REPOSITORY_RESET);
|
|
1009
|
-
//
|
|
1010
|
-
//
|
|
998
|
+
// mark form pristine immediately: in a zoneless app the effect that
|
|
999
|
+
// calls updateMetadataForm (and thus markAsPristine) is scheduled
|
|
1000
|
+
// asynchronously, so without this explicit call the pending-changes
|
|
1001
|
+
// guard would still see a dirty form and prompt the user even though
|
|
1002
|
+
// the item was just saved successfully.
|
|
1003
|
+
this.metadata.markAsPristine();
|
|
1004
|
+
// reload to force change in page URL for new items
|
|
1011
1005
|
if (!item.id) {
|
|
1012
1006
|
this.id.set(saved.id);
|
|
1013
1007
|
this._router.navigate(['/items', saved.id]);
|
|
@@ -1046,26 +1040,11 @@ class ItemEditorComponent {
|
|
|
1046
1040
|
return;
|
|
1047
1041
|
}
|
|
1048
1042
|
const route = this._libraryRouteService.buildPartEditorRoute(this.id(), 'new', typeId, roleId);
|
|
1049
|
-
|
|
1050
|
-
this._router.navigate([route.route], route.rid
|
|
1051
|
-
? {
|
|
1052
|
-
queryParams: {
|
|
1053
|
-
rid: route.rid,
|
|
1054
|
-
},
|
|
1055
|
-
}
|
|
1056
|
-
: {});
|
|
1043
|
+
this._router.navigate([route.route], route.rid ? { queryParams: { rid: route.rid } } : {});
|
|
1057
1044
|
}
|
|
1058
1045
|
editPart(part) {
|
|
1059
|
-
// build the target route to the appropriate part editor
|
|
1060
1046
|
const route = this._libraryRouteService.buildPartEditorRoute(part.itemId, part.id, part.typeId, part.roleId);
|
|
1061
|
-
|
|
1062
|
-
this._router.navigate([route.route], route.rid
|
|
1063
|
-
? {
|
|
1064
|
-
queryParams: {
|
|
1065
|
-
rid: route.rid,
|
|
1066
|
-
},
|
|
1067
|
-
}
|
|
1068
|
-
: {});
|
|
1047
|
+
this._router.navigate([route.route], route.rid ? { queryParams: { rid: route.rid } } : {});
|
|
1069
1048
|
}
|
|
1070
1049
|
previewPart(part) {
|
|
1071
1050
|
if (part.roleId?.startsWith('fr.')) {
|
|
@@ -1096,7 +1075,6 @@ class ItemEditorComponent {
|
|
|
1096
1075
|
if (!result) {
|
|
1097
1076
|
return;
|
|
1098
1077
|
}
|
|
1099
|
-
// delete
|
|
1100
1078
|
this.busy.set(true);
|
|
1101
1079
|
this._repository.deletePart(part.id).then((_) => {
|
|
1102
1080
|
this.busy.set(false);
|
|
@@ -1115,13 +1093,13 @@ class ItemEditorComponent {
|
|
|
1115
1093
|
if (part.roleId) {
|
|
1116
1094
|
name += ' for ' + this.getRoleIdName(part.roleId);
|
|
1117
1095
|
}
|
|
1118
|
-
this.busy.set(true);
|
|
1119
1096
|
this._dialogService
|
|
1120
1097
|
.confirm('Confirm Addition', `Add layer "${name}"?`)
|
|
1121
1098
|
.subscribe((result) => {
|
|
1122
1099
|
if (!result) {
|
|
1123
1100
|
return;
|
|
1124
1101
|
}
|
|
1102
|
+
this.busy.set(true);
|
|
1125
1103
|
this._repository
|
|
1126
1104
|
.addNewLayerPart(part.typeId, part.roleId)
|
|
1127
1105
|
.finally(() => this.busy.set(false));
|
|
@@ -1140,34 +1118,27 @@ class ItemEditorComponent {
|
|
|
1140
1118
|
data: {},
|
|
1141
1119
|
});
|
|
1142
1120
|
dialogRef.afterClosed().subscribe((targetItem) => {
|
|
1143
|
-
// nope if no target item or same item
|
|
1144
1121
|
if (!targetItem || part.itemId === targetItem.id) {
|
|
1145
1122
|
return;
|
|
1146
1123
|
}
|
|
1147
|
-
|
|
1148
|
-
if (this.facet.value !== targetItem.facetId) {
|
|
1124
|
+
if (this.facetCtrl.value !== targetItem.facetId) {
|
|
1149
1125
|
this._snackbar.open('Cannot copy part to an item with a different facet', 'OK');
|
|
1150
1126
|
return;
|
|
1151
1127
|
}
|
|
1152
|
-
// check if the part already exists in the target item
|
|
1153
1128
|
this.busy.set(true);
|
|
1154
1129
|
this._itemService
|
|
1155
1130
|
.partWithTypeAndRoleExists(targetItem.id, part.typeId, part.roleId)
|
|
1156
1131
|
.subscribe((exists) => {
|
|
1157
|
-
// part already exists, nope
|
|
1158
1132
|
if (exists) {
|
|
1159
1133
|
this._snackbar.open('Part already exists in target item', 'OK');
|
|
1160
1134
|
this.busy.set(false);
|
|
1161
1135
|
return;
|
|
1162
1136
|
}
|
|
1163
|
-
// else add part as a new part to the target item
|
|
1164
1137
|
part.id = '';
|
|
1165
1138
|
part.itemId = targetItem.id;
|
|
1166
1139
|
this._itemService.addPart(part).subscribe({
|
|
1167
1140
|
next: (_) => {
|
|
1168
|
-
this._snackbar.open('Part copied', 'OK', {
|
|
1169
|
-
duration: 3000,
|
|
1170
|
-
});
|
|
1141
|
+
this._snackbar.open('Part copied', 'OK', { duration: 3000 });
|
|
1171
1142
|
},
|
|
1172
1143
|
error: (error) => {
|
|
1173
1144
|
console.error(error);
|
|
@@ -1202,11 +1173,8 @@ class ItemEditorComponent {
|
|
|
1202
1173
|
.generateItems(data.count, this.id(), data.title, data.flags)
|
|
1203
1174
|
.subscribe({
|
|
1204
1175
|
next: (_) => {
|
|
1205
|
-
// reset the items list
|
|
1206
1176
|
this._messaging.sendMessage(MESSAGE_ITEM_LIST_REPOSITORY_RESET);
|
|
1207
|
-
this._snackbar.open('Items generated', 'OK', {
|
|
1208
|
-
duration: 3000,
|
|
1209
|
-
});
|
|
1177
|
+
this._snackbar.open('Items generated', 'OK', { duration: 3000 });
|
|
1210
1178
|
},
|
|
1211
1179
|
error: (error) => {
|
|
1212
1180
|
console.error(error);
|
|
@@ -1218,16 +1186,13 @@ class ItemEditorComponent {
|
|
|
1218
1186
|
});
|
|
1219
1187
|
});
|
|
1220
1188
|
}
|
|
1221
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.
|
|
1222
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: ItemEditorComponent, isStandalone: true, selector: "cadmus-item-editor", ngImport: i0, template: "<mat-card appearance=\"outlined\">\r\n <mat-card-header>\r\n <mat-card-subtitle>\r\n <cadmus-current-item-bar />\r\n </mat-card-subtitle>\r\n <!-- <mat-card-title>\r\n {{ (item$ | async)?.title || \"Item\" }}\r\n </mat-card-title>\r\n <mat-card-subtitle>\r\n {{ (item$ | async)?.description }}\r\n </mat-card-subtitle> -->\r\n </mat-card-header>\r\n <mat-card-content>\r\n <!-- @if (id()) {\r\n <p>\r\n ID:\r\n <input\r\n [cdkCopyToClipboard]=\"(item$ | async)?.id || ''\"\r\n type=\"text\"\r\n readonly=\"true\"\r\n spellcheck=\"false\"\r\n matTooltip=\"Click to copy\"\r\n [value]=\"(item$ | async)?.id\"\r\n class=\"id\"\r\n />\r\n </p>\r\n } @if (item$ | async; as item) {\r\n <p>\r\n Last saved {{ item.timeModified | date : \"yyyy-MM-dd HH:mm:ss\" }} by\r\n {{ item.userId }}.<br />\r\n Created {{ item.timeCreated | date : \"yyyy-MM-dd HH:mm:ss\" }} by\r\n {{ item.creatorId }}.\r\n </p>\r\n } -->\r\n @if (busy()) {\r\n <mat-progress-bar mode=\"indeterminate\" />\r\n }\r\n\r\n <!-- item content -->\r\n <mat-tab-group [selectedIndex]=\"id() ? 1 : 0\">\r\n <!-- metadata -->\r\n <mat-tab label=\"Metadata\">\r\n <form [formGroup]=\"metadata\" (ngSubmit)=\"save()\">\r\n <div class=\"form-row\">\r\n <!-- title -->\r\n <mat-form-field style=\"flex: 1 0 auto\">\r\n <mat-label>title</mat-label>\r\n <input matInput type=\"text\" id=\"title\" [formControl]=\"title\" />\r\n @if (\r\n title.hasError(\"required\") && (title.touched || title.dirty)\r\n ) {\r\n <mat-error>enter title</mat-error>\r\n }\r\n @if (\r\n title.hasError(\"maxLength\") && (title.touched || title.dirty)\r\n ) {\r\n <mat-error> title too long</mat-error>\r\n }\r\n </mat-form-field>\r\n\r\n <!-- sortKey -->\r\n <mat-form-field style=\"flex: 1 0 auto\">\r\n <mat-label>sort key</mat-label>\r\n <input\r\n matInput\r\n type=\"text\"\r\n id=\"sortKey\"\r\n [formControl]=\"sortKey\"\r\n />\r\n @if (\r\n sortKey.hasError(\"required\") &&\r\n (sortKey.touched || sortKey.dirty)\r\n ) {\r\n <mat-error>enter sort key</mat-error>\r\n }\r\n @if (\r\n sortKey.hasError(\"maxLength\") &&\r\n (sortKey.touched || sortKey.dirty)\r\n ) {\r\n <mat-error>sort key too long</mat-error>\r\n }\r\n </mat-form-field>\r\n </div>\r\n\r\n <!-- description -->\r\n <div>\r\n <mat-form-field class=\"full-width\">\r\n <mat-label>description</mat-label>\r\n <textarea\r\n rows=\"2\"\r\n matInput\r\n id=\"description\"\r\n [formControl]=\"description\"\r\n ></textarea>\r\n @if (\r\n description.hasError(\"required\") &&\r\n (description.touched || description.dirty)\r\n ) {\r\n <mat-error>enter description</mat-error>\r\n }\r\n @if (\r\n description.hasError(\"maxLength\") &&\r\n (description.touched || description.dirty)\r\n ) {\r\n <mat-error>description too long</mat-error>\r\n }\r\n </mat-form-field>\r\n </div>\r\n\r\n <!-- facet -->\r\n <div class=\"form-row\">\r\n <mat-form-field>\r\n <mat-label>facet</mat-label>\r\n <mat-select [formControl]=\"facet\" required=\"true\">\r\n @for (f of facets$ | async; track f.id) {\r\n <mat-option [value]=\"f.id\">\r\n {{ f.label }}\r\n </mat-option>\r\n }\r\n </mat-select>\r\n <mat-error>please select a facet</mat-error>\r\n </mat-form-field>\r\n\r\n <!-- group -->\r\n <mat-form-field>\r\n <mat-label>group ID</mat-label>\r\n <input matInput [formControl]=\"group\" />\r\n @if (\r\n group.hasError(\"maxLength\") && (group.dirty || group.touched)\r\n ) {\r\n <mat-error>too long</mat-error>\r\n }\r\n </mat-form-field>\r\n </div>\r\n\r\n <!-- flags -->\r\n <fieldset>\r\n <legend>flags</legend>\r\n @if (flagDefinitions().length) {\r\n <div formArrayName=\"flagChecks\">\r\n @for (c of flagChecks.controls; track c; let i = $index) {\r\n @if (\r\n userLevel() < 4 && flagDefinitions()[i].isAdmin === true\r\n ) {\r\n <span\r\n [style.color]=\"'#' + flagDefinitions()[i].colorKey\"\r\n style=\"margin-left: 12px\"\r\n >◆</span\r\n >\r\n \r\n {{ flagDefinitions()[i].label }}\r\n } @else {\r\n <mat-checkbox class=\"flag\" [formControlName]=\"i\">\r\n <span [style.color]=\"'#' + flagDefinitions()[i].colorKey\"\r\n >⬤</span\r\n >\r\n \r\n {{ flagDefinitions()[i].label }}\r\n </mat-checkbox>\r\n }\r\n }\r\n </div>\r\n }\r\n </fieldset>\r\n <br />\r\n\r\n <!-- action buttons -->\r\n @if (userLevel() > 1) {\r\n <div class=\"form-row\">\r\n <button\r\n type=\"button\"\r\n mat-flat-button\r\n class=\"mat-warn\"\r\n (click)=\"onGenerateItems()\"\r\n >\r\n <mat-icon>copy_all</mat-icon> generate\r\n </button>\r\n <button\r\n type=\"submit\"\r\n mat-flat-button\r\n class=\"mat-primary\"\r\n [disabled]=\"busy()\"\r\n matTooltip=\"Save metadata\"\r\n (click)=\"save()\"\r\n >\r\n <mat-icon>save</mat-icon> save\r\n </button>\r\n </div>\r\n }\r\n </form>\r\n </mat-tab>\r\n\r\n <!-- parts -->\r\n @if (id()) {\r\n <mat-tab label=\"Parts\">\r\n <div class=\"new-part\">\r\n <form [formGroup]=\"newPart\" class=\"form-row\">\r\n <mat-form-field>\r\n <mat-label>part</mat-label>\r\n <mat-select [formControl]=\"newPartType\" required>\r\n @for (\r\n p of newPartDefinitions$ | async;\r\n track p.typeId + \":\" + (p.roleId || \"\")\r\n ) {\r\n <mat-option [value]=\"p\">\r\n <span\r\n [style.color]=\"'#' + p.colorKey\"\r\n class=\"new-part-icon\"\r\n >⬤</span\r\n >\r\n {{ getPartIdName(p.typeId, p.roleId) }}\r\n </mat-option>\r\n }\r\n </mat-select>\r\n <mat-error>part type required</mat-error>\r\n </mat-form-field>\r\n <button\r\n mat-flat-button\r\n class=\"mat-primary\"\r\n type=\"button\"\r\n [disabled]=\"userLevel() < 2 || busy() || !newPart.valid\"\r\n (click)=\"addPart()\"\r\n matTooltip=\"Add a new part of the selected type\"\r\n >\r\n <mat-icon>add_circle</mat-icon>\r\n part\r\n </button>\r\n </form>\r\n </div>\r\n <mat-divider></mat-divider>\r\n @for (group of partGroups$ | async; track group.key) {\r\n <mat-expansion-panel expanded=\"true\" class=\"group-header\">\r\n <mat-expansion-panel-header>\r\n <mat-panel-title\r\n ><strong>{{ group.label }}</strong></mat-panel-title\r\n >\r\n <mat-panel-description>{{\r\n group.parts.length\r\n }}</mat-panel-description>\r\n </mat-expansion-panel-header>\r\n <table class=\"parts-table\">\r\n <thead>\r\n <tr>\r\n <th></th>\r\n <th>type</th>\r\n <th>role</th>\r\n <th class=\"noif-lt-xs\">modified</th>\r\n <th class=\"noif-lt-xs\">user</th>\r\n </tr>\r\n </thead>\r\n <tbody>\r\n @for (\r\n part of group.parts;\r\n track part.typeId + \":\" + (part.roleId || \"\")\r\n ) {\r\n <tr>\r\n <!-- edit -->\r\n <td class=\"fit-width\">\r\n <button\r\n mat-icon-button\r\n type=\"button\"\r\n [disabled]=\"busy()\"\r\n (click)=\"editPart(part)\"\r\n matTooltip=\"Edit this part\"\r\n >\r\n <mat-icon class=\"mat-primary\">create</mat-icon>\r\n </button>\r\n <!-- delete -->\r\n @if (\r\n user()?.roles?.length &&\r\n (user()?.roles?.includes(\"admin\") ||\r\n user()?.roles?.includes(\"editor\") ||\r\n user()?.roles?.includes(\"operator\"))\r\n ) {\r\n <button\r\n mat-icon-button\r\n type=\"button\"\r\n [disabled]=\"userLevel() < 2 || busy()\"\r\n (click)=\"deletePart(part)\"\r\n matTooltip=\"Delete this part\"\r\n >\r\n <mat-icon class=\"mat-warn\">delete</mat-icon>\r\n </button>\r\n }\r\n <!-- copy -->\r\n <button\r\n mat-icon-button\r\n type=\"button\"\r\n matTooltip=\"Copy this part ID\"\r\n [cdkCopyToClipboard]=\"part.id\"\r\n >\r\n <mat-icon>assignment</mat-icon>\r\n </button>\r\n <!-- copy into item -->\r\n <button\r\n mat-icon-button\r\n type=\"button\"\r\n matTooltip=\"Copy part into another item\"\r\n (click)=\"onCopyPart(part)\"\r\n >\r\n <mat-icon>open_in_new</mat-icon>\r\n </button>\r\n <!-- preview -->\r\n @if (\r\n part\r\n | hasPreview\r\n : (previewJKeys$ | async)\r\n : (previewFKeys$ | async)\r\n ) {\r\n <button\r\n mat-icon-button\r\n type=\"button\"\r\n matTooltip=\"Preview this part\"\r\n (click)=\"previewPart(part)\"\r\n >\r\n <mat-icon>preview</mat-icon>\r\n </button>\r\n }\r\n </td>\r\n <td>\r\n <cadmus-part-badge\r\n [partTypeIds]=\"part\"\r\n [facetDefinition]=\"(facet$ | async) || undefined\"\r\n [badgeType]=\"1\"\r\n [typeThesaurus]=\"\r\n (typeThesaurus$ | async) || undefined\r\n \"\r\n />\r\n </td>\r\n <td>\r\n <cadmus-part-badge\r\n [partTypeIds]=\"part\"\r\n [facetDefinition]=\"(facet$ | async) || undefined\"\r\n [badgeType]=\"2\"\r\n [typeThesaurus]=\"\r\n (typeThesaurus$ | async) || undefined\r\n \"\r\n />\r\n </td>\r\n <td class=\"noif-lt-xs\">\r\n {{ part.timeModified | date: \"yyyy-MM-dd HH:mm:ss\" }}\r\n </td>\r\n <td class=\"noif-lt-xs\">{{ part.userId }}</td>\r\n </tr>\r\n }\r\n </tbody>\r\n </table>\r\n </mat-expansion-panel>\r\n }\r\n <cadmus-missing-parts\r\n [facetDefinition]=\"(facet$ | async) || undefined\"\r\n [partDefinitions]=\"(facet$ | async)?.partDefinitions\"\r\n [parts]=\"(parts$ | async) || undefined\"\r\n [typeThesaurus]=\"(typeThesaurus$ | async) || undefined\"\r\n (addRequest)=\"addPart($event)\"\r\n />\r\n </mat-tab>\r\n }\r\n @if (id()) {\r\n <mat-tab label=\"Layers\">\r\n @if (layerPartInfos$ | async; as parts) {\r\n <table id=\"layers\">\r\n <thead>\r\n <th></th>\r\n <th>type</th>\r\n <th>role</th>\r\n <th>frr.</th>\r\n <th>last modified</th>\r\n </thead>\r\n <tbody>\r\n @for (\r\n part of parts;\r\n track part.typeId + \":\" + (part.roleId || \"\")\r\n ) {\r\n <tr>\r\n <td class=\"fit-width\">\r\n @if (!part.isAbsent) {\r\n <button\r\n type=\"button\"\r\n mat-icon-button\r\n matTooltip=\"Edit this layer part\"\r\n (click)=\"editPart(part)\"\r\n >\r\n <mat-icon class=\"mat-primary\">edit</mat-icon>\r\n </button>\r\n }\r\n @if (part.isAbsent) {\r\n <button\r\n type=\"button\"\r\n mat-icon-button\r\n matTooltip=\"Add this layer part\"\r\n [disabled]=\"userLevel() < 2\"\r\n (click)=\"addLayerPart(part)\"\r\n >\r\n <mat-icon class=\"mat-primary\">add_circle</mat-icon>\r\n </button>\r\n }\r\n @if (!part.isAbsent) {\r\n <button\r\n type=\"button\"\r\n mat-icon-button\r\n matTooltip=\"Delete this layer part\"\r\n [disabled]=\"userLevel() < 2\"\r\n (click)=\"deletePart(part)\"\r\n >\r\n <mat-icon class=\"mat-warn\">delete</mat-icon>\r\n </button>\r\n }\r\n @if (!part.isAbsent) {\r\n <button\r\n mat-icon-button\r\n type=\"button\"\r\n matTooltip=\"Copy this part ID\"\r\n [cdkCopyToClipboard]=\"part.id\"\r\n >\r\n <mat-icon>assignment</mat-icon>\r\n </button>\r\n }\r\n </td>\r\n <td>\r\n <cadmus-part-badge\r\n [partTypeIds]=\"part\"\r\n [facetDefinition]=\"(facet$ | async) || undefined\"\r\n [badgeType]=\"1\"\r\n [typeThesaurus]=\"(typeThesaurus$ | async) || undefined\"\r\n />\r\n </td>\r\n <td>\r\n <cadmus-part-badge\r\n [partTypeIds]=\"part\"\r\n [facetDefinition]=\"(facet$ | async) || undefined\"\r\n [badgeType]=\"2\"\r\n [typeThesaurus]=\"(typeThesaurus$ | async) || undefined\"\r\n />\r\n </td>\r\n <td\r\n [class.count-n]=\"part.fragmentCount\"\r\n [class.count-z]=\"!part.fragmentCount\"\r\n >\r\n {{ part.fragmentCount }}\r\n </td>\r\n <td>\r\n @if (!part.isAbsent) {\r\n <span>\r\n {{ part.timeModified | date: \"yyyy-MM-dd HH:mm:ss\" }}\r\n </span>\r\n }\r\n </td>\r\n </tr>\r\n }\r\n </tbody>\r\n </table>\r\n }\r\n </mat-tab>\r\n }\r\n @if (parts$ | async; as parts) {\r\n <mat-tab label=\"Th-Scopes\">\r\n <!-- [parts]=\"parts | sort: 'typeId' | sort: 'roleId'\" -->\r\n <cadmus-parts-scope-editor\r\n [parts]=\"parts\"\r\n [readonly]=\"userLevel() < 2 || busy() ? true : false\"\r\n (setScopeRequest)=\"setPartsScope($event)\"\r\n />\r\n </mat-tab>\r\n }\r\n </mat-tab-group>\r\n </mat-card-content>\r\n</mat-card>\r\n", styles: [".full-width{width:100%}table{width:100%;border-collapse:collapse}tbody tr:nth-child(odd){background-color:var(--mat-sys-surface-container)}th{text-align:left;font-weight:400;color:var(--mat-sys-on-surface-variant)}tbody tr:hover{background-color:var(--mat-sys-surface-container-high)}td.fit-width{width:1px;white-space:nowrap}tbody tr.selected{background-color:var(--mat-sys-secondary-container);color:var(--mat-sys-on-secondary-container)}table#layers td{padding:0 6px}table#layers th{text-align:left}div.new-part{margin-left:32px}span.new-part-role{color:var(--mat-sys-on-surface-variant);margin-left:8px;vertical-align:middle}span.new-part-icon{margin:0 4px;vertical-align:middle}td.count-n{text-align:center;color:var(--mat-sys-success)}td.count-z{text-align:center;color:var(--mat-sys-error)}input.id{font-family:Courier New,Courier,monospace;color:var(--mat-sys-on-surface-variant);min-width:22em}.flag{margin-left:10px}.form-row{display:flex;gap:8px;align-items:center;flex-wrap:wrap}.form-row *{flex:0 0 auto}.group-header{border-top:1px solid var(--mat-sys-on-surface-variant)}table.parts-table{width:100%}table.parts-table th{text-align:left}fieldset{border:1px solid var(--mat-sys-on-surface-variant);border-radius:6px;padding:6px;margin:8px 0}@media only screen and (max-width:599px){.noif-lt-xs{display:none}}\n"], dependencies: [{ kind: "component", type: MatCard, selector: "mat-card", inputs: ["appearance"], exportAs: ["matCard"] }, { kind: "component", type: MatCardHeader, selector: "mat-card-header" }, { kind: "directive", type: MatCardSubtitle, selector: "mat-card-subtitle, [mat-card-subtitle], [matCardSubtitle]" }, { kind: "directive", type: MatCardContent, selector: "mat-card-content" }, { kind: "directive", type: MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "directive", type: CdkCopyToClipboard, selector: "[cdkCopyToClipboard]", inputs: ["cdkCopyToClipboard", "cdkCopyToClipboardAttempts"], outputs: ["cdkCopyToClipboardCopied"] }, { kind: "component", type: MatProgressBar, selector: "mat-progress-bar", inputs: ["color", "value", "bufferValue", "mode"], outputs: ["animationEnd"], exportAs: ["matProgressBar"] }, { kind: "component", type: MatTabGroup, selector: "mat-tab-group", inputs: ["color", "fitInkBarToContent", "mat-stretch-tabs", "mat-align-tabs", "dynamicHeight", "selectedIndex", "headerPosition", "animationDuration", "contentTabIndex", "disablePagination", "disableRipple", "preserveContent", "backgroundColor", "aria-label", "aria-labelledby"], outputs: ["selectedIndexChange", "focusChange", "animationDone", "selectedTabChange"], exportAs: ["matTabGroup"] }, { kind: "component", type: MatTab, selector: "mat-tab", inputs: ["disabled", "label", "aria-label", "aria-labelledby", "labelClass", "bodyClass", "id"], exportAs: ["matTab"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1$1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1$1.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$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],[formArray],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.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { 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: "directive", type: i1$1.FormArrayName, selector: "[formArrayName]", inputs: ["formArrayName"] }, { kind: "component", type: MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: MatLabel, selector: "mat-label" }, { kind: "directive", type: 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: "directive", type: MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "component", type: 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: MatOption, selector: "mat-option", inputs: ["value", "id", "disabled"], outputs: ["onSelectionChange"], exportAs: ["matOption"] }, { kind: "component", type: MatCheckbox, selector: "mat-checkbox", inputs: ["aria-label", "aria-labelledby", "aria-describedby", "aria-expanded", "aria-controls", "aria-owns", "id", "required", "labelPosition", "name", "value", "disableRipple", "tabIndex", "color", "disabledInteractive", "checked", "disabled", "indeterminate"], outputs: ["change", "indeterminateChange"], exportAs: ["matCheckbox"] }, { kind: "component", type: 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: "component", type: MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: MatDivider, selector: "mat-divider", inputs: ["vertical", "inset"] }, { kind: "component", type: MatExpansionPanel, selector: "mat-expansion-panel", inputs: ["hideToggle", "togglePosition"], outputs: ["afterExpand", "afterCollapse"], exportAs: ["matExpansionPanel"] }, { kind: "component", type: MatExpansionPanelHeader, selector: "mat-expansion-panel-header", inputs: ["expandedHeight", "collapsedHeight", "tabIndex"] }, { kind: "directive", type: MatExpansionPanelTitle, selector: "mat-panel-title" }, { kind: "directive", type: MatExpansionPanelDescription, selector: "mat-panel-description" }, { kind: "component", type: MatIconButton, selector: "button[mat-icon-button], a[mat-icon-button], button[matIconButton], a[matIconButton]", exportAs: ["matButton", "matAnchor"] }, { kind: "component", type: MissingPartsComponent, selector: "cadmus-missing-parts", inputs: ["facetDefinition", "partDefinitions", "parts", "typeThesaurus"], outputs: ["addRequest"] }, { kind: "component", type: PartsScopeEditorComponent, selector: "cadmus-parts-scope-editor", inputs: ["parts", "readonly"], outputs: ["setScopeRequest"] }, { kind: "component", type: PartBadgeComponent, selector: "cadmus-part-badge", inputs: ["badgeType", "typeThesaurus", "facetDefinition", "partTypeIds"] }, { kind: "component", type: CurrentItemBarComponent, selector: "cadmus-current-item-bar" }, { kind: "pipe", type: AsyncPipe, name: "async" }, { kind: "pipe", type: DatePipe, name: "date" }, { kind: "pipe", type: HasPreviewPipe, name: "hasPreview" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1189
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.6", ngImport: i0, type: ItemEditorComponent, deps: [{ token: i2$1.ItemRefLookupService }, { token: i2.MatDialog }, { token: i3$1.Router }, { token: i3$1.ActivatedRoute }, { token: i4.MatSnackBar }, { token: i1.AppRepository }, { token: EditedItemRepository }, { token: i7.ItemService }, { token: i8.LibraryRouteService }, { token: i3.DialogService }, { token: i10.AuthJwtService }, { token: i7.UserLevelService }, { token: i7.MessagingService }, { token: i1$1.FormBuilder }], target: i0.ɵɵFactoryTarget.Component });
|
|
1190
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.6", type: ItemEditorComponent, isStandalone: true, selector: "cadmus-item-editor", ngImport: i0, template: "<mat-card appearance=\"outlined\">\n <mat-card-content>\n <div>\n <cadmus-current-item-bar />\n </div>\n @if (busy()) {\n <mat-progress-bar mode=\"indeterminate\" />\n }\n\n <!-- item content -->\n <mat-tab-group [selectedIndex]=\"id() ? 1 : 0\">\n <!-- metadata -->\n <mat-tab label=\"Metadata\">\n <form [formGroup]=\"metadata\" (ngSubmit)=\"save()\">\n <div class=\"form-row\">\n <!-- title -->\n <mat-form-field class=\"flex-field\">\n <mat-label>title</mat-label>\n <input matInput type=\"text\" id=\"title\" [formControl]=\"title\" />\n @if (\n title.hasError(\"required\") && (title.touched || title.dirty)\n ) {\n <mat-error>enter title</mat-error>\n }\n @if (\n title.hasError(\"maxLength\") && (title.touched || title.dirty)\n ) {\n <mat-error>title too long</mat-error>\n }\n </mat-form-field>\n\n <!-- sortKey -->\n <mat-form-field class=\"flex-field\">\n <mat-label>sort key</mat-label>\n <input\n matInput\n type=\"text\"\n id=\"sortKey\"\n [formControl]=\"sortKey\"\n />\n @if (\n sortKey.hasError(\"required\") &&\n (sortKey.touched || sortKey.dirty)\n ) {\n <mat-error>enter sort key</mat-error>\n }\n @if (\n sortKey.hasError(\"maxLength\") &&\n (sortKey.touched || sortKey.dirty)\n ) {\n <mat-error>sort key too long</mat-error>\n }\n </mat-form-field>\n </div>\n\n <!-- description -->\n <div>\n <mat-form-field class=\"full-width\">\n <mat-label>description</mat-label>\n <textarea\n rows=\"2\"\n matInput\n id=\"description\"\n [formControl]=\"description\"\n ></textarea>\n @if (\n description.hasError(\"required\") &&\n (description.touched || description.dirty)\n ) {\n <mat-error>enter description</mat-error>\n }\n @if (\n description.hasError(\"maxLength\") &&\n (description.touched || description.dirty)\n ) {\n <mat-error>description too long</mat-error>\n }\n </mat-form-field>\n </div>\n\n <!-- facet -->\n <div class=\"form-row\">\n <mat-form-field>\n <mat-label>facet</mat-label>\n <mat-select [formControl]=\"facetCtrl\" required=\"true\">\n @for (f of facets(); track f.id) {\n <mat-option [value]=\"f.id\">\n {{ f.label }}\n </mat-option>\n }\n </mat-select>\n <mat-error>please select a facet</mat-error>\n </mat-form-field>\n\n <!-- group -->\n <mat-form-field>\n <mat-label>group ID</mat-label>\n <input matInput [formControl]=\"group\" />\n @if (\n group.hasError(\"maxLength\") && (group.dirty || group.touched)\n ) {\n <mat-error>too long</mat-error>\n }\n </mat-form-field>\n </div>\n\n <!-- flags -->\n <fieldset>\n <legend>flags</legend>\n <!-- read-only admin flags for non-admin users -->\n @if (adminFlagDefs().length) {\n <div class=\"admin-flags\">\n @for (def of adminFlagDefs(); track def.id) {\n <span class=\"admin-flag\">\n <span [style.color]=\"'#' + def.colorKey\">◆</span>\n {{ def.label }}\n </span>\n }\n </div>\n }\n <!-- editable flags -->\n @if (flagSetFlags().length) {\n <cadmus-ui-flag-set\n [hideToolbar]=\"true\"\n [flags]=\"flagSetFlags()\"\n [checkedIds]=\"checkedFlagIds()\"\n (checkedIdsChange)=\"onFlagCheckedIdsChange($event)\"\n />\n }\n </fieldset>\n <br />\n\n <!-- action buttons -->\n @if (userLevel() > 1) {\n <div class=\"form-row\">\n <button\n type=\"button\"\n mat-flat-button\n class=\"mat-warn\"\n (click)=\"onGenerateItems()\"\n >\n <mat-icon>copy_all</mat-icon> generate\n </button>\n <button\n type=\"submit\"\n mat-flat-button\n class=\"mat-primary\"\n [disabled]=\"busy()\"\n matTooltip=\"Save metadata\"\n (click)=\"save()\"\n >\n <mat-icon>save</mat-icon> save\n </button>\n </div>\n }\n </form>\n </mat-tab>\n\n <!-- parts -->\n @if (id()) {\n <mat-tab label=\"Parts\">\n <div class=\"new-part\">\n <form [formGroup]=\"newPart\" class=\"form-row\">\n <mat-form-field>\n <mat-label>part</mat-label>\n <mat-select [formControl]=\"newPartType\" required>\n @for (\n p of newPartDefinitions();\n track p.typeId + \":\" + (p.roleId || \"\")\n ) {\n <mat-option [value]=\"p\">\n <span\n [style.color]=\"'#' + p.colorKey\"\n class=\"new-part-icon\"\n >⬤</span\n >\n {{ getPartIdName(p.typeId, p.roleId) }}\n </mat-option>\n }\n </mat-select>\n <mat-error>part type required</mat-error>\n </mat-form-field>\n <button\n mat-flat-button\n class=\"mat-primary\"\n type=\"button\"\n [disabled]=\"userLevel() < 2 || busy() || !newPart.valid\"\n (click)=\"addPart()\"\n matTooltip=\"Add a new part of the selected type\"\n >\n <mat-icon>add_circle</mat-icon>\n part\n </button>\n </form>\n </div>\n <mat-divider></mat-divider>\n @for (group of partGroups(); track group.key) {\n <mat-expansion-panel expanded=\"true\" class=\"group-header\">\n <mat-expansion-panel-header>\n <mat-panel-title\n ><strong>{{ group.label }}</strong></mat-panel-title\n >\n <mat-panel-description>{{\n group.parts.length\n }}</mat-panel-description>\n </mat-expansion-panel-header>\n <table class=\"parts-table\">\n <thead>\n <tr>\n <th></th>\n <th>type</th>\n <th>role</th>\n <th class=\"noif-lt-xs\">modified</th>\n <th class=\"noif-lt-xs\">user</th>\n </tr>\n </thead>\n <tbody>\n @for (\n part of group.parts;\n track part.typeId + \":\" + (part.roleId || \"\")\n ) {\n <tr>\n <!-- edit -->\n <td class=\"fit-width\">\n <button\n mat-icon-button\n type=\"button\"\n [disabled]=\"busy()\"\n (click)=\"editPart(part)\"\n matTooltip=\"Edit this part\"\n >\n <mat-icon class=\"mat-primary\">create</mat-icon>\n </button>\n <!-- delete -->\n @if (\n user()?.roles?.length &&\n (user()?.roles?.includes(\"admin\") ||\n user()?.roles?.includes(\"editor\") ||\n user()?.roles?.includes(\"operator\"))\n ) {\n <button\n mat-icon-button\n type=\"button\"\n [disabled]=\"userLevel() < 2 || busy()\"\n (click)=\"deletePart(part)\"\n matTooltip=\"Delete this part\"\n >\n <mat-icon class=\"mat-warn\">delete</mat-icon>\n </button>\n }\n <!-- copy ID -->\n <button\n mat-icon-button\n type=\"button\"\n matTooltip=\"Copy this part ID\"\n [cdkCopyToClipboard]=\"part.id\"\n >\n <mat-icon>assignment</mat-icon>\n </button>\n <!-- copy into item -->\n <button\n mat-icon-button\n type=\"button\"\n matTooltip=\"Copy part into another item\"\n (click)=\"onCopyPart(part)\"\n >\n <mat-icon>open_in_new</mat-icon>\n </button>\n <!-- preview -->\n @if (\n part | hasPreview: previewJKeys() : previewFKeys()\n ) {\n <button\n mat-icon-button\n type=\"button\"\n matTooltip=\"Preview this part\"\n (click)=\"previewPart(part)\"\n >\n <mat-icon>preview</mat-icon>\n </button>\n }\n </td>\n <td>\n <cadmus-part-badge\n [partTypeIds]=\"part\"\n [facetDefinition]=\"facet()\"\n [badgeType]=\"1\"\n [typeThesaurus]=\"typeThesaurus()\"\n />\n </td>\n <td>\n <cadmus-part-badge\n [partTypeIds]=\"part\"\n [facetDefinition]=\"facet()\"\n [badgeType]=\"2\"\n [typeThesaurus]=\"typeThesaurus()\"\n />\n </td>\n <td class=\"noif-lt-xs\">\n {{ part.timeModified | date: \"yyyy-MM-dd HH:mm:ss\" }}\n </td>\n <td class=\"noif-lt-xs\">{{ part.userId }}</td>\n </tr>\n }\n </tbody>\n </table>\n </mat-expansion-panel>\n }\n <cadmus-missing-parts\n [facetDefinition]=\"facet()\"\n [partDefinitions]=\"facet()?.partDefinitions\"\n [parts]=\"parts()\"\n [typeThesaurus]=\"typeThesaurus()\"\n (addRequest)=\"addPart($event)\"\n />\n </mat-tab>\n }\n\n <!-- layers -->\n @if (id()) {\n <mat-tab label=\"Layers\">\n <table id=\"layers\">\n <thead>\n <th aria-label=\"actions\"></th>\n <th>type</th>\n <th>role</th>\n <th>frr.</th>\n <th>last modified</th>\n </thead>\n <tbody>\n @for (\n part of layerPartInfos();\n track part.typeId + \":\" + (part.roleId || \"\")\n ) {\n <tr>\n <td class=\"fit-width\">\n @if (!part.isAbsent) {\n <button\n type=\"button\"\n mat-icon-button\n matTooltip=\"Edit this layer part\"\n (click)=\"editPart(part)\"\n >\n <mat-icon class=\"mat-primary\">edit</mat-icon>\n </button>\n }\n @if (part.isAbsent) {\n <button\n type=\"button\"\n mat-icon-button\n matTooltip=\"Add this layer part\"\n [disabled]=\"userLevel() < 2\"\n (click)=\"addLayerPart(part)\"\n >\n <mat-icon class=\"mat-primary\">add_circle</mat-icon>\n </button>\n }\n @if (!part.isAbsent) {\n <button\n type=\"button\"\n mat-icon-button\n matTooltip=\"Delete this layer part\"\n [disabled]=\"userLevel() < 2\"\n (click)=\"deletePart(part)\"\n >\n <mat-icon class=\"mat-warn\">delete</mat-icon>\n </button>\n }\n @if (!part.isAbsent) {\n <button\n mat-icon-button\n type=\"button\"\n matTooltip=\"Copy this part ID\"\n [cdkCopyToClipboard]=\"part.id\"\n >\n <mat-icon>assignment</mat-icon>\n </button>\n }\n </td>\n <td>\n <cadmus-part-badge\n [partTypeIds]=\"part\"\n [facetDefinition]=\"facet()\"\n [badgeType]=\"1\"\n [typeThesaurus]=\"typeThesaurus()\"\n />\n </td>\n <td>\n <cadmus-part-badge\n [partTypeIds]=\"part\"\n [facetDefinition]=\"facet()\"\n [badgeType]=\"2\"\n [typeThesaurus]=\"typeThesaurus()\"\n />\n </td>\n <td\n [class.count-n]=\"part.fragmentCount\"\n [class.count-z]=\"!part.fragmentCount\"\n >\n {{ part.fragmentCount }}\n </td>\n <td>\n @if (!part.isAbsent) {\n <span>\n {{ part.timeModified | date: \"yyyy-MM-dd HH:mm:ss\" }}\n </span>\n }\n </td>\n </tr>\n }\n </tbody>\n </table>\n </mat-tab>\n }\n\n <!-- thesaurus scopes -->\n @if (parts().length) {\n <mat-tab label=\"Th-Scopes\">\n <cadmus-parts-scope-editor\n [parts]=\"parts()\"\n [readonly]=\"userLevel() < 2 || busy() ? true : false\"\n (setScopeRequest)=\"setPartsScope($event)\"\n />\n </mat-tab>\n }\n </mat-tab-group>\n </mat-card-content>\n</mat-card>\n", styles: [".full-width{width:100%}.flex-field{flex:1 0 auto}table{width:100%;border-collapse:collapse;color:var(--mat-sys-on-surface-variant)}tbody tr:nth-child(odd){background-color:var(--mat-sys-surface-container)}th{text-align:left;font-weight:400;color:var(--mat-sys-on-surface-variant)}tbody tr:hover{background-color:var(--mat-sys-surface-container-high)}td.fit-width{width:1px;white-space:nowrap}tbody tr.selected{background-color:var(--mat-sys-secondary-container);color:var(--mat-sys-on-secondary-container)}table#layers td{padding:0 6px}table#layers th{text-align:left}div.new-part{margin-left:32px}span.new-part-role{color:var(--mat-sys-on-surface-variant);margin-left:8px;vertical-align:middle}span.new-part-icon{margin:0 4px;vertical-align:middle}td.count-n{text-align:center;color:var(--mat-sys-success)}td.count-z{text-align:center;color:var(--mat-sys-error)}input.id{font-family:Courier New,Courier,monospace;color:var(--mat-sys-on-surface-variant);min-width:22em}.admin-flags{margin-bottom:4px}.admin-flag{margin-left:12px}.form-row{display:flex;gap:8px;align-items:center;flex-wrap:wrap}.form-row *{flex:0 0 auto}.group-header{margin-top:6px}table.parts-table{width:100%}table.parts-table th{text-align:left}fieldset{border:1px solid var(--mat-sys-on-surface-variant);border-radius:6px;padding:6px;margin:8px 0}@media only screen and (max-width:599px){.noif-lt-xs{display:none}}\n"], dependencies: [{ kind: "component", type: MatCard, selector: "mat-card", inputs: ["appearance"], exportAs: ["matCard"] }, { kind: "directive", type: MatCardContent, selector: "mat-card-content" }, { kind: "directive", type: MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "directive", type: CdkCopyToClipboard, selector: "[cdkCopyToClipboard]", inputs: ["cdkCopyToClipboard", "cdkCopyToClipboardAttempts"], outputs: ["cdkCopyToClipboardCopied"] }, { kind: "component", type: MatProgressBar, selector: "mat-progress-bar", inputs: ["color", "value", "bufferValue", "mode"], outputs: ["animationEnd"], exportAs: ["matProgressBar"] }, { kind: "component", type: MatTabGroup, selector: "mat-tab-group", inputs: ["color", "fitInkBarToContent", "mat-stretch-tabs", "mat-align-tabs", "dynamicHeight", "selectedIndex", "headerPosition", "animationDuration", "contentTabIndex", "disablePagination", "disableRipple", "preserveContent", "backgroundColor", "aria-label", "aria-labelledby"], outputs: ["selectedIndexChange", "focusChange", "animationDone", "selectedTabChange"], exportAs: ["matTabGroup"] }, { kind: "component", type: MatTab, selector: "mat-tab", inputs: ["disabled", "label", "aria-label", "aria-labelledby", "labelClass", "bodyClass", "id"], exportAs: ["matTab"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1$1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1$1.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$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],[formArray],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.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "directive", type: i1$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "component", type: MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: MatLabel, selector: "mat-label" }, { kind: "directive", type: 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: "directive", type: MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "component", type: 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: MatOption, selector: "mat-option", inputs: ["value", "id", "disabled"], outputs: ["onSelectionChange"], exportAs: ["matOption"] }, { kind: "component", type: 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: "component", type: MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: MatDivider, selector: "mat-divider", inputs: ["vertical", "inset"] }, { kind: "component", type: MatExpansionPanel, selector: "mat-expansion-panel", inputs: ["hideToggle", "togglePosition"], outputs: ["afterExpand", "afterCollapse"], exportAs: ["matExpansionPanel"] }, { kind: "component", type: MatExpansionPanelHeader, selector: "mat-expansion-panel-header", inputs: ["expandedHeight", "collapsedHeight", "tabIndex"] }, { kind: "directive", type: MatExpansionPanelTitle, selector: "mat-panel-title" }, { kind: "directive", type: MatExpansionPanelDescription, selector: "mat-panel-description" }, { kind: "component", type: MatIconButton, selector: "button[mat-icon-button], a[mat-icon-button], button[matIconButton], a[matIconButton]", exportAs: ["matButton", "matAnchor"] }, { kind: "component", type: MissingPartsComponent, selector: "cadmus-missing-parts", inputs: ["facetDefinition", "partDefinitions", "parts", "typeThesaurus"], outputs: ["addRequest"] }, { kind: "component", type: PartsScopeEditorComponent, selector: "cadmus-parts-scope-editor", inputs: ["parts", "readonly"], outputs: ["setScopeRequest"] }, { kind: "component", type: PartBadgeComponent, selector: "cadmus-part-badge", inputs: ["badgeType", "typeThesaurus", "facetDefinition", "partTypeIds"] }, { kind: "component", type: CurrentItemBarComponent, selector: "cadmus-current-item-bar" }, { kind: "component", type: FlagSetComponent, selector: "cadmus-ui-flag-set", inputs: ["flags", "checkedIds", "allowCustom", "hideToolbar", "numbering"], outputs: ["checkedIdsChange"] }, { kind: "pipe", type: DatePipe, name: "date" }, { kind: "pipe", type: HasPreviewPipe, name: "hasPreview" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1223
1191
|
}
|
|
1224
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.
|
|
1192
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.6", ngImport: i0, type: ItemEditorComponent, decorators: [{
|
|
1225
1193
|
type: Component,
|
|
1226
1194
|
args: [{ selector: 'cadmus-item-editor', changeDetection: ChangeDetectionStrategy.OnPush, imports: [
|
|
1227
1195
|
MatCard,
|
|
1228
|
-
MatCardHeader,
|
|
1229
|
-
MatCardTitle,
|
|
1230
|
-
MatCardSubtitle,
|
|
1231
1196
|
MatCardContent,
|
|
1232
1197
|
MatTooltip,
|
|
1233
1198
|
CdkCopyToClipboard,
|
|
@@ -1241,7 +1206,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
1241
1206
|
MatError,
|
|
1242
1207
|
MatSelect,
|
|
1243
1208
|
MatOption,
|
|
1244
|
-
MatCheckbox,
|
|
1245
1209
|
MatButton,
|
|
1246
1210
|
MatIcon,
|
|
1247
1211
|
MatDivider,
|
|
@@ -1251,14 +1215,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
1251
1215
|
MatExpansionPanelDescription,
|
|
1252
1216
|
MatIconButton,
|
|
1253
1217
|
MissingPartsComponent,
|
|
1254
|
-
NgClass,
|
|
1255
|
-
AsyncPipe,
|
|
1256
1218
|
DatePipe,
|
|
1257
1219
|
HasPreviewPipe,
|
|
1258
1220
|
PartsScopeEditorComponent,
|
|
1259
1221
|
PartBadgeComponent,
|
|
1260
1222
|
CurrentItemBarComponent,
|
|
1261
|
-
], template: "<mat-card appearance=\"outlined\">\r\n <mat-card-header>\r\n <mat-card-subtitle>\r\n <cadmus-current-item-bar />\r\n </mat-card-subtitle>\r\n <!-- <mat-card-title>\r\n {{ (item$ | async)?.title || \"Item\" }}\r\n </mat-card-title>\r\n <mat-card-subtitle>\r\n {{ (item$ | async)?.description }}\r\n </mat-card-subtitle> -->\r\n </mat-card-header>\r\n <mat-card-content>\r\n <!-- @if (id()) {\r\n <p>\r\n ID:\r\n <input\r\n [cdkCopyToClipboard]=\"(item$ | async)?.id || ''\"\r\n type=\"text\"\r\n readonly=\"true\"\r\n spellcheck=\"false\"\r\n matTooltip=\"Click to copy\"\r\n [value]=\"(item$ | async)?.id\"\r\n class=\"id\"\r\n />\r\n </p>\r\n } @if (item$ | async; as item) {\r\n <p>\r\n Last saved {{ item.timeModified | date : \"yyyy-MM-dd HH:mm:ss\" }} by\r\n {{ item.userId }}.<br />\r\n Created {{ item.timeCreated | date : \"yyyy-MM-dd HH:mm:ss\" }} by\r\n {{ item.creatorId }}.\r\n </p>\r\n } -->\r\n @if (busy()) {\r\n <mat-progress-bar mode=\"indeterminate\" />\r\n }\r\n\r\n <!-- item content -->\r\n <mat-tab-group [selectedIndex]=\"id() ? 1 : 0\">\r\n <!-- metadata -->\r\n <mat-tab label=\"Metadata\">\r\n <form [formGroup]=\"metadata\" (ngSubmit)=\"save()\">\r\n <div class=\"form-row\">\r\n <!-- title -->\r\n <mat-form-field style=\"flex: 1 0 auto\">\r\n <mat-label>title</mat-label>\r\n <input matInput type=\"text\" id=\"title\" [formControl]=\"title\" />\r\n @if (\r\n title.hasError(\"required\") && (title.touched || title.dirty)\r\n ) {\r\n <mat-error>enter title</mat-error>\r\n }\r\n @if (\r\n title.hasError(\"maxLength\") && (title.touched || title.dirty)\r\n ) {\r\n <mat-error> title too long</mat-error>\r\n }\r\n </mat-form-field>\r\n\r\n <!-- sortKey -->\r\n <mat-form-field style=\"flex: 1 0 auto\">\r\n <mat-label>sort key</mat-label>\r\n <input\r\n matInput\r\n type=\"text\"\r\n id=\"sortKey\"\r\n [formControl]=\"sortKey\"\r\n />\r\n @if (\r\n sortKey.hasError(\"required\") &&\r\n (sortKey.touched || sortKey.dirty)\r\n ) {\r\n <mat-error>enter sort key</mat-error>\r\n }\r\n @if (\r\n sortKey.hasError(\"maxLength\") &&\r\n (sortKey.touched || sortKey.dirty)\r\n ) {\r\n <mat-error>sort key too long</mat-error>\r\n }\r\n </mat-form-field>\r\n </div>\r\n\r\n <!-- description -->\r\n <div>\r\n <mat-form-field class=\"full-width\">\r\n <mat-label>description</mat-label>\r\n <textarea\r\n rows=\"2\"\r\n matInput\r\n id=\"description\"\r\n [formControl]=\"description\"\r\n ></textarea>\r\n @if (\r\n description.hasError(\"required\") &&\r\n (description.touched || description.dirty)\r\n ) {\r\n <mat-error>enter description</mat-error>\r\n }\r\n @if (\r\n description.hasError(\"maxLength\") &&\r\n (description.touched || description.dirty)\r\n ) {\r\n <mat-error>description too long</mat-error>\r\n }\r\n </mat-form-field>\r\n </div>\r\n\r\n <!-- facet -->\r\n <div class=\"form-row\">\r\n <mat-form-field>\r\n <mat-label>facet</mat-label>\r\n <mat-select [formControl]=\"facet\" required=\"true\">\r\n @for (f of facets$ | async; track f.id) {\r\n <mat-option [value]=\"f.id\">\r\n {{ f.label }}\r\n </mat-option>\r\n }\r\n </mat-select>\r\n <mat-error>please select a facet</mat-error>\r\n </mat-form-field>\r\n\r\n <!-- group -->\r\n <mat-form-field>\r\n <mat-label>group ID</mat-label>\r\n <input matInput [formControl]=\"group\" />\r\n @if (\r\n group.hasError(\"maxLength\") && (group.dirty || group.touched)\r\n ) {\r\n <mat-error>too long</mat-error>\r\n }\r\n </mat-form-field>\r\n </div>\r\n\r\n <!-- flags -->\r\n <fieldset>\r\n <legend>flags</legend>\r\n @if (flagDefinitions().length) {\r\n <div formArrayName=\"flagChecks\">\r\n @for (c of flagChecks.controls; track c; let i = $index) {\r\n @if (\r\n userLevel() < 4 && flagDefinitions()[i].isAdmin === true\r\n ) {\r\n <span\r\n [style.color]=\"'#' + flagDefinitions()[i].colorKey\"\r\n style=\"margin-left: 12px\"\r\n >◆</span\r\n >\r\n \r\n {{ flagDefinitions()[i].label }}\r\n } @else {\r\n <mat-checkbox class=\"flag\" [formControlName]=\"i\">\r\n <span [style.color]=\"'#' + flagDefinitions()[i].colorKey\"\r\n >⬤</span\r\n >\r\n \r\n {{ flagDefinitions()[i].label }}\r\n </mat-checkbox>\r\n }\r\n }\r\n </div>\r\n }\r\n </fieldset>\r\n <br />\r\n\r\n <!-- action buttons -->\r\n @if (userLevel() > 1) {\r\n <div class=\"form-row\">\r\n <button\r\n type=\"button\"\r\n mat-flat-button\r\n class=\"mat-warn\"\r\n (click)=\"onGenerateItems()\"\r\n >\r\n <mat-icon>copy_all</mat-icon> generate\r\n </button>\r\n <button\r\n type=\"submit\"\r\n mat-flat-button\r\n class=\"mat-primary\"\r\n [disabled]=\"busy()\"\r\n matTooltip=\"Save metadata\"\r\n (click)=\"save()\"\r\n >\r\n <mat-icon>save</mat-icon> save\r\n </button>\r\n </div>\r\n }\r\n </form>\r\n </mat-tab>\r\n\r\n <!-- parts -->\r\n @if (id()) {\r\n <mat-tab label=\"Parts\">\r\n <div class=\"new-part\">\r\n <form [formGroup]=\"newPart\" class=\"form-row\">\r\n <mat-form-field>\r\n <mat-label>part</mat-label>\r\n <mat-select [formControl]=\"newPartType\" required>\r\n @for (\r\n p of newPartDefinitions$ | async;\r\n track p.typeId + \":\" + (p.roleId || \"\")\r\n ) {\r\n <mat-option [value]=\"p\">\r\n <span\r\n [style.color]=\"'#' + p.colorKey\"\r\n class=\"new-part-icon\"\r\n >⬤</span\r\n >\r\n {{ getPartIdName(p.typeId, p.roleId) }}\r\n </mat-option>\r\n }\r\n </mat-select>\r\n <mat-error>part type required</mat-error>\r\n </mat-form-field>\r\n <button\r\n mat-flat-button\r\n class=\"mat-primary\"\r\n type=\"button\"\r\n [disabled]=\"userLevel() < 2 || busy() || !newPart.valid\"\r\n (click)=\"addPart()\"\r\n matTooltip=\"Add a new part of the selected type\"\r\n >\r\n <mat-icon>add_circle</mat-icon>\r\n part\r\n </button>\r\n </form>\r\n </div>\r\n <mat-divider></mat-divider>\r\n @for (group of partGroups$ | async; track group.key) {\r\n <mat-expansion-panel expanded=\"true\" class=\"group-header\">\r\n <mat-expansion-panel-header>\r\n <mat-panel-title\r\n ><strong>{{ group.label }}</strong></mat-panel-title\r\n >\r\n <mat-panel-description>{{\r\n group.parts.length\r\n }}</mat-panel-description>\r\n </mat-expansion-panel-header>\r\n <table class=\"parts-table\">\r\n <thead>\r\n <tr>\r\n <th></th>\r\n <th>type</th>\r\n <th>role</th>\r\n <th class=\"noif-lt-xs\">modified</th>\r\n <th class=\"noif-lt-xs\">user</th>\r\n </tr>\r\n </thead>\r\n <tbody>\r\n @for (\r\n part of group.parts;\r\n track part.typeId + \":\" + (part.roleId || \"\")\r\n ) {\r\n <tr>\r\n <!-- edit -->\r\n <td class=\"fit-width\">\r\n <button\r\n mat-icon-button\r\n type=\"button\"\r\n [disabled]=\"busy()\"\r\n (click)=\"editPart(part)\"\r\n matTooltip=\"Edit this part\"\r\n >\r\n <mat-icon class=\"mat-primary\">create</mat-icon>\r\n </button>\r\n <!-- delete -->\r\n @if (\r\n user()?.roles?.length &&\r\n (user()?.roles?.includes(\"admin\") ||\r\n user()?.roles?.includes(\"editor\") ||\r\n user()?.roles?.includes(\"operator\"))\r\n ) {\r\n <button\r\n mat-icon-button\r\n type=\"button\"\r\n [disabled]=\"userLevel() < 2 || busy()\"\r\n (click)=\"deletePart(part)\"\r\n matTooltip=\"Delete this part\"\r\n >\r\n <mat-icon class=\"mat-warn\">delete</mat-icon>\r\n </button>\r\n }\r\n <!-- copy -->\r\n <button\r\n mat-icon-button\r\n type=\"button\"\r\n matTooltip=\"Copy this part ID\"\r\n [cdkCopyToClipboard]=\"part.id\"\r\n >\r\n <mat-icon>assignment</mat-icon>\r\n </button>\r\n <!-- copy into item -->\r\n <button\r\n mat-icon-button\r\n type=\"button\"\r\n matTooltip=\"Copy part into another item\"\r\n (click)=\"onCopyPart(part)\"\r\n >\r\n <mat-icon>open_in_new</mat-icon>\r\n </button>\r\n <!-- preview -->\r\n @if (\r\n part\r\n | hasPreview\r\n : (previewJKeys$ | async)\r\n : (previewFKeys$ | async)\r\n ) {\r\n <button\r\n mat-icon-button\r\n type=\"button\"\r\n matTooltip=\"Preview this part\"\r\n (click)=\"previewPart(part)\"\r\n >\r\n <mat-icon>preview</mat-icon>\r\n </button>\r\n }\r\n </td>\r\n <td>\r\n <cadmus-part-badge\r\n [partTypeIds]=\"part\"\r\n [facetDefinition]=\"(facet$ | async) || undefined\"\r\n [badgeType]=\"1\"\r\n [typeThesaurus]=\"\r\n (typeThesaurus$ | async) || undefined\r\n \"\r\n />\r\n </td>\r\n <td>\r\n <cadmus-part-badge\r\n [partTypeIds]=\"part\"\r\n [facetDefinition]=\"(facet$ | async) || undefined\"\r\n [badgeType]=\"2\"\r\n [typeThesaurus]=\"\r\n (typeThesaurus$ | async) || undefined\r\n \"\r\n />\r\n </td>\r\n <td class=\"noif-lt-xs\">\r\n {{ part.timeModified | date: \"yyyy-MM-dd HH:mm:ss\" }}\r\n </td>\r\n <td class=\"noif-lt-xs\">{{ part.userId }}</td>\r\n </tr>\r\n }\r\n </tbody>\r\n </table>\r\n </mat-expansion-panel>\r\n }\r\n <cadmus-missing-parts\r\n [facetDefinition]=\"(facet$ | async) || undefined\"\r\n [partDefinitions]=\"(facet$ | async)?.partDefinitions\"\r\n [parts]=\"(parts$ | async) || undefined\"\r\n [typeThesaurus]=\"(typeThesaurus$ | async) || undefined\"\r\n (addRequest)=\"addPart($event)\"\r\n />\r\n </mat-tab>\r\n }\r\n @if (id()) {\r\n <mat-tab label=\"Layers\">\r\n @if (layerPartInfos$ | async; as parts) {\r\n <table id=\"layers\">\r\n <thead>\r\n <th></th>\r\n <th>type</th>\r\n <th>role</th>\r\n <th>frr.</th>\r\n <th>last modified</th>\r\n </thead>\r\n <tbody>\r\n @for (\r\n part of parts;\r\n track part.typeId + \":\" + (part.roleId || \"\")\r\n ) {\r\n <tr>\r\n <td class=\"fit-width\">\r\n @if (!part.isAbsent) {\r\n <button\r\n type=\"button\"\r\n mat-icon-button\r\n matTooltip=\"Edit this layer part\"\r\n (click)=\"editPart(part)\"\r\n >\r\n <mat-icon class=\"mat-primary\">edit</mat-icon>\r\n </button>\r\n }\r\n @if (part.isAbsent) {\r\n <button\r\n type=\"button\"\r\n mat-icon-button\r\n matTooltip=\"Add this layer part\"\r\n [disabled]=\"userLevel() < 2\"\r\n (click)=\"addLayerPart(part)\"\r\n >\r\n <mat-icon class=\"mat-primary\">add_circle</mat-icon>\r\n </button>\r\n }\r\n @if (!part.isAbsent) {\r\n <button\r\n type=\"button\"\r\n mat-icon-button\r\n matTooltip=\"Delete this layer part\"\r\n [disabled]=\"userLevel() < 2\"\r\n (click)=\"deletePart(part)\"\r\n >\r\n <mat-icon class=\"mat-warn\">delete</mat-icon>\r\n </button>\r\n }\r\n @if (!part.isAbsent) {\r\n <button\r\n mat-icon-button\r\n type=\"button\"\r\n matTooltip=\"Copy this part ID\"\r\n [cdkCopyToClipboard]=\"part.id\"\r\n >\r\n <mat-icon>assignment</mat-icon>\r\n </button>\r\n }\r\n </td>\r\n <td>\r\n <cadmus-part-badge\r\n [partTypeIds]=\"part\"\r\n [facetDefinition]=\"(facet$ | async) || undefined\"\r\n [badgeType]=\"1\"\r\n [typeThesaurus]=\"(typeThesaurus$ | async) || undefined\"\r\n />\r\n </td>\r\n <td>\r\n <cadmus-part-badge\r\n [partTypeIds]=\"part\"\r\n [facetDefinition]=\"(facet$ | async) || undefined\"\r\n [badgeType]=\"2\"\r\n [typeThesaurus]=\"(typeThesaurus$ | async) || undefined\"\r\n />\r\n </td>\r\n <td\r\n [class.count-n]=\"part.fragmentCount\"\r\n [class.count-z]=\"!part.fragmentCount\"\r\n >\r\n {{ part.fragmentCount }}\r\n </td>\r\n <td>\r\n @if (!part.isAbsent) {\r\n <span>\r\n {{ part.timeModified | date: \"yyyy-MM-dd HH:mm:ss\" }}\r\n </span>\r\n }\r\n </td>\r\n </tr>\r\n }\r\n </tbody>\r\n </table>\r\n }\r\n </mat-tab>\r\n }\r\n @if (parts$ | async; as parts) {\r\n <mat-tab label=\"Th-Scopes\">\r\n <!-- [parts]=\"parts | sort: 'typeId' | sort: 'roleId'\" -->\r\n <cadmus-parts-scope-editor\r\n [parts]=\"parts\"\r\n [readonly]=\"userLevel() < 2 || busy() ? true : false\"\r\n (setScopeRequest)=\"setPartsScope($event)\"\r\n />\r\n </mat-tab>\r\n }\r\n </mat-tab-group>\r\n </mat-card-content>\r\n</mat-card>\r\n", styles: [".full-width{width:100%}table{width:100%;border-collapse:collapse}tbody tr:nth-child(odd){background-color:var(--mat-sys-surface-container)}th{text-align:left;font-weight:400;color:var(--mat-sys-on-surface-variant)}tbody tr:hover{background-color:var(--mat-sys-surface-container-high)}td.fit-width{width:1px;white-space:nowrap}tbody tr.selected{background-color:var(--mat-sys-secondary-container);color:var(--mat-sys-on-secondary-container)}table#layers td{padding:0 6px}table#layers th{text-align:left}div.new-part{margin-left:32px}span.new-part-role{color:var(--mat-sys-on-surface-variant);margin-left:8px;vertical-align:middle}span.new-part-icon{margin:0 4px;vertical-align:middle}td.count-n{text-align:center;color:var(--mat-sys-success)}td.count-z{text-align:center;color:var(--mat-sys-error)}input.id{font-family:Courier New,Courier,monospace;color:var(--mat-sys-on-surface-variant);min-width:22em}.flag{margin-left:10px}.form-row{display:flex;gap:8px;align-items:center;flex-wrap:wrap}.form-row *{flex:0 0 auto}.group-header{border-top:1px solid var(--mat-sys-on-surface-variant)}table.parts-table{width:100%}table.parts-table th{text-align:left}fieldset{border:1px solid var(--mat-sys-on-surface-variant);border-radius:6px;padding:6px;margin:8px 0}@media only screen and (max-width:599px){.noif-lt-xs{display:none}}\n"] }]
|
|
1223
|
+
FlagSetComponent,
|
|
1224
|
+
], template: "<mat-card appearance=\"outlined\">\n <mat-card-content>\n <div>\n <cadmus-current-item-bar />\n </div>\n @if (busy()) {\n <mat-progress-bar mode=\"indeterminate\" />\n }\n\n <!-- item content -->\n <mat-tab-group [selectedIndex]=\"id() ? 1 : 0\">\n <!-- metadata -->\n <mat-tab label=\"Metadata\">\n <form [formGroup]=\"metadata\" (ngSubmit)=\"save()\">\n <div class=\"form-row\">\n <!-- title -->\n <mat-form-field class=\"flex-field\">\n <mat-label>title</mat-label>\n <input matInput type=\"text\" id=\"title\" [formControl]=\"title\" />\n @if (\n title.hasError(\"required\") && (title.touched || title.dirty)\n ) {\n <mat-error>enter title</mat-error>\n }\n @if (\n title.hasError(\"maxLength\") && (title.touched || title.dirty)\n ) {\n <mat-error>title too long</mat-error>\n }\n </mat-form-field>\n\n <!-- sortKey -->\n <mat-form-field class=\"flex-field\">\n <mat-label>sort key</mat-label>\n <input\n matInput\n type=\"text\"\n id=\"sortKey\"\n [formControl]=\"sortKey\"\n />\n @if (\n sortKey.hasError(\"required\") &&\n (sortKey.touched || sortKey.dirty)\n ) {\n <mat-error>enter sort key</mat-error>\n }\n @if (\n sortKey.hasError(\"maxLength\") &&\n (sortKey.touched || sortKey.dirty)\n ) {\n <mat-error>sort key too long</mat-error>\n }\n </mat-form-field>\n </div>\n\n <!-- description -->\n <div>\n <mat-form-field class=\"full-width\">\n <mat-label>description</mat-label>\n <textarea\n rows=\"2\"\n matInput\n id=\"description\"\n [formControl]=\"description\"\n ></textarea>\n @if (\n description.hasError(\"required\") &&\n (description.touched || description.dirty)\n ) {\n <mat-error>enter description</mat-error>\n }\n @if (\n description.hasError(\"maxLength\") &&\n (description.touched || description.dirty)\n ) {\n <mat-error>description too long</mat-error>\n }\n </mat-form-field>\n </div>\n\n <!-- facet -->\n <div class=\"form-row\">\n <mat-form-field>\n <mat-label>facet</mat-label>\n <mat-select [formControl]=\"facetCtrl\" required=\"true\">\n @for (f of facets(); track f.id) {\n <mat-option [value]=\"f.id\">\n {{ f.label }}\n </mat-option>\n }\n </mat-select>\n <mat-error>please select a facet</mat-error>\n </mat-form-field>\n\n <!-- group -->\n <mat-form-field>\n <mat-label>group ID</mat-label>\n <input matInput [formControl]=\"group\" />\n @if (\n group.hasError(\"maxLength\") && (group.dirty || group.touched)\n ) {\n <mat-error>too long</mat-error>\n }\n </mat-form-field>\n </div>\n\n <!-- flags -->\n <fieldset>\n <legend>flags</legend>\n <!-- read-only admin flags for non-admin users -->\n @if (adminFlagDefs().length) {\n <div class=\"admin-flags\">\n @for (def of adminFlagDefs(); track def.id) {\n <span class=\"admin-flag\">\n <span [style.color]=\"'#' + def.colorKey\">◆</span>\n {{ def.label }}\n </span>\n }\n </div>\n }\n <!-- editable flags -->\n @if (flagSetFlags().length) {\n <cadmus-ui-flag-set\n [hideToolbar]=\"true\"\n [flags]=\"flagSetFlags()\"\n [checkedIds]=\"checkedFlagIds()\"\n (checkedIdsChange)=\"onFlagCheckedIdsChange($event)\"\n />\n }\n </fieldset>\n <br />\n\n <!-- action buttons -->\n @if (userLevel() > 1) {\n <div class=\"form-row\">\n <button\n type=\"button\"\n mat-flat-button\n class=\"mat-warn\"\n (click)=\"onGenerateItems()\"\n >\n <mat-icon>copy_all</mat-icon> generate\n </button>\n <button\n type=\"submit\"\n mat-flat-button\n class=\"mat-primary\"\n [disabled]=\"busy()\"\n matTooltip=\"Save metadata\"\n (click)=\"save()\"\n >\n <mat-icon>save</mat-icon> save\n </button>\n </div>\n }\n </form>\n </mat-tab>\n\n <!-- parts -->\n @if (id()) {\n <mat-tab label=\"Parts\">\n <div class=\"new-part\">\n <form [formGroup]=\"newPart\" class=\"form-row\">\n <mat-form-field>\n <mat-label>part</mat-label>\n <mat-select [formControl]=\"newPartType\" required>\n @for (\n p of newPartDefinitions();\n track p.typeId + \":\" + (p.roleId || \"\")\n ) {\n <mat-option [value]=\"p\">\n <span\n [style.color]=\"'#' + p.colorKey\"\n class=\"new-part-icon\"\n >⬤</span\n >\n {{ getPartIdName(p.typeId, p.roleId) }}\n </mat-option>\n }\n </mat-select>\n <mat-error>part type required</mat-error>\n </mat-form-field>\n <button\n mat-flat-button\n class=\"mat-primary\"\n type=\"button\"\n [disabled]=\"userLevel() < 2 || busy() || !newPart.valid\"\n (click)=\"addPart()\"\n matTooltip=\"Add a new part of the selected type\"\n >\n <mat-icon>add_circle</mat-icon>\n part\n </button>\n </form>\n </div>\n <mat-divider></mat-divider>\n @for (group of partGroups(); track group.key) {\n <mat-expansion-panel expanded=\"true\" class=\"group-header\">\n <mat-expansion-panel-header>\n <mat-panel-title\n ><strong>{{ group.label }}</strong></mat-panel-title\n >\n <mat-panel-description>{{\n group.parts.length\n }}</mat-panel-description>\n </mat-expansion-panel-header>\n <table class=\"parts-table\">\n <thead>\n <tr>\n <th></th>\n <th>type</th>\n <th>role</th>\n <th class=\"noif-lt-xs\">modified</th>\n <th class=\"noif-lt-xs\">user</th>\n </tr>\n </thead>\n <tbody>\n @for (\n part of group.parts;\n track part.typeId + \":\" + (part.roleId || \"\")\n ) {\n <tr>\n <!-- edit -->\n <td class=\"fit-width\">\n <button\n mat-icon-button\n type=\"button\"\n [disabled]=\"busy()\"\n (click)=\"editPart(part)\"\n matTooltip=\"Edit this part\"\n >\n <mat-icon class=\"mat-primary\">create</mat-icon>\n </button>\n <!-- delete -->\n @if (\n user()?.roles?.length &&\n (user()?.roles?.includes(\"admin\") ||\n user()?.roles?.includes(\"editor\") ||\n user()?.roles?.includes(\"operator\"))\n ) {\n <button\n mat-icon-button\n type=\"button\"\n [disabled]=\"userLevel() < 2 || busy()\"\n (click)=\"deletePart(part)\"\n matTooltip=\"Delete this part\"\n >\n <mat-icon class=\"mat-warn\">delete</mat-icon>\n </button>\n }\n <!-- copy ID -->\n <button\n mat-icon-button\n type=\"button\"\n matTooltip=\"Copy this part ID\"\n [cdkCopyToClipboard]=\"part.id\"\n >\n <mat-icon>assignment</mat-icon>\n </button>\n <!-- copy into item -->\n <button\n mat-icon-button\n type=\"button\"\n matTooltip=\"Copy part into another item\"\n (click)=\"onCopyPart(part)\"\n >\n <mat-icon>open_in_new</mat-icon>\n </button>\n <!-- preview -->\n @if (\n part | hasPreview: previewJKeys() : previewFKeys()\n ) {\n <button\n mat-icon-button\n type=\"button\"\n matTooltip=\"Preview this part\"\n (click)=\"previewPart(part)\"\n >\n <mat-icon>preview</mat-icon>\n </button>\n }\n </td>\n <td>\n <cadmus-part-badge\n [partTypeIds]=\"part\"\n [facetDefinition]=\"facet()\"\n [badgeType]=\"1\"\n [typeThesaurus]=\"typeThesaurus()\"\n />\n </td>\n <td>\n <cadmus-part-badge\n [partTypeIds]=\"part\"\n [facetDefinition]=\"facet()\"\n [badgeType]=\"2\"\n [typeThesaurus]=\"typeThesaurus()\"\n />\n </td>\n <td class=\"noif-lt-xs\">\n {{ part.timeModified | date: \"yyyy-MM-dd HH:mm:ss\" }}\n </td>\n <td class=\"noif-lt-xs\">{{ part.userId }}</td>\n </tr>\n }\n </tbody>\n </table>\n </mat-expansion-panel>\n }\n <cadmus-missing-parts\n [facetDefinition]=\"facet()\"\n [partDefinitions]=\"facet()?.partDefinitions\"\n [parts]=\"parts()\"\n [typeThesaurus]=\"typeThesaurus()\"\n (addRequest)=\"addPart($event)\"\n />\n </mat-tab>\n }\n\n <!-- layers -->\n @if (id()) {\n <mat-tab label=\"Layers\">\n <table id=\"layers\">\n <thead>\n <th aria-label=\"actions\"></th>\n <th>type</th>\n <th>role</th>\n <th>frr.</th>\n <th>last modified</th>\n </thead>\n <tbody>\n @for (\n part of layerPartInfos();\n track part.typeId + \":\" + (part.roleId || \"\")\n ) {\n <tr>\n <td class=\"fit-width\">\n @if (!part.isAbsent) {\n <button\n type=\"button\"\n mat-icon-button\n matTooltip=\"Edit this layer part\"\n (click)=\"editPart(part)\"\n >\n <mat-icon class=\"mat-primary\">edit</mat-icon>\n </button>\n }\n @if (part.isAbsent) {\n <button\n type=\"button\"\n mat-icon-button\n matTooltip=\"Add this layer part\"\n [disabled]=\"userLevel() < 2\"\n (click)=\"addLayerPart(part)\"\n >\n <mat-icon class=\"mat-primary\">add_circle</mat-icon>\n </button>\n }\n @if (!part.isAbsent) {\n <button\n type=\"button\"\n mat-icon-button\n matTooltip=\"Delete this layer part\"\n [disabled]=\"userLevel() < 2\"\n (click)=\"deletePart(part)\"\n >\n <mat-icon class=\"mat-warn\">delete</mat-icon>\n </button>\n }\n @if (!part.isAbsent) {\n <button\n mat-icon-button\n type=\"button\"\n matTooltip=\"Copy this part ID\"\n [cdkCopyToClipboard]=\"part.id\"\n >\n <mat-icon>assignment</mat-icon>\n </button>\n }\n </td>\n <td>\n <cadmus-part-badge\n [partTypeIds]=\"part\"\n [facetDefinition]=\"facet()\"\n [badgeType]=\"1\"\n [typeThesaurus]=\"typeThesaurus()\"\n />\n </td>\n <td>\n <cadmus-part-badge\n [partTypeIds]=\"part\"\n [facetDefinition]=\"facet()\"\n [badgeType]=\"2\"\n [typeThesaurus]=\"typeThesaurus()\"\n />\n </td>\n <td\n [class.count-n]=\"part.fragmentCount\"\n [class.count-z]=\"!part.fragmentCount\"\n >\n {{ part.fragmentCount }}\n </td>\n <td>\n @if (!part.isAbsent) {\n <span>\n {{ part.timeModified | date: \"yyyy-MM-dd HH:mm:ss\" }}\n </span>\n }\n </td>\n </tr>\n }\n </tbody>\n </table>\n </mat-tab>\n }\n\n <!-- thesaurus scopes -->\n @if (parts().length) {\n <mat-tab label=\"Th-Scopes\">\n <cadmus-parts-scope-editor\n [parts]=\"parts()\"\n [readonly]=\"userLevel() < 2 || busy() ? true : false\"\n (setScopeRequest)=\"setPartsScope($event)\"\n />\n </mat-tab>\n }\n </mat-tab-group>\n </mat-card-content>\n</mat-card>\n", styles: [".full-width{width:100%}.flex-field{flex:1 0 auto}table{width:100%;border-collapse:collapse;color:var(--mat-sys-on-surface-variant)}tbody tr:nth-child(odd){background-color:var(--mat-sys-surface-container)}th{text-align:left;font-weight:400;color:var(--mat-sys-on-surface-variant)}tbody tr:hover{background-color:var(--mat-sys-surface-container-high)}td.fit-width{width:1px;white-space:nowrap}tbody tr.selected{background-color:var(--mat-sys-secondary-container);color:var(--mat-sys-on-secondary-container)}table#layers td{padding:0 6px}table#layers th{text-align:left}div.new-part{margin-left:32px}span.new-part-role{color:var(--mat-sys-on-surface-variant);margin-left:8px;vertical-align:middle}span.new-part-icon{margin:0 4px;vertical-align:middle}td.count-n{text-align:center;color:var(--mat-sys-success)}td.count-z{text-align:center;color:var(--mat-sys-error)}input.id{font-family:Courier New,Courier,monospace;color:var(--mat-sys-on-surface-variant);min-width:22em}.admin-flags{margin-bottom:4px}.admin-flag{margin-left:12px}.form-row{display:flex;gap:8px;align-items:center;flex-wrap:wrap}.form-row *{flex:0 0 auto}.group-header{margin-top:6px}table.parts-table{width:100%}table.parts-table th{text-align:left}fieldset{border:1px solid var(--mat-sys-on-surface-variant);border-radius:6px;padding:6px;margin:8px 0}@media only screen and (max-width:599px){.noif-lt-xs{display:none}}\n"] }]
|
|
1262
1225
|
}], ctorParameters: () => [{ type: i2$1.ItemRefLookupService }, { type: i2.MatDialog }, { type: i3$1.Router }, { type: i3$1.ActivatedRoute }, { type: i4.MatSnackBar }, { type: i1.AppRepository }, { type: EditedItemRepository }, { type: i7.ItemService }, { type: i8.LibraryRouteService }, { type: i3.DialogService }, { type: i10.AuthJwtService }, { type: i7.UserLevelService }, { type: i7.MessagingService }, { type: i1$1.FormBuilder }] });
|
|
1263
1226
|
|
|
1264
1227
|
/*
|