@myrmidon/cadmus-refs-asserted-ids 1.0.3 → 1.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,32 +1,218 @@
1
1
  import * as i0 from '@angular/core';
2
- import { EventEmitter, Component, Input, Output, ViewChildren, NgModule } from '@angular/core';
3
- import * as i1 from '@angular/forms';
2
+ import { Injectable, EventEmitter, Component, Inject, Output, Input, NgModule } from '@angular/core';
3
+ import * as i1$1 from '@angular/forms';
4
4
  import { Validators, FormsModule, ReactiveFormsModule } from '@angular/forms';
5
5
  import { debounceTime } from 'rxjs/operators';
6
- import * as i2 from '@angular/common';
6
+ import { of, map, forkJoin, take } from 'rxjs';
7
+ import * as i1 from '@myrmidon/cadmus-api';
8
+ import { CadmusApiModule } from '@myrmidon/cadmus-api';
9
+ import * as i3 from '@angular/common';
7
10
  import { CommonModule } from '@angular/common';
8
- import * as i3 from '@angular/material/expansion';
11
+ import * as i4 from '@angular/material/button';
12
+ import { MatButtonModule } from '@angular/material/button';
13
+ import * as i5 from '@angular/material/expansion';
9
14
  import { MatExpansionModule } from '@angular/material/expansion';
10
- import * as i4 from '@angular/material/form-field';
15
+ import * as i7 from '@angular/material/form-field';
11
16
  import { MatFormFieldModule } from '@angular/material/form-field';
12
- import * as i5 from '@angular/material/input';
17
+ import * as i8 from '@angular/material/icon';
18
+ import { MatIconModule } from '@angular/material/icon';
19
+ import * as i9 from '@angular/material/input';
13
20
  import { MatInputModule } from '@angular/material/input';
14
- import * as i6 from '@angular/material/select';
21
+ import * as i10 from '@angular/material/select';
15
22
  import { MatSelectModule } from '@angular/material/select';
16
- import * as i7 from '@angular/material/core';
17
- import * as i8 from '@myrmidon/cadmus-refs-assertion';
23
+ import * as i11 from '@angular/material/core';
24
+ import * as i11$1 from '@myrmidon/cadmus-refs-assertion';
18
25
  import { CadmusRefsAssertionModule } from '@myrmidon/cadmus-refs-assertion';
19
- import * as i3$1 from '@angular/material/button';
20
- import { MatButtonModule } from '@angular/material/button';
21
- import * as i6$1 from '@angular/material/icon';
22
- import { MatIconModule } from '@angular/material/icon';
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';
23
29
  import { CadmusCoreModule } from '@myrmidon/cadmus-core';
24
30
  import { CadmusRefsDocReferencesModule } from '@myrmidon/cadmus-refs-doc-references';
25
31
 
