@myrmidon/cadmus-refs-asserted-ids 1.0.9 → 2.0.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 (24) hide show
  1. package/esm2022/lib/asserted-id/asserted-id.component.mjs +133 -0
  2. package/esm2022/lib/asserted-ids/asserted-ids.component.mjs +147 -0
  3. package/esm2022/lib/cadmus-refs-asserted-ids.module.mjs +92 -0
  4. package/esm2022/lib/scoped-pin-lookup/scoped-pin-lookup.component.mjs +130 -0
  5. package/esm2022/lib/services/pin-ref-lookup.service.mjs +73 -0
  6. package/{esm2020 → esm2022}/myrmidon-cadmus-refs-asserted-ids.mjs +4 -4
  7. package/{esm2020 → esm2022}/public-api.mjs +8 -8
  8. package/{fesm2020 → fesm2022}/myrmidon-cadmus-refs-asserted-ids.mjs +500 -500
  9. package/{fesm2020 → fesm2022}/myrmidon-cadmus-refs-asserted-ids.mjs.map +1 -1
  10. package/index.d.ts +5 -5
  11. package/lib/asserted-id/asserted-id.component.d.ts +49 -49
  12. package/lib/asserted-ids/asserted-ids.component.d.ts +44 -44
  13. package/lib/cadmus-refs-asserted-ids.module.d.ts +22 -22
  14. package/lib/scoped-pin-lookup/scoped-pin-lookup.component.d.ts +39 -39
  15. package/lib/services/pin-ref-lookup.service.d.ts +18 -18
  16. package/package.json +8 -14
  17. package/public-api.d.ts +5 -5
  18. package/esm2020/lib/asserted-id/asserted-id.component.mjs +0 -132
  19. package/esm2020/lib/asserted-ids/asserted-ids.component.mjs +0 -146
  20. package/esm2020/lib/cadmus-refs-asserted-ids.module.mjs +0 -91
  21. package/esm2020/lib/scoped-pin-lookup/scoped-pin-lookup.component.mjs +0 -129
  22. package/esm2020/lib/services/pin-ref-lookup.service.mjs +0 -72
  23. package/fesm2015/myrmidon-cadmus-refs-asserted-ids.mjs +0 -554
  24. package/fesm2015/myrmidon-cadmus-refs-asserted-ids.mjs.map +0 -1
@@ -29,518 +29,518 @@ import * as i2 from '@myrmidon/ng-mat-tools';
29
29
  import { CadmusCoreModule } from '@myrmidon/cadmus-core';
30
30
  import { CadmusRefsDocReferencesModule } from '@myrmidon/cadmus-refs-doc-references';
31
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?.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
- // for other operators see backend SqlQueryBuilderBase.cs
67
- sb.push(`[value*=${text}]`); // *= is "contains"
68
- }
69
- return sb.join('');
70
- }
71
- lookup(filter, options) {
72
- // the index lookup definition is required
73
- const def = options;
74
- if (!def) {
75
- return of([]);
76
- }
77
- // build the corresponding pin query
78
- const query = this.buildQuery(def, filter.text);
79
- // search the index
80
- return this._itemService.searchPins(query, 1, filter.limit).pipe(map((w) => {
81
- if (w.error) {
82
- console.error(w.error);
83
- return [];
84
- }
85
- else {
86
- return w.value?.items || [];
87
- }
88
- }));
89
- }
90
- }
91
- PinRefLookupServicefac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.3", ngImport: i0, type: PinRefLookupService, deps: [{ token: i1.ItemService }], target: i0.ɵɵFactoryTarget.Injectable });
92
- PinRefLookupService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.3", ngImport: i0, type: PinRefLookupService, providedIn: 'root' });
93
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.3", ngImport: i0, type: PinRefLookupService, decorators: [{
94
- type: Injectable,
95
- args: [{
96
- providedIn: 'root',
97
- }]
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?.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
+ // for other operators see backend SqlQueryBuilderBase.cs
67
+ sb.push(`[value*=${text}]`); // *= is "contains"
68
+ }
69
+ return sb.join('');
70
+ }
71
+ lookup(filter, options) {
72
+ // the index lookup definition is required
73
+ const def = options;
74
+ if (!def) {
75
+ return of([]);
76
+ }
77
+ // build the corresponding pin query
78
+ const query = this.buildQuery(def, filter.text);
79
+ // search the index
80
+ return this._itemService.searchPins(query, 1, filter.limit).pipe(map((w) => {
81
+ if (w.error) {
82
+ console.error(w.error);
83
+ return [];
84
+ }
85
+ else {
86
+ return w.value?.items || [];
87
+ }
88
+ }));
89
+ }
90
+ 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 }); }
91
+ static { thisprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.0.1", ngImport: i0, type: PinRefLookupService, providedIn: 'root' }); }
92
+ }
93
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.1", ngImport: i0, type: PinRefLookupService, decorators: [{
94
+ type: Injectable,
95
+ args: [{
96
+ providedIn: 'root',
97
+ }]
98
98
  }], ctorParameters: function () { return [{ type: i1.ItemService }]; } });
