@myrmidon/cadmus-item-editor 16.1.5 → 17.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -35,6 +35,7 @@ import * as i3$1 from '@angular/router';
|
|
|
35
35
|
import * as i4 from '@angular/material/snack-bar';
|
|
36
36
|
import * as i8 from '@myrmidon/cadmus-core';
|
|
37
37
|
import * as i10 from '@myrmidon/auth-jwt-login';
|
|
38
|
+
import * as i11 from '@myrmidon/ngx-tools';
|
|
38
39
|
|
|
39
40
|
/**
|
|
40
41
|
* Edited item repository.
|
|
@@ -348,10 +349,10 @@ class EditedItemRepository {
|
|
|
348
349
|
});
|
|
349
350
|
});
|
|
350
351
|
}
|
|
351
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
352
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
352
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.1", ngImport: i0, type: EditedItemRepository, deps: [{ token: i1.AppRepository }, { token: i7.ItemService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
353
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.1", ngImport: i0, type: EditedItemRepository, providedIn: 'root' });
|
|
353
354
|
}
|
|
354
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
355
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.1", ngImport: i0, type: EditedItemRepository, decorators: [{
|
|
355
356
|
type: Injectable,
|
|
356
357
|
args: [{ providedIn: 'root' }]
|
|
357
358
|
}], ctorParameters: () => [{ type: i1.AppRepository }, { type: i7.ItemService }] });
|
|
@@ -361,12 +362,12 @@ class CurrentItemBarComponent {
|
|
|
361
362
|
constructor(repository) {
|
|
362
363
|
this.item = toSignal(repository.item$);
|
|
363
364
|
}
|
|
364
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
365
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "
|
|
365
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.1", ngImport: i0, type: CurrentItemBarComponent, deps: [{ token: EditedItemRepository }], target: i0.ɵɵFactoryTarget.Component });
|
|
366
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.1", type: CurrentItemBarComponent, isStandalone: true, selector: "cadmus-current-item-bar", ngImport: i0, template: "@if (item(); as item) {\r\n <div class=\"item-bar\">\r\n <span class=\"title\">{{ item.title }}</span>\r\n <span class=\"id\">{{ item.id }}</span>\r\n ⬤\r\n <span class=\"dsc\">\r\n {{ item.description }} ⬤\r\n <span matTooltip=\"Created\"\r\n >{{ item.timeCreated | date: \"yyyy-MM-dd HH:mm:ss\" }}\r\n {{ item.creatorId }}</span\r\n >\r\n ⬤\r\n <span matTooltip=\"Last saved\"\r\n >{{ item.timeModified | date: \"yyyy-MM-dd HH:mm:ss\" }}\r\n {{ item.userId }}</span\r\n >\r\n </span>\r\n </div>\r\n}\r\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
367
|
}
|
|
367
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
368
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.1", ngImport: i0, type: CurrentItemBarComponent, decorators: [{
|
|
368
369
|
type: Component,
|
|
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
|
+
args: [{ selector: 'cadmus-current-item-bar', changeDetection: ChangeDetectionStrategy.OnPush, imports: [DatePipe, MatTooltip], template: "@if (item(); as item) {\r\n <div class=\"item-bar\">\r\n <span class=\"title\">{{ item.title }}</span>\r\n <span class=\"id\">{{ item.id }}</span>\r\n ⬤\r\n <span class=\"dsc\">\r\n {{ item.description }} ⬤\r\n <span matTooltip=\"Created\"\r\n >{{ item.timeCreated | date: \"yyyy-MM-dd HH:mm:ss\" }}\r\n {{ item.creatorId }}</span\r\n >\r\n ⬤\r\n <span matTooltip=\"Last saved\"\r\n >{{ item.timeModified | date: \"yyyy-MM-dd HH:mm:ss\" }}\r\n {{ item.userId }}</span\r\n >\r\n </span>\r\n </div>\r\n}\r\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
371
|
}], ctorParameters: () => [{ type: EditedItemRepository }] });
|
|
371
372
|
|
|
372
373
|
class CurrentLayerPartBarComponent {
|
|
@@ -389,20 +390,23 @@ class CurrentLayerPartBarComponent {
|
|
|
389
390
|
if (!part)
|
|
390
391
|
return undefined;
|
|
391
392
|
return this.getTypeIdName(part.typeId);
|
|
392
|
-
},
|
|
393
|
+
}, /* @ts-ignore */
|
|
394
|
+
...(ngDevMode ? [{ debugName: "typeId" }] : /* istanbul ignore next */ []));
|
|
393
395
|
this.roleId = computed(() => {
|
|
394
396
|
const part = this._part();
|
|
395
397
|
if (!part)
|
|
396
398
|
return undefined;
|
|
397
399
|
return this.getRoleIdName(part.roleId);
|
|
398
|
-
},
|
|
400
|
+
}, /* @ts-ignore */
|
|
401
|
+
...(ngDevMode ? [{ debugName: "roleId" }] : /* istanbul ignore next */ []));
|
|
399
402
|
this.color = computed(() => {
|
|
400
403
|
const part = this._part();
|
|
401
404
|
this._facet(); // declare dependency so color recomputes on facet change
|
|
402
405
|
if (!part)
|
|
403
406
|
return undefined;
|
|
404
407
|
return this.getPartColor(part.typeId, part.roleId);
|
|
405
|
-
},
|
|
408
|
+
}, /* @ts-ignore */
|
|
409
|
+
...(ngDevMode ? [{ debugName: "color" }] : /* istanbul ignore next */ []));
|
|
406
410
|
}
|
|
407
411
|
getTypeIdName(typeId) {
|
|
408
412
|
const typeThesaurus = this._appRepository.getTypeThesaurus();
|
|
@@ -427,12 +431,12 @@ class CurrentLayerPartBarComponent {
|
|
|
427
431
|
const facet = this._editedItemRepository.getFacet();
|
|
428
432
|
return this._facetService.getPartColor(typeId, roleId, facet);
|
|
429
433
|
}
|
|
430
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
431
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "
|
|
434
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.1", ngImport: i0, type: CurrentLayerPartBarComponent, deps: [{ token: i1.AppRepository }, { token: EditedItemRepository }, { token: i1.EditedLayerRepository }, { token: i7.FacetService }], target: i0.ɵɵFactoryTarget.Component });
|
|
435
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "22.0.1", type: CurrentLayerPartBarComponent, isStandalone: true, selector: "cadmus-current-layer-part-bar", ngImport: i0, template: "<div>\r\n <span class=\"type-id\" [style.background-color]=\"color()\">{{ typeId() }}</span>\r\n <span class=\"role-id\">{{ roleId() }}</span>\r\n</div>\r\n", styles: ["span.type-id{padding:4px;border-radius:6px}span.role-id{padding:4px}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
432
436
|
}
|
|
433
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
437
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.1", ngImport: i0, type: CurrentLayerPartBarComponent, decorators: [{
|
|
434
438
|
type: Component,
|
|
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"] }]
|
|
439
|
+
args: [{ selector: 'cadmus-current-layer-part-bar', changeDetection: ChangeDetectionStrategy.OnPush, template: "<div>\r\n <span class=\"type-id\" [style.background-color]=\"color()\">{{ typeId() }}</span>\r\n <span class=\"role-id\">{{ roleId() }}</span>\r\n</div>\r\n", styles: ["span.type-id{padding:4px;border-radius:6px}span.role-id{padding:4px}\n"] }]
|
|
436
440
|
}], ctorParameters: () => [{ type: i1.AppRepository }, { type: EditedItemRepository }, { type: i1.EditedLayerRepository }, { type: i7.FacetService }] });
|
|
437
441
|
|
|
438
442
|
/**
|
|
@@ -447,8 +451,10 @@ class PartsScopeEditorComponent {
|
|
|
447
451
|
_appRepository;
|
|
448
452
|
_colorService;
|
|
449
453
|
_editedItemRepository;
|
|
450
|
-
parts = input(
|
|
451
|
-
|
|
454
|
+
parts = input(/* @ts-ignore */
|
|
455
|
+
...(ngDevMode ? [undefined, { debugName: "parts" }] : /* istanbul ignore next */ []));
|
|
456
|
+
readonly = input(/* @ts-ignore */
|
|
457
|
+
...(ngDevMode ? [undefined, { debugName: "readonly" }] : /* istanbul ignore next */ []));
|
|
452
458
|
setScopeRequest = output();
|
|
453
459
|
checks;
|
|
454
460
|
scope;
|
|
@@ -540,10 +546,10 @@ class PartsScopeEditorComponent {
|
|
|
540
546
|
});
|
|
541
547
|
});
|
|
542
548
|
}
|
|
543
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
544
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "
|
|
549
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.1", 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 });
|
|
550
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.1", 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()\">\r\n <table id=\"parts\" formArrayName=\"checks\">\r\n <thead>\r\n <tr>\r\n <th aria-label=\"select\"></th>\r\n <th>type</th>\r\n <th>role</th>\r\n <th>scope</th>\r\n <th>modified</th>\r\n <th>user</th>\r\n </tr>\r\n </thead>\r\n <tbody>\r\n @for (\r\n part of parts() ?? [];\r\n track part.typeId + \":\" + (part.roleId ?? \"\");\r\n let i = $index\r\n ) {\r\n <tr>\r\n <td class=\"fit-width\">\r\n <mat-checkbox [formControlName]=\"i\" (change)=\"onCheckChanged()\" />\r\n </td>\r\n <td>\r\n <span\r\n class=\"model-type\"\r\n [style.background-color]=\"getPartColor(part.typeId, part.roleId)\"\r\n [style.color]=\"getContrastColor(part.typeId, part.roleId)\"\r\n >{{ getTypeIdName(part.typeId) }}</span\r\n >\r\n </td>\r\n <td>{{ getRoleIdName(part.roleId ?? \"\") }}</td>\r\n <td>{{ part.thesaurusScope }}</td>\r\n <td>{{ part.timeModified | date: \"yyyy-MM-dd HH:mm:ss\" }}</td>\r\n <td>{{ part.userId }}</td>\r\n </tr>\r\n }\r\n </tbody>\r\n </table>\r\n <div class=\"form-row\">\r\n <mat-form-field>\r\n <mat-label>scope</mat-label>\r\n <input matInput formControlName=\"scope\" />\r\n @if (scope.hasError(\"maxLength\") && (scope.dirty || scope.touched)) {\r\n <mat-error>too long</mat-error>\r\n }\r\n @if (scope.hasError(\"pattern\") && (scope.dirty || scope.touched)) {\r\n <mat-error>invalid scope</mat-error>\r\n }\r\n </mat-form-field>\r\n <button\r\n mat-flat-button\r\n class=\"mat-primary\"\r\n type=\"submit\"\r\n [disabled]=\"form.invalid || readonly()\"\r\n matTooltip=\"Assign the scope to the checked parts\"\r\n >\r\n assign\r\n </button>\r\n </div>\r\n</form>\r\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]):not([ngNoCva])[formControlName],textarea:not([ngNoCva])[formControlName],input:not([type=checkbox]):not([ngNoCva])[formControl],textarea:not([ngNoCva])[formControl],input:not([type=checkbox]):not([ngNoCva])[ngModel],textarea:not([ngNoCva])[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 });
|
|
545
551
|
}
|
|
546
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
552
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.1", ngImport: i0, type: PartsScopeEditorComponent, decorators: [{
|
|
547
553
|
type: Component,
|
|
548
554
|
args: [{ selector: 'cadmus-parts-scope-editor', changeDetection: ChangeDetectionStrategy.OnPush, imports: [
|
|
549
555
|
ReactiveFormsModule,
|
|
@@ -555,7 +561,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.6", ngImpor
|
|
|
555
561
|
MatButton,
|
|
556
562
|
MatTooltip,
|
|
557
563
|
DatePipe,
|
|
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"] }]
|
|
564
|
+
], template: "<form [formGroup]=\"form\" (submit)=\"submit()\">\r\n <table id=\"parts\" formArrayName=\"checks\">\r\n <thead>\r\n <tr>\r\n <th aria-label=\"select\"></th>\r\n <th>type</th>\r\n <th>role</th>\r\n <th>scope</th>\r\n <th>modified</th>\r\n <th>user</th>\r\n </tr>\r\n </thead>\r\n <tbody>\r\n @for (\r\n part of parts() ?? [];\r\n track part.typeId + \":\" + (part.roleId ?? \"\");\r\n let i = $index\r\n ) {\r\n <tr>\r\n <td class=\"fit-width\">\r\n <mat-checkbox [formControlName]=\"i\" (change)=\"onCheckChanged()\" />\r\n </td>\r\n <td>\r\n <span\r\n class=\"model-type\"\r\n [style.background-color]=\"getPartColor(part.typeId, part.roleId)\"\r\n [style.color]=\"getContrastColor(part.typeId, part.roleId)\"\r\n >{{ getTypeIdName(part.typeId) }}</span\r\n >\r\n </td>\r\n <td>{{ getRoleIdName(part.roleId ?? \"\") }}</td>\r\n <td>{{ part.thesaurusScope }}</td>\r\n <td>{{ part.timeModified | date: \"yyyy-MM-dd HH:mm:ss\" }}</td>\r\n <td>{{ part.userId }}</td>\r\n </tr>\r\n }\r\n </tbody>\r\n </table>\r\n <div class=\"form-row\">\r\n <mat-form-field>\r\n <mat-label>scope</mat-label>\r\n <input matInput formControlName=\"scope\" />\r\n @if (scope.hasError(\"maxLength\") && (scope.dirty || scope.touched)) {\r\n <mat-error>too long</mat-error>\r\n }\r\n @if (scope.hasError(\"pattern\") && (scope.dirty || scope.touched)) {\r\n <mat-error>invalid scope</mat-error>\r\n }\r\n </mat-form-field>\r\n <button\r\n mat-flat-button\r\n class=\"mat-primary\"\r\n type=\"submit\"\r\n [disabled]=\"form.invalid || readonly()\"\r\n matTooltip=\"Assign the scope to the checked parts\"\r\n >\r\n assign\r\n </button>\r\n </div>\r\n</form>\r\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"] }]
|
|
559
565
|
}], 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"] }] } });
|
|
560
566
|
|
|
561
567
|
/**
|
|
@@ -577,10 +583,10 @@ class ItemLookupDialogComponent {
|
|
|
577
583
|
onItemLookupChange(value) {
|
|
578
584
|
this.dialogRef.close(value);
|
|
579
585
|
}
|
|
580
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
581
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "
|
|
586
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.1", ngImport: i0, type: ItemLookupDialogComponent, deps: [{ token: i2.MatDialogRef }, { token: MAT_DIALOG_DATA }, { token: i2$1.ItemRefLookupService }], target: i0.ɵɵFactoryTarget.Component });
|
|
587
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "22.0.1", 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 });
|
|
582
588
|
}
|
|
583
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
589
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.1", ngImport: i0, type: ItemLookupDialogComponent, decorators: [{
|
|
584
590
|
type: Component,
|
|
585
591
|
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"] }]
|
|
586
592
|
}], ctorParameters: () => [{ type: i2.MatDialogRef }, { type: i2.MatDialogConfig, decorators: [{
|
|
@@ -595,7 +601,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.6", ngImpor
|
|
|
595
601
|
class ItemGenerateDialogComponent {
|
|
596
602
|
dialogRef;
|
|
597
603
|
config;
|
|
598
|
-
flags = signal([],
|
|
604
|
+
flags = signal([], /* @ts-ignore */
|
|
605
|
+
...(ngDevMode ? [{ debugName: "flags" }] : /* istanbul ignore next */ []));
|
|
599
606
|
itemCount;
|
|
600
607
|
itemTitle;
|
|
601
608
|
itemFlags;
|
|
@@ -634,10 +641,10 @@ class ItemGenerateDialogComponent {
|
|
|
634
641
|
flags: flags,
|
|
635
642
|
});
|
|
636
643
|
}
|
|
637
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
638
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "
|
|
644
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.1", ngImport: i0, type: ItemGenerateDialogComponent, deps: [{ token: i1$1.FormBuilder }, { token: i2.MatDialogRef }, { token: MAT_DIALOG_DATA }], target: i0.ɵɵFactoryTarget.Component });
|
|
645
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.1", type: ItemGenerateDialogComponent, isStandalone: true, selector: "cadmus-item-generate-dialog", ngImport: i0, template: "<div id=\"container\">\r\n <h3>Generate Items</h3>\r\n <form [formGroup]=\"form\" (submit)=\"apply()\">\r\n <!-- count -->\r\n <div>\r\n <mat-form-field class=\"input-nr\">\r\n <mat-label>count</mat-label>\r\n <input matInput type=\"number\" min=\"1\" [formControl]=\"itemCount\" />\r\n <mat-hint>number of items to generate</mat-hint>\r\n @if (\r\n itemCount.errors?.[\"required\"] && (itemCount.dirty || itemCount.touched)\r\n ) {\r\n <mat-error>count required</mat-error>\r\n }\r\n @if (\r\n itemCount.errors?.[\"min\"] && (itemCount.dirty || itemCount.touched)\r\n ) {\r\n <mat-error>count too low</mat-error>\r\n }\r\n @if (\r\n itemCount.errors?.[\"max\"] && (itemCount.dirty || itemCount.touched)\r\n ) {\r\n <mat-error>count too high</mat-error>\r\n }\r\n </mat-form-field>\r\n </div>\r\n\r\n <!-- title -->\r\n <div>\r\n <mat-form-field>\r\n <mat-label>title</mat-label>\r\n <input matInput [formControl]=\"itemTitle\" />\r\n <mat-hint>title template ({{ \"{0}\" }}=N)</mat-hint>\r\n @if (\r\n itemTitle.errors?.[\"required\"] &&\r\n (itemTitle.dirty || itemTitle.touched)\r\n ) {\r\n <mat-error>title required</mat-error>\r\n }\r\n @if (\r\n itemTitle.errors?.[\"maxlength\"] &&\r\n (itemTitle.dirty || itemTitle.touched)\r\n ) {\r\n <mat-error>title too long</mat-error>\r\n }\r\n </mat-form-field>\r\n </div>\r\n\r\n <!-- flags -->\r\n @if (flags().length) {\r\n <div>\r\n <mat-form-field>\r\n <mat-label>flags</mat-label>\r\n <mat-select [formControl]=\"itemFlags\" multiple>\r\n @for (flag of flags(); track flag.id) {\r\n <mat-option [value]=\"flag\">\r\n <span class=\"flag-bullet\" [style.color]=\"'#' + flag.colorKey\"\r\n >⬤</span\r\n >\r\n {{ flag.label }}\r\n </mat-option>\r\n }\r\n </mat-select>\r\n </mat-form-field>\r\n </div>\r\n }\r\n\r\n <!-- apply button -->\r\n <div>\r\n <button\r\n mat-flat-button\r\n class=\"mat-primary\"\r\n type=\"submit\"\r\n [disabled]=\"form.invalid\"\r\n >\r\n generate\r\n </button>\r\n </div>\r\n </form>\r\n</div>\r\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]):not([ngNoCva])[formControlName],textarea:not([ngNoCva])[formControlName],input:not([type=checkbox]):not([ngNoCva])[formControl],textarea:not([ngNoCva])[formControl],input:not([type=checkbox]):not([ngNoCva])[ngModel],textarea:not([ngNoCva])[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1$1.NumberValueAccessor, selector: "input[type=number]:not([ngNoCva])[formControlName],input[type=number]:not([ngNoCva])[formControl],input[type=number]:not([ngNoCva])[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 });
|
|
639
646
|
}
|
|
640
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
647
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.1", ngImport: i0, type: ItemGenerateDialogComponent, decorators: [{
|
|
641
648
|
type: Component,
|
|
642
649
|
args: [{ selector: 'cadmus-item-generate-dialog', changeDetection: ChangeDetectionStrategy.OnPush, imports: [
|
|
643
650
|
ReactiveFormsModule,
|
|
@@ -649,21 +656,26 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.6", ngImpor
|
|
|
649
656
|
MatSelect,
|
|
650
657
|
MatOption,
|
|
651
658
|
MatButton,
|
|
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"] }]
|
|
659
|
+
], template: "<div id=\"container\">\r\n <h3>Generate Items</h3>\r\n <form [formGroup]=\"form\" (submit)=\"apply()\">\r\n <!-- count -->\r\n <div>\r\n <mat-form-field class=\"input-nr\">\r\n <mat-label>count</mat-label>\r\n <input matInput type=\"number\" min=\"1\" [formControl]=\"itemCount\" />\r\n <mat-hint>number of items to generate</mat-hint>\r\n @if (\r\n itemCount.errors?.[\"required\"] && (itemCount.dirty || itemCount.touched)\r\n ) {\r\n <mat-error>count required</mat-error>\r\n }\r\n @if (\r\n itemCount.errors?.[\"min\"] && (itemCount.dirty || itemCount.touched)\r\n ) {\r\n <mat-error>count too low</mat-error>\r\n }\r\n @if (\r\n itemCount.errors?.[\"max\"] && (itemCount.dirty || itemCount.touched)\r\n ) {\r\n <mat-error>count too high</mat-error>\r\n }\r\n </mat-form-field>\r\n </div>\r\n\r\n <!-- title -->\r\n <div>\r\n <mat-form-field>\r\n <mat-label>title</mat-label>\r\n <input matInput [formControl]=\"itemTitle\" />\r\n <mat-hint>title template ({{ \"{0}\" }}=N)</mat-hint>\r\n @if (\r\n itemTitle.errors?.[\"required\"] &&\r\n (itemTitle.dirty || itemTitle.touched)\r\n ) {\r\n <mat-error>title required</mat-error>\r\n }\r\n @if (\r\n itemTitle.errors?.[\"maxlength\"] &&\r\n (itemTitle.dirty || itemTitle.touched)\r\n ) {\r\n <mat-error>title too long</mat-error>\r\n }\r\n </mat-form-field>\r\n </div>\r\n\r\n <!-- flags -->\r\n @if (flags().length) {\r\n <div>\r\n <mat-form-field>\r\n <mat-label>flags</mat-label>\r\n <mat-select [formControl]=\"itemFlags\" multiple>\r\n @for (flag of flags(); track flag.id) {\r\n <mat-option [value]=\"flag\">\r\n <span class=\"flag-bullet\" [style.color]=\"'#' + flag.colorKey\"\r\n >⬤</span\r\n >\r\n {{ flag.label }}\r\n </mat-option>\r\n }\r\n </mat-select>\r\n </mat-form-field>\r\n </div>\r\n }\r\n\r\n <!-- apply button -->\r\n <div>\r\n <button\r\n mat-flat-button\r\n class=\"mat-primary\"\r\n type=\"submit\"\r\n [disabled]=\"form.invalid\"\r\n >\r\n generate\r\n </button>\r\n </div>\r\n </form>\r\n</div>\r\n", styles: ["#container{padding:16px}.flag-bullet{margin-right:.5em}.input-nr{width:5em}\n"] }]
|
|
653
660
|
}], ctorParameters: () => [{ type: i1$1.FormBuilder }, { type: i2.MatDialogRef }, { type: i2.MatDialogConfig, decorators: [{
|
|
654
661
|
type: Inject,
|
|
655
662
|
args: [MAT_DIALOG_DATA]
|
|
656
663
|
}] }] });
|
|
657
664
|
|
|
658
665
|
class MissingPartsComponent {
|
|
659
|
-
facetDefinition = input(
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
666
|
+
facetDefinition = input(/* @ts-ignore */
|
|
667
|
+
...(ngDevMode ? [undefined, { debugName: "facetDefinition" }] : /* istanbul ignore next */ []));
|
|
668
|
+
partDefinitions = input(/* @ts-ignore */
|
|
669
|
+
...(ngDevMode ? [undefined, { debugName: "partDefinitions" }] : /* istanbul ignore next */ []));
|
|
670
|
+
parts = input(/* @ts-ignore */
|
|
671
|
+
...(ngDevMode ? [undefined, { debugName: "parts" }] : /* istanbul ignore next */ []));
|
|
672
|
+
missingDefinitions = signal([], /* @ts-ignore */
|
|
673
|
+
...(ngDevMode ? [{ debugName: "missingDefinitions" }] : /* istanbul ignore next */ []));
|
|
663
674
|
/**
|
|
664
675
|
* The types thesaurus.
|
|
665
676
|
*/
|
|
666
|
-
typeThesaurus = input(
|
|
677
|
+
typeThesaurus = input(/* @ts-ignore */
|
|
678
|
+
...(ngDevMode ? [undefined, { debugName: "typeThesaurus" }] : /* istanbul ignore next */ []));
|
|
667
679
|
/**
|
|
668
680
|
* Emitted when the user requests to add a missing part.
|
|
669
681
|
*/
|
|
@@ -695,12 +707,12 @@ class MissingPartsComponent {
|
|
|
695
707
|
requestAddPart(definition) {
|
|
696
708
|
this.addRequest.emit(definition);
|
|
697
709
|
}
|
|
698
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
699
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "
|
|
710
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.1", ngImport: i0, type: MissingPartsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
711
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.1", 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) {\r\n <div>\r\n <fieldset>\r\n <legend>\r\n <mat-icon class=\"mat-warn\">warning</mat-icon> Missing Parts\r\n </legend>\r\n <table>\r\n <tbody>\r\n @for (\r\n def of missingDefinitions();\r\n track def.typeId + \":\" + (def.roleId ?? \"\")\r\n ) {\r\n <tr>\r\n <td>\r\n <button\r\n type=\"button\"\r\n mat-icon-button\r\n matTooltip=\"Add this part\"\r\n (click)=\"requestAddPart(def)\"\r\n >\r\n <mat-icon>add_circle</mat-icon>\r\n </button>\r\n </td>\r\n <td [matTooltip]=\"def.description\">\r\n <cadmus-part-badge\r\n [partTypeIds]=\"def\"\r\n [facetDefinition]=\"facetDefinition()\"\r\n [typeThesaurus]=\"typeThesaurus()\"\r\n />\r\n </td>\r\n </tr>\r\n }\r\n </tbody>\r\n </table>\r\n </fieldset>\r\n </div>\r\n}\r\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 });
|
|
700
712
|
}
|
|
701
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
713
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.1", ngImport: i0, type: MissingPartsComponent, decorators: [{
|
|
702
714
|
type: Component,
|
|
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"] }]
|
|
715
|
+
args: [{ selector: 'cadmus-missing-parts', changeDetection: ChangeDetectionStrategy.OnPush, imports: [MatIcon, MatIconButton, MatTooltip, PartBadgeComponent], template: "@if (missingDefinitions().length) {\r\n <div>\r\n <fieldset>\r\n <legend>\r\n <mat-icon class=\"mat-warn\">warning</mat-icon> Missing Parts\r\n </legend>\r\n <table>\r\n <tbody>\r\n @for (\r\n def of missingDefinitions();\r\n track def.typeId + \":\" + (def.roleId ?? \"\")\r\n ) {\r\n <tr>\r\n <td>\r\n <button\r\n type=\"button\"\r\n mat-icon-button\r\n matTooltip=\"Add this part\"\r\n (click)=\"requestAddPart(def)\"\r\n >\r\n <mat-icon>add_circle</mat-icon>\r\n </button>\r\n </td>\r\n <td [matTooltip]=\"def.description\">\r\n <cadmus-part-badge\r\n [partTypeIds]=\"def\"\r\n [facetDefinition]=\"facetDefinition()\"\r\n [typeThesaurus]=\"typeThesaurus()\"\r\n />\r\n </td>\r\n </tr>\r\n }\r\n </tbody>\r\n </table>\r\n </fieldset>\r\n </div>\r\n}\r\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"] }]
|
|
704
716
|
}], 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"] }] } });
|
|
705
717
|
|
|
706
718
|
/**
|
|
@@ -738,10 +750,10 @@ class HasPreviewPipe {
|
|
|
738
750
|
const key = value.roleId ? `${value.typeId}|${value.roleId}` : value.typeId;
|
|
739
751
|
return rKeys?.find((k) => k === key) ? true : false;
|
|
740
752
|
}
|
|
741
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
742
|
-
static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "
|
|
753
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.1", ngImport: i0, type: HasPreviewPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
754
|
+
static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "22.0.1", ngImport: i0, type: HasPreviewPipe, isStandalone: true, name: "hasPreview" });
|
|
743
755
|
}
|
|
744
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
756
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.1", ngImport: i0, type: HasPreviewPipe, decorators: [{
|
|
745
757
|
type: Pipe,
|
|
746
758
|
args: [{ name: 'hasPreview' }]
|
|
747
759
|
}] });
|
|
@@ -765,6 +777,7 @@ class ItemEditorComponent {
|
|
|
765
777
|
_authService;
|
|
766
778
|
_userLevelService;
|
|
767
779
|
_messaging;
|
|
780
|
+
_envService;
|
|
768
781
|
// signals from edited-item repository
|
|
769
782
|
item;
|
|
770
783
|
parts;
|
|
@@ -778,11 +791,15 @@ class ItemEditorComponent {
|
|
|
778
791
|
previewJKeys;
|
|
779
792
|
previewFKeys;
|
|
780
793
|
flagDefinitions;
|
|
781
|
-
id = signal(undefined,
|
|
794
|
+
id = signal(undefined, /* @ts-ignore */
|
|
795
|
+
...(ngDevMode ? [{ debugName: "id" }] : /* istanbul ignore next */ []));
|
|
782
796
|
_currentUser;
|
|
783
797
|
user;
|
|
784
798
|
userLevel;
|
|
785
|
-
busy = signal(false,
|
|
799
|
+
busy = signal(false, /* @ts-ignore */
|
|
800
|
+
...(ngDevMode ? [{ debugName: "busy" }] : /* istanbul ignore next */ []));
|
|
801
|
+
hasMetadataBuilders = signal(false, /* @ts-ignore */
|
|
802
|
+
...(ngDevMode ? [{ debugName: "hasMetadataBuilders" }] : /* istanbul ignore next */ []));
|
|
786
803
|
// flag-set signals
|
|
787
804
|
_flagsValue;
|
|
788
805
|
/** Flags adapted for FlagSetComponent; admin flags excluded for non-admins. */
|
|
@@ -802,7 +819,7 @@ class ItemEditorComponent {
|
|
|
802
819
|
group;
|
|
803
820
|
flags;
|
|
804
821
|
metadata;
|
|
805
|
-
constructor(itemLookupService, dialog, _router, _route, _snackbar, _appRepository, _repository, _itemService, _libraryRouteService, _dialogService, _authService, _userLevelService, _messaging, _formBuilder) {
|
|
822
|
+
constructor(itemLookupService, dialog, _router, _route, _snackbar, _appRepository, _repository, _itemService, _libraryRouteService, _dialogService, _authService, _userLevelService, _messaging, _envService, _formBuilder) {
|
|
806
823
|
this.itemLookupService = itemLookupService;
|
|
807
824
|
this.dialog = dialog;
|
|
808
825
|
this._router = _router;
|
|
@@ -816,10 +833,12 @@ class ItemEditorComponent {
|
|
|
816
833
|
this._authService = _authService;
|
|
817
834
|
this._userLevelService = _userLevelService;
|
|
818
835
|
this._messaging = _messaging;
|
|
836
|
+
this._envService = _envService;
|
|
819
837
|
this.id.set(this._route.snapshot.params['id']);
|
|
820
838
|
if (this.id() === 'new') {
|
|
821
839
|
this.id.set(undefined);
|
|
822
840
|
}
|
|
841
|
+
this.hasMetadataBuilders.set(this._envService.get('hasMetadataBuilders') === 'true');
|
|
823
842
|
// new part form
|
|
824
843
|
this.newPartType = _formBuilder.control(null, Validators.required);
|
|
825
844
|
this.newPart = _formBuilder.group({
|
|
@@ -880,12 +899,14 @@ class ItemEditorComponent {
|
|
|
880
899
|
this._currentUser = toSignal(this._authService.currentUser$, {
|
|
881
900
|
initialValue: null,
|
|
882
901
|
});
|
|
883
|
-
this.user = computed(() => this._currentUser() ?? undefined,
|
|
902
|
+
this.user = computed(() => this._currentUser() ?? undefined, /* @ts-ignore */
|
|
903
|
+
...(ngDevMode ? [{ debugName: "user" }] : /* istanbul ignore next */ []));
|
|
884
904
|
this.userLevel = computed(() => {
|
|
885
905
|
// track user changes so userLevel is recomputed on login/logout
|
|
886
906
|
this._currentUser();
|
|
887
907
|
return this._userLevelService.getCurrentUserLevel();
|
|
888
|
-
},
|
|
908
|
+
}, /* @ts-ignore */
|
|
909
|
+
...(ngDevMode ? [{ debugName: "userLevel" }] : /* istanbul ignore next */ []));
|
|
889
910
|
// flags signal (tracks the flags form control value)
|
|
890
911
|
this._flagsValue = toSignal(this.flags.valueChanges, { initialValue: 0 });
|
|
891
912
|
// flags for FlagSetComponent: exclude admin flags for non-admins
|
|
@@ -895,20 +916,23 @@ class ItemEditorComponent {
|
|
|
895
916
|
id: String(def.id),
|
|
896
917
|
label: def.label,
|
|
897
918
|
color: '#' + def.colorKey,
|
|
898
|
-
})),
|
|
919
|
+
})), /* @ts-ignore */
|
|
920
|
+
...(ngDevMode ? [{ debugName: "flagSetFlags" }] : /* istanbul ignore next */ []));
|
|
899
921
|
// admin-only flags shown read-only when user is not admin
|
|
900
922
|
this.adminFlagDefs = computed(() => {
|
|
901
923
|
if (this.userLevel() >= 4)
|
|
902
924
|
return [];
|
|
903
925
|
return this.flagDefinitions().filter((def) => def.isAdmin === true);
|
|
904
|
-
},
|
|
926
|
+
}, /* @ts-ignore */
|
|
927
|
+
...(ngDevMode ? [{ debugName: "adminFlagDefs" }] : /* istanbul ignore next */ []));
|
|
905
928
|
// checked flag IDs derived from the bitmask value
|
|
906
929
|
this.checkedFlagIds = computed(() => {
|
|
907
930
|
const value = this._flagsValue();
|
|
908
931
|
return this.flagDefinitions()
|
|
909
932
|
.filter((def) => (value & def.id) !== 0)
|
|
910
933
|
.map((def) => String(def.id));
|
|
911
|
-
},
|
|
934
|
+
}, /* @ts-ignore */
|
|
935
|
+
...(ngDevMode ? [{ debugName: "checkedFlagIds" }] : /* istanbul ignore next */ []));
|
|
912
936
|
// update the metadata form whenever the item changes
|
|
913
937
|
effect(() => {
|
|
914
938
|
this.updateMetadataForm(this.item());
|
|
@@ -1186,10 +1210,64 @@ class ItemEditorComponent {
|
|
|
1186
1210
|
});
|
|
1187
1211
|
});
|
|
1188
1212
|
}
|
|
1189
|
-
|
|
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 });
|
|
1213
|
+
generateTitle() {
|
|
1214
|
+
if (this.busy()) {
|
|
1215
|
+
return;
|
|
1216
|
+
}
|
|
1217
|
+
this.busy.set(true);
|
|
1218
|
+
this._itemService.getItemMetadata(this.id(), 'T').subscribe({
|
|
1219
|
+
next: (title) => {
|
|
1220
|
+
const result = title['T'];
|
|
1221
|
+
if (result) {
|
|
1222
|
+
this.title.setValue(result);
|
|
1223
|
+
this.title.markAsDirty();
|
|
1224
|
+
this.title.updateValueAndValidity();
|
|
1225
|
+
}
|
|
1226
|
+
else {
|
|
1227
|
+
this._snackbar.open('No title generated', 'OK', { duration: 3000 });
|
|
1228
|
+
}
|
|
1229
|
+
},
|
|
1230
|
+
error: (error) => {
|
|
1231
|
+
console.error(error);
|
|
1232
|
+
this._snackbar.open('Error generating title', 'OK');
|
|
1233
|
+
},
|
|
1234
|
+
complete: () => {
|
|
1235
|
+
this.busy.set(false);
|
|
1236
|
+
},
|
|
1237
|
+
});
|
|
1238
|
+
}
|
|
1239
|
+
generateDescription() {
|
|
1240
|
+
if (this.busy()) {
|
|
1241
|
+
return;
|
|
1242
|
+
}
|
|
1243
|
+
this.busy.set(true);
|
|
1244
|
+
this._itemService.getItemMetadata(this.id(), 'D').subscribe({
|
|
1245
|
+
next: (description) => {
|
|
1246
|
+
const result = description['D'];
|
|
1247
|
+
if (result) {
|
|
1248
|
+
this.description.setValue(result);
|
|
1249
|
+
this.description.markAsDirty();
|
|
1250
|
+
this.description.updateValueAndValidity();
|
|
1251
|
+
}
|
|
1252
|
+
else {
|
|
1253
|
+
this._snackbar.open('No description generated', 'OK', {
|
|
1254
|
+
duration: 3000,
|
|
1255
|
+
});
|
|
1256
|
+
}
|
|
1257
|
+
},
|
|
1258
|
+
error: (error) => {
|
|
1259
|
+
console.error(error);
|
|
1260
|
+
this._snackbar.open('Error generating description', 'OK');
|
|
1261
|
+
},
|
|
1262
|
+
complete: () => {
|
|
1263
|
+
this.busy.set(false);
|
|
1264
|
+
},
|
|
1265
|
+
});
|
|
1266
|
+
}
|
|
1267
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.1", 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: i11.EnvService }, { token: i1$1.FormBuilder }], target: i0.ɵɵFactoryTarget.Component });
|
|
1268
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.1", type: ItemEditorComponent, isStandalone: true, selector: "cadmus-item-editor", ngImport: i0, template: "<mat-card appearance=\"outlined\">\r\n <mat-card-content>\r\n <div>\r\n <cadmus-current-item-bar />\r\n </div>\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 class=\"flex-field\">\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 @if (hasMetadataBuilders()) {\r\n <!-- auto title -->\r\n <button\r\n type=\"button\"\r\n mat-icon-button\r\n [disabled]=\"busy()\"\r\n (click)=\"generateTitle()\"\r\n >\r\n <mat-icon matTooltip=\"Generate title\">auto_awesome</mat-icon>\r\n </button>\r\n }\r\n\r\n <!-- sortKey -->\r\n <mat-form-field class=\"flex-field\">\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 class=\"flex-row\">\r\n <mat-form-field class=\"item\">\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\r\n @if (hasMetadataBuilders()) {\r\n <!-- auto description -->\r\n <button\r\n class=\"item fit\"\r\n type=\"button\"\r\n mat-icon-button\r\n [disabled]=\"busy()\"\r\n (click)=\"generateDescription()\"\r\n >\r\n <mat-icon matTooltip=\"Generate description\"\r\n >auto_awesome</mat-icon\r\n >\r\n </button>\r\n }\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]=\"facetCtrl\" required=\"true\">\r\n @for (f of facets(); 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 <!-- read-only admin flags for non-admin users -->\r\n @if (adminFlagDefs().length) {\r\n <div class=\"admin-flags\">\r\n @for (def of adminFlagDefs(); track def.id) {\r\n <span class=\"admin-flag\">\r\n <span [style.color]=\"'#' + def.colorKey\">◆</span>\r\n {{ def.label }}\r\n </span>\r\n }\r\n </div>\r\n }\r\n <!-- editable flags -->\r\n @if (flagSetFlags().length) {\r\n <cadmus-ui-flag-set\r\n [hideToolbar]=\"true\"\r\n [flags]=\"flagSetFlags()\"\r\n [checkedIds]=\"checkedFlagIds()\"\r\n (checkedIdsChange)=\"onFlagCheckedIdsChange($event)\"\r\n />\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();\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(); 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 ID -->\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 | hasPreview: previewJKeys() : previewFKeys()\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()\"\r\n [badgeType]=\"1\"\r\n [typeThesaurus]=\"typeThesaurus()\"\r\n />\r\n </td>\r\n <td>\r\n <cadmus-part-badge\r\n [partTypeIds]=\"part\"\r\n [facetDefinition]=\"facet()\"\r\n [badgeType]=\"2\"\r\n [typeThesaurus]=\"typeThesaurus()\"\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()\"\r\n [partDefinitions]=\"\r\n $safeNavigationMigration(facet()?.partDefinitions)\r\n \"\r\n [parts]=\"parts()\"\r\n [typeThesaurus]=\"typeThesaurus()\"\r\n (addRequest)=\"addPart($event)\"\r\n />\r\n </mat-tab>\r\n }\r\n\r\n <!-- layers -->\r\n @if (id()) {\r\n <mat-tab label=\"Layers\">\r\n <table id=\"layers\">\r\n <thead>\r\n <th aria-label=\"actions\"></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 layerPartInfos();\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()\"\r\n [badgeType]=\"1\"\r\n [typeThesaurus]=\"typeThesaurus()\"\r\n />\r\n </td>\r\n <td>\r\n <cadmus-part-badge\r\n [partTypeIds]=\"part\"\r\n [facetDefinition]=\"facet()\"\r\n [badgeType]=\"2\"\r\n [typeThesaurus]=\"typeThesaurus()\"\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 </mat-tab>\r\n }\r\n\r\n <!-- thesaurus scopes -->\r\n @if (parts().length) {\r\n <mat-tab label=\"Th-Scopes\">\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%}.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}}.flex-row{display:flex;flex-wrap:wrap}.flex-row .item{box-sizing:border-box}.flex-row .item.fit{flex:0 0 auto}.flex-row .item:not(.fit){flex:1 1 auto}\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]):not([ngNoCva])[formControlName],textarea:not([ngNoCva])[formControlName],input:not([type=checkbox]):not([ngNoCva])[formControl],textarea:not([ngNoCva])[formControl],input:not([type=checkbox]):not([ngNoCva])[ngModel],textarea:not([ngNoCva])[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 });
|
|
1191
1269
|
}
|
|
1192
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1270
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.1", ngImport: i0, type: ItemEditorComponent, decorators: [{
|
|
1193
1271
|
type: Component,
|
|
1194
1272
|
args: [{ selector: 'cadmus-item-editor', changeDetection: ChangeDetectionStrategy.OnPush, imports: [
|
|
1195
1273
|
MatCard,
|
|
@@ -1221,8 +1299,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.6", ngImpor
|
|
|
1221
1299
|
PartBadgeComponent,
|
|
1222
1300
|
CurrentItemBarComponent,
|
|
1223
1301
|
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"] }]
|
|
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 }] });
|
|
1302
|
+
], template: "<mat-card appearance=\"outlined\">\r\n <mat-card-content>\r\n <div>\r\n <cadmus-current-item-bar />\r\n </div>\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 class=\"flex-field\">\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 @if (hasMetadataBuilders()) {\r\n <!-- auto title -->\r\n <button\r\n type=\"button\"\r\n mat-icon-button\r\n [disabled]=\"busy()\"\r\n (click)=\"generateTitle()\"\r\n >\r\n <mat-icon matTooltip=\"Generate title\">auto_awesome</mat-icon>\r\n </button>\r\n }\r\n\r\n <!-- sortKey -->\r\n <mat-form-field class=\"flex-field\">\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 class=\"flex-row\">\r\n <mat-form-field class=\"item\">\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\r\n @if (hasMetadataBuilders()) {\r\n <!-- auto description -->\r\n <button\r\n class=\"item fit\"\r\n type=\"button\"\r\n mat-icon-button\r\n [disabled]=\"busy()\"\r\n (click)=\"generateDescription()\"\r\n >\r\n <mat-icon matTooltip=\"Generate description\"\r\n >auto_awesome</mat-icon\r\n >\r\n </button>\r\n }\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]=\"facetCtrl\" required=\"true\">\r\n @for (f of facets(); 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 <!-- read-only admin flags for non-admin users -->\r\n @if (adminFlagDefs().length) {\r\n <div class=\"admin-flags\">\r\n @for (def of adminFlagDefs(); track def.id) {\r\n <span class=\"admin-flag\">\r\n <span [style.color]=\"'#' + def.colorKey\">◆</span>\r\n {{ def.label }}\r\n </span>\r\n }\r\n </div>\r\n }\r\n <!-- editable flags -->\r\n @if (flagSetFlags().length) {\r\n <cadmus-ui-flag-set\r\n [hideToolbar]=\"true\"\r\n [flags]=\"flagSetFlags()\"\r\n [checkedIds]=\"checkedFlagIds()\"\r\n (checkedIdsChange)=\"onFlagCheckedIdsChange($event)\"\r\n />\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();\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(); 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 ID -->\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 | hasPreview: previewJKeys() : previewFKeys()\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()\"\r\n [badgeType]=\"1\"\r\n [typeThesaurus]=\"typeThesaurus()\"\r\n />\r\n </td>\r\n <td>\r\n <cadmus-part-badge\r\n [partTypeIds]=\"part\"\r\n [facetDefinition]=\"facet()\"\r\n [badgeType]=\"2\"\r\n [typeThesaurus]=\"typeThesaurus()\"\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()\"\r\n [partDefinitions]=\"\r\n $safeNavigationMigration(facet()?.partDefinitions)\r\n \"\r\n [parts]=\"parts()\"\r\n [typeThesaurus]=\"typeThesaurus()\"\r\n (addRequest)=\"addPart($event)\"\r\n />\r\n </mat-tab>\r\n }\r\n\r\n <!-- layers -->\r\n @if (id()) {\r\n <mat-tab label=\"Layers\">\r\n <table id=\"layers\">\r\n <thead>\r\n <th aria-label=\"actions\"></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 layerPartInfos();\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()\"\r\n [badgeType]=\"1\"\r\n [typeThesaurus]=\"typeThesaurus()\"\r\n />\r\n </td>\r\n <td>\r\n <cadmus-part-badge\r\n [partTypeIds]=\"part\"\r\n [facetDefinition]=\"facet()\"\r\n [badgeType]=\"2\"\r\n [typeThesaurus]=\"typeThesaurus()\"\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 </mat-tab>\r\n }\r\n\r\n <!-- thesaurus scopes -->\r\n @if (parts().length) {\r\n <mat-tab label=\"Th-Scopes\">\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%}.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}}.flex-row{display:flex;flex-wrap:wrap}.flex-row .item{box-sizing:border-box}.flex-row .item.fit{flex:0 0 auto}.flex-row .item:not(.fit){flex:1 1 auto}\n"] }]
|
|
1303
|
+
}], 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: i11.EnvService }, { type: i1$1.FormBuilder }] });
|
|
1226
1304
|
|
|
1227
1305
|
/*
|
|
1228
1306
|
* Public API Surface of cadmus-item-editor
|