32
+ /**
33
+ * Cadmus pin-based lookup data service. The text being searched here is just
34
+ * the pin's value, according to the options specified. These options correspond
35
+ * to an index lookup definition. The resulting items are of type DataPinInfo.
36
+ */
37
+ class PinRefLookupService {
38
+ constructor(_itemService) {
39
+ this._itemService = _itemService;
40
+ }
41
+ getName(item) {
42
+ return (item === null || item === void 0 ? void 0 : item.value) || '';
43
+ }
44
+ buildQuery(def, text) {
45
+ const sb = [];
46
+ const AND = ' AND ';
47
+ if (def.typeId) {
48
+ sb.push(`[partTypeId=${def.typeId}]`);
49
+ }
50
+ if (def.roleId) {
51
+ if (sb.length) {
52
+ sb.push(AND);
53
+ }
54
+ sb.push(`[roleId=${def.roleId}]`);
55
+ }
56
+ if (def.name) {
57
+ if (sb.length) {
58
+ sb.push(AND);
59
+ }
60
+ sb.push(`[name=${def.name}]`);
61
+ }
62
+ if (text) {
63
+ if (sb.length) {
64
+ sb.push(AND);
65
+ }
66
+ sb.push(`[value^=${text}]`); // ^= is starts-with
67
+ }
68
+ return sb.join('');
69
+ }
70
+ lookup(filter, options) {
71
+ // the index lookup definition is required
72
+ const def = options;
73
+ if (!def) {
74
+ return of([]);
75
+ }
76
+ // build the corresponding pin query
77
+ const query = this.buildQuery(def, filter.text);
78
+ // search the index
79
+ return this._itemService.searchPins(query, 1, filter.limit).pipe(map((w) => {
80
+ var _a;
81
+ if (w.error) {
82
+ console.error(w.error);
83
+ return [];
84
+ }
85
+ else {
86
+ return ((_a = w.value) === null || _a === void 0 ? void 0 : _a.items) || [];
87
+ }
88
+ }));
89
+ }
90
+ }
91
+ PinRefLookupService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.1", ngImport: i0, type: PinRefLookupService, deps: [{ token: i1.ItemService }], target: i0.ɵɵFactoryTarget.Injectable });
92
+ PinRefLookupService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.1", ngImport: i0, type: PinRefLookupService, providedIn: 'root' });
93
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.1", ngImport: i0, type: PinRefLookupService, decorators: [{
94
+ type: Injectable,
95
+ args: [{
96
+ providedIn: 'root',
97
+ }]
98
+ }], ctorParameters: function () { return [{ type: i1.ItemService }]; } });
99
+
100
+ // from Cadmus general parts
101
+ const METADATA_PART_ID = 'it.vedph.metadata';
102
+ /*
103
+ * Scoped pin-based lookup component. This component provides a list
104
+ * of pin-based searches, with a lookup control. Whenever the user
105
+ * picks a pin value, he gets the details about its item and part, and
106
+ * item's metadata part, if any. He can then use these data to build
107
+ * some EID by variously assembling these components.
108
+ */
109
+ class ScopedPinLookupComponent {
110
+ constructor(formBuilder, _itemService, lookupService, lookupDefs) {
111
+ this._itemService = _itemService;
112
+ this.lookupService = lookupService;
113
+ this.lookupDefs = lookupDefs;
114
+ // lookup
115
+ // keys are all the defined lookup searches
116
+ this.keys = Object.keys(lookupDefs);
117
+ // the selected key defines the lookup scope
118
+ this.key = formBuilder.control(null);
119
+ this.keyForm = formBuilder.group({
120
+ key: this.key,
121
+ });
122
+ // id
123
+ this.id = formBuilder.control(null, [
124
+ Validators.required,
125
+ Validators.maxLength(300),
126
+ ]);
127
+ this.idForm = formBuilder.group({
128
+ id: this.id,
129
+ });
130
+ // event
131
+ this.idPick = new EventEmitter();
132
+ }
133
+ ngOnInit() {
134
+ // pre-select a unique key
135
+ if (this.keys.length === 1) {
136
+ this.key.setValue(this.keys[0]);
137
+ this.key.markAsDirty();
138
+ this.key.updateValueAndValidity();
139
+ }
140
+ }
141
+ onItemChange(item) {
142
+ const info = {
143
+ pin: item,
144
+ };
145
+ // lookup item and its metadata part if any
146
+ forkJoin({
147
+ item: this._itemService.getItem(item.itemId, false),
148
+ part: this._itemService.getPartFromTypeAndRole(item.itemId, METADATA_PART_ID),
149
+ })
150
+ .pipe(take(1))
151
+ .subscribe({
152
+ next: (result) => {
153
+ info.item = result.item;
154
+ info.part = result.part;
155
+ this.info = info;
156
+ },
157
+ error: (error) => {
158
+ console.error(error ? JSON.stringify(error) : 'Error loading item/metadata');
159
+ },
160
+ });
161
+ }
162
+ appendIdComponent(type, metaIndex = -1) {
163
+ var _a, _b, _c, _d;
164
+ let id = this.id.value || '';
165
+ switch (type) {
166
+ case 'itemId':
167
+ id += ((_a = this.info.item) === null || _a === void 0 ? void 0 : _a.id) || '';
168
+ break;
169
+ case 'partId':
170
+ id += ((_b = this.info.part) === null || _b === void 0 ? void 0 : _b.id) || '';
171
+ break;
172
+ case 'partTypeId':
173
+ id += ((_c = this.info.part) === null || _c === void 0 ? void 0 : _c.typeId) || '';
174
+ break;
175
+ case 'partRoleId':
176
+ id += ((_d = this.info.part) === null || _d === void 0 ? void 0 : _d.roleId) || '';
177
+ break;
178
+ case 'metadata':
179
+ id += this.info.part.metadata[metaIndex].value;
180
+ break;
181
+ }
182
+ this.id.setValue(id);
183
+ this.id.markAsDirty();
184
+ this.id.updateValueAndValidity();
185
+ }
186
+ pickId() {
187
+ if (this.idForm.invalid) {
188
+ return;
189
+ }
190
+ this.idPick.emit(this.id.value);
191
+ }
192
+ resetId() {
193
+ this.id.reset();
194
+ this.id.markAsDirty();
195
+ this.id.updateValueAndValidity();
196
+ }
197
+ }
198
+ ScopedPinLookupComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.1", ngImport: i0, type: ScopedPinLookupComponent, deps: [{ token: i1$1.FormBuilder }, { token: i1.ItemService }, { token: PinRefLookupService }, { token: 'indexLookupDefinitions' }], target: i0.ɵɵFactoryTarget.Component });
199
+ ScopedPinLookupComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.1", type: ScopedPinLookupComponent, selector: "cadmus-scoped-pin-lookup", outputs: { idPick: "idPick" }, ngImport: i0, template: "<div>\n <!-- lookup -->\n <div>\n <form [formGroup]=\"keyForm\" class=\"form-row\">\n <!-- key -->\n <mat-form-field *ngIf=\"keys.length > 1\">\n <mat-label>type</mat-label>\n <mat-select [formControl]=\"key\">\n <mat-option *ngFor=\"let k of keys\" [value]=\"k\">{{ k }}</mat-option>\n </mat-select>\n <mat-error\n *ngIf=\"$any(key).errors?.required && (key.dirty || key.touched)\"\n >type required</mat-error\n >\n </mat-form-field>\n <cadmus-ref-lookup\n [service]=\"lookupService\"\n label=\"pin\"\n [options]=\"key.value ? lookupDefs[key.value] : undefined\"\n (itemChange)=\"onItemChange($event)\"\n ></cadmus-ref-lookup>\n </form>\n </div>\n\n <!-- builder -->\n <mat-expansion-panel *ngIf=\"info\" [expanded]=\"info\" [disabled]=\"!info\">\n <mat-expansion-panel-header>ID builder</mat-expansion-panel-header>\n <!-- ID -->\n <div>\n <form [formGroup]=\"idForm\" (submit)=\"pickId()\">\n <mat-form-field style=\"width: 100%\">\n <input matInput [formControl]=\"id\" />\n <mat-error\n *ngIf=\"$any(id).errors?.required && (id.dirty || id.touched)\"\n >ID required</mat-error\n >\n <mat-error\n *ngIf=\"$any(id).errors?.maxLength && (id.dirty || id.touched)\"\n >ID too long</mat-error\n >\n <button\n mat-icon-button\n type=\"button\"\n matSuffix\n (click)=\"resetId()\"\n [disabled]=\"!id.value\"\n >\n <mat-icon color=\"warn\">close</mat-icon>\n </button>\n <button\n mat-icon-button\n type=\"button\"\n matSuffix\n (click)=\"pickId()\"\n [disabled]=\"idForm.invalid\"\n >\n <mat-icon color=\"primary\">check_circle</mat-icon>\n </button>\n </mat-form-field>\n </form>\n </div>\n <!-- table -->\n <table>\n <thead>\n <th></th>\n <th>source</th>\n <th>value</th>\n </thead>\n <tbody>\n <!-- item ID -->\n <tr>\n <td>\n <button\n type=\"button\"\n mat-icon-button\n color=\"primary\"\n (click)=\"appendIdComponent('itemId')\"\n >\n <mat-icon>add_circle</mat-icon>\n </button>\n </td>\n <td>item ID</td>\n <td>{{ info!.item?.id }}</td>\n </tr>\n <!-- item title -->\n <tr>\n <td></td>\n <td>item title</td>\n <td>{{ info!.item?.title }}</td>\n </tr>\n <!-- part ID -->\n <tr>\n <td>\n <button\n type=\"button\"\n mat-icon-button\n color=\"primary\"\n (click)=\"appendIdComponent('partId')\"\n >\n <mat-icon>add_circle</mat-icon>\n </button>\n </td>\n <td>part ID</td>\n <td>{{ info!.part?.id }}</td>\n </tr>\n <!-- part type ID -->\n <tr>\n <td>\n <button\n type=\"button\"\n mat-icon-button\n color=\"primary\"\n (click)=\"appendIdComponent('partTypeId')\"\n >\n <mat-icon>add_circle</mat-icon>\n </button>\n </td>\n <td>part type ID</td>\n <td>{{ info!.part?.typeId }}</td>\n </tr>\n <!-- part role ID -->\n <tr>\n <td>\n <button\n type=\"button\"\n mat-icon-button\n color=\"primary\"\n (click)=\"appendIdComponent('partRoleId')\"\n >\n <mat-icon>add_circle</mat-icon>\n </button>\n </td>\n <td>part role ID</td>\n <td>{{ info!.part?.roleId }}</td>\n </tr>\n\n <!-- part's metadata -->\n <tr *ngFor=\"let m of info!.part?.metadata; let i = index\">\n <td>\n <button\n type=\"button\"\n mat-icon-button\n color=\"primary\"\n (click)=\"appendIdComponent('metadata', i)\"\n >\n <mat-icon>add_circle</mat-icon>\n </button>\n </td>\n <td class=\"metadata\">{{ m.name }}</td>\n <td class=\"metadata\">{{ m.value }}</td>\n </tr>\n </tbody>\n </table>\n </mat-expansion-panel>\n</div>\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: i7.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i7.MatLabel, selector: "mat-label" }, { kind: "directive", type: i7.MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "directive", type: i7.MatSuffix, selector: "[matSuffix], [matIconSuffix], [matTextSuffix]", inputs: ["matTextSuffix"] }, { kind: "component", type: i8.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "directive", type: i9.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: i10.MatSelect, selector: "mat-select", inputs: ["disabled", "disableRipple", "tabIndex"], exportAs: ["matSelect"] }, { kind: "component", type: i11.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"] }] });
200
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.1", ngImport: i0, type: ScopedPinLookupComponent, decorators: [{
201
+ type: Component,
202
+ args: [{ selector: 'cadmus-scoped-pin-lookup', template: "<div>\n <!-- lookup -->\n <div>\n <form [formGroup]=\"keyForm\" class=\"form-row\">\n <!-- key -->\n <mat-form-field *ngIf=\"keys.length > 1\">\n <mat-label>type</mat-label>\n <mat-select [formControl]=\"key\">\n <mat-option *ngFor=\"let k of keys\" [value]=\"k\">{{ k }}</mat-option>\n </mat-select>\n <mat-error\n *ngIf=\"$any(key).errors?.required && (key.dirty || key.touched)\"\n >type required</mat-error\n >\n </mat-form-field>\n <cadmus-ref-lookup\n [service]=\"lookupService\"\n label=\"pin\"\n [options]=\"key.value ? lookupDefs[key.value] : undefined\"\n (itemChange)=\"onItemChange($event)\"\n ></cadmus-ref-lookup>\n </form>\n </div>\n\n <!-- builder -->\n <mat-expansion-panel *ngIf=\"info\" [expanded]=\"info\" [disabled]=\"!info\">\n <mat-expansion-panel-header>ID builder</mat-expansion-panel-header>\n <!-- ID -->\n <div>\n <form [formGroup]=\"idForm\" (submit)=\"pickId()\">\n <mat-form-field style=\"width: 100%\">\n <input matInput [formControl]=\"id\" />\n <mat-error\n *ngIf=\"$any(id).errors?.required && (id.dirty || id.touched)\"\n >ID required</mat-error\n >\n <mat-error\n *ngIf=\"$any(id).errors?.maxLength && (id.dirty || id.touched)\"\n >ID too long</mat-error\n >\n <button\n mat-icon-button\n type=\"button\"\n matSuffix\n (click)=\"resetId()\"\n [disabled]=\"!id.value\"\n >\n <mat-icon color=\"warn\">close</mat-icon>\n </button>\n <button\n mat-icon-button\n type=\"button\"\n matSuffix\n (click)=\"pickId()\"\n [disabled]=\"idForm.invalid\"\n >\n <mat-icon color=\"primary\">check_circle</mat-icon>\n </button>\n </mat-form-field>\n </form>\n </div>\n <!-- table -->\n <table>\n <thead>\n <th></th>\n <th>source</th>\n <th>value</th>\n </thead>\n <tbody>\n <!-- item ID -->\n <tr>\n <td>\n <button\n type=\"button\"\n mat-icon-button\n color=\"primary\"\n (click)=\"appendIdComponent('itemId')\"\n >\n <mat-icon>add_circle</mat-icon>\n </button>\n </td>\n <td>item ID</td>\n <td>{{ info!.item?.id }}</td>\n </tr>\n <!-- item title -->\n <tr>\n <td></td>\n <td>item title</td>\n <td>{{ info!.item?.title }}</td>\n </tr>\n <!-- part ID -->\n <tr>\n <td>\n <button\n type=\"button\"\n mat-icon-button\n color=\"primary\"\n (click)=\"appendIdComponent('partId')\"\n >\n <mat-icon>add_circle</mat-icon>\n </button>\n </td>\n <td>part ID</td>\n <td>{{ info!.part?.id }}</td>\n </tr>\n <!-- part type ID -->\n <tr>\n <td>\n <button\n type=\"button\"\n mat-icon-button\n color=\"primary\"\n (click)=\"appendIdComponent('partTypeId')\"\n >\n <mat-icon>add_circle</mat-icon>\n </button>\n </td>\n <td>part type ID</td>\n <td>{{ info!.part?.typeId }}</td>\n </tr>\n <!-- part role ID -->\n <tr>\n <td>\n <button\n type=\"button\"\n mat-icon-button\n color=\"primary\"\n (click)=\"appendIdComponent('partRoleId')\"\n >\n <mat-icon>add_circle</mat-icon>\n </button>\n </td>\n <td>part role ID</td>\n <td>{{ info!.part?.roleId }}</td>\n </tr>\n\n <!-- part's metadata -->\n <tr *ngFor=\"let m of info!.part?.metadata; let i = index\">\n <td>\n <button\n type=\"button\"\n mat-icon-button\n color=\"primary\"\n (click)=\"appendIdComponent('metadata', i)\"\n >\n <mat-icon>add_circle</mat-icon>\n </button>\n </td>\n <td class=\"metadata\">{{ m.name }}</td>\n <td class=\"metadata\">{{ m.value }}</td>\n </tr>\n </tbody>\n </table>\n </mat-expansion-panel>\n</div>\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"] }]
203
+ }], ctorParameters: function () {
204
+ return [{ type: i1$1.FormBuilder }, { type: i1.ItemService }, { type: PinRefLookupService }, { type: undefined, decorators: [{
205
+ type: Inject,
206
+ args: ['indexLookupDefinitions']
207
+ }] }];
208
+ }, propDecorators: { idPick: [{
209
+ type: Output
210
+ }] } });
211
+
26
212
  class AssertedIdComponent {
27
- constructor(formBuilder) {
28
- this.idChange = new EventEmitter();
29
- // form
213
+ constructor(formBuilder, lookupService, lookupDefs) {
214
+ this.lookupService = lookupService;
215
+ this.lookupDefs = lookupDefs;
30
216
  this.tag = formBuilder.control(null, Validators.maxLength(50));
31
217
  this.value = formBuilder.control(null, [
32
218
  Validators.required,
@@ -38,6 +224,8 @@ class AssertedIdComponent {
38
224
  value: this.value,
39
225
  scope: this.scope,
40
226
  });
227
+ this.lookupExpanded = false;
228
+ this.idChange = new EventEmitter();
41
229
  }
42
230
  get id() {
43
231
  return this._id;
@@ -59,6 +247,12 @@ class AssertedIdComponent {
59
247
  this.assertion = assertion;
60
248
  setTimeout(() => this.emitIdChange(), 0);
61
249
  }
250
+ onIdPick(id) {
251
+ this.value.setValue(id);
252
+ this.value.markAsDirty();
253
+ this.value.updateValueAndValidity();
254
+ this.lookupExpanded = false;
255
+ }
62
256
  updateForm(value) {
63
257
  this._updatingForm = true;
64
258
  if (!value) {
@@ -85,15 +279,27 @@ class AssertedIdComponent {
85
279
  };
86
280
  }
87
281
  emitIdChange() {
88
- this.idChange.emit(this.getId());
282
+ if (!this.hasSubmit) {
283
+ this.idChange.emit(this.getId());
284
+ }
285
+ }
286
+ save() {
287
+ if (this.form.valid) {
288
+ this.idChange.emit(this.getId());
289
+ }
89
290
  }
90
291
  }
91
- AssertedIdComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: AssertedIdComponent, deps: [{ token: i1.FormBuilder }], target: i0.ɵɵFactoryTarget.Component });
92
- AssertedIdComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.0.4", type: AssertedIdComponent, selector: "cadmus-refs-asserted-id", inputs: { scopeEntries: "scopeEntries", idTagEntries: "idTagEntries", assTagEntries: "assTagEntries", refTypeEntries: "refTypeEntries", refTagEntries: "refTagEntries", id: "id" }, outputs: { idChange: "idChange" }, ngImport: i0, template: "<form [formGroup]=\"form\">\n <div>\n <!-- tag (bound) -->\n <mat-form-field *ngIf=\"idTagEntries?.length\" style=\"width: 8em\">\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\" style=\"width: 8em\">\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 &nbsp;\n\n <!-- scope (bound) -->\n <mat-form-field *ngIf=\"scopeEntries?.length\" style=\"width: 8em\">\n <mat-label>scope</mat-label>\n <mat-select [formControl]=\"scope\">\n <mat-option *ngFor=\"let e of scopeEntries\" [value]=\"e.id\">{{\n e.value\n }}</mat-option>\n </mat-select>\n </mat-form-field>\n <!-- scope (free) -->\n <mat-form-field *ngIf=\"!scopeEntries?.length\" style=\"width: 8em\">\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 <!-- value -->\n &nbsp;\n <mat-form-field>\n <mat-label>value</mat-label>\n <input matInput [formControl]=\"value\" />\n <mat-error\n *ngIf=\"value.errors?.required && (value.dirty || value.touched)\"\n >value required</mat-error\n >\n <mat-error\n *ngIf=\"value.errors?.maxLength && (value.dirty || value.touched)\"\n >value too long</mat-error\n >\n </mat-form-field>\n </div>\n\n <!-- assertion -->\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]=\"initialAssertion\"\n (assertionChange)=\"onAssertionChange($event)\"\n >\n </cadmus-refs-assertion>\n </mat-expansion-panel>\n</form>\n", styles: [""], dependencies: [{ kind: "directive", type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1.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.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "directive", type: i1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "component", type: i3.MatExpansionPanel, selector: "mat-expansion-panel", inputs: ["disabled", "expanded", "hideToggle", "togglePosition"], outputs: ["opened", "closed", "expandedChange", "afterExpand", "afterCollapse"], exportAs: ["matExpansionPanel"] }, { kind: "component", type: i3.MatExpansionPanelHeader, selector: "mat-expansion-panel-header", inputs: ["tabIndex", "expandedHeight", "collapsedHeight"] }, { kind: "component", type: i4.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i4.MatLabel, selector: "mat-label" }, { kind: "directive", type: i4.MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "directive", type: i5.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: i6.MatSelect, selector: "mat-select", inputs: ["disabled", "disableRipple", "tabIndex"], exportAs: ["matSelect"] }, { kind: "component", type: i7.MatOption, selector: "mat-option", exportAs: ["matOption"] }, { kind: "component", type: i8.AssertionComponent, selector: "cadmus-refs-assertion", inputs: ["assTagEntries", "refTypeEntries", "refTagEntries", "assertion"], outputs: ["assertionChange"] }] });
93
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: AssertedIdComponent, decorators: [{
292
+ AssertedIdComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.1", ngImport: i0, type: AssertedIdComponent, deps: [{ token: i1$1.FormBuilder }, { token: PinRefLookupService }, { token: 'indexLookupDefinitions' }], target: i0.ɵɵFactoryTarget.Component });
293
+ AssertedIdComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.1", type: AssertedIdComponent, selector: "cadmus-refs-asserted-id", inputs: { scopeEntries: "scopeEntries", idTagEntries: "idTagEntries", assTagEntries: "assTagEntries", refTypeEntries: "refTypeEntries", refTagEntries: "refTagEntries", id: "id", noEidLookup: "noEidLookup", hasSubmit: "hasSubmit" }, outputs: { idChange: "idChange" }, 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\" style=\"width: 8em\">\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\" style=\"width: 8em\">\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=\"scopeEntries?.length\" style=\"width: 8em\">\n <mat-label>scope</mat-label>\n <mat-select [formControl]=\"scope\">\n <mat-option *ngFor=\"let e of scopeEntries\" [value]=\"e.id\">{{\n e.value\n }}</mat-option>\n </mat-select>\n </mat-form-field>\n <!-- scope (free) -->\n <mat-form-field *ngIf=\"!scopeEntries?.length\" style=\"width: 8em\">\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 <!-- value -->\n <mat-form-field>\n <mat-label>value</mat-label>\n <input matInput [formControl]=\"value\" />\n <mat-error\n *ngIf=\"value.errors?.required && (value.dirty || value.touched)\"\n >value required</mat-error\n >\n <mat-error\n *ngIf=\"value.errors?.maxLength && (value.dirty || value.touched)\"\n >value too long</mat-error\n >\n </mat-form-field>\n\n <!-- lookup -->\n <div *ngIf=\"!noEidLookup\" style=\"margin-top: 4px\">\n <mat-expansion-panel [(expanded)]=\"lookupExpanded\">\n <mat-expansion-panel-header>lookup</mat-expansion-panel-header>\n <cadmus-scoped-pin-lookup\n (idPick)=\"onIdPick($event)\"\n ></cadmus-scoped-pin-lookup>\n </mat-expansion-panel>\n </div>\n </div>\n\n <!-- assertion -->\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]=\"initialAssertion\"\n (assertionChange)=\"onAssertionChange($event)\"\n >\n </cadmus-refs-assertion>\n </mat-expansion-panel>\n </div>\n\n <!-- buttons -->\n <div *ngIf=\"hasSubmit\">\n <button mat-icon-button color=\"warn\" type=\"button\">\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: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: i7.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i7.MatLabel, selector: "mat-label" }, { kind: "directive", type: i7.MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "component", type: i8.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "directive", type: i9.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: i10.MatSelect, selector: "mat-select", inputs: ["disabled", "disableRipple", "tabIndex"], exportAs: ["matSelect"] }, { kind: "component", type: i11.MatOption, selector: "mat-option", exportAs: ["matOption"] }, { kind: "component", type: i11$1.AssertionComponent, selector: "cadmus-refs-assertion", inputs: ["assTagEntries", "refTypeEntries", "refTagEntries", "assertion"], outputs: ["assertionChange"] }, { kind: "component", type: ScopedPinLookupComponent, selector: "cadmus-scoped-pin-lookup", outputs: ["idPick"] }] });
294
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.1", ngImport: i0, type: AssertedIdComponent, decorators: [{
94
295
  type: Component,
95
- args: [{ selector: 'cadmus-refs-asserted-id', template: "<form [formGroup]=\"form\">\n <div>\n <!-- tag (bound) -->\n <mat-form-field *ngIf=\"idTagEntries?.length\" style=\"width: 8em\">\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\" style=\"width: 8em\">\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 &nbsp;\n\n <!-- scope (bound) -->\n <mat-form-field *ngIf=\"scopeEntries?.length\" style=\"width: 8em\">\n <mat-label>scope</mat-label>\n <mat-select [formControl]=\"scope\">\n <mat-option *ngFor=\"let e of scopeEntries\" [value]=\"e.id\">{{\n e.value\n }}</mat-option>\n </mat-select>\n </mat-form-field>\n <!-- scope (free) -->\n <mat-form-field *ngIf=\"!scopeEntries?.length\" style=\"width: 8em\">\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 <!-- value -->\n &nbsp;\n <mat-form-field>\n <mat-label>value</mat-label>\n <input matInput [formControl]=\"value\" />\n <mat-error\n *ngIf=\"value.errors?.required && (value.dirty || value.touched)\"\n >value required</mat-error\n >\n <mat-error\n *ngIf=\"value.errors?.maxLength && (value.dirty || value.touched)\"\n >value too long</mat-error\n >\n </mat-form-field>\n </div>\n\n <!-- assertion -->\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]=\"initialAssertion\"\n (assertionChange)=\"onAssertionChange($event)\"\n >\n </cadmus-refs-assertion>\n </mat-expansion-panel>\n</form>\n" }]
96
- }], ctorParameters: function () { return [{ type: i1.FormBuilder }]; }, propDecorators: { scopeEntries: [{
296
+ args: [{ selector: 'cadmus-refs-asserted-id', template: "<form [formGroup]=\"form\" (submit)=\"save()\">\n <div>\n <div class=\"form-row\">\n <!-- tag (bound) -->\n <mat-form-field *ngIf=\"idTagEntries?.length\" style=\"width: 8em\">\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\" style=\"width: 8em\">\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=\"scopeEntries?.length\" style=\"width: 8em\">\n <mat-label>scope</mat-label>\n <mat-select [formControl]=\"scope\">\n <mat-option *ngFor=\"let e of scopeEntries\" [value]=\"e.id\">{{\n e.value\n }}</mat-option>\n </mat-select>\n </mat-form-field>\n <!-- scope (free) -->\n <mat-form-field *ngIf=\"!scopeEntries?.length\" style=\"width: 8em\">\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 <!-- value -->\n <mat-form-field>\n <mat-label>value</mat-label>\n <input matInput [formControl]=\"value\" />\n <mat-error\n *ngIf=\"value.errors?.required && (value.dirty || value.touched)\"\n >value required</mat-error\n >\n <mat-error\n *ngIf=\"value.errors?.maxLength && (value.dirty || value.touched)\"\n >value too long</mat-error\n >\n </mat-form-field>\n\n <!-- lookup -->\n <div *ngIf=\"!noEidLookup\" style=\"margin-top: 4px\">\n <mat-expansion-panel [(expanded)]=\"lookupExpanded\">\n <mat-expansion-panel-header>lookup</mat-expansion-panel-header>\n <cadmus-scoped-pin-lookup\n (idPick)=\"onIdPick($event)\"\n ></cadmus-scoped-pin-lookup>\n </mat-expansion-panel>\n </div>\n </div>\n\n <!-- assertion -->\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]=\"initialAssertion\"\n (assertionChange)=\"onAssertionChange($event)\"\n >\n </cadmus-refs-assertion>\n </mat-expansion-panel>\n </div>\n\n <!-- buttons -->\n <div *ngIf=\"hasSubmit\">\n <button mat-icon-button color=\"warn\" type=\"button\">\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: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"] }]
297
+ }], ctorParameters: function () {
298
+ return [{ type: i1$1.FormBuilder }, { type: PinRefLookupService }, { type: undefined, decorators: [{
299
+ type: Inject,
300
+ args: ['indexLookupDefinitions']
301
+ }] }];
302
+ }, propDecorators: { scopeEntries: [{
97
303
  type: Input
98
304
  }], idTagEntries: [{
99
305
  type: Input
@@ -105,21 +311,27 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImpor
105
311
  type: Input
106
312
  }], id: [{
107
313
  type: Input
314
+ }], noEidLookup: [{
315
+ type: Input
316
+ }], hasSubmit: [{
317
+ type: Input
108
318
  }], idChange: [{
109
319
  type: Output
110
320
  }] } });
