@myrmidon/cadmus-refs-asserted-ids 1.0.9 → 2.1.0

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.
Files changed (36) hide show
  1. package/README.md +96 -96
  2. package/esm2022/lib/asserted-composite-id/asserted-composite-id.component.mjs +142 -0
  3. package/esm2022/lib/asserted-composite-ids/asserted-composite-ids.component.mjs +154 -0
  4. package/esm2022/lib/asserted-id/asserted-id.component.mjs +133 -0
  5. package/esm2022/lib/asserted-ids/asserted-ids.component.mjs +147 -0
  6. package/esm2022/lib/cadmus-refs-asserted-ids.module.mjs +122 -0
  7. package/esm2022/lib/pin-target-lookup/pin-target-lookup.component.mjs +405 -0
  8. package/esm2022/lib/scoped-pin-lookup/scoped-pin-lookup.component.mjs +130 -0
  9. package/esm2022/lib/services/item-ref-lookup.service.mjs +29 -0
  10. package/esm2022/lib/services/pin-ref-lookup.service.mjs +85 -0
  11. package/{esm2020 → esm2022}/myrmidon-cadmus-refs-asserted-ids.mjs +4 -4
  12. package/esm2022/public-api.mjs +13 -0
  13. package/fesm2022/myrmidon-cadmus-refs-asserted-ids.mjs +1265 -0
  14. package/fesm2022/myrmidon-cadmus-refs-asserted-ids.mjs.map +1 -0
  15. package/index.d.ts +5 -5
  16. package/lib/asserted-composite-id/asserted-composite-id.component.d.ts +83 -0
  17. package/lib/asserted-composite-ids/asserted-composite-ids.component.d.ts +67 -0
  18. package/lib/asserted-id/asserted-id.component.d.ts +49 -49
  19. package/lib/asserted-ids/asserted-ids.component.d.ts +44 -44
  20. package/lib/cadmus-refs-asserted-ids.module.d.ts +28 -22
  21. package/lib/pin-target-lookup/pin-target-lookup.component.d.ts +139 -0
  22. package/lib/scoped-pin-lookup/scoped-pin-lookup.component.d.ts +39 -39
  23. package/lib/services/item-ref-lookup.service.d.ts +13 -0
  24. package/lib/services/pin-ref-lookup.service.d.ts +27 -18
  25. package/package.json +8 -14
  26. package/public-api.d.ts +9 -5
  27. package/esm2020/lib/asserted-id/asserted-id.component.mjs +0 -132
  28. package/esm2020/lib/asserted-ids/asserted-ids.component.mjs +0 -146
  29. package/esm2020/lib/cadmus-refs-asserted-ids.module.mjs +0 -91
  30. package/esm2020/lib/scoped-pin-lookup/scoped-pin-lookup.component.mjs +0 -129
  31. package/esm2020/lib/services/pin-ref-lookup.service.mjs +0 -72
  32. package/esm2020/public-api.mjs +0 -9
  33. package/fesm2015/myrmidon-cadmus-refs-asserted-ids.mjs +0 -554
  34. package/fesm2015/myrmidon-cadmus-refs-asserted-ids.mjs.map +0 -1
  35. package/fesm2020/myrmidon-cadmus-refs-asserted-ids.mjs +0 -547
  36. package/fesm2020/myrmidon-cadmus-refs-asserted-ids.mjs.map +0 -1