99
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
- let id = this.id.value || '';
164
- switch (type) {
165
- case 'pin':
166
- id += this.info?.pin.value;
167
- break;
168
- case 'itemId':
169
- id += this.info.item?.id || '';
170
- break;
171
- case 'partId':
172
- id += this.info.part?.id || '';
173
- break;
174
- case 'partTypeId':
175
- id += this.info.part?.typeId || '';
176
- break;
177
- case 'partRoleId':
178
- id += this.info.part?.roleId || '';
179
- break;
180
- case 'metadata':
181
- id += this.info.part.metadata[metaIndex].value;
182
- break;
183
- }
184
- this.id.setValue(id);
185
- this.id.markAsDirty();
186
- this.id.updateValueAndValidity();
187
- }
188
- pickId() {
189
- if (this.idForm.invalid) {
190
- return;
191
- }
192
- this.idPick.emit(this.id.value);
193
- this.info = undefined;
194
- }
195
- resetId() {
196
- this.id.reset();
197
- this.id.markAsDirty();
198
- this.id.updateValueAndValidity();
199
- }
200
- }
201
- ScopedPinLookupComponentfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.3", ngImport: i0, type: ScopedPinLookupComponent, deps: [{ token: i1$1.FormBuilder }, { token: i1.ItemService }, { token: PinRefLookupService }, { token: 'indexLookupDefinitions' }], target: i0.ɵɵFactoryTarget.Component });
202
- ScopedPinLookupComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.3", 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 <!-- pin -->\n <tr>\n <td>\n <button\n type=\"button\"\n mat-icon-button\n color=\"primary\"\n (click)=\"appendIdComponent('pin')\"\n >\n <mat-icon>add_circle</mat-icon>\n </button>\n </td>\n <td>pin</td>\n <td>{{ info!.pin.value }}</td>\n </tr>\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"] }] });
203
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.3", ngImport: i0, type: ScopedPinLookupComponent, decorators: [{
204
- type: Component,
205
- 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 <!-- pin -->\n <tr>\n <td>\n <button\n type=\"button\"\n mat-icon-button\n color=\"primary\"\n (click)=\"appendIdComponent('pin')\"\n >\n <mat-icon>add_circle</mat-icon>\n </button>\n </td>\n <td>pin</td>\n <td>{{ info!.pin.value }}</td>\n </tr>\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"] }]
206
- }], ctorParameters: function () { return [{ type: i1$1.FormBuilder }, { type: i1.ItemService }, { type: PinRefLookupService }, { type: undefined, decorators: [{
207
- type: Inject,
208
- args: ['indexLookupDefinitions']
209
- }] }]; }, propDecorators: { idPick: [{
210
- type: Output
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
+ let id = this.id.value || '';
164
+ switch (type) {
165
+ case 'pin':
166
+ id += this.info?.pin.value;
167
+ break;
168
+ case 'itemId':
169
+ id += this.info.item?.id || '';
170
+ break;
171
+ case 'partId':
172
+ id += this.info.part?.id || '';
173
+ break;
174
+ case 'partTypeId':
175
+ id += this.info.part?.typeId || '';
176
+ break;
177
+ case 'partRoleId':
178
+ id += this.info.part?.roleId || '';
179
+ break;
180
+ case 'metadata':
181
+ id += this.info.part.metadata[metaIndex].value;
182
+ break;
183
+ }
184
+ this.id.setValue(id);
185
+ this.id.markAsDirty();
186
+ this.id.updateValueAndValidity();
187
+ }
188
+ pickId() {
189
+ if (this.idForm.invalid) {
190
+ return;
191
+ }
192
+ this.idPick.emit(this.id.value);
193
+ this.info = undefined;
194
+ }
195
+ resetId() {
196
+ this.id.reset();
197
+ this.id.markAsDirty();
198
+ this.id.updateValueAndValidity();
199
+ }
200
+ 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 }); }
201
+ static { thiscmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.0.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 <!-- pin -->\n <tr>\n <td>\n <button\n type=\"button\"\n mat-icon-button\n color=\"primary\"\n (click)=\"appendIdComponent('pin')\"\n >\n <mat-icon>add_circle</mat-icon>\n </button>\n </td>\n <td>pin</td>\n <td>{{ info!.pin.value }}</td>\n </tr>\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", "hideSingleSelectionIndicator"], 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"] }] }); }
202
+ }
203
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.1", ngImport: i0, type: ScopedPinLookupComponent, decorators: [{
204
+ type: Component,
205
+ 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 <!-- pin -->\n <tr>\n <td>\n <button\n type=\"button\"\n mat-icon-button\n color=\"primary\"\n (click)=\"appendIdComponent('pin')\"\n >\n <mat-icon>add_circle</mat-icon>\n </button>\n </td>\n <td>pin</td>\n <td>{{ info!.pin.value }}</td>\n </tr>\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"] }]
206
+ }], ctorParameters: function () { return [{ type: i1$1.FormBuilder }, { type: i1.ItemService }, { type: PinRefLookupService }, { type: undefined, decorators: [{
207
+ type: Inject,
208
+ args: ['indexLookupDefinitions']
209
+ }] }]; }, propDecorators: { idPick: [{
210
+ type: Output
211
211
  }] } });