111
321
 
322
+ /**
323
+ * Asserted IDs editor.
324
+ */
112
325
  class AssertedIdsComponent {
113
- constructor(_formBuilder) {
114
- this._formBuilder = _formBuilder;
326
+ constructor(formBuilder, _dialogService) {
327
+ this._dialogService = _dialogService;
115
328
  this._ids = [];
116
- this._idsSubs = [];
329
+ this._editedIndex = -1;
117
330
  this.idsChange = new EventEmitter();
118
- this.assEdOpen = false;
331
+ this.entries = formBuilder.control([], { nonNullable: true });
119
332
  // form
120
- this.idsArr = _formBuilder.array([]);
121
- this.form = _formBuilder.group({
122
- idsArr: this.idsArr,
333
+ this.form = formBuilder.group({
334
+ ids: this.entries,
123
335
  });
124
336
  }
125
337
  /**
@@ -134,164 +346,100 @@ class AssertedIdsComponent {
134
346
  this.updateForm(value);
135
347
  }
136
348
  }
137
- ngAfterViewInit() {
138
- var _a;
139
- // focus on newly added ID
140
- this._idSubscription = (_a = this.idQueryList) === null || _a === void 0 ? void 0 : _a.changes.pipe(debounceTime(300)).subscribe((lst) => {
141
- if (!this._updatingForm && lst.length > 0) {
142
- lst.last.nativeElement.focus();
143
- }
144
- });
145
- }
146
- unsubscribeIds() {
147
- for (let i = 0; i < this._idsSubs.length; i++) {
148
- this._idsSubs[i].unsubscribe();
349
+ updateForm(ids) {
350
+ if (!(ids === null || ids === void 0 ? void 0 : ids.length)) {
351
+ this.form.reset();
352
+ return;
149
353
  }
354
+ this.entries.setValue(ids, { emitEvent: false });
355
+ this.entries.updateValueAndValidity();
356
+ this.form.markAsPristine();
150
357
  }
151
- ngOnDestroy() {
152
- var _a;
153
- this.unsubscribeIds();
154
- (_a = this._idSubscription) === null || _a === void 0 ? void 0 : _a.unsubscribe();
155
- }
156
- getIdGroup(id) {
157
- return this._formBuilder.group({
158
- value: this._formBuilder.control(id === null || id === void 0 ? void 0 : id.value, [
159
- Validators.required,
160
- Validators.maxLength(500),
161
- ]),
162
- scope: this._formBuilder.control(id === null || id === void 0 ? void 0 : id.scope, Validators.maxLength(50)),
163
- tag: this._formBuilder.control(id === null || id === void 0 ? void 0 : id.tag, Validators.maxLength(50)),
164
- assertion: this._formBuilder.control(id === null || id === void 0 ? void 0 : id.assertion),
165
- });
358
+ emitIdsChange() {
359
+ this.idsChange.emit(this.entries.value);
166
360
  }
167
- addId(id) {
168
- const g = this.getIdGroup(id);
169
- this._idsSubs.push(g.valueChanges.pipe(debounceTime(300)).subscribe((_) => {
170
- this.emitIdsChange();
171
- }));
172
- this.idsArr.push(g);
173
- if (!this._updatingForm) {
174
- this.emitIdsChange();
175
- }
361
+ addId() {
362
+ this.editId({
363
+ scope: '',
364
+ value: '',
365
+ }, -1);
176
366
  }
177
- removeId(index) {
178
- this.closeAssertion();
179
- this._idsSubs[index].unsubscribe();
180
- this._idsSubs.splice(index, 1);
181
- this.idsArr.removeAt(index);
182
- this.emitIdsChange();
367
+ editId(id, index) {
368
+ this._editedIndex = index;
369
+ this.edited = id;
183
370
  }
184
- swapArrElems(a, i, j) {
185
- if (i === j) {
186
- return;
371
+ closeId() {
372
+ this._editedIndex = -1;
373
+ this.edited = undefined;
374
+ }
375
+ saveId(entry) {
376
+ const entries = [...this.entries.value];
377
+ if (this._editedIndex === -1) {
378
+ entries.push(entry);
379
+ }
380
+ else {
381
+ entries.splice(this._editedIndex, 1, entry);
187
382
  }
188
- const t = a[i];
189
- a[i] = a[j];
190
- a[j] = t;
383
+ this.entries.setValue(entries);
384
+ this.entries.markAsDirty();
385
+ this.entries.updateValueAndValidity();
386
+ this.closeId();
387
+ }
388
+ deleteId(index) {
389
+ this._dialogService
390
+ .confirm('Confirmation', 'Delete ID?')
391
+ .pipe(take(1))
392
+ .subscribe((yes) => {
393
+ if (yes) {
394
+ if (this._editedIndex === index) {
395
+ this.closeId();
396
+ }
397
+ const entries = [...this.entries.value];
398
+ entries.splice(index, 1);
399
+ this.entries.setValue(entries);
400
+ this.entries.markAsDirty();
401
+ this.entries.updateValueAndValidity();
402
+ this.emitIdsChange();
403
+ }
404
+ });
191
405
  }
192
406
  moveIdUp(index) {
193
407
  if (index < 1) {
194
408
  return;
195
409
  }
196
- this.closeAssertion();
197
- const ctl = this.idsArr.controls[index];
198
- this.idsArr.removeAt(index);
199
- this.idsArr.insert(index - 1, ctl);
200
- this.swapArrElems(this._idsSubs, index, index - 1);
410
+ const entry = this.entries.value[index];
411
+ const entries = [...this.entries.value];
412
+ entries.splice(index, 1);
413
+ entries.splice(index - 1, 0, entry);
414
+ this.entries.setValue(entries);
415
+ this.entries.markAsDirty();
416
+ this.entries.updateValueAndValidity();
201
417
  this.emitIdsChange();
202
418
  }
203
419
  moveIdDown(index) {
204
- if (index + 1 >= this.idsArr.length) {
420
+ if (index + 1 >= this.entries.value.length) {
205
421
  return;
206
422
  }
207
- this.closeAssertion();
208
- const item = this.idsArr.controls[index];
209
- this.idsArr.removeAt(index);
210
- this.idsArr.insert(index + 1, item);
211
- this.swapArrElems(this._idsSubs, index, index + 1);
423
+ const entry = this.entries.value[index];
424
+ const entries = [...this.entries.value];
425
+ entries.splice(index, 1);
426
+ entries.splice(index + 1, 0, entry);
427
+ this.entries.setValue(entries);
428
+ this.entries.markAsDirty();
429
+ this.entries.updateValueAndValidity();
212
430
  this.emitIdsChange();
213
431
  }
214
- clearIds() {
215
- this.closeAssertion();
216
- this.idsArr.clear();
217
- this.unsubscribeIds();
218
- this._idsSubs = [];
219
- if (!this._updatingForm) {
220
- this.emitIdsChange();
221
- }
222
- }
223
- editAssertion(index) {
224
- // save the currently edited assertion if any
225
- this.saveAssertion();
226
- // edit the new assertion
227
- this.initialAssertion = this.idsArr.at(index).controls['assertion'].value;
228
- this.assertionNr = index + 1;
229
- this.assEdOpen = true;
230
- }
231
- onAssertionChange(assertion) {
232
- this.assertion = assertion;
233
- }
234
- saveAssertion() {
235
- // save the currently edited assertion if any
236
- if (this.assertionNr) {
237
- const g = this.idsArr.at(this.assertionNr - 1);
238
- g.controls['assertion'].setValue(this.assertion);
239
- this.closeAssertion();
240
- this.emitIdsChange();
241
- }
242
- }
243
- closeAssertion() {
244
- if (this.assertionNr) {
245
- this.assEdOpen = false;
246
- this.assertionNr = 0;
247
- this.initialAssertion = undefined;
248
- }
249
- }
250
- updateForm(ids) {
251
- if (!this.idsArr) {
252
- return;
253
- }
254
- this._updatingForm = true;
255
- this.clearIds();
256
- if (!ids) {
257
- this.form.reset();
258
- }
259
- else {
260
- for (const id of ids) {
261
- this.addId(id);
262
- }
263
- this.form.markAsPristine();
264
- }
265
- this._updatingForm = false;
432
+ onIdChange(id) {
433
+ this.saveId(id);
266
434
  this.emitIdsChange();
267
435
  }
268
- getIds() {
269
- var _a, _b, _c;
270
- const ids = [];
271
- for (let i = 0; i < this.idsArr.length; i++) {
272
- const g = this.idsArr.controls[i];
273
- ids.push({
274
- value: (_a = g.controls.value.value) === null || _a === void 0 ? void 0 : _a.trim(),
275
- scope: (_b = g.controls.scope.value) === null || _b === void 0 ? void 0 : _b.trim(),
276
- tag: (_c = g.controls.tag.value) === null || _c === void 0 ? void 0 : _c.trim(),
277
- assertion: g.controls.assertion.value,
278
- });
279
- }
280
- return ids;
281
- }
282
- emitIdsChange() {
283
- this.idsChange.emit(this.getIds());
284
- }
285
436
  }
286
- AssertedIdsComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: AssertedIdsComponent, deps: [{ token: i1.FormBuilder }], target: i0.ɵɵFactoryTarget.Component });
287
- AssertedIdsComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.0.4", type: AssertedIdsComponent, selector: "cadmus-refs-asserted-ids", inputs: { ids: "ids", scopeEntries: "scopeEntries", tagEntries: "tagEntries", assTagEntries: "assTagEntries", refTypeEntries: "refTypeEntries", refTagEntries: "refTagEntries" }, outputs: { idsChange: "idsChange" }, viewQueries: [{ propertyName: "idQueryList", predicate: ["id"], descendants: true }], ngImport: i0, template: "<form [formGroup]=\"form\">\r\n <div formArrayName=\"idsArr\">\r\n <div>\r\n <button\r\n type=\"button\"\r\n mat-flat-button\r\n color=\"primary\"\r\n (click)=\"addId()\"\r\n >\r\n <mat-icon>add_circle</mat-icon> add ID\r\n </button>\r\n </div>\r\n <div\r\n *ngFor=\"\r\n let item of idsArr.controls;\r\n let i = index;\r\n let first = first;\r\n let last = last\r\n \"\r\n >\r\n <!-- child form -->\r\n <div [formGroupName]=\"i\">\r\n <!-- child actions -->\r\n {{ i + 1 }}.\r\n <button\r\n mat-icon-button\r\n type=\"button\"\r\n matTooltip=\"Remove this ID\"\r\n color=\"warn\"\r\n (click)=\"removeId(i)\"\r\n >\r\n <mat-icon>remove_circle</mat-icon>\r\n </button>\r\n <button\r\n [disabled]=\"first\"\r\n mat-icon-button\r\n type=\"button\"\r\n matTooltip=\"Move ID up\"\r\n (click)=\"moveIdUp(i)\"\r\n >\r\n <mat-icon>arrow_upward</mat-icon>\r\n </button>\r\n <button\r\n [disabled]=\"last\"\r\n mat-icon-button\r\n type=\"button\"\r\n matTooltip=\"Move ID down\"\r\n (click)=\"moveIdDown(i)\"\r\n >\r\n <mat-icon>arrow_downward</mat-icon>\r\n </button>\r\n\r\n <!-- child controls -->\r\n <!-- value -->\r\n <mat-form-field>\r\n <mat-label>external ID</mat-label>\r\n <input #id autofocus matInput formControlName=\"value\" />\r\n <mat-error\r\n *ngIf=\"\r\n $any(item)['controls'].value?.hasError('required') &&\r\n ($any(item)['controls'].value.dirty ||\r\n $any(item)['controls'].value.touched)\r\n \"\r\n >ID required\r\n </mat-error>\r\n <mat-error\r\n *ngIf=\"\r\n $any(item)['controls'].value?.hasError('max-length') &&\r\n ($any(item)['controls'].value.dirty ||\r\n $any(item)['controls'].value.touched)\r\n \"\r\n >ID too long\r\n </mat-error>\r\n </mat-form-field>\r\n\r\n &nbsp;\r\n <!-- scope (bound) -->\r\n <ng-container *ngIf=\"scopeEntries\">\r\n <mat-form-field style=\"width: 8em\">\r\n <mat-label>scope</mat-label>\r\n <mat-select formControlName=\"scope\">\r\n <mat-option *ngFor=\"let e of scopeEntries\" [value]=\"e.id\">\r\n {{ e.value }}\r\n </mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n </ng-container>\r\n\r\n <!-- scope (free) -->\r\n <ng-container *ngIf=\"!scopeEntries\">\r\n <mat-form-field style=\"width: 8em\">\r\n <mat-label>scope</mat-label>\r\n <input matInput formControlName=\"scope\" />\r\n <mat-error\r\n *ngIf=\"\r\n $any(item)['controls'].scope?.hasError('max-length') &&\r\n ($any(item)['controls'].scope.dirty ||\r\n $any(item)['controls'].scope.touched)\r\n \"\r\n >scope too long\r\n </mat-error>\r\n </mat-form-field>\r\n </ng-container>\r\n\r\n &nbsp;\r\n <!-- tag (bound) -->\r\n <ng-container *ngIf=\"tagEntries\">\r\n <mat-form-field style=\"width: 8em\">\r\n <mat-label>tag</mat-label>\r\n <mat-select formControlName=\"tag\">\r\n <mat-option *ngFor=\"let e of tagEntries\" [value]=\"e.id\">\r\n {{ e.value }}\r\n </mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n </ng-container>\r\n\r\n <!-- tag (free) -->\r\n <ng-container *ngIf=\"!tagEntries\">\r\n <mat-form-field style=\"width: 8em\">\r\n <mat-label>tag</mat-label>\r\n <input matInput formControlName=\"tag\" />\r\n <mat-error\r\n *ngIf=\"\r\n $any(item)['controls'].tag?.hasError('max-length') &&\r\n ($any(item)['controls'].tag.dirty ||\r\n $any(item)['controls'].tag.touched)\r\n \"\r\n >tag too long\r\n </mat-error>\r\n </mat-form-field>\r\n </ng-container>\r\n\r\n <!-- assertion -->\r\n &nbsp;\r\n <button\r\n type=\"button\"\r\n color=\"primary\"\r\n mat-icon-button\r\n matTooltip=\"Edit assertion\"\r\n (click)=\"editAssertion(i)\"\r\n >\r\n <mat-icon>feedback</mat-icon>\r\n </button>\r\n </div>\r\n </div>\r\n <!-- assertion -->\r\n <mat-expansion-panel\r\n *ngIf=\"idsArr?.length\"\r\n [disabled]=\"!assertionNr\"\r\n [(expanded)]=\"assEdOpen\"\r\n >\r\n <mat-expansion-panel-header\r\n >#{{ assertionNr }} assertion</mat-expansion-panel-header\r\n >\r\n <cadmus-refs-assertion\r\n [assertion]=\"initialAssertion\"\r\n [assTagEntries]=\"assTagEntries\"\r\n [refTagEntries]=\"refTagEntries\"\r\n [refTypeEntries]=\"refTypeEntries\"\r\n (assertionChange)=\"onAssertionChange($event)\"\r\n ></cadmus-refs-assertion>\r\n <button\r\n color=\"primary\"\r\n type=\"button\"\r\n mat-flat-button\r\n style=\"margin-top: 6px;\"\r\n (click)=\"saveAssertion()\"\r\n >\r\n <mat-icon>check_circle</mat-icon> assertion\r\n </button>\r\n </mat-expansion-panel>\r\n </div>\r\n</form>\r\n", styles: [""], dependencies: [{ kind: "directive", type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1.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.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "directive", type: i1.FormGroupName, selector: "[formGroupName]", inputs: ["formGroupName"] }, { kind: "directive", type: i1.FormArrayName, selector: "[formArrayName]", inputs: ["formArrayName"] }, { kind: "component", type: i3$1.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: i3$1.MatIconButton, selector: "button[mat-icon-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "component", type: i3.MatExpansionPanel, selector: "mat-expansion-panel", inputs: ["disabled", "expanded", "hideToggle", "togglePosition"], outputs: ["opened", "closed", "expandedChange", "afterExpand", "afterCollapse"], exportAs: ["matExpansionPanel"] }, { kind: "component", type: i3.MatExpansionPanelHeader, selector: "mat-expansion-panel-header", inputs: ["tabIndex", "expandedHeight", "collapsedHeight"] }, { kind: "component", type: i4.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i4.MatLabel, selector: "mat-label" }, { kind: "directive", type: i4.MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "component", type: i6$1.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "directive", type: i5.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: i6.MatSelect, selector: "mat-select", inputs: ["disabled", "disableRipple", "tabIndex"], exportAs: ["matSelect"] }, { kind: "component", type: i7.MatOption, selector: "mat-option", exportAs: ["matOption"] }, { kind: "component", type: i8.AssertionComponent, selector: "cadmus-refs-assertion", inputs: ["assTagEntries", "refTypeEntries", "refTagEntries", "assertion"], outputs: ["assertionChange"] }] });
288
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: AssertedIdsComponent, decorators: [{
437
+ AssertedIdsComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.1", ngImport: i0, type: AssertedIdsComponent, deps: [{ token: i1$1.FormBuilder }, { token: i2.DialogService }], target: i0.ɵɵFactoryTarget.Component });
438
+ AssertedIdsComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.1", type: AssertedIdsComponent, selector: "cadmus-refs-asserted-ids", inputs: { ids: "ids", scopeEntries: "scopeEntries", tagEntries: "tagEntries", 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</mat-expansion-panel-header>\r\n <cadmus-refs-asserted-id\r\n [hasSubmit]=\"true\"\r\n [id]=\"edited\"\r\n (idChange)=\"onIdChange($event)\"\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: i8.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: AssertedIdComponent, selector: "cadmus-refs-asserted-id", inputs: ["scopeEntries", "idTagEntries", "assTagEntries", "refTypeEntries", "refTagEntries", "id", "noEidLookup", "hasSubmit"], outputs: ["idChange"] }] });
439
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.1", ngImport: i0, type: AssertedIdsComponent, decorators: [{
289
440
  type: Component,
290
- args: [{ selector: 'cadmus-refs-asserted-ids', template: "<form [formGroup]=\"form\">\r\n <div formArrayName=\"idsArr\">\r\n <div>\r\n <button\r\n type=\"button\"\r\n mat-flat-button\r\n color=\"primary\"\r\n (click)=\"addId()\"\r\n >\r\n <mat-icon>add_circle</mat-icon> add ID\r\n </button>\r\n </div>\r\n <div\r\n *ngFor=\"\r\n let item of idsArr.controls;\r\n let i = index;\r\n let first = first;\r\n let last = last\r\n \"\r\n >\r\n <!-- child form -->\r\n <div [formGroupName]=\"i\">\r\n <!-- child actions -->\r\n {{ i + 1 }}.\r\n <button\r\n mat-icon-button\r\n type=\"button\"\r\n matTooltip=\"Remove this ID\"\r\n color=\"warn\"\r\n (click)=\"removeId(i)\"\r\n >\r\n <mat-icon>remove_circle</mat-icon>\r\n </button>\r\n <button\r\n [disabled]=\"first\"\r\n mat-icon-button\r\n type=\"button\"\r\n matTooltip=\"Move ID up\"\r\n (click)=\"moveIdUp(i)\"\r\n >\r\n <mat-icon>arrow_upward</mat-icon>\r\n </button>\r\n <button\r\n [disabled]=\"last\"\r\n mat-icon-button\r\n type=\"button\"\r\n matTooltip=\"Move ID down\"\r\n (click)=\"moveIdDown(i)\"\r\n >\r\n <mat-icon>arrow_downward</mat-icon>\r\n </button>\r\n\r\n <!-- child controls -->\r\n <!-- value -->\r\n <mat-form-field>\r\n <mat-label>external ID</mat-label>\r\n <input #id autofocus matInput formControlName=\"value\" />\r\n <mat-error\r\n *ngIf=\"\r\n $any(item)['controls'].value?.hasError('required') &&\r\n ($any(item)['controls'].value.dirty ||\r\n $any(item)['controls'].value.touched)\r\n \"\r\n >ID required\r\n </mat-error>\r\n <mat-error\r\n *ngIf=\"\r\n $any(item)['controls'].value?.hasError('max-length') &&\r\n ($any(item)['controls'].value.dirty ||\r\n $any(item)['controls'].value.touched)\r\n \"\r\n >ID too long\r\n </mat-error>\r\n </mat-form-field>\r\n\r\n &nbsp;\r\n <!-- scope (bound) -->\r\n <ng-container *ngIf=\"scopeEntries\">\r\n <mat-form-field style=\"width: 8em\">\r\n <mat-label>scope</mat-label>\r\n <mat-select formControlName=\"scope\">\r\n <mat-option *ngFor=\"let e of scopeEntries\" [value]=\"e.id\">\r\n {{ e.value }}\r\n </mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n </ng-container>\r\n\r\n <!-- scope (free) -->\r\n <ng-container *ngIf=\"!scopeEntries\">\r\n <mat-form-field style=\"width: 8em\">\r\n <mat-label>scope</mat-label>\r\n <input matInput formControlName=\"scope\" />\r\n <mat-error\r\n *ngIf=\"\r\n $any(item)['controls'].scope?.hasError('max-length') &&\r\n ($any(item)['controls'].scope.dirty ||\r\n $any(item)['controls'].scope.touched)\r\n \"\r\n >scope too long\r\n </mat-error>\r\n </mat-form-field>\r\n </ng-container>\r\n\r\n &nbsp;\r\n <!-- tag (bound) -->\r\n <ng-container *ngIf=\"tagEntries\">\r\n <mat-form-field style=\"width: 8em\">\r\n <mat-label>tag</mat-label>\r\n <mat-select formControlName=\"tag\">\r\n <mat-option *ngFor=\"let e of tagEntries\" [value]=\"e.id\">\r\n {{ e.value }}\r\n </mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n </ng-container>\r\n\r\n <!-- tag (free) -->\r\n <ng-container *ngIf=\"!tagEntries\">\r\n <mat-form-field style=\"width: 8em\">\r\n <mat-label>tag</mat-label>\r\n <input matInput formControlName=\"tag\" />\r\n <mat-error\r\n *ngIf=\"\r\n $any(item)['controls'].tag?.hasError('max-length') &&\r\n ($any(item)['controls'].tag.dirty ||\r\n $any(item)['controls'].tag.touched)\r\n \"\r\n >tag too long\r\n </mat-error>\r\n </mat-form-field>\r\n </ng-container>\r\n\r\n <!-- assertion -->\r\n &nbsp;\r\n <button\r\n type=\"button\"\r\n color=\"primary\"\r\n mat-icon-button\r\n matTooltip=\"Edit assertion\"\r\n (click)=\"editAssertion(i)\"\r\n >\r\n <mat-icon>feedback</mat-icon>\r\n </button>\r\n </div>\r\n </div>\r\n <!-- assertion -->\r\n <mat-expansion-panel\r\n *ngIf=\"idsArr?.length\"\r\n [disabled]=\"!assertionNr\"\r\n [(expanded)]=\"assEdOpen\"\r\n >\r\n <mat-expansion-panel-header\r\n >#{{ assertionNr }} assertion</mat-expansion-panel-header\r\n >\r\n <cadmus-refs-assertion\r\n [assertion]=\"initialAssertion\"\r\n [assTagEntries]=\"assTagEntries\"\r\n [refTagEntries]=\"refTagEntries\"\r\n [refTypeEntries]=\"refTypeEntries\"\r\n (assertionChange)=\"onAssertionChange($event)\"\r\n ></cadmus-refs-assertion>\r\n <button\r\n color=\"primary\"\r\n type=\"button\"\r\n mat-flat-button\r\n style=\"margin-top: 6px;\"\r\n (click)=\"saveAssertion()\"\r\n >\r\n <mat-icon>check_circle</mat-icon> assertion\r\n </button>\r\n </mat-expansion-panel>\r\n </div>\r\n</form>\r\n" }]
291
- }], ctorParameters: function () { return [{ type: i1.FormBuilder }]; }, propDecorators: { idQueryList: [{
292
- type: ViewChildren,
293
- args: ['id']
294
- }], ids: [{
441
+ 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</mat-expansion-panel-header>\r\n <cadmus-refs-asserted-id\r\n [hasSubmit]=\"true\"\r\n [id]=\"edited\"\r\n (idChange)=\"onIdChange($event)\"\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"] }]
442
+ }], ctorParameters: function () { return [{ type: i1$1.FormBuilder }, { type: i2.DialogService }]; }, propDecorators: { ids: [{
295
443
  type: Input
296
444
  }], scopeEntries: [{
297
445
  type: Input
@@ -309,8 +457,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImpor
309
457
 
310
458
  class CadmusRefsAssertedIdsModule {
311
459
  }
312
- CadmusRefsAssertedIdsModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: CadmusRefsAssertedIdsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
313
- CadmusRefsAssertedIdsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.0.4", ngImport: i0, type: CadmusRefsAssertedIdsModule, declarations: [AssertedIdComponent, AssertedIdsComponent], imports: [CommonModule,
460
+ CadmusRefsAssertedIdsModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.1", ngImport: i0, type: CadmusRefsAssertedIdsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
461
+ CadmusRefsAssertedIdsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.1.1", ngImport: i0, type: CadmusRefsAssertedIdsModule, declarations: [AssertedIdComponent,
462
+ AssertedIdsComponent,
463
+ ScopedPinLookupComponent], imports: [CommonModule,
314
464
  FormsModule,
315
465
  ReactiveFormsModule,
316
466
  // material
@@ -323,8 +473,12 @@ CadmusRefsAssertedIdsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0
323
473
  // Cadmus
324
474
  CadmusCoreModule,
325
475
  CadmusRefsDocReferencesModule,
326
- CadmusRefsAssertionModule], exports: [AssertedIdComponent, AssertedIdsComponent] });
327
- CadmusRefsAssertedIdsModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: CadmusRefsAssertedIdsModule, imports: [CommonModule,
476
+ CadmusRefsAssertionModule,
477
+ CadmusRefsLookupModule,
478
+ CadmusApiModule], exports: [AssertedIdComponent,
479
+ AssertedIdsComponent,
480
+ ScopedPinLookupComponent] });
481
+ CadmusRefsAssertedIdsModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.1.1", ngImport: i0, type: CadmusRefsAssertedIdsModule, imports: [CommonModule,
328
482
  FormsModule,
329
483
  ReactiveFormsModule,
330
484
  // material
@@ -337,11 +491,17 @@ CadmusRefsAssertedIdsModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0
337
491
  // Cadmus
338
492
  CadmusCoreModule,
339
493
  CadmusRefsDocReferencesModule,
340
- CadmusRefsAssertionModule] });
341
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: CadmusRefsAssertedIdsModule, decorators: [{
494
+ CadmusRefsAssertionModule,
495
+ CadmusRefsLookupModule,
496
+ CadmusApiModule] });
497
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.1", ngImport: i0, type: CadmusRefsAssertedIdsModule, decorators: [{
342
498
  type: NgModule,
343
499
  args: [{
344
- declarations: [AssertedIdComponent, AssertedIdsComponent],
500
+ declarations: [
501
+ AssertedIdComponent,
502
+ AssertedIdsComponent,
503
+ ScopedPinLookupComponent,
504
+ ],
345
505
  imports: [
346
506
  CommonModule,
347
507
  FormsModule,
@@ -357,8 +517,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImpor
357
517
  CadmusCoreModule,
358
518
  CadmusRefsDocReferencesModule,
359
519
  CadmusRefsAssertionModule,
520
+ CadmusRefsLookupModule,
521
+ CadmusApiModule,
522
+ ],
523
+ exports: [
524
+ AssertedIdComponent,
525
+ AssertedIdsComponent,
526
+ ScopedPinLookupComponent,
360
527
  ],
361
- exports: [AssertedIdComponent, AssertedIdsComponent],
362
528
  }]
363
529
  }] });
364
530
 
@@ -370,6 +536,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImpor
370
536
  * Generated bundle index. Do not edit.
371
537
  */
372
538
 
373
- export { AssertedIdComponent, AssertedIdsComponent, CadmusRefsAssertedIdsModule };
374
- //# sourceMappingURL=myrmidon-cadmus-refs-asserted-ids.mjs.map
539
+ export { AssertedIdComponent, AssertedIdsComponent, CadmusRefsAssertedIdsModule, PinRefLookupService, ScopedPinLookupComponent };
375
540
  //# sourceMappingURL=myrmidon-cadmus-refs-asserted-ids.mjs.map