@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,309 @@
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) => (Object.assign(Object.assign({}, state), { item: {
112
+ id: '',
113
+ title: '',
114
+ description: '',
115
+ facetId: '',
116
+ groupId: '',
117
+ sortKey: '',
118
+ flags: 0,
119
+ timeCreated: new Date(),
120
+ creatorId: '',
121
+ timeModified: new Date(),
122
+ userId: '',
123
+ }, parts: [], partGroups: [], layerPartInfos: layers, facet: this.pickDefaultFacet(app.facets) })));
124
+ });
125
+ }
126
+ else {
127
+ // existing item
128
+ forkJoin({
129
+ item: this._itemService.getItem(itemId, true),
130
+ layers: this._itemService.getItemLayerInfo(itemId, true),
131
+ })
132
+ .pipe(take(1))
133
+ .subscribe({
134
+ next: (result) => {
135
+ this._store.update(updateRequestStatus('edited-item', 'success'));
136
+ const itemFacet = app.facets.find((f) => {
137
+ return f.id === result.item.facetId;
138
+ });
139
+ const facetParts = itemFacet ? itemFacet.partDefinitions : [];
140
+ this._store.update((state) => (Object.assign(Object.assign({}, state), { item: result.item, parts: result.item.parts || [], partGroups: this._itemService.groupParts(result.item.parts || [], facetParts), layerPartInfos: result.layers, facet: itemFacet })));
141
+ },
142
+ });
143
+ }
144
+ }
145
+ /**
146
+ * Ensure that the item with the specified ID is loaded.
147
+ *
148
+ * @param id The item ID.
149
+ */
150
+ ensureItemLoaded(id) {
151
+ var _a;
152
+ if (((_a = this.getItem()) === null || _a === void 0 ? void 0 : _a.id) === id) {
153
+ return;
154
+ }
155
+ this.load(id);
156
+ }
157
+ /**
158
+ * Save the specified item.
159
+ *
160
+ * @param item The item.
161
+ * @returns Promise with saved item.
162
+ */
163
+ save(item) {
164
+ return new Promise((resolve, reject) => {
165
+ this._itemService
166
+ .addItem(item)
167
+ .pipe(take(1))
168
+ .subscribe({
169
+ next: (saved) => {
170
+ this._store.update(setProp('item', saved));
171
+ resolve(saved);
172
+ },
173
+ error: (error) => {
174
+ if (error) {
175
+ console.error(JSON.stringify(error));
176
+ }
177
+ reject({ message: 'Error saving item ' + item.id, error: error });
178
+ },
179
+ });
180
+ });
181
+ }
182
+ /**
183
+ * Delete the specified part from this edited item.
184
+ *
185
+ * @param id The part's ID.
186
+ * @returns Promise with part ID.
187
+ */
188
+ deletePart(id) {
189
+ return new Promise((resolve, reject) => {
190
+ var _a;
191
+ const itemId = (_a = this._store.getValue().item) === null || _a === void 0 ? void 0 : _a.id;
192
+ if (!itemId) {
193
+ reject({
194
+ message: 'Cannot delete part of unsaved item',
195
+ });
196
+ }
197
+ this._itemService
198
+ .deletePart(id)
199
+ .pipe(take(1))
200
+ .subscribe({
201
+ next: (_) => {
202
+ this.load(itemId);
203
+ resolve(id);
204
+ },
205
+ error: (error) => {
206
+ if (error) {
207
+ console.error(JSON.stringify(error));
208
+ }
209
+ reject({
210
+ message: "Error deleting item's part " + id,
211
+ error: error,
212
+ });
213
+ },
214
+ });
215
+ });
216
+ }
217
+ /**
218
+ * Add a new layer part to this item.
219
+ *
220
+ * @param typeId The part type ID.
221
+ * @param roleId The part role ID.
222
+ * @returns Promise with new part.
223
+ */
224
+ addNewLayerPart(typeId, roleId) {
225
+ return new Promise((resolve, reject) => {
226
+ var _a;
227
+ const itemId = (_a = this._store.getValue().item) === null || _a === void 0 ? void 0 : _a.id;
228
+ if (!itemId) {
229
+ reject({
230
+ message: 'Cannot add part to unsaved item',
231
+ });
232
+ }
233
+ const part = {
234
+ itemId: itemId,
235
+ typeId,
236
+ roleId,
237
+ id: '',
238
+ creatorId: '',
239
+ userId: '',
240
+ timeCreated: new Date(),
241
+ timeModified: new Date(),
242
+ };
243
+ this._itemService
244
+ .addPart(part)
245
+ .pipe(take(1))
246
+ .subscribe({
247
+ next: (part) => {
248
+ this.load(itemId);
249
+ resolve(part);
250
+ },
251
+ error: (error) => {
252
+ if (error) {
253
+ console.error(JSON.stringify(error));
254
+ }
255
+ reject({
256
+ message: 'Error adding new layer part for item ' + itemId,
257
+ error: error,
258
+ });
259
+ },
260
+ });
261
+ });
262
+ }
263
+ /**
264
+ * Set the scope for the specified parts in this item.
265
+ *
266
+ * @param ids The part IDs.
267
+ * @param scope The scope to set.
268
+ * @returns Promise.
269
+ */
270
+ setPartThesaurusScope(ids, scope) {
271
+ return new Promise((resolve, reject) => {
272
+ var _a;
273
+ const itemId = (_a = this._store.getValue().item) === null || _a === void 0 ? void 0 : _a.id;
274
+ if (!itemId) {
275
+ reject({
276
+ message: 'Cannot set scope for unsaved item',
277
+ });
278
+ }
279
+ this._itemService
280
+ .setPartThesaurusScope(ids, scope)
281
+ .pipe(take(1))
282
+ .subscribe({
283
+ next: (_) => {
284
+ this.load(itemId);
285
+ resolve(true);
286
+ },
287
+ error: (error) => {
288
+ if (error) {
289
+ console.error(JSON.stringify(error));
290
+ }
291
+ reject({
292
+ message: "Error setting item's part scope",
293
+ error: error,
294
+ });
295
+ },
296
+ });
297
+ });
298
+ }
299
+ }
300
+ 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 });
301
+ EditedItemRepository.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: EditedItemRepository, providedIn: 'root' });
302
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: EditedItemRepository, decorators: [{
303
+ type: Injectable,
304
+ args: [{ providedIn: 'root' }]
305
+ }], ctorParameters: function () { return [{ type: i1.AppRepository }, { type: i2.ItemService }]; } });
306
+
49
307
  class MissingPartsComponent {
50
308
  constructor() {
51
309
  this.missingDefinitions = [];
@@ -95,9 +353,9 @@ class MissingPartsComponent {
95
353
  }
96
354
  }
97
355
  }
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: [{
356
+ MissingPartsComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: MissingPartsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
357
+ 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"] }] });
358
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: MissingPartsComponent, decorators: [{
101
359
  type: Component,
102
360
  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
361
  }], ctorParameters: function () { return []; }, propDecorators: { partDefinitions: [{
@@ -116,12 +374,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImpor
116
374
  * in the item editor.
117
375
  */
118
376
  class PartsScopeEditorComponent {
119
- constructor(_formBuilder, _facetService, _dialogService, _appQuery, _itemQuery) {
377
+ constructor(_formBuilder, _facetService, _dialogService, _appRepository, _editedItemRepository) {
120
378
  this._formBuilder = _formBuilder;
121
379
  this._facetService = _facetService;
122
380
  this._dialogService = _dialogService;
123
- this._appQuery = _appQuery;
124
- this._itemQuery = _itemQuery;
381
+ this._appRepository = _appRepository;
382
+ this._editedItemRepository = _editedItemRepository;
125
383
  // events
126
384
  this.setScopeRequest = new EventEmitter();
127
385
  // form
@@ -153,12 +411,12 @@ class PartsScopeEditorComponent {
153
411
  }
154
412
  }
155
413
  getPartColor(typeId, roleId) {
156
- const state = this._itemQuery.getValue();
157
- return this._facetService.getPartColor(typeId, roleId, state === null || state === void 0 ? void 0 : state.facet);
414
+ const facet = this._editedItemRepository.getFacet();
415
+ return this._facetService.getPartColor(typeId, roleId, facet);
158
416
  }
159
417
  getTypeIdName(typeId) {
160
418
  var _a;
161
- const state = this._appQuery.getValue();
419
+ const state = this._appRepository.getValue();
162
420
  if (!state || !state.typeThesaurus) {
163
421
  return typeId;
164
422
  }
@@ -201,12 +459,12 @@ class PartsScopeEditorComponent {
201
459
  });
202
460
  }
203
461
  }
204
- 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 });
205
- 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" }] });
206
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: PartsScopeEditorComponent, decorators: [{
462
+ 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 });
463
+ 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" }] });
464
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: PartsScopeEditorComponent, decorators: [{
207
465
  type: Component,
208
- 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"] }]
209
- }], ctorParameters: function () { return [{ type: i8.FormBuilder }, { type: i4$1.FacetService }, { type: i3$1.DialogService }, { type: i3$2.AppQuery }, { type: i3$2.EditItemQuery }]; }, propDecorators: { parts: [{
466
+ 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"] }]
467
+ }], ctorParameters: function () { return [{ type: i9.FormBuilder }, { type: i2.FacetService }, { type: i3$1.DialogService }, { type: i1.AppRepository }, { type: EditedItemRepository }]; }, propDecorators: { parts: [{
210
468
  type: Input
211
469
  }], readonly: [{
212
470
  type: Input
@@ -250,9 +508,9 @@ class HasPreviewPipe {
250
508
  return (rKeys === null || rKeys === void 0 ? void 0 : rKeys.find((k) => k === key)) ? true : false;
251
509
  }
252
510
  }
253
- HasPreviewPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: HasPreviewPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
254
- HasPreviewPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "14.1.3", ngImport: i0, type: HasPreviewPipe, name: "hasPreview" });
255
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: HasPreviewPipe, decorators: [{
511
+ HasPreviewPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: HasPreviewPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
512
+ HasPreviewPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "15.0.0", ngImport: i0, type: HasPreviewPipe, name: "hasPreview" });
513
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: HasPreviewPipe, decorators: [{
256
514
  type: Pipe,
257
515
  args: [{
258
516
  name: 'hasPreview',
@@ -263,13 +521,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImpor
263
521
  * Item editor. This can edit a new or existing item's metadata and parts.
264
522
  */
265
523
  class ItemEditorComponent {
266
- constructor(_router, _route, _snackbar, _appQuery, _query, _editItemService, _itemService, _libraryRouteService, _dialogService, _authService, _userLevelService, _formBuilder) {
524
+ constructor(_router, _route, _snackbar, _appRepository, _repository, _itemService, _libraryRouteService, _dialogService, _authService, _userLevelService, _formBuilder) {
267
525
  this._router = _router;
268
526
  this._route = _route;
269
527
  this._snackbar = _snackbar;
270
- this._appQuery = _appQuery;
271
- this._query = _query;
272
- this._editItemService = _editItemService;
528
+ this._appRepository = _appRepository;
529
+ this._repository = _repository;
273
530
  this._itemService = _itemService;
274
531
  this._libraryRouteService = _libraryRouteService;
275
532
  this._dialogService = _dialogService;
@@ -282,6 +539,7 @@ class ItemEditorComponent {
282
539
  if (this.id === 'new') {
283
540
  this.id = undefined;
284
541
  }
542
+ // this.status$ = this._repository.status$;
285
543
  // new part form
286
544
  this.newPartType = _formBuilder.control(null, Validators.required);
287
545
  this.newPart = _formBuilder.group({
@@ -314,19 +572,16 @@ class ItemEditorComponent {
314
572
  flagChecks: this.flagChecks,
315
573
  });
316
574
  this.userLevel = 0;
317
- this.item$ = this._query.selectItem();
318
- this.parts$ = this._query.selectParts();
319
- this.partGroups$ = this._query.select((state) => state.partGroups);
320
- this.layerPartInfos$ = this._query.select((state) => state.layerPartInfos);
321
- this.facet$ = this._query.selectFacet();
322
- this.facets$ = this._appQuery.selectFacets();
323
- this.typeThesaurus$ = this._appQuery.selectTypeThesaurus();
324
- this.previewJKeys$ = this._appQuery.selectPreviewJKeys();
325
- this.previewFKeys$ = this._appQuery.selectPreviewFKeys();
326
- this.loading$ = this._query.selectLoading();
327
- this.saving$ = this._query.selectSaving();
328
- this.deletingPart$ = this._query.selectDeletingPart();
329
- this.error$ = this._query.selectError();
575
+ this.item$ = this._repository.item$;
576
+ this.parts$ = this._repository.parts$;
577
+ this.partGroups$ = this._repository.partGroups$;
578
+ this.layerPartInfos$ = this._repository.layers$;
579
+ this.facet$ = this._repository.facet$;
580
+ // app
581
+ this.facets$ = this._appRepository.facets$;
582
+ this.typeThesaurus$ = this._appRepository.typeThesaurus$;
583
+ this.previewJKeys$ = this._appRepository.previewJKeys$;
584
+ this.previewFKeys$ = this._appRepository.previewFKeys$;
330
585
  }
331
586
  ngOnInit() {
332
587
  this._authService.currentUser$.subscribe((user) => {
@@ -334,7 +589,7 @@ class ItemEditorComponent {
334
589
  this.userLevel = this._userLevelService.getCurrentUserLevel();
335
590
  });
336
591
  // rebuild the flags controls array when flags definitions change
337
- this._appQuery.selectFlags().subscribe((defs) => {
592
+ this._appRepository.flags$.subscribe((defs) => {
338
593
  this.flagDefinitions = defs;
339
594
  this.buildFlagsControls();
340
595
  });
@@ -348,13 +603,13 @@ class ItemEditorComponent {
348
603
  this.newPartDefinitions = this.getNewPartDefinitions();
349
604
  });
350
605
  // load the item (if any) and its lookup
351
- this._editItemService.load(this.id);
606
+ this._repository.load(this.id);
352
607
  }
353
608
  canDeactivate() {
354
609
  return !this.metadata.dirty;
355
610
  }
356
611
  getExistingPartTypeAndRoleIds() {
357
- const groups = this._query.getValue().partGroups;
612
+ const groups = this._repository.getPartGroups();
358
613
  if (!groups) {
359
614
  return [];
360
615
  }
@@ -371,7 +626,7 @@ class ItemEditorComponent {
371
626
  }
372
627
  getNewPartDefinitions() {
373
628
  var _a;
374
- const facet = this._query.getValue().facet;
629
+ const facet = this._repository.getFacet();
375
630
  if (!facet) {
376
631
  return [];
377
632
  }
@@ -457,7 +712,7 @@ class ItemEditorComponent {
457
712
  }
458
713
  getTypeIdName(typeId) {
459
714
  var _a;
460
- const state = this._appQuery.getValue();
715
+ const state = this._appRepository.getValue();
461
716
  if (!state || !state.typeThesaurus) {
462
717
  return typeId;
463
718
  }
@@ -477,10 +732,10 @@ class ItemEditorComponent {
477
732
  }
478
733
  save() {
479
734
  var _a, _b, _c, _d, _e;
480
- if (!this.metadata.valid) {
735
+ if (this.busy || !this.metadata.valid) {
481
736
  return;
482
737
  }
483
- const item = Object.assign({}, this._query.getValue().item);
738
+ const item = Object.assign({}, this._repository.getItem());
484
739
  if (!item) {
485
740
  return;
486
741
  }
@@ -491,16 +746,22 @@ class ItemEditorComponent {
491
746
  item.groupId = ((_e = this.group.value) === null || _e === void 0 ? void 0 : _e.trim()) || undefined;
492
747
  item.flags = this.flags.value;
493
748
  // save and reload as edited if was new
494
- this._editItemService.save(item).then((saved) => {
749
+ this.busy = true;
750
+ this._repository
751
+ .save(item)
752
+ .then((saved) => {
495
753
  this.metadata.markAsPristine();
496
754
  if (!item.id) {
497
755
  this.id = saved.id;
498
756
  this._router.navigate(['/items', saved.id]);
499
757
  }
758
+ })
759
+ .finally(() => {
760
+ this.busy = false;
500
761
  });
501
762
  }
502
763
  partExists(typeId, roleId) {
503
- const groups = this._query.getValue().partGroups;
764
+ const groups = this._repository.getPartGroups();
504
765
  if (!groups) {
505
766
  return false;
506
767
  }
@@ -551,7 +812,7 @@ class ItemEditorComponent {
551
812
  // layer parts redirect to base-text
552
813
  this._itemService
553
814
  .getBaseTextPart(part.itemId)
554
- .pipe(take(1))
815
+ .pipe(take$1(1))
555
816
  .subscribe((p) => {
556
817
  this._router.navigate(['preview', part.itemId, p.part.id, 'text'], {
557
818
  queryParams: { lid: part.roleId },
@@ -566,6 +827,9 @@ class ItemEditorComponent {
566
827
  }
567
828
  }
568
829
  deletePart(part) {
830
+ if (this.busy) {
831
+ return;
832
+ }
569
833
  this._dialogService
570
834
  .confirm('Confirm Deletion', `Delete part "${part.typeId}"?`)
571
835
  .subscribe((result) => {
@@ -573,39 +837,48 @@ class ItemEditorComponent {
573
837
  return;
574
838
  }
575
839
  // delete
576
- this._editItemService.deletePart(part.id).then((_) => {
840
+ this.busy = true;
841
+ this._repository.deletePart(part.id).then((_) => {
842
+ this.busy = false;
577
843
  // once deleted, refresh new-part definitions
578
844
  this.newPartDefinitions = this.getNewPartDefinitions();
579
845
  }, (error) => {
846
+ this.busy = false;
580
847
  console.error(error);
581
848
  this._snackbar.open('Error deleting part', 'OK');
582
849
  });
583
850
  });
584
851
  }
585
852
  addLayerPart(part) {
853
+ if (this.busy) {
854
+ return;
855
+ }
586
856
  let name = this.getTypeIdName(part.typeId);
587
857
  if (part.roleId) {
588
858
  name += ' for ' + this.getRoleIdName(part.roleId);
589
859
  }
860
+ this.busy = true;
590
861
  this._dialogService
591
862
  .confirm('Confirm Addition', `Add layer "${name}"?`)
592
863
  .subscribe((result) => {
593
864
  if (!result) {
594
865
  return;
595
866
  }
596
- this._editItemService.addNewLayerPart(part.itemId, part.typeId, part.roleId);
867
+ this._repository
868
+ .addNewLayerPart(part.typeId, part.roleId)
869
+ .finally(() => (this.busy = false));
597
870
  });
598
871
  }
599
872
  setPartsScope(request) {
600
- this._editItemService.setPartThesaurusScope(request.ids, request.scope);
873
+ this._repository.setPartThesaurusScope(request.ids, request.scope);
601
874
  }
602
875
  }
603
- 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 });
604
- 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" }] });
605
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: ItemEditorComponent, decorators: [{
876
+ 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 });
877
+ 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" }] });
878
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: ItemEditorComponent, decorators: [{
606
879
  type: Component,
607
- 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"] }]
608
- }], 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 }]; } });
880
+ 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"] }]
881
+ }], 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 }]; } });
609
882
 
610
883
  // https://github.com/ng-packagr/ng-packagr/issues/778
611
884
  const RouterModuleForChild = RouterModule.forChild([
@@ -613,13 +886,13 @@ const RouterModuleForChild = RouterModule.forChild([
613
886
  ]);
614
887
  class CadmusItemEditorModule {
615
888
  }
616
- CadmusItemEditorModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: CadmusItemEditorModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
617
- CadmusItemEditorModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.1.3", ngImport: i0, type: CadmusItemEditorModule, declarations: [ItemEditorComponent,
889
+ CadmusItemEditorModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: CadmusItemEditorModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
890
+ CadmusItemEditorModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.0.0", ngImport: i0, type: CadmusItemEditorModule, declarations: [ItemEditorComponent,
618
891
  MissingPartsComponent,
619
892
  PartsScopeEditorComponent,
620
893
  HasPreviewPipe], imports: [CommonModule,
621
894
  ReactiveFormsModule,
622
- FormsModule, i1.RouterModule, ClipboardModule,
895
+ FormsModule, i1$1.RouterModule, ClipboardModule,
623
896
  // material
624
897
  MatButtonModule,
625
898
  MatCheckboxModule,
@@ -639,7 +912,7 @@ CadmusItemEditorModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0",
639
912
  CadmusStateModule,
640
913
  NgToolsModule,
641
914
  NgMatToolsModule], exports: [ItemEditorComponent] });
642
- CadmusItemEditorModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: CadmusItemEditorModule, imports: [CommonModule,
915
+ CadmusItemEditorModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: CadmusItemEditorModule, imports: [CommonModule,
643
916
  ReactiveFormsModule,
644
917
  FormsModule,
645
918
  RouterModuleForChild,
@@ -663,7 +936,7 @@ CadmusItemEditorModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0",
663
936
  CadmusStateModule,
664
937
  NgToolsModule,
665
938
  NgMatToolsModule] });
666
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: CadmusItemEditorModule, decorators: [{
939
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: CadmusItemEditorModule, decorators: [{
667
940
  type: NgModule,
668
941
  args: [{
669
942
  imports: [
@@ -710,5 +983,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImpor
710
983
  * Generated bundle index. Do not edit.
711
984
  */
712
985
 
713
- export { CadmusItemEditorModule, ItemEditorComponent, RouterModuleForChild };
986
+ export { CadmusItemEditorModule, EditedItemRepository, ItemEditorComponent, RouterModuleForChild };
714
987
  //# sourceMappingURL=myrmidon-cadmus-item-editor.mjs.map