212
212
 
213
- class AssertedIdComponent {
214
- constructor(formBuilder, lookupService, lookupDefs) {
215
- this.lookupService = lookupService;
216
- this.lookupDefs = lookupDefs;
217
- this.tag = formBuilder.control(null, Validators.maxLength(50));
218
- this.value = formBuilder.control(null, [
219
- Validators.required,
220
- Validators.maxLength(500),
221
- ]);
222
- this.scope = formBuilder.control(null, Validators.maxLength(500));
223
- this.assertion = formBuilder.control(null);
224
- this.form = formBuilder.group({
225
- tag: this.tag,
226
- value: this.value,
227
- scope: this.scope,
228
- assertion: this.assertion
229
- });
230
- this.lookupExpanded = false;
231
- // events
232
- this.idChange = new EventEmitter();
233
- this.editorClose = new EventEmitter();
234
- }
235
- get id() {
236
- return this._id;
237
- }
238
- set id(value) {
239
- if (this._id !== value) {
240
- this._id = value || undefined;
241
- this.updateForm(this._id);
242
- }
243
- }
244
- ngOnInit() {
245
- this.form.valueChanges.pipe(debounceTime(300)).subscribe((_) => {
246
- if (!this._updatingForm) {
247
- this.emitIdChange();
248
- }
249
- });
250
- }
251
- onAssertionChange(assertion) {
252
- this.assertion.setValue(assertion || null);
253
- }
254
- onIdPick(id) {
255
- this.value.setValue(id);
256
- this.value.markAsDirty();
257
- this.value.updateValueAndValidity();
258
- this.lookupExpanded = false;
259
- }
260
- updateForm(value) {
261
- this._updatingForm = true;
262
- if (!value) {
263
- this.form.reset();
264
- }
265
- else {
266
- this.tag.setValue(value.tag || null);
267
- this.value.setValue(value.value);
268
- this.scope.setValue(value.scope);
269
- this.assertion.setValue(value.assertion || null);
270
- this.form.markAsPristine();
271
- }
272
- this._updatingForm = false;
273
- // this.emitIdChange();
274
- }
275
- getId() {
276
- return {
277
- tag: this.tag.value?.trim(),
278
- value: this.value.value?.trim() || '',
279
- scope: this.scope.value?.trim() || '',
280
- assertion: this.assertion.value || undefined,
281
- };
282
- }
283
- emitIdChange() {
284
- if (!this.hasSubmit) {
285
- this._id = this.getId();
286
- this.idChange.emit(this._id);
287
- }
288
- }
289
- cancel() {
290
- this.editorClose.emit();
291
- }
292
- save() {
293
- if (this.form.valid) {
294
- this._id = this.getId();
295
- this.idChange.emit(this._id);
296
- }
297
- }
298
- }
299
- AssertedIdComponentfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.3", ngImport: i0, type: AssertedIdComponent, deps: [{ token: i1$1.FormBuilder }, { token: PinRefLookupService }, { token: 'indexLookupDefinitions' }], target: i0.ɵɵFactoryTarget.Component });
300
- AssertedIdComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.3", 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()\">\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=\"idScopeEntries?.length\" style=\"width: 8em\">\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\" 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]=\"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 mat-icon-button color=\"warn\" type=\"button\" (click)=\"cancel()\">\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"] }] });
301
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.3", ngImport: i0, type: AssertedIdComponent, decorators: [{
302
- type: Component,
303
- 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=\"idScopeEntries?.length\" style=\"width: 8em\">\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\" 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]=\"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 mat-icon-button color=\"warn\" type=\"button\" (click)=\"cancel()\">\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"] }]
304
- }], ctorParameters: function () { return [{ type: i1$1.FormBuilder }, { type: PinRefLookupService }, { type: undefined, decorators: [{
305
- type: Inject,
306
- args: ['indexLookupDefinitions']
307
- }] }]; }, propDecorators: { idScopeEntries: [{
308
- type: Input
309
- }], idTagEntries: [{
310
- type: Input
311
- }], assTagEntries: [{
312
- type: Input
313
- }], refTypeEntries: [{
314
- type: Input
315
- }], refTagEntries: [{
316
- type: Input
317
- }], id: [{
318
- type: Input
319
- }], noEidLookup: [{
320
- type: Input
321
- }], hasSubmit: [{
322
- type: Input
323
- }], idChange: [{
324
- type: Output
325
- }], editorClose: [{
326
- type: Output
213
+ class AssertedIdComponent {
214
+ get id() {
215
+ return this._id;
216
+ }
217
+ set id(value) {
218
+ if (this._id !== value) {
219
+ this._id = value || undefined;
220
+ this.updateForm(this._id);
221
+ }
222
+ }
223
+ constructor(formBuilder, lookupService, lookupDefs) {
224
+ this.lookupService = lookupService;
225
+ this.lookupDefs = lookupDefs;
226
+ this.tag = formBuilder.control(null, Validators.maxLength(50));
227
+ this.value = formBuilder.control(null, [
228
+ Validators.required,
229
+ Validators.maxLength(500),
230
+ ]);
231
+ this.scope = formBuilder.control(null, Validators.maxLength(500));
232
+ this.assertion = formBuilder.control(null);
233
+ this.form = formBuilder.group({
234
+ tag: this.tag,
235
+ value: this.value,
236
+ scope: this.scope,
237
+ assertion: this.assertion
238
+ });
239
+ this.lookupExpanded = false;
240
+ // events
241
+ this.idChange = new EventEmitter();
242
+ this.editorClose = new EventEmitter();
243
+ }
244
+ ngOnInit() {
245
+ this.form.valueChanges.pipe(debounceTime(300)).subscribe((_) => {
246
+ if (!this._updatingForm) {
247
+ this.emitIdChange();
248
+ }
249
+ });
250
+ }
251
+ onAssertionChange(assertion) {
252
+ this.assertion.setValue(assertion || null);
253
+ }
254
+ onIdPick(id) {
255
+ this.value.setValue(id);
256
+ this.value.markAsDirty();
257
+ this.value.updateValueAndValidity();
258
+ this.lookupExpanded = false;
259
+ }
260
+ updateForm(value) {
261
+ this._updatingForm = true;
262
+ if (!value) {
263
+ this.form.reset();
264
+ }
265
+ else {
266
+ this.tag.setValue(value.tag || null);
267
+ this.value.setValue(value.value);
268
+ this.scope.setValue(value.scope);
269
+ this.assertion.setValue(value.assertion || null);
270
+ this.form.markAsPristine();
271
+ }
272
+ this._updatingForm = false;
273
+ // this.emitIdChange();
274
+ }
275
+ getId() {
276
+ return {
277
+ tag: this.tag.value?.trim(),
278
+ value: this.value.value?.trim() || '',
279
+ scope: this.scope.value?.trim() || '',
280
+ assertion: this.assertion.value || undefined,
281
+ };
282
+ }
283
+ emitIdChange() {
284
+ if (!this.hasSubmit) {
285
+ this._id = this.getId();
286
+ this.idChange.emit(this._id);
287
+ }
288
+ }
289
+ cancel() {
290
+ this.editorClose.emit();
291
+ }
292
+ save() {
293
+ if (this.form.valid) {
294
+ this._id = this.getId();
295
+ this.idChange.emit(this._id);
296
+ }
297
+ }
298
+ 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 }); }
299
+ static { thiscmp = 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()\">\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=\"idScopeEntries?.length\" style=\"width: 8em\">\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\" 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]=\"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 mat-icon-button color=\"warn\" type=\"button\" (click)=\"cancel()\">\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", "hideSingleSelectionIndicator"], 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"] }] }); }
300
+ }
301
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.1", ngImport: i0, type: AssertedIdComponent, decorators: [{
302
+ type: Component,
303
+ 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=\"idScopeEntries?.length\" style=\"width: 8em\">\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\" 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]=\"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 mat-icon-button color=\"warn\" type=\"button\" (click)=\"cancel()\">\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"] }]
304
+ }], ctorParameters: function () { return [{ type: i1$1.FormBuilder }, { type: PinRefLookupService }, { type: undefined, decorators: [{
305
+ type: Inject,
306
+ args: ['indexLookupDefinitions']
307
+ }] }]; }, propDecorators: { idScopeEntries: [{
308
+ type: Input
309
+ }], idTagEntries: [{
310
+ type: Input
311
+ }], assTagEntries: [{
312
+ type: Input
313
+ }], refTypeEntries: [{
314
+ type: Input
315
+ }], refTagEntries: [{
316
+ type: Input
317
+ }], id: [{
318
+ type: Input
319
+ }], noEidLookup: [{
320
+ type: Input
321
+ }], hasSubmit: [{
322
+ type: Input
323
+ }], idChange: [{
324
+ type: Output
325
+ }], editorClose: [{
326
+ type: Output
327
327
  }] } });