@@ -0,0 +1,1265 @@
1
+ import * as i0 from '@angular/core';
2
+ import { Injectable, EventEmitter, Component, Inject, Output, Input, NgModule } from '@angular/core';
3
+ import * as i1$1 from '@angular/forms';
4
+ import { Validators, FormsModule, ReactiveFormsModule } from '@angular/forms';
5
+ import { debounceTime } from 'rxjs/operators';
6
+ import { of, map, forkJoin, take, distinctUntilChanged, debounceTime as debounceTime$1 } from 'rxjs';
7
+ import * as i1 from '@myrmidon/cadmus-api';
8
+ import { CadmusApiModule } from '@myrmidon/cadmus-api';
9
+ import * as i3 from '@angular/common';
10
+ import { CommonModule } from '@angular/common';
11
+ import * as i4 from '@angular/material/button';
12
+ import { MatButtonModule } from '@angular/material/button';
13
+ import * as i5 from '@angular/material/expansion';
14
+ import { MatExpansionModule } from '@angular/material/expansion';
15
+ import * as i6 from '@angular/material/form-field';
16
+ import { MatFormFieldModule } from '@angular/material/form-field';
17
+ import * as i7 from '@angular/material/icon';
18
+ import { MatIconModule } from '@angular/material/icon';
19
+ import * as i8 from '@angular/material/input';
20
+ import { MatInputModule } from '@angular/material/input';
21
+ import * as i9 from '@angular/material/select';
22
+ import { MatSelectModule } from '@angular/material/select';
23
+ import * as i10 from '@angular/material/core';
24
+ import * as i11 from '@myrmidon/cadmus-refs-assertion';
25
+ import { CadmusRefsAssertionModule } from '@myrmidon/cadmus-refs-assertion';
26
+ import * as i12 from '@myrmidon/cadmus-refs-lookup';
27
+ import { CadmusRefsLookupModule } from '@myrmidon/cadmus-refs-lookup';
28
+ import * as i2 from '@myrmidon/ng-mat-tools';
29
+ import * as i4$1 from '@angular/material/snack-bar';
30
+ import * as i7$1 from '@angular/cdk/clipboard';
31
+ import { ClipboardModule } from '@angular/cdk/clipboard';
32
+ import * as i9$1 from '@angular/material/checkbox';
33
+ import { MatCheckboxModule } from '@angular/material/checkbox';
34
+ import * as i17 from '@myrmidon/ng-tools';
35
+ import { NgToolsModule } from '@myrmidon/ng-tools';
36
+ import { CadmusCoreModule } from '@myrmidon/cadmus-core';
37
+ import { CadmusRefsDocReferencesModule } from '@myrmidon/cadmus-refs-doc-references';
38
+
39
+ /**
40
+ * Cadmus pin-based lookup data service. The text being searched here is just
41
+ * the pin's value, according to the options specified. These options correspond
42
+ * to an index lookup definition. The resulting items are of type DataPinInfo.
43
+ */
44
+ class PinRefLookupService {
45
+ constructor(_itemService) {
46
+ this._itemService = _itemService;
47
+ }
48
+ getName(item) {
49
+ return item?.value || '';
50
+ }
51
+ buildQuery(def, filter) {
52
+ const sb = [];
53
+ const AND = ' AND ';
54
+ if (def.typeId) {
55
+ sb.push(`[partTypeId=${def.typeId}]`);
56
+ }
57
+ if (def.roleId) {
58
+ if (sb.length) {
59
+ sb.push(AND);
60
+ }
61
+ sb.push(`[roleId=${def.roleId}]`);
62
+ }
63
+ if (def.name) {
64
+ if (sb.length) {
65
+ sb.push(AND);
66
+ }
67
+ sb.push(`[name=${def.name}]`);
68
+ }
69
+ if (filter.itemId) {
70
+ if (sb.length) {
71
+ sb.push(AND);
72
+ }
73
+ sb.push(`[itemId=${filter.itemId}]`);
74
+ }
75
+ if (filter.partId) {
76
+ if (sb.length) {
77
+ sb.push(AND);
78
+ }
79
+ sb.push(`[partId=${filter.partId}]`);
80
+ }
81
+ if (filter.text) {
82
+ if (sb.length) {
83
+ sb.push(AND);
84
+ }
85
+ // for other operators see backend SqlQueryBuilderBase.cs
86
+ sb.push(`[value*=${filter.text}]`); // *= is "contains"
87
+ }
88
+ return sb.join('');
89
+ }
90
+ lookup(filter, options) {
91
+ // the index lookup definition is required
92
+ const def = options;
93
+ if (!def) {
94
+ return of([]);
95
+ }
96
+ // build the corresponding pin query
97
+ const query = this.buildQuery(def, filter);
98
+ // search the index
99
+ return this._itemService.searchPins(query, 1, filter.limit).pipe(map((w) => {
100
+ if (w.error) {
101
+ console.error(w.error);
102
+ return [];
103
+ }
104
+ else {
105
+ return w.value?.items || [];
106
+ }
107
+ }));
108
+ }
109
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.1", ngImport: i0, type: PinRefLookupService, deps: [{ token: i1.ItemService }], target: i0.ɵɵFactoryTarget.Injectable }); }
110
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.0.1", ngImport: i0, type: PinRefLookupService, providedIn: 'root' }); }
111
+ }
112
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.1", ngImport: i0, type: PinRefLookupService, decorators: [{
113
+ type: Injectable,
114
+ args: [{
115
+ providedIn: 'root',
116
+ }]
117
+ }], ctorParameters: function () { return [{ type: i1.ItemService }]; } });
118
+
119
+ // from Cadmus general parts
120
+ const METADATA_PART_ID$1 = 'it.vedph.metadata';
121
+ /*
122
+ * Scoped pin-based lookup component. This component provides a list
123
+ * of pin-based searches, with a lookup control. Whenever the user
124
+ * picks a pin value, he gets the details about its item and part, and
125
+ * item's metadata part, if any. He can then use these data to build
126
+ * some EID by variously assembling these components.
127
+ */
128
+ class ScopedPinLookupComponent {
129
+ constructor(formBuilder, _itemService, lookupService, lookupDefs) {
130
+ this._itemService = _itemService;
131
+ this.lookupService = lookupService;
132
+ this.lookupDefs = lookupDefs;
133
+ // lookup
134
+ // keys are all the defined lookup searches
135
+ this.keys = Object.keys(lookupDefs);
136
+ // the selected key defines the lookup scope
137
+ this.key = formBuilder.control(null);
138
+ this.keyForm = formBuilder.group({
139
+ key: this.key,
140
+ });
141
+ // id
142
+ this.id = formBuilder.control(null, [
143
+ Validators.required,
144
+ Validators.maxLength(300),
145
+ ]);
146
+ this.idForm = formBuilder.group({
147
+ id: this.id,
148
+ });
149
+ // event
150
+ this.idPick = new EventEmitter();
151
+ }
152
+ ngOnInit() {
153
+ // pre-select a unique key
154
+ if (this.keys.length === 1) {
155
+ this.key.setValue(this.keys[0]);
156
+ this.key.markAsDirty();
157
+ this.key.updateValueAndValidity();
158
+ }
159
+ }
160
+ onItemChange(item) {
161
+ const info = {
162
+ pin: item,
163
+ };
164
+ // lookup item and its metadata part if any
165
+ forkJoin({
166
+ item: this._itemService.getItem(item.itemId, false),
167
+ part: this._itemService.getPartFromTypeAndRole(item.itemId, METADATA_PART_ID$1),
168
+ })
169
+ .pipe(take(1))
170
+ .subscribe({
171
+ next: (result) => {
172
+ info.item = result.item;
173
+ info.part = result.part;
174
+ this.info = info;
175
+ },
176
+ error: (error) => {
177
+ console.error(error ? JSON.stringify(error) : 'Error loading item/metadata');
178
+ },
179
+ });
180
+ }
181
+ appendIdComponent(type, metaIndex = -1) {
182
+ let id = this.id.value || '';
183
+ switch (type) {
184
+ case 'pin':
185
+ id += this.info?.pin.value;
186
+ break;
187
+ case 'itemId':
188
+ id += this.info.item?.id || '';
189
+ break;
190
+ case 'partId':
191
+ id += this.info.part?.id || '';
192
+ break;
193
+ case 'partTypeId':
194
+ id += this.info.part?.typeId || '';
195
+ break;
196
+ case 'partRoleId':
197
+ id += this.info.part?.roleId || '';
198
+ break;
199
+ case 'metadata':
200
+ id += this.info.part.metadata[metaIndex].value;
201
+ break;
202
+ }
203
+ this.id.setValue(id);
204
+ this.id.markAsDirty();
205
+ this.id.updateValueAndValidity();
206
+ }
207
+ pickId() {
208
+ if (this.idForm.invalid) {
209
+ return;
210
+ }
211
+ this.idPick.emit(this.id.value);
212
+ this.info = undefined;
213
+ }
214
+ resetId() {
215
+ this.id.reset();
216
+ this.id.markAsDirty();
217
+ this.id.updateValueAndValidity();
218
+ }
219
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.1", ngImport: i0, type: ScopedPinLookupComponent, deps: [{ token: i1$1.FormBuilder }, { token: i1.ItemService }, { token: PinRefLookupService }, { token: 'indexLookupDefinitions' }], target: i0.ɵɵFactoryTarget.Component }); }
220
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.0.1", type: ScopedPinLookupComponent, selector: "cadmus-scoped-pin-lookup", outputs: { idPick: "idPick" }, ngImport: i0, template: "<div>\r\n <!-- lookup -->\r\n <div>\r\n <form [formGroup]=\"keyForm\" class=\"form-row\">\r\n <!-- key -->\r\n <mat-form-field *ngIf=\"keys.length > 1\">\r\n <mat-label>type</mat-label>\r\n <mat-select [formControl]=\"key\">\r\n <mat-option *ngFor=\"let k of keys\" [value]=\"k\">{{ k }}</mat-option>\r\n </mat-select>\r\n <mat-error\r\n *ngIf=\"$any(key).errors?.required && (key.dirty || key.touched)\"\r\n >type required</mat-error\r\n >\r\n </mat-form-field>\r\n <cadmus-ref-lookup\r\n [service]=\"lookupService\"\r\n label=\"pin\"\r\n [options]=\"key.value ? lookupDefs[key.value] : undefined\"\r\n (itemChange)=\"onItemChange($event)\"\r\n ></cadmus-ref-lookup>\r\n </form>\r\n </div>\r\n\r\n <!-- builder -->\r\n <mat-expansion-panel *ngIf=\"info\" [expanded]=\"info\" [disabled]=\"!info\">\r\n <mat-expansion-panel-header>ID builder</mat-expansion-panel-header>\r\n <!-- ID -->\r\n <div>\r\n <form [formGroup]=\"idForm\" (submit)=\"pickId()\">\r\n <mat-form-field style=\"width: 100%\">\r\n <input matInput [formControl]=\"id\" />\r\n <mat-error\r\n *ngIf=\"$any(id).errors?.required && (id.dirty || id.touched)\"\r\n >ID required</mat-error\r\n >\r\n <mat-error\r\n *ngIf=\"$any(id).errors?.maxLength && (id.dirty || id.touched)\"\r\n >ID too long</mat-error\r\n >\r\n <button\r\n mat-icon-button\r\n type=\"button\"\r\n matSuffix\r\n (click)=\"resetId()\"\r\n [disabled]=\"!id.value\"\r\n >\r\n <mat-icon color=\"warn\">close</mat-icon>\r\n </button>\r\n <button\r\n mat-icon-button\r\n type=\"button\"\r\n matSuffix\r\n (click)=\"pickId()\"\r\n [disabled]=\"idForm.invalid\"\r\n >\r\n <mat-icon color=\"primary\">check_circle</mat-icon>\r\n </button>\r\n </mat-form-field>\r\n </form>\r\n </div>\r\n <!-- table -->\r\n <table>\r\n <thead>\r\n <th></th>\r\n <th>source</th>\r\n <th>value</th>\r\n </thead>\r\n <tbody>\r\n <!-- pin -->\r\n <tr>\r\n <td>\r\n <button\r\n type=\"button\"\r\n mat-icon-button\r\n color=\"primary\"\r\n (click)=\"appendIdComponent('pin')\"\r\n >\r\n <mat-icon>add_circle</mat-icon>\r\n </button>\r\n </td>\r\n <td>pin</td>\r\n <td>{{ info!.pin.value }}</td>\r\n </tr>\r\n <!-- item ID -->\r\n <tr>\r\n <td>\r\n <button\r\n type=\"button\"\r\n mat-icon-button\r\n color=\"primary\"\r\n (click)=\"appendIdComponent('itemId')\"\r\n >\r\n <mat-icon>add_circle</mat-icon>\r\n </button>\r\n </td>\r\n <td>item ID</td>\r\n <td>{{ info!.item?.id }}</td>\r\n </tr>\r\n <!-- item title -->\r\n <tr>\r\n <td></td>\r\n <td>item title</td>\r\n <td>{{ info!.item?.title }}</td>\r\n </tr>\r\n <!-- part ID -->\r\n <tr>\r\n <td>\r\n <button\r\n type=\"button\"\r\n mat-icon-button\r\n color=\"primary\"\r\n (click)=\"appendIdComponent('partId')\"\r\n >\r\n <mat-icon>add_circle</mat-icon>\r\n </button>\r\n </td>\r\n <td>part ID</td>\r\n <td>{{ info!.part?.id }}</td>\r\n </tr>\r\n <!-- part type ID -->\r\n <tr>\r\n <td>\r\n <button\r\n type=\"button\"\r\n mat-icon-button\r\n color=\"primary\"\r\n (click)=\"appendIdComponent('partTypeId')\"\r\n >\r\n <mat-icon>add_circle</mat-icon>\r\n </button>\r\n </td>\r\n <td>part type ID</td>\r\n <td>{{ info!.part?.typeId }}</td>\r\n </tr>\r\n <!-- part role ID -->\r\n <tr>\r\n <td>\r\n <button\r\n type=\"button\"\r\n mat-icon-button\r\n color=\"primary\"\r\n (click)=\"appendIdComponent('partRoleId')\"\r\n >\r\n <mat-icon>add_circle</mat-icon>\r\n </button>\r\n </td>\r\n <td>part role ID</td>\r\n <td>{{ info!.part?.roleId }}</td>\r\n </tr>\r\n\r\n <!-- part's metadata -->\r\n <tr *ngFor=\"let m of info!.part?.metadata; let i = index\">\r\n <td>\r\n <button\r\n type=\"button\"\r\n mat-icon-button\r\n color=\"primary\"\r\n (click)=\"appendIdComponent('metadata', i)\"\r\n >\r\n <mat-icon>add_circle</mat-icon>\r\n </button>\r\n </td>\r\n <td class=\"metadata\">{{ m.name }}</td>\r\n <td class=\"metadata\">{{ m.value }}</td>\r\n </tr>\r\n </tbody>\r\n </table>\r\n </mat-expansion-panel>\r\n</div>\r\n", styles: [".metadata{color:#4a3001}table{border:1px solid silver;border-radius:6px;padding:4px;margin-top:8px}tr:nth-child(odd){background-color:#f0f0f0}th{font-weight:400;text-align:left;color:silver}\n"], dependencies: [{ kind: "directive", type: i3.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1$1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1$1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1$1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "directive", type: i1$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "component", type: i4.MatIconButton, selector: "button[mat-icon-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "component", type: i5.MatExpansionPanel, selector: "mat-expansion-panel", inputs: ["disabled", "expanded", "hideToggle", "togglePosition"], outputs: ["opened", "closed", "expandedChange", "afterExpand", "afterCollapse"], exportAs: ["matExpansionPanel"] }, { kind: "component", type: i5.MatExpansionPanelHeader, selector: "mat-expansion-panel-header", inputs: ["tabIndex", "expandedHeight", "collapsedHeight"] }, { kind: "component", type: i6.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i6.MatLabel, selector: "mat-label" }, { kind: "directive", type: i6.MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "directive", type: i6.MatSuffix, selector: "[matSuffix], [matIconSuffix], [matTextSuffix]", inputs: ["matTextSuffix"] }, { kind: "component", type: i7.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "directive", type: i8.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: i9.MatSelect, selector: "mat-select", inputs: ["disabled", "disableRipple", "tabIndex", "hideSingleSelectionIndicator"], exportAs: ["matSelect"] }, { kind: "component", type: i10.MatOption, selector: "mat-option", exportAs: ["matOption"] }, { kind: "component", type: i12.RefLookupComponent, selector: "cadmus-ref-lookup", inputs: ["label", "limit", "baseFilter", "service", "item", "required", "hasMore", "linkTemplate", "optDialog", "options"], outputs: ["itemChange", "moreRequest"] }] }); }
221
+ }
222
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.1", ngImport: i0, type: ScopedPinLookupComponent, decorators: [{
223
+ type: Component,
224
+ args: [{ selector: 'cadmus-scoped-pin-lookup', template: "<div>\r\n <!-- lookup -->\r\n <div>\r\n <form [formGroup]=\"keyForm\" class=\"form-row\">\r\n <!-- key -->\r\n <mat-form-field *ngIf=\"keys.length > 1\">\r\n <mat-label>type</mat-label>\r\n <mat-select [formControl]=\"key\">\r\n <mat-option *ngFor=\"let k of keys\" [value]=\"k\">{{ k }}</mat-option>\r\n </mat-select>\r\n <mat-error\r\n *ngIf=\"$any(key).errors?.required && (key.dirty || key.touched)\"\r\n >type required</mat-error\r\n >\r\n </mat-form-field>\r\n <cadmus-ref-lookup\r\n [service]=\"lookupService\"\r\n label=\"pin\"\r\n [options]=\"key.value ? lookupDefs[key.value] : undefined\"\r\n (itemChange)=\"onItemChange($event)\"\r\n ></cadmus-ref-lookup>\r\n </form>\r\n </div>\r\n\r\n <!-- builder -->\r\n <mat-expansion-panel *ngIf=\"info\" [expanded]=\"info\" [disabled]=\"!info\">\r\n <mat-expansion-panel-header>ID builder</mat-expansion-panel-header>\r\n <!-- ID -->\r\n <div>\r\n <form [formGroup]=\"idForm\" (submit)=\"pickId()\">\r\n <mat-form-field style=\"width: 100%\">\r\n <input matInput [formControl]=\"id\" />\r\n <mat-error\r\n *ngIf=\"$any(id).errors?.required && (id.dirty || id.touched)\"\r\n >ID required</mat-error\r\n >\r\n <mat-error\r\n *ngIf=\"$any(id).errors?.maxLength && (id.dirty || id.touched)\"\r\n >ID too long</mat-error\r\n >\r\n <button\r\n mat-icon-button\r\n type=\"button\"\r\n matSuffix\r\n (click)=\"resetId()\"\r\n [disabled]=\"!id.value\"\r\n >\r\n <mat-icon color=\"warn\">close</mat-icon>\r\n </button>\r\n <button\r\n mat-icon-button\r\n type=\"button\"\r\n matSuffix\r\n (click)=\"pickId()\"\r\n [disabled]=\"idForm.invalid\"\r\n >\r\n <mat-icon color=\"primary\">check_circle</mat-icon>\r\n </button>\r\n </mat-form-field>\r\n </form>\r\n </div>\r\n <!-- table -->\r\n <table>\r\n <thead>\r\n <th></th>\r\n <th>source</th>\r\n <th>value</th>\r\n </thead>\r\n <tbody>\r\n <!-- pin -->\r\n <tr>\r\n <td>\r\n <button\r\n type=\"button\"\r\n mat-icon-button\r\n color=\"primary\"\r\n (click)=\"appendIdComponent('pin')\"\r\n >\r\n <mat-icon>add_circle</mat-icon>\r\n </button>\r\n </td>\r\n <td>pin</td>\r\n <td>{{ info!.pin.value }}</td>\r\n </tr>\r\n <!-- item ID -->\r\n <tr>\r\n <td>\r\n <button\r\n type=\"button\"\r\n mat-icon-button\r\n color=\"primary\"\r\n (click)=\"appendIdComponent('itemId')\"\r\n >\r\n <mat-icon>add_circle</mat-icon>\r\n </button>\r\n </td>\r\n <td>item ID</td>\r\n <td>{{ info!.item?.id }}</td>\r\n </tr>\r\n <!-- item title -->\r\n <tr>\r\n <td></td>\r\n <td>item title</td>\r\n <td>{{ info!.item?.title }}</td>\r\n </tr>\r\n <!-- part ID -->\r\n <tr>\r\n <td>\r\n <button\r\n type=\"button\"\r\n mat-icon-button\r\n color=\"primary\"\r\n (click)=\"appendIdComponent('partId')\"\r\n >\r\n <mat-icon>add_circle</mat-icon>\r\n </button>\r\n </td>\r\n <td>part ID</td>\r\n <td>{{ info!.part?.id }}</td>\r\n </tr>\r\n <!-- part type ID -->\r\n <tr>\r\n <td>\r\n <button\r\n type=\"button\"\r\n mat-icon-button\r\n color=\"primary\"\r\n (click)=\"appendIdComponent('partTypeId')\"\r\n >\r\n <mat-icon>add_circle</mat-icon>\r\n </button>\r\n </td>\r\n <td>part type ID</td>\r\n <td>{{ info!.part?.typeId }}</td>\r\n </tr>\r\n <!-- part role ID -->\r\n <tr>\r\n <td>\r\n <button\r\n type=\"button\"\r\n mat-icon-button\r\n color=\"primary\"\r\n (click)=\"appendIdComponent('partRoleId')\"\r\n >\r\n <mat-icon>add_circle</mat-icon>\r\n </button>\r\n </td>\r\n <td>part role ID</td>\r\n <td>{{ info!.part?.roleId }}</td>\r\n </tr>\r\n\r\n <!-- part's metadata -->\r\n <tr *ngFor=\"let m of info!.part?.metadata; let i = index\">\r\n <td>\r\n <button\r\n type=\"button\"\r\n mat-icon-button\r\n color=\"primary\"\r\n (click)=\"appendIdComponent('metadata', i)\"\r\n >\r\n <mat-icon>add_circle</mat-icon>\r\n </button>\r\n </td>\r\n <td class=\"metadata\">{{ m.name }}</td>\r\n <td class=\"metadata\">{{ m.value }}</td>\r\n </tr>\r\n </tbody>\r\n </table>\r\n </mat-expansion-panel>\r\n</div>\r\n", styles: [".metadata{color:#4a3001}table{border:1px solid silver;border-radius:6px;padding:4px;margin-top:8px}tr:nth-child(odd){background-color:#f0f0f0}th{font-weight:400;text-align:left;color:silver}\n"] }]
225
+ }], ctorParameters: function () { return [{ type: i1$1.FormBuilder }, { type: i1.ItemService }, { type: PinRefLookupService }, { type: undefined, decorators: [{
226
+ type: Inject,
227
+ args: ['indexLookupDefinitions']
228
+ }] }]; }, propDecorators: { idPick: [{
229
+ type: Output
230
+ }] } });
231
+
232
+ class AssertedIdComponent {
233
+ get id() {
234
+ return this._id;
235
+ }
236
+ set id(value) {
237
+ if (this._id !== value) {
238
+ this._id = value || undefined;
239
+ this.updateForm(this._id);
240
+ }
241
+ }
242
+ constructor(formBuilder, lookupService, lookupDefs) {
243
+ this.lookupService = lookupService;
244
+ this.lookupDefs = lookupDefs;
245
+ this.tag = formBuilder.control(null, Validators.maxLength(50));
246
+ this.value = formBuilder.control(null, [
247
+ Validators.required,
248
+ Validators.maxLength(500),
249
+ ]);
250
+ this.scope = formBuilder.control(null, Validators.maxLength(500));
251
+ this.assertion = formBuilder.control(null);
252
+ this.form = formBuilder.group({
253
+ tag: this.tag,
254
+ value: this.value,
255
+ scope: this.scope,
256
+ assertion: this.assertion
257
+ });
258
+ this.lookupExpanded = false;
259
+ // events
260
+ this.idChange = new EventEmitter();
261
+ this.editorClose = new EventEmitter();
262
+ }
263
+ ngOnInit() {
264
+ this.form.valueChanges.pipe(debounceTime(300)).subscribe((_) => {
265
+ if (!this._updatingForm) {
266
+ this.emitIdChange();
267
+ }
268
+ });
269
+ }
270
+ onAssertionChange(assertion) {
271
+ this.assertion.setValue(assertion || null);
272
+ }
273
+ onIdPick(id) {
274
+ this.value.setValue(id);
275
+ this.value.markAsDirty();
276
+ this.value.updateValueAndValidity();
277
+ this.lookupExpanded = false;
278
+ }
279
+ updateForm(value) {
280
+ this._updatingForm = true;
281
+ if (!value) {
282
+ this.form.reset();
283
+ }
284
+ else {
285
+ this.tag.setValue(value.tag || null);
286
+ this.value.setValue(value.value);
287
+ this.scope.setValue(value.scope);
288
+ this.assertion.setValue(value.assertion || null);
289
+ this.form.markAsPristine();
290
+ }
291
+ this._updatingForm = false;
292
+ // this.emitIdChange();
293
+ }
294
+ getId() {
295
+ return {
296
+ tag: this.tag.value?.trim(),
297
+ value: this.value.value?.trim() || '',
298
+ scope: this.scope.value?.trim() || '',
299
+ assertion: this.assertion.value || undefined,
300
+ };
301
+ }
302
+ emitIdChange() {
303
+ if (!this.hasSubmit) {
304
+ this._id = this.getId();
305
+ this.idChange.emit(this._id);
306
+ }
307
+ }
308
+ cancel() {
309
+ this.editorClose.emit();
310
+ }
311
+ save() {
312
+ if (this.form.valid) {
313
+ this._id = this.getId();
314
+ this.idChange.emit(this._id);
315
+ }
316
+ }
317
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.1", ngImport: i0, type: AssertedIdComponent, deps: [{ token: i1$1.FormBuilder }, { token: PinRefLookupService }, { token: 'indexLookupDefinitions' }], target: i0.ɵɵFactoryTarget.Component }); }
318
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.0.1", type: AssertedIdComponent, selector: "cadmus-refs-asserted-id", inputs: { idScopeEntries: "idScopeEntries", idTagEntries: "idTagEntries", assTagEntries: "assTagEntries", refTypeEntries: "refTypeEntries", refTagEntries: "refTagEntries", id: "id", noEidLookup: "noEidLookup", hasSubmit: "hasSubmit" }, outputs: { idChange: "idChange", editorClose: "editorClose" }, ngImport: i0, template: "<form [formGroup]=\"form\" (submit)=\"save()\">\r\n <div>\r\n <div class=\"form-row\">\r\n <!-- tag (bound) -->\r\n <mat-form-field *ngIf=\"idTagEntries?.length\" style=\"width: 8em\">\r\n <mat-label>tag</mat-label>\r\n <mat-select [formControl]=\"tag\">\r\n <mat-option *ngFor=\"let e of idTagEntries\" [value]=\"e.id\">{{\r\n e.value\r\n }}</mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n <!-- tag (free) -->\r\n <mat-form-field *ngIf=\"!idTagEntries?.length\" style=\"width: 8em\">\r\n <mat-label>tag</mat-label>\r\n <input matInput [formControl]=\"tag\" />\r\n <mat-error *ngIf=\"tag.errors?.maxLength && (tag.dirty || tag.touched)\"\r\n >tag too long</mat-error\r\n >\r\n </mat-form-field>\r\n\r\n <!-- scope (bound) -->\r\n <mat-form-field *ngIf=\"idScopeEntries?.length\" style=\"width: 8em\">\r\n <mat-label>scope</mat-label>\r\n <mat-select [formControl]=\"scope\">\r\n <mat-option *ngFor=\"let e of idScopeEntries\" [value]=\"e.id\">{{\r\n e.value\r\n }}</mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n <!-- scope (free) -->\r\n <mat-form-field *ngIf=\"!idScopeEntries?.length\" style=\"width: 8em\">\r\n <mat-label>scope</mat-label>\r\n <input matInput [formControl]=\"scope\" />\r\n <mat-error\r\n *ngIf=\"scope.errors?.maxLength && (scope.dirty || scope.touched)\"\r\n >scope too long</mat-error\r\n >\r\n </mat-form-field>\r\n\r\n <!-- value -->\r\n <mat-form-field>\r\n <mat-label>value</mat-label>\r\n <input matInput [formControl]=\"value\" />\r\n <mat-error\r\n *ngIf=\"value.errors?.required && (value.dirty || value.touched)\"\r\n >value required</mat-error\r\n >\r\n <mat-error\r\n *ngIf=\"value.errors?.maxLength && (value.dirty || value.touched)\"\r\n >value too long</mat-error\r\n >\r\n </mat-form-field>\r\n\r\n <!-- lookup -->\r\n <div *ngIf=\"!noEidLookup\" style=\"margin-top: 4px\">\r\n <mat-expansion-panel [(expanded)]=\"lookupExpanded\">\r\n <mat-expansion-panel-header>lookup</mat-expansion-panel-header>\r\n <cadmus-scoped-pin-lookup\r\n (idPick)=\"onIdPick($event)\"\r\n ></cadmus-scoped-pin-lookup>\r\n </mat-expansion-panel>\r\n </div>\r\n </div>\r\n\r\n <!-- assertion -->\r\n <mat-expansion-panel>\r\n <mat-expansion-panel-header>assertion</mat-expansion-panel-header>\r\n <cadmus-refs-assertion\r\n [assTagEntries]=\"assTagEntries\"\r\n [refTypeEntries]=\"refTypeEntries\"\r\n [refTagEntries]=\"refTagEntries\"\r\n [assertion]=\"assertion.value\"\r\n (assertionChange)=\"onAssertionChange($event)\"\r\n >\r\n </cadmus-refs-assertion>\r\n </mat-expansion-panel>\r\n </div>\r\n\r\n <!-- buttons -->\r\n <div *ngIf=\"hasSubmit\">\r\n <button mat-icon-button color=\"warn\" type=\"button\" (click)=\"cancel()\">\r\n <mat-icon>close</mat-icon>\r\n </button>\r\n <button\r\n mat-icon-button\r\n color=\"primary\"\r\n type=\"submit\"\r\n [disabled]=\"form.invalid\"\r\n >\r\n <mat-icon>check_circle</mat-icon>\r\n </button>\r\n </div>\r\n</form>\r\n", styles: [".form-row{display:flex;gap:8px;align-items:flex-start;flex-wrap:wrap}.form-row *{flex:0 0 auto}.pin-info{font-size:90%;color:silver}fieldset{border:1px solid silver;border-radius:6px;padding:6px}@media only screen and (max-width: 959px){div#container{grid-template-rows:1fr auto;grid-template-columns:1fr;grid-template-areas:\"editor\" \"lookup\"}}\n"], dependencies: [{ kind: "directive", type: i3.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1$1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1$1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1$1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "directive", type: i1$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "component", type: i4.MatIconButton, selector: "button[mat-icon-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "component", type: i5.MatExpansionPanel, selector: "mat-expansion-panel", inputs: ["disabled", "expanded", "hideToggle", "togglePosition"], outputs: ["opened", "closed", "expandedChange", "afterExpand", "afterCollapse"], exportAs: ["matExpansionPanel"] }, { kind: "component", type: i5.MatExpansionPanelHeader, selector: "mat-expansion-panel-header", inputs: ["tabIndex", "expandedHeight", "collapsedHeight"] }, { kind: "component", type: i6.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i6.MatLabel, selector: "mat-label" }, { kind: "directive", type: i6.MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "component", type: i7.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "directive", type: i8.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: i9.MatSelect, selector: "mat-select", inputs: ["disabled", "disableRipple", "tabIndex", "hideSingleSelectionIndicator"], exportAs: ["matSelect"] }, { kind: "component", type: i10.MatOption, selector: "mat-option", exportAs: ["matOption"] }, { kind: "component", type: i11.AssertionComponent, selector: "cadmus-refs-assertion", inputs: ["assTagEntries", "refTypeEntries", "refTagEntries", "assertion"], outputs: ["assertionChange"] }, { kind: "component", type: ScopedPinLookupComponent, selector: "cadmus-scoped-pin-lookup", outputs: ["idPick"] }] }); }
319
+ }
320
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.1", ngImport: i0, type: AssertedIdComponent, decorators: [{
321
+ type: Component,
322
+ args: [{ selector: 'cadmus-refs-asserted-id', template: "<form [formGroup]=\"form\" (submit)=\"save()\">\r\n <div>\r\n <div class=\"form-row\">\r\n <!-- tag (bound) -->\r\n <mat-form-field *ngIf=\"idTagEntries?.length\" style=\"width: 8em\">\r\n <mat-label>tag</mat-label>\r\n <mat-select [formControl]=\"tag\">\r\n <mat-option *ngFor=\"let e of idTagEntries\" [value]=\"e.id\">{{\r\n e.value\r\n }}</mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n <!-- tag (free) -->\r\n <mat-form-field *ngIf=\"!idTagEntries?.length\" style=\"width: 8em\">\r\n <mat-label>tag</mat-label>\r\n <input matInput [formControl]=\"tag\" />\r\n <mat-error *ngIf=\"tag.errors?.maxLength && (tag.dirty || tag.touched)\"\r\n >tag too long</mat-error\r\n >\r\n </mat-form-field>\r\n\r\n <!-- scope (bound) -->\r\n <mat-form-field *ngIf=\"idScopeEntries?.length\" style=\"width: 8em\">\r\n <mat-label>scope</mat-label>\r\n <mat-select [formControl]=\"scope\">\r\n <mat-option *ngFor=\"let e of idScopeEntries\" [value]=\"e.id\">{{\r\n e.value\r\n }}</mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n <!-- scope (free) -->\r\n <mat-form-field *ngIf=\"!idScopeEntries?.length\" style=\"width: 8em\">\r\n <mat-label>scope</mat-label>\r\n <input matInput [formControl]=\"scope\" />\r\n <mat-error\r\n *ngIf=\"scope.errors?.maxLength && (scope.dirty || scope.touched)\"\r\n >scope too long</mat-error\r\n >\r\n </mat-form-field>\r\n\r\n <!-- value -->\r\n <mat-form-field>\r\n <mat-label>value</mat-label>\r\n <input matInput [formControl]=\"value\" />\r\n <mat-error\r\n *ngIf=\"value.errors?.required && (value.dirty || value.touched)\"\r\n >value required</mat-error\r\n >\r\n <mat-error\r\n *ngIf=\"value.errors?.maxLength && (value.dirty || value.touched)\"\r\n >value too long</mat-error\r\n >\r\n </mat-form-field>\r\n\r\n <!-- lookup -->\r\n <div *ngIf=\"!noEidLookup\" style=\"margin-top: 4px\">\r\n <mat-expansion-panel [(expanded)]=\"lookupExpanded\">\r\n <mat-expansion-panel-header>lookup</mat-expansion-panel-header>\r\n <cadmus-scoped-pin-lookup\r\n (idPick)=\"onIdPick($event)\"\r\n ></cadmus-scoped-pin-lookup>\r\n </mat-expansion-panel>\r\n </div>\r\n </div>\r\n\r\n <!-- assertion -->\r\n <mat-expansion-panel>\r\n <mat-expansion-panel-header>assertion</mat-expansion-panel-header>\r\n <cadmus-refs-assertion\r\n [assTagEntries]=\"assTagEntries\"\r\n [refTypeEntries]=\"refTypeEntries\"\r\n [refTagEntries]=\"refTagEntries\"\r\n [assertion]=\"assertion.value\"\r\n (assertionChange)=\"onAssertionChange($event)\"\r\n >\r\n </cadmus-refs-assertion>\r\n </mat-expansion-panel>\r\n </div>\r\n\r\n <!-- buttons -->\r\n <div *ngIf=\"hasSubmit\">\r\n <button mat-icon-button color=\"warn\" type=\"button\" (click)=\"cancel()\">\r\n <mat-icon>close</mat-icon>\r\n </button>\r\n <button\r\n mat-icon-button\r\n color=\"primary\"\r\n type=\"submit\"\r\n [disabled]=\"form.invalid\"\r\n >\r\n <mat-icon>check_circle</mat-icon>\r\n </button>\r\n </div>\r\n</form>\r\n", styles: [".form-row{display:flex;gap:8px;align-items:flex-start;flex-wrap:wrap}.form-row *{flex:0 0 auto}.pin-info{font-size:90%;color:silver}fieldset{border:1px solid silver;border-radius:6px;padding:6px}@media only screen and (max-width: 959px){div#container{grid-template-rows:1fr auto;grid-template-columns:1fr;grid-template-areas:\"editor\" \"lookup\"}}\n"] }]
323
+ }], ctorParameters: function () { return [{ type: i1$1.FormBuilder }, { type: PinRefLookupService }, { type: undefined, decorators: [{
324
+ type: Inject,
325
+ args: ['indexLookupDefinitions']
326
+ }] }]; }, propDecorators: { idScopeEntries: [{
327
+ type: Input
328
+ }], idTagEntries: [{
329
+ type: Input
330
+ }], assTagEntries: [{
331
+ type: Input
332
+ }], refTypeEntries: [{
333
+ type: Input
334
+ }], refTagEntries: [{
335
+ type: Input
336
+ }], id: [{
337
+ type: Input
338
+ }], noEidLookup: [{
339
+ type: Input
340
+ }], hasSubmit: [{
341
+ type: Input
342
+ }], idChange: [{
343
+ type: Output
344
+ }], editorClose: [{
345
+ type: Output
346
+ }] } });
347
+
348
+ /**
349
+ * Asserted IDs editor.
350
+ */
351
+ class AssertedIdsComponent {
352
+ /**
353
+ * The asserted IDs.
354
+ */
355
+ get ids() {
356
+ return this._ids;
357
+ }
358
+ set ids(value) {
359
+ if (this._ids !== value) {
360
+ this._ids = value || [];
361
+ this.updateForm(value);
362
+ }
363
+ }
364
+ constructor(formBuilder, _dialogService) {
365
+ this._dialogService = _dialogService;
366
+ this._ids = [];
367
+ this._editedIndex = -1;
368
+ this.idsChange = new EventEmitter();
369
+ this.entries = formBuilder.control([], { nonNullable: true });
370
+ // form
371
+ this.form = formBuilder.group({
372
+ ids: this.entries,
373
+ });
374
+ }
375
+ updateForm(ids) {
376
+ if (!ids?.length) {
377
+ this.form.reset();
378
+ return;
379
+ }
380
+ this.entries.setValue(ids, { emitEvent: false });
381
+ this.entries.updateValueAndValidity();
382
+ this.form.markAsPristine();
383
+ }
384
+ emitIdsChange() {
385
+ this.idsChange.emit(this.entries.value);
386
+ }
387
+ addId() {
388
+ this.editId({
389
+ scope: '',
390
+ value: '',
391
+ }, -1);
392
+ }
393
+ editId(id, index) {
394
+ this._editedIndex = index;
395
+ this.edited = id;
396
+ }
397
+ closeId() {
398
+ this._editedIndex = -1;
399
+ this.edited = undefined;
400
+ }
401
+ saveId(entry) {
402
+ const entries = [...this.entries.value];
403
+ if (this._editedIndex === -1) {
404
+ entries.push(entry);
405
+ }
406
+ else {
407
+ entries.splice(this._editedIndex, 1, entry);
408
+ }
409
+ this.entries.setValue(entries);
410
+ this.entries.markAsDirty();
411
+ this.entries.updateValueAndValidity();
412
+ this.closeId();
413
+ }
414
+ deleteId(index) {
415
+ this._dialogService
416
+ .confirm('Confirmation', 'Delete ID?')
417
+ .pipe(take(1))
418
+ .subscribe((yes) => {
419
+ if (yes) {
420
+ if (this._editedIndex === index) {
421
+ this.closeId();
422
+ }
423
+ const entries = [...this.entries.value];
424
+ entries.splice(index, 1);
425
+ this.entries.setValue(entries);
426
+ this.entries.markAsDirty();
427
+ this.entries.updateValueAndValidity();
428
+ this.emitIdsChange();
429
+ }
430
+ });
431
+ }
432
+ moveIdUp(index) {
433
+ if (index < 1) {
434
+ return;
435
+ }
436
+ const entry = this.entries.value[index];
437
+ const entries = [...this.entries.value];
438
+ entries.splice(index, 1);
439
+ entries.splice(index - 1, 0, entry);
440
+ this.entries.setValue(entries);
441
+ this.entries.markAsDirty();
442
+ this.entries.updateValueAndValidity();
443
+ this.emitIdsChange();
444
+ }
445
+ moveIdDown(index) {
446
+ if (index + 1 >= this.entries.value.length) {
447
+ return;
448
+ }
449
+ const entry = this.entries.value[index];
450
+ const entries = [...this.entries.value];
451
+ entries.splice(index, 1);
452
+ entries.splice(index + 1, 0, entry);
453
+ this.entries.setValue(entries);
454
+ this.entries.markAsDirty();
455
+ this.entries.updateValueAndValidity();
456
+ this.emitIdsChange();
457
+ }
458
+ onIdChange(id) {
459
+ this.saveId(id);
460
+ this.emitIdsChange();
461
+ }
462
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.1", ngImport: i0, type: AssertedIdsComponent, deps: [{ token: i1$1.FormBuilder }, { token: i2.DialogService }], target: i0.ɵɵFactoryTarget.Component }); }
463
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.0.1", type: AssertedIdsComponent, selector: "cadmus-refs-asserted-ids", inputs: { ids: "ids", idScopeEntries: "idScopeEntries", idTagEntries: "idTagEntries", assTagEntries: "assTagEntries", refTypeEntries: "refTypeEntries", refTagEntries: "refTagEntries" }, outputs: { idsChange: "idsChange" }, ngImport: i0, template: "<form [formGroup]=\"form\">\r\n <div>\r\n <button type=\"button\" mat-flat-button color=\"primary\" (click)=\"addId()\">\r\n <mat-icon>add_circle</mat-icon> ID\r\n </button>\r\n </div>\r\n <table *ngIf=\"entries.value?.length\">\r\n <thead>\r\n <tr>\r\n <th></th>\r\n <th>scope</th>\r\n <th>value</th>\r\n </tr>\r\n </thead>\r\n <tbody>\r\n <tr\r\n *ngFor=\"\r\n let entry of entries.value;\r\n let i = index;\r\n let first = first;\r\n let last = last\r\n \"\r\n >\r\n <td>\r\n <button\r\n type=\"button\"\r\n mat-icon-button\r\n color=\"primary\"\r\n matTooltip=\"Edit this ID\"\r\n (click)=\"editId(entry, i)\"\r\n >\r\n <mat-icon>edit</mat-icon>\r\n </button>\r\n <button\r\n type=\"button\"\r\n mat-icon-button\r\n matTooltip=\"Move this ID up\"\r\n [disabled]=\"first\"\r\n (click)=\"moveIdUp(i)\"\r\n >\r\n <mat-icon>arrow_upward</mat-icon>\r\n </button>\r\n <button\r\n type=\"button\"\r\n mat-icon-button\r\n matTooltip=\"Move this ID down\"\r\n [disabled]=\"last\"\r\n (click)=\"moveIdDown(i)\"\r\n >\r\n <mat-icon>arrow_downward</mat-icon>\r\n </button>\r\n <button\r\n type=\"button\"\r\n mat-icon-button\r\n color=\"warn\"\r\n matTooltip=\"Delete this ID\"\r\n (click)=\"deleteId(i)\"\r\n >\r\n <mat-icon>remove_circle</mat-icon>\r\n </button>\r\n </td>\r\n <td>{{ entry.scope }}</td>\r\n <td>{{ entry.value }}</td>\r\n </tr>\r\n </tbody>\r\n </table>\r\n\r\n <mat-expansion-panel [expanded]=\"edited\" [disabled]=\"!edited\">\r\n <mat-expansion-panel-header>ID {{edited?.value}}</mat-expansion-panel-header>\r\n <cadmus-refs-asserted-id\r\n [idScopeEntries]=\"idScopeEntries\"\r\n [idTagEntries]=\"idTagEntries\"\r\n [assTagEntries]=\"assTagEntries\"\r\n [refTypeEntries]=\"refTypeEntries\"\r\n [refTagEntries]=\"refTagEntries\"\r\n [hasSubmit]=\"true\"\r\n [id]=\"edited\"\r\n (idChange)=\"onIdChange($event)\"\r\n (editorClose)=\"closeId()\"\r\n ></cadmus-refs-asserted-id>\r\n </mat-expansion-panel>\r\n</form>\r\n", styles: ["th{font-weight:400;color:silver;text-align:left}\n"], dependencies: [{ kind: "directive", type: i3.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1$1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "component", type: i4.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: i4.MatIconButton, selector: "button[mat-icon-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "component", type: i5.MatExpansionPanel, selector: "mat-expansion-panel", inputs: ["disabled", "expanded", "hideToggle", "togglePosition"], outputs: ["opened", "closed", "expandedChange", "afterExpand", "afterCollapse"], exportAs: ["matExpansionPanel"] }, { kind: "component", type: i5.MatExpansionPanelHeader, selector: "mat-expansion-panel-header", inputs: ["tabIndex", "expandedHeight", "collapsedHeight"] }, { kind: "component", type: i7.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: AssertedIdComponent, selector: "cadmus-refs-asserted-id", inputs: ["idScopeEntries", "idTagEntries", "assTagEntries", "refTypeEntries", "refTagEntries", "id", "noEidLookup", "hasSubmit"], outputs: ["idChange", "editorClose"] }] }); }
464
+ }
465
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.1", ngImport: i0, type: AssertedIdsComponent, decorators: [{
466
+ type: Component,
467
+ args: [{ selector: 'cadmus-refs-asserted-ids', template: "<form [formGroup]=\"form\">\r\n <div>\r\n <button type=\"button\" mat-flat-button color=\"primary\" (click)=\"addId()\">\r\n <mat-icon>add_circle</mat-icon> ID\r\n </button>\r\n </div>\r\n <table *ngIf=\"entries.value?.length\">\r\n <thead>\r\n <tr>\r\n <th></th>\r\n <th>scope</th>\r\n <th>value</th>\r\n </tr>\r\n </thead>\r\n <tbody>\r\n <tr\r\n *ngFor=\"\r\n let entry of entries.value;\r\n let i = index;\r\n let first = first;\r\n let last = last\r\n \"\r\n >\r\n <td>\r\n <button\r\n type=\"button\"\r\n mat-icon-button\r\n color=\"primary\"\r\n matTooltip=\"Edit this ID\"\r\n (click)=\"editId(entry, i)\"\r\n >\r\n <mat-icon>edit</mat-icon>\r\n </button>\r\n <button\r\n type=\"button\"\r\n mat-icon-button\r\n matTooltip=\"Move this ID up\"\r\n [disabled]=\"first\"\r\n (click)=\"moveIdUp(i)\"\r\n >\r\n <mat-icon>arrow_upward</mat-icon>\r\n </button>\r\n <button\r\n type=\"button\"\r\n mat-icon-button\r\n matTooltip=\"Move this ID down\"\r\n [disabled]=\"last\"\r\n (click)=\"moveIdDown(i)\"\r\n >\r\n <mat-icon>arrow_downward</mat-icon>\r\n </button>\r\n <button\r\n type=\"button\"\r\n mat-icon-button\r\n color=\"warn\"\r\n matTooltip=\"Delete this ID\"\r\n (click)=\"deleteId(i)\"\r\n >\r\n <mat-icon>remove_circle</mat-icon>\r\n </button>\r\n </td>\r\n <td>{{ entry.scope }}</td>\r\n <td>{{ entry.value }}</td>\r\n </tr>\r\n </tbody>\r\n </table>\r\n\r\n <mat-expansion-panel [expanded]=\"edited\" [disabled]=\"!edited\">\r\n <mat-expansion-panel-header>ID {{edited?.value}}</mat-expansion-panel-header>\r\n <cadmus-refs-asserted-id\r\n [idScopeEntries]=\"idScopeEntries\"\r\n [idTagEntries]=\"idTagEntries\"\r\n [assTagEntries]=\"assTagEntries\"\r\n [refTypeEntries]=\"refTypeEntries\"\r\n [refTagEntries]=\"refTagEntries\"\r\n [hasSubmit]=\"true\"\r\n [id]=\"edited\"\r\n (idChange)=\"onIdChange($event)\"\r\n (editorClose)=\"closeId()\"\r\n ></cadmus-refs-asserted-id>\r\n </mat-expansion-panel>\r\n</form>\r\n", styles: ["th{font-weight:400;color:silver;text-align:left}\n"] }]
468
+ }], ctorParameters: function () { return [{ type: i1$1.FormBuilder }, { type: i2.DialogService }]; }, propDecorators: { ids: [{
469
+ type: Input
470
+ }], idScopeEntries: [{
471
+ type: Input
472
+ }], idTagEntries: [{
473
+ type: Input
474
+ }], assTagEntries: [{
475
+ type: Input
476
+ }], refTypeEntries: [{
477
+ type: Input
478
+ }], refTagEntries: [{
479
+ type: Input
480
+ }], idsChange: [{
481
+ type: Output
482
+ }] } });
483
+
484
+ class ItemRefLookupService {
485
+ constructor(_itemService) {
486
+ this._itemService = _itemService;
487
+ }
488
+ lookup(filter, options) {
489
+ return this._itemService
490
+ .getItems({
491
+ title: filter.text,
492
+ }, 1, filter.limit || 10)
493
+ .pipe(map((page) => page.items));
494
+ }
495
+ getName(item) {
496
+ return item?.title;
497
+ }
498
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.1", ngImport: i0, type: ItemRefLookupService, deps: [{ token: i1.ItemService }], target: i0.ɵɵFactoryTarget.Injectable }); }
499
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.0.1", ngImport: i0, type: ItemRefLookupService, providedIn: 'root' }); }
500
+ }
501
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.1", ngImport: i0, type: ItemRefLookupService, decorators: [{
502
+ type: Injectable,
503
+ args: [{
504
+ providedIn: 'root',
505
+ }]
506
+ }], ctorParameters: function () { return [{ type: i1.ItemService }]; } });
507
+
508
+ // from Cadmus general parts
509
+ const METADATA_PART_ID = 'it.vedph.metadata';
510
+ /*
511
+ * Scoped pin-based lookup component. This component provides a list
512
+ * of pin-based searches, with a lookup control. Whenever the user
513
+ * picks a pin value, he gets the details about its item and part, and
514
+ * item's metadata part, if any. He can then use these data to build
515
+ * some EID by variously assembling these components.
516
+ */
517
+ class PinTargetLookupComponent {
518
+ /**
519
+ * True when the by-type pin lookup mode is active.
520
+ * User can change mode unless modeSwitching is false.
521
+ */
522
+ get pinByTypeMode() {
523
+ return this.byTypeMode?.value;
524
+ }
525
+ set pinByTypeMode(value) {
526
+ if (!this.byTypeMode) {
527
+ this._startWithByTypeMode = value;
528
+ }
529
+ else {
530
+ this.byTypeMode.setValue(value || false);
531
+ this.byTypeMode.updateValueAndValidity();
532
+ }
533
+ }
534
+ /**
535
+ * The target to be edited.
536
+ */
537
+ get target() {
538
+ return this._target;
539
+ }
540
+ set target(value) {
541
+ if (this._target === value) {
542
+ return;
543
+ }
544
+ this._target = value || undefined;
545
+ this.updateForm(this._target);
546
+ }
547
+ constructor(_presetLookupDefs, itemLookupService, pinLookupService, _itemService, _thesService, _snackbar, formBuilder) {
548
+ this._presetLookupDefs = _presetLookupDefs;
549
+ this.itemLookupService = itemLookupService;
550
+ this.pinLookupService = pinLookupService;
551
+ this._itemService = _itemService;
552
+ this._thesService = _thesService;
553
+ this._snackbar = _snackbar;
554
+ this.partTypeKeys = [];
555
+ this.itemParts = [];
556
+ this._subs = [];
557
+ this.modelEntries = [];
558
+ // this is the default filter for the pin lookup, which will
559
+ // be merged with values provided by user here
560
+ this.filter = {
561
+ text: '',
562
+ limit: 10,
563
+ };
564
+ // form
565
+ this.item = formBuilder.control(null);
566
+ this.itemPart = formBuilder.control(null);
567
+ this.partTypeKey = formBuilder.control(null);
568
+ this.gid = formBuilder.control(null, [
569
+ Validators.required,
570
+ Validators.maxLength(300),
571
+ ]);
572
+ this.label = formBuilder.control(null, [
573
+ Validators.required,
574
+ Validators.maxLength(300),
575
+ ]);
576
+ this.byTypeMode = formBuilder.control(false, { nonNullable: true });
577
+ this.external = formBuilder.control(false, { nonNullable: true });
578
+ this.form = formBuilder.group({
579
+ item: this.item,
580
+ itemPart: this.itemPart,
581
+ partTypeKey: this.partTypeKey,
582
+ gid: this.gid,
583
+ label: this.label,
584
+ byTypeMode: this.byTypeMode,
585
+ external: this.external,
586
+ });
587
+ // events
588
+ this.targetChange = new EventEmitter();
589
+ this.editorClose = new EventEmitter();
590
+ }
591
+ forceByItem() {
592
+ this.pinByTypeMode = false;
593
+ this.canSwitchMode = false;
594
+ }
595
+ setupKeys() {
596
+ // use DI presets if no lookup definitions
597
+ if (!this.lookupDefinitions) {
598
+ this.lookupDefinitions = this._presetLookupDefs;
599
+ }
600
+ // keys are all the defined lookup searches
601
+ this.partTypeKeys = Object.keys(this.lookupDefinitions);
602
+ // if no keys, get them from thesaurus model-types;
603
+ // if this is not available, just force by item mode.
604
+ if (!this.partTypeKeys.length) {
605
+ if (this.modelEntries?.length) {
606
+ // set lookupDefinitions from thesaurus entries
607
+ this.lookupDefinitions = {};
608
+ this.modelEntries.forEach((e) => {
609
+ this.lookupDefinitions[e.value] = {
610
+ name: e.value,
611
+ typeId: e.id,
612
+ };
613
+ });
614
+ // set type keys from thesaurus entries
615
+ this.partTypeKeys = this.modelEntries.map((e) => e.value);
616
+ }
617
+ }
618
+ // if still no keys, force by item mode
619
+ if (!this.partTypeKeys.length) {
620
+ this.forceByItem();
621
+ }
622
+ else {
623
+ // if there is only one key, set it as the default
624
+ if (this.partTypeKeys.length === 1) {
625
+ this.partTypeKey.setValue(this.partTypeKeys[0]);
626
+ }
627
+ }
628
+ }
629
+ canBuildGid() {
630
+ return (!this.external.value && !this.gid.value) || this.gid.pristine;
631
+ }
632
+ canBuildLabel() {
633
+ return (!this.external.value && !this.label.value) || this.label.pristine;
634
+ }
635
+ ngOnInit() {
636
+ // set start mode if required
637
+ if (this._startWithByTypeMode) {
638
+ this.byTypeMode.setValue(true);
639
+ }
640
+ // whenever item changes, update item's parts and filter
641
+ this._subs.push(this.item.valueChanges
642
+ .pipe(distinctUntilChanged(), debounceTime$1(300))
643
+ .subscribe((item) => {
644
+ this.itemPart.setValue(null);
645
+ this.itemParts = item?.parts || [];
646
+ this.filter = {
647
+ ...this.filter,
648
+ itemId: item?.id,
649
+ };
650
+ }));
651
+ // whenever itemPart changes, update target and eventually gid
652
+ this._subs.push(this.itemPart.valueChanges
653
+ .pipe(distinctUntilChanged(), debounceTime$1(300))
654
+ .subscribe((part) => {
655
+ if (!this.gid.value || this.gid.pristine) {
656
+ this.gid.setValue(this.buildGid());
657
+ }
658
+ this.filter = {
659
+ ...this.filter,
660
+ partId: part?.id,
661
+ };
662
+ this.updateTarget();
663
+ }));
664
+ // whenever partTypeKey changes, update filter's options
665
+ this._subs.push(this.partTypeKey.valueChanges
666
+ .pipe(distinctUntilChanged(), debounceTime$1(300))
667
+ .subscribe((key) => {
668
+ this.pinFilterOptions = key
669
+ ? this.lookupDefinitions[key]
670
+ : undefined;
671
+ }));
672
+ // load model-types thesaurus entries
673
+ this._thesService.getThesaurus('model-types', true).subscribe({
674
+ next: (t) => {
675
+ this.modelEntries = t.entries || [];
676
+ if (this.modelEntries?.length) {
677
+ this.setupKeys();
678
+ }
679
+ else {
680
+ this.forceByItem();
681
+ }
682
+ },
683
+ error: () => {
684
+ this.forceByItem();
685
+ },
686
+ });
687
+ }
688
+ ngOnDestroy() {
689
+ for (let i = 0; i < this._subs.length; i++) {
690
+ this._subs[i].unsubscribe();
691
+ }
692
+ }
693
+ buildGid() {
694
+ // the GID is the part ID if any, or the item ID, followed by
695
+ // the pin's value (=EID)
696
+ const pin = this.lookupData?.pin;
697
+ if (!pin) {
698
+ return null;
699
+ }
700
+ return pin.partId
701
+ ? `P${pin.partId}/${pin.value}`
702
+ : `I${pin.itemId}/${pin.value}`;
703
+ }
704
+ buildLabel() {
705
+ if (!this.lookupData?.pin) {
706
+ return null;
707
+ }
708
+ const sb = [];
709
+ // pin value
710
+ sb.push(this.lookupData.pin.value);
711
+ // item title
712
+ sb.push(' | ');
713
+ sb.push(this.lookupData.item.title || this.lookupData.item.id);
714
+ // part type and role
715
+ const e = this.modelEntries?.find((e) => e.id === this.lookupData.pin.partTypeId);
716
+ sb.push(' (');
717
+ sb.push(e?.value || this.lookupData.pin.partTypeId);
718
+ if (this.lookupData.pin.roleId) {
719
+ sb.push(`, ${this.lookupData.pin.roleId}`);
720
+ }
721
+ sb.push(')');
722
+ return sb.join('');
723
+ }
724
+ getTarget() {
725
+ if (this.external.value) {
726
+ return {
727
+ gid: this.gid.value || '',
728
+ label: this.label.value || '',
729
+ };
730
+ }
731
+ else {
732
+ const pin = this.lookupData?.pin;
733
+ return {
734
+ itemId: pin?.itemId || '',
735
+ partId: pin?.partId || '',
736
+ partTypeId: pin?.partTypeId || '',
737
+ roleId: pin?.roleId || '',
738
+ name: pin?.name || '',
739
+ value: pin?.value || '',
740
+ gid: pin?.value || '',
741
+ label: pin?.value || '',
742
+ };
743
+ }
744
+ }
745
+ updateTarget() {
746
+ this._noFormUpdate = true;
747
+ if (this.canBuildGid()) {
748
+ this.gid.setValue(this.buildGid());
749
+ this.gid.markAsDirty();
750
+ }
751
+ if (this.canBuildLabel()) {
752
+ this.label.setValue(this.buildLabel());
753
+ this.label.markAsDirty();
754
+ }
755
+ this.target = this.getTarget();
756
+ this._noFormUpdate = false;
757
+ }
758
+ updateForm(target) {
759
+ if (this._noFormUpdate) {
760
+ return;
761
+ }
762
+ // build pin info from target
763
+ if (!target) {
764
+ this.lookupData = undefined;
765
+ this.form.reset();
766
+ return;
767
+ }
768
+ this.external.setValue(!target.name);
769
+ this.lookupData = {
770
+ pin: {
771
+ itemId: target.itemId || '',
772
+ partId: target.partId || '',
773
+ partTypeId: target.partTypeId || '',
774
+ roleId: target.roleId || '',
775
+ name: target.name || '',
776
+ value: target.value || '',
777
+ },
778
+ };
779
+ // get item
780
+ if (target.itemId) {
781
+ this._itemService.getItem(target.itemId, true).subscribe({
782
+ next: (item) => {
783
+ this.item.setValue(item);
784
+ this.form.markAsPristine();
785
+ },
786
+ error: (error) => {
787
+ if (error) {
788
+ console.error(JSON.stringify(error));
789
+ }
790
+ },
791
+ });
792
+ }
793
+ }
794
+ /**
795
+ * Called when the item lookup changes (item is looked up
796
+ * by its title).
797
+ *
798
+ * @param item The item got from lookup.
799
+ */
800
+ onItemLookupChange(item) {
801
+ // load item's parts
802
+ this._itemService.getItem(item.id, true).subscribe({
803
+ next: (i) => {
804
+ // setting the item will trigger its parts update
805
+ this.item.setValue(i);
806
+ this.updateTarget();
807
+ },
808
+ error: (error) => {
809
+ if (error) {
810
+ console.error(JSON.stringify(error));
811
+ }
812
+ this.itemPart.setValue(null);
813
+ this.itemParts = [];
814
+ this.updateTarget();
815
+ },
816
+ });
817
+ }
818
+ loadItemInfo(pin) {
819
+ forkJoin({
820
+ item: this._itemService.getItem(pin.itemId, false),
821
+ part: this._itemService.getPartFromTypeAndRole(pin.itemId, METADATA_PART_ID),
822
+ })
823
+ .pipe(take(1))
824
+ .subscribe({
825
+ next: (result) => {
826
+ this.lookupData = {
827
+ pin: pin,
828
+ item: result.item,
829
+ metaPart: result.part,
830
+ };
831
+ this.updateTarget();
832
+ },
833
+ error: (error) => {
834
+ this.lookupData = undefined;
835
+ console.error(error ? JSON.stringify(error) : 'Error loading item/metadata');
836
+ },
837
+ });
838
+ }
839
+ /**
840
+ * Called when the pin lookup change. A pin is looked up by its
841
+ * name and value (=the filter's text), and optionally by:
842
+ * - its index lookup definition (selected by partTypeKey).
843
+ * - its item (defined by item, in filter).
844
+ * - its part (defined by itemPart, in filter).
845
+ *
846
+ * @param info The pin info from pin lookup.
847
+ */
848
+ onPinLookupChange(info) {
849
+ this.loadItemInfo(info);
850
+ }
851
+ onCopied() {
852
+ this._snackbar.open('Copied to clipboard', 'OK', {
853
+ duration: 1500,
854
+ });
855
+ }
856
+ close() {
857
+ this.editorClose.emit();
858
+ }
859
+ save() {
860
+ if (this.form.invalid) {
861
+ return;
862
+ }
863
+ this._target = this.getTarget();
864
+ this.targetChange.emit(this._target);
865
+ }
866
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.1", ngImport: i0, type: PinTargetLookupComponent, deps: [{ token: 'indexLookupDefinitions' }, { token: ItemRefLookupService }, { token: PinRefLookupService }, { token: i1.ItemService }, { token: i1.ThesaurusService }, { token: i4$1.MatSnackBar }, { token: i1$1.FormBuilder }], target: i0.ɵɵFactoryTarget.Component }); }
867
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.0.1", type: PinTargetLookupComponent, selector: "cadmus-pin-target-lookup", inputs: { pinByTypeMode: "pinByTypeMode", canSwitchMode: "canSwitchMode", canEditTarget: "canEditTarget", lookupDefinitions: "lookupDefinitions", target: "target" }, outputs: { editorClose: "editorClose", targetChange: "targetChange" }, ngImport: i0, template: "<form [formGroup]=\"form\" (submit)=\"save()\">\r\n <!-- external -->\r\n <mat-checkbox [formControl]=\"external\">external</mat-checkbox>\r\n\r\n <div class=\"form-row\">\r\n <!-- label -->\r\n <div>\r\n <mat-form-field *ngIf=\"external.value || canEditTarget\">\r\n <mat-label>label</mat-label>\r\n <input matInput [formControl]=\"label\" />\r\n <mat-error\r\n *ngIf=\"$any(label).errors?.required && (label.dirty || label.touched)\"\r\n >label required</mat-error\r\n >\r\n <mat-error\r\n *ngIf=\"\r\n $any(label).errors?.maxLength && (label.dirty || label.touched)\r\n \"\r\n >label too long</mat-error\r\n >\r\n </mat-form-field>\r\n <div\r\n *ngIf=\"!external.value && !canEditTarget && label.value\"\r\n class=\"info\"\r\n >\r\n <span class=\"label\">label</span>{{ label.value }}\r\n </div>\r\n </div>\r\n\r\n <!-- gid -->\r\n <div>\r\n <mat-form-field *ngIf=\"external.value || canEditTarget\">\r\n <mat-label>GID</mat-label>\r\n <input matInput [formControl]=\"gid\" />\r\n <mat-error\r\n *ngIf=\"$any(gid).errors?.required && (gid.dirty || gid.touched)\"\r\n >GID required</mat-error\r\n >\r\n <mat-error\r\n *ngIf=\"$any(gid).errors?.maxLength && (gid.dirty || gid.touched)\"\r\n >GID too long</mat-error\r\n >\r\n </mat-form-field>\r\n <div *ngIf=\"!external.value && !canEditTarget && gid.value\" class=\"info\">\r\n <span class=\"label\">GID</span> <span class=\"gid\">{{ gid.value }}</span>\r\n </div>\r\n </div>\r\n </div>\r\n\r\n <!-- BY ITEM -->\r\n <div *ngIf=\"!external.value\">\r\n <fieldset *ngIf=\"!byTypeMode.value\" class=\"form-row\">\r\n <legend>pin filters</legend>\r\n <!-- item filter -->\r\n <cadmus-ref-lookup\r\n [service]=\"itemLookupService\"\r\n label=\"item\"\r\n (itemChange)=\"onItemLookupChange($event)\"\r\n ></cadmus-ref-lookup>\r\n\r\n <!-- part filter -->\r\n <mat-form-field *ngIf=\"itemParts.length\">\r\n <mat-label>part</mat-label>\r\n <mat-select [formControl]=\"itemPart\">\r\n <mat-option [value]=\"null\">(any)</mat-option>\r\n <mat-option *ngFor=\"let p of itemParts\" [value]=\"p\">{{\r\n p.typeId | flatLookup : modelEntries : \"id\" : \"value\"\r\n }}</mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n </fieldset>\r\n\r\n <!-- BY TYPE -->\r\n <div *ngIf=\"byTypeMode.value\">\r\n <!-- par type filter -->\r\n <mat-form-field *ngIf=\"partTypeKeys?.length\">\r\n <mat-label>part type</mat-label>\r\n <mat-select [formControl]=\"partTypeKey\">\r\n <mat-option *ngFor=\"let k of partTypeKeys\" [value]=\"k\">{{\r\n k\r\n }}</mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n </div>\r\n\r\n <!-- PIN -->\r\n <div class=\"form-row\">\r\n <!-- pin lookup -->\r\n <cadmus-ref-lookup\r\n [service]=\"pinLookupService\"\r\n [baseFilter]=\"filter\"\r\n [options]=\"pinFilterOptions\"\r\n label=\"pin\"\r\n (itemChange)=\"onPinLookupChange($event)\"\r\n ></cadmus-ref-lookup>\r\n <!-- mode switcher -->\r\n <div>\r\n <mat-checkbox [formControl]=\"byTypeMode\" *ngIf=\"canSwitchMode\">\r\n by type</mat-checkbox\r\n >\r\n </div>\r\n </div>\r\n\r\n <!-- data -->\r\n <mat-expansion-panel id=\"data\" *ngIf=\"lookupData?.pin?.name\">\r\n <mat-expansion-panel-header>pin data</mat-expansion-panel-header>\r\n <!-- table -->\r\n <table>\r\n <thead>\r\n <th></th>\r\n <th>source</th>\r\n <th>value</th>\r\n </thead>\r\n <tbody>\r\n <!-- pin -->\r\n <tr *ngIf=\"lookupData?.pin?.value\">\r\n <td>\r\n <button\r\n type=\"button\"\r\n mat-icon-button\r\n color=\"primary\"\r\n [cdkCopyToClipboard]=\"lookupData!.pin!.value\"\r\n (cdkCopyToClipboardCopied)=\"onCopied()\"\r\n >\r\n <mat-icon>content_copy</mat-icon>\r\n </button>\r\n </td>\r\n <td>pin</td>\r\n <td>{{ lookupData!.pin.value }}</td>\r\n </tr>\r\n <!-- item ID -->\r\n <tr *ngIf=\"lookupData?.pin?.itemId\">\r\n <td>\r\n <button\r\n type=\"button\"\r\n mat-icon-button\r\n color=\"primary\"\r\n [cdkCopyToClipboard]=\"lookupData!.pin!.itemId\"\r\n (cdkCopyToClipboardCopied)=\"onCopied()\"\r\n >\r\n <mat-icon>content_copy</mat-icon>\r\n </button>\r\n </td>\r\n <td>item ID</td>\r\n <td>{{ lookupData!.pin.itemId }}</td>\r\n </tr>\r\n <!-- item title -->\r\n <tr *ngIf=\"lookupData?.item?.title\">\r\n <td>\r\n <button\r\n type=\"button\"\r\n mat-icon-button\r\n color=\"primary\"\r\n [cdkCopyToClipboard]=\"lookupData!.item!.title\"\r\n (cdkCopyToClipboardCopied)=\"onCopied()\"\r\n >\r\n <mat-icon>content_copy</mat-icon>\r\n </button>\r\n </td>\r\n <td>item title</td>\r\n <td>{{ lookupData!.item!.title }}</td>\r\n </tr>\r\n <!-- part ID -->\r\n <tr *ngIf=\"lookupData?.pin?.partId\">\r\n <td>\r\n <button\r\n type=\"button\"\r\n mat-icon-button\r\n color=\"primary\"\r\n [cdkCopyToClipboard]=\"lookupData!.pin!.partId\"\r\n (cdkCopyToClipboardCopied)=\"onCopied()\"\r\n >\r\n <mat-icon>content_copy</mat-icon>\r\n </button>\r\n </td>\r\n <td>part ID</td>\r\n <td>{{ lookupData!.pin.partId }}</td>\r\n </tr>\r\n <!-- part type ID -->\r\n <tr *ngIf=\"lookupData?.pin?.partTypeId\">\r\n <td>\r\n <button\r\n type=\"button\"\r\n mat-icon-button\r\n color=\"primary\"\r\n [cdkCopyToClipboard]=\"lookupData!.pin!.partTypeId\"\r\n (cdkCopyToClipboardCopied)=\"onCopied()\"\r\n >\r\n <mat-icon>content_copy</mat-icon>\r\n </button>\r\n </td>\r\n <td>part type ID</td>\r\n <td>{{ lookupData!.pin!.partTypeId }}</td>\r\n </tr>\r\n <!-- part role ID -->\r\n <tr *ngIf=\"lookupData?.pin?.roleId\">\r\n <td>\r\n <button\r\n type=\"button\"\r\n mat-icon-button\r\n color=\"primary\"\r\n [cdkCopyToClipboard]=\"lookupData!.pin!.roleId!\"\r\n (cdkCopyToClipboardCopied)=\"onCopied()\"\r\n >\r\n <mat-icon>content_copy</mat-icon>\r\n </button>\r\n </td>\r\n <td>part role ID</td>\r\n <td>{{ lookupData!.pin!.roleId }}</td>\r\n </tr>\r\n\r\n <!-- part's metadata -->\r\n <tr\r\n *ngFor=\"\r\n let m of lookupData?.metaPart?.metadata || [];\r\n let i = index\r\n \"\r\n >\r\n <td>\r\n <button\r\n type=\"button\"\r\n mat-icon-button\r\n color=\"primary\"\r\n [cdkCopyToClipboard]=\"m.value\"\r\n (cdkCopyToClipboardCopied)=\"onCopied()\"\r\n >\r\n <mat-icon>content_copy</mat-icon>\r\n </button>\r\n </td>\r\n <td class=\"metadata\">{{ m.name }}</td>\r\n <td class=\"metadata\">{{ m.value }}</td>\r\n </tr>\r\n </tbody>\r\n </table>\r\n </mat-expansion-panel>\r\n </div>\r\n\r\n <!-- buttons -->\r\n <div>\r\n <button mat-flat-button type=\"button\" (click)=\"close()\">\r\n <mat-icon color=\"warn\">close</mat-icon>\r\n </button>\r\n <button mat-flat-button type=\"submit\" [disabled]=\"form.invalid\">\r\n <mat-icon color=\"primary\">check_circle</mat-icon> target\r\n </button>\r\n </div>\r\n</form>\r\n", styles: [".metadata{color:#4a3001}.info{border:1px solid silver;border-radius:6px;background-color:silver;color:#fff;padding:4px;margin:8px 0}.info .label{background-color:#fff;color:silver;margin:0 6px}#data{margin:8px 0}table{border:1px solid silver;border-radius:6px;padding:4px;margin-top:8px}tr:nth-child(odd){background-color:#f0f0f0}th{font-weight:400;text-align:left;color:silver}.form-row{display:flex;gap:8px;align-items:center;flex-wrap:wrap}.form-row *{flex:0 0 auto}.label{border:1px solid silver;border-radius:6px;padding:4px}fieldset{border:1px solid silver;border-radius:6px;padding:4px 8px;margin-bottom:8px}legend{color:silver}\n"], dependencies: [{ kind: "directive", type: i3.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1$1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1$1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1$1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "directive", type: i1$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i7$1.CdkCopyToClipboard, selector: "[cdkCopyToClipboard]", inputs: ["cdkCopyToClipboard", "cdkCopyToClipboardAttempts"], outputs: ["cdkCopyToClipboardCopied"] }, { kind: "component", type: i4.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: i4.MatIconButton, selector: "button[mat-icon-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "component", type: i9$1.MatCheckbox, selector: "mat-checkbox", inputs: ["disableRipple", "color", "tabIndex"], exportAs: ["matCheckbox"] }, { kind: "component", type: i5.MatExpansionPanel, selector: "mat-expansion-panel", inputs: ["disabled", "expanded", "hideToggle", "togglePosition"], outputs: ["opened", "closed", "expandedChange", "afterExpand", "afterCollapse"], exportAs: ["matExpansionPanel"] }, { kind: "component", type: i5.MatExpansionPanelHeader, selector: "mat-expansion-panel-header", inputs: ["tabIndex", "expandedHeight", "collapsedHeight"] }, { kind: "component", type: i6.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i6.MatLabel, selector: "mat-label" }, { kind: "directive", type: i6.MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "component", type: i7.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "directive", type: i8.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: i9.MatSelect, selector: "mat-select", inputs: ["disabled", "disableRipple", "tabIndex", "hideSingleSelectionIndicator"], exportAs: ["matSelect"] }, { kind: "component", type: i10.MatOption, selector: "mat-option", exportAs: ["matOption"] }, { kind: "component", type: i12.RefLookupComponent, selector: "cadmus-ref-lookup", inputs: ["label", "limit", "baseFilter", "service", "item", "required", "hasMore", "linkTemplate", "optDialog", "options"], outputs: ["itemChange", "moreRequest"] }, { kind: "pipe", type: i17.FlatLookupPipe, name: "flatLookup" }] }); }
868
+ }
869
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.1", ngImport: i0, type: PinTargetLookupComponent, decorators: [{
870
+ type: Component,
871
+ args: [{ selector: 'cadmus-pin-target-lookup', template: "<form [formGroup]=\"form\" (submit)=\"save()\">\r\n <!-- external -->\r\n <mat-checkbox [formControl]=\"external\">external</mat-checkbox>\r\n\r\n <div class=\"form-row\">\r\n <!-- label -->\r\n <div>\r\n <mat-form-field *ngIf=\"external.value || canEditTarget\">\r\n <mat-label>label</mat-label>\r\n <input matInput [formControl]=\"label\" />\r\n <mat-error\r\n *ngIf=\"$any(label).errors?.required && (label.dirty || label.touched)\"\r\n >label required</mat-error\r\n >\r\n <mat-error\r\n *ngIf=\"\r\n $any(label).errors?.maxLength && (label.dirty || label.touched)\r\n \"\r\n >label too long</mat-error\r\n >\r\n </mat-form-field>\r\n <div\r\n *ngIf=\"!external.value && !canEditTarget && label.value\"\r\n class=\"info\"\r\n >\r\n <span class=\"label\">label</span>{{ label.value }}\r\n </div>\r\n </div>\r\n\r\n <!-- gid -->\r\n <div>\r\n <mat-form-field *ngIf=\"external.value || canEditTarget\">\r\n <mat-label>GID</mat-label>\r\n <input matInput [formControl]=\"gid\" />\r\n <mat-error\r\n *ngIf=\"$any(gid).errors?.required && (gid.dirty || gid.touched)\"\r\n >GID required</mat-error\r\n >\r\n <mat-error\r\n *ngIf=\"$any(gid).errors?.maxLength && (gid.dirty || gid.touched)\"\r\n >GID too long</mat-error\r\n >\r\n </mat-form-field>\r\n <div *ngIf=\"!external.value && !canEditTarget && gid.value\" class=\"info\">\r\n <span class=\"label\">GID</span> <span class=\"gid\">{{ gid.value }}</span>\r\n </div>\r\n </div>\r\n </div>\r\n\r\n <!-- BY ITEM -->\r\n <div *ngIf=\"!external.value\">\r\n <fieldset *ngIf=\"!byTypeMode.value\" class=\"form-row\">\r\n <legend>pin filters</legend>\r\n <!-- item filter -->\r\n <cadmus-ref-lookup\r\n [service]=\"itemLookupService\"\r\n label=\"item\"\r\n (itemChange)=\"onItemLookupChange($event)\"\r\n ></cadmus-ref-lookup>\r\n\r\n <!-- part filter -->\r\n <mat-form-field *ngIf=\"itemParts.length\">\r\n <mat-label>part</mat-label>\r\n <mat-select [formControl]=\"itemPart\">\r\n <mat-option [value]=\"null\">(any)</mat-option>\r\n <mat-option *ngFor=\"let p of itemParts\" [value]=\"p\">{{\r\n p.typeId | flatLookup : modelEntries : \"id\" : \"value\"\r\n }}</mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n </fieldset>\r\n\r\n <!-- BY TYPE -->\r\n <div *ngIf=\"byTypeMode.value\">\r\n <!-- par type filter -->\r\n <mat-form-field *ngIf=\"partTypeKeys?.length\">\r\n <mat-label>part type</mat-label>\r\n <mat-select [formControl]=\"partTypeKey\">\r\n <mat-option *ngFor=\"let k of partTypeKeys\" [value]=\"k\">{{\r\n k\r\n }}</mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n </div>\r\n\r\n <!-- PIN -->\r\n <div class=\"form-row\">\r\n <!-- pin lookup -->\r\n <cadmus-ref-lookup\r\n [service]=\"pinLookupService\"\r\n [baseFilter]=\"filter\"\r\n [options]=\"pinFilterOptions\"\r\n label=\"pin\"\r\n (itemChange)=\"onPinLookupChange($event)\"\r\n ></cadmus-ref-lookup>\r\n <!-- mode switcher -->\r\n <div>\r\n <mat-checkbox [formControl]=\"byTypeMode\" *ngIf=\"canSwitchMode\">\r\n by type</mat-checkbox\r\n >\r\n </div>\r\n </div>\r\n\r\n <!-- data -->\r\n <mat-expansion-panel id=\"data\" *ngIf=\"lookupData?.pin?.name\">\r\n <mat-expansion-panel-header>pin data</mat-expansion-panel-header>\r\n <!-- table -->\r\n <table>\r\n <thead>\r\n <th></th>\r\n <th>source</th>\r\n <th>value</th>\r\n </thead>\r\n <tbody>\r\n <!-- pin -->\r\n <tr *ngIf=\"lookupData?.pin?.value\">\r\n <td>\r\n <button\r\n type=\"button\"\r\n mat-icon-button\r\n color=\"primary\"\r\n [cdkCopyToClipboard]=\"lookupData!.pin!.value\"\r\n (cdkCopyToClipboardCopied)=\"onCopied()\"\r\n >\r\n <mat-icon>content_copy</mat-icon>\r\n </button>\r\n </td>\r\n <td>pin</td>\r\n <td>{{ lookupData!.pin.value }}</td>\r\n </tr>\r\n <!-- item ID -->\r\n <tr *ngIf=\"lookupData?.pin?.itemId\">\r\n <td>\r\n <button\r\n type=\"button\"\r\n mat-icon-button\r\n color=\"primary\"\r\n [cdkCopyToClipboard]=\"lookupData!.pin!.itemId\"\r\n (cdkCopyToClipboardCopied)=\"onCopied()\"\r\n >\r\n <mat-icon>content_copy</mat-icon>\r\n </button>\r\n </td>\r\n <td>item ID</td>\r\n <td>{{ lookupData!.pin.itemId }}</td>\r\n </tr>\r\n <!-- item title -->\r\n <tr *ngIf=\"lookupData?.item?.title\">\r\n <td>\r\n <button\r\n type=\"button\"\r\n mat-icon-button\r\n color=\"primary\"\r\n [cdkCopyToClipboard]=\"lookupData!.item!.title\"\r\n (cdkCopyToClipboardCopied)=\"onCopied()\"\r\n >\r\n <mat-icon>content_copy</mat-icon>\r\n </button>\r\n </td>\r\n <td>item title</td>\r\n <td>{{ lookupData!.item!.title }}</td>\r\n </tr>\r\n <!-- part ID -->\r\n <tr *ngIf=\"lookupData?.pin?.partId\">\r\n <td>\r\n <button\r\n type=\"button\"\r\n mat-icon-button\r\n color=\"primary\"\r\n [cdkCopyToClipboard]=\"lookupData!.pin!.partId\"\r\n (cdkCopyToClipboardCopied)=\"onCopied()\"\r\n >\r\n <mat-icon>content_copy</mat-icon>\r\n </button>\r\n </td>\r\n <td>part ID</td>\r\n <td>{{ lookupData!.pin.partId }}</td>\r\n </tr>\r\n <!-- part type ID -->\r\n <tr *ngIf=\"lookupData?.pin?.partTypeId\">\r\n <td>\r\n <button\r\n type=\"button\"\r\n mat-icon-button\r\n color=\"primary\"\r\n [cdkCopyToClipboard]=\"lookupData!.pin!.partTypeId\"\r\n (cdkCopyToClipboardCopied)=\"onCopied()\"\r\n >\r\n <mat-icon>content_copy</mat-icon>\r\n </button>\r\n </td>\r\n <td>part type ID</td>\r\n <td>{{ lookupData!.pin!.partTypeId }}</td>\r\n </tr>\r\n <!-- part role ID -->\r\n <tr *ngIf=\"lookupData?.pin?.roleId\">\r\n <td>\r\n <button\r\n type=\"button\"\r\n mat-icon-button\r\n color=\"primary\"\r\n [cdkCopyToClipboard]=\"lookupData!.pin!.roleId!\"\r\n (cdkCopyToClipboardCopied)=\"onCopied()\"\r\n >\r\n <mat-icon>content_copy</mat-icon>\r\n </button>\r\n </td>\r\n <td>part role ID</td>\r\n <td>{{ lookupData!.pin!.roleId }}</td>\r\n </tr>\r\n\r\n <!-- part's metadata -->\r\n <tr\r\n *ngFor=\"\r\n let m of lookupData?.metaPart?.metadata || [];\r\n let i = index\r\n \"\r\n >\r\n <td>\r\n <button\r\n type=\"button\"\r\n mat-icon-button\r\n color=\"primary\"\r\n [cdkCopyToClipboard]=\"m.value\"\r\n (cdkCopyToClipboardCopied)=\"onCopied()\"\r\n >\r\n <mat-icon>content_copy</mat-icon>\r\n </button>\r\n </td>\r\n <td class=\"metadata\">{{ m.name }}</td>\r\n <td class=\"metadata\">{{ m.value }}</td>\r\n </tr>\r\n </tbody>\r\n </table>\r\n </mat-expansion-panel>\r\n </div>\r\n\r\n <!-- buttons -->\r\n <div>\r\n <button mat-flat-button type=\"button\" (click)=\"close()\">\r\n <mat-icon color=\"warn\">close</mat-icon>\r\n </button>\r\n <button mat-flat-button type=\"submit\" [disabled]=\"form.invalid\">\r\n <mat-icon color=\"primary\">check_circle</mat-icon> target\r\n </button>\r\n </div>\r\n</form>\r\n", styles: [".metadata{color:#4a3001}.info{border:1px solid silver;border-radius:6px;background-color:silver;color:#fff;padding:4px;margin:8px 0}.info .label{background-color:#fff;color:silver;margin:0 6px}#data{margin:8px 0}table{border:1px solid silver;border-radius:6px;padding:4px;margin-top:8px}tr:nth-child(odd){background-color:#f0f0f0}th{font-weight:400;text-align:left;color:silver}.form-row{display:flex;gap:8px;align-items:center;flex-wrap:wrap}.form-row *{flex:0 0 auto}.label{border:1px solid silver;border-radius:6px;padding:4px}fieldset{border:1px solid silver;border-radius:6px;padding:4px 8px;margin-bottom:8px}legend{color:silver}\n"] }]
872
+ }], ctorParameters: function () { return [{ type: undefined, decorators: [{
873
+ type: Inject,
874
+ args: ['indexLookupDefinitions']
875
+ }] }, { type: ItemRefLookupService }, { type: PinRefLookupService }, { type: i1.ItemService }, { type: i1.ThesaurusService }, { type: i4$1.MatSnackBar }, { type: i1$1.FormBuilder }]; }, propDecorators: { pinByTypeMode: [{
876
+ type: Input
877
+ }], canSwitchMode: [{
878
+ type: Input
879
+ }], canEditTarget: [{
880
+ type: Input
881
+ }], lookupDefinitions: [{
882
+ type: Input
883
+ }], target: [{
884
+ type: Input
885
+ }], editorClose: [{
886
+ type: Output
887
+ }], targetChange: [{
888
+ type: Output
889
+ }] } });
890
+
891
+ class AssertedCompositeIdComponent {
892
+ get id() {
893
+ return this._id;
894
+ }
895
+ set id(value) {
896
+ if (this._id !== value) {
897
+ this._id = value || undefined;
898
+ this.updateForm(this._id);
899
+ }
900
+ }
901
+ constructor(formBuilder, lookupService, lookupDefs) {
902
+ this.lookupService = lookupService;
903
+ this.lookupDefs = lookupDefs;
904
+ this.target = formBuilder.control(null, Validators.required);
905
+ this.scope = formBuilder.control(null, Validators.maxLength(500));
906
+ this.tag = formBuilder.control(null, Validators.maxLength(50));
907
+ this.assertion = formBuilder.control(null);
908
+ this.form = formBuilder.group({
909
+ target: this.target,
910
+ scope: this.scope,
911
+ tag: this.tag,
912
+ assertion: this.assertion,
913
+ });
914
+ this.targetExpanded = false;
915
+ // events
916
+ this.idChange = new EventEmitter();
917
+ this.editorClose = new EventEmitter();
918
+ }
919
+ ngOnInit() {
920
+ this.form.valueChanges.pipe(debounceTime(300)).subscribe((_) => {
921
+ if (!this._updatingForm) {
922
+ this.emitIdChange();
923
+ }
924
+ });
925
+ }
926
+ onAssertionChange(assertion) {
927
+ this.assertion.setValue(assertion || null);
928
+ }
929
+ onTargetChange(target) {
930
+ this.target.setValue(target);
931
+ this.target.markAsDirty();
932
+ this.target.updateValueAndValidity();
933
+ this.targetExpanded = false;
934
+ }
935
+ updateForm(id) {
936
+ this._updatingForm = true;
937
+ if (!id) {
938
+ this.form.reset();
939
+ }
940
+ else {
941
+ this.target.setValue(id.target);
942
+ this.scope.setValue(id.scope || null);
943
+ this.tag.setValue(id.tag || null);
944
+ this.assertion.setValue(id.assertion || null);
945
+ this.form.markAsPristine();
946
+ }
947
+ this._updatingForm = false;
948
+ }
949
+ getId() {
950
+ const external = !this.target.value?.name;
951
+ const target = this.target.value;
952
+ return {
953
+ target: external
954
+ ? {
955
+ gid: target?.gid || '',
956
+ label: target?.label || target?.gid || '',
957
+ }
958
+ : target,
959
+ scope: this.scope.value?.trim() || '',
960
+ tag: this.tag.value?.trim(),
961
+ assertion: this.assertion.value || undefined,
962
+ };
963
+ }
964
+ emitIdChange() {
965
+ if (!this.hasSubmit) {
966
+ this._id = this.getId();
967
+ this.idChange.emit(this._id);
968
+ }
969
+ }
970
+ cancel() {
971
+ this.editorClose.emit();
972
+ }
973
+ save() {
974
+ if (this.form.valid) {
975
+ this._id = this.getId();
976
+ this.idChange.emit(this._id);
977
+ }
978
+ }
979
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.1", ngImport: i0, type: AssertedCompositeIdComponent, deps: [{ token: i1$1.FormBuilder }, { token: PinRefLookupService }, { token: 'indexLookupDefinitions' }], target: i0.ɵɵFactoryTarget.Component }); }
980
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.0.1", type: AssertedCompositeIdComponent, selector: "cadmus-refs-asserted-composite-id", inputs: { idScopeEntries: "idScopeEntries", idTagEntries: "idTagEntries", assTagEntries: "assTagEntries", refTypeEntries: "refTypeEntries", refTagEntries: "refTagEntries", id: "id", hasSubmit: "hasSubmit", pinByTypeMode: "pinByTypeMode", canSwitchMode: "canSwitchMode", canEditTarget: "canEditTarget", lookupDefinitions: "lookupDefinitions" }, outputs: { idChange: "idChange", editorClose: "editorClose" }, ngImport: i0, template: "<form [formGroup]=\"form\" (submit)=\"save()\">\n <div>\n <div class=\"form-row\">\n <!-- tag (bound) -->\n <mat-form-field *ngIf=\"idTagEntries?.length\" class=\"short-text\">\n <mat-label>tag</mat-label>\n <mat-select [formControl]=\"tag\">\n <mat-option *ngFor=\"let e of idTagEntries\" [value]=\"e.id\">{{\n e.value\n }}</mat-option>\n </mat-select>\n </mat-form-field>\n <!-- tag (free) -->\n <mat-form-field *ngIf=\"!idTagEntries?.length\" class=\"short-text\">\n <mat-label>tag</mat-label>\n <input matInput [formControl]=\"tag\" />\n <mat-error *ngIf=\"tag.errors?.maxLength && (tag.dirty || tag.touched)\"\n >tag too long</mat-error\n >\n </mat-form-field>\n\n <!-- scope (bound) -->\n <mat-form-field *ngIf=\"idScopeEntries?.length\" class=\"short-text\">\n <mat-label>scope</mat-label>\n <mat-select [formControl]=\"scope\">\n <mat-option *ngFor=\"let e of idScopeEntries\" [value]=\"e.id\">{{\n e.value\n }}</mat-option>\n </mat-select>\n </mat-form-field>\n <!-- scope (free) -->\n <mat-form-field *ngIf=\"!idScopeEntries?.length\" class=\"short-text\">\n <mat-label>scope</mat-label>\n <input matInput [formControl]=\"scope\" />\n <mat-error\n *ngIf=\"scope.errors?.maxLength && (scope.dirty || scope.touched)\"\n >scope too long</mat-error\n >\n </mat-form-field>\n\n <!-- label and GID -->\n <div class=\"info\" *ngIf=\"target.value?.label\">\n <span class=\"label\">label</span>{{ target.value?.label }}\n </div>\n <div class=\"info\" *ngIf=\"target.value?.gid\">\n <span class=\"label\">GID</span>{{ target.value?.gid }}\n </div>\n </div>\n\n <!-- target -->\n <div>\n <mat-expansion-panel [(expanded)]=\"targetExpanded\">\n <mat-expansion-panel-header>target</mat-expansion-panel-header>\n <cadmus-pin-target-lookup\n [pinByTypeMode]=\"pinByTypeMode\"\n [canSwitchMode]=\"canSwitchMode\"\n [canEditTarget]=\"canEditTarget\"\n [lookupDefinitions]=\"lookupDefinitions\"\n [target]=\"target.value\"\n (targetChange)=\"onTargetChange($event)\"\n ></cadmus-pin-target-lookup>\n </mat-expansion-panel>\n </div>\n\n <!-- assertion -->\n <br />\n <mat-expansion-panel>\n <mat-expansion-panel-header>assertion</mat-expansion-panel-header>\n <cadmus-refs-assertion\n [assTagEntries]=\"assTagEntries\"\n [refTypeEntries]=\"refTypeEntries\"\n [refTagEntries]=\"refTagEntries\"\n [assertion]=\"assertion.value\"\n (assertionChange)=\"onAssertionChange($event)\"\n >\n </cadmus-refs-assertion>\n </mat-expansion-panel>\n </div>\n\n <!-- buttons -->\n <div *ngIf=\"hasSubmit\">\n <button\n mat-icon-button\n color=\"warn\"\n type=\"button\"\n (click)=\"cancel()\"\n [disabled]=\"!this.target.value?.gid || !this.target.value?.label\"\n >\n <mat-icon>close</mat-icon>\n </button>\n <button\n mat-icon-button\n color=\"primary\"\n type=\"submit\"\n [disabled]=\"form.invalid\"\n >\n <mat-icon>check_circle</mat-icon>\n </button>\n </div>\n</form>\n", styles: [".form-row{display:flex;gap:8px;align-items:center;flex-wrap:wrap}.form-row *{flex:0 0 auto}.short-text{width:8em}.pin-info{font-size:90%;color:silver}fieldset{border:1px solid silver;border-radius:6px;padding:6px}.info{border:1px solid silver;border-radius:6px;background-color:silver;color:#fff;padding:4px}.info .label{background-color:#fff;color:silver;margin:0 6px}@media only screen and (max-width: 959px){div#container{grid-template-rows:1fr auto;grid-template-columns:1fr;grid-template-areas:\"editor\" \"lookup\"}}\n"], dependencies: [{ kind: "directive", type: i3.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1$1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1$1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1$1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "directive", type: i1$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "component", type: i4.MatIconButton, selector: "button[mat-icon-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "component", type: i5.MatExpansionPanel, selector: "mat-expansion-panel", inputs: ["disabled", "expanded", "hideToggle", "togglePosition"], outputs: ["opened", "closed", "expandedChange", "afterExpand", "afterCollapse"], exportAs: ["matExpansionPanel"] }, { kind: "component", type: i5.MatExpansionPanelHeader, selector: "mat-expansion-panel-header", inputs: ["tabIndex", "expandedHeight", "collapsedHeight"] }, { kind: "component", type: i6.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i6.MatLabel, selector: "mat-label" }, { kind: "directive", type: i6.MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "component", type: i7.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "directive", type: i8.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: i9.MatSelect, selector: "mat-select", inputs: ["disabled", "disableRipple", "tabIndex", "hideSingleSelectionIndicator"], exportAs: ["matSelect"] }, { kind: "component", type: i10.MatOption, selector: "mat-option", exportAs: ["matOption"] }, { kind: "component", type: i11.AssertionComponent, selector: "cadmus-refs-assertion", inputs: ["assTagEntries", "refTypeEntries", "refTagEntries", "assertion"], outputs: ["assertionChange"] }, { kind: "component", type: PinTargetLookupComponent, selector: "cadmus-pin-target-lookup", inputs: ["pinByTypeMode", "canSwitchMode", "canEditTarget", "lookupDefinitions", "target"], outputs: ["editorClose", "targetChange"] }] }); }
981
+ }
982
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.1", ngImport: i0, type: AssertedCompositeIdComponent, decorators: [{
983
+ type: Component,
984
+ args: [{ selector: 'cadmus-refs-asserted-composite-id', template: "<form [formGroup]=\"form\" (submit)=\"save()\">\n <div>\n <div class=\"form-row\">\n <!-- tag (bound) -->\n <mat-form-field *ngIf=\"idTagEntries?.length\" class=\"short-text\">\n <mat-label>tag</mat-label>\n <mat-select [formControl]=\"tag\">\n <mat-option *ngFor=\"let e of idTagEntries\" [value]=\"e.id\">{{\n e.value\n }}</mat-option>\n </mat-select>\n </mat-form-field>\n <!-- tag (free) -->\n <mat-form-field *ngIf=\"!idTagEntries?.length\" class=\"short-text\">\n <mat-label>tag</mat-label>\n <input matInput [formControl]=\"tag\" />\n <mat-error *ngIf=\"tag.errors?.maxLength && (tag.dirty || tag.touched)\"\n >tag too long</mat-error\n >\n </mat-form-field>\n\n <!-- scope (bound) -->\n <mat-form-field *ngIf=\"idScopeEntries?.length\" class=\"short-text\">\n <mat-label>scope</mat-label>\n <mat-select [formControl]=\"scope\">\n <mat-option *ngFor=\"let e of idScopeEntries\" [value]=\"e.id\">{{\n e.value\n }}</mat-option>\n </mat-select>\n </mat-form-field>\n <!-- scope (free) -->\n <mat-form-field *ngIf=\"!idScopeEntries?.length\" class=\"short-text\">\n <mat-label>scope</mat-label>\n <input matInput [formControl]=\"scope\" />\n <mat-error\n *ngIf=\"scope.errors?.maxLength && (scope.dirty || scope.touched)\"\n >scope too long</mat-error\n >\n </mat-form-field>\n\n <!-- label and GID -->\n <div class=\"info\" *ngIf=\"target.value?.label\">\n <span class=\"label\">label</span>{{ target.value?.label }}\n </div>\n <div class=\"info\" *ngIf=\"target.value?.gid\">\n <span class=\"label\">GID</span>{{ target.value?.gid }}\n </div>\n </div>\n\n <!-- target -->\n <div>\n <mat-expansion-panel [(expanded)]=\"targetExpanded\">\n <mat-expansion-panel-header>target</mat-expansion-panel-header>\n <cadmus-pin-target-lookup\n [pinByTypeMode]=\"pinByTypeMode\"\n [canSwitchMode]=\"canSwitchMode\"\n [canEditTarget]=\"canEditTarget\"\n [lookupDefinitions]=\"lookupDefinitions\"\n [target]=\"target.value\"\n (targetChange)=\"onTargetChange($event)\"\n ></cadmus-pin-target-lookup>\n </mat-expansion-panel>\n </div>\n\n <!-- assertion -->\n <br />\n <mat-expansion-panel>\n <mat-expansion-panel-header>assertion</mat-expansion-panel-header>\n <cadmus-refs-assertion\n [assTagEntries]=\"assTagEntries\"\n [refTypeEntries]=\"refTypeEntries\"\n [refTagEntries]=\"refTagEntries\"\n [assertion]=\"assertion.value\"\n (assertionChange)=\"onAssertionChange($event)\"\n >\n </cadmus-refs-assertion>\n </mat-expansion-panel>\n </div>\n\n <!-- buttons -->\n <div *ngIf=\"hasSubmit\">\n <button\n mat-icon-button\n color=\"warn\"\n type=\"button\"\n (click)=\"cancel()\"\n [disabled]=\"!this.target.value?.gid || !this.target.value?.label\"\n >\n <mat-icon>close</mat-icon>\n </button>\n <button\n mat-icon-button\n color=\"primary\"\n type=\"submit\"\n [disabled]=\"form.invalid\"\n >\n <mat-icon>check_circle</mat-icon>\n </button>\n </div>\n</form>\n", styles: [".form-row{display:flex;gap:8px;align-items:center;flex-wrap:wrap}.form-row *{flex:0 0 auto}.short-text{width:8em}.pin-info{font-size:90%;color:silver}fieldset{border:1px solid silver;border-radius:6px;padding:6px}.info{border:1px solid silver;border-radius:6px;background-color:silver;color:#fff;padding:4px}.info .label{background-color:#fff;color:silver;margin:0 6px}@media only screen and (max-width: 959px){div#container{grid-template-rows:1fr auto;grid-template-columns:1fr;grid-template-areas:\"editor\" \"lookup\"}}\n"] }]
985
+ }], ctorParameters: function () { return [{ type: i1$1.FormBuilder }, { type: PinRefLookupService }, { type: undefined, decorators: [{
986
+ type: Inject,
987
+ args: ['indexLookupDefinitions']
988
+ }] }]; }, propDecorators: { idScopeEntries: [{
989
+ type: Input
990
+ }], idTagEntries: [{
991
+ type: Input
992
+ }], assTagEntries: [{
993
+ type: Input
994
+ }], refTypeEntries: [{
995
+ type: Input
996
+ }], refTagEntries: [{
997
+ type: Input
998
+ }], id: [{
999
+ type: Input
1000
+ }], hasSubmit: [{
1001
+ type: Input
1002
+ }], pinByTypeMode: [{
1003
+ type: Input
1004
+ }], canSwitchMode: [{
1005
+ type: Input
1006
+ }], canEditTarget: [{
1007
+ type: Input
1008
+ }], lookupDefinitions: [{
1009
+ type: Input
1010
+ }], idChange: [{
1011
+ type: Output
1012
+ }], editorClose: [{
1013
+ type: Output
1014
+ }] } });
1015
+
1016
+ /**
1017
+ * Asserted IDs editor.
1018
+ */
1019
+ class AssertedCompositeIdsComponent {
1020
+ /**
1021
+ * The asserted IDs.
1022
+ */
1023
+ get ids() {
1024
+ return this._ids;
1025
+ }
1026
+ set ids(value) {
1027
+ if (this._ids !== value) {
1028
+ this._ids = value || [];
1029
+ this.updateForm(value);
1030
+ }
1031
+ }
1032
+ constructor(formBuilder, _dialogService) {
1033
+ this._dialogService = _dialogService;
1034
+ this._ids = [];
1035
+ this._editedIndex = -1;
1036
+ this.idsChange = new EventEmitter();
1037
+ this.entries = formBuilder.control([], { nonNullable: true });
1038
+ // form
1039
+ this.form = formBuilder.group({
1040
+ ids: this.entries,
1041
+ });
1042
+ }
1043
+ updateForm(ids) {
1044
+ if (!ids?.length) {
1045
+ this.form.reset();
1046
+ return;
1047
+ }
1048
+ this.entries.setValue(ids, { emitEvent: false });
1049
+ this.entries.updateValueAndValidity();
1050
+ this.form.markAsPristine();
1051
+ }
1052
+ emitIdsChange() {
1053
+ this.idsChange.emit(this.entries.value);
1054
+ }
1055
+ addId() {
1056
+ this.editId({
1057
+ target: { gid: '', label: '' },
1058
+ }, -1);
1059
+ }
1060
+ editId(id, index) {
1061
+ this._editedIndex = index;
1062
+ this.edited = id;
1063
+ }
1064
+ closeId() {
1065
+ this._editedIndex = -1;
1066
+ this.edited = undefined;
1067
+ }
1068
+ saveId(entry) {
1069
+ const entries = [...this.entries.value];
1070
+ if (this._editedIndex === -1) {
1071
+ entries.push(entry);
1072
+ }
1073
+ else {
1074
+ entries.splice(this._editedIndex, 1, entry);
1075
+ }
1076
+ this.entries.setValue(entries);
1077
+ this.entries.markAsDirty();
1078
+ this.entries.updateValueAndValidity();
1079
+ this.closeId();
1080
+ }
1081
+ deleteId(index) {
1082
+ this._dialogService
1083
+ .confirm('Confirmation', 'Delete ID?')
1084
+ .pipe(take(1))
1085
+ .subscribe((yes) => {
1086
+ if (yes) {
1087
+ if (this._editedIndex === index) {
1088
+ this.closeId();
1089
+ }
1090
+ const entries = [...this.entries.value];
1091
+ entries.splice(index, 1);
1092
+ this.entries.setValue(entries);
1093
+ this.entries.markAsDirty();
1094
+ this.entries.updateValueAndValidity();
1095
+ this.emitIdsChange();
1096
+ }
1097
+ });
1098
+ }
1099
+ moveIdUp(index) {
1100
+ if (index < 1) {
1101
+ return;
1102
+ }
1103
+ const entry = this.entries.value[index];
1104
+ const entries = [...this.entries.value];
1105
+ entries.splice(index, 1);
1106
+ entries.splice(index - 1, 0, entry);
1107
+ this.entries.setValue(entries);
1108
+ this.entries.markAsDirty();
1109
+ this.entries.updateValueAndValidity();
1110
+ this.emitIdsChange();
1111
+ }
1112
+ moveIdDown(index) {
1113
+ if (index + 1 >= this.entries.value.length) {
1114
+ return;
1115
+ }
1116
+ const entry = this.entries.value[index];
1117
+ const entries = [...this.entries.value];
1118
+ entries.splice(index, 1);
1119
+ entries.splice(index + 1, 0, entry);
1120
+ this.entries.setValue(entries);
1121
+ this.entries.markAsDirty();
1122
+ this.entries.updateValueAndValidity();
1123
+ this.emitIdsChange();
1124
+ }
1125
+ onIdChange(id) {
1126
+ this.saveId(id);
1127
+ this.emitIdsChange();
1128
+ }
1129
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.1", ngImport: i0, type: AssertedCompositeIdsComponent, deps: [{ token: i1$1.FormBuilder }, { token: i2.DialogService }], target: i0.ɵɵFactoryTarget.Component }); }
1130
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.0.1", type: AssertedCompositeIdsComponent, selector: "cadmus-refs-asserted-composite-ids", inputs: { ids: "ids", idScopeEntries: "idScopeEntries", idTagEntries: "idTagEntries", assTagEntries: "assTagEntries", refTypeEntries: "refTypeEntries", refTagEntries: "refTagEntries", pinByTypeMode: "pinByTypeMode", canSwitchMode: "canSwitchMode", canEditTarget: "canEditTarget", lookupDefinitions: "lookupDefinitions" }, outputs: { idsChange: "idsChange" }, ngImport: i0, template: "<form [formGroup]=\"form\">\r\n <!-- buttons -->\r\n <button type=\"button\" color=\"primary\" mat-flat-button (click)=\"addId()\">\r\n <mat-icon>add_circle</mat-icon> ID\r\n </button>\r\n <!-- list -->\r\n <table *ngIf=\"entries.value?.length\">\r\n <thead>\r\n <tr>\r\n <th></th>\r\n <th>scope</th>\r\n <th>label</th>\r\n <th>value</th>\r\n <th>ass.</th>\r\n </tr>\r\n </thead>\r\n <tbody>\r\n <tr\r\n *ngFor=\"\r\n let entry of entries.value;\r\n let i = index;\r\n let first = first;\r\n let last = last\r\n \"\r\n >\r\n <td class=\"fit-width\">\r\n <button\r\n type=\"button\"\r\n mat-icon-button\r\n color=\"primary\"\r\n matTooltip=\"Edit this ID\"\r\n (click)=\"editId(entry, i)\"\r\n >\r\n <mat-icon>edit</mat-icon>\r\n </button>\r\n <button\r\n type=\"button\"\r\n mat-icon-button\r\n matTooltip=\"Move this ID up\"\r\n [disabled]=\"first\"\r\n (click)=\"moveIdUp(i)\"\r\n >\r\n <mat-icon>arrow_upward</mat-icon>\r\n </button>\r\n <button\r\n type=\"button\"\r\n mat-icon-button\r\n matTooltip=\"Move this ID down\"\r\n [disabled]=\"last\"\r\n (click)=\"moveIdDown(i)\"\r\n >\r\n <mat-icon>arrow_downward</mat-icon>\r\n </button>\r\n <button\r\n type=\"button\"\r\n mat-icon-button\r\n color=\"warn\"\r\n matTooltip=\"Delete this ID\"\r\n (click)=\"deleteId(i)\"\r\n >\r\n <mat-icon>remove_circle</mat-icon>\r\n </button>\r\n </td>\r\n <td>{{ entry.scope }}</td>\r\n <td>{{ entry?.target?.label }}</td>\r\n <td>{{ entry?.target?.gid }}</td>\r\n <td>{{ entry?.assertion ? \"Y\" : \"N\" }}</td>\r\n </tr>\r\n </tbody>\r\n </table>\r\n\r\n <!-- editor -->\r\n <mat-expansion-panel [expanded]=\"edited\" [disabled]=\"!edited\">\r\n <mat-expansion-panel-header\r\n >ID {{ edited?.target?.label }}</mat-expansion-panel-header\r\n >\r\n <cadmus-refs-asserted-composite-id\r\n [idScopeEntries]=\"idScopeEntries\"\r\n [idTagEntries]=\"idTagEntries\"\r\n [assTagEntries]=\"assTagEntries\"\r\n [refTypeEntries]=\"refTypeEntries\"\r\n [refTagEntries]=\"refTagEntries\"\r\n [hasSubmit]=\"true\"\r\n [pinByTypeMode]=\"pinByTypeMode\"\r\n [canSwitchMode]=\"canSwitchMode\"\r\n [canEditTarget]=\"canEditTarget\"\r\n [lookupDefinitions]=\"lookupDefinitions\"\r\n [id]=\"edited\"\r\n (idChange)=\"onIdChange($event)\"\r\n (editorClose)=\"closeId()\"\r\n ></cadmus-refs-asserted-composite-id>\r\n </mat-expansion-panel>\r\n</form>\r\n", styles: ["th{font-weight:400;color:silver;text-align:left}td{padding-right:4px}td.fit-width{width:1px;white-space:nowrap;padding:0}\n"], dependencies: [{ kind: "directive", type: i3.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1$1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "component", type: i4.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: i4.MatIconButton, selector: "button[mat-icon-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "component", type: i5.MatExpansionPanel, selector: "mat-expansion-panel", inputs: ["disabled", "expanded", "hideToggle", "togglePosition"], outputs: ["opened", "closed", "expandedChange", "afterExpand", "afterCollapse"], exportAs: ["matExpansionPanel"] }, { kind: "component", type: i5.MatExpansionPanelHeader, selector: "mat-expansion-panel-header", inputs: ["tabIndex", "expandedHeight", "collapsedHeight"] }, { kind: "component", type: i7.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: AssertedCompositeIdComponent, selector: "cadmus-refs-asserted-composite-id", inputs: ["idScopeEntries", "idTagEntries", "assTagEntries", "refTypeEntries", "refTagEntries", "id", "hasSubmit", "pinByTypeMode", "canSwitchMode", "canEditTarget", "lookupDefinitions"], outputs: ["idChange", "editorClose"] }] }); }
1131
+ }
1132
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.1", ngImport: i0, type: AssertedCompositeIdsComponent, decorators: [{
1133
+ type: Component,
1134
+ args: [{ selector: 'cadmus-refs-asserted-composite-ids', template: "<form [formGroup]=\"form\">\r\n <!-- buttons -->\r\n <button type=\"button\" color=\"primary\" mat-flat-button (click)=\"addId()\">\r\n <mat-icon>add_circle</mat-icon> ID\r\n </button>\r\n <!-- list -->\r\n <table *ngIf=\"entries.value?.length\">\r\n <thead>\r\n <tr>\r\n <th></th>\r\n <th>scope</th>\r\n <th>label</th>\r\n <th>value</th>\r\n <th>ass.</th>\r\n </tr>\r\n </thead>\r\n <tbody>\r\n <tr\r\n *ngFor=\"\r\n let entry of entries.value;\r\n let i = index;\r\n let first = first;\r\n let last = last\r\n \"\r\n >\r\n <td class=\"fit-width\">\r\n <button\r\n type=\"button\"\r\n mat-icon-button\r\n color=\"primary\"\r\n matTooltip=\"Edit this ID\"\r\n (click)=\"editId(entry, i)\"\r\n >\r\n <mat-icon>edit</mat-icon>\r\n </button>\r\n <button\r\n type=\"button\"\r\n mat-icon-button\r\n matTooltip=\"Move this ID up\"\r\n [disabled]=\"first\"\r\n (click)=\"moveIdUp(i)\"\r\n >\r\n <mat-icon>arrow_upward</mat-icon>\r\n </button>\r\n <button\r\n type=\"button\"\r\n mat-icon-button\r\n matTooltip=\"Move this ID down\"\r\n [disabled]=\"last\"\r\n (click)=\"moveIdDown(i)\"\r\n >\r\n <mat-icon>arrow_downward</mat-icon>\r\n </button>\r\n <button\r\n type=\"button\"\r\n mat-icon-button\r\n color=\"warn\"\r\n matTooltip=\"Delete this ID\"\r\n (click)=\"deleteId(i)\"\r\n >\r\n <mat-icon>remove_circle</mat-icon>\r\n </button>\r\n </td>\r\n <td>{{ entry.scope }}</td>\r\n <td>{{ entry?.target?.label }}</td>\r\n <td>{{ entry?.target?.gid }}</td>\r\n <td>{{ entry?.assertion ? \"Y\" : \"N\" }}</td>\r\n </tr>\r\n </tbody>\r\n </table>\r\n\r\n <!-- editor -->\r\n <mat-expansion-panel [expanded]=\"edited\" [disabled]=\"!edited\">\r\n <mat-expansion-panel-header\r\n >ID {{ edited?.target?.label }}</mat-expansion-panel-header\r\n >\r\n <cadmus-refs-asserted-composite-id\r\n [idScopeEntries]=\"idScopeEntries\"\r\n [idTagEntries]=\"idTagEntries\"\r\n [assTagEntries]=\"assTagEntries\"\r\n [refTypeEntries]=\"refTypeEntries\"\r\n [refTagEntries]=\"refTagEntries\"\r\n [hasSubmit]=\"true\"\r\n [pinByTypeMode]=\"pinByTypeMode\"\r\n [canSwitchMode]=\"canSwitchMode\"\r\n [canEditTarget]=\"canEditTarget\"\r\n [lookupDefinitions]=\"lookupDefinitions\"\r\n [id]=\"edited\"\r\n (idChange)=\"onIdChange($event)\"\r\n (editorClose)=\"closeId()\"\r\n ></cadmus-refs-asserted-composite-id>\r\n </mat-expansion-panel>\r\n</form>\r\n", styles: ["th{font-weight:400;color:silver;text-align:left}td{padding-right:4px}td.fit-width{width:1px;white-space:nowrap;padding:0}\n"] }]
1135
+ }], ctorParameters: function () { return [{ type: i1$1.FormBuilder }, { type: i2.DialogService }]; }, propDecorators: { ids: [{
1136
+ type: Input
1137
+ }], idScopeEntries: [{
1138
+ type: Input
1139
+ }], idTagEntries: [{
1140
+ type: Input
1141
+ }], assTagEntries: [{
1142
+ type: Input
1143
+ }], refTypeEntries: [{
1144
+ type: Input
1145
+ }], refTagEntries: [{
1146
+ type: Input
1147
+ }], pinByTypeMode: [{
1148
+ type: Input
1149
+ }], canSwitchMode: [{
1150
+ type: Input
1151
+ }], canEditTarget: [{
1152
+ type: Input
1153
+ }], lookupDefinitions: [{
1154
+ type: Input
1155
+ }], idsChange: [{
1156
+ type: Output
1157
+ }] } });
1158
+
1159
+ class CadmusRefsAssertedIdsModule {
1160
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.1", ngImport: i0, type: CadmusRefsAssertedIdsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
1161
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.0.1", ngImport: i0, type: CadmusRefsAssertedIdsModule, declarations: [AssertedIdComponent,
1162
+ AssertedIdsComponent,
1163
+ AssertedCompositeIdComponent,
1164
+ AssertedCompositeIdsComponent,
1165
+ PinTargetLookupComponent,
1166
+ ScopedPinLookupComponent], imports: [CommonModule,
1167
+ FormsModule,
1168
+ ReactiveFormsModule,
1169
+ // material
1170
+ ClipboardModule,
1171
+ MatButtonModule,
1172
+ MatCheckboxModule,
1173
+ MatExpansionModule,
1174
+ MatFormFieldModule,
1175
+ MatIconModule,
1176
+ MatInputModule,
1177
+ MatSelectModule,
1178
+ // Myrmidon
1179
+ NgToolsModule,
1180
+ // Cadmus
1181
+ CadmusCoreModule,
1182
+ CadmusRefsDocReferencesModule,
1183
+ CadmusRefsAssertionModule,
1184
+ CadmusRefsLookupModule,
1185
+ CadmusApiModule], exports: [AssertedIdComponent,
1186
+ AssertedIdsComponent,
1187
+ AssertedCompositeIdComponent,
1188
+ AssertedCompositeIdsComponent,
1189
+ PinTargetLookupComponent,
1190
+ ScopedPinLookupComponent] }); }
1191
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.0.1", ngImport: i0, type: CadmusRefsAssertedIdsModule, imports: [CommonModule,
1192
+ FormsModule,
1193
+ ReactiveFormsModule,
1194
+ // material
1195
+ ClipboardModule,
1196
+ MatButtonModule,
1197
+ MatCheckboxModule,
1198
+ MatExpansionModule,
1199
+ MatFormFieldModule,
1200
+ MatIconModule,
1201
+ MatInputModule,
1202
+ MatSelectModule,
1203
+ // Myrmidon
1204
+ NgToolsModule,
1205
+ // Cadmus
1206
+ CadmusCoreModule,
1207
+ CadmusRefsDocReferencesModule,
1208
+ CadmusRefsAssertionModule,
1209
+ CadmusRefsLookupModule,
1210
+ CadmusApiModule] }); }
1211
+ }
1212
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.1", ngImport: i0, type: CadmusRefsAssertedIdsModule, decorators: [{
1213
+ type: NgModule,
1214
+ args: [{
1215
+ declarations: [
1216
+ AssertedIdComponent,
1217
+ AssertedIdsComponent,
1218
+ AssertedCompositeIdComponent,
1219
+ AssertedCompositeIdsComponent,
1220
+ PinTargetLookupComponent,
1221
+ ScopedPinLookupComponent,
1222
+ ],
1223
+ imports: [
1224
+ CommonModule,
1225
+ FormsModule,
1226
+ ReactiveFormsModule,
1227
+ // material
1228
+ ClipboardModule,
1229
+ MatButtonModule,
1230
+ MatCheckboxModule,
1231
+ MatExpansionModule,
1232
+ MatFormFieldModule,
1233
+ MatIconModule,
1234
+ MatInputModule,
1235
+ MatSelectModule,
1236
+ // Myrmidon
1237
+ NgToolsModule,
1238
+ // Cadmus
1239
+ CadmusCoreModule,
1240
+ CadmusRefsDocReferencesModule,
1241
+ CadmusRefsAssertionModule,
1242
+ CadmusRefsLookupModule,
1243
+ CadmusApiModule,
1244
+ ],
1245
+ exports: [
1246
+ AssertedIdComponent,
1247
+ AssertedIdsComponent,
1248
+ AssertedCompositeIdComponent,
1249
+ AssertedCompositeIdsComponent,
1250
+ PinTargetLookupComponent,
1251
+ ScopedPinLookupComponent,
1252
+ ],
1253
+ }]
1254
+ }] });
1255
+
1256
+ /*
1257
+ * Public API Surface of cadmus-refs-asserted-ids
1258
+ */
1259
+
1260
+ /**
1261
+ * Generated bundle index. Do not edit.
1262
+ */
1263
+
1264
+ export { AssertedCompositeIdComponent, AssertedCompositeIdsComponent, AssertedIdComponent, AssertedIdsComponent, CadmusRefsAssertedIdsModule, ItemRefLookupService, PinRefLookupService, PinTargetLookupComponent, ScopedPinLookupComponent };
1265
+ //# sourceMappingURL=myrmidon-cadmus-refs-asserted-ids.mjs.map