@myrmidon/cadmus-item-editor 2.0.5 → 2.0.7
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.
- package/esm2020/lib/cadmus-item-editor.module.mjs +4 -4
- package/esm2020/lib/has-preview.pipe.mjs +3 -3
- package/esm2020/lib/item-editor/item-editor.component.mjs +36 -71
- package/esm2020/lib/missing-parts/missing-parts.component.mjs +3 -3
- package/esm2020/lib/parts-scope-editor/parts-scope-editor.component.mjs +20 -14
- package/esm2020/lib/state/edited-item.repository.mjs +67 -7
- package/fesm2015/myrmidon-cadmus-item-editor.mjs +122 -96
- package/fesm2015/myrmidon-cadmus-item-editor.mjs.map +1 -1
- package/fesm2020/myrmidon-cadmus-item-editor.mjs +125 -95
- package/fesm2020/myrmidon-cadmus-item-editor.mjs.map +1 -1
- package/lib/item-editor/item-editor.component.d.ts +3 -3
- package/lib/parts-scope-editor/parts-scope-editor.component.d.ts +5 -2
- package/lib/state/edited-item.repository.d.ts +11 -3
- package/package.json +1 -1
|
@@ -25,7 +25,7 @@ import * as i12 from '@angular/cdk/clipboard';
|
|
|
25
25
|
import { ClipboardModule } from '@angular/cdk/clipboard';
|
|
26
26
|
import * as i13 from '@angular/material/button';
|
|
27
27
|
import { MatButtonModule } from '@angular/material/button';
|
|
28
|
-
import * as
|
|
28
|
+
import * as i9 from '@angular/material/checkbox';
|
|
29
29
|
import { MatCheckboxModule } from '@angular/material/checkbox';
|
|
30
30
|
import * as i15 from '@angular/material/card';
|
|
31
31
|
import { MatCardModule } from '@angular/material/card';
|
|
@@ -33,11 +33,11 @@ import * as i16 from '@angular/material/divider';
|
|
|
33
33
|
import { MatDividerModule } from '@angular/material/divider';
|
|
34
34
|
import * as i17 from '@angular/material/expansion';
|
|
35
35
|
import { MatExpansionModule } from '@angular/material/expansion';
|
|
36
|
-
import * as
|
|
36
|
+
import * as i10$1 from '@angular/material/form-field';
|
|
37
37
|
import { MatFormFieldModule } from '@angular/material/form-field';
|
|
38
38
|
import * as i3 from '@angular/material/icon';
|
|
39
39
|
import { MatIconModule } from '@angular/material/icon';
|
|
40
|
-
import * as
|
|
40
|
+
import * as i11$1 from '@angular/material/input';
|
|
41
41
|
import { MatInputModule } from '@angular/material/input';
|
|
42
42
|
import * as i21 from '@angular/material/progress-bar';
|
|
43
43
|
import { MatProgressBarModule } from '@angular/material/progress-bar';
|
|
@@ -64,12 +64,14 @@ class EditedItemRepository {
|
|
|
64
64
|
parts: [],
|
|
65
65
|
partGroups: [],
|
|
66
66
|
layerPartInfos: [],
|
|
67
|
+
newPartDefinitions: [],
|
|
67
68
|
}), withRequestsStatus());
|
|
68
69
|
this.item$ = this._store.pipe(select((state) => state.item));
|
|
69
70
|
this.parts$ = this._store.pipe(select((state) => state.parts));
|
|
70
71
|
this.partGroups$ = this._store.pipe(select((state) => state.partGroups));
|
|
71
72
|
this.layers$ = this._store.pipe(select((state) => state.layerPartInfos));
|
|
72
73
|
this.facet$ = this._store.pipe(select((state) => state.facet));
|
|
74
|
+
this.newPartDefinitions$ = this._store.pipe(select((state) => state.newPartDefinitions));
|
|
73
75
|
// this.status$ = this._store.pipe(selectRequestStatus('edited-item'));
|
|
74
76
|
}
|
|
75
77
|
getValue() {
|
|
@@ -81,6 +83,50 @@ class EditedItemRepository {
|
|
|
81
83
|
getFacet() {
|
|
82
84
|
return this._store.query((state) => state.facet);
|
|
83
85
|
}
|
|
86
|
+
getExistingPartTypeAndRoleIds() {
|
|
87
|
+
const groups = this.getPartGroups();
|
|
88
|
+
if (!groups) {
|
|
89
|
+
return [];
|
|
90
|
+
}
|
|
91
|
+
const results = [];
|
|
92
|
+
for (const group of groups) {
|
|
93
|
+
for (const part of group.parts) {
|
|
94
|
+
results.push({
|
|
95
|
+
typeId: part.typeId,
|
|
96
|
+
roleId: part.roleId,
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
return results;
|
|
101
|
+
}
|
|
102
|
+
getNewPartDefinitions() {
|
|
103
|
+
var _a;
|
|
104
|
+
const facet = this.getFacet();
|
|
105
|
+
if (!facet) {
|
|
106
|
+
return [];
|
|
107
|
+
}
|
|
108
|
+
const existingTypeRoleIds = this.getExistingPartTypeAndRoleIds();
|
|
109
|
+
const defs = [];
|
|
110
|
+
for (const def of facet.partDefinitions) {
|
|
111
|
+
// exclude layer parts, as these are in the layers tab
|
|
112
|
+
if ((_a = def.roleId) === null || _a === void 0 ? void 0 : _a.startsWith('fr.')) {
|
|
113
|
+
continue;
|
|
114
|
+
}
|
|
115
|
+
// exclude parts present in the item
|
|
116
|
+
if (existingTypeRoleIds.find((tr) => {
|
|
117
|
+
return (tr.typeId === def.typeId &&
|
|
118
|
+
((!tr.roleId && !def.roleId) || tr.roleId === def.roleId));
|
|
119
|
+
})) {
|
|
120
|
+
continue;
|
|
121
|
+
}
|
|
122
|
+
defs.push(def);
|
|
123
|
+
}
|
|
124
|
+
// sort by sort key
|
|
125
|
+
defs.sort((a, b) => {
|
|
126
|
+
return a.sortKey.localeCompare(b.sortKey);
|
|
127
|
+
});
|
|
128
|
+
return defs;
|
|
129
|
+
}
|
|
84
130
|
getPartGroups() {
|
|
85
131
|
return this._store.query((state) => state.partGroups);
|
|
86
132
|
}
|
|
@@ -99,7 +145,7 @@ class EditedItemRepository {
|
|
|
99
145
|
/**
|
|
100
146
|
* Load the specified item or a new item.
|
|
101
147
|
*
|
|
102
|
-
* @param itemId The item ID, or
|
|
148
|
+
* @param itemId The item ID, or falsy for a new item.
|
|
103
149
|
*/
|
|
104
150
|
load(itemId) {
|
|
105
151
|
const app = this._appRepository.getValue();
|
|
@@ -124,6 +170,7 @@ class EditedItemRepository {
|
|
|
124
170
|
timeModified: new Date(),
|
|
125
171
|
userId: '',
|
|
126
172
|
}, parts: [], partGroups: [], layerPartInfos: layers, facet: this.pickDefaultFacet(app.facets) })));
|
|
173
|
+
this._store.update(setProp('newPartDefinitions', this.getNewPartDefinitions()));
|
|
127
174
|
});
|
|
128
175
|
}
|
|
129
176
|
else {
|
|
@@ -141,6 +188,7 @@ class EditedItemRepository {
|
|
|
141
188
|
});
|
|
142
189
|
const facetParts = itemFacet ? itemFacet.partDefinitions : [];
|
|
143
190
|
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 })));
|
|
191
|
+
this._store.update(setProp('newPartDefinitions', this.getNewPartDefinitions()));
|
|
144
192
|
},
|
|
145
193
|
});
|
|
146
194
|
}
|
|
@@ -158,7 +206,7 @@ class EditedItemRepository {
|
|
|
158
206
|
this.load(id);
|
|
159
207
|
}
|
|
160
208
|
/**
|
|
161
|
-
* Save the specified item.
|
|
209
|
+
* Save the specified item in the backend and update this store.
|
|
162
210
|
*
|
|
163
211
|
* @param item The item.
|
|
164
212
|
* @returns Promise with saved item.
|
|
@@ -170,7 +218,16 @@ class EditedItemRepository {
|
|
|
170
218
|
.pipe(take(1))
|
|
171
219
|
.subscribe({
|
|
172
220
|
next: (saved) => {
|
|
173
|
-
|
|
221
|
+
// update the item and the selected facet from it;
|
|
222
|
+
// this is required when the item was new, and thus loaded
|
|
223
|
+
// with the default facet before saving it
|
|
224
|
+
const app = this._appRepository.getValue();
|
|
225
|
+
const itemFacet = app.facets.find((f) => {
|
|
226
|
+
return f.id === saved.facetId;
|
|
227
|
+
});
|
|
228
|
+
this._store.update((state) => (Object.assign(Object.assign({}, state), { item: saved, facet: itemFacet })));
|
|
229
|
+
// new-parts definitions
|
|
230
|
+
this._store.update(setProp('newPartDefinitions', this.getNewPartDefinitions()));
|
|
174
231
|
resolve(saved);
|
|
175
232
|
},
|
|
176
233
|
error: (error) => {
|
|
@@ -300,9 +357,9 @@ class EditedItemRepository {
|
|
|
300
357
|
});
|
|
301
358
|
}
|
|
302
359
|
}
|
|
303
|
-
EditedItemRepository.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.
|
|
304
|
-
EditedItemRepository.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.
|
|
305
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.
|
|
360
|
+
EditedItemRepository.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.3", ngImport: i0, type: EditedItemRepository, deps: [{ token: i1.AppRepository }, { token: i2.ItemService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
361
|
+
EditedItemRepository.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.3", ngImport: i0, type: EditedItemRepository, providedIn: 'root' });
|
|
362
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.3", ngImport: i0, type: EditedItemRepository, decorators: [{
|
|
306
363
|
type: Injectable,
|
|
307
364
|
args: [{ providedIn: 'root' }]
|
|
308
365
|
}], ctorParameters: function () { return [{ type: i1.AppRepository }, { type: i2.ItemService }]; } });
|
|
@@ -356,9 +413,9 @@ class MissingPartsComponent {
|
|
|
356
413
|
}
|
|
357
414
|
}
|
|
358
415
|
}
|
|
359
|
-
MissingPartsComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.
|
|
360
|
-
MissingPartsComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.
|
|
361
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.
|
|
416
|
+
MissingPartsComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.3", ngImport: i0, type: MissingPartsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
417
|
+
MissingPartsComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.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> 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: i11.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i11.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i13.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: "directive", type: i4.MatTooltip, selector: "[matTooltip]", exportAs: ["matTooltip"] }, { kind: "component", type: i5.PartBadgeComponent, selector: "cadmus-part-badge", inputs: ["badgeType", "typeThesaurus", "facetDefinition", "partTypeIds"] }] });
|
|
418
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.3", ngImport: i0, type: MissingPartsComponent, decorators: [{
|
|
362
419
|
type: Component,
|
|
363
420
|
args: [{ selector: 'cadmus-missing-parts', template: "<div *ngIf=\"missingDefinitions.length\">\r\n <h3><mat-icon color=\"warn\">warning</mat-icon> 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" }]
|
|
364
421
|
}], ctorParameters: function () { return []; }, propDecorators: { partDefinitions: [{
|
|
@@ -377,11 +434,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.3", ngImpor
|
|
|
377
434
|
* in the item editor.
|
|
378
435
|
*/
|
|
379
436
|
class PartsScopeEditorComponent {
|
|
380
|
-
constructor(_formBuilder, _facetService, _dialogService, _appRepository, _editedItemRepository) {
|
|
437
|
+
constructor(_formBuilder, _facetService, _dialogService, _appRepository, _colorService, _editedItemRepository) {
|
|
381
438
|
this._formBuilder = _formBuilder;
|
|
382
439
|
this._facetService = _facetService;
|
|
383
440
|
this._dialogService = _dialogService;
|
|
384
441
|
this._appRepository = _appRepository;
|
|
442
|
+
this._colorService = _colorService;
|
|
385
443
|
this._editedItemRepository = _editedItemRepository;
|
|
386
444
|
// events
|
|
387
445
|
this.setScopeRequest = new EventEmitter();
|
|
@@ -417,6 +475,10 @@ class PartsScopeEditorComponent {
|
|
|
417
475
|
const facet = this._editedItemRepository.getFacet();
|
|
418
476
|
return this._facetService.getPartColor(typeId, roleId, facet);
|
|
419
477
|
}
|
|
478
|
+
getContrastColor(typeId, roleId) {
|
|
479
|
+
const rgb = this.getPartColor(typeId, roleId);
|
|
480
|
+
return this._colorService.getContrastColor(rgb);
|
|
481
|
+
}
|
|
420
482
|
getTypeIdName(typeId) {
|
|
421
483
|
var _a;
|
|
422
484
|
const state = this._appRepository.getValue();
|
|
@@ -462,12 +524,12 @@ class PartsScopeEditorComponent {
|
|
|
462
524
|
});
|
|
463
525
|
}
|
|
464
526
|
}
|
|
465
|
-
PartsScopeEditorComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.
|
|
466
|
-
PartsScopeEditorComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.
|
|
467
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.
|
|
527
|
+
PartsScopeEditorComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.3", ngImport: i0, type: PartsScopeEditorComponent, deps: [{ token: i10.FormBuilder }, { token: i2.FacetService }, { token: i3$1.DialogService }, { token: i1.AppRepository }, { token: i5.ColorService }, { token: EditedItemRepository }], target: i0.ɵɵFactoryTarget.Component });
|
|
528
|
+
PartsScopeEditorComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.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 \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]=\"getPartColor($any(parts)[i].typeId, $any(parts)[i].roleId)\"\r\n [style.color]=\"getContrastColor($any(parts)[i].typeId, $any(parts)[i].roleId)\"\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: i11.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i11.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i10.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i10.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: i10.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i10.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i10.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i10.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "directive", type: i10.FormArrayName, selector: "[formArrayName]", inputs: ["formArrayName"] }, { kind: "component", type: i13.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: i9.MatCheckbox, selector: "mat-checkbox", inputs: ["disableRipple", "color", "tabIndex"], exportAs: ["matCheckbox"] }, { kind: "component", type: i10$1.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i10$1.MatLabel, selector: "mat-label" }, { kind: "directive", type: i10$1.MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "directive", type: i11$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: "directive", type: i4.MatTooltip, selector: "[matTooltip]", exportAs: ["matTooltip"] }, { kind: "pipe", type: i11.DatePipe, name: "date" }] });
|
|
529
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.3", ngImport: i0, type: PartsScopeEditorComponent, decorators: [{
|
|
468
530
|
type: Component,
|
|
469
|
-
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 \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]=\"
|
|
470
|
-
}], ctorParameters: function () { return [{ type: i10.FormBuilder }, { type: i2.FacetService }, { type: i3$1.DialogService }, { type: i1.AppRepository }, { type: EditedItemRepository }]; }, propDecorators: { parts: [{
|
|
531
|
+
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 \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]=\"getPartColor($any(parts)[i].typeId, $any(parts)[i].roleId)\"\r\n [style.color]=\"getContrastColor($any(parts)[i].typeId, $any(parts)[i].roleId)\"\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"] }]
|
|
532
|
+
}], ctorParameters: function () { return [{ type: i10.FormBuilder }, { type: i2.FacetService }, { type: i3$1.DialogService }, { type: i1.AppRepository }, { type: i5.ColorService }, { type: EditedItemRepository }]; }, propDecorators: { parts: [{
|
|
471
533
|
type: Input
|
|
472
534
|
}], readonly: [{
|
|
473
535
|
type: Input
|
|
@@ -511,9 +573,9 @@ class HasPreviewPipe {
|
|
|
511
573
|
return (rKeys === null || rKeys === void 0 ? void 0 : rKeys.find((k) => k === key)) ? true : false;
|
|
512
574
|
}
|
|
513
575
|
}
|
|
514
|
-
HasPreviewPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.
|
|
515
|
-
HasPreviewPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "15.
|
|
516
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.
|
|
576
|
+
HasPreviewPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.3", ngImport: i0, type: HasPreviewPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
577
|
+
HasPreviewPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "15.1.3", ngImport: i0, type: HasPreviewPipe, name: "hasPreview" });
|
|
578
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.3", ngImport: i0, type: HasPreviewPipe, decorators: [{
|
|
517
579
|
type: Pipe,
|
|
518
580
|
args: [{
|
|
519
581
|
name: 'hasPreview',
|
|
@@ -522,6 +584,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.3", ngImpor
|
|
|
522
584
|
|
|
523
585
|
/**
|
|
524
586
|
* Item editor. This can edit a new or existing item's metadata and parts.
|
|
587
|
+
* The ID of the item being edited is extracted from the route. For a new item
|
|
588
|
+
* this is 'new', which here is stored as an empty string.
|
|
525
589
|
*/
|
|
526
590
|
class ItemEditorComponent {
|
|
527
591
|
constructor(_router, _route, _snackbar, _appRepository, _repository, _itemService, _itemListRepository, _libraryRouteService, _dialogService, _authService, _userLevelService, _formBuilder) {
|
|
@@ -539,11 +603,9 @@ class ItemEditorComponent {
|
|
|
539
603
|
this._formBuilder = _formBuilder;
|
|
540
604
|
this.id = this._route.snapshot.params['id'];
|
|
541
605
|
this.flagDefinitions = [];
|
|
542
|
-
this.newPartDefinitions = [];
|
|
543
606
|
if (this.id === 'new') {
|
|
544
607
|
this.id = undefined;
|
|
545
608
|
}
|
|
546
|
-
// this.status$ = this._repository.status$;
|
|
547
609
|
// new part form
|
|
548
610
|
this.newPartType = _formBuilder.control(null, Validators.required);
|
|
549
611
|
this.newPart = _formBuilder.group({
|
|
@@ -581,6 +643,7 @@ class ItemEditorComponent {
|
|
|
581
643
|
this.partGroups$ = this._repository.partGroups$;
|
|
582
644
|
this.layerPartInfos$ = this._repository.layers$;
|
|
583
645
|
this.facet$ = this._repository.facet$;
|
|
646
|
+
this.newPartDefinitions$ = this._repository.newPartDefinitions$;
|
|
584
647
|
// app
|
|
585
648
|
this.facets$ = this._appRepository.facets$;
|
|
586
649
|
this.typeThesaurus$ = this._appRepository.typeThesaurus$;
|
|
@@ -603,10 +666,9 @@ class ItemEditorComponent {
|
|
|
603
666
|
this.flags.setValue(this.getFlagsValue());
|
|
604
667
|
}
|
|
605
668
|
});
|
|
606
|
-
// update the metadata form when item changes
|
|
669
|
+
// update the metadata form when item changes (e.g. saved)
|
|
607
670
|
this.item$.subscribe((item) => {
|
|
608
671
|
this.updateMetadataForm(item);
|
|
609
|
-
this.newPartDefinitions = this.getNewPartDefinitions();
|
|
610
672
|
});
|
|
611
673
|
// load the item (if any) and its lookup
|
|
612
674
|
this._repository.load(this.id);
|
|
@@ -614,50 +676,6 @@ class ItemEditorComponent {
|
|
|
614
676
|
canDeactivate() {
|
|
615
677
|
return !this.metadata.dirty;
|
|
616
678
|
}
|
|
617
|
-
getExistingPartTypeAndRoleIds() {
|
|
618
|
-
const groups = this._repository.getPartGroups();
|
|
619
|
-
if (!groups) {
|
|
620
|
-
return [];
|
|
621
|
-
}
|
|
622
|
-
const results = [];
|
|
623
|
-
for (const group of groups) {
|
|
624
|
-
for (const part of group.parts) {
|
|
625
|
-
results.push({
|
|
626
|
-
typeId: part.typeId,
|
|
627
|
-
roleId: part.roleId,
|
|
628
|
-
});
|
|
629
|
-
}
|
|
630
|
-
}
|
|
631
|
-
return results;
|
|
632
|
-
}
|
|
633
|
-
getNewPartDefinitions() {
|
|
634
|
-
var _a;
|
|
635
|
-
const facet = this._repository.getFacet();
|
|
636
|
-
if (!facet) {
|
|
637
|
-
return [];
|
|
638
|
-
}
|
|
639
|
-
const existingTypeRoleIds = this.getExistingPartTypeAndRoleIds();
|
|
640
|
-
const defs = [];
|
|
641
|
-
for (const def of facet.partDefinitions) {
|
|
642
|
-
// exclude layer parts, as these are in the layers tab
|
|
643
|
-
if ((_a = def.roleId) === null || _a === void 0 ? void 0 : _a.startsWith('fr.')) {
|
|
644
|
-
continue;
|
|
645
|
-
}
|
|
646
|
-
// exclude parts present in the item
|
|
647
|
-
if (existingTypeRoleIds.find((tr) => {
|
|
648
|
-
return (tr.typeId === def.typeId &&
|
|
649
|
-
((!tr.roleId && !def.roleId) || tr.roleId === def.roleId));
|
|
650
|
-
})) {
|
|
651
|
-
continue;
|
|
652
|
-
}
|
|
653
|
-
defs.push(def);
|
|
654
|
-
}
|
|
655
|
-
// sort by sort key
|
|
656
|
-
defs.sort((a, b) => {
|
|
657
|
-
return a.sortKey.localeCompare(b.sortKey);
|
|
658
|
-
});
|
|
659
|
-
return defs;
|
|
660
|
-
}
|
|
661
679
|
/**
|
|
662
680
|
* Builds the array of flags controls according to the current flags
|
|
663
681
|
* definitions and the current flags value.
|
|
@@ -746,6 +764,7 @@ class ItemEditorComponent {
|
|
|
746
764
|
if (this.busy || !this.metadata.valid) {
|
|
747
765
|
return;
|
|
748
766
|
}
|
|
767
|
+
// build item (its ID will be empty if new)
|
|
749
768
|
const item = Object.assign({}, this._repository.getItem());
|
|
750
769
|
if (!item) {
|
|
751
770
|
return;
|
|
@@ -756,27 +775,36 @@ class ItemEditorComponent {
|
|
|
756
775
|
item.facetId = ((_d = this.facet.value) === null || _d === void 0 ? void 0 : _d.trim()) || undefined;
|
|
757
776
|
item.groupId = ((_e = this.group.value) === null || _e === void 0 ? void 0 : _e.trim()) || undefined;
|
|
758
777
|
item.flags = this.flags.value;
|
|
759
|
-
// save
|
|
778
|
+
// save: this will trigger a change in the store's item, reflected here
|
|
779
|
+
// by updating the metadata form
|
|
760
780
|
this.busy = true;
|
|
761
781
|
this._repository
|
|
762
782
|
.save(item)
|
|
763
783
|
.then((saved) => {
|
|
764
|
-
//
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
784
|
+
// once saved, a new item requires resetting the items list
|
|
785
|
+
if (!item.id) {
|
|
786
|
+
this._itemListRepository.clearCache();
|
|
787
|
+
this._itemListRepository.loadPage(1);
|
|
788
|
+
}
|
|
789
|
+
else {
|
|
790
|
+
// an existing item instead just requires updating the entity
|
|
791
|
+
// in the items list if present (e.g. flags might have been changed)
|
|
792
|
+
this._itemListRepository.updateEntity({
|
|
793
|
+
id: item.id,
|
|
794
|
+
title: item.title,
|
|
795
|
+
description: item.description,
|
|
796
|
+
facetId: item.facetId,
|
|
797
|
+
groupId: item.groupId,
|
|
798
|
+
sortKey: item.sortKey,
|
|
799
|
+
flags: item.flags,
|
|
800
|
+
timeCreated: item.timeCreated,
|
|
801
|
+
creatorId: item.creatorId,
|
|
802
|
+
timeModified: item.timeModified,
|
|
803
|
+
userId: item.userId,
|
|
804
|
+
});
|
|
805
|
+
}
|
|
806
|
+
// this.metadata.markAsPristine();
|
|
807
|
+
// reload to force change in page URL
|
|
780
808
|
if (!item.id) {
|
|
781
809
|
this.id = saved.id;
|
|
782
810
|
this._router.navigate(['/items', saved.id]);
|
|
@@ -866,8 +894,6 @@ class ItemEditorComponent {
|
|
|
866
894
|
this.busy = true;
|
|
867
895
|
this._repository.deletePart(part.id).then((_) => {
|
|
868
896
|
this.busy = false;
|
|
869
|
-
// once deleted, refresh new-part definitions
|
|
870
|
-
this.newPartDefinitions = this.getNewPartDefinitions();
|
|
871
897
|
}, (error) => {
|
|
872
898
|
this.busy = false;
|
|
873
899
|
console.error(error);
|
|
@@ -899,11 +925,11 @@ class ItemEditorComponent {
|
|
|
899
925
|
this._repository.setPartThesaurusScope(request.ids, request.scope);
|
|
900
926
|
}
|
|
901
927
|
}
|
|
902
|
-
ItemEditorComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.
|
|
903
|
-
ItemEditorComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.0.3", 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 >⬤</span\r\n >\r\n \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 >⬤</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 \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 style=\"width: 100%\">\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 class=\"noif-lt-xs\">modified</th>\r\n <th class=\"noif-lt-xs\">user</th>\r\n </tr>\r\n </thead>\r\n <tbody>\r\n <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 [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 [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 class=\"noif-lt-xs\">\r\n {{ part.timeModified | date: \"yyyy-MM-dd HH:mm:ss\" }}\r\n </td>\r\n <td class=\"noif-lt-xs\">{{ part.userId }}</td>\r\n </tr>\r\n </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}@media only screen and (max-width: 599px){.noif-lt-xs{display:none}}\n"], dependencies: [{ kind: "directive", type: i11.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i11.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i11.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i10.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i10.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: i10.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i10.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i10.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i10.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "directive", type: i10.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i10.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "directive", type: i10.FormArrayName, selector: "[formArrayName]", inputs: ["formArrayName"] }, { kind: "directive", type: i12.CdkCopyToClipboard, selector: "[cdkCopyToClipboard]", inputs: ["cdkCopyToClipboard", "cdkCopyToClipboardAttempts"], outputs: ["cdkCopyToClipboardCopied"] }, { kind: "component", type: i13.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: i13.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: i15.MatCard, selector: "mat-card", inputs: ["appearance"], exportAs: ["matCard"] }, { kind: "directive", type: i15.MatCardContent, selector: "mat-card-content" }, { kind: "component", type: i15.MatCardHeader, selector: "mat-card-header" }, { kind: "directive", type: i15.MatCardSubtitle, selector: "mat-card-subtitle, [mat-card-subtitle], [matCardSubtitle]" }, { kind: "directive", type: i15.MatCardTitle, selector: "mat-card-title, [mat-card-title], [matCardTitle]" }, { kind: "component", type: i16.MatDivider, selector: "mat-divider", inputs: ["vertical", "inset"] }, { kind: "component", type: i17.MatExpansionPanel, selector: "mat-expansion-panel", inputs: ["disabled", "expanded", "hideToggle", "togglePosition"], outputs: ["opened", "closed", "expandedChange", "afterExpand", "afterCollapse"], exportAs: ["matExpansionPanel"] }, { kind: "component", type: i17.MatExpansionPanelHeader, selector: "mat-expansion-panel-header", inputs: ["tabIndex", "expandedHeight", "collapsedHeight"] }, { kind: "directive", type: i17.MatExpansionPanelTitle, selector: "mat-panel-title" }, { kind: "directive", type: i17.MatExpansionPanelDescription, selector: "mat-panel-description" }, { kind: "component", type: i9.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i9.MatLabel, selector: "mat-label" }, { kind: "directive", type: i9.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: i21.MatProgressBar, selector: "mat-progress-bar", inputs: ["color", "value", "bufferValue", "mode"], outputs: ["animationEnd"], exportAs: ["matProgressBar"] }, { kind: "component", type: i22.MatSelect, selector: "mat-select", inputs: ["disabled", "disableRipple", "tabIndex"], exportAs: ["matSelect"] }, { kind: "component", type: i23.MatOption, selector: "mat-option", exportAs: ["matOption"] }, { kind: "component", type: i24.MatTab, selector: "mat-tab", inputs: ["disabled"], exportAs: ["matTab"] }, { kind: "component", type: i24.MatTabGroup, selector: "mat-tab-group", inputs: ["color", "disableRipple", "fitInkBarToContent", "mat-stretch-tabs"], exportAs: ["matTabGroup"] }, { kind: "directive", type: i4.MatTooltip, selector: "[matTooltip]", exportAs: ["matTooltip"] }, { kind: "component", type: i5.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: i11.AsyncPipe, name: "async" }, { kind: "pipe", type: i11.DatePipe, name: "date" }, { kind: "pipe", type: HasPreviewPipe, name: "hasPreview" }] });
|
|
904
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.
|
|
928
|
+
ItemEditorComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.3", 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.ItemListRepository }, { token: i7.LibraryRouteService }, { token: i3$1.DialogService }, { token: i9$1.AuthJwtService }, { token: i2.UserLevelService }, { token: i10.FormBuilder }], target: i0.ɵɵFactoryTarget.Component });
|
|
929
|
+
ItemEditorComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.3", 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 >⬤</span\r\n >\r\n \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\r\n *ngFor=\"let p of newPartDefinitions$ | async\"\r\n [value]=\"p\"\r\n >\r\n <span [style.color]=\"'#' + p.colorKey\" class=\"new-part-icon\"\r\n >⬤</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 \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 style=\"width: 100%\">\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 class=\"noif-lt-xs\">modified</th>\r\n <th class=\"noif-lt-xs\">user</th>\r\n </tr>\r\n </thead>\r\n <tbody>\r\n <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 [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 [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 class=\"noif-lt-xs\">\r\n {{ part.timeModified | date : \"yyyy-MM-dd HH:mm:ss\" }}\r\n </td>\r\n <td class=\"noif-lt-xs\">{{ part.userId }}</td>\r\n </tr>\r\n </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}@media only screen and (max-width: 599px){.noif-lt-xs{display:none}}\n"], dependencies: [{ kind: "directive", type: i11.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i11.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i11.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i10.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i10.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: i10.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i10.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i10.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i10.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "directive", type: i10.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i10.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "directive", type: i10.FormArrayName, selector: "[formArrayName]", inputs: ["formArrayName"] }, { kind: "directive", type: i12.CdkCopyToClipboard, selector: "[cdkCopyToClipboard]", inputs: ["cdkCopyToClipboard", "cdkCopyToClipboardAttempts"], outputs: ["cdkCopyToClipboardCopied"] }, { kind: "component", type: i13.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: i13.MatIconButton, selector: "button[mat-icon-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "component", type: i9.MatCheckbox, selector: "mat-checkbox", inputs: ["disableRipple", "color", "tabIndex"], exportAs: ["matCheckbox"] }, { kind: "component", type: i15.MatCard, selector: "mat-card", inputs: ["appearance"], exportAs: ["matCard"] }, { kind: "directive", type: i15.MatCardContent, selector: "mat-card-content" }, { kind: "component", type: i15.MatCardHeader, selector: "mat-card-header" }, { kind: "directive", type: i15.MatCardSubtitle, selector: "mat-card-subtitle, [mat-card-subtitle], [matCardSubtitle]" }, { kind: "directive", type: i15.MatCardTitle, selector: "mat-card-title, [mat-card-title], [matCardTitle]" }, { kind: "component", type: i16.MatDivider, selector: "mat-divider", inputs: ["vertical", "inset"] }, { kind: "component", type: i17.MatExpansionPanel, selector: "mat-expansion-panel", inputs: ["disabled", "expanded", "hideToggle", "togglePosition"], outputs: ["opened", "closed", "expandedChange", "afterExpand", "afterCollapse"], exportAs: ["matExpansionPanel"] }, { kind: "component", type: i17.MatExpansionPanelHeader, selector: "mat-expansion-panel-header", inputs: ["tabIndex", "expandedHeight", "collapsedHeight"] }, { kind: "directive", type: i17.MatExpansionPanelTitle, selector: "mat-panel-title" }, { kind: "directive", type: i17.MatExpansionPanelDescription, selector: "mat-panel-description" }, { kind: "component", type: i10$1.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i10$1.MatLabel, selector: "mat-label" }, { kind: "directive", type: i10$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: i11$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: i21.MatProgressBar, selector: "mat-progress-bar", inputs: ["color", "value", "bufferValue", "mode"], outputs: ["animationEnd"], exportAs: ["matProgressBar"] }, { kind: "component", type: i22.MatSelect, selector: "mat-select", inputs: ["disabled", "disableRipple", "tabIndex"], exportAs: ["matSelect"] }, { kind: "component", type: i23.MatOption, selector: "mat-option", exportAs: ["matOption"] }, { kind: "component", type: i24.MatTab, selector: "mat-tab", inputs: ["disabled"], exportAs: ["matTab"] }, { kind: "component", type: i24.MatTabGroup, selector: "mat-tab-group", inputs: ["color", "disableRipple", "fitInkBarToContent", "mat-stretch-tabs"], exportAs: ["matTabGroup"] }, { kind: "directive", type: i4.MatTooltip, selector: "[matTooltip]", exportAs: ["matTooltip"] }, { kind: "component", type: i5.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: i11.AsyncPipe, name: "async" }, { kind: "pipe", type: i11.DatePipe, name: "date" }, { kind: "pipe", type: HasPreviewPipe, name: "hasPreview" }] });
|
|
930
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.3", ngImport: i0, type: ItemEditorComponent, decorators: [{
|
|
905
931
|
type: Component,
|
|
906
|
-
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 >⬤</span\r\n >\r\n \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 >⬤</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 \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 style=\"width: 100%\">\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 class=\"noif-lt-xs\">modified</th>\r\n <th class=\"noif-lt-xs\">user</th>\r\n </tr>\r\n </thead>\r\n <tbody>\r\n <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 [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 [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 class=\"noif-lt-xs\">\r\n {{ part.timeModified | date: \"yyyy-MM-dd HH:mm:ss\" }}\r\n </td>\r\n <td class=\"noif-lt-xs\">{{ part.userId }}</td>\r\n </tr>\r\n </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}@media only screen and (max-width: 599px){.noif-lt-xs{display:none}}\n"] }]
|
|
932
|
+
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 >⬤</span\r\n >\r\n \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\r\n *ngFor=\"let p of newPartDefinitions$ | async\"\r\n [value]=\"p\"\r\n >\r\n <span [style.color]=\"'#' + p.colorKey\" class=\"new-part-icon\"\r\n >⬤</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 \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 style=\"width: 100%\">\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 class=\"noif-lt-xs\">modified</th>\r\n <th class=\"noif-lt-xs\">user</th>\r\n </tr>\r\n </thead>\r\n <tbody>\r\n <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 [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 [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 class=\"noif-lt-xs\">\r\n {{ part.timeModified | date : \"yyyy-MM-dd HH:mm:ss\" }}\r\n </td>\r\n <td class=\"noif-lt-xs\">{{ part.userId }}</td>\r\n </tr>\r\n </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}@media only screen and (max-width: 599px){.noif-lt-xs{display:none}}\n"] }]
|
|
907
933
|
}], 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.ItemListRepository }, { type: i7.LibraryRouteService }, { type: i3$1.DialogService }, { type: i9$1.AuthJwtService }, { type: i2.UserLevelService }, { type: i10.FormBuilder }]; } });
|
|
908
934
|
|
|
909
935
|
// https://github.com/ng-packagr/ng-packagr/issues/778
|
|
@@ -912,8 +938,8 @@ const RouterModuleForChild = RouterModule.forChild([
|
|
|
912
938
|
]);
|
|
913
939
|
class CadmusItemEditorModule {
|
|
914
940
|
}
|
|
915
|
-
CadmusItemEditorModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.
|
|
916
|
-
CadmusItemEditorModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.
|
|
941
|
+
CadmusItemEditorModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.3", ngImport: i0, type: CadmusItemEditorModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
942
|
+
CadmusItemEditorModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.1.3", ngImport: i0, type: CadmusItemEditorModule, declarations: [ItemEditorComponent,
|
|
917
943
|
MissingPartsComponent,
|
|
918
944
|
PartsScopeEditorComponent,
|
|
919
945
|
HasPreviewPipe], imports: [CommonModule,
|
|
@@ -939,7 +965,7 @@ CadmusItemEditorModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0",
|
|
|
939
965
|
CadmusStateModule,
|
|
940
966
|
NgToolsModule,
|
|
941
967
|
NgMatToolsModule], exports: [ItemEditorComponent] });
|
|
942
|
-
CadmusItemEditorModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.
|
|
968
|
+
CadmusItemEditorModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.1.3", ngImport: i0, type: CadmusItemEditorModule, imports: [CommonModule,
|
|
943
969
|
ReactiveFormsModule,
|
|
944
970
|
FormsModule,
|
|
945
971
|
RouterModuleForChild,
|
|
@@ -964,7 +990,7 @@ CadmusItemEditorModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0",
|
|
|
964
990
|
CadmusStateModule,
|
|
965
991
|
NgToolsModule,
|
|
966
992
|
NgMatToolsModule] });
|
|
967
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.
|
|
993
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.3", ngImport: i0, type: CadmusItemEditorModule, decorators: [{
|
|
968
994
|
type: NgModule,
|
|
969
995
|
args: [{
|
|
970
996
|
imports: [
|