328
328
 
329
- /**
330
- * Asserted IDs editor.
331
- */
332
- class AssertedIdsComponent {
333
- constructor(formBuilder, _dialogService) {
334
- this._dialogService = _dialogService;
335
- this._ids = [];
336
- this._editedIndex = -1;
337
- this.idsChange = new EventEmitter();
338
- this.entries = formBuilder.control([], { nonNullable: true });
339
- // form
340
- this.form = formBuilder.group({
341
- ids: this.entries,
342
- });
343
- }
344
- /**
345
- * The asserted IDs.
346
- */
347
- get ids() {
348
- return this._ids;
349
- }
350
- set ids(value) {
351
- if (this._ids !== value) {
352
- this._ids = value || [];
353
- this.updateForm(value);
354
- }
355
- }
356
- updateForm(ids) {
357
- if (!ids?.length) {
358
- this.form.reset();
359
- return;
360
- }
361
- this.entries.setValue(ids, { emitEvent: false });
362
- this.entries.updateValueAndValidity();
363
- this.form.markAsPristine();
364
- }
365
- emitIdsChange() {
366
- this.idsChange.emit(this.entries.value);
367
- }
368
- addId() {
369
- this.editId({
370
- scope: '',
371
- value: '',
372
- }, -1);
373
- }
374
- editId(id, index) {
375
- this._editedIndex = index;
376
- this.edited = id;
377
- }
378
- closeId() {
379
- this._editedIndex = -1;
380
- this.edited = undefined;
381
- }
382
- saveId(entry) {
383
- const entries = [...this.entries.value];
384
- if (this._editedIndex === -1) {
385
- entries.push(entry);
386
- }
387
- else {
388
- entries.splice(this._editedIndex, 1, entry);
389
- }
390
- this.entries.setValue(entries);
391
- this.entries.markAsDirty();
392
- this.entries.updateValueAndValidity();
393
- this.closeId();
394
- }
395
- deleteId(index) {
396
- this._dialogService
397
- .confirm('Confirmation', 'Delete ID?')
398
- .pipe(take(1))
399
- .subscribe((yes) => {
400
- if (yes) {
401
- if (this._editedIndex === index) {
402
- this.closeId();
403
- }
404
- const entries = [...this.entries.value];
405
- entries.splice(index, 1);
406
- this.entries.setValue(entries);
407
- this.entries.markAsDirty();
408
- this.entries.updateValueAndValidity();
409
- this.emitIdsChange();
410
- }
411
- });
412
- }
413
- moveIdUp(index) {
414
- if (index < 1) {
415
- return;
416
- }
417
- const entry = this.entries.value[index];
418
- const entries = [...this.entries.value];
419
- entries.splice(index, 1);
420
- entries.splice(index - 1, 0, entry);
421
- this.entries.setValue(entries);
422
- this.entries.markAsDirty();
423
- this.entries.updateValueAndValidity();
424
- this.emitIdsChange();
425
- }
426
- moveIdDown(index) {
427
- if (index + 1 >= this.entries.value.length) {
428
- return;
429
- }
430
- const entry = this.entries.value[index];
431
- const entries = [...this.entries.value];
432
- entries.splice(index, 1);
433
- entries.splice(index + 1, 0, entry);
434
- this.entries.setValue(entries);
435
- this.entries.markAsDirty();
436
- this.entries.updateValueAndValidity();
437
- this.emitIdsChange();
438
- }
439
- onIdChange(id) {
440
- this.saveId(id);
441
- this.emitIdsChange();
442
- }
443
- }
444
- AssertedIdsComponentfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.3", ngImport: i0, type: AssertedIdsComponent, deps: [{ token: i1$1.FormBuilder }, { token: i2.DialogService }], target: i0.ɵɵFactoryTarget.Component });
445
- AssertedIdsComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.3", 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: i8.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"] }] });
446
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.3", ngImport: i0, type: AssertedIdsComponent, decorators: [{
447
- type: Component,
448
- 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"] }]
449
- }], ctorParameters: function () { return [{ type: i1$1.FormBuilder }, { type: i2.DialogService }]; }, propDecorators: { ids: [{
450
- type: Input
451
- }], idScopeEntries: [{
452
- type: Input
453
- }], idTagEntries: [{
454
- type: Input
455
- }], assTagEntries: [{
456
- type: Input
457
- }], refTypeEntries: [{
458
- type: Input
459
- }], refTagEntries: [{
460
- type: Input
461
- }], idsChange: [{
462
- type: Output
329
+ /**
330
+ * Asserted IDs editor.
331
+ */
332
+ class AssertedIdsComponent {
333
+ /**
334
+ * The asserted IDs.
335
+ */
336
+ get ids() {
337
+ return this._ids;
338
+ }
339
+ set ids(value) {
340
+ if (this._ids !== value) {
341
+ this._ids = value || [];
342
+ this.updateForm(value);
343
+ }
344
+ }
345
+ constructor(formBuilder, _dialogService) {
346
+ this._dialogService = _dialogService;
347
+ this._ids = [];
348
+ this._editedIndex = -1;
349
+ this.idsChange = new EventEmitter();
350
+ this.entries = formBuilder.control([], { nonNullable: true });
351
+ // form
352
+ this.form = formBuilder.group({
353
+ ids: this.entries,
354
+ });
355
+ }
356
+ updateForm(ids) {
357
+ if (!ids?.length) {
358
+ this.form.reset();
359
+ return;
360
+ }
361
+ this.entries.setValue(ids, { emitEvent: false });
362
+ this.entries.updateValueAndValidity();
363
+ this.form.markAsPristine();
364
+ }
365
+ emitIdsChange() {
366
+ this.idsChange.emit(this.entries.value);
367
+ }
368
+ addId() {
369
+ this.editId({
370
+ scope: '',
371
+ value: '',
372
+ }, -1);
373
+ }
374
+ editId(id, index) {
375
+ this._editedIndex = index;
376
+ this.edited = id;
377
+ }
378
+ closeId() {
379
+ this._editedIndex = -1;
380
+ this.edited = undefined;
381
+ }
382
+ saveId(entry) {
383
+ const entries = [...this.entries.value];
384
+ if (this._editedIndex === -1) {
385
+ entries.push(entry);
386
+ }
387
+ else {
388
+ entries.splice(this._editedIndex, 1, entry);
389
+ }
390
+ this.entries.setValue(entries);
391
+ this.entries.markAsDirty();
392
+ this.entries.updateValueAndValidity();
393
+ this.closeId();
394
+ }
395
+ deleteId(index) {
396
+ this._dialogService
397
+ .confirm('Confirmation', 'Delete ID?')
398
+ .pipe(take(1))
399
+ .subscribe((yes) => {
400
+ if (yes) {
401
+ if (this._editedIndex === index) {
402
+ this.closeId();
403
+ }
404
+ const entries = [...this.entries.value];
405
+ entries.splice(index, 1);
406
+ this.entries.setValue(entries);
407
+ this.entries.markAsDirty();
408
+ this.entries.updateValueAndValidity();
409
+ this.emitIdsChange();
410
+ }
411
+ });
412
+ }
413
+ moveIdUp(index) {
414
+ if (index < 1) {
415
+ return;
416
+ }
417
+ const entry = this.entries.value[index];
418
+ const entries = [...this.entries.value];
419
+ entries.splice(index, 1);
420
+ entries.splice(index - 1, 0, entry);
421
+ this.entries.setValue(entries);
422
+ this.entries.markAsDirty();
423
+ this.entries.updateValueAndValidity();
424
+ this.emitIdsChange();
425
+ }
426
+ moveIdDown(index) {
427
+ if (index + 1 >= this.entries.value.length) {
428
+ return;
429
+ }
430
+ const entry = this.entries.value[index];
431
+ const entries = [...this.entries.value];
432
+ entries.splice(index, 1);
433
+ entries.splice(index + 1, 0, entry);
434
+ this.entries.setValue(entries);
435
+ this.entries.markAsDirty();
436
+ this.entries.updateValueAndValidity();
437
+ this.emitIdsChange();
438
+ }
439
+ onIdChange(id) {
440
+ this.saveId(id);
441
+ this.emitIdsChange();
442
+ }
443
+ 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 }); }
444
+ static { thiscmp = 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: i8.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"] }] }); }
445
+ }
446
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.1", ngImport: i0, type: AssertedIdsComponent, decorators: [{
447
+ type: Component,
448
+ 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"] }]
449
+ }], ctorParameters: function () { return [{ type: i1$1.FormBuilder }, { type: i2.DialogService }]; }, propDecorators: { ids: [{
450
+ type: Input
451
+ }], idScopeEntries: [{
452
+ type: Input
453
+ }], idTagEntries: [{
454
+ type: Input
455
+ }], assTagEntries: [{
456
+ type: Input
457
+ }], refTypeEntries: [{
458
+ type: Input
459
+ }], refTagEntries: [{
460
+ type: Input
461
+ }], idsChange: [{
462
+ type: Output
463
463
  }] } });
