@myrmidon/cadmus-item-editor 16.1.2 → 16.1.4

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