@myrmidon/cadmus-item-editor 1.1.2 → 2.0.2

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,51 +1,319 @@
1
1
  import * as i0 from '@angular/core';
2
- import { EventEmitter, Component, Input, Output, Pipe, NgModule } from '@angular/core';
3
- import * as i8 from '@angular/forms';
2
+ import { Injectable, EventEmitter, Component, Input, Output, Pipe, NgModule } from '@angular/core';
3
+ import { take, forkJoin } from 'rxjs';
4
+ import { createStore, withProps, select, setProp } from '@ngneat/elf';
5
+ import { withRequestsStatus, updateRequestStatus } from '@ngneat/elf-requests';
6
+ import * as i1 from '@myrmidon/cadmus-state';
7
+ import { CadmusStateModule } from '@myrmidon/cadmus-state';
8
+ import * as i2 from '@myrmidon/cadmus-api';
9
+ import { CadmusApiModule } from '@myrmidon/cadmus-api';
10
+ import * as i9 from '@angular/forms';
4
11
  import { Validators, ReactiveFormsModule, FormsModule } from '@angular/forms';
5
- import { take } from 'rxjs/operators';
6
- import * as i1 from '@angular/router';
12
+ import { take as take$1 } from 'rxjs/operators';
13
+ import * as i1$1 from '@angular/router';
7
14
  import { RouterModule } from '@angular/router';
8
15
  import * as i2$1 from '@angular/material/snack-bar';
9
- import * as i3$2 from '@myrmidon/cadmus-state';
10
- import { CadmusStateModule } from '@myrmidon/cadmus-state';
11
- import * as i4$1 from '@myrmidon/cadmus-api';
12
- import { CadmusApiModule } from '@myrmidon/cadmus-api';
13
- import * as i5 from '@myrmidon/cadmus-core';
16
+ import * as i6 from '@myrmidon/cadmus-core';
14
17
  import { CadmusCoreModule } from '@myrmidon/cadmus-core';
15
18
  import * as i3$1 from '@myrmidon/ng-mat-tools';
16
19
  import { NgMatToolsModule } from '@myrmidon/ng-mat-tools';
17
- import * as i7$1 from '@myrmidon/auth-jwt-login';
18
- import * as i9 from '@angular/common';
20
+ import * as i8$1 from '@myrmidon/auth-jwt-login';
21
+ import * as i10 from '@angular/common';
19
22
  import { CommonModule } from '@angular/common';
20
- import * as i10 from '@angular/cdk/clipboard';
23
+ import * as i11 from '@angular/cdk/clipboard';
21
24
  import { ClipboardModule } from '@angular/cdk/clipboard';
22
- import * as i2 from '@angular/material/button';
25
+ import * as i12 from '@angular/material/button';
23
26
  import { MatButtonModule } from '@angular/material/button';
24
- import * as i7 from '@angular/material/checkbox';
27
+ import * as i8 from '@angular/material/checkbox';
25
28
  import { MatCheckboxModule } from '@angular/material/checkbox';
26
- import * as i13 from '@angular/material/card';
29
+ import * as i14 from '@angular/material/card';
27
30
  import { MatCardModule } from '@angular/material/card';
28
- import * as i14 from '@angular/material/divider';
31
+ import * as i15 from '@angular/material/divider';
29
32
  import { MatDividerModule } from '@angular/material/divider';
30
- import * as i15 from '@angular/material/expansion';
33
+ import * as i16 from '@angular/material/expansion';
31
34
  import { MatExpansionModule } from '@angular/material/expansion';
32
- import * as i8$1 from '@angular/material/form-field';
35
+ import * as i9$1 from '@angular/material/form-field';
33
36
  import { MatFormFieldModule } from '@angular/material/form-field';
34
37
  import * as i3 from '@angular/material/icon';
35
38
  import { MatIconModule } from '@angular/material/icon';
36
- import * as i9$1 from '@angular/material/input';
39
+ import * as i10$1 from '@angular/material/input';
37
40
  import { MatInputModule } from '@angular/material/input';
38
- import * as i19 from '@angular/material/progress-bar';
41
+ import * as i20 from '@angular/material/progress-bar';
39
42
  import { MatProgressBarModule } from '@angular/material/progress-bar';
40
- import * as i20 from '@angular/material/select';
43
+ import * as i21 from '@angular/material/select';
41
44
  import { MatSelectModule } from '@angular/material/select';
42
- import * as i21 from '@angular/material/core';
43
- import * as i22 from '@angular/material/tabs';
45
+ import * as i22 from '@angular/material/core';
46
+ import * as i23 from '@angular/material/tabs';
44
47
  import { MatTabsModule } from '@angular/material/tabs';
45
48
  import * as i4 from '@myrmidon/cadmus-ui';
46
49
  import { CustomValidators, CadmusUiModule } from '@myrmidon/cadmus-ui';
47
50
  import { NgToolsModule } from '@myrmidon/ng-tools';
48
51
 
52
+ /**
53
+ * Edited item ELF repository.
54
+ */
55
+ class EditedItemRepository {
56
+ // public status$: Observable<StatusState>;
57
+ constructor(_appRepository, _itemService) {
58
+ this._appRepository = _appRepository;
59
+ this._itemService = _itemService;
60
+ this._store = createStore({ name: 'edited-item' }, withProps({
61
+ parts: [],
62
+ partGroups: [],
63
+ layerPartInfos: [],
64
+ }), withRequestsStatus());
65
+ this.item$ = this._store.pipe(select((state) => state.item));
66
+ this.parts$ = this._store.pipe(select((state) => state.parts));
67
+ this.partGroups$ = this._store.pipe(select((state) => state.partGroups));
68
+ this.layers$ = this._store.pipe(select((state) => state.layerPartInfos));
69
+ this.facet$ = this._store.pipe(select((state) => state.facet));
70
+ // this.status$ = this._store.pipe(selectRequestStatus('edited-item'));
71
+ }
72
+ getValue() {
73
+ return this._store.getValue();
74
+ }
75
+ getItem() {
76
+ return this._store.query((state) => state.item);
77
+ }
78
+ getFacet() {
79
+ return this._store.query((state) => state.facet);
80
+ }
81
+ getPartGroups() {
82
+ return this._store.query((state) => state.partGroups);
83
+ }
84
+ pickDefaultFacet(facets) {
85
+ if (!facets.length) {
86
+ return undefined;
87
+ }
88
+ // if there is a facet with id="default", pick it
89
+ const defaultFacet = facets.find((f) => f.id === 'default');
90
+ if (defaultFacet) {
91
+ return defaultFacet;
92
+ }
93
+ // else just pick the first in the list
94
+ return facets[0];
95
+ }
96
+ /**
97
+ * Load the specified item or a new item.
98
+ *
99
+ * @param itemId The item ID, or undefined for a new item.
100
+ */
101
+ load(itemId) {
102
+ const app = this._appRepository.getValue();
103
+ this._store.update(updateRequestStatus('edited-item', 'pending'));
104
+ if (!itemId) {
105
+ // new item
106
+ this._itemService
107
+ .getItemLayerInfo('new', true)
108
+ .pipe(take(1))
109
+ .subscribe((layers) => {
110
+ this._store.update(updateRequestStatus('edited-item', 'success'));
111
+ this._store.update((state) => ({
112
+ ...state,
113
+ item: {
114
+ id: '',
115
+ title: '',
116
+ description: '',
117
+ facetId: '',
118
+ groupId: '',
119
+ sortKey: '',
120
+ flags: 0,
121
+ timeCreated: new Date(),
122
+ creatorId: '',
123
+ timeModified: new Date(),
124
+ userId: '',
125
+ },
126
+ parts: [],
127
+ partGroups: [],
128
+ layerPartInfos: layers,
129
+ facet: this.pickDefaultFacet(app.facets),
130
+ }));
131
+ });
132
+ }
133
+ else {
134
+ // existing item
135
+ forkJoin({
136
+ item: this._itemService.getItem(itemId, true),
137
+ layers: this._itemService.getItemLayerInfo(itemId, true),
138
+ })
139
+ .pipe(take(1))
140
+ .subscribe({
141
+ next: (result) => {
142
+ this._store.update(updateRequestStatus('edited-item', 'success'));
143
+ const itemFacet = app.facets.find((f) => {
144
+ return f.id === result.item.facetId;
145
+ });
146
+ const facetParts = itemFacet ? itemFacet.partDefinitions : [];
147
+ this._store.update((state) => ({
148
+ ...state,
149
+ item: result.item,
150
+ parts: result.item.parts || [],
151
+ partGroups: this._itemService.groupParts(result.item.parts || [], facetParts),
152
+ layerPartInfos: result.layers,
153
+ facet: itemFacet,
154
+ }));
155
+ },
156
+ });
157
+ }
158
+ }
159
+ /**
160
+ * Ensure that the item with the specified ID is loaded.
161
+ *
162
+ * @param id The item ID.
163
+ */
164
+ ensureItemLoaded(id) {
165
+ if (this.getItem()?.id === id) {
166
+ return;
167
+ }
168
+ this.load(id);
169
+ }
170
+ /**
171
+ * Save the specified item.
172
+ *
173
+ * @param item The item.
174
+ * @returns Promise with saved item.
175
+ */
176
+ save(item) {
177
+ return new Promise((resolve, reject) => {
178
+ this._itemService
179
+ .addItem(item)
180
+ .pipe(take(1))
181
+ .subscribe({
182
+ next: (saved) => {
183
+ this._store.update(setProp('item', saved));
184
+ resolve(saved);
185
+ },
186
+ error: (error) => {
187
+ if (error) {
188
+ console.error(JSON.stringify(error));
189
+ }
190
+ reject({ message: 'Error saving item ' + item.id, error: error });
191
+ },
192
+ });
193
+ });
194
+ }
195
+ /**
196
+ * Delete the specified part from this edited item.
197
+ *
198
+ * @param id The part's ID.
199
+ * @returns Promise with part ID.
200
+ */
201
+ deletePart(id) {
202
+ return new Promise((resolve, reject) => {
203
+ const itemId = this._store.getValue().item?.id;
204
+ if (!itemId) {
205
+ reject({
206
+ message: 'Cannot delete part of unsaved item',
207
+ });
208
+ }
209
+ this._itemService
210
+ .deletePart(id)
211
+ .pipe(take(1))
212
+ .subscribe({
213
+ next: (_) => {
214
+ this.load(itemId);
215
+ resolve(id);
216
+ },
217
+ error: (error) => {
218
+ if (error) {
219
+ console.error(JSON.stringify(error));
220
+ }
221
+ reject({
222
+ message: "Error deleting item's part " + id,
223
+ error: error,
224
+ });
225
+ },
226
+ });
227
+ });
228
+ }
229
+ /**
230
+ * Add a new layer part to this item.
231
+ *
232
+ * @param typeId The part type ID.
233
+ * @param roleId The part role ID.
234
+ * @returns Promise with new part.
235
+ */
236
+ addNewLayerPart(typeId, roleId) {
237
+ return new Promise((resolve, reject) => {
238
+ const itemId = this._store.getValue().item?.id;
239
+ if (!itemId) {
240
+ reject({
241
+ message: 'Cannot add part to unsaved item',
242
+ });
243
+ }
244
+ const part = {
245
+ itemId: itemId,
246
+ typeId,
247
+ roleId,
248
+ id: '',
249
+ creatorId: '',
250
+ userId: '',
251
+ timeCreated: new Date(),
252
+ timeModified: new Date(),
253
+ };
254
+ this._itemService
255
+ .addPart(part)
256
+ .pipe(take(1))
257
+ .subscribe({
258
+ next: (part) => {
259
+ this.load(itemId);
260
+ resolve(part);
261
+ },
262
+ error: (error) => {
263
+ if (error) {
264
+ console.error(JSON.stringify(error));
265
+ }
266
+ reject({
267
+ message: 'Error adding new layer part for item ' + itemId,
268
+ error: error,
269
+ });
270
+ },
271
+ });
272
+ });
273
+ }
274
+ /**
275
+ * Set the scope for the specified parts in this item.
276
+ *
277
+ * @param ids The part IDs.
278
+ * @param scope The scope to set.
279
+ * @returns Promise.
280
+ */
281
+ setPartThesaurusScope(ids, scope) {
282
+ return new Promise((resolve, reject) => {
283
+ const itemId = this._store.getValue().item?.id;
284
+ if (!itemId) {
285
+ reject({
286
+ message: 'Cannot set scope for unsaved item',
287
+ });
288
+ }
289
+ this._itemService
290
+ .setPartThesaurusScope(ids, scope)
291
+ .pipe(take(1))
292
+ .subscribe({
293
+ next: (_) => {
294
+ this.load(itemId);
295
+ resolve(true);
296
+ },
297
+ error: (error) => {
298
+ if (error) {
299
+ console.error(JSON.stringify(error));
300
+ }
301
+ reject({
302
+ message: "Error setting item's part scope",
303
+ error: error,
304
+ });
305
+ },
306
+ });
307
+ });
308
+ }
309
+ }
310
+ EditedItemRepository.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: EditedItemRepository, deps: [{ token: i1.AppRepository }, { token: i2.ItemService }], target: i0.ɵɵFactoryTarget.Injectable });
311
+ EditedItemRepository.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: EditedItemRepository, providedIn: 'root' });
312
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: EditedItemRepository, decorators: [{
313
+ type: Injectable,
314
+ args: [{ providedIn: 'root' }]
315
+ }], ctorParameters: function () { return [{ type: i1.AppRepository }, { type: i2.ItemService }]; } });
316
+
49
317
  class MissingPartsComponent {
50
318
  constructor() {
51
319
  this.missingDefinitions = [];
@@ -95,9 +363,9 @@ class MissingPartsComponent {
95
363
  }
96
364
  }
97
365
  }