464
464
 
465
- class CadmusRefsAssertedIdsModule {
466
- }
467
- CadmusRefsAssertedIdsModulefac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.3", ngImport: i0, type: CadmusRefsAssertedIdsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
468
- CadmusRefsAssertedIdsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.1.3", ngImport: i0, type: CadmusRefsAssertedIdsModule, declarations: [AssertedIdComponent,
469
- AssertedIdsComponent,
470
- ScopedPinLookupComponent], imports: [CommonModule,
471
- FormsModule,
472
- ReactiveFormsModule,
473
- // material
474
- MatButtonModule,
475
- MatExpansionModule,
476
- MatFormFieldModule,
477
- MatIconModule,
478
- MatInputModule,
479
- MatSelectModule,
480
- // Cadmus
481
- CadmusCoreModule,
482
- CadmusRefsDocReferencesModule,
483
- CadmusRefsAssertionModule,
484
- CadmusRefsLookupModule,
485
- CadmusApiModule], exports: [AssertedIdComponent,
486
- AssertedIdsComponent,
487
- ScopedPinLookupComponent] });
488
- CadmusRefsAssertedIdsModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.1.3", ngImport: i0, type: CadmusRefsAssertedIdsModule, imports: [CommonModule,
489
- FormsModule,
490
- ReactiveFormsModule,
491
- // material
492
- MatButtonModule,
493
- MatExpansionModule,
494
- MatFormFieldModule,
495
- MatIconModule,
496
- MatInputModule,
497
- MatSelectModule,
498
- // Cadmus
499
- CadmusCoreModule,
500
- CadmusRefsDocReferencesModule,
501
- CadmusRefsAssertionModule,
502
- CadmusRefsLookupModule,
503
- CadmusApiModule] });
504
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.3", ngImport: i0, type: CadmusRefsAssertedIdsModule, decorators: [{
505
- type: NgModule,
506
- args: [{
507
- declarations: [
508
- AssertedIdComponent,
509
- AssertedIdsComponent,
510
- ScopedPinLookupComponent,
511
- ],
512
- imports: [
513
- CommonModule,
514
- FormsModule,
515
- ReactiveFormsModule,
516
- // material
517
- MatButtonModule,
518
- MatExpansionModule,
519
- MatFormFieldModule,
520
- MatIconModule,
521
- MatInputModule,
522
- MatSelectModule,
523
- // Cadmus
524
- CadmusCoreModule,
525
- CadmusRefsDocReferencesModule,
526
- CadmusRefsAssertionModule,
527
- CadmusRefsLookupModule,
528
- CadmusApiModule,
529
- ],
530
- exports: [
531
- AssertedIdComponent,
532
- AssertedIdsComponent,
533
- ScopedPinLookupComponent,
534
- ],
535
- }]
465
+ class CadmusRefsAssertedIdsModule {
466
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.1", ngImport: i0, type: CadmusRefsAssertedIdsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
467
+ static { thismod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.0.1", ngImport: i0, type: CadmusRefsAssertedIdsModule, declarations: [AssertedIdComponent,
468
+ AssertedIdsComponent,
469
+ ScopedPinLookupComponent], imports: [CommonModule,
470
+ FormsModule,
471
+ ReactiveFormsModule,
472
+ // material
473
+ MatButtonModule,
474
+ MatExpansionModule,
475
+ MatFormFieldModule,
476
+ MatIconModule,
477
+ MatInputModule,
478
+ MatSelectModule,
479
+ // Cadmus
480
+ CadmusCoreModule,
481
+ CadmusRefsDocReferencesModule,
482
+ CadmusRefsAssertionModule,
483
+ CadmusRefsLookupModule,
484
+ CadmusApiModule], exports: [AssertedIdComponent,
485
+ AssertedIdsComponent,
486
+ ScopedPinLookupComponent] }); }
487
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.0.1", ngImport: i0, type: CadmusRefsAssertedIdsModule, imports: [CommonModule,
488
+ FormsModule,
489
+ ReactiveFormsModule,
490
+ // material
491
+ MatButtonModule,
492
+ MatExpansionModule,
493
+ MatFormFieldModule,
494
+ MatIconModule,
495
+ MatInputModule,
496
+ MatSelectModule,
497
+ // Cadmus
498
+ CadmusCoreModule,
499
+ CadmusRefsDocReferencesModule,
500
+ CadmusRefsAssertionModule,
501
+ CadmusRefsLookupModule,
502
+ CadmusApiModule] }); }
503
+ }
504
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.1", ngImport: i0, type: CadmusRefsAssertedIdsModule, decorators: [{
505
+ type: NgModule,
506
+ args: [{
507
+ declarations: [
508
+ AssertedIdComponent,
509
+ AssertedIdsComponent,
510
+ ScopedPinLookupComponent,
511
+ ],
512
+ imports: [
513
+ CommonModule,
514
+ FormsModule,
515
+ ReactiveFormsModule,
516
+ // material
517
+ MatButtonModule,
518
+ MatExpansionModule,
519
+ MatFormFieldModule,
520
+ MatIconModule,
521
+ MatInputModule,
522
+ MatSelectModule,
523
+ // Cadmus
524
+ CadmusCoreModule,
525
+ CadmusRefsDocReferencesModule,
526
+ CadmusRefsAssertionModule,
527
+ CadmusRefsLookupModule,
528
+ CadmusApiModule,
529
+ ],
530
+ exports: [
531
+ AssertedIdComponent,
532
+ AssertedIdsComponent,
533
+ ScopedPinLookupComponent,
534
+ ],
535
+ }]
536
536
  }] });
537
537
 
538
- /*
539
- * Public API Surface of cadmus-refs-asserted-ids
538
+ /*
539
+ * Public API Surface of cadmus-refs-asserted-ids
540
540
  */
541
541
 
542
- /**
543
- * Generated bundle index. Do not edit.
542
+ /**
543
+ * Generated bundle index. Do not edit.
544
544
  */
545
545
 
546
546
  export { AssertedIdComponent, AssertedIdsComponent, CadmusRefsAssertedIdsModule, PinRefLookupService, ScopedPinLookupComponent };