98
- MissingPartsComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: MissingPartsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
99
- MissingPartsComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.3", type: MissingPartsComponent, selector: "cadmus-missing-parts", inputs: { partDefinitions: "partDefinitions", parts: "parts", typeThesaurus: "typeThesaurus" }, outputs: { addRequest: "addRequest" }, ngImport: i0, template: "<div *ngIf=\"missingDefinitions.length\">\r\n <h3><mat-icon color=\"warn\">warning</mat-icon>&nbsp; Missing Parts</h3>\r\n <table>\r\n <tbody>\r\n <tr *ngFor=\"let def of missingDefinitions\">\r\n <td>\r\n <button type=\"button\" mat-icon-button matTooltip=\"Add this part\">\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]=\"$any(def)\"\r\n [typeThesaurus]=\"typeThesaurus\"\r\n ></cadmus-part-badge>\r\n </td>\r\n </tr>\r\n </tbody>\r\n </table>\r\n</div>\r\n", styles: [""], dependencies: [{ kind: "directive", type: i9.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i9.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i2.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "component", type: i3.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: i4.PartBadgeComponent, selector: "cadmus-part-badge", inputs: ["badgeType", "typeThesaurus", "facetDefinition", "partTypeIds"] }] });
100
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: MissingPartsComponent, decorators: [{
366
+ MissingPartsComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: MissingPartsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
367
+ MissingPartsComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.0.0", type: MissingPartsComponent, selector: "cadmus-missing-parts", inputs: { partDefinitions: "partDefinitions", parts: "parts", typeThesaurus: "typeThesaurus" }, outputs: { addRequest: "addRequest" }, ngImport: i0, template: "<div *ngIf=\"missingDefinitions.length\">\r\n <h3><mat-icon color=\"warn\">warning</mat-icon>&nbsp; Missing Parts</h3>\r\n <table>\r\n <tbody>\r\n <tr *ngFor=\"let def of missingDefinitions\">\r\n <td>\r\n <button type=\"button\" mat-icon-button matTooltip=\"Add this part\">\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]=\"$any(def)\"\r\n [typeThesaurus]=\"typeThesaurus\"\r\n ></cadmus-part-badge>\r\n </td>\r\n </tr>\r\n </tbody>\r\n </table>\r\n</div>\r\n", styles: [""], dependencies: [{ kind: "directive", type: i10.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i10.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i12.MatIconButton, selector: "button[mat-icon-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "component", type: i3.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: i4.PartBadgeComponent, selector: "cadmus-part-badge", inputs: ["badgeType", "typeThesaurus", "facetDefinition", "partTypeIds"] }] });
368
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: MissingPartsComponent, decorators: [{
101
369
  type: Component,
102
370
  args: [{ selector: 'cadmus-missing-parts', template: "<div *ngIf=\"missingDefinitions.length\">\r\n <h3><mat-icon color=\"warn\">warning</mat-icon>&nbsp; Missing Parts</h3>\r\n <table>\r\n <tbody>\r\n <tr *ngFor=\"let def of missingDefinitions\">\r\n <td>\r\n <button type=\"button\" mat-icon-button matTooltip=\"Add this part\">\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]=\"$any(def)\"\r\n [typeThesaurus]=\"typeThesaurus\"\r\n ></cadmus-part-badge>\r\n </td>\r\n </tr>\r\n </tbody>\r\n </table>\r\n</div>\r\n" }]
103
371
  }], ctorParameters: function () { return []; }, propDecorators: { partDefinitions: [{
@@ -116,12 +384,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImpor
116
384
  * in the item editor.
117
385
  */
118
386
  class PartsScopeEditorComponent {
119
- constructor(_formBuilder, _facetService, _dialogService, _appQuery, _itemQuery) {
387
+ constructor(_formBuilder, _facetService, _dialogService, _appRepository, _editedItemRepository) {
120
388
  this._formBuilder = _formBuilder;
121
389
  this._facetService = _facetService;
122
390
  this._dialogService = _dialogService;
123
- this._appQuery = _appQuery;
124
- this._itemQuery = _itemQuery;
391
+ this._appRepository = _appRepository;
392
+ this._editedItemRepository = _editedItemRepository;
125
393
  // events
126
394
  this.setScopeRequest = new EventEmitter();
127
395
  // form
@@ -153,11 +421,11 @@ class PartsScopeEditorComponent {
153
421
  }
154
422
  }
155
423
  getPartColor(typeId, roleId) {
156
- const state = this._itemQuery.getValue();
157
- return this._facetService.getPartColor(typeId, roleId, state?.facet);
424
+ const facet = this._editedItemRepository.getFacet();
425
+ return this._facetService.getPartColor(typeId, roleId, facet);
158
426
  }
159
427
  getTypeIdName(typeId) {
160
- const state = this._appQuery.getValue();
428
+ const state = this._appRepository.getValue();
161
429
  if (!state || !state.typeThesaurus) {
162
430
  return typeId;
163
431
  }
@@ -200,12 +468,12 @@ class PartsScopeEditorComponent {
200
468
  });
201
469
  }
202
470
  }
203
- PartsScopeEditorComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: PartsScopeEditorComponent, deps: [{ token: i8.FormBuilder }, { token: i4$1.FacetService }, { token: i3$1.DialogService }, { token: i3$2.AppQuery }, { token: i3$2.EditItemQuery }], target: i0.ɵɵFactoryTarget.Component });
204
- PartsScopeEditorComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.3", type: PartsScopeEditorComponent, selector: "cadmus-parts-scope-editor", inputs: { parts: "parts", readonly: "readonly" }, 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 style=\"min-width: 32px\"></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 <tr\r\n formArrayName=\"checks\"\r\n *ngFor=\"let ctl of checks.controls; let i = index\"\r\n >\r\n <td>\r\n &nbsp;\r\n <mat-checkbox [formControlName]=\"i\"></mat-checkbox>\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 >{{ 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>{{ $any(parts)[i].timeModified | date: 'yyyy-MM-dd HH:mm:ss' }}</td>\r\n <td>{{ $any(parts)[i].userId }}</td>\r\n </tr>\r\n </tbody>\r\n </table>\r\n <div>\r\n <mat-form-field>\r\n <input matInput placeholder=\"scope\" formControlName=\"scope\" />\r\n <mat-error\r\n *ngIf=\"scope.hasError('maxLength') && (scope.dirty || scope.touched)\"\r\n >too long</mat-error\r\n >\r\n <mat-error\r\n *ngIf=\"scope.hasError('pattern') && (scope.dirty || scope.touched)\"\r\n >invalid scope</mat-error\r\n >\r\n </mat-form-field>\r\n </div>\r\n <button\r\n mat-raised-button\r\n color=\"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</form>\r\n", styles: ["th{font-weight:400;color:silver;text-align:left}td{padding:0 6px}span.model-type{padding:4px;border-radius:6px}table#parts{border-collapse:separate;border-spacing:0 8px}\n"], dependencies: [{ kind: "directive", type: i9.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i9.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i8.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i8.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: i8.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i8.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i8.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i8.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "directive", type: i8.FormArrayName, selector: "[formArrayName]", inputs: ["formArrayName"] }, { kind: "component", type: i2.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "component", type: i7.MatCheckbox, selector: "mat-checkbox", inputs: ["disableRipple", "color", "tabIndex"], exportAs: ["matCheckbox"] }, { kind: "directive", type: i8$1.MatError, selector: "mat-error", inputs: ["id"] }, { kind: "component", type: i8$1.MatFormField, selector: "mat-form-field", inputs: ["color", "appearance", "hideRequiredMarker", "hintLabel", "floatLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i9$1.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { kind: "pipe", type: i9.DatePipe, name: "date" }] });
205
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: PartsScopeEditorComponent, decorators: [{
471
+ PartsScopeEditorComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: PartsScopeEditorComponent, deps: [{ token: i9.FormBuilder }, { token: i2.FacetService }, { token: i3$1.DialogService }, { token: i1.AppRepository }, { token: EditedItemRepository }], target: i0.ɵɵFactoryTarget.Component });
472
+ PartsScopeEditorComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.0.0", type: PartsScopeEditorComponent, selector: "cadmus-parts-scope-editor", inputs: { parts: "parts", readonly: "readonly" }, 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 style=\"min-width: 32px\"></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 <tr\r\n formArrayName=\"checks\"\r\n *ngFor=\"let ctl of checks.controls; let i = index\"\r\n >\r\n <td>\r\n &nbsp;\r\n <mat-checkbox [formControlName]=\"i\"></mat-checkbox>\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 >{{ 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>{{ $any(parts)[i].timeModified | date: 'yyyy-MM-dd HH:mm:ss' }}</td>\r\n <td>{{ $any(parts)[i].userId }}</td>\r\n </tr>\r\n </tbody>\r\n </table>\r\n <div>\r\n <mat-form-field>\r\n <mat-label>scope</mat-label>\r\n <input matInput formControlName=\"scope\" />\r\n <mat-error\r\n *ngIf=\"scope.hasError('maxLength') && (scope.dirty || scope.touched)\"\r\n >too long</mat-error\r\n >\r\n <mat-error\r\n *ngIf=\"scope.hasError('pattern') && (scope.dirty || scope.touched)\"\r\n >invalid scope</mat-error\r\n >\r\n </mat-form-field>\r\n </div>\r\n <button\r\n mat-raised-button\r\n color=\"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</form>\r\n", styles: ["th{font-weight:400;color:silver;text-align:left}td{padding:0 6px}span.model-type{padding:4px;border-radius:6px}table#parts{border-collapse:separate;border-spacing:0 8px}\n"], dependencies: [{ kind: "directive", type: i10.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i10.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i9.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i9.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: i9.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i9.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i9.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i9.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "directive", type: i9.FormArrayName, selector: "[formArrayName]", inputs: ["formArrayName"] }, { kind: "component", type: i12.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "component", type: i8.MatCheckbox, selector: "mat-checkbox", inputs: ["disableRipple", "color", "tabIndex"], exportAs: ["matCheckbox"] }, { kind: "component", type: i9$1.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i9$1.MatLabel, selector: "mat-label" }, { kind: "directive", type: i9$1.MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "directive", type: i10$1.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { kind: "pipe", type: i10.DatePipe, name: "date" }] });
473
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: PartsScopeEditorComponent, decorators: [{
206
474
  type: Component,
207
- args: [{ selector: 'cadmus-parts-scope-editor', template: "<form [formGroup]=\"form\" (submit)=\"submit()\">\r\n <table id=\"parts\">\r\n <thead>\r\n <tr>\r\n <th style=\"min-width: 32px\"></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 <tr\r\n formArrayName=\"checks\"\r\n *ngFor=\"let ctl of checks.controls; let i = index\"\r\n >\r\n <td>\r\n &nbsp;\r\n <mat-checkbox [formControlName]=\"i\"></mat-checkbox>\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 >{{ 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>{{ $any(parts)[i].timeModified | date: 'yyyy-MM-dd HH:mm:ss' }}</td>\r\n <td>{{ $any(parts)[i].userId }}</td>\r\n </tr>\r\n </tbody>\r\n </table>\r\n <div>\r\n <mat-form-field>\r\n <input matInput placeholder=\"scope\" formControlName=\"scope\" />\r\n <mat-error\r\n *ngIf=\"scope.hasError('maxLength') && (scope.dirty || scope.touched)\"\r\n >too long</mat-error\r\n >\r\n <mat-error\r\n *ngIf=\"scope.hasError('pattern') && (scope.dirty || scope.touched)\"\r\n >invalid scope</mat-error\r\n >\r\n </mat-form-field>\r\n </div>\r\n <button\r\n mat-raised-button\r\n color=\"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</form>\r\n", styles: ["th{font-weight:400;color:silver;text-align:left}td{padding:0 6px}span.model-type{padding:4px;border-radius:6px}table#parts{border-collapse:separate;border-spacing:0 8px}\n"] }]
208
- }], ctorParameters: function () { return [{ type: i8.FormBuilder }, { type: i4$1.FacetService }, { type: i3$1.DialogService }, { type: i3$2.AppQuery }, { type: i3$2.EditItemQuery }]; }, propDecorators: { parts: [{
475
+ args: [{ selector: 'cadmus-parts-scope-editor', template: "<form [formGroup]=\"form\" (submit)=\"submit()\">\r\n <table id=\"parts\">\r\n <thead>\r\n <tr>\r\n <th style=\"min-width: 32px\"></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 <tr\r\n formArrayName=\"checks\"\r\n *ngFor=\"let ctl of checks.controls; let i = index\"\r\n >\r\n <td>\r\n &nbsp;\r\n <mat-checkbox [formControlName]=\"i\"></mat-checkbox>\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 >{{ 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>{{ $any(parts)[i].timeModified | date: 'yyyy-MM-dd HH:mm:ss' }}</td>\r\n <td>{{ $any(parts)[i].userId }}</td>\r\n </tr>\r\n </tbody>\r\n </table>\r\n <div>\r\n <mat-form-field>\r\n <mat-label>scope</mat-label>\r\n <input matInput formControlName=\"scope\" />\r\n <mat-error\r\n *ngIf=\"scope.hasError('maxLength') && (scope.dirty || scope.touched)\"\r\n >too long</mat-error\r\n >\r\n <mat-error\r\n *ngIf=\"scope.hasError('pattern') && (scope.dirty || scope.touched)\"\r\n >invalid scope</mat-error\r\n >\r\n </mat-form-field>\r\n </div>\r\n <button\r\n mat-raised-button\r\n color=\"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</form>\r\n", styles: ["th{font-weight:400;color:silver;text-align:left}td{padding:0 6px}span.model-type{padding:4px;border-radius:6px}table#parts{border-collapse:separate;border-spacing:0 8px}\n"] }]
476
+ }], ctorParameters: function () { return [{ type: i9.FormBuilder }, { type: i2.FacetService }, { type: i3$1.DialogService }, { type: i1.AppRepository }, { type: EditedItemRepository }]; }, propDecorators: { parts: [{
209
477
  type: Input
210
478
  }], readonly: [{
211
479
  type: Input
@@ -249,9 +517,9 @@ class HasPreviewPipe {
249
517
  return rKeys?.find((k) => k === key) ? true : false;
250
518
  }
251
519
  }
252
- HasPreviewPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: HasPreviewPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
253
- HasPreviewPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "14.1.3", ngImport: i0, type: HasPreviewPipe, name: "hasPreview" });
254
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: HasPreviewPipe, decorators: [{
520
+ HasPreviewPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: HasPreviewPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
521
+ HasPreviewPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "15.0.0", ngImport: i0, type: HasPreviewPipe, name: "hasPreview" });
522
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: HasPreviewPipe, decorators: [{
255
523
  type: Pipe,
256
524
  args: [{
257
525
  name: 'hasPreview',
@@ -262,13 +530,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImpor
262
530
  * Item editor. This can edit a new or existing item's metadata and parts.
263
531
  */
264
532
  class ItemEditorComponent {
265
- constructor(_router, _route, _snackbar, _appQuery, _query, _editItemService, _itemService, _libraryRouteService, _dialogService, _authService, _userLevelService, _formBuilder) {
533
+ constructor(_router, _route, _snackbar, _appRepository, _repository, _itemService, _libraryRouteService, _dialogService, _authService, _userLevelService, _formBuilder) {
266
534
  this._router = _router;
267
535
  this._route = _route;
268
536
  this._snackbar = _snackbar;
269
- this._appQuery = _appQuery;
270
- this._query = _query;
271
- this._editItemService = _editItemService;
537
+ this._appRepository = _appRepository;
538
+ this._repository = _repository;
272
539
  this._itemService = _itemService;
273
540
  this._libraryRouteService = _libraryRouteService;
274
541
  this._dialogService = _dialogService;
@@ -281,6 +548,7 @@ class ItemEditorComponent {
281
548
  if (this.id === 'new') {
282
549
  this.id = undefined;
283
550
  }
551
+ // this.status$ = this._repository.status$;
284
552
  // new part form
285
553
  this.newPartType = _formBuilder.control(null, Validators.required);
286
554
  this.newPart = _formBuilder.group({
@@ -313,19 +581,16 @@ class ItemEditorComponent {
313
581
  flagChecks: this.flagChecks,
314
582
  });
315
583
  this.userLevel = 0;
316
- this.item$ = this._query.selectItem();
317
- this.parts$ = this._query.selectParts();
318
- this.partGroups$ = this._query.select((state) => state.partGroups);
319
- this.layerPartInfos$ = this._query.select((state) => state.layerPartInfos);
320
- this.facet$ = this._query.selectFacet();
321
- this.facets$ = this._appQuery.selectFacets();
322
- this.typeThesaurus$ = this._appQuery.selectTypeThesaurus();
323
- this.previewJKeys$ = this._appQuery.selectPreviewJKeys();
324
- this.previewFKeys$ = this._appQuery.selectPreviewFKeys();
325
- this.loading$ = this._query.selectLoading();
326
- this.saving$ = this._query.selectSaving();
327
- this.deletingPart$ = this._query.selectDeletingPart();
328
- this.error$ = this._query.selectError();
584
+ this.item$ = this._repository.item$;
585
+ this.parts$ = this._repository.parts$;
586
+ this.partGroups$ = this._repository.partGroups$;
587
+ this.layerPartInfos$ = this._repository.layers$;
588
+ this.facet$ = this._repository.facet$;
589
+ // app
590
+ this.facets$ = this._appRepository.facets$;
591
+ this.typeThesaurus$ = this._appRepository.typeThesaurus$;
592
+ this.previewJKeys$ = this._appRepository.previewJKeys$;
593
+ this.previewFKeys$ = this._appRepository.previewFKeys$;
329
594
  }
330
595
  ngOnInit() {
331
596
  this._authService.currentUser$.subscribe((user) => {
@@ -333,7 +598,7 @@ class ItemEditorComponent {
333
598
  this.userLevel = this._userLevelService.getCurrentUserLevel();
334
599
  });
335
600
  // rebuild the flags controls array when flags definitions change
336
- this._appQuery.selectFlags().subscribe((defs) => {
601
+ this._appRepository.flags$.subscribe((defs) => {
337
602
  this.flagDefinitions = defs;
338
603
  this.buildFlagsControls();
339
604
  });
@@ -347,13 +612,13 @@ class ItemEditorComponent {
347
612
  this.newPartDefinitions = this.getNewPartDefinitions();
348
613
  });
349
614
  // load the item (if any) and its lookup
350
- this._editItemService.load(this.id);
615
+ this._repository.load(this.id);
351
616
  }
352
617
  canDeactivate() {
353
618
  return !this.metadata.dirty;
354
619
  }
355
620
  getExistingPartTypeAndRoleIds() {
356
- const groups = this._query.getValue().partGroups;
621
+ const groups = this._repository.getPartGroups();
357
622
  if (!groups) {
358
623
  return [];
359
624
  }
@@ -369,7 +634,7 @@ class ItemEditorComponent {
369
634
  return results;
370
635
  }
371
636
  getNewPartDefinitions() {
372
- const facet = this._query.getValue().facet;
637
+ const facet = this._repository.getFacet();
373
638
  if (!facet) {
374
639
  return [];
375
640
  }
@@ -453,7 +718,7 @@ class ItemEditorComponent {
453
718
  }
454
719
  }
455
720
  getTypeIdName(typeId) {
456
- const state = this._appQuery.getValue();
721
+ const state = this._appRepository.getValue();
457
722
  if (!state || !state.typeThesaurus) {
458
723
  return typeId;
459
724
  }
@@ -472,10 +737,10 @@ class ItemEditorComponent {
472
737
  return this.getTypeIdName(roleId);
473
738
  }
474
739
  save() {
475
- if (!this.metadata.valid) {
740
+ if (this.busy || !this.metadata.valid) {
476
741
  return;
477
742
  }
478
- const item = { ...this._query.getValue().item };
743
+ const item = { ...this._repository.getItem() };
479
744
  if (!item) {
480
745
  return;
481
746
  }
@@ -486,16 +751,22 @@ class ItemEditorComponent {
486
751
  item.groupId = this.group.value?.trim() || undefined;
487
752
  item.flags = this.flags.value;
488
753
  // save and reload as edited if was new
489
- this._editItemService.save(item).then((saved) => {
754
+ this.busy = true;
755
+ this._repository
756
+ .save(item)
757
+ .then((saved) => {
490
758
  this.metadata.markAsPristine();
491
759
  if (!item.id) {
492
760
  this.id = saved.id;
493
761
  this._router.navigate(['/items', saved.id]);
494
762
  }
763
+ })
764
+ .finally(() => {
765
+ this.busy = false;
495
766
  });
496
767
  }
497
768
  partExists(typeId, roleId) {
498
- const groups = this._query.getValue().partGroups;
769
+ const groups = this._repository.getPartGroups();
499
770
  if (!groups) {
500
771
  return false;
501
772
  }
@@ -545,7 +816,7 @@ class ItemEditorComponent {
545
816
  // layer parts redirect to base-text
546
817
  this._itemService
547
818
  .getBaseTextPart(part.itemId)
548
- .pipe(take(1))
819
+ .pipe(take$1(1))
549
820
  .subscribe((p) => {
550
821
  this._router.navigate(['preview', part.itemId, p.part.id, 'text'], {
551
822
  queryParams: { lid: part.roleId },
@@ -560,6 +831,9 @@ class ItemEditorComponent {
560
831
  }
561
832
  }
562
833
  deletePart(part) {
834
+ if (this.busy) {
835
+ return;
836
+ }
563
837
  this._dialogService
564
838
  .confirm('Confirm Deletion', `Delete part "${part.typeId}"?`)
565
839
  .subscribe((result) => {
@@ -567,39 +841,48 @@ class ItemEditorComponent {
567
841
  return;
568
842
  }
569
843
  // delete
570
- this._editItemService.deletePart(part.id).then((_) => {
844
+ this.busy = true;
845
+ this._repository.deletePart(part.id).then((_) => {
846
+ this.busy = false;
571
847
  // once deleted, refresh new-part definitions
572
848
  this.newPartDefinitions = this.getNewPartDefinitions();
573
849
  }, (error) => {
850
+ this.busy = false;
574
851
  console.error(error);
575
852
  this._snackbar.open('Error deleting part', 'OK');
576
853
  });
577
854
  });
578
855
  }
579
856
  addLayerPart(part) {
857
+ if (this.busy) {
858
+ return;
859
+ }
580
860
  let name = this.getTypeIdName(part.typeId);
581
861
  if (part.roleId) {
582
862
  name += ' for ' + this.getRoleIdName(part.roleId);
583
863
  }
864
+ this.busy = true;
584
865
  this._dialogService
585
866
  .confirm('Confirm Addition', `Add layer "${name}"?`)
586
867
  .subscribe((result) => {
587
868
  if (!result) {
588
869
  return;
589
870
  }
590
- this._editItemService.addNewLayerPart(part.itemId, part.typeId, part.roleId);
871
+ this._repository
872
+ .addNewLayerPart(part.typeId, part.roleId)
873
+ .finally(() => (this.busy = false));
591
874
  });
592
875
  }
593
876
  setPartsScope(request) {
594
- this._editItemService.setPartThesaurusScope(request.ids, request.scope);
877
+ this._repository.setPartThesaurusScope(request.ids, request.scope);
595
878
  }
596
879
  }
597
- ItemEditorComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: ItemEditorComponent, deps: [{ token: i1.Router }, { token: i1.ActivatedRoute }, { token: i2$1.MatSnackBar }, { token: i3$2.AppQuery }, { token: i3$2.EditItemQuery }, { token: i3$2.EditItemService }, { token: i4$1.ItemService }, { token: i5.LibraryRouteService }, { token: i3$1.DialogService }, { token: i7$1.AuthJwtService }, { token: i4$1.UserLevelService }, { token: i8.FormBuilder }], target: i0.ɵɵFactoryTarget.Component });
598
- ItemEditorComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.3", type: ItemEditorComponent, selector: "cadmus-item-editor", ngImport: i0, template: "<mat-card>\r\n <mat-card-header>\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 <p *ngIf=\"id\">\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 <p *ngIf=\"item$ | async as item\">\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 <p *ngIf=\"error$ | async as error\">\r\n <mat-error>\r\n {{ error }}\r\n </mat-error>\r\n </p>\r\n\r\n <mat-progress-bar\r\n mode=\"indeterminate\"\r\n *ngIf=\"(loading$ | async) || (saving$ | async)\"\r\n ></mat-progress-bar>\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 <input\r\n matInput\r\n type=\"text\"\r\n id=\"title\"\r\n placeholder=\"title\"\r\n formControlName=\"title\"\r\n />\r\n <mat-error\r\n *ngIf=\"\r\n title.hasError('required') && (title.touched || title.dirty)\r\n \"\r\n >enter title</mat-error\r\n >\r\n <mat-error\r\n *ngIf=\"\r\n title.hasError('maxLength') && (title.touched || title.dirty)\r\n \"\r\n >\r\n 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 <input\r\n matInput\r\n type=\"text\"\r\n id=\"sortKey\"\r\n placeholder=\"sort key\"\r\n formControlName=\"sortKey\"\r\n />\r\n <mat-error\r\n *ngIf=\"\r\n sortKey.hasError('required') &&\r\n (sortKey.touched || sortKey.dirty)\r\n \"\r\n >enter sort key</mat-error\r\n >\r\n <mat-error\r\n *ngIf=\"\r\n sortKey.hasError('maxLength') &&\r\n (sortKey.touched || sortKey.dirty)\r\n \"\r\n >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 <textarea\r\n rows=\"2\"\r\n matInput\r\n id=\"description\"\r\n placeholder=\"description\"\r\n formControlName=\"description\"\r\n ></textarea>\r\n <mat-error\r\n *ngIf=\"\r\n description.hasError('required') &&\r\n (description.touched || description.dirty)\r\n \"\r\n >enter description</mat-error\r\n >\r\n <mat-error\r\n *ngIf=\"\r\n description.hasError('maxLength') &&\r\n (description.touched || description.dirty)\r\n \"\r\n >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-select\r\n placeholder=\"facet\"\r\n formControlName=\"facet\"\r\n required=\"true\"\r\n >\r\n <mat-option *ngFor=\"let f of facets$ | async\" [value]=\"f.id\">\r\n {{ f.label }}\r\n </mat-option>\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 <input matInput formControlName=\"group\" placeholder=\"group ID\" />\r\n <mat-error\r\n *ngIf=\"\r\n group.hasError('maxLength') && (group.dirty || group.touched)\r\n \"\r\n >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 <div formArrayName=\"flagChecks\" *ngIf=\"flagDefinitions\">\r\n <mat-checkbox\r\n class=\"flag\"\r\n *ngFor=\"let c of flagChecks.controls; let i = index\"\r\n [formControlName]=\"i\"\r\n >\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 </div>\r\n </fieldset>\r\n <br />\r\n\r\n <div>\r\n <button\r\n type=\"submit\"\r\n mat-raised-button\r\n color=\"primary\"\r\n [disabled]=\"\r\n userLevel < 2 || (saving$ | async) || (loading$ | async)\r\n \"\r\n matTooltip=\"Save metadata\"\r\n *ngIf=\"\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 >\r\n <mat-icon>save</mat-icon> save\r\n </button>\r\n </div>\r\n </form>\r\n </mat-tab>\r\n\r\n <!-- parts -->\r\n <mat-tab label=\"Parts\" *ngIf=\"id\">\r\n <div class=\"new-part\">\r\n <form [formGroup]=\"newPart\">\r\n <mat-form-field>\r\n <mat-select\r\n placeholder=\"part\"\r\n formControlName=\"newPartType\"\r\n required\r\n >\r\n <mat-option *ngFor=\"let p of newPartDefinitions\" [value]=\"p\">\r\n <span [style.color]=\"'#' + p.colorKey\" class=\"new-part-icon\"\r\n >&#x2b24;</span\r\n >\r\n {{ p.name }}\r\n <span *ngIf=\"p.roleId\" class=\"new-part-role\">{{\r\n p.roleId\r\n }}</span>\r\n </mat-option>\r\n </mat-select>\r\n <mat-error>part type required</mat-error>\r\n </mat-form-field>\r\n &nbsp;\r\n <button\r\n mat-stroked-button\r\n color=\"primary\"\r\n type=\"button\"\r\n [disabled]=\"userLevel < 2 || (loading$ | async) || !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 add part\r\n </button>\r\n </form>\r\n </div>\r\n\r\n <mat-divider></mat-divider>\r\n\r\n <mat-expansion-panel\r\n *ngFor=\"let group of partGroups$ | async\"\r\n [expanded]=\"true\"\r\n >\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\r\n <table>\r\n <thead>\r\n <tr>\r\n <th style=\"width: 160px\"></th>\r\n <th>type</th>\r\n <th>role</th>\r\n <th fxHide.xs>modified</th>\r\n <th fxHide.xs>user</th>\r\n </tr>\r\n </thead>\r\n <tbody>\r\n <tr *ngFor=\"let part of group.parts\">\r\n <!-- edit -->\r\n <td>\r\n <button\r\n mat-icon-button\r\n type=\"button\"\r\n color=\"primary\"\r\n matTooltip=\"Edit this part\"\r\n [disabled]=\"(loading$ | async) || (deletingPart$ | async)\"\r\n (click)=\"editPart(part)\"\r\n >\r\n <mat-icon>create</mat-icon>\r\n </button>\r\n <!-- delete -->\r\n <button\r\n mat-icon-button\r\n type=\"button\"\r\n matTooltip=\"Delete this part\"\r\n [disabled]=\"\r\n userLevel < 2 ||\r\n (loading$ | async) ||\r\n (deletingPart$ | async)\r\n \"\r\n (click)=\"deletePart(part)\"\r\n *ngIf=\"\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 >\r\n <mat-icon color=\"warn\">delete</mat-icon>\r\n </button>\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 <!-- preview -->\r\n <button\r\n mat-icon-button\r\n type=\"button\"\r\n matTooltip=\"Preview this part\"\r\n *ngIf=\"\r\n part\r\n | hasPreview\r\n : (previewJKeys$ | async)\r\n : (previewFKeys$ | async)\r\n \"\r\n (click)=\"previewPart(part)\"\r\n >\r\n <mat-icon>preview</mat-icon>\r\n </button>\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 ></cadmus-part-badge>\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 ></cadmus-part-badge>\r\n </td>\r\n <td fxHide.xs>\r\n {{ part.timeModified | date: \"yyyy-MM-dd HH:mm:ss\" }}\r\n </td>\r\n <td fxHide.xs>{{ part.userId }}</td>\r\n </tr>\r\n </tbody>\r\n </table>\r\n </mat-expansion-panel>\r\n\r\n <cadmus-missing-parts\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 ></cadmus-missing-parts>\r\n </mat-tab>\r\n\r\n <mat-tab label=\"Layers\" *ngIf=\"id\">\r\n <table id=\"layers\" *ngIf=\"layerPartInfos$ | async as parts\">\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 <tr *ngFor=\"let part of parts\">\r\n <td>\r\n <button\r\n *ngIf=\"!part.isAbsent\"\r\n type=\"button\"\r\n color=\"primary\"\r\n mat-icon-button\r\n matTooltip=\"Edit this layer part\"\r\n (click)=\"editPart(part)\"\r\n >\r\n <mat-icon>edit</mat-icon>\r\n </button>\r\n <button\r\n *ngIf=\"part.isAbsent\"\r\n type=\"button\"\r\n mat-icon-button\r\n color=\"primary\"\r\n matTooltip=\"Add this layer part\"\r\n [disabled]=\"userLevel < 2\"\r\n (click)=\"addLayerPart(part)\"\r\n >\r\n <mat-icon>add_circle</mat-icon>\r\n </button>\r\n <button\r\n *ngIf=\"!part.isAbsent\"\r\n type=\"button\"\r\n mat-icon-button\r\n color=\"warn\"\r\n matTooltip=\"Delete this layer part\"\r\n [disabled]=\"userLevel < 2\"\r\n (click)=\"deletePart(part)\"\r\n >\r\n <mat-icon>delete</mat-icon>\r\n </button>\r\n <button\r\n *ngIf=\"!part.isAbsent\"\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 </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 ></cadmus-part-badge>\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 ></cadmus-part-badge>\r\n </td>\r\n <td\r\n [ngClass]=\"{\r\n 'count-n': part.fragmentCount,\r\n 'count-z': !part.fragmentCount\r\n }\"\r\n >\r\n {{ part.fragmentCount }}\r\n </td>\r\n <td>\r\n <span *ngIf=\"!part.isAbsent\">\r\n {{ part.timeModified | date: \"yyyy-MM-dd HH:mm:ss\" }}\r\n </span>\r\n </td>\r\n </tr>\r\n </tbody>\r\n </table>\r\n </mat-tab>\r\n\r\n <mat-tab label=\"Th-Scopes\" *ngIf=\"parts$ | async as parts\">\r\n <!-- [parts]=\"parts | sort: 'typeId' | sort: 'roleId'\" -->\r\n <cadmus-parts-scope-editor\r\n [parts]=\"parts\"\r\n [readonly]=\"\r\n userLevel < 2 || (saving$ | async) || (loading$ | async)\r\n ? true\r\n : false\r\n \"\r\n (setScopeRequest)=\"setPartsScope($event)\"\r\n ></cadmus-parts-scope-editor>\r\n </mat-tab>\r\n </mat-tab-group>\r\n </mat-card-content>\r\n</mat-card>\r\n", styles: [".full-width{width:100%}th{font-weight:400;color:silver}#layers td{padding:0 6px}div.new-part{margin-left:32px}span.new-part-role{color:gray;margin-left:8px;vertical-align:middle}span.new-part-icon{margin:0 4px;vertical-align:middle}td.count-n{text-align:center;color:#03c03c}td.count-z{text-align:center;color:#f34f41}input.id{font-family:Courier New,Courier,monospace;color:gray;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}fieldset{border:1px solid silver;border-radius:6px;padding:6px;margin:8px 0}\n"], dependencies: [{ kind: "directive", type: i9.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i9.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i9.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i8.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i8.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: i8.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i8.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i8.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i8.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i8.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "directive", type: i8.FormArrayName, selector: "[formArrayName]", inputs: ["formArrayName"] }, { kind: "directive", type: i10.CdkCopyToClipboard, selector: "[cdkCopyToClipboard]", inputs: ["cdkCopyToClipboard", "cdkCopyToClipboardAttempts"], outputs: ["cdkCopyToClipboardCopied"] }, { kind: "component", type: i2.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "component", type: i7.MatCheckbox, selector: "mat-checkbox", inputs: ["disableRipple", "color", "tabIndex"], exportAs: ["matCheckbox"] }, { kind: "component", type: i13.MatCard, selector: "mat-card", exportAs: ["matCard"] }, { kind: "component", type: i13.MatCardHeader, selector: "mat-card-header" }, { kind: "directive", type: i13.MatCardContent, selector: "mat-card-content, [mat-card-content], [matCardContent]" }, { kind: "directive", type: i13.MatCardTitle, selector: "mat-card-title, [mat-card-title], [matCardTitle]" }, { kind: "directive", type: i13.MatCardSubtitle, selector: "mat-card-subtitle, [mat-card-subtitle], [matCardSubtitle]" }, { kind: "component", type: i14.MatDivider, selector: "mat-divider", inputs: ["vertical", "inset"] }, { kind: "component", type: i15.MatExpansionPanel, selector: "mat-expansion-panel", inputs: ["disabled", "expanded", "hideToggle", "togglePosition"], outputs: ["opened", "closed", "expandedChange", "afterExpand", "afterCollapse"], exportAs: ["matExpansionPanel"] }, { kind: "component", type: i15.MatExpansionPanelHeader, selector: "mat-expansion-panel-header", inputs: ["tabIndex", "expandedHeight", "collapsedHeight"] }, { kind: "directive", type: i15.MatExpansionPanelTitle, selector: "mat-panel-title" }, { kind: "directive", type: i15.MatExpansionPanelDescription, selector: "mat-panel-description" }, { kind: "directive", type: i8$1.MatError, selector: "mat-error", inputs: ["id"] }, { kind: "component", type: i8$1.MatFormField, selector: "mat-form-field", inputs: ["color", "appearance", "hideRequiredMarker", "hintLabel", "floatLabel"], exportAs: ["matFormField"] }, { kind: "component", type: i3.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "directive", type: i9$1.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { kind: "component", type: i19.MatProgressBar, selector: "mat-progress-bar", inputs: ["color", "value", "bufferValue", "mode"], outputs: ["animationEnd"], exportAs: ["matProgressBar"] }, { kind: "component", type: i20.MatSelect, selector: "mat-select", inputs: ["disabled", "disableRipple", "tabIndex"], exportAs: ["matSelect"] }, { kind: "component", type: i21.MatOption, selector: "mat-option", exportAs: ["matOption"] }, { kind: "component", type: i22.MatTabGroup, selector: "mat-tab-group", inputs: ["color", "disableRipple"], exportAs: ["matTabGroup"] }, { kind: "component", type: i22.MatTab, selector: "mat-tab", inputs: ["disabled", "label", "aria-label", "aria-labelledby", "labelClass", "bodyClass"], exportAs: ["matTab"] }, { kind: "component", type: i4.PartBadgeComponent, selector: "cadmus-part-badge", inputs: ["badgeType", "typeThesaurus", "facetDefinition", "partTypeIds"] }, { kind: "component", type: MissingPartsComponent, selector: "cadmus-missing-parts", inputs: ["partDefinitions", "parts", "typeThesaurus"], outputs: ["addRequest"] }, { kind: "component", type: PartsScopeEditorComponent, selector: "cadmus-parts-scope-editor", inputs: ["parts", "readonly"], outputs: ["setScopeRequest"] }, { kind: "pipe", type: i9.AsyncPipe, name: "async" }, { kind: "pipe", type: i9.DatePipe, name: "date" }, { kind: "pipe", type: HasPreviewPipe, name: "hasPreview" }] });
599
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: ItemEditorComponent, decorators: [{
880
+ ItemEditorComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: ItemEditorComponent, deps: [{ token: i1$1.Router }, { token: i1$1.ActivatedRoute }, { token: i2$1.MatSnackBar }, { token: i1.AppRepository }, { token: EditedItemRepository }, { token: i2.ItemService }, { token: i6.LibraryRouteService }, { token: i3$1.DialogService }, { token: i8$1.AuthJwtService }, { token: i2.UserLevelService }, { token: i9.FormBuilder }], target: i0.ɵɵFactoryTarget.Component });
881
+ ItemEditorComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.0.0", type: ItemEditorComponent, selector: "cadmus-item-editor", ngImport: i0, template: "<mat-card appearance=\"outlined\">\r\n <mat-card-header>\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 <p *ngIf=\"id\">\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 <p *ngIf=\"item$ | async as item\">\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 <mat-progress-bar mode=\"indeterminate\" *ngIf=\"busy\"></mat-progress-bar>\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 <mat-error\r\n *ngIf=\"\r\n title.hasError('required') && (title.touched || title.dirty)\r\n \"\r\n >enter title</mat-error\r\n >\r\n <mat-error\r\n *ngIf=\"\r\n title.hasError('maxLength') && (title.touched || title.dirty)\r\n \"\r\n >\r\n 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 <mat-error\r\n *ngIf=\"\r\n sortKey.hasError('required') &&\r\n (sortKey.touched || sortKey.dirty)\r\n \"\r\n >enter sort key</mat-error\r\n >\r\n <mat-error\r\n *ngIf=\"\r\n sortKey.hasError('maxLength') &&\r\n (sortKey.touched || sortKey.dirty)\r\n \"\r\n >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 <mat-error\r\n *ngIf=\"\r\n description.hasError('required') &&\r\n (description.touched || description.dirty)\r\n \"\r\n >enter description</mat-error\r\n >\r\n <mat-error\r\n *ngIf=\"\r\n description.hasError('maxLength') &&\r\n (description.touched || description.dirty)\r\n \"\r\n >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 <mat-option *ngFor=\"let f of facets$ | async\" [value]=\"f.id\">\r\n {{ f.label }}\r\n </mat-option>\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 <mat-error\r\n *ngIf=\"\r\n group.hasError('maxLength') && (group.dirty || group.touched)\r\n \"\r\n >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 <div formArrayName=\"flagChecks\" *ngIf=\"flagDefinitions\">\r\n <mat-checkbox\r\n class=\"flag\"\r\n *ngFor=\"let c of flagChecks.controls; let i = index\"\r\n [formControlName]=\"i\"\r\n >\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 </div>\r\n </fieldset>\r\n <br />\r\n\r\n <div>\r\n <button\r\n type=\"submit\"\r\n mat-raised-button\r\n color=\"primary\"\r\n [disabled]=\"userLevel < 2 || busy\"\r\n matTooltip=\"Save metadata\"\r\n *ngIf=\"\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 >\r\n <mat-icon>save</mat-icon> save\r\n </button>\r\n </div>\r\n </form>\r\n </mat-tab>\r\n\r\n <!-- parts -->\r\n <mat-tab label=\"Parts\" *ngIf=\"id\">\r\n <div class=\"new-part\">\r\n <form [formGroup]=\"newPart\">\r\n <mat-form-field>\r\n <mat-label>part</mat-label>\r\n <mat-select [formControl]=\"newPartType\" required>\r\n <mat-option *ngFor=\"let p of newPartDefinitions\" [value]=\"p\">\r\n <span [style.color]=\"'#' + p.colorKey\" class=\"new-part-icon\"\r\n >&#x2b24;</span\r\n >\r\n {{ p.name }}\r\n <span *ngIf=\"p.roleId\" class=\"new-part-role\">{{\r\n p.roleId\r\n }}</span>\r\n </mat-option>\r\n </mat-select>\r\n <mat-error>part type required</mat-error>\r\n </mat-form-field>\r\n &nbsp;\r\n <button\r\n mat-stroked-button\r\n color=\"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 add part\r\n </button>\r\n </form>\r\n </div>\r\n\r\n <mat-divider></mat-divider>\r\n\r\n <mat-expansion-panel\r\n *ngFor=\"let group of partGroups$ | async\"\r\n [expanded]=\"true\"\r\n >\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\r\n <table>\r\n <thead>\r\n <tr>\r\n <th style=\"width: 200px\"></th>\r\n <th>type</th>\r\n <th>role</th>\r\n <th fxHide.xs>modified</th>\r\n <th fxHide.xs>user</th>\r\n </tr>\r\n </thead>\r\n <tbody>\r\n <tr *ngFor=\"let part of group.parts\">\r\n <!-- edit -->\r\n <td>\r\n <button\r\n mat-icon-button\r\n type=\"button\"\r\n color=\"primary\"\r\n matTooltip=\"Edit this part\"\r\n [disabled]=\"busy\"\r\n (click)=\"editPart(part)\"\r\n >\r\n <mat-icon>create</mat-icon>\r\n </button>\r\n <!-- delete -->\r\n <button\r\n mat-icon-button\r\n type=\"button\"\r\n matTooltip=\"Delete this part\"\r\n [disabled]=\"userLevel < 2 || busy\"\r\n (click)=\"deletePart(part)\"\r\n *ngIf=\"\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 >\r\n <mat-icon color=\"warn\">delete</mat-icon>\r\n </button>\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 <!-- preview -->\r\n <button\r\n mat-icon-button\r\n type=\"button\"\r\n matTooltip=\"Preview this part\"\r\n *ngIf=\"\r\n part\r\n | hasPreview\r\n : (previewJKeys$ | async)\r\n : (previewFKeys$ | async)\r\n \"\r\n (click)=\"previewPart(part)\"\r\n >\r\n <mat-icon>preview</mat-icon>\r\n </button>\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 ></cadmus-part-badge>\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 ></cadmus-part-badge>\r\n </td>\r\n <td fxHide.xs>\r\n {{ part.timeModified | date: \"yyyy-MM-dd HH:mm:ss\" }}\r\n </td>\r\n <td fxHide.xs>{{ part.userId }}</td>\r\n </tr>\r\n </tbody>\r\n </table>\r\n </mat-expansion-panel>\r\n\r\n <cadmus-missing-parts\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 ></cadmus-missing-parts>\r\n </mat-tab>\r\n\r\n <mat-tab label=\"Layers\" *ngIf=\"id\">\r\n <table id=\"layers\" *ngIf=\"layerPartInfos$ | async as parts\">\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 <tr *ngFor=\"let part of parts\">\r\n <td>\r\n <button\r\n *ngIf=\"!part.isAbsent\"\r\n type=\"button\"\r\n color=\"primary\"\r\n mat-icon-button\r\n matTooltip=\"Edit this layer part\"\r\n (click)=\"editPart(part)\"\r\n >\r\n <mat-icon>edit</mat-icon>\r\n </button>\r\n <button\r\n *ngIf=\"part.isAbsent\"\r\n type=\"button\"\r\n mat-icon-button\r\n color=\"primary\"\r\n matTooltip=\"Add this layer part\"\r\n [disabled]=\"userLevel < 2\"\r\n (click)=\"addLayerPart(part)\"\r\n >\r\n <mat-icon>add_circle</mat-icon>\r\n </button>\r\n <button\r\n *ngIf=\"!part.isAbsent\"\r\n type=\"button\"\r\n mat-icon-button\r\n color=\"warn\"\r\n matTooltip=\"Delete this layer part\"\r\n [disabled]=\"userLevel < 2\"\r\n (click)=\"deletePart(part)\"\r\n >\r\n <mat-icon>delete</mat-icon>\r\n </button>\r\n <button\r\n *ngIf=\"!part.isAbsent\"\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 </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 ></cadmus-part-badge>\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 ></cadmus-part-badge>\r\n </td>\r\n <td\r\n [ngClass]=\"{\r\n 'count-n': part.fragmentCount,\r\n 'count-z': !part.fragmentCount\r\n }\"\r\n >\r\n {{ part.fragmentCount }}\r\n </td>\r\n <td>\r\n <span *ngIf=\"!part.isAbsent\">\r\n {{ part.timeModified | date: \"yyyy-MM-dd HH:mm:ss\" }}\r\n </span>\r\n </td>\r\n </tr>\r\n </tbody>\r\n </table>\r\n </mat-tab>\r\n\r\n <mat-tab label=\"Th-Scopes\" *ngIf=\"parts$ | async as parts\">\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 ></cadmus-parts-scope-editor>\r\n </mat-tab>\r\n </mat-tab-group>\r\n </mat-card-content>\r\n</mat-card>\r\n", styles: [".full-width{width:100%}th{font-weight:400;color:silver}#layers td{padding:0 6px}div.new-part{margin-left:32px}span.new-part-role{color:gray;margin-left:8px;vertical-align:middle}span.new-part-icon{margin:0 4px;vertical-align:middle}td.count-n{text-align:center;color:#03c03c}td.count-z{text-align:center;color:#f34f41}input.id{font-family:Courier New,Courier,monospace;color:gray;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}fieldset{border:1px solid silver;border-radius:6px;padding:6px;margin:8px 0}\n"], dependencies: [{ kind: "directive", type: i10.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i10.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i10.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i9.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i9.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: i9.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i9.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i9.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i9.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "directive", type: i9.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i9.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "directive", type: i9.FormArrayName, selector: "[formArrayName]", inputs: ["formArrayName"] }, { kind: "directive", type: i11.CdkCopyToClipboard, selector: "[cdkCopyToClipboard]", inputs: ["cdkCopyToClipboard", "cdkCopyToClipboardAttempts"], outputs: ["cdkCopyToClipboardCopied"] }, { kind: "component", type: i12.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "component", type: i12.MatIconButton, selector: "button[mat-icon-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "component", type: i8.MatCheckbox, selector: "mat-checkbox", inputs: ["disableRipple", "color", "tabIndex"], exportAs: ["matCheckbox"] }, { kind: "component", type: i14.MatCard, selector: "mat-card", inputs: ["appearance"], exportAs: ["matCard"] }, { kind: "directive", type: i14.MatCardContent, selector: "mat-card-content" }, { kind: "component", type: i14.MatCardHeader, selector: "mat-card-header" }, { kind: "directive", type: i14.MatCardSubtitle, selector: "mat-card-subtitle, [mat-card-subtitle], [matCardSubtitle]" }, { kind: "directive", type: i14.MatCardTitle, selector: "mat-card-title, [mat-card-title], [matCardTitle]" }, { kind: "component", type: i15.MatDivider, selector: "mat-divider", inputs: ["vertical", "inset"] }, { kind: "component", type: i16.MatExpansionPanel, selector: "mat-expansion-panel", inputs: ["disabled", "expanded", "hideToggle", "togglePosition"], outputs: ["opened", "closed", "expandedChange", "afterExpand", "afterCollapse"], exportAs: ["matExpansionPanel"] }, { kind: "component", type: i16.MatExpansionPanelHeader, selector: "mat-expansion-panel-header", inputs: ["tabIndex", "expandedHeight", "collapsedHeight"] }, { kind: "directive", type: i16.MatExpansionPanelTitle, selector: "mat-panel-title" }, { kind: "directive", type: i16.MatExpansionPanelDescription, selector: "mat-panel-description" }, { kind: "component", type: i9$1.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i9$1.MatLabel, selector: "mat-label" }, { kind: "directive", type: i9$1.MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "component", type: i3.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "directive", type: i10$1.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { kind: "component", type: i20.MatProgressBar, selector: "mat-progress-bar", inputs: ["color", "value", "bufferValue", "mode"], outputs: ["animationEnd"], exportAs: ["matProgressBar"] }, { kind: "component", type: i21.MatSelect, selector: "mat-select", inputs: ["disabled", "disableRipple", "tabIndex"], exportAs: ["matSelect"] }, { kind: "component", type: i22.MatOption, selector: "mat-option", exportAs: ["matOption"] }, { kind: "component", type: i23.MatTab, selector: "mat-tab", inputs: ["disabled"], exportAs: ["matTab"] }, { kind: "component", type: i23.MatTabGroup, selector: "mat-tab-group", inputs: ["color", "disableRipple", "fitInkBarToContent", "mat-stretch-tabs"], exportAs: ["matTabGroup"] }, { kind: "component", type: i4.PartBadgeComponent, selector: "cadmus-part-badge", inputs: ["badgeType", "typeThesaurus", "facetDefinition", "partTypeIds"] }, { kind: "component", type: MissingPartsComponent, selector: "cadmus-missing-parts", inputs: ["partDefinitions", "parts", "typeThesaurus"], outputs: ["addRequest"] }, { kind: "component", type: PartsScopeEditorComponent, selector: "cadmus-parts-scope-editor", inputs: ["parts", "readonly"], outputs: ["setScopeRequest"] }, { kind: "pipe", type: i10.AsyncPipe, name: "async" }, { kind: "pipe", type: i10.DatePipe, name: "date" }, { kind: "pipe", type: HasPreviewPipe, name: "hasPreview" }] });
882
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: ItemEditorComponent, decorators: [{
600
883
  type: Component,
601
- args: [{ selector: 'cadmus-item-editor', template: "<mat-card>\r\n <mat-card-header>\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 <p *ngIf=\"id\">\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 <p *ngIf=\"item$ | async as item\">\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 <p *ngIf=\"error$ | async as error\">\r\n <mat-error>\r\n {{ error }}\r\n </mat-error>\r\n </p>\r\n\r\n <mat-progress-bar\r\n mode=\"indeterminate\"\r\n *ngIf=\"(loading$ | async) || (saving$ | async)\"\r\n ></mat-progress-bar>\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 <input\r\n matInput\r\n type=\"text\"\r\n id=\"title\"\r\n placeholder=\"title\"\r\n formControlName=\"title\"\r\n />\r\n <mat-error\r\n *ngIf=\"\r\n title.hasError('required') && (title.touched || title.dirty)\r\n \"\r\n >enter title</mat-error\r\n >\r\n <mat-error\r\n *ngIf=\"\r\n title.hasError('maxLength') && (title.touched || title.dirty)\r\n \"\r\n >\r\n 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 <input\r\n matInput\r\n type=\"text\"\r\n id=\"sortKey\"\r\n placeholder=\"sort key\"\r\n formControlName=\"sortKey\"\r\n />\r\n <mat-error\r\n *ngIf=\"\r\n sortKey.hasError('required') &&\r\n (sortKey.touched || sortKey.dirty)\r\n \"\r\n >enter sort key</mat-error\r\n >\r\n <mat-error\r\n *ngIf=\"\r\n sortKey.hasError('maxLength') &&\r\n (sortKey.touched || sortKey.dirty)\r\n \"\r\n >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 <textarea\r\n rows=\"2\"\r\n matInput\r\n id=\"description\"\r\n placeholder=\"description\"\r\n formControlName=\"description\"\r\n ></textarea>\r\n <mat-error\r\n *ngIf=\"\r\n description.hasError('required') &&\r\n (description.touched || description.dirty)\r\n \"\r\n >enter description</mat-error\r\n >\r\n <mat-error\r\n *ngIf=\"\r\n description.hasError('maxLength') &&\r\n (description.touched || description.dirty)\r\n \"\r\n >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-select\r\n placeholder=\"facet\"\r\n formControlName=\"facet\"\r\n required=\"true\"\r\n >\r\n <mat-option *ngFor=\"let f of facets$ | async\" [value]=\"f.id\">\r\n {{ f.label }}\r\n </mat-option>\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 <input matInput formControlName=\"group\" placeholder=\"group ID\" />\r\n <mat-error\r\n *ngIf=\"\r\n group.hasError('maxLength') && (group.dirty || group.touched)\r\n \"\r\n >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 <div formArrayName=\"flagChecks\" *ngIf=\"flagDefinitions\">\r\n <mat-checkbox\r\n class=\"flag\"\r\n *ngFor=\"let c of flagChecks.controls; let i = index\"\r\n [formControlName]=\"i\"\r\n >\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 </div>\r\n </fieldset>\r\n <br />\r\n\r\n <div>\r\n <button\r\n type=\"submit\"\r\n mat-raised-button\r\n color=\"primary\"\r\n [disabled]=\"\r\n userLevel < 2 || (saving$ | async) || (loading$ | async)\r\n \"\r\n matTooltip=\"Save metadata\"\r\n *ngIf=\"\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 >\r\n <mat-icon>save</mat-icon> save\r\n </button>\r\n </div>\r\n </form>\r\n </mat-tab>\r\n\r\n <!-- parts -->\r\n <mat-tab label=\"Parts\" *ngIf=\"id\">\r\n <div class=\"new-part\">\r\n <form [formGroup]=\"newPart\">\r\n <mat-form-field>\r\n <mat-select\r\n placeholder=\"part\"\r\n formControlName=\"newPartType\"\r\n required\r\n >\r\n <mat-option *ngFor=\"let p of newPartDefinitions\" [value]=\"p\">\r\n <span [style.color]=\"'#' + p.colorKey\" class=\"new-part-icon\"\r\n >&#x2b24;</span\r\n >\r\n {{ p.name }}\r\n <span *ngIf=\"p.roleId\" class=\"new-part-role\">{{\r\n p.roleId\r\n }}</span>\r\n </mat-option>\r\n </mat-select>\r\n <mat-error>part type required</mat-error>\r\n </mat-form-field>\r\n &nbsp;\r\n <button\r\n mat-stroked-button\r\n color=\"primary\"\r\n type=\"button\"\r\n [disabled]=\"userLevel < 2 || (loading$ | async) || !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 add part\r\n </button>\r\n </form>\r\n </div>\r\n\r\n <mat-divider></mat-divider>\r\n\r\n <mat-expansion-panel\r\n *ngFor=\"let group of partGroups$ | async\"\r\n [expanded]=\"true\"\r\n >\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\r\n <table>\r\n <thead>\r\n <tr>\r\n <th style=\"width: 160px\"></th>\r\n <th>type</th>\r\n <th>role</th>\r\n <th fxHide.xs>modified</th>\r\n <th fxHide.xs>user</th>\r\n </tr>\r\n </thead>\r\n <tbody>\r\n <tr *ngFor=\"let part of group.parts\">\r\n <!-- edit -->\r\n <td>\r\n <button\r\n mat-icon-button\r\n type=\"button\"\r\n color=\"primary\"\r\n matTooltip=\"Edit this part\"\r\n [disabled]=\"(loading$ | async) || (deletingPart$ | async)\"\r\n (click)=\"editPart(part)\"\r\n >\r\n <mat-icon>create</mat-icon>\r\n </button>\r\n <!-- delete -->\r\n <button\r\n mat-icon-button\r\n type=\"button\"\r\n matTooltip=\"Delete this part\"\r\n [disabled]=\"\r\n userLevel < 2 ||\r\n (loading$ | async) ||\r\n (deletingPart$ | async)\r\n \"\r\n (click)=\"deletePart(part)\"\r\n *ngIf=\"\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 >\r\n <mat-icon color=\"warn\">delete</mat-icon>\r\n </button>\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 <!-- preview -->\r\n <button\r\n mat-icon-button\r\n type=\"button\"\r\n matTooltip=\"Preview this part\"\r\n *ngIf=\"\r\n part\r\n | hasPreview\r\n : (previewJKeys$ | async)\r\n : (previewFKeys$ | async)\r\n \"\r\n (click)=\"previewPart(part)\"\r\n >\r\n <mat-icon>preview</mat-icon>\r\n </button>\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 ></cadmus-part-badge>\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 ></cadmus-part-badge>\r\n </td>\r\n <td fxHide.xs>\r\n {{ part.timeModified | date: \"yyyy-MM-dd HH:mm:ss\" }}\r\n </td>\r\n <td fxHide.xs>{{ part.userId }}</td>\r\n </tr>\r\n </tbody>\r\n </table>\r\n </mat-expansion-panel>\r\n\r\n <cadmus-missing-parts\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 ></cadmus-missing-parts>\r\n </mat-tab>\r\n\r\n <mat-tab label=\"Layers\" *ngIf=\"id\">\r\n <table id=\"layers\" *ngIf=\"layerPartInfos$ | async as parts\">\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 <tr *ngFor=\"let part of parts\">\r\n <td>\r\n <button\r\n *ngIf=\"!part.isAbsent\"\r\n type=\"button\"\r\n color=\"primary\"\r\n mat-icon-button\r\n matTooltip=\"Edit this layer part\"\r\n (click)=\"editPart(part)\"\r\n >\r\n <mat-icon>edit</mat-icon>\r\n </button>\r\n <button\r\n *ngIf=\"part.isAbsent\"\r\n type=\"button\"\r\n mat-icon-button\r\n color=\"primary\"\r\n matTooltip=\"Add this layer part\"\r\n [disabled]=\"userLevel < 2\"\r\n (click)=\"addLayerPart(part)\"\r\n >\r\n <mat-icon>add_circle</mat-icon>\r\n </button>\r\n <button\r\n *ngIf=\"!part.isAbsent\"\r\n type=\"button\"\r\n mat-icon-button\r\n color=\"warn\"\r\n matTooltip=\"Delete this layer part\"\r\n [disabled]=\"userLevel < 2\"\r\n (click)=\"deletePart(part)\"\r\n >\r\n <mat-icon>delete</mat-icon>\r\n </button>\r\n <button\r\n *ngIf=\"!part.isAbsent\"\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 </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 ></cadmus-part-badge>\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 ></cadmus-part-badge>\r\n </td>\r\n <td\r\n [ngClass]=\"{\r\n 'count-n': part.fragmentCount,\r\n 'count-z': !part.fragmentCount\r\n }\"\r\n >\r\n {{ part.fragmentCount }}\r\n </td>\r\n <td>\r\n <span *ngIf=\"!part.isAbsent\">\r\n {{ part.timeModified | date: \"yyyy-MM-dd HH:mm:ss\" }}\r\n </span>\r\n </td>\r\n </tr>\r\n </tbody>\r\n </table>\r\n </mat-tab>\r\n\r\n <mat-tab label=\"Th-Scopes\" *ngIf=\"parts$ | async as parts\">\r\n <!-- [parts]=\"parts | sort: 'typeId' | sort: 'roleId'\" -->\r\n <cadmus-parts-scope-editor\r\n [parts]=\"parts\"\r\n [readonly]=\"\r\n userLevel < 2 || (saving$ | async) || (loading$ | async)\r\n ? true\r\n : false\r\n \"\r\n (setScopeRequest)=\"setPartsScope($event)\"\r\n ></cadmus-parts-scope-editor>\r\n </mat-tab>\r\n </mat-tab-group>\r\n </mat-card-content>\r\n</mat-card>\r\n", styles: [".full-width{width:100%}th{font-weight:400;color:silver}#layers td{padding:0 6px}div.new-part{margin-left:32px}span.new-part-role{color:gray;margin-left:8px;vertical-align:middle}span.new-part-icon{margin:0 4px;vertical-align:middle}td.count-n{text-align:center;color:#03c03c}td.count-z{text-align:center;color:#f34f41}input.id{font-family:Courier New,Courier,monospace;color:gray;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}fieldset{border:1px solid silver;border-radius:6px;padding:6px;margin:8px 0}\n"] }]
602
- }], ctorParameters: function () { return [{ type: i1.Router }, { type: i1.ActivatedRoute }, { type: i2$1.MatSnackBar }, { type: i3$2.AppQuery }, { type: i3$2.EditItemQuery }, { type: i3$2.EditItemService }, { type: i4$1.ItemService }, { type: i5.LibraryRouteService }, { type: i3$1.DialogService }, { type: i7$1.AuthJwtService }, { type: i4$1.UserLevelService }, { type: i8.FormBuilder }]; } });
884
+ args: [{ selector: 'cadmus-item-editor', template: "<mat-card appearance=\"outlined\">\r\n <mat-card-header>\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 <p *ngIf=\"id\">\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 <p *ngIf=\"item$ | async as item\">\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 <mat-progress-bar mode=\"indeterminate\" *ngIf=\"busy\"></mat-progress-bar>\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 <mat-error\r\n *ngIf=\"\r\n title.hasError('required') && (title.touched || title.dirty)\r\n \"\r\n >enter title</mat-error\r\n >\r\n <mat-error\r\n *ngIf=\"\r\n title.hasError('maxLength') && (title.touched || title.dirty)\r\n \"\r\n >\r\n 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 <mat-error\r\n *ngIf=\"\r\n sortKey.hasError('required') &&\r\n (sortKey.touched || sortKey.dirty)\r\n \"\r\n >enter sort key</mat-error\r\n >\r\n <mat-error\r\n *ngIf=\"\r\n sortKey.hasError('maxLength') &&\r\n (sortKey.touched || sortKey.dirty)\r\n \"\r\n >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 <mat-error\r\n *ngIf=\"\r\n description.hasError('required') &&\r\n (description.touched || description.dirty)\r\n \"\r\n >enter description</mat-error\r\n >\r\n <mat-error\r\n *ngIf=\"\r\n description.hasError('maxLength') &&\r\n (description.touched || description.dirty)\r\n \"\r\n >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 <mat-option *ngFor=\"let f of facets$ | async\" [value]=\"f.id\">\r\n {{ f.label }}\r\n </mat-option>\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 <mat-error\r\n *ngIf=\"\r\n group.hasError('maxLength') && (group.dirty || group.touched)\r\n \"\r\n >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 <div formArrayName=\"flagChecks\" *ngIf=\"flagDefinitions\">\r\n <mat-checkbox\r\n class=\"flag\"\r\n *ngFor=\"let c of flagChecks.controls; let i = index\"\r\n [formControlName]=\"i\"\r\n >\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 </div>\r\n </fieldset>\r\n <br />\r\n\r\n <div>\r\n <button\r\n type=\"submit\"\r\n mat-raised-button\r\n color=\"primary\"\r\n [disabled]=\"userLevel < 2 || busy\"\r\n matTooltip=\"Save metadata\"\r\n *ngIf=\"\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 >\r\n <mat-icon>save</mat-icon> save\r\n </button>\r\n </div>\r\n </form>\r\n </mat-tab>\r\n\r\n <!-- parts -->\r\n <mat-tab label=\"Parts\" *ngIf=\"id\">\r\n <div class=\"new-part\">\r\n <form [formGroup]=\"newPart\">\r\n <mat-form-field>\r\n <mat-label>part</mat-label>\r\n <mat-select [formControl]=\"newPartType\" required>\r\n <mat-option *ngFor=\"let p of newPartDefinitions\" [value]=\"p\">\r\n <span [style.color]=\"'#' + p.colorKey\" class=\"new-part-icon\"\r\n >&#x2b24;</span\r\n >\r\n {{ p.name }}\r\n <span *ngIf=\"p.roleId\" class=\"new-part-role\">{{\r\n p.roleId\r\n }}</span>\r\n </mat-option>\r\n </mat-select>\r\n <mat-error>part type required</mat-error>\r\n </mat-form-field>\r\n &nbsp;\r\n <button\r\n mat-stroked-button\r\n color=\"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 add part\r\n </button>\r\n </form>\r\n </div>\r\n\r\n <mat-divider></mat-divider>\r\n\r\n <mat-expansion-panel\r\n *ngFor=\"let group of partGroups$ | async\"\r\n [expanded]=\"true\"\r\n >\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\r\n <table>\r\n <thead>\r\n <tr>\r\n <th style=\"width: 200px\"></th>\r\n <th>type</th>\r\n <th>role</th>\r\n <th fxHide.xs>modified</th>\r\n <th fxHide.xs>user</th>\r\n </tr>\r\n </thead>\r\n <tbody>\r\n <tr *ngFor=\"let part of group.parts\">\r\n <!-- edit -->\r\n <td>\r\n <button\r\n mat-icon-button\r\n type=\"button\"\r\n color=\"primary\"\r\n matTooltip=\"Edit this part\"\r\n [disabled]=\"busy\"\r\n (click)=\"editPart(part)\"\r\n >\r\n <mat-icon>create</mat-icon>\r\n </button>\r\n <!-- delete -->\r\n <button\r\n mat-icon-button\r\n type=\"button\"\r\n matTooltip=\"Delete this part\"\r\n [disabled]=\"userLevel < 2 || busy\"\r\n (click)=\"deletePart(part)\"\r\n *ngIf=\"\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 >\r\n <mat-icon color=\"warn\">delete</mat-icon>\r\n </button>\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 <!-- preview -->\r\n <button\r\n mat-icon-button\r\n type=\"button\"\r\n matTooltip=\"Preview this part\"\r\n *ngIf=\"\r\n part\r\n | hasPreview\r\n : (previewJKeys$ | async)\r\n : (previewFKeys$ | async)\r\n \"\r\n (click)=\"previewPart(part)\"\r\n >\r\n <mat-icon>preview</mat-icon>\r\n </button>\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 ></cadmus-part-badge>\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 ></cadmus-part-badge>\r\n </td>\r\n <td fxHide.xs>\r\n {{ part.timeModified | date: \"yyyy-MM-dd HH:mm:ss\" }}\r\n </td>\r\n <td fxHide.xs>{{ part.userId }}</td>\r\n </tr>\r\n </tbody>\r\n </table>\r\n </mat-expansion-panel>\r\n\r\n <cadmus-missing-parts\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 ></cadmus-missing-parts>\r\n </mat-tab>\r\n\r\n <mat-tab label=\"Layers\" *ngIf=\"id\">\r\n <table id=\"layers\" *ngIf=\"layerPartInfos$ | async as parts\">\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 <tr *ngFor=\"let part of parts\">\r\n <td>\r\n <button\r\n *ngIf=\"!part.isAbsent\"\r\n type=\"button\"\r\n color=\"primary\"\r\n mat-icon-button\r\n matTooltip=\"Edit this layer part\"\r\n (click)=\"editPart(part)\"\r\n >\r\n <mat-icon>edit</mat-icon>\r\n </button>\r\n <button\r\n *ngIf=\"part.isAbsent\"\r\n type=\"button\"\r\n mat-icon-button\r\n color=\"primary\"\r\n matTooltip=\"Add this layer part\"\r\n [disabled]=\"userLevel < 2\"\r\n (click)=\"addLayerPart(part)\"\r\n >\r\n <mat-icon>add_circle</mat-icon>\r\n </button>\r\n <button\r\n *ngIf=\"!part.isAbsent\"\r\n type=\"button\"\r\n mat-icon-button\r\n color=\"warn\"\r\n matTooltip=\"Delete this layer part\"\r\n [disabled]=\"userLevel < 2\"\r\n (click)=\"deletePart(part)\"\r\n >\r\n <mat-icon>delete</mat-icon>\r\n </button>\r\n <button\r\n *ngIf=\"!part.isAbsent\"\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 </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 ></cadmus-part-badge>\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 ></cadmus-part-badge>\r\n </td>\r\n <td\r\n [ngClass]=\"{\r\n 'count-n': part.fragmentCount,\r\n 'count-z': !part.fragmentCount\r\n }\"\r\n >\r\n {{ part.fragmentCount }}\r\n </td>\r\n <td>\r\n <span *ngIf=\"!part.isAbsent\">\r\n {{ part.timeModified | date: \"yyyy-MM-dd HH:mm:ss\" }}\r\n </span>\r\n </td>\r\n </tr>\r\n </tbody>\r\n </table>\r\n </mat-tab>\r\n\r\n <mat-tab label=\"Th-Scopes\" *ngIf=\"parts$ | async as parts\">\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 ></cadmus-parts-scope-editor>\r\n </mat-tab>\r\n </mat-tab-group>\r\n </mat-card-content>\r\n</mat-card>\r\n", styles: [".full-width{width:100%}th{font-weight:400;color:silver}#layers td{padding:0 6px}div.new-part{margin-left:32px}span.new-part-role{color:gray;margin-left:8px;vertical-align:middle}span.new-part-icon{margin:0 4px;vertical-align:middle}td.count-n{text-align:center;color:#03c03c}td.count-z{text-align:center;color:#f34f41}input.id{font-family:Courier New,Courier,monospace;color:gray;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}fieldset{border:1px solid silver;border-radius:6px;padding:6px;margin:8px 0}\n"] }]
885
+ }], ctorParameters: function () { return [{ type: i1$1.Router }, { type: i1$1.ActivatedRoute }, { type: i2$1.MatSnackBar }, { type: i1.AppRepository }, { type: EditedItemRepository }, { type: i2.ItemService }, { type: i6.LibraryRouteService }, { type: i3$1.DialogService }, { type: i8$1.AuthJwtService }, { type: i2.UserLevelService }, { type: i9.FormBuilder }]; } });
603
886
 
604
887
  // https://github.com/ng-packagr/ng-packagr/issues/778
605
888
  const RouterModuleForChild = RouterModule.forChild([
@@ -607,13 +890,13 @@ const RouterModuleForChild = RouterModule.forChild([
607
890
  ]);
608
891
  class CadmusItemEditorModule {
609
892
  }
610
- CadmusItemEditorModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: CadmusItemEditorModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
611
- CadmusItemEditorModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.1.3", ngImport: i0, type: CadmusItemEditorModule, declarations: [ItemEditorComponent,
893
+ CadmusItemEditorModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: CadmusItemEditorModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
894
+ CadmusItemEditorModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.0.0", ngImport: i0, type: CadmusItemEditorModule, declarations: [ItemEditorComponent,
612
895
  MissingPartsComponent,
613
896
  PartsScopeEditorComponent,
614
897
  HasPreviewPipe], imports: [CommonModule,
615
898
  ReactiveFormsModule,
616
- FormsModule, i1.RouterModule, ClipboardModule,
899
+ FormsModule, i1$1.RouterModule, ClipboardModule,
617
900
  // material
618
901
  MatButtonModule,
619
902
  MatCheckboxModule,
@@ -633,7 +916,7 @@ CadmusItemEditorModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0",
633
916
  CadmusStateModule,
634
917
  NgToolsModule,
635
918
  NgMatToolsModule], exports: [ItemEditorComponent] });
636
- CadmusItemEditorModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: CadmusItemEditorModule, imports: [CommonModule,
919
+ CadmusItemEditorModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: CadmusItemEditorModule, imports: [CommonModule,
637
920
  ReactiveFormsModule,
638
921
  FormsModule,
639
922
  RouterModuleForChild,
@@ -657,7 +940,7 @@ CadmusItemEditorModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0",
657
940
  CadmusStateModule,
658
941
  NgToolsModule,
659
942
  NgMatToolsModule] });
660
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: CadmusItemEditorModule, decorators: [{
943
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: CadmusItemEditorModule, decorators: [{
661
944
  type: NgModule,
662
945
  args: [{
663
946
  imports: [
@@ -704,5 +987,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImpor
704
987
  * Generated bundle index. Do not edit.
705
988
  */
706
989
 
707
- export { CadmusItemEditorModule, ItemEditorComponent, RouterModuleForChild };
990
+ export { CadmusItemEditorModule, EditedItemRepository, ItemEditorComponent, RouterModuleForChild };
708
991
  //# sourceMappingURL=myrmidon-cadmus-item-editor.mjs.map