@myrmidon/cadmus-refs-asserted-ids 7.0.0 → 8.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.
- package/README.md +213 -133
- package/fesm2022/myrmidon-cadmus-refs-asserted-ids.mjs +425 -285
- package/fesm2022/myrmidon-cadmus-refs-asserted-ids.mjs.map +1 -1
- package/lib/asserted-composite-id/asserted-composite-id.component.d.ts +20 -23
- package/lib/asserted-composite-ids/asserted-composite-ids.component.d.ts +15 -16
- package/lib/asserted-id/asserted-id.component.d.ts +29 -15
- package/lib/asserted-ids/asserted-ids.component.d.ts +8 -16
- package/lib/pin-target-lookup/pin-target-lookup.component.d.ts +22 -22
- package/lib/scoped-pin-lookup/scoped-pin-lookup.component.d.ts +5 -3
- package/package.json +5 -4
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { Injectable,
|
|
2
|
+
import { Injectable, output, Component, Inject, input, model, effect, Input } from '@angular/core';
|
|
3
3
|
import * as i1$1 from '@angular/forms';
|
|
4
4
|
import { Validators, FormsModule, ReactiveFormsModule } from '@angular/forms';
|
|
5
5
|
import { debounceTime } from 'rxjs/operators';
|
|
@@ -38,6 +38,7 @@ import * as i4$1 from '@angular/material/snack-bar';
|
|
|
38
38
|
* to an index lookup definition. The resulting items are of type DataPinInfo.
|
|
39
39
|
*/
|
|
40
40
|
class PinRefLookupService {
|
|
41
|
+
_itemService;
|
|
41
42
|
constructor(_itemService) {
|
|
42
43
|
this._itemService = _itemService;
|
|
43
44
|
}
|
|
@@ -102,10 +103,10 @@ class PinRefLookupService {
|
|
|
102
103
|
}
|
|
103
104
|
}));
|
|
104
105
|
}
|
|
105
|
-
static
|
|
106
|
-
static
|
|
106
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: PinRefLookupService, deps: [{ token: i1.ItemService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
107
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: PinRefLookupService, providedIn: 'root' });
|
|
107
108
|
}
|
|
108
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.
|
|
109
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: PinRefLookupService, decorators: [{
|
|
109
110
|
type: Injectable,
|
|
110
111
|
args: [{
|
|
111
112
|
providedIn: 'root',
|
|
@@ -122,6 +123,21 @@ const METADATA_PART_ID$1 = 'it.vedph.metadata';
|
|
|
122
123
|
* some EID by variously assembling these components.
|
|
123
124
|
*/
|
|
124
125
|
class ScopedPinLookupComponent {
|
|
126
|
+
_itemService;
|
|
127
|
+
lookupService;
|
|
128
|
+
lookupDefs;
|
|
129
|
+
// lookup
|
|
130
|
+
key;
|
|
131
|
+
keyForm;
|
|
132
|
+
keys;
|
|
133
|
+
info;
|
|
134
|
+
// builder
|
|
135
|
+
id;
|
|
136
|
+
idForm;
|
|
137
|
+
/**
|
|
138
|
+
* Emitted whenever the user picks an ID.
|
|
139
|
+
*/
|
|
140
|
+
idPick = output();
|
|
125
141
|
constructor(formBuilder, _itemService, lookupService, lookupDefs) {
|
|
126
142
|
this._itemService = _itemService;
|
|
127
143
|
this.lookupService = lookupService;
|
|
@@ -142,8 +158,6 @@ class ScopedPinLookupComponent {
|
|
|
142
158
|
this.idForm = formBuilder.group({
|
|
143
159
|
id: this.id,
|
|
144
160
|
});
|
|
145
|
-
// event
|
|
146
|
-
this.idPick = new EventEmitter();
|
|
147
161
|
}
|
|
148
162
|
ngOnInit() {
|
|
149
163
|
// pre-select a unique key
|
|
@@ -159,15 +173,21 @@ class ScopedPinLookupComponent {
|
|
|
159
173
|
};
|
|
160
174
|
// lookup item and its metadata part if any
|
|
161
175
|
forkJoin({
|
|
162
|
-
item:
|
|
163
|
-
|
|
176
|
+
item: item
|
|
177
|
+
? this._itemService.getItem(item.itemId, false, true)
|
|
178
|
+
: of(null),
|
|
179
|
+
part: item
|
|
180
|
+
? this._itemService.getPartFromTypeAndRole(item.itemId, METADATA_PART_ID$1, undefined, true)
|
|
181
|
+
: of(null),
|
|
164
182
|
})
|
|
165
183
|
.pipe(take(1))
|
|
166
184
|
.subscribe({
|
|
167
185
|
next: (result) => {
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
186
|
+
if (result.item) {
|
|
187
|
+
info.item = result.item;
|
|
188
|
+
info.part = result.part;
|
|
189
|
+
this.info = info;
|
|
190
|
+
}
|
|
171
191
|
},
|
|
172
192
|
error: (error) => {
|
|
173
193
|
console.error(error ? JSON.stringify(error) : 'Error loading item/metadata');
|
|
@@ -212,10 +232,10 @@ class ScopedPinLookupComponent {
|
|
|
212
232
|
this.id.markAsDirty();
|
|
213
233
|
this.id.updateValueAndValidity();
|
|
214
234
|
}
|
|
215
|
-
static
|
|
216
|
-
static
|
|
235
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: ScopedPinLookupComponent, deps: [{ token: i1$1.FormBuilder }, { token: i1.ItemService }, { token: PinRefLookupService }, { token: 'indexLookupDefinitions' }], target: i0.ɵɵFactoryTarget.Component });
|
|
236
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.5", type: ScopedPinLookupComponent, isStandalone: true, 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 @if (keys.length > 1) {\n <mat-form-field>\n <mat-label>type</mat-label>\n <mat-select [formControl]=\"key\">\n @for (k of keys; track k) {\n <mat-option [value]=\"k\">{{ k }}</mat-option>\n }\n </mat-select>\n @if ($any(key).errors?.required && (key.dirty || key.touched)) {\n <mat-error>type required</mat-error>\n }\n </mat-form-field>\n }\n <cadmus-ref-lookup\n [service]=\"lookupService\"\n label=\"pin\"\n [options]=\"key.value ? lookupDefs[key.value] : undefined\"\n (itemChange)=\"onItemChange($event)\"\n />\n </form>\n </div>\n\n <!-- builder -->\n @if (info) {\n <mat-expansion-panel [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 @if ($any(id).errors?.required && (id.dirty || id.touched)) {\n <mat-error>ID required</mat-error>\n } @if ($any(id).errors?.maxLength && (id.dirty || id.touched)) {\n <mat-error>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 class=\"mat-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 class=\"mat-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 (click)=\"appendIdComponent('pin')\"\n >\n <mat-icon class=\"mat-primary\">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 (click)=\"appendIdComponent('itemId')\"\n >\n <mat-icon class=\"mat-primary\">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 (click)=\"appendIdComponent('partId')\"\n >\n <mat-icon class=\"mat-primary\">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 (click)=\"appendIdComponent('partTypeId')\"\n >\n <mat-icon class=\"mat-primary\">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 (click)=\"appendIdComponent('partRoleId')\"\n >\n <mat-icon class=\"mat-primary\">add_circle</mat-icon>\n </button>\n </td>\n <td>part role ID</td>\n <td>{{ info!.part?.roleId }}</td>\n </tr>\n <!-- part's metadata -->\n @for (m of info!.part?.metadata; track m; let i = $index) {\n <tr>\n <td>\n <button\n type=\"button\"\n mat-icon-button\n (click)=\"appendIdComponent('metadata', i)\"\n >\n <mat-icon class=\"mat-primary\">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 }\n </tbody>\n </table>\n </mat-expansion-panel>\n }\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: "ngmodule", type: FormsModule }, { 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: "ngmodule", type: ReactiveFormsModule }, { 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: "ngmodule", type: MatButtonModule }, { kind: "component", type: i3.MatIconButton, selector: "button[mat-icon-button]", exportAs: ["matButton"] }, { kind: "ngmodule", type: MatExpansionModule }, { kind: "component", type: i4.MatExpansionPanel, selector: "mat-expansion-panel", inputs: ["hideToggle", "togglePosition"], outputs: ["afterExpand", "afterCollapse"], exportAs: ["matExpansionPanel"] }, { kind: "component", type: i4.MatExpansionPanelHeader, selector: "mat-expansion-panel-header", inputs: ["expandedHeight", "collapsedHeight", "tabIndex"] }, { kind: "ngmodule", type: MatFormFieldModule }, { kind: "component", type: i6.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i6.MatLabel, selector: "mat-label" }, { kind: "directive", type: i6.MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "directive", type: i6.MatSuffix, selector: "[matSuffix], [matIconSuffix], [matTextSuffix]", inputs: ["matTextSuffix"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i7.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: MatInputModule }, { kind: "directive", type: i8.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly", "disabledInteractive"], exportAs: ["matInput"] }, { kind: "ngmodule", type: MatSelectModule }, { kind: "component", type: i9.MatSelect, selector: "mat-select", inputs: ["aria-describedby", "panelClass", "disabled", "disableRipple", "tabIndex", "hideSingleSelectionIndicator", "placeholder", "required", "multiple", "disableOptionCentering", "compareWith", "value", "aria-label", "aria-labelledby", "errorStateMatcher", "typeaheadDebounceInterval", "sortComparator", "id", "panelWidth", "canSelectNullableOptions"], outputs: ["openedChange", "opened", "closed", "selectionChange", "valueChange"], exportAs: ["matSelect"] }, { kind: "component", type: i10.MatOption, selector: "mat-option", inputs: ["value", "id", "disabled"], outputs: ["onSelectionChange"], exportAs: ["matOption"] }, { kind: "component", type: RefLookupComponent, selector: "cadmus-ref-lookup", inputs: ["label", "limit", "baseFilter", "service", "item", "required", "hasMore", "linkTemplate", "optDialog", "options"], outputs: ["itemChange", "optionsChange", "moreRequest"] }] });
|
|
217
237
|
}
|
|
218
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.
|
|
238
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: ScopedPinLookupComponent, decorators: [{
|
|
219
239
|
type: Component,
|
|
220
240
|
args: [{ selector: 'cadmus-scoped-pin-lookup', imports: [
|
|
221
241
|
FormsModule,
|
|
@@ -227,24 +247,53 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.1", ngImpor
|
|
|
227
247
|
MatInputModule,
|
|
228
248
|
MatSelectModule,
|
|
229
249
|
RefLookupComponent,
|
|
230
|
-
], template: "<div>\n <!-- lookup -->\n <div>\n <form [formGroup]=\"keyForm\" class=\"form-row\">\n <!-- key -->\n @if (keys.length > 1) {\n <mat-form-field>\n <mat-label>type</mat-label>\n <mat-select [formControl]=\"key\">\n @for (k of keys; track k) {\n <mat-option [value]=\"k\">{{ k }}</mat-option>\n }\n </mat-select>\n @if ($any(key).errors?.required && (key.dirty || key.touched)) {\n <mat-error>type required</mat-error>\n }\n </mat-form-field>\n }\n <cadmus-ref-lookup\n [service]=\"lookupService\"\n label=\"pin\"\n [options]=\"key.value ? lookupDefs[key.value] : undefined\"\n (itemChange)=\"onItemChange($event)\"\n
|
|
250
|
+
], template: "<div>\n <!-- lookup -->\n <div>\n <form [formGroup]=\"keyForm\" class=\"form-row\">\n <!-- key -->\n @if (keys.length > 1) {\n <mat-form-field>\n <mat-label>type</mat-label>\n <mat-select [formControl]=\"key\">\n @for (k of keys; track k) {\n <mat-option [value]=\"k\">{{ k }}</mat-option>\n }\n </mat-select>\n @if ($any(key).errors?.required && (key.dirty || key.touched)) {\n <mat-error>type required</mat-error>\n }\n </mat-form-field>\n }\n <cadmus-ref-lookup\n [service]=\"lookupService\"\n label=\"pin\"\n [options]=\"key.value ? lookupDefs[key.value] : undefined\"\n (itemChange)=\"onItemChange($event)\"\n />\n </form>\n </div>\n\n <!-- builder -->\n @if (info) {\n <mat-expansion-panel [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 @if ($any(id).errors?.required && (id.dirty || id.touched)) {\n <mat-error>ID required</mat-error>\n } @if ($any(id).errors?.maxLength && (id.dirty || id.touched)) {\n <mat-error>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 class=\"mat-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 class=\"mat-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 (click)=\"appendIdComponent('pin')\"\n >\n <mat-icon class=\"mat-primary\">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 (click)=\"appendIdComponent('itemId')\"\n >\n <mat-icon class=\"mat-primary\">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 (click)=\"appendIdComponent('partId')\"\n >\n <mat-icon class=\"mat-primary\">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 (click)=\"appendIdComponent('partTypeId')\"\n >\n <mat-icon class=\"mat-primary\">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 (click)=\"appendIdComponent('partRoleId')\"\n >\n <mat-icon class=\"mat-primary\">add_circle</mat-icon>\n </button>\n </td>\n <td>part role ID</td>\n <td>{{ info!.part?.roleId }}</td>\n </tr>\n <!-- part's metadata -->\n @for (m of info!.part?.metadata; track m; let i = $index) {\n <tr>\n <td>\n <button\n type=\"button\"\n mat-icon-button\n (click)=\"appendIdComponent('metadata', i)\"\n >\n <mat-icon class=\"mat-primary\">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 }\n </tbody>\n </table>\n </mat-expansion-panel>\n }\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"] }]
|
|
231
251
|
}], ctorParameters: () => [{ type: i1$1.FormBuilder }, { type: i1.ItemService }, { type: PinRefLookupService }, { type: undefined, decorators: [{
|
|
232
252
|
type: Inject,
|
|
233
253
|
args: ['indexLookupDefinitions']
|
|
234
|
-
}] }]
|
|
235
|
-
type: Output
|
|
236
|
-
}] } });
|
|
254
|
+
}] }] });
|
|
237
255
|
|
|
256
|
+
/**
|
|
257
|
+
* Asserted ID editor component.
|
|
258
|
+
*/
|
|
238
259
|
class AssertedIdComponent {
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
260
|
+
lookupService;
|
|
261
|
+
lookupDefs;
|
|
262
|
+
_sub;
|
|
263
|
+
_updatingForm;
|
|
264
|
+
tag;
|
|
265
|
+
value;
|
|
266
|
+
label;
|
|
267
|
+
scope;
|
|
268
|
+
assertion;
|
|
269
|
+
form;
|
|
270
|
+
lookupExpanded;
|
|
271
|
+
// asserted-id-scopes
|
|
272
|
+
idScopeEntries = input();
|
|
273
|
+
// asserted-id-tags
|
|
274
|
+
idTagEntries = input();
|
|
275
|
+
// assertion-tags
|
|
276
|
+
assTagEntries = input();
|
|
277
|
+
// doc-reference-types
|
|
278
|
+
refTypeEntries = input();
|
|
279
|
+
// doc-reference-tags
|
|
280
|
+
refTagEntries = input();
|
|
281
|
+
/**
|
|
282
|
+
* The asserted ID being edited.
|
|
283
|
+
*/
|
|
284
|
+
id = model();
|
|
285
|
+
/**
|
|
286
|
+
* True to hide the pin-based EID lookup UI.
|
|
287
|
+
*/
|
|
288
|
+
noEidLookup = input();
|
|
289
|
+
/**
|
|
290
|
+
* True to show the submit button.
|
|
291
|
+
*/
|
|
292
|
+
hasSubmit = input();
|
|
293
|
+
/**
|
|
294
|
+
* Emitted when the editor is closed.
|
|
295
|
+
*/
|
|
296
|
+
editorClose = output();
|
|
248
297
|
constructor(formBuilder, lookupService, lookupDefs) {
|
|
249
298
|
this.lookupService = lookupService;
|
|
250
299
|
this.lookupDefs = lookupDefs;
|
|
@@ -264,17 +313,23 @@ class AssertedIdComponent {
|
|
|
264
313
|
assertion: this.assertion,
|
|
265
314
|
});
|
|
266
315
|
this.lookupExpanded = false;
|
|
267
|
-
//
|
|
268
|
-
|
|
269
|
-
|
|
316
|
+
// when id changes, update form
|
|
317
|
+
effect(() => {
|
|
318
|
+
this.updateForm(this.id());
|
|
319
|
+
});
|
|
270
320
|
}
|
|
271
321
|
ngOnInit() {
|
|
272
|
-
this.form.valueChanges
|
|
322
|
+
this._sub = this.form.valueChanges
|
|
323
|
+
.pipe(debounceTime(300))
|
|
324
|
+
.subscribe((_) => {
|
|
273
325
|
if (!this._updatingForm) {
|
|
274
326
|
this.emitIdChange();
|
|
275
327
|
}
|
|
276
328
|
});
|
|
277
329
|
}
|
|
330
|
+
ngOnDestroy() {
|
|
331
|
+
this._sub?.unsubscribe();
|
|
332
|
+
}
|
|
278
333
|
onAssertionChange(assertion) {
|
|
279
334
|
this.assertion.setValue(assertion || null);
|
|
280
335
|
}
|
|
@@ -309,9 +364,8 @@ class AssertedIdComponent {
|
|
|
309
364
|
};
|
|
310
365
|
}
|
|
311
366
|
emitIdChange() {
|
|
312
|
-
if (!this.hasSubmit) {
|
|
313
|
-
this.
|
|
314
|
-
this.idChange.emit(this._id);
|
|
367
|
+
if (!this.hasSubmit()) {
|
|
368
|
+
this.id.set(this.getId());
|
|
315
369
|
}
|
|
316
370
|
}
|
|
317
371
|
cancel() {
|
|
@@ -319,14 +373,13 @@ class AssertedIdComponent {
|
|
|
319
373
|
}
|
|
320
374
|
save() {
|
|
321
375
|
if (this.form.valid) {
|
|
322
|
-
this.
|
|
323
|
-
this.idChange.emit(this._id);
|
|
376
|
+
this.id.set(this.getId());
|
|
324
377
|
}
|
|
325
378
|
}
|
|
326
|
-
static
|
|
327
|
-
static
|
|
379
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: AssertedIdComponent, deps: [{ token: i1$1.FormBuilder }, { token: PinRefLookupService }, { token: 'indexLookupDefinitions' }], target: i0.ɵɵFactoryTarget.Component });
|
|
380
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.5", type: AssertedIdComponent, isStandalone: true, selector: "cadmus-refs-asserted-id", inputs: { idScopeEntries: { classPropertyName: "idScopeEntries", publicName: "idScopeEntries", isSignal: true, isRequired: false, transformFunction: null }, idTagEntries: { classPropertyName: "idTagEntries", publicName: "idTagEntries", isSignal: true, isRequired: false, transformFunction: null }, assTagEntries: { classPropertyName: "assTagEntries", publicName: "assTagEntries", isSignal: true, isRequired: false, transformFunction: null }, refTypeEntries: { classPropertyName: "refTypeEntries", publicName: "refTypeEntries", isSignal: true, isRequired: false, transformFunction: null }, refTagEntries: { classPropertyName: "refTagEntries", publicName: "refTagEntries", isSignal: true, isRequired: false, transformFunction: null }, id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, noEidLookup: { classPropertyName: "noEidLookup", publicName: "noEidLookup", isSignal: true, isRequired: false, transformFunction: null }, hasSubmit: { classPropertyName: "hasSubmit", publicName: "hasSubmit", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { id: "idChange", editorClose: "editorClose" }, ngImport: i0, template: "<form [formGroup]=\"form\" (submit)=\"save()\">\n <div>\n <div class=\"form-row\">\n <!-- tag (bound) -->\n @if (idTagEntries()?.length) {\n <mat-form-field>\n <mat-label>tag</mat-label>\n <mat-select [formControl]=\"tag\">\n @for (e of idTagEntries(); track e) {\n <mat-option [value]=\"e.id\">{{ e.value }}</mat-option>\n }\n </mat-select>\n </mat-form-field>\n }\n <!-- tag (free) -->\n @else {\n <mat-form-field>\n <mat-label>tag</mat-label>\n <input matInput [formControl]=\"tag\" />\n @if ($any(tag.errors)?.maxLength && (tag.dirty || tag.touched)) {\n <mat-error>tag too long</mat-error>\n }\n </mat-form-field>\n }\n\n <!-- scope (bound) -->\n @if (idScopeEntries()?.length) {\n <mat-form-field>\n <mat-label>scope</mat-label>\n <mat-select [formControl]=\"scope\">\n @for (e of idScopeEntries(); track e) {\n <mat-option [value]=\"e.id\">{{ e.value }}</mat-option>\n }\n </mat-select>\n </mat-form-field>\n }\n <!-- scope (free) -->\n @else {\n <mat-form-field>\n <mat-label>scope</mat-label>\n <input matInput [formControl]=\"scope\" />\n @if ($any(scope.errors)?.maxLength && (scope.dirty || scope.touched)) {\n <mat-error>scope too long</mat-error>\n }\n </mat-form-field>\n }\n\n <!-- value -->\n <mat-form-field>\n <mat-label>value</mat-label>\n <input matInput [formControl]=\"value\" />\n @if ($any(value.errors)?.required && (value.dirty || value.touched)) {\n <mat-error>value required</mat-error>\n } @if ($any(value.errors)?.maxLength && (value.dirty || value.touched))\n {\n <mat-error>value too long</mat-error>\n }\n </mat-form-field>\n\n <!-- label -->\n <mat-form-field>\n <mat-label>label</mat-label>\n <input matInput [formControl]=\"label\" />\n @if ($any(label.errors)?.maxLength && (label.dirty || label.touched)) {\n <mat-error>label too long</mat-error>\n }\n </mat-form-field>\n\n <!-- lookup -->\n @if (!noEidLookup()) {\n <div>\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 }\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 || undefined\"\n (assertionChange)=\"onAssertionChange($event)\"\n >\n </cadmus-refs-assertion>\n </mat-expansion-panel>\n </div>\n\n <!-- buttons -->\n @if (hasSubmit()) {\n <div>\n <button mat-icon-button type=\"button\" (click)=\"cancel()\">\n <mat-icon class=\"mat-warn\">close</mat-icon>\n </button>\n <button mat-icon-button type=\"submit\" [disabled]=\"form.invalid\">\n <mat-icon class=\"mat-primary\">check_circle</mat-icon>\n </button>\n </div>\n }\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: "ngmodule", type: FormsModule }, { 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: "ngmodule", type: ReactiveFormsModule }, { 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: "ngmodule", type: MatButtonModule }, { kind: "component", type: i3.MatIconButton, selector: "button[mat-icon-button]", exportAs: ["matButton"] }, { kind: "ngmodule", type: MatExpansionModule }, { kind: "component", type: i4.MatExpansionPanel, selector: "mat-expansion-panel", inputs: ["hideToggle", "togglePosition"], outputs: ["afterExpand", "afterCollapse"], exportAs: ["matExpansionPanel"] }, { kind: "component", type: i4.MatExpansionPanelHeader, selector: "mat-expansion-panel-header", inputs: ["expandedHeight", "collapsedHeight", "tabIndex"] }, { kind: "ngmodule", type: MatFormFieldModule }, { kind: "component", type: i6.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i6.MatLabel, selector: "mat-label" }, { kind: "directive", type: i6.MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i7.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: MatInputModule }, { kind: "directive", type: i8.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly", "disabledInteractive"], exportAs: ["matInput"] }, { kind: "ngmodule", type: MatSelectModule }, { kind: "component", type: i9.MatSelect, selector: "mat-select", inputs: ["aria-describedby", "panelClass", "disabled", "disableRipple", "tabIndex", "hideSingleSelectionIndicator", "placeholder", "required", "multiple", "disableOptionCentering", "compareWith", "value", "aria-label", "aria-labelledby", "errorStateMatcher", "typeaheadDebounceInterval", "sortComparator", "id", "panelWidth", "canSelectNullableOptions"], outputs: ["openedChange", "opened", "closed", "selectionChange", "valueChange"], exportAs: ["matSelect"] }, { kind: "component", type: i10.MatOption, selector: "mat-option", inputs: ["value", "id", "disabled"], outputs: ["onSelectionChange"], exportAs: ["matOption"] }, { kind: "component", type: AssertionComponent, selector: "cadmus-refs-assertion", inputs: ["assTagEntries", "refTypeEntries", "refTagEntries", "assertion"], outputs: ["assertionChange"] }, { kind: "component", type: ScopedPinLookupComponent, selector: "cadmus-scoped-pin-lookup", outputs: ["idPick"] }] });
|
|
328
381
|
}
|
|
329
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.
|
|
382
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: AssertedIdComponent, decorators: [{
|
|
330
383
|
type: Component,
|
|
331
384
|
args: [{ selector: 'cadmus-refs-asserted-id', imports: [
|
|
332
385
|
FormsModule,
|
|
@@ -339,58 +392,47 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.1", ngImpor
|
|
|
339
392
|
MatSelectModule,
|
|
340
393
|
AssertionComponent,
|
|
341
394
|
ScopedPinLookupComponent,
|
|
342
|
-
], template: "<form [formGroup]=\"form\" (submit)=\"save()\">\n <div>\n <div class=\"form-row\">\n <!-- tag (bound) -->\n @if (idTagEntries?.length) {\n <mat-form-field>\n <mat-label>tag</mat-label>\n <mat-select [formControl]=\"tag\">\n @for (e of idTagEntries; track e) {\n <mat-option [value]=\"e.id\">{{ e.value }}</mat-option>\n }\n </mat-select>\n </mat-form-field>\n }\n <!-- tag (free) -->\n @
|
|
395
|
+
], template: "<form [formGroup]=\"form\" (submit)=\"save()\">\n <div>\n <div class=\"form-row\">\n <!-- tag (bound) -->\n @if (idTagEntries()?.length) {\n <mat-form-field>\n <mat-label>tag</mat-label>\n <mat-select [formControl]=\"tag\">\n @for (e of idTagEntries(); track e) {\n <mat-option [value]=\"e.id\">{{ e.value }}</mat-option>\n }\n </mat-select>\n </mat-form-field>\n }\n <!-- tag (free) -->\n @else {\n <mat-form-field>\n <mat-label>tag</mat-label>\n <input matInput [formControl]=\"tag\" />\n @if ($any(tag.errors)?.maxLength && (tag.dirty || tag.touched)) {\n <mat-error>tag too long</mat-error>\n }\n </mat-form-field>\n }\n\n <!-- scope (bound) -->\n @if (idScopeEntries()?.length) {\n <mat-form-field>\n <mat-label>scope</mat-label>\n <mat-select [formControl]=\"scope\">\n @for (e of idScopeEntries(); track e) {\n <mat-option [value]=\"e.id\">{{ e.value }}</mat-option>\n }\n </mat-select>\n </mat-form-field>\n }\n <!-- scope (free) -->\n @else {\n <mat-form-field>\n <mat-label>scope</mat-label>\n <input matInput [formControl]=\"scope\" />\n @if ($any(scope.errors)?.maxLength && (scope.dirty || scope.touched)) {\n <mat-error>scope too long</mat-error>\n }\n </mat-form-field>\n }\n\n <!-- value -->\n <mat-form-field>\n <mat-label>value</mat-label>\n <input matInput [formControl]=\"value\" />\n @if ($any(value.errors)?.required && (value.dirty || value.touched)) {\n <mat-error>value required</mat-error>\n } @if ($any(value.errors)?.maxLength && (value.dirty || value.touched))\n {\n <mat-error>value too long</mat-error>\n }\n </mat-form-field>\n\n <!-- label -->\n <mat-form-field>\n <mat-label>label</mat-label>\n <input matInput [formControl]=\"label\" />\n @if ($any(label.errors)?.maxLength && (label.dirty || label.touched)) {\n <mat-error>label too long</mat-error>\n }\n </mat-form-field>\n\n <!-- lookup -->\n @if (!noEidLookup()) {\n <div>\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 }\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 || undefined\"\n (assertionChange)=\"onAssertionChange($event)\"\n >\n </cadmus-refs-assertion>\n </mat-expansion-panel>\n </div>\n\n <!-- buttons -->\n @if (hasSubmit()) {\n <div>\n <button mat-icon-button type=\"button\" (click)=\"cancel()\">\n <mat-icon class=\"mat-warn\">close</mat-icon>\n </button>\n <button mat-icon-button type=\"submit\" [disabled]=\"form.invalid\">\n <mat-icon class=\"mat-primary\">check_circle</mat-icon>\n </button>\n </div>\n }\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"] }]
|
|
343
396
|
}], ctorParameters: () => [{ type: i1$1.FormBuilder }, { type: PinRefLookupService }, { type: undefined, decorators: [{
|
|
344
397
|
type: Inject,
|
|
345
398
|
args: ['indexLookupDefinitions']
|
|
346
|
-
}] }]
|
|
347
|
-
type: Input
|
|
348
|
-
}], idTagEntries: [{
|
|
349
|
-
type: Input
|
|
350
|
-
}], assTagEntries: [{
|
|
351
|
-
type: Input
|
|
352
|
-
}], refTypeEntries: [{
|
|
353
|
-
type: Input
|
|
354
|
-
}], refTagEntries: [{
|
|
355
|
-
type: Input
|
|
356
|
-
}], id: [{
|
|
357
|
-
type: Input
|
|
358
|
-
}], noEidLookup: [{
|
|
359
|
-
type: Input
|
|
360
|
-
}], hasSubmit: [{
|
|
361
|
-
type: Input
|
|
362
|
-
}], idChange: [{
|
|
363
|
-
type: Output
|
|
364
|
-
}], editorClose: [{
|
|
365
|
-
type: Output
|
|
366
|
-
}] } });
|
|
399
|
+
}] }] });
|
|
367
400
|
|
|
368
401
|
/**
|
|
369
402
|
* Asserted IDs editor.
|
|
370
403
|
*/
|
|
371
404
|
class AssertedIdsComponent {
|
|
405
|
+
_dialogService;
|
|
406
|
+
_editedIndex;
|
|
407
|
+
edited;
|
|
372
408
|
/**
|
|
373
409
|
* The asserted IDs.
|
|
374
410
|
*/
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
411
|
+
ids = model([]);
|
|
412
|
+
// asserted-id-scopes
|
|
413
|
+
idScopeEntries = input();
|
|
414
|
+
// asserted-id-tags
|
|
415
|
+
idTagEntries = input();
|
|
416
|
+
// assertion-tags
|
|
417
|
+
assTagEntries = input();
|
|
418
|
+
// doc-reference-types
|
|
419
|
+
refTypeEntries = input();
|
|
420
|
+
// doc-reference-tags
|
|
421
|
+
refTagEntries = input();
|
|
422
|
+
entries;
|
|
423
|
+
form;
|
|
384
424
|
constructor(formBuilder, _dialogService) {
|
|
385
425
|
this._dialogService = _dialogService;
|
|
386
|
-
this._ids = [];
|
|
387
426
|
this._editedIndex = -1;
|
|
388
|
-
this.idsChange = new EventEmitter();
|
|
389
427
|
this.entries = formBuilder.control([], { nonNullable: true });
|
|
390
428
|
// form
|
|
391
429
|
this.form = formBuilder.group({
|
|
392
430
|
ids: this.entries,
|
|
393
431
|
});
|
|
432
|
+
// when ids change, update form
|
|
433
|
+
effect(() => {
|
|
434
|
+
this.updateForm(this.ids());
|
|
435
|
+
});
|
|
394
436
|
}
|
|
395
437
|
updateForm(ids) {
|
|
396
438
|
if (!ids?.length) {
|
|
@@ -401,9 +443,6 @@ class AssertedIdsComponent {
|
|
|
401
443
|
this.entries.updateValueAndValidity();
|
|
402
444
|
this.form.markAsPristine();
|
|
403
445
|
}
|
|
404
|
-
emitIdsChange() {
|
|
405
|
-
this.idsChange.emit(this.entries.value);
|
|
406
|
-
}
|
|
407
446
|
addId() {
|
|
408
447
|
this.editId({
|
|
409
448
|
scope: '',
|
|
@@ -445,7 +484,7 @@ class AssertedIdsComponent {
|
|
|
445
484
|
this.entries.setValue(entries);
|
|
446
485
|
this.entries.markAsDirty();
|
|
447
486
|
this.entries.updateValueAndValidity();
|
|
448
|
-
this.
|
|
487
|
+
this.ids.set(this.entries.value);
|
|
449
488
|
}
|
|
450
489
|
});
|
|
451
490
|
}
|
|
@@ -460,7 +499,7 @@ class AssertedIdsComponent {
|
|
|
460
499
|
this.entries.setValue(entries);
|
|
461
500
|
this.entries.markAsDirty();
|
|
462
501
|
this.entries.updateValueAndValidity();
|
|
463
|
-
this.
|
|
502
|
+
this.ids.set(this.entries.value);
|
|
464
503
|
}
|
|
465
504
|
moveIdDown(index) {
|
|
466
505
|
if (index + 1 >= this.entries.value.length) {
|
|
@@ -473,16 +512,16 @@ class AssertedIdsComponent {
|
|
|
473
512
|
this.entries.setValue(entries);
|
|
474
513
|
this.entries.markAsDirty();
|
|
475
514
|
this.entries.updateValueAndValidity();
|
|
476
|
-
this.
|
|
515
|
+
this.ids.set(this.entries.value);
|
|
477
516
|
}
|
|
478
517
|
onIdChange(id) {
|
|
479
518
|
this.saveId(id);
|
|
480
|
-
this.
|
|
519
|
+
this.ids.set(this.entries.value);
|
|
481
520
|
}
|
|
482
|
-
static
|
|
483
|
-
static
|
|
521
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: AssertedIdsComponent, deps: [{ token: i1$1.FormBuilder }, { token: i2.DialogService }], target: i0.ɵɵFactoryTarget.Component });
|
|
522
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.5", type: AssertedIdsComponent, isStandalone: true, selector: "cadmus-refs-asserted-ids", inputs: { ids: { classPropertyName: "ids", publicName: "ids", isSignal: true, isRequired: false, transformFunction: null }, idScopeEntries: { classPropertyName: "idScopeEntries", publicName: "idScopeEntries", isSignal: true, isRequired: false, transformFunction: null }, idTagEntries: { classPropertyName: "idTagEntries", publicName: "idTagEntries", isSignal: true, isRequired: false, transformFunction: null }, assTagEntries: { classPropertyName: "assTagEntries", publicName: "assTagEntries", isSignal: true, isRequired: false, transformFunction: null }, refTypeEntries: { classPropertyName: "refTypeEntries", publicName: "refTypeEntries", isSignal: true, isRequired: false, transformFunction: null }, refTagEntries: { classPropertyName: "refTagEntries", publicName: "refTagEntries", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { ids: "idsChange" }, ngImport: i0, template: "<form [formGroup]=\"form\">\n <div>\n <button type=\"button\" mat-flat-button class=\"mat-primary\" (click)=\"addId()\">\n <mat-icon>add_circle</mat-icon> ID\n </button>\n </div>\n @if (entries.value.length) {\n <table>\n <thead>\n <tr>\n <th></th>\n <th>scope</th>\n <th>value</th>\n </tr>\n </thead>\n <tbody>\n @for ( entry of entries.value; track entry; let i = $index; let first =\n $first; let last = $last) {\n <tr>\n <td>\n <button\n type=\"button\"\n mat-icon-button\n matTooltip=\"Edit this ID\"\n (click)=\"editId(entry, i)\"\n >\n <mat-icon class=\"mat-primary\">edit</mat-icon>\n </button>\n <button\n type=\"button\"\n mat-icon-button\n matTooltip=\"Move this ID up\"\n [disabled]=\"first\"\n (click)=\"moveIdUp(i)\"\n >\n <mat-icon>arrow_upward</mat-icon>\n </button>\n <button\n type=\"button\"\n mat-icon-button\n matTooltip=\"Move this ID down\"\n [disabled]=\"last\"\n (click)=\"moveIdDown(i)\"\n >\n <mat-icon>arrow_downward</mat-icon>\n </button>\n <button\n type=\"button\"\n mat-icon-button\n matTooltip=\"Delete this ID\"\n (click)=\"deleteId(i)\"\n >\n <mat-icon class=\"mat-warn\">remove_circle</mat-icon>\n </button>\n </td>\n <td>{{ entry.scope }}</td>\n <td>{{ entry.value }}</td>\n </tr>\n }\n </tbody>\n </table>\n }\n\n <mat-expansion-panel [expanded]=\"edited\" [disabled]=\"!edited\">\n <mat-expansion-panel-header\n >ID {{ edited?.value }}</mat-expansion-panel-header\n >\n <cadmus-refs-asserted-id\n [idScopeEntries]=\"idScopeEntries()\"\n [idTagEntries]=\"idTagEntries()\"\n [assTagEntries]=\"assTagEntries()\"\n [refTypeEntries]=\"refTypeEntries()\"\n [refTagEntries]=\"refTagEntries()\"\n [hasSubmit]=\"true\"\n [id]=\"edited\"\n (idChange)=\"onIdChange($event)\"\n (editorClose)=\"closeId()\"\n ></cadmus-refs-asserted-id>\n </mat-expansion-panel>\n</form>\n", styles: ["th{font-weight:400;color:silver;text-align:left}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: FormsModule }, { 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: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i3.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", exportAs: ["matButton"] }, { kind: "component", type: i3.MatIconButton, selector: "button[mat-icon-button]", exportAs: ["matButton"] }, { kind: "ngmodule", type: MatExpansionModule }, { kind: "component", type: i4.MatExpansionPanel, selector: "mat-expansion-panel", inputs: ["hideToggle", "togglePosition"], outputs: ["afterExpand", "afterCollapse"], exportAs: ["matExpansionPanel"] }, { kind: "component", type: i4.MatExpansionPanelHeader, selector: "mat-expansion-panel-header", inputs: ["expandedHeight", "collapsedHeight", "tabIndex"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i7.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: MatTooltipModule }, { kind: "directive", type: i6$1.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "component", type: AssertedIdComponent, selector: "cadmus-refs-asserted-id", inputs: ["idScopeEntries", "idTagEntries", "assTagEntries", "refTypeEntries", "refTagEntries", "id", "noEidLookup", "hasSubmit"], outputs: ["idChange", "editorClose"] }] });
|
|
484
523
|
}
|
|
485
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.
|
|
524
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: AssertedIdsComponent, decorators: [{
|
|
486
525
|
type: Component,
|
|
487
526
|
args: [{ selector: 'cadmus-refs-asserted-ids', imports: [
|
|
488
527
|
CommonModule,
|
|
@@ -493,24 +532,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.1", ngImpor
|
|
|
493
532
|
MatIconModule,
|
|
494
533
|
MatTooltipModule,
|
|
495
534
|
AssertedIdComponent,
|
|
496
|
-
], template: "<form [formGroup]=\"form\">\n <div>\n <button
|
|
497
|
-
}], ctorParameters: () => [{ type: i1$1.FormBuilder }, { type: i2.DialogService }]
|
|
498
|
-
type: Input
|
|
499
|
-
}], idScopeEntries: [{
|
|
500
|
-
type: Input
|
|
501
|
-
}], idTagEntries: [{
|
|
502
|
-
type: Input
|
|
503
|
-
}], assTagEntries: [{
|
|
504
|
-
type: Input
|
|
505
|
-
}], refTypeEntries: [{
|
|
506
|
-
type: Input
|
|
507
|
-
}], refTagEntries: [{
|
|
508
|
-
type: Input
|
|
509
|
-
}], idsChange: [{
|
|
510
|
-
type: Output
|
|
511
|
-
}] } });
|
|
535
|
+
], template: "<form [formGroup]=\"form\">\n <div>\n <button type=\"button\" mat-flat-button class=\"mat-primary\" (click)=\"addId()\">\n <mat-icon>add_circle</mat-icon> ID\n </button>\n </div>\n @if (entries.value.length) {\n <table>\n <thead>\n <tr>\n <th></th>\n <th>scope</th>\n <th>value</th>\n </tr>\n </thead>\n <tbody>\n @for ( entry of entries.value; track entry; let i = $index; let first =\n $first; let last = $last) {\n <tr>\n <td>\n <button\n type=\"button\"\n mat-icon-button\n matTooltip=\"Edit this ID\"\n (click)=\"editId(entry, i)\"\n >\n <mat-icon class=\"mat-primary\">edit</mat-icon>\n </button>\n <button\n type=\"button\"\n mat-icon-button\n matTooltip=\"Move this ID up\"\n [disabled]=\"first\"\n (click)=\"moveIdUp(i)\"\n >\n <mat-icon>arrow_upward</mat-icon>\n </button>\n <button\n type=\"button\"\n mat-icon-button\n matTooltip=\"Move this ID down\"\n [disabled]=\"last\"\n (click)=\"moveIdDown(i)\"\n >\n <mat-icon>arrow_downward</mat-icon>\n </button>\n <button\n type=\"button\"\n mat-icon-button\n matTooltip=\"Delete this ID\"\n (click)=\"deleteId(i)\"\n >\n <mat-icon class=\"mat-warn\">remove_circle</mat-icon>\n </button>\n </td>\n <td>{{ entry.scope }}</td>\n <td>{{ entry.value }}</td>\n </tr>\n }\n </tbody>\n </table>\n }\n\n <mat-expansion-panel [expanded]=\"edited\" [disabled]=\"!edited\">\n <mat-expansion-panel-header\n >ID {{ edited?.value }}</mat-expansion-panel-header\n >\n <cadmus-refs-asserted-id\n [idScopeEntries]=\"idScopeEntries()\"\n [idTagEntries]=\"idTagEntries()\"\n [assTagEntries]=\"assTagEntries()\"\n [refTypeEntries]=\"refTypeEntries()\"\n [refTagEntries]=\"refTagEntries()\"\n [hasSubmit]=\"true\"\n [id]=\"edited\"\n (idChange)=\"onIdChange($event)\"\n (editorClose)=\"closeId()\"\n ></cadmus-refs-asserted-id>\n </mat-expansion-panel>\n</form>\n", styles: ["th{font-weight:400;color:silver;text-align:left}\n"] }]
|
|
536
|
+
}], ctorParameters: () => [{ type: i1$1.FormBuilder }, { type: i2.DialogService }] });
|
|
512
537
|
|
|
513
538
|
class ItemRefLookupService {
|
|
539
|
+
_itemService;
|
|
514
540
|
constructor(_itemService) {
|
|
515
541
|
this._itemService = _itemService;
|
|
516
542
|
}
|
|
@@ -524,10 +550,10 @@ class ItemRefLookupService {
|
|
|
524
550
|
getName(item) {
|
|
525
551
|
return item?.title;
|
|
526
552
|
}
|
|
527
|
-
static
|
|
528
|
-
static
|
|
553
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: ItemRefLookupService, deps: [{ token: i1.ItemService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
554
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: ItemRefLookupService, providedIn: 'root' });
|
|
529
555
|
}
|
|
530
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.
|
|
556
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: ItemRefLookupService, decorators: [{
|
|
531
557
|
type: Injectable,
|
|
532
558
|
args: [{
|
|
533
559
|
providedIn: 'root',
|
|
@@ -544,35 +570,87 @@ const METADATA_PART_ID = 'it.vedph.metadata';
|
|
|
544
570
|
* some EID by variously assembling these components.
|
|
545
571
|
*/
|
|
546
572
|
class PinTargetLookupComponent {
|
|
573
|
+
_presetLookupDefs;
|
|
574
|
+
itemLookupService;
|
|
575
|
+
pinLookupService;
|
|
576
|
+
_itemService;
|
|
577
|
+
_thesService;
|
|
578
|
+
_snackbar;
|
|
579
|
+
_subs = [];
|
|
580
|
+
_noTargetUpdate;
|
|
581
|
+
_noFormUpdate;
|
|
582
|
+
_startWithByTypeMode;
|
|
547
583
|
/**
|
|
548
584
|
* True when the by-type pin lookup mode is active.
|
|
549
585
|
* User can change mode unless modeSwitching is false.
|
|
550
586
|
*/
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
587
|
+
pinByTypeMode = model();
|
|
588
|
+
/**
|
|
589
|
+
* True when the user can switch between by-type and by-item mode.
|
|
590
|
+
*/
|
|
591
|
+
canSwitchMode = model();
|
|
592
|
+
/**
|
|
593
|
+
* True when the user can edit the target's gid/label for internal
|
|
594
|
+
* targets.
|
|
595
|
+
*/
|
|
596
|
+
canEditTarget = input();
|
|
597
|
+
/**
|
|
598
|
+
* The lookup definitions to be used for the by-type lookup. If
|
|
599
|
+
* not specified, the lookup definitions will be got via injection
|
|
600
|
+
* when available; if the injected definitions are empty, the
|
|
601
|
+
* lookup definitions will be built from the model-types thesaurus;
|
|
602
|
+
* if this is not available either, the by-type lookup will be
|
|
603
|
+
* disabled.
|
|
604
|
+
*/
|
|
605
|
+
lookupDefinitions = model();
|
|
606
|
+
/**
|
|
607
|
+
* The optional configurations for using external lookup services.
|
|
608
|
+
*/
|
|
609
|
+
extLookupConfigs = input([]);
|
|
610
|
+
/**
|
|
611
|
+
* True if when a new target is set it should be internal rather than
|
|
612
|
+
* external by default.
|
|
613
|
+
*/
|
|
614
|
+
internalDefault = input();
|
|
563
615
|
/**
|
|
564
616
|
* The target to be edited.
|
|
565
617
|
*/
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
618
|
+
target = model();
|
|
619
|
+
/**
|
|
620
|
+
* The default value for part type key when the by-type mode is active.
|
|
621
|
+
*/
|
|
622
|
+
defaultPartTypeKey = input();
|
|
623
|
+
/**
|
|
624
|
+
* Emitted when user closes the editor.
|
|
625
|
+
*/
|
|
626
|
+
editorClose = output();
|
|
627
|
+
/**
|
|
628
|
+
* Emitted when the user requests more items from an external lookup.
|
|
629
|
+
*/
|
|
630
|
+
extMoreRequest = output();
|
|
631
|
+
/**
|
|
632
|
+
* Emitted when the user changes the external lookup configuration.
|
|
633
|
+
*/
|
|
634
|
+
extLookupConfigChange = output();
|
|
635
|
+
// by type
|
|
636
|
+
modelEntries;
|
|
637
|
+
partTypeKeys;
|
|
638
|
+
// by item
|
|
639
|
+
itemParts;
|
|
640
|
+
// form - by item
|
|
641
|
+
item;
|
|
642
|
+
itemPart;
|
|
643
|
+
// form - by type
|
|
644
|
+
partTypeKey;
|
|
645
|
+
// form - both
|
|
646
|
+
gid;
|
|
647
|
+
label;
|
|
648
|
+
byTypeMode;
|
|
649
|
+
external;
|
|
650
|
+
form;
|
|
651
|
+
filter;
|
|
652
|
+
pinFilterOptions;
|
|
653
|
+
lookupData;
|
|
576
654
|
constructor(_presetLookupDefs, itemLookupService, pinLookupService, _itemService, _thesService, _snackbar, formBuilder) {
|
|
577
655
|
this._presetLookupDefs = _presetLookupDefs;
|
|
578
656
|
this.itemLookupService = itemLookupService;
|
|
@@ -582,9 +660,7 @@ class PinTargetLookupComponent {
|
|
|
582
660
|
this._snackbar = _snackbar;
|
|
583
661
|
this.partTypeKeys = [];
|
|
584
662
|
this.itemParts = [];
|
|
585
|
-
this._subs = [];
|
|
586
663
|
this.modelEntries = [];
|
|
587
|
-
this.extLookupConfigs = [];
|
|
588
664
|
// this is the default filter for the pin lookup, which will
|
|
589
665
|
// be merged with values provided by user here
|
|
590
666
|
this.filter = {
|
|
@@ -614,35 +690,52 @@ class PinTargetLookupComponent {
|
|
|
614
690
|
byTypeMode: this.byTypeMode,
|
|
615
691
|
external: this.external,
|
|
616
692
|
});
|
|
617
|
-
//
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
693
|
+
// when pinByTypeMode changes, adjust form
|
|
694
|
+
effect(() => {
|
|
695
|
+
if (!this.byTypeMode) {
|
|
696
|
+
this._startWithByTypeMode = this.pinByTypeMode();
|
|
697
|
+
}
|
|
698
|
+
else {
|
|
699
|
+
this.byTypeMode.setValue(this.pinByTypeMode() || false, {
|
|
700
|
+
emitEvent: false,
|
|
701
|
+
});
|
|
702
|
+
this.byTypeMode.updateValueAndValidity();
|
|
703
|
+
}
|
|
704
|
+
});
|
|
705
|
+
// when target changes, update form
|
|
706
|
+
effect(() => {
|
|
707
|
+
if (this._noFormUpdate) {
|
|
708
|
+
this._noFormUpdate = false;
|
|
709
|
+
return;
|
|
710
|
+
}
|
|
711
|
+
console.log('target changed', this.target());
|
|
712
|
+
this.updateForm(this.target());
|
|
713
|
+
});
|
|
622
714
|
}
|
|
623
715
|
forceByItem() {
|
|
624
|
-
this.pinByTypeMode
|
|
625
|
-
this.canSwitchMode
|
|
716
|
+
this.pinByTypeMode.set(false);
|
|
717
|
+
this.canSwitchMode.set(false);
|
|
626
718
|
}
|
|
627
719
|
setupKeys() {
|
|
628
720
|
// use DI presets if no lookup definitions
|
|
629
|
-
if (!this.lookupDefinitions) {
|
|
630
|
-
this.lookupDefinitions
|
|
721
|
+
if (!this.lookupDefinitions()) {
|
|
722
|
+
this.lookupDefinitions.set(this._presetLookupDefs);
|
|
631
723
|
}
|
|
632
724
|
// keys are all the defined lookup searches
|
|
633
|
-
this.partTypeKeys = Object.keys(this.lookupDefinitions);
|
|
725
|
+
this.partTypeKeys = Object.keys(this.lookupDefinitions());
|
|
634
726
|
// if no keys, get them from thesaurus model-types;
|
|
635
727
|
// if this is not available, just force by item mode.
|
|
636
728
|
if (!this.partTypeKeys.length) {
|
|
637
729
|
if (this.modelEntries?.length) {
|
|
638
730
|
// set lookupDefinitions from thesaurus entries
|
|
639
|
-
|
|
731
|
+
const defs = {};
|
|
640
732
|
this.modelEntries.forEach((e) => {
|
|
641
|
-
|
|
733
|
+
defs[e.value] = {
|
|
642
734
|
name: e.value,
|
|
643
735
|
typeId: e.id,
|
|
644
736
|
};
|
|
645
737
|
});
|
|
738
|
+
this.lookupDefinitions.set(defs);
|
|
646
739
|
// set type keys from thesaurus entries
|
|
647
740
|
this.partTypeKeys = this.modelEntries.map((e) => e.value);
|
|
648
741
|
}
|
|
@@ -653,7 +746,7 @@ class PinTargetLookupComponent {
|
|
|
653
746
|
}
|
|
654
747
|
else {
|
|
655
748
|
// set default key
|
|
656
|
-
this.partTypeKey.setValue(this.defaultPartTypeKey || this.partTypeKeys[0]);
|
|
749
|
+
this.partTypeKey.setValue(this.defaultPartTypeKey() || this.partTypeKeys[0]);
|
|
657
750
|
}
|
|
658
751
|
}
|
|
659
752
|
ngOnInit() {
|
|
@@ -661,18 +754,19 @@ class PinTargetLookupComponent {
|
|
|
661
754
|
if (this._startWithByTypeMode) {
|
|
662
755
|
this.byTypeMode.setValue(true);
|
|
663
756
|
}
|
|
664
|
-
// whenever item changes, update item's parts and filter
|
|
757
|
+
// whenever item changes (by lookup), update item's parts and filter
|
|
665
758
|
this._subs.push(this.item.valueChanges
|
|
666
759
|
.pipe(distinctUntilChanged(), debounceTime$1(300))
|
|
667
760
|
.subscribe((item) => {
|
|
668
|
-
this.itemPart.setValue(null);
|
|
761
|
+
this.itemPart.setValue(null, { emitEvent: false });
|
|
669
762
|
this.itemParts = item?.parts || [];
|
|
670
763
|
this.filter = {
|
|
671
764
|
...this.filter,
|
|
672
765
|
itemId: item?.id,
|
|
673
766
|
};
|
|
674
767
|
}));
|
|
675
|
-
// whenever itemPart changes, update target and
|
|
768
|
+
// whenever itemPart changes (by user selection), update target and
|
|
769
|
+
// eventually gid
|
|
676
770
|
this._subs.push(this.itemPart.valueChanges
|
|
677
771
|
.pipe(distinctUntilChanged(), debounceTime$1(300))
|
|
678
772
|
.subscribe((part) => {
|
|
@@ -683,14 +777,14 @@ class PinTargetLookupComponent {
|
|
|
683
777
|
...this.filter,
|
|
684
778
|
partId: part?.id,
|
|
685
779
|
};
|
|
686
|
-
this.updateTarget();
|
|
780
|
+
this.updateTarget(true);
|
|
687
781
|
}));
|
|
688
782
|
// whenever partTypeKey changes, update filter's options
|
|
689
783
|
this._subs.push(this.partTypeKey.valueChanges
|
|
690
784
|
.pipe(distinctUntilChanged(), debounceTime$1(300))
|
|
691
785
|
.subscribe((key) => {
|
|
692
786
|
this.pinFilterOptions = key
|
|
693
|
-
? this.lookupDefinitions[key]
|
|
787
|
+
? this.lookupDefinitions()[key]
|
|
694
788
|
: undefined;
|
|
695
789
|
}));
|
|
696
790
|
// whenever external changes, set required validator in label
|
|
@@ -786,7 +880,11 @@ class PinTargetLookupComponent {
|
|
|
786
880
|
};
|
|
787
881
|
}
|
|
788
882
|
}
|
|
789
|
-
|
|
883
|
+
emitChange() {
|
|
884
|
+
this._noFormUpdate = true;
|
|
885
|
+
this.target.set(this.getTarget());
|
|
886
|
+
}
|
|
887
|
+
updateTarget(noEmit = false) {
|
|
790
888
|
if (this._noTargetUpdate) {
|
|
791
889
|
return;
|
|
792
890
|
}
|
|
@@ -798,7 +896,9 @@ class PinTargetLookupComponent {
|
|
|
798
896
|
this.label.updateValueAndValidity();
|
|
799
897
|
this.label.markAsDirty();
|
|
800
898
|
}
|
|
801
|
-
|
|
899
|
+
if (!noEmit) {
|
|
900
|
+
this.emitChange();
|
|
901
|
+
}
|
|
802
902
|
}
|
|
803
903
|
updateForm(target) {
|
|
804
904
|
// build pin info from target
|
|
@@ -811,8 +911,8 @@ class PinTargetLookupComponent {
|
|
|
811
911
|
return;
|
|
812
912
|
}
|
|
813
913
|
this._noTargetUpdate = true;
|
|
814
|
-
this.gid.setValue(target.gid || '');
|
|
815
|
-
this.label.setValue(target.label || '');
|
|
914
|
+
this.gid.setValue(target.gid || '', { emitEvent: false });
|
|
915
|
+
this.label.setValue(target.label || '', { emitEvent: false });
|
|
816
916
|
this.lookupData = {
|
|
817
917
|
pin: {
|
|
818
918
|
itemId: target.itemId || '',
|
|
@@ -827,23 +927,25 @@ class PinTargetLookupComponent {
|
|
|
827
927
|
if (target.itemId) {
|
|
828
928
|
this._itemService.getItem(target.itemId, true, true).subscribe({
|
|
829
929
|
next: (item) => {
|
|
830
|
-
this.item.setValue(item);
|
|
930
|
+
this.item.setValue(item, { emitEvent: false });
|
|
831
931
|
this.form.markAsPristine();
|
|
832
932
|
this._noTargetUpdate = false;
|
|
833
|
-
this.external.setValue(!target.name);
|
|
933
|
+
this.external.setValue(!target.name, { emitEvent: false });
|
|
834
934
|
this.updateTarget();
|
|
835
935
|
},
|
|
836
936
|
error: (error) => {
|
|
837
937
|
if (error) {
|
|
838
|
-
console.error(
|
|
938
|
+
console.error('Item service error', error);
|
|
839
939
|
}
|
|
840
|
-
this.external.setValue(!target.name);
|
|
940
|
+
this.external.setValue(!target.name, { emitEvent: false });
|
|
841
941
|
this._noTargetUpdate = false;
|
|
842
942
|
},
|
|
843
943
|
});
|
|
844
944
|
}
|
|
845
945
|
else {
|
|
846
|
-
this.external.setValue(!target.name && !this.internalDefault)
|
|
946
|
+
this.external.setValue(!target.name && !this.internalDefault(), {
|
|
947
|
+
emitEvent: false,
|
|
948
|
+
});
|
|
847
949
|
this._noTargetUpdate = false;
|
|
848
950
|
this.updateTarget();
|
|
849
951
|
}
|
|
@@ -855,24 +957,30 @@ class PinTargetLookupComponent {
|
|
|
855
957
|
* @param item The item got from lookup.
|
|
856
958
|
*/
|
|
857
959
|
onItemLookupChange(item) {
|
|
960
|
+
if (!item) {
|
|
961
|
+
return;
|
|
962
|
+
}
|
|
858
963
|
// load item's parts
|
|
859
964
|
this._itemService.getItem(item.id, true, true).subscribe({
|
|
860
965
|
next: (i) => {
|
|
861
966
|
// setting the item will trigger its parts update
|
|
862
967
|
this.item.setValue(i);
|
|
863
|
-
this.updateTarget();
|
|
968
|
+
this.updateTarget(true);
|
|
864
969
|
},
|
|
865
970
|
error: (error) => {
|
|
866
971
|
if (error) {
|
|
867
|
-
console.error(
|
|
972
|
+
console.error('Error getting item', error);
|
|
868
973
|
}
|
|
869
974
|
this.itemPart.setValue(null);
|
|
870
975
|
this.itemParts = [];
|
|
871
|
-
this.updateTarget();
|
|
976
|
+
this.updateTarget(true);
|
|
872
977
|
},
|
|
873
978
|
});
|
|
874
979
|
}
|
|
875
980
|
loadItemInfo(pin) {
|
|
981
|
+
if (!pin) {
|
|
982
|
+
return;
|
|
983
|
+
}
|
|
876
984
|
forkJoin({
|
|
877
985
|
item: this._itemService.getItem(pin.itemId, false, true),
|
|
878
986
|
part: this._itemService.getPartFromTypeAndRole(pin.itemId, METADATA_PART_ID, undefined, true),
|
|
@@ -885,11 +993,11 @@ class PinTargetLookupComponent {
|
|
|
885
993
|
item: result.item,
|
|
886
994
|
metaPart: result.part,
|
|
887
995
|
};
|
|
888
|
-
this.updateTarget();
|
|
996
|
+
this.updateTarget(true);
|
|
889
997
|
},
|
|
890
998
|
error: (error) => {
|
|
891
999
|
this.lookupData = undefined;
|
|
892
|
-
console.error(
|
|
1000
|
+
console.error('Error loading item/metadata', error);
|
|
893
1001
|
},
|
|
894
1002
|
});
|
|
895
1003
|
}
|
|
@@ -906,14 +1014,16 @@ class PinTargetLookupComponent {
|
|
|
906
1014
|
this.loadItemInfo(info);
|
|
907
1015
|
}
|
|
908
1016
|
onExtItemChange(event) {
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
1017
|
+
if (event.item) {
|
|
1018
|
+
setTimeout(() => {
|
|
1019
|
+
this.gid.setValue(event.itemId);
|
|
1020
|
+
this.gid.updateValueAndValidity();
|
|
1021
|
+
this.gid.markAsDirty();
|
|
1022
|
+
this.label.setValue(event.itemLabel);
|
|
1023
|
+
this.label.updateValueAndValidity();
|
|
1024
|
+
this.label.markAsDirty();
|
|
1025
|
+
});
|
|
1026
|
+
}
|
|
917
1027
|
}
|
|
918
1028
|
onExtMoreRequest(event) {
|
|
919
1029
|
this.extMoreRequest.emit(event);
|
|
@@ -933,13 +1043,13 @@ class PinTargetLookupComponent {
|
|
|
933
1043
|
if (this.form.invalid) {
|
|
934
1044
|
return;
|
|
935
1045
|
}
|
|
936
|
-
this.
|
|
937
|
-
this.
|
|
1046
|
+
this.target.set(this.getTarget());
|
|
1047
|
+
this.emitChange();
|
|
938
1048
|
}
|
|
939
|
-
static
|
|
940
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.1", type: PinTargetLookupComponent, isStandalone: true, selector: "cadmus-pin-target-lookup", inputs: { pinByTypeMode: "pinByTypeMode", canSwitchMode: "canSwitchMode", canEditTarget: "canEditTarget", lookupDefinitions: "lookupDefinitions", extLookupConfigs: "extLookupConfigs", internalDefault: "internalDefault", target: "target", defaultPartTypeKey: "defaultPartTypeKey" }, outputs: { editorClose: "editorClose", targetChange: "targetChange", extMoreRequest: "extMoreRequest", extLookupConfigChange: "extLookupConfigChange" }, ngImport: i0, template: "<form [formGroup]=\"form\" (submit)=\"save()\">\r\n <div class=\"form-row\">\r\n <!-- external -->\r\n <mat-checkbox [formControl]=\"external\">external</mat-checkbox>\r\n <!-- mode switcher -->\r\n @if (!external.value) {\r\n <div>\r\n @if (canSwitchMode) {\r\n <mat-checkbox [formControl]=\"byTypeMode\"> by type</mat-checkbox>\r\n }\r\n </div>\r\n }\r\n </div>\r\n\r\n <div class=\"form-row\">\r\n <!-- label -->\r\n <div>\r\n @if (external.value || canEditTarget) {\r\n <mat-form-field>\r\n <mat-label>label</mat-label>\r\n <input matInput [formControl]=\"label\" />\r\n @if ($any(label).errors?.required && (label.dirty || label.touched)) {\r\n <mat-error>label required</mat-error>\r\n } @if ( $any(label).errors?.maxLength && (label.dirty || label.touched)\r\n ) {\r\n <mat-error>label too long</mat-error>\r\n }\r\n </mat-form-field>\r\n } @if (!external.value && !canEditTarget && label.value) {\r\n <div class=\"info\"><span class=\"label\">label</span>{{ label.value }}</div>\r\n }\r\n </div>\r\n\r\n <!-- gid -->\r\n <div>\r\n @if (external.value || canEditTarget) {\r\n <mat-form-field>\r\n <mat-label>GID</mat-label>\r\n <input matInput [formControl]=\"gid\" />\r\n @if ($any(gid).errors?.required && (gid.dirty || gid.touched)) {\r\n <mat-error>GID required</mat-error>\r\n } @if ($any(gid).errors?.maxLength && (gid.dirty || gid.touched)) {\r\n <mat-error>GID too long</mat-error>\r\n }\r\n </mat-form-field>\r\n } @if (!external.value && !canEditTarget && gid.value) {\r\n <div class=\"info\">\r\n <span class=\"label\">GID</span> <span class=\"gid\">{{ gid.value }}</span>\r\n </div>\r\n }\r\n </div>\r\n </div>\r\n\r\n <!-- external lookup set -->\r\n @if (external.value && extLookupConfigs.length) {\r\n <div>\r\n <cadmus-ref-lookup-set\r\n [configs]=\"extLookupConfigs\"\r\n (itemChange)=\"onExtItemChange($event)\"\r\n (moreRequest)=\"onExtMoreRequest($event)\"\r\n (configChange)=\"onExtConfigChange($any($event))\"\r\n ></cadmus-ref-lookup-set>\r\n </div>\r\n }\r\n\r\n <!-- BY ITEM -->\r\n @if (!external.value) {\r\n <div>\r\n @if (!byTypeMode.value) {\r\n <fieldset class=\"form-row\">\r\n <legend>pin filters</legend>\r\n <!-- item filter -->\r\n <cadmus-ref-lookup\r\n [service]=\"itemLookupService\"\r\n label=\"item\"\r\n (itemChange)=\"onItemLookupChange($event)\"\r\n ></cadmus-ref-lookup>\r\n <!-- part filter -->\r\n @if (itemParts.length) {\r\n <mat-form-field>\r\n <mat-label>part</mat-label>\r\n <mat-select [formControl]=\"itemPart\">\r\n <mat-option [value]=\"null\">(any)</mat-option>\r\n @for (p of itemParts; track p) {\r\n <mat-option [value]=\"p\">{{\r\n p.typeId | flatLookup : modelEntries : \"id\" : \"value\"\r\n }}</mat-option>\r\n }\r\n </mat-select>\r\n </mat-form-field>\r\n }\r\n </fieldset>\r\n }\r\n <!-- BY TYPE -->\r\n @if (byTypeMode.value) {\r\n <div>\r\n <!-- par type filter -->\r\n @if (partTypeKeys.length) {\r\n <mat-form-field>\r\n <mat-label>part type</mat-label>\r\n <mat-select [formControl]=\"partTypeKey\">\r\n @for (k of partTypeKeys; track k) {\r\n <mat-option [value]=\"k\">{{ k }}</mat-option>\r\n }\r\n </mat-select>\r\n </mat-form-field>\r\n }\r\n </div>\r\n }\r\n <!-- PIN -->\r\n @if (partTypeKey.value) {\r\n <div>\r\n <!-- pin lookup -->\r\n <cadmus-ref-lookup\r\n [service]=\"pinLookupService\"\r\n [baseFilter]=\"filter\"\r\n [options]=\"pinFilterOptions\"\r\n label=\"pin\"\r\n (itemChange)=\"onPinLookupChange($event)\"\r\n ></cadmus-ref-lookup>\r\n </div>\r\n }\r\n <!-- data -->\r\n @if (lookupData?.pin?.name) {\r\n <mat-expansion-panel id=\"data\">\r\n <mat-expansion-panel-header>pin data</mat-expansion-panel-header>\r\n <!-- table -->\r\n <table>\r\n <thead>\r\n <th></th>\r\n <th>source</th>\r\n <th>value</th>\r\n </thead>\r\n <tbody>\r\n <!-- pin -->\r\n @if (lookupData?.pin?.value) {\r\n <tr>\r\n <td>\r\n <button\r\n type=\"button\"\r\n mat-icon-button\r\n [cdkCopyToClipboard]=\"lookupData!.pin!.value\"\r\n (cdkCopyToClipboardCopied)=\"onCopied()\"\r\n >\r\n <mat-icon class=\"mat-primary\">content_copy</mat-icon>\r\n </button>\r\n </td>\r\n <td>pin</td>\r\n <td>{{ lookupData!.pin.value }}</td>\r\n </tr>\r\n }\r\n <!-- item ID -->\r\n @if (lookupData?.pin?.itemId) {\r\n <tr>\r\n <td>\r\n <button\r\n type=\"button\"\r\n mat-icon-button\r\n [cdkCopyToClipboard]=\"lookupData!.pin!.itemId\"\r\n (cdkCopyToClipboardCopied)=\"onCopied()\"\r\n >\r\n <mat-icon class=\"mat-primary\">content_copy</mat-icon>\r\n </button>\r\n </td>\r\n <td>item ID</td>\r\n <td>{{ lookupData!.pin.itemId }}</td>\r\n </tr>\r\n }\r\n <!-- item title -->\r\n @if (lookupData?.item?.title) {\r\n <tr>\r\n <td>\r\n <button\r\n type=\"button\"\r\n mat-icon-button\r\n [cdkCopyToClipboard]=\"lookupData!.item!.title\"\r\n (cdkCopyToClipboardCopied)=\"onCopied()\"\r\n >\r\n <mat-icon class=\"mat-primary\">content_copy</mat-icon>\r\n </button>\r\n </td>\r\n <td>item title</td>\r\n <td>{{ lookupData!.item!.title }}</td>\r\n </tr>\r\n }\r\n <!-- part ID -->\r\n @if (lookupData?.pin?.partId) {\r\n <tr>\r\n <td>\r\n <button\r\n type=\"button\"\r\n mat-icon-button\r\n [cdkCopyToClipboard]=\"lookupData!.pin!.partId\"\r\n (cdkCopyToClipboardCopied)=\"onCopied()\"\r\n >\r\n <mat-icon class=\"mat-primary\">content_copy</mat-icon>\r\n </button>\r\n </td>\r\n <td>part ID</td>\r\n <td>{{ lookupData!.pin.partId }}</td>\r\n </tr>\r\n }\r\n <!-- part type ID -->\r\n @if (lookupData?.pin?.partTypeId) {\r\n <tr>\r\n <td>\r\n <button\r\n type=\"button\"\r\n mat-icon-button\r\n [cdkCopyToClipboard]=\"lookupData!.pin!.partTypeId\"\r\n (cdkCopyToClipboardCopied)=\"onCopied()\"\r\n >\r\n <mat-icon class=\"mat-primary\">content_copy</mat-icon>\r\n </button>\r\n </td>\r\n <td>part type ID</td>\r\n <td>{{ lookupData!.pin!.partTypeId }}</td>\r\n </tr>\r\n }\r\n <!-- part role ID -->\r\n @if (lookupData?.pin?.roleId) {\r\n <tr>\r\n <td>\r\n <button\r\n type=\"button\"\r\n mat-icon-button\r\n [cdkCopyToClipboard]=\"lookupData!.pin!.roleId!\"\r\n (cdkCopyToClipboardCopied)=\"onCopied()\"\r\n >\r\n <mat-icon class=\"mat-primary\">content_copy</mat-icon>\r\n </button>\r\n </td>\r\n <td>part role ID</td>\r\n <td>{{ lookupData!.pin!.roleId }}</td>\r\n </tr>\r\n }\r\n <!-- part's metadata -->\r\n @for ( m of lookupData?.metaPart?.metadata || []; track m; let i =\r\n $index) {\r\n <tr>\r\n <td>\r\n <button\r\n type=\"button\"\r\n mat-icon-button\r\n [cdkCopyToClipboard]=\"m.value\"\r\n (cdkCopyToClipboardCopied)=\"onCopied()\"\r\n >\r\n <mat-icon class=\"mat-primary\">content_copy</mat-icon>\r\n </button>\r\n </td>\r\n <td class=\"metadata\">{{ m.name }}</td>\r\n <td class=\"metadata\">{{ m.value }}</td>\r\n </tr>\r\n }\r\n </tbody>\r\n </table>\r\n </mat-expansion-panel>\r\n }\r\n </div>\r\n }\r\n\r\n <!-- buttons -->\r\n <div class=\"button-row\">\r\n <button mat-icon-button type=\"button\" (click)=\"close()\">\r\n <mat-icon color=\"warn\" class=\"mat-warn\">close</mat-icon>\r\n </button>\r\n <button mat-flat-button type=\"submit\" [disabled]=\"form.invalid\">\r\n <mat-icon>check_circle</mat-icon>\r\n target\r\n </button>\r\n </div>\r\n</form>\r\n", styles: [".metadata{color:#4a3001}.info{border:1px solid silver;border-radius:6px;background-color:silver;color:#fff;padding:4px;margin:8px 0}.info .label{background-color:#fff;color:silver;margin:0 6px}#data{margin:8px 0}table{border:1px solid silver;border-radius:6px;padding:4px;margin-top:8px}tr:nth-child(odd){background-color:#f0f0f0}th{font-weight:400;text-align:left;color:silver}.form-row{display:flex;gap:8px;align-items:center;flex-wrap:wrap}.form-row *{flex:0 0 auto}.button-row{display:flex;align-items:center;flex-wrap:wrap}.label{border:1px solid silver;border-radius:6px;padding:4px}fieldset{border:1px solid silver;border-radius:6px;padding:4px 8px;margin-bottom:8px}legend{color:silver}\n"], dependencies: [{ kind: "ngmodule", type: FormsModule }, { 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: "ngmodule", type: ReactiveFormsModule }, { 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: "ngmodule", type: ClipboardModule }, { kind: "directive", type: i6$2.CdkCopyToClipboard, selector: "[cdkCopyToClipboard]", inputs: ["cdkCopyToClipboard", "cdkCopyToClipboardAttempts"], outputs: ["cdkCopyToClipboardCopied"] }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i3.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", exportAs: ["matButton"] }, { kind: "component", type: i3.MatIconButton, selector: "button[mat-icon-button]", exportAs: ["matButton"] }, { kind: "ngmodule", type: MatCheckboxModule }, { kind: "component", type: i8$1.MatCheckbox, selector: "mat-checkbox", inputs: ["aria-label", "aria-labelledby", "aria-describedby", "aria-expanded", "aria-controls", "aria-owns", "id", "required", "labelPosition", "name", "value", "disableRipple", "tabIndex", "color", "disabledInteractive", "checked", "disabled", "indeterminate"], outputs: ["change", "indeterminateChange"], exportAs: ["matCheckbox"] }, { kind: "ngmodule", type: MatExpansionModule }, { kind: "component", type: i4.MatExpansionPanel, selector: "mat-expansion-panel", inputs: ["hideToggle", "togglePosition"], outputs: ["afterExpand", "afterCollapse"], exportAs: ["matExpansionPanel"] }, { kind: "component", type: i4.MatExpansionPanelHeader, selector: "mat-expansion-panel-header", inputs: ["expandedHeight", "collapsedHeight", "tabIndex"] }, { kind: "ngmodule", type: MatFormFieldModule }, { kind: "component", type: i6.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i6.MatLabel, selector: "mat-label" }, { kind: "directive", type: i6.MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i7.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: MatInputModule }, { kind: "directive", type: i8.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly", "disabledInteractive"], exportAs: ["matInput"] }, { kind: "ngmodule", type: MatSelectModule }, { kind: "component", type: i9.MatSelect, selector: "mat-select", inputs: ["aria-describedby", "panelClass", "disabled", "disableRipple", "tabIndex", "hideSingleSelectionIndicator", "placeholder", "required", "multiple", "disableOptionCentering", "compareWith", "value", "aria-label", "aria-labelledby", "errorStateMatcher", "typeaheadDebounceInterval", "sortComparator", "id", "panelWidth"], outputs: ["openedChange", "opened", "closed", "selectionChange", "valueChange"], exportAs: ["matSelect"] }, { kind: "component", type: i10.MatOption, selector: "mat-option", inputs: ["value", "id", "disabled"], outputs: ["onSelectionChange"], exportAs: ["matOption"] }, { kind: "component", type: RefLookupComponent, selector: "cadmus-ref-lookup", inputs: ["label", "limit", "baseFilter", "service", "item", "required", "hasMore", "linkTemplate", "optDialog", "options"], outputs: ["itemChange", "moreRequest"] }, { kind: "component", type: RefLookupSetComponent, selector: "cadmus-ref-lookup-set", inputs: ["configs", "iconSize"], outputs: ["configChange", "itemChange", "moreRequest"] }, { kind: "pipe", type: FlatLookupPipe, name: "flatLookup" }] }); }
|
|
1049
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: PinTargetLookupComponent, deps: [{ token: 'indexLookupDefinitions' }, { token: ItemRefLookupService }, { token: PinRefLookupService }, { token: i1.ItemService }, { token: i1.ThesaurusService }, { token: i4$1.MatSnackBar }, { token: i1$1.FormBuilder }], target: i0.ɵɵFactoryTarget.Component });
|
|
1050
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.5", type: PinTargetLookupComponent, isStandalone: true, selector: "cadmus-pin-target-lookup", inputs: { pinByTypeMode: { classPropertyName: "pinByTypeMode", publicName: "pinByTypeMode", isSignal: true, isRequired: false, transformFunction: null }, canSwitchMode: { classPropertyName: "canSwitchMode", publicName: "canSwitchMode", isSignal: true, isRequired: false, transformFunction: null }, canEditTarget: { classPropertyName: "canEditTarget", publicName: "canEditTarget", isSignal: true, isRequired: false, transformFunction: null }, lookupDefinitions: { classPropertyName: "lookupDefinitions", publicName: "lookupDefinitions", isSignal: true, isRequired: false, transformFunction: null }, extLookupConfigs: { classPropertyName: "extLookupConfigs", publicName: "extLookupConfigs", isSignal: true, isRequired: false, transformFunction: null }, internalDefault: { classPropertyName: "internalDefault", publicName: "internalDefault", isSignal: true, isRequired: false, transformFunction: null }, target: { classPropertyName: "target", publicName: "target", isSignal: true, isRequired: false, transformFunction: null }, defaultPartTypeKey: { classPropertyName: "defaultPartTypeKey", publicName: "defaultPartTypeKey", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { pinByTypeMode: "pinByTypeModeChange", canSwitchMode: "canSwitchModeChange", lookupDefinitions: "lookupDefinitionsChange", target: "targetChange", editorClose: "editorClose", extMoreRequest: "extMoreRequest", extLookupConfigChange: "extLookupConfigChange" }, ngImport: i0, template: "<form [formGroup]=\"form\" (submit)=\"save()\">\r\n <div class=\"form-row\">\r\n <!-- external -->\r\n <mat-checkbox [formControl]=\"external\">external</mat-checkbox>\r\n <!-- mode switcher -->\r\n @if (!external.value) {\r\n <div>\r\n @if (canSwitchMode()) {\r\n <mat-checkbox [formControl]=\"byTypeMode\"> by type</mat-checkbox>\r\n }\r\n </div>\r\n }\r\n </div>\r\n\r\n <div class=\"form-row\">\r\n <!-- label -->\r\n <div>\r\n @if (external.value || canEditTarget()) {\r\n <mat-form-field>\r\n <mat-label>label</mat-label>\r\n <input matInput [formControl]=\"label\" />\r\n @if ($any(label).errors?.required && (label.dirty || label.touched)) {\r\n <mat-error>label required</mat-error>\r\n } @if ( $any(label).errors?.maxLength && (label.dirty || label.touched)\r\n ) {\r\n <mat-error>label too long</mat-error>\r\n }\r\n </mat-form-field>\r\n } @if (!external.value && !canEditTarget() && label.value) {\r\n <div class=\"info\"><span class=\"label\">label</span>{{ label.value }}</div>\r\n }\r\n </div>\r\n\r\n <!-- gid -->\r\n <div>\r\n @if (external.value || canEditTarget()) {\r\n <mat-form-field>\r\n <mat-label>GID</mat-label>\r\n <input matInput [formControl]=\"gid\" />\r\n @if ($any(gid).errors?.required && (gid.dirty || gid.touched)) {\r\n <mat-error>GID required</mat-error>\r\n } @if ($any(gid).errors?.maxLength && (gid.dirty || gid.touched)) {\r\n <mat-error>GID too long</mat-error>\r\n }\r\n </mat-form-field>\r\n } @if (!external.value && !canEditTarget() && gid.value) {\r\n <div class=\"info\">\r\n <span class=\"label\">GID</span> <span class=\"gid\">{{ gid.value }}</span>\r\n </div>\r\n }\r\n </div>\r\n </div>\r\n\r\n <!-- external lookup set -->\r\n @if (external.value && extLookupConfigs().length) {\r\n <div>\r\n <cadmus-ref-lookup-set\r\n [configs]=\"extLookupConfigs()\"\r\n (itemChange)=\"onExtItemChange($event)\"\r\n (moreRequest)=\"onExtMoreRequest($event)\"\r\n (configChange)=\"onExtConfigChange($any($event))\"\r\n ></cadmus-ref-lookup-set>\r\n </div>\r\n }\r\n\r\n <!-- BY ITEM -->\r\n @if (!external.value) {\r\n <div>\r\n <div class=\"form-row\">\r\n @if (!byTypeMode.value) {\r\n <fieldset class=\"form-row\">\r\n <legend>pin filters</legend>\r\n <!-- item filter -->\r\n <cadmus-ref-lookup\r\n [service]=\"itemLookupService\"\r\n label=\"item\"\r\n (itemChange)=\"onItemLookupChange($event)\"\r\n ></cadmus-ref-lookup>\r\n <!-- part filter -->\r\n @if (itemParts.length) {\r\n <mat-form-field>\r\n <mat-label>part</mat-label>\r\n <mat-select [formControl]=\"itemPart\">\r\n <mat-option [value]=\"null\">(any)</mat-option>\r\n @for (p of itemParts; track p) {\r\n <mat-option [value]=\"p\">{{\r\n p.typeId | flatLookup : modelEntries : \"id\" : \"value\"\r\n }}</mat-option>\r\n }\r\n </mat-select>\r\n </mat-form-field>\r\n }\r\n </fieldset>\r\n }\r\n <!-- BY TYPE -->\r\n @if (byTypeMode.value) {\r\n <div>\r\n <!-- par type filter -->\r\n @if (partTypeKeys.length) {\r\n <mat-form-field>\r\n <mat-label>part type</mat-label>\r\n <mat-select [formControl]=\"partTypeKey\">\r\n @for (k of partTypeKeys; track k) {\r\n <mat-option [value]=\"k\">{{ k }}</mat-option>\r\n }\r\n </mat-select>\r\n </mat-form-field>\r\n }\r\n </div>\r\n }\r\n <!-- PIN -->\r\n @if (partTypeKey.value) {\r\n <div>\r\n <!-- pin lookup -->\r\n <cadmus-ref-lookup\r\n [service]=\"pinLookupService\"\r\n [baseFilter]=\"filter\"\r\n [options]=\"pinFilterOptions\"\r\n label=\"pin\"\r\n (itemChange)=\"onPinLookupChange($event)\"\r\n />\r\n </div>\r\n }\r\n </div>\r\n <!-- data -->\r\n @if (lookupData?.pin?.name) {\r\n <mat-expansion-panel id=\"data\">\r\n <mat-expansion-panel-header>pin data</mat-expansion-panel-header>\r\n <!-- table -->\r\n <table>\r\n <thead>\r\n <th></th>\r\n <th>source</th>\r\n <th>value</th>\r\n </thead>\r\n <tbody>\r\n <!-- pin -->\r\n @if (lookupData?.pin?.value) {\r\n <tr>\r\n <td>\r\n <button\r\n type=\"button\"\r\n mat-icon-button\r\n [cdkCopyToClipboard]=\"lookupData!.pin!.value\"\r\n (cdkCopyToClipboardCopied)=\"onCopied()\"\r\n >\r\n <mat-icon class=\"mat-primary\">content_copy</mat-icon>\r\n </button>\r\n </td>\r\n <td>pin</td>\r\n <td>{{ lookupData!.pin.value }}</td>\r\n </tr>\r\n }\r\n <!-- item ID -->\r\n @if (lookupData?.pin?.itemId) {\r\n <tr>\r\n <td>\r\n <button\r\n type=\"button\"\r\n mat-icon-button\r\n [cdkCopyToClipboard]=\"lookupData!.pin!.itemId\"\r\n (cdkCopyToClipboardCopied)=\"onCopied()\"\r\n >\r\n <mat-icon class=\"mat-primary\">content_copy</mat-icon>\r\n </button>\r\n </td>\r\n <td>item ID</td>\r\n <td>{{ lookupData!.pin.itemId }}</td>\r\n </tr>\r\n }\r\n <!-- item title -->\r\n @if (lookupData?.item?.title) {\r\n <tr>\r\n <td>\r\n <button\r\n type=\"button\"\r\n mat-icon-button\r\n [cdkCopyToClipboard]=\"lookupData!.item!.title\"\r\n (cdkCopyToClipboardCopied)=\"onCopied()\"\r\n >\r\n <mat-icon class=\"mat-primary\">content_copy</mat-icon>\r\n </button>\r\n </td>\r\n <td>item title</td>\r\n <td>{{ lookupData!.item!.title }}</td>\r\n </tr>\r\n }\r\n <!-- part ID -->\r\n @if (lookupData?.pin?.partId) {\r\n <tr>\r\n <td>\r\n <button\r\n type=\"button\"\r\n mat-icon-button\r\n [cdkCopyToClipboard]=\"lookupData!.pin!.partId\"\r\n (cdkCopyToClipboardCopied)=\"onCopied()\"\r\n >\r\n <mat-icon class=\"mat-primary\">content_copy</mat-icon>\r\n </button>\r\n </td>\r\n <td>part ID</td>\r\n <td>{{ lookupData!.pin.partId }}</td>\r\n </tr>\r\n }\r\n <!-- part type ID -->\r\n @if (lookupData?.pin?.partTypeId) {\r\n <tr>\r\n <td>\r\n <button\r\n type=\"button\"\r\n mat-icon-button\r\n [cdkCopyToClipboard]=\"lookupData!.pin!.partTypeId\"\r\n (cdkCopyToClipboardCopied)=\"onCopied()\"\r\n >\r\n <mat-icon class=\"mat-primary\">content_copy</mat-icon>\r\n </button>\r\n </td>\r\n <td>part type ID</td>\r\n <td>{{ lookupData!.pin!.partTypeId }}</td>\r\n </tr>\r\n }\r\n <!-- part role ID -->\r\n @if (lookupData?.pin?.roleId) {\r\n <tr>\r\n <td>\r\n <button\r\n type=\"button\"\r\n mat-icon-button\r\n [cdkCopyToClipboard]=\"lookupData!.pin!.roleId!\"\r\n (cdkCopyToClipboardCopied)=\"onCopied()\"\r\n >\r\n <mat-icon class=\"mat-primary\">content_copy</mat-icon>\r\n </button>\r\n </td>\r\n <td>part role ID</td>\r\n <td>{{ lookupData!.pin!.roleId }}</td>\r\n </tr>\r\n }\r\n <!-- part's metadata -->\r\n @for ( m of lookupData?.metaPart?.metadata || []; track m; let i =\r\n $index) {\r\n <tr>\r\n <td>\r\n <button\r\n type=\"button\"\r\n mat-icon-button\r\n [cdkCopyToClipboard]=\"m.value\"\r\n (cdkCopyToClipboardCopied)=\"onCopied()\"\r\n >\r\n <mat-icon class=\"mat-primary\">content_copy</mat-icon>\r\n </button>\r\n </td>\r\n <td class=\"metadata\">{{ m.name }}</td>\r\n <td class=\"metadata\">{{ m.value }}</td>\r\n </tr>\r\n }\r\n </tbody>\r\n </table>\r\n </mat-expansion-panel>\r\n }\r\n </div>\r\n }\r\n\r\n <!-- buttons -->\r\n <div class=\"button-row\" id=\"toolbar\">\r\n <button mat-icon-button type=\"button\" (click)=\"close()\">\r\n <mat-icon class=\"mat-warn\">close</mat-icon>\r\n </button>\r\n <button mat-flat-button type=\"submit\" [disabled]=\"form.invalid\">\r\n <mat-icon>check_circle</mat-icon>\r\n target\r\n </button>\r\n </div>\r\n</form>\r\n", styles: [".metadata{color:#4a3001}.info{border:1px solid silver;border-radius:6px;background-color:silver;color:#fff;padding:4px;margin:8px 0}.info .label{background-color:#fff;color:silver;margin:0 6px}#data{margin:8px 0}table{border:1px solid silver;border-radius:6px;padding:4px;margin-top:8px}tr:nth-child(odd){background-color:#f0f0f0}th{font-weight:400;text-align:left;color:silver}.form-row{display:flex;gap:8px;align-items:center;flex-wrap:wrap}.form-row *{flex:0 0 auto}.button-row{display:flex;align-items:center;flex-wrap:wrap}.label{border:1px solid silver;border-radius:6px;padding:4px}fieldset{border:1px solid silver;border-radius:6px;padding:8px;margin-bottom:8px}legend{color:silver}div#toolbar{margin-top:8px}\n"], dependencies: [{ kind: "ngmodule", type: FormsModule }, { 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: "ngmodule", type: ReactiveFormsModule }, { 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: "ngmodule", type: ClipboardModule }, { kind: "directive", type: i6$2.CdkCopyToClipboard, selector: "[cdkCopyToClipboard]", inputs: ["cdkCopyToClipboard", "cdkCopyToClipboardAttempts"], outputs: ["cdkCopyToClipboardCopied"] }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i3.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", exportAs: ["matButton"] }, { kind: "component", type: i3.MatIconButton, selector: "button[mat-icon-button]", exportAs: ["matButton"] }, { kind: "ngmodule", type: MatCheckboxModule }, { kind: "component", type: i8$1.MatCheckbox, selector: "mat-checkbox", inputs: ["aria-label", "aria-labelledby", "aria-describedby", "aria-expanded", "aria-controls", "aria-owns", "id", "required", "labelPosition", "name", "value", "disableRipple", "tabIndex", "color", "disabledInteractive", "checked", "disabled", "indeterminate"], outputs: ["change", "indeterminateChange"], exportAs: ["matCheckbox"] }, { kind: "ngmodule", type: MatExpansionModule }, { kind: "component", type: i4.MatExpansionPanel, selector: "mat-expansion-panel", inputs: ["hideToggle", "togglePosition"], outputs: ["afterExpand", "afterCollapse"], exportAs: ["matExpansionPanel"] }, { kind: "component", type: i4.MatExpansionPanelHeader, selector: "mat-expansion-panel-header", inputs: ["expandedHeight", "collapsedHeight", "tabIndex"] }, { kind: "ngmodule", type: MatFormFieldModule }, { kind: "component", type: i6.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i6.MatLabel, selector: "mat-label" }, { kind: "directive", type: i6.MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i7.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: MatInputModule }, { kind: "directive", type: i8.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly", "disabledInteractive"], exportAs: ["matInput"] }, { kind: "ngmodule", type: MatSelectModule }, { kind: "component", type: i9.MatSelect, selector: "mat-select", inputs: ["aria-describedby", "panelClass", "disabled", "disableRipple", "tabIndex", "hideSingleSelectionIndicator", "placeholder", "required", "multiple", "disableOptionCentering", "compareWith", "value", "aria-label", "aria-labelledby", "errorStateMatcher", "typeaheadDebounceInterval", "sortComparator", "id", "panelWidth", "canSelectNullableOptions"], outputs: ["openedChange", "opened", "closed", "selectionChange", "valueChange"], exportAs: ["matSelect"] }, { kind: "component", type: i10.MatOption, selector: "mat-option", inputs: ["value", "id", "disabled"], outputs: ["onSelectionChange"], exportAs: ["matOption"] }, { kind: "component", type: RefLookupComponent, selector: "cadmus-ref-lookup", inputs: ["label", "limit", "baseFilter", "service", "item", "required", "hasMore", "linkTemplate", "optDialog", "options"], outputs: ["itemChange", "optionsChange", "moreRequest"] }, { kind: "component", type: RefLookupSetComponent, selector: "cadmus-ref-lookup-set", inputs: ["configs", "iconSize"], outputs: ["configChange", "itemChange", "moreRequest"] }, { kind: "pipe", type: FlatLookupPipe, name: "flatLookup" }] });
|
|
941
1051
|
}
|
|
942
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.
|
|
1052
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: PinTargetLookupComponent, decorators: [{
|
|
943
1053
|
type: Component,
|
|
944
1054
|
args: [{ selector: 'cadmus-pin-target-lookup', imports: [
|
|
945
1055
|
FormsModule,
|
|
@@ -954,36 +1064,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.1", ngImpor
|
|
|
954
1064
|
MatSelectModule,
|
|
955
1065
|
RefLookupComponent,
|
|
956
1066
|
RefLookupSetComponent,
|
|
957
|
-
FlatLookupPipe
|
|
958
|
-
], template: "<form [formGroup]=\"form\" (submit)=\"save()\">\r\n <div class=\"form-row\">\r\n <!-- external -->\r\n <mat-checkbox [formControl]=\"external\">external</mat-checkbox>\r\n <!-- mode switcher -->\r\n @if (!external.value) {\r\n <div>\r\n @if (canSwitchMode) {\r\n <mat-checkbox [formControl]=\"byTypeMode\"> by type</mat-checkbox>\r\n }\r\n </div>\r\n }\r\n </div>\r\n\r\n <div class=\"form-row\">\r\n <!-- label -->\r\n <div>\r\n @if (external.value || canEditTarget) {\r\n <mat-form-field>\r\n <mat-label>label</mat-label>\r\n <input matInput [formControl]=\"label\" />\r\n @if ($any(label).errors?.required && (label.dirty || label.touched)) {\r\n <mat-error>label required</mat-error>\r\n } @if ( $any(label).errors?.maxLength && (label.dirty || label.touched)\r\n ) {\r\n <mat-error>label too long</mat-error>\r\n }\r\n </mat-form-field>\r\n } @if (!external.value && !canEditTarget && label.value) {\r\n <div class=\"info\"><span class=\"label\">label</span>{{ label.value }}</div>\r\n }\r\n </div>\r\n\r\n <!-- gid -->\r\n <div>\r\n @if (external.value || canEditTarget) {\r\n <mat-form-field>\r\n <mat-label>GID</mat-label>\r\n <input matInput [formControl]=\"gid\" />\r\n @if ($any(gid).errors?.required && (gid.dirty || gid.touched)) {\r\n <mat-error>GID required</mat-error>\r\n } @if ($any(gid).errors?.maxLength && (gid.dirty || gid.touched)) {\r\n <mat-error>GID too long</mat-error>\r\n }\r\n </mat-form-field>\r\n } @if (!external.value && !canEditTarget && gid.value) {\r\n <div class=\"info\">\r\n <span class=\"label\">GID</span> <span class=\"gid\">{{ gid.value }}</span>\r\n </div>\r\n }\r\n </div>\r\n </div>\r\n\r\n <!-- external lookup set -->\r\n @if (external.value && extLookupConfigs.length) {\r\n <div>\r\n <cadmus-ref-lookup-set\r\n [configs]=\"extLookupConfigs\"\r\n (itemChange)=\"onExtItemChange($event)\"\r\n (moreRequest)=\"onExtMoreRequest($event)\"\r\n (configChange)=\"onExtConfigChange($any($event))\"\r\n ></cadmus-ref-lookup-set>\r\n </div>\r\n }\r\n\r\n <!-- BY ITEM -->\r\n @if (!external.value) {\r\n <div>\r\n @if (!byTypeMode.value) {\r\n <fieldset class=\"form-row\">\r\n <legend>pin filters</legend>\r\n <!-- item filter -->\r\n <cadmus-ref-lookup\r\n [service]=\"itemLookupService\"\r\n label=\"item\"\r\n (itemChange)=\"onItemLookupChange($event)\"\r\n ></cadmus-ref-lookup>\r\n <!-- part filter -->\r\n @if (itemParts.length) {\r\n <mat-form-field>\r\n <mat-label>part</mat-label>\r\n <mat-select [formControl]=\"itemPart\">\r\n <mat-option [value]=\"null\">(any)</mat-option>\r\n @for (p of itemParts; track p) {\r\n <mat-option [value]=\"p\">{{\r\n p.typeId | flatLookup : modelEntries : \"id\" : \"value\"\r\n }}</mat-option>\r\n }\r\n </mat-select>\r\n </mat-form-field>\r\n }\r\n </fieldset>\r\n }\r\n <!-- BY TYPE -->\r\n @if (byTypeMode.value) {\r\n <div>\r\n <!-- par type filter -->\r\n @if (partTypeKeys.length) {\r\n <mat-form-field>\r\n <mat-label>part type</mat-label>\r\n <mat-select [formControl]=\"partTypeKey\">\r\n @for (k of partTypeKeys; track k) {\r\n <mat-option [value]=\"k\">{{ k }}</mat-option>\r\n }\r\n </mat-select>\r\n </mat-form-field>\r\n }\r\n </div>\r\n }\r\n <!-- PIN -->\r\n @if (partTypeKey.value) {\r\n <div>\r\n <!-- pin lookup -->\r\n <cadmus-ref-lookup\r\n [service]=\"pinLookupService\"\r\n [baseFilter]=\"filter\"\r\n [options]=\"pinFilterOptions\"\r\n label=\"pin\"\r\n (itemChange)=\"onPinLookupChange($event)\"\r\n ></cadmus-ref-lookup>\r\n </div>\r\n }\r\n <!-- data -->\r\n @if (lookupData?.pin?.name) {\r\n <mat-expansion-panel id=\"data\">\r\n <mat-expansion-panel-header>pin data</mat-expansion-panel-header>\r\n <!-- table -->\r\n <table>\r\n <thead>\r\n <th></th>\r\n <th>source</th>\r\n <th>value</th>\r\n </thead>\r\n <tbody>\r\n <!-- pin -->\r\n @if (lookupData?.pin?.value) {\r\n <tr>\r\n <td>\r\n <button\r\n type=\"button\"\r\n mat-icon-button\r\n [cdkCopyToClipboard]=\"lookupData!.pin!.value\"\r\n (cdkCopyToClipboardCopied)=\"onCopied()\"\r\n >\r\n <mat-icon class=\"mat-primary\">content_copy</mat-icon>\r\n </button>\r\n </td>\r\n <td>pin</td>\r\n <td>{{ lookupData!.pin.value }}</td>\r\n </tr>\r\n }\r\n <!-- item ID -->\r\n @if (lookupData?.pin?.itemId) {\r\n <tr>\r\n <td>\r\n <button\r\n type=\"button\"\r\n mat-icon-button\r\n [cdkCopyToClipboard]=\"lookupData!.pin!.itemId\"\r\n (cdkCopyToClipboardCopied)=\"onCopied()\"\r\n >\r\n <mat-icon class=\"mat-primary\">content_copy</mat-icon>\r\n </button>\r\n </td>\r\n <td>item ID</td>\r\n <td>{{ lookupData!.pin.itemId }}</td>\r\n </tr>\r\n }\r\n <!-- item title -->\r\n @if (lookupData?.item?.title) {\r\n <tr>\r\n <td>\r\n <button\r\n type=\"button\"\r\n mat-icon-button\r\n [cdkCopyToClipboard]=\"lookupData!.item!.title\"\r\n (cdkCopyToClipboardCopied)=\"onCopied()\"\r\n >\r\n <mat-icon class=\"mat-primary\">content_copy</mat-icon>\r\n </button>\r\n </td>\r\n <td>item title</td>\r\n <td>{{ lookupData!.item!.title }}</td>\r\n </tr>\r\n }\r\n <!-- part ID -->\r\n @if (lookupData?.pin?.partId) {\r\n <tr>\r\n <td>\r\n <button\r\n type=\"button\"\r\n mat-icon-button\r\n [cdkCopyToClipboard]=\"lookupData!.pin!.partId\"\r\n (cdkCopyToClipboardCopied)=\"onCopied()\"\r\n >\r\n <mat-icon class=\"mat-primary\">content_copy</mat-icon>\r\n </button>\r\n </td>\r\n <td>part ID</td>\r\n <td>{{ lookupData!.pin.partId }}</td>\r\n </tr>\r\n }\r\n <!-- part type ID -->\r\n @if (lookupData?.pin?.partTypeId) {\r\n <tr>\r\n <td>\r\n <button\r\n type=\"button\"\r\n mat-icon-button\r\n [cdkCopyToClipboard]=\"lookupData!.pin!.partTypeId\"\r\n (cdkCopyToClipboardCopied)=\"onCopied()\"\r\n >\r\n <mat-icon class=\"mat-primary\">content_copy</mat-icon>\r\n </button>\r\n </td>\r\n <td>part type ID</td>\r\n <td>{{ lookupData!.pin!.partTypeId }}</td>\r\n </tr>\r\n }\r\n <!-- part role ID -->\r\n @if (lookupData?.pin?.roleId) {\r\n <tr>\r\n <td>\r\n <button\r\n type=\"button\"\r\n mat-icon-button\r\n [cdkCopyToClipboard]=\"lookupData!.pin!.roleId!\"\r\n (cdkCopyToClipboardCopied)=\"onCopied()\"\r\n >\r\n <mat-icon class=\"mat-primary\">content_copy</mat-icon>\r\n </button>\r\n </td>\r\n <td>part role ID</td>\r\n <td>{{ lookupData!.pin!.roleId }}</td>\r\n </tr>\r\n }\r\n <!-- part's metadata -->\r\n @for ( m of lookupData?.metaPart?.metadata || []; track m; let i =\r\n $index) {\r\n <tr>\r\n <td>\r\n <button\r\n type=\"button\"\r\n mat-icon-button\r\n [cdkCopyToClipboard]=\"m.value\"\r\n (cdkCopyToClipboardCopied)=\"onCopied()\"\r\n >\r\n <mat-icon class=\"mat-primary\">content_copy</mat-icon>\r\n </button>\r\n </td>\r\n <td class=\"metadata\">{{ m.name }}</td>\r\n <td class=\"metadata\">{{ m.value }}</td>\r\n </tr>\r\n }\r\n </tbody>\r\n </table>\r\n </mat-expansion-panel>\r\n }\r\n </div>\r\n }\r\n\r\n <!-- buttons -->\r\n <div class=\"button-row\">\r\n <button mat-icon-button type=\"button\" (click)=\"close()\">\r\n <mat-icon color=\"warn\" class=\"mat-warn\">close</mat-icon>\r\n </button>\r\n <button mat-flat-button type=\"submit\" [disabled]=\"form.invalid\">\r\n <mat-icon>check_circle</mat-icon>\r\n target\r\n </button>\r\n </div>\r\n</form>\r\n", styles: [".metadata{color:#4a3001}.info{border:1px solid silver;border-radius:6px;background-color:silver;color:#fff;padding:4px;margin:8px 0}.info .label{background-color:#fff;color:silver;margin:0 6px}#data{margin:8px 0}table{border:1px solid silver;border-radius:6px;padding:4px;margin-top:8px}tr:nth-child(odd){background-color:#f0f0f0}th{font-weight:400;text-align:left;color:silver}.form-row{display:flex;gap:8px;align-items:center;flex-wrap:wrap}.form-row *{flex:0 0 auto}.button-row{display:flex;align-items:center;flex-wrap:wrap}.label{border:1px solid silver;border-radius:6px;padding:4px}fieldset{border:1px solid silver;border-radius:6px;padding:4px 8px;margin-bottom:8px}legend{color:silver}\n"] }]
|
|
1067
|
+
FlatLookupPipe,
|
|
1068
|
+
], template: "<form [formGroup]=\"form\" (submit)=\"save()\">\r\n <div class=\"form-row\">\r\n <!-- external -->\r\n <mat-checkbox [formControl]=\"external\">external</mat-checkbox>\r\n <!-- mode switcher -->\r\n @if (!external.value) {\r\n <div>\r\n @if (canSwitchMode()) {\r\n <mat-checkbox [formControl]=\"byTypeMode\"> by type</mat-checkbox>\r\n }\r\n </div>\r\n }\r\n </div>\r\n\r\n <div class=\"form-row\">\r\n <!-- label -->\r\n <div>\r\n @if (external.value || canEditTarget()) {\r\n <mat-form-field>\r\n <mat-label>label</mat-label>\r\n <input matInput [formControl]=\"label\" />\r\n @if ($any(label).errors?.required && (label.dirty || label.touched)) {\r\n <mat-error>label required</mat-error>\r\n } @if ( $any(label).errors?.maxLength && (label.dirty || label.touched)\r\n ) {\r\n <mat-error>label too long</mat-error>\r\n }\r\n </mat-form-field>\r\n } @if (!external.value && !canEditTarget() && label.value) {\r\n <div class=\"info\"><span class=\"label\">label</span>{{ label.value }}</div>\r\n }\r\n </div>\r\n\r\n <!-- gid -->\r\n <div>\r\n @if (external.value || canEditTarget()) {\r\n <mat-form-field>\r\n <mat-label>GID</mat-label>\r\n <input matInput [formControl]=\"gid\" />\r\n @if ($any(gid).errors?.required && (gid.dirty || gid.touched)) {\r\n <mat-error>GID required</mat-error>\r\n } @if ($any(gid).errors?.maxLength && (gid.dirty || gid.touched)) {\r\n <mat-error>GID too long</mat-error>\r\n }\r\n </mat-form-field>\r\n } @if (!external.value && !canEditTarget() && gid.value) {\r\n <div class=\"info\">\r\n <span class=\"label\">GID</span> <span class=\"gid\">{{ gid.value }}</span>\r\n </div>\r\n }\r\n </div>\r\n </div>\r\n\r\n <!-- external lookup set -->\r\n @if (external.value && extLookupConfigs().length) {\r\n <div>\r\n <cadmus-ref-lookup-set\r\n [configs]=\"extLookupConfigs()\"\r\n (itemChange)=\"onExtItemChange($event)\"\r\n (moreRequest)=\"onExtMoreRequest($event)\"\r\n (configChange)=\"onExtConfigChange($any($event))\"\r\n ></cadmus-ref-lookup-set>\r\n </div>\r\n }\r\n\r\n <!-- BY ITEM -->\r\n @if (!external.value) {\r\n <div>\r\n <div class=\"form-row\">\r\n @if (!byTypeMode.value) {\r\n <fieldset class=\"form-row\">\r\n <legend>pin filters</legend>\r\n <!-- item filter -->\r\n <cadmus-ref-lookup\r\n [service]=\"itemLookupService\"\r\n label=\"item\"\r\n (itemChange)=\"onItemLookupChange($event)\"\r\n ></cadmus-ref-lookup>\r\n <!-- part filter -->\r\n @if (itemParts.length) {\r\n <mat-form-field>\r\n <mat-label>part</mat-label>\r\n <mat-select [formControl]=\"itemPart\">\r\n <mat-option [value]=\"null\">(any)</mat-option>\r\n @for (p of itemParts; track p) {\r\n <mat-option [value]=\"p\">{{\r\n p.typeId | flatLookup : modelEntries : \"id\" : \"value\"\r\n }}</mat-option>\r\n }\r\n </mat-select>\r\n </mat-form-field>\r\n }\r\n </fieldset>\r\n }\r\n <!-- BY TYPE -->\r\n @if (byTypeMode.value) {\r\n <div>\r\n <!-- par type filter -->\r\n @if (partTypeKeys.length) {\r\n <mat-form-field>\r\n <mat-label>part type</mat-label>\r\n <mat-select [formControl]=\"partTypeKey\">\r\n @for (k of partTypeKeys; track k) {\r\n <mat-option [value]=\"k\">{{ k }}</mat-option>\r\n }\r\n </mat-select>\r\n </mat-form-field>\r\n }\r\n </div>\r\n }\r\n <!-- PIN -->\r\n @if (partTypeKey.value) {\r\n <div>\r\n <!-- pin lookup -->\r\n <cadmus-ref-lookup\r\n [service]=\"pinLookupService\"\r\n [baseFilter]=\"filter\"\r\n [options]=\"pinFilterOptions\"\r\n label=\"pin\"\r\n (itemChange)=\"onPinLookupChange($event)\"\r\n />\r\n </div>\r\n }\r\n </div>\r\n <!-- data -->\r\n @if (lookupData?.pin?.name) {\r\n <mat-expansion-panel id=\"data\">\r\n <mat-expansion-panel-header>pin data</mat-expansion-panel-header>\r\n <!-- table -->\r\n <table>\r\n <thead>\r\n <th></th>\r\n <th>source</th>\r\n <th>value</th>\r\n </thead>\r\n <tbody>\r\n <!-- pin -->\r\n @if (lookupData?.pin?.value) {\r\n <tr>\r\n <td>\r\n <button\r\n type=\"button\"\r\n mat-icon-button\r\n [cdkCopyToClipboard]=\"lookupData!.pin!.value\"\r\n (cdkCopyToClipboardCopied)=\"onCopied()\"\r\n >\r\n <mat-icon class=\"mat-primary\">content_copy</mat-icon>\r\n </button>\r\n </td>\r\n <td>pin</td>\r\n <td>{{ lookupData!.pin.value }}</td>\r\n </tr>\r\n }\r\n <!-- item ID -->\r\n @if (lookupData?.pin?.itemId) {\r\n <tr>\r\n <td>\r\n <button\r\n type=\"button\"\r\n mat-icon-button\r\n [cdkCopyToClipboard]=\"lookupData!.pin!.itemId\"\r\n (cdkCopyToClipboardCopied)=\"onCopied()\"\r\n >\r\n <mat-icon class=\"mat-primary\">content_copy</mat-icon>\r\n </button>\r\n </td>\r\n <td>item ID</td>\r\n <td>{{ lookupData!.pin.itemId }}</td>\r\n </tr>\r\n }\r\n <!-- item title -->\r\n @if (lookupData?.item?.title) {\r\n <tr>\r\n <td>\r\n <button\r\n type=\"button\"\r\n mat-icon-button\r\n [cdkCopyToClipboard]=\"lookupData!.item!.title\"\r\n (cdkCopyToClipboardCopied)=\"onCopied()\"\r\n >\r\n <mat-icon class=\"mat-primary\">content_copy</mat-icon>\r\n </button>\r\n </td>\r\n <td>item title</td>\r\n <td>{{ lookupData!.item!.title }}</td>\r\n </tr>\r\n }\r\n <!-- part ID -->\r\n @if (lookupData?.pin?.partId) {\r\n <tr>\r\n <td>\r\n <button\r\n type=\"button\"\r\n mat-icon-button\r\n [cdkCopyToClipboard]=\"lookupData!.pin!.partId\"\r\n (cdkCopyToClipboardCopied)=\"onCopied()\"\r\n >\r\n <mat-icon class=\"mat-primary\">content_copy</mat-icon>\r\n </button>\r\n </td>\r\n <td>part ID</td>\r\n <td>{{ lookupData!.pin.partId }}</td>\r\n </tr>\r\n }\r\n <!-- part type ID -->\r\n @if (lookupData?.pin?.partTypeId) {\r\n <tr>\r\n <td>\r\n <button\r\n type=\"button\"\r\n mat-icon-button\r\n [cdkCopyToClipboard]=\"lookupData!.pin!.partTypeId\"\r\n (cdkCopyToClipboardCopied)=\"onCopied()\"\r\n >\r\n <mat-icon class=\"mat-primary\">content_copy</mat-icon>\r\n </button>\r\n </td>\r\n <td>part type ID</td>\r\n <td>{{ lookupData!.pin!.partTypeId }}</td>\r\n </tr>\r\n }\r\n <!-- part role ID -->\r\n @if (lookupData?.pin?.roleId) {\r\n <tr>\r\n <td>\r\n <button\r\n type=\"button\"\r\n mat-icon-button\r\n [cdkCopyToClipboard]=\"lookupData!.pin!.roleId!\"\r\n (cdkCopyToClipboardCopied)=\"onCopied()\"\r\n >\r\n <mat-icon class=\"mat-primary\">content_copy</mat-icon>\r\n </button>\r\n </td>\r\n <td>part role ID</td>\r\n <td>{{ lookupData!.pin!.roleId }}</td>\r\n </tr>\r\n }\r\n <!-- part's metadata -->\r\n @for ( m of lookupData?.metaPart?.metadata || []; track m; let i =\r\n $index) {\r\n <tr>\r\n <td>\r\n <button\r\n type=\"button\"\r\n mat-icon-button\r\n [cdkCopyToClipboard]=\"m.value\"\r\n (cdkCopyToClipboardCopied)=\"onCopied()\"\r\n >\r\n <mat-icon class=\"mat-primary\">content_copy</mat-icon>\r\n </button>\r\n </td>\r\n <td class=\"metadata\">{{ m.name }}</td>\r\n <td class=\"metadata\">{{ m.value }}</td>\r\n </tr>\r\n }\r\n </tbody>\r\n </table>\r\n </mat-expansion-panel>\r\n }\r\n </div>\r\n }\r\n\r\n <!-- buttons -->\r\n <div class=\"button-row\" id=\"toolbar\">\r\n <button mat-icon-button type=\"button\" (click)=\"close()\">\r\n <mat-icon class=\"mat-warn\">close</mat-icon>\r\n </button>\r\n <button mat-flat-button type=\"submit\" [disabled]=\"form.invalid\">\r\n <mat-icon>check_circle</mat-icon>\r\n target\r\n </button>\r\n </div>\r\n</form>\r\n", styles: [".metadata{color:#4a3001}.info{border:1px solid silver;border-radius:6px;background-color:silver;color:#fff;padding:4px;margin:8px 0}.info .label{background-color:#fff;color:silver;margin:0 6px}#data{margin:8px 0}table{border:1px solid silver;border-radius:6px;padding:4px;margin-top:8px}tr:nth-child(odd){background-color:#f0f0f0}th{font-weight:400;text-align:left;color:silver}.form-row{display:flex;gap:8px;align-items:center;flex-wrap:wrap}.form-row *{flex:0 0 auto}.button-row{display:flex;align-items:center;flex-wrap:wrap}.label{border:1px solid silver;border-radius:6px;padding:4px}fieldset{border:1px solid silver;border-radius:6px;padding:8px;margin-bottom:8px}legend{color:silver}div#toolbar{margin-top:8px}\n"] }]
|
|
959
1069
|
}], ctorParameters: () => [{ type: undefined, decorators: [{
|
|
960
1070
|
type: Inject,
|
|
961
1071
|
args: ['indexLookupDefinitions']
|
|
962
|
-
}] }, { type: ItemRefLookupService }, { type: PinRefLookupService }, { type: i1.ItemService }, { type: i1.ThesaurusService }, { type: i4$1.MatSnackBar }, { type: i1$1.FormBuilder }]
|
|
963
|
-
type: Input
|
|
964
|
-
}], canSwitchMode: [{
|
|
965
|
-
type: Input
|
|
966
|
-
}], canEditTarget: [{
|
|
967
|
-
type: Input
|
|
968
|
-
}], lookupDefinitions: [{
|
|
969
|
-
type: Input
|
|
970
|
-
}], extLookupConfigs: [{
|
|
971
|
-
type: Input
|
|
972
|
-
}], internalDefault: [{
|
|
973
|
-
type: Input
|
|
974
|
-
}], target: [{
|
|
975
|
-
type: Input
|
|
976
|
-
}], defaultPartTypeKey: [{
|
|
977
|
-
type: Input
|
|
978
|
-
}], editorClose: [{
|
|
979
|
-
type: Output
|
|
980
|
-
}], targetChange: [{
|
|
981
|
-
type: Output
|
|
982
|
-
}], extMoreRequest: [{
|
|
983
|
-
type: Output
|
|
984
|
-
}], extLookupConfigChange: [{
|
|
985
|
-
type: Output
|
|
986
|
-
}] } });
|
|
1072
|
+
}] }, { type: ItemRefLookupService }, { type: PinRefLookupService }, { type: i1.ItemService }, { type: i1.ThesaurusService }, { type: i4$1.MatSnackBar }, { type: i1$1.FormBuilder }] });
|
|
987
1073
|
|
|
988
1074
|
/**
|
|
989
1075
|
* The key to be used to retrieve the external lookup configs from the
|
|
@@ -996,21 +1082,79 @@ const ASSERTED_COMPOSITE_ID_CONFIGS_KEY = 'cadmus-refs-asserted-composite-id.con
|
|
|
996
1082
|
* composite ID, which can be an external ID or a lookup ID.
|
|
997
1083
|
*/
|
|
998
1084
|
class AssertedCompositeIdComponent {
|
|
1085
|
+
lookupService;
|
|
1086
|
+
lookupDefs;
|
|
1087
|
+
_updatingForm;
|
|
1088
|
+
extLookupConfigs;
|
|
1089
|
+
targetExpanded = false;
|
|
1090
|
+
// form
|
|
1091
|
+
target;
|
|
1092
|
+
scope;
|
|
1093
|
+
tag;
|
|
1094
|
+
assertion;
|
|
1095
|
+
form;
|
|
1096
|
+
// asserted-id-scopes
|
|
1097
|
+
idScopeEntries = input();
|
|
1098
|
+
// asserted-id-tags
|
|
1099
|
+
idTagEntries = input();
|
|
1100
|
+
// assertion-tags
|
|
1101
|
+
assTagEntries = input();
|
|
1102
|
+
// doc-reference-types
|
|
1103
|
+
refTypeEntries = input();
|
|
1104
|
+
// doc-reference-tags
|
|
1105
|
+
refTagEntries = input();
|
|
999
1106
|
/**
|
|
1000
1107
|
* The ID being edited.
|
|
1001
1108
|
*/
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1109
|
+
id = model();
|
|
1110
|
+
/**
|
|
1111
|
+
* True if when a new ID is set it should be internal rather than
|
|
1112
|
+
* external by default.
|
|
1113
|
+
*/
|
|
1114
|
+
internalDefault = input();
|
|
1115
|
+
/**
|
|
1116
|
+
* True if the UI has a submit button.
|
|
1117
|
+
*/
|
|
1118
|
+
hasSubmit = input();
|
|
1119
|
+
/**
|
|
1120
|
+
* True when the internal UI preselected mode should be by type rather than
|
|
1121
|
+
* by item. User can change mode unless modeSwitching is false.
|
|
1122
|
+
*/
|
|
1123
|
+
pinByTypeMode = input();
|
|
1124
|
+
/**
|
|
1125
|
+
* True when the user can switch between by-type and by-item mode in
|
|
1126
|
+
* the internal UI.
|
|
1127
|
+
*/
|
|
1128
|
+
canSwitchMode = input();
|
|
1129
|
+
/**
|
|
1130
|
+
* True when the user can edit the target's gid/label for internal targets.
|
|
1131
|
+
*/
|
|
1132
|
+
canEditTarget = input();
|
|
1133
|
+
/**
|
|
1134
|
+
* The lookup definitions to be used for the by-type lookup in the internal UI.
|
|
1135
|
+
* If not specified, the lookup definitions will be got via injection
|
|
1136
|
+
* when available; if the injected definitions are empty, the
|
|
1137
|
+
* lookup definitions will be built from the model-types thesaurus;
|
|
1138
|
+
* if this is not available either, the by-type lookup will be
|
|
1139
|
+
* disabled.
|
|
1140
|
+
*/
|
|
1141
|
+
lookupDefinitions = input();
|
|
1142
|
+
/**
|
|
1143
|
+
* The default part type key to be used.
|
|
1144
|
+
*/
|
|
1145
|
+
defaultPartTypeKey = input();
|
|
1146
|
+
/**
|
|
1147
|
+
* Emitted whenever the user requests to close the editor.
|
|
1148
|
+
*/
|
|
1149
|
+
editorClose = output();
|
|
1150
|
+
/**
|
|
1151
|
+
* Emitted when the user requests more.
|
|
1152
|
+
*/
|
|
1153
|
+
extMoreRequest = output();
|
|
1011
1154
|
constructor(formBuilder, lookupService, lookupDefs, settings) {
|
|
1012
1155
|
this.lookupService = lookupService;
|
|
1013
1156
|
this.lookupDefs = lookupDefs;
|
|
1157
|
+
// form
|
|
1014
1158
|
this.target = formBuilder.control(null, Validators.required);
|
|
1015
1159
|
this.scope = formBuilder.control(null, Validators.maxLength(500));
|
|
1016
1160
|
this.tag = formBuilder.control(null, Validators.maxLength(50));
|
|
@@ -1021,14 +1165,14 @@ class AssertedCompositeIdComponent {
|
|
|
1021
1165
|
tag: this.tag,
|
|
1022
1166
|
assertion: this.assertion,
|
|
1023
1167
|
});
|
|
1024
|
-
|
|
1168
|
+
// external lookup configs
|
|
1025
1169
|
this.extLookupConfigs =
|
|
1026
1170
|
settings.retrieve(ASSERTED_COMPOSITE_ID_CONFIGS_KEY) ||
|
|
1027
1171
|
[];
|
|
1028
|
-
//
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1172
|
+
// when id changes, update form
|
|
1173
|
+
effect(() => {
|
|
1174
|
+
this.updateForm(this.id());
|
|
1175
|
+
});
|
|
1032
1176
|
}
|
|
1033
1177
|
ngOnInit() {
|
|
1034
1178
|
this.form.valueChanges.pipe(debounceTime(300)).subscribe((_) => {
|
|
@@ -1044,7 +1188,9 @@ class AssertedCompositeIdComponent {
|
|
|
1044
1188
|
this.target.setValue(target);
|
|
1045
1189
|
this.target.markAsDirty();
|
|
1046
1190
|
this.target.updateValueAndValidity();
|
|
1047
|
-
this.
|
|
1191
|
+
if (this.form.valid) {
|
|
1192
|
+
this.targetExpanded = false;
|
|
1193
|
+
}
|
|
1048
1194
|
}
|
|
1049
1195
|
updateForm(id) {
|
|
1050
1196
|
this._updatingForm = true;
|
|
@@ -1076,9 +1222,8 @@ class AssertedCompositeIdComponent {
|
|
|
1076
1222
|
};
|
|
1077
1223
|
}
|
|
1078
1224
|
emitIdChange() {
|
|
1079
|
-
if (!this.hasSubmit) {
|
|
1080
|
-
this.
|
|
1081
|
-
this.idChange.emit(this._id);
|
|
1225
|
+
if (!this.hasSubmit()) {
|
|
1226
|
+
this.id.set(this.getId());
|
|
1082
1227
|
}
|
|
1083
1228
|
}
|
|
1084
1229
|
onEditorClose() {
|
|
@@ -1100,17 +1245,16 @@ class AssertedCompositeIdComponent {
|
|
|
1100
1245
|
}
|
|
1101
1246
|
save() {
|
|
1102
1247
|
if (this.form.valid) {
|
|
1103
|
-
this.
|
|
1104
|
-
this.idChange.emit(this._id);
|
|
1248
|
+
this.id.set(this.getId());
|
|
1105
1249
|
}
|
|
1106
1250
|
}
|
|
1107
|
-
static
|
|
1108
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.1", type: AssertedCompositeIdComponent, isStandalone: true, selector: "cadmus-refs-asserted-composite-id", inputs: { idScopeEntries: "idScopeEntries", idTagEntries: "idTagEntries", assTagEntries: "assTagEntries", refTypeEntries: "refTypeEntries", refTagEntries: "refTagEntries", id: "id", internalDefault: "internalDefault", hasSubmit: "hasSubmit", pinByTypeMode: "pinByTypeMode", canSwitchMode: "canSwitchMode", canEditTarget: "canEditTarget", lookupDefinitions: "lookupDefinitions", defaultPartTypeKey: "defaultPartTypeKey" }, outputs: { idChange: "idChange", editorClose: "editorClose", extMoreRequest: "extMoreRequest" }, ngImport: i0, template: "<form [formGroup]=\"form\" (submit)=\"save()\">\n <div>\n <div class=\"form-row\">\n <!-- tag (bound) -->\n @if (idTagEntries?.length) {\n <mat-form-field class=\"short-text\">\n <mat-label>tag</mat-label>\n <mat-select [formControl]=\"tag\">\n @for (e of idTagEntries; track e) {\n <mat-option [value]=\"e.id\">{{\n e.value\n }}</mat-option>\n }\n </mat-select>\n </mat-form-field>\n }\n <!-- tag (free) -->\n @if (!idTagEntries?.length) {\n <mat-form-field class=\"short-text\">\n <mat-label>tag</mat-label>\n <input matInput [formControl]=\"tag\" />\n @if ($any(tag.errors)?.maxLength && (tag.dirty || tag.touched)) {\n <mat-error\n >tag too long</mat-error\n >\n }\n </mat-form-field>\n }\n\n <!-- scope (bound) -->\n @if (idScopeEntries?.length) {\n <mat-form-field class=\"short-text\">\n <mat-label>scope</mat-label>\n <mat-select [formControl]=\"scope\">\n @for (e of idScopeEntries; track e) {\n <mat-option [value]=\"e.id\">{{\n e.value\n }}</mat-option>\n }\n </mat-select>\n </mat-form-field>\n }\n <!-- scope (free) -->\n @if (!idScopeEntries?.length) {\n <mat-form-field class=\"short-text\">\n <mat-label>scope</mat-label>\n <input matInput [formControl]=\"scope\" />\n @if (\n $any(scope.errors)?.maxLength && (scope.dirty || scope.touched)\n ) {\n <mat-error\n >scope too long</mat-error\n >\n }\n </mat-form-field>\n }\n\n <!-- label and GID -->\n @if (target.value?.label) {\n <div class=\"info\">\n <span class=\"label\">label</span>{{ target.value?.label }}\n </div>\n }\n @if (target.value?.gid) {\n <div class=\"info\">\n <span class=\"label\">GID</span>{{ target.value?.gid }}\n </div>\n }\n </div>\n\n <!-- target -->\n <div class=\"boxed\">\n <mat-expansion-panel [(expanded)]=\"targetExpanded\">\n <mat-expansion-panel-header>target</mat-expansion-panel-header>\n <cadmus-pin-target-lookup\n [pinByTypeMode]=\"pinByTypeMode\"\n [canSwitchMode]=\"canSwitchMode\"\n [canEditTarget]=\"canEditTarget\"\n [lookupDefinitions]=\"lookupDefinitions\"\n [defaultPartTypeKey]=\"defaultPartTypeKey\"\n [target]=\"target.value\"\n [internalDefault]=\"internalDefault\"\n [extLookupConfigs]=\"extLookupConfigs\"\n (targetChange)=\"onTargetChange($event)\"\n (editorClose)=\"onEditorClose()\"\n (extMoreRequest)=\"onExtMoreRequest($event)\"\n (extLookupConfigChange)=\"onExtLookupConfigChange($event)\"\n ></cadmus-pin-target-lookup>\n </mat-expansion-panel>\n </div>\n\n <!-- assertion -->\n <br />\n <div class=\"boxed\">\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 </div>\n\n <!-- buttons -->\n @if (hasSubmit) {\n <div>\n <button\n mat-icon-button\n color=\"warn\"\n type=\"button\"\n (click)=\"cancel()\"\n [disabled]=\"!this.target.value?.gid || !this.target.value?.label\"\n >\n <mat-icon class=\"mat-warn\">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 class=\"mat-primary\">check_circle</mat-icon>\n </button>\n </div>\n }\n </form>\n", styles: [".form-row{display:flex;gap:8px;align-items:center;flex-wrap:wrap}.form-row *{flex:0 0 auto}.boxed{border:1px solid silver;border-radius:6px;padding:6px}.short-text{width:8em}.pin-info{font-size:90%;color:silver}fieldset{border:1px solid silver;border-radius:6px;padding:6px}.info{border:1px solid silver;border-radius:6px;background-color:silver;color:#fff;padding:4px}.info .label{background-color:#fff;color:silver;margin:0 6px}@media only screen and (max-width: 959px){div#container{grid-template-rows:1fr auto;grid-template-columns:1fr;grid-template-areas:\"editor\" \"lookup\"}}\n"], dependencies: [{ kind: "ngmodule", type: FormsModule }, { 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: "ngmodule", type: ReactiveFormsModule }, { 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: "ngmodule", type: MatButtonModule }, { kind: "component", type: i3.MatIconButton, selector: "button[mat-icon-button]", exportAs: ["matButton"] }, { kind: "ngmodule", type: MatExpansionModule }, { kind: "component", type: i4.MatExpansionPanel, selector: "mat-expansion-panel", inputs: ["hideToggle", "togglePosition"], outputs: ["afterExpand", "afterCollapse"], exportAs: ["matExpansionPanel"] }, { kind: "component", type: i4.MatExpansionPanelHeader, selector: "mat-expansion-panel-header", inputs: ["expandedHeight", "collapsedHeight", "tabIndex"] }, { kind: "ngmodule", type: MatFormFieldModule }, { kind: "component", type: i6.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i6.MatLabel, selector: "mat-label" }, { kind: "directive", type: i6.MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i7.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: MatInputModule }, { kind: "directive", type: i8.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly", "disabledInteractive"], exportAs: ["matInput"] }, { kind: "ngmodule", type: MatSelectModule }, { kind: "component", type: i9.MatSelect, selector: "mat-select", inputs: ["aria-describedby", "panelClass", "disabled", "disableRipple", "tabIndex", "hideSingleSelectionIndicator", "placeholder", "required", "multiple", "disableOptionCentering", "compareWith", "value", "aria-label", "aria-labelledby", "errorStateMatcher", "typeaheadDebounceInterval", "sortComparator", "id", "panelWidth"], outputs: ["openedChange", "opened", "closed", "selectionChange", "valueChange"], exportAs: ["matSelect"] }, { kind: "component", type: i10.MatOption, selector: "mat-option", inputs: ["value", "id", "disabled"], outputs: ["onSelectionChange"], exportAs: ["matOption"] }, { kind: "component", type: AssertionComponent, selector: "cadmus-refs-assertion", inputs: ["assTagEntries", "refTypeEntries", "refTagEntries", "assertion"], outputs: ["assertionChange"] }, { kind: "component", type: PinTargetLookupComponent, selector: "cadmus-pin-target-lookup", inputs: ["pinByTypeMode", "canSwitchMode", "canEditTarget", "lookupDefinitions", "extLookupConfigs", "internalDefault", "target", "defaultPartTypeKey"], outputs: ["editorClose", "targetChange", "extMoreRequest", "extLookupConfigChange"] }] }); }
|
|
1251
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: AssertedCompositeIdComponent, deps: [{ token: i1$1.FormBuilder }, { token: PinRefLookupService }, { token: 'indexLookupDefinitions' }, { token: i3$1.RamStorageService }], target: i0.ɵɵFactoryTarget.Component });
|
|
1252
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.5", type: AssertedCompositeIdComponent, isStandalone: true, selector: "cadmus-refs-asserted-composite-id", inputs: { idScopeEntries: { classPropertyName: "idScopeEntries", publicName: "idScopeEntries", isSignal: true, isRequired: false, transformFunction: null }, idTagEntries: { classPropertyName: "idTagEntries", publicName: "idTagEntries", isSignal: true, isRequired: false, transformFunction: null }, assTagEntries: { classPropertyName: "assTagEntries", publicName: "assTagEntries", isSignal: true, isRequired: false, transformFunction: null }, refTypeEntries: { classPropertyName: "refTypeEntries", publicName: "refTypeEntries", isSignal: true, isRequired: false, transformFunction: null }, refTagEntries: { classPropertyName: "refTagEntries", publicName: "refTagEntries", isSignal: true, isRequired: false, transformFunction: null }, id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, internalDefault: { classPropertyName: "internalDefault", publicName: "internalDefault", isSignal: true, isRequired: false, transformFunction: null }, hasSubmit: { classPropertyName: "hasSubmit", publicName: "hasSubmit", isSignal: true, isRequired: false, transformFunction: null }, pinByTypeMode: { classPropertyName: "pinByTypeMode", publicName: "pinByTypeMode", isSignal: true, isRequired: false, transformFunction: null }, canSwitchMode: { classPropertyName: "canSwitchMode", publicName: "canSwitchMode", isSignal: true, isRequired: false, transformFunction: null }, canEditTarget: { classPropertyName: "canEditTarget", publicName: "canEditTarget", isSignal: true, isRequired: false, transformFunction: null }, lookupDefinitions: { classPropertyName: "lookupDefinitions", publicName: "lookupDefinitions", isSignal: true, isRequired: false, transformFunction: null }, defaultPartTypeKey: { classPropertyName: "defaultPartTypeKey", publicName: "defaultPartTypeKey", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { id: "idChange", editorClose: "editorClose", extMoreRequest: "extMoreRequest" }, ngImport: i0, template: "<form [formGroup]=\"form\" (submit)=\"save()\">\n <div>\n <div class=\"form-row\">\n <!-- tag (bound) -->\n @if (idTagEntries()?.length) {\n <mat-form-field class=\"short-text\">\n <mat-label>tag</mat-label>\n <mat-select [formControl]=\"tag\">\n @for (e of idTagEntries(); track e) {\n <mat-option [value]=\"e.id\">{{ e.value }}</mat-option>\n }\n </mat-select>\n </mat-form-field>\n }\n <!-- tag (free) -->\n @else {\n <mat-form-field class=\"short-text\">\n <mat-label>tag</mat-label>\n <input matInput [formControl]=\"tag\" />\n @if ($any(tag.errors)?.maxLength && (tag.dirty || tag.touched)) {\n <mat-error>tag too long</mat-error>\n }\n </mat-form-field>\n }\n\n <!-- scope (bound) -->\n @if (idScopeEntries()?.length) {\n <mat-form-field class=\"short-text\">\n <mat-label>scope</mat-label>\n <mat-select [formControl]=\"scope\">\n @for (e of idScopeEntries(); track e) {\n <mat-option [value]=\"e.id\">{{ e.value }}</mat-option>\n }\n </mat-select>\n </mat-form-field>\n }\n <!-- scope (free) -->\n @else {\n <mat-form-field class=\"short-text\">\n <mat-label>scope</mat-label>\n <input matInput [formControl]=\"scope\" />\n @if ( $any(scope.errors)?.maxLength && (scope.dirty || scope.touched) )\n {\n <mat-error>scope too long</mat-error>\n }\n </mat-form-field>\n }\n\n <!-- label and GID -->\n @if (target.value?.label) {\n <div class=\"info\">\n <span class=\"label\">label</span>{{ target.value?.label }}\n </div>\n } @if (target.value?.gid) {\n <div class=\"info\">\n <span class=\"label\">GID</span>{{ target.value?.gid }}\n </div>\n }\n </div>\n\n <!-- target -->\n <div class=\"boxed\">\n <mat-expansion-panel [(expanded)]=\"targetExpanded\">\n <mat-expansion-panel-header>target</mat-expansion-panel-header>\n <cadmus-pin-target-lookup\n [pinByTypeMode]=\"pinByTypeMode()\"\n [canSwitchMode]=\"canSwitchMode()\"\n [canEditTarget]=\"canEditTarget()\"\n [lookupDefinitions]=\"lookupDefinitions()\"\n [defaultPartTypeKey]=\"defaultPartTypeKey()\"\n [target]=\"target.value || undefined\"\n [internalDefault]=\"internalDefault()\"\n [extLookupConfigs]=\"extLookupConfigs\"\n (targetChange)=\"onTargetChange($event)\"\n (editorClose)=\"onEditorClose()\"\n (extMoreRequest)=\"onExtMoreRequest($event)\"\n (extLookupConfigChange)=\"onExtLookupConfigChange($event)\"\n />\n </mat-expansion-panel>\n </div>\n\n <!-- assertion -->\n <br />\n <div class=\"boxed\">\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 || undefined\"\n (assertionChange)=\"onAssertionChange($event)\"\n >\n </cadmus-refs-assertion>\n </mat-expansion-panel>\n </div>\n </div>\n\n <!-- buttons -->\n @if (hasSubmit()) {\n <div>\n <button\n mat-icon-button\n type=\"button\"\n (click)=\"cancel()\"\n [disabled]=\"!this.target.value?.gid || !this.target.value?.label\"\n >\n <mat-icon class=\"mat-warn\">close</mat-icon>\n </button>\n <button mat-icon-button type=\"submit\" [disabled]=\"form.invalid\">\n <mat-icon class=\"mat-primary\">check_circle</mat-icon>\n </button>\n </div>\n }\n</form>\n", styles: [".form-row{display:flex;gap:8px;align-items:center;flex-wrap:wrap}.form-row *{flex:0 0 auto}.boxed{border:1px solid silver;border-radius:6px;padding:6px}.short-text{width:8em}.pin-info{font-size:90%;color:silver}fieldset{border:1px solid silver;border-radius:6px;padding:6px}.info{border:1px solid silver;border-radius:6px;background-color:silver;color:#fff;padding:4px}.info .label{background-color:#fff;color:silver;margin:0 6px}@media only screen and (max-width: 959px){div#container{grid-template-rows:1fr auto;grid-template-columns:1fr;grid-template-areas:\"editor\" \"lookup\"}}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: ReactiveFormsModule }, { 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: "ngmodule", type: MatButtonModule }, { kind: "component", type: i3.MatIconButton, selector: "button[mat-icon-button]", exportAs: ["matButton"] }, { kind: "ngmodule", type: MatExpansionModule }, { kind: "component", type: i4.MatExpansionPanel, selector: "mat-expansion-panel", inputs: ["hideToggle", "togglePosition"], outputs: ["afterExpand", "afterCollapse"], exportAs: ["matExpansionPanel"] }, { kind: "component", type: i4.MatExpansionPanelHeader, selector: "mat-expansion-panel-header", inputs: ["expandedHeight", "collapsedHeight", "tabIndex"] }, { kind: "ngmodule", type: MatFormFieldModule }, { kind: "component", type: i6.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i6.MatLabel, selector: "mat-label" }, { kind: "directive", type: i6.MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i7.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: MatInputModule }, { kind: "directive", type: i8.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly", "disabledInteractive"], exportAs: ["matInput"] }, { kind: "ngmodule", type: MatSelectModule }, { kind: "component", type: i9.MatSelect, selector: "mat-select", inputs: ["aria-describedby", "panelClass", "disabled", "disableRipple", "tabIndex", "hideSingleSelectionIndicator", "placeholder", "required", "multiple", "disableOptionCentering", "compareWith", "value", "aria-label", "aria-labelledby", "errorStateMatcher", "typeaheadDebounceInterval", "sortComparator", "id", "panelWidth", "canSelectNullableOptions"], outputs: ["openedChange", "opened", "closed", "selectionChange", "valueChange"], exportAs: ["matSelect"] }, { kind: "component", type: i10.MatOption, selector: "mat-option", inputs: ["value", "id", "disabled"], outputs: ["onSelectionChange"], exportAs: ["matOption"] }, { kind: "ngmodule", type: MatTooltipModule }, { kind: "component", type: AssertionComponent, selector: "cadmus-refs-assertion", inputs: ["assTagEntries", "refTypeEntries", "refTagEntries", "assertion"], outputs: ["assertionChange"] }, { kind: "component", type: PinTargetLookupComponent, selector: "cadmus-pin-target-lookup", inputs: ["pinByTypeMode", "canSwitchMode", "canEditTarget", "lookupDefinitions", "extLookupConfigs", "internalDefault", "target", "defaultPartTypeKey"], outputs: ["pinByTypeModeChange", "canSwitchModeChange", "lookupDefinitionsChange", "targetChange", "editorClose", "extMoreRequest", "extLookupConfigChange"] }] });
|
|
1109
1253
|
}
|
|
1110
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.
|
|
1254
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: AssertedCompositeIdComponent, decorators: [{
|
|
1111
1255
|
type: Component,
|
|
1112
1256
|
args: [{ selector: 'cadmus-refs-asserted-composite-id', imports: [
|
|
1113
|
-
|
|
1257
|
+
CommonModule,
|
|
1114
1258
|
ReactiveFormsModule,
|
|
1115
1259
|
MatButtonModule,
|
|
1116
1260
|
MatExpansionModule,
|
|
@@ -1118,50 +1262,23 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.1", ngImpor
|
|
|
1118
1262
|
MatIconModule,
|
|
1119
1263
|
MatInputModule,
|
|
1120
1264
|
MatSelectModule,
|
|
1265
|
+
MatTooltipModule,
|
|
1121
1266
|
AssertionComponent,
|
|
1122
1267
|
PinTargetLookupComponent,
|
|
1123
|
-
], template: "<form [formGroup]=\"form\" (submit)=\"save()\">\n <div>\n <div class=\"form-row\">\n <!-- tag (bound) -->\n @if (idTagEntries?.length) {\n
|
|
1268
|
+
], template: "<form [formGroup]=\"form\" (submit)=\"save()\">\n <div>\n <div class=\"form-row\">\n <!-- tag (bound) -->\n @if (idTagEntries()?.length) {\n <mat-form-field class=\"short-text\">\n <mat-label>tag</mat-label>\n <mat-select [formControl]=\"tag\">\n @for (e of idTagEntries(); track e) {\n <mat-option [value]=\"e.id\">{{ e.value }}</mat-option>\n }\n </mat-select>\n </mat-form-field>\n }\n <!-- tag (free) -->\n @else {\n <mat-form-field class=\"short-text\">\n <mat-label>tag</mat-label>\n <input matInput [formControl]=\"tag\" />\n @if ($any(tag.errors)?.maxLength && (tag.dirty || tag.touched)) {\n <mat-error>tag too long</mat-error>\n }\n </mat-form-field>\n }\n\n <!-- scope (bound) -->\n @if (idScopeEntries()?.length) {\n <mat-form-field class=\"short-text\">\n <mat-label>scope</mat-label>\n <mat-select [formControl]=\"scope\">\n @for (e of idScopeEntries(); track e) {\n <mat-option [value]=\"e.id\">{{ e.value }}</mat-option>\n }\n </mat-select>\n </mat-form-field>\n }\n <!-- scope (free) -->\n @else {\n <mat-form-field class=\"short-text\">\n <mat-label>scope</mat-label>\n <input matInput [formControl]=\"scope\" />\n @if ( $any(scope.errors)?.maxLength && (scope.dirty || scope.touched) )\n {\n <mat-error>scope too long</mat-error>\n }\n </mat-form-field>\n }\n\n <!-- label and GID -->\n @if (target.value?.label) {\n <div class=\"info\">\n <span class=\"label\">label</span>{{ target.value?.label }}\n </div>\n } @if (target.value?.gid) {\n <div class=\"info\">\n <span class=\"label\">GID</span>{{ target.value?.gid }}\n </div>\n }\n </div>\n\n <!-- target -->\n <div class=\"boxed\">\n <mat-expansion-panel [(expanded)]=\"targetExpanded\">\n <mat-expansion-panel-header>target</mat-expansion-panel-header>\n <cadmus-pin-target-lookup\n [pinByTypeMode]=\"pinByTypeMode()\"\n [canSwitchMode]=\"canSwitchMode()\"\n [canEditTarget]=\"canEditTarget()\"\n [lookupDefinitions]=\"lookupDefinitions()\"\n [defaultPartTypeKey]=\"defaultPartTypeKey()\"\n [target]=\"target.value || undefined\"\n [internalDefault]=\"internalDefault()\"\n [extLookupConfigs]=\"extLookupConfigs\"\n (targetChange)=\"onTargetChange($event)\"\n (editorClose)=\"onEditorClose()\"\n (extMoreRequest)=\"onExtMoreRequest($event)\"\n (extLookupConfigChange)=\"onExtLookupConfigChange($event)\"\n />\n </mat-expansion-panel>\n </div>\n\n <!-- assertion -->\n <br />\n <div class=\"boxed\">\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 || undefined\"\n (assertionChange)=\"onAssertionChange($event)\"\n >\n </cadmus-refs-assertion>\n </mat-expansion-panel>\n </div>\n </div>\n\n <!-- buttons -->\n @if (hasSubmit()) {\n <div>\n <button\n mat-icon-button\n type=\"button\"\n (click)=\"cancel()\"\n [disabled]=\"!this.target.value?.gid || !this.target.value?.label\"\n >\n <mat-icon class=\"mat-warn\">close</mat-icon>\n </button>\n <button mat-icon-button type=\"submit\" [disabled]=\"form.invalid\">\n <mat-icon class=\"mat-primary\">check_circle</mat-icon>\n </button>\n </div>\n }\n</form>\n", styles: [".form-row{display:flex;gap:8px;align-items:center;flex-wrap:wrap}.form-row *{flex:0 0 auto}.boxed{border:1px solid silver;border-radius:6px;padding:6px}.short-text{width:8em}.pin-info{font-size:90%;color:silver}fieldset{border:1px solid silver;border-radius:6px;padding:6px}.info{border:1px solid silver;border-radius:6px;background-color:silver;color:#fff;padding:4px}.info .label{background-color:#fff;color:silver;margin:0 6px}@media only screen and (max-width: 959px){div#container{grid-template-rows:1fr auto;grid-template-columns:1fr;grid-template-areas:\"editor\" \"lookup\"}}\n"] }]
|
|
1124
1269
|
}], ctorParameters: () => [{ type: i1$1.FormBuilder }, { type: PinRefLookupService }, { type: undefined, decorators: [{
|
|
1125
1270
|
type: Inject,
|
|
1126
1271
|
args: ['indexLookupDefinitions']
|
|
1127
|
-
}] }, { type: i3$1.RamStorageService }]
|
|
1128
|
-
type: Input
|
|
1129
|
-
}], idTagEntries: [{
|
|
1130
|
-
type: Input
|
|
1131
|
-
}], assTagEntries: [{
|
|
1132
|
-
type: Input
|
|
1133
|
-
}], refTypeEntries: [{
|
|
1134
|
-
type: Input
|
|
1135
|
-
}], refTagEntries: [{
|
|
1136
|
-
type: Input
|
|
1137
|
-
}], id: [{
|
|
1138
|
-
type: Input
|
|
1139
|
-
}], internalDefault: [{
|
|
1140
|
-
type: Input
|
|
1141
|
-
}], hasSubmit: [{
|
|
1142
|
-
type: Input
|
|
1143
|
-
}], pinByTypeMode: [{
|
|
1144
|
-
type: Input
|
|
1145
|
-
}], canSwitchMode: [{
|
|
1146
|
-
type: Input
|
|
1147
|
-
}], canEditTarget: [{
|
|
1148
|
-
type: Input
|
|
1149
|
-
}], lookupDefinitions: [{
|
|
1150
|
-
type: Input
|
|
1151
|
-
}], defaultPartTypeKey: [{
|
|
1152
|
-
type: Input
|
|
1153
|
-
}], idChange: [{
|
|
1154
|
-
type: Output
|
|
1155
|
-
}], editorClose: [{
|
|
1156
|
-
type: Output
|
|
1157
|
-
}], extMoreRequest: [{
|
|
1158
|
-
type: Output
|
|
1159
|
-
}] } });
|
|
1272
|
+
}] }, { type: i3$1.RamStorageService }] });
|
|
1160
1273
|
|
|
1161
1274
|
/**
|
|
1162
|
-
* Asserted IDs editor.
|
|
1275
|
+
* Asserted composite IDs editor.
|
|
1163
1276
|
*/
|
|
1164
1277
|
class AssertedCompositeIdsComponent {
|
|
1278
|
+
_dialogService;
|
|
1279
|
+
_ids;
|
|
1280
|
+
_editedIndex;
|
|
1281
|
+
edited;
|
|
1165
1282
|
/**
|
|
1166
1283
|
* The asserted IDs.
|
|
1167
1284
|
*/
|
|
@@ -1174,11 +1291,58 @@ class AssertedCompositeIdsComponent {
|
|
|
1174
1291
|
this.updateForm(value);
|
|
1175
1292
|
}
|
|
1176
1293
|
}
|
|
1294
|
+
// asserted-id-scopes
|
|
1295
|
+
idScopeEntries = input();
|
|
1296
|
+
// asserted-id-tags
|
|
1297
|
+
idTagEntries = input();
|
|
1298
|
+
// assertion-tags
|
|
1299
|
+
assTagEntries = input();
|
|
1300
|
+
// doc-reference-types
|
|
1301
|
+
refTypeEntries = input();
|
|
1302
|
+
// doc-reference-tags
|
|
1303
|
+
refTagEntries = input();
|
|
1304
|
+
/**
|
|
1305
|
+
* True when the internal UI preselected mode should be by type rather than
|
|
1306
|
+
* by item. User can change mode unless modeSwitching is false.
|
|
1307
|
+
*/
|
|
1308
|
+
pinByTypeMode = input();
|
|
1309
|
+
/**
|
|
1310
|
+
* True when the user can switch between by-type and by-item mode in
|
|
1311
|
+
* the internal UI.
|
|
1312
|
+
*/
|
|
1313
|
+
canSwitchMode = input();
|
|
1314
|
+
/**
|
|
1315
|
+
* True when the user can edit the target's gid/label for internal targets.
|
|
1316
|
+
*/
|
|
1317
|
+
canEditTarget = input();
|
|
1318
|
+
/**
|
|
1319
|
+
* The lookup definitions to be used for the by-type lookup in the internal UI.
|
|
1320
|
+
* If not specified, the lookup definitions will be got via injection
|
|
1321
|
+
* when available; if the injected definitions are empty, the
|
|
1322
|
+
* lookup definitions will be built from the model-types thesaurus;
|
|
1323
|
+
* if this is not available either, the by-type lookup will be
|
|
1324
|
+
* disabled.
|
|
1325
|
+
*/
|
|
1326
|
+
lookupDefinitions = input();
|
|
1327
|
+
/**
|
|
1328
|
+
* The default part type key.
|
|
1329
|
+
*/
|
|
1330
|
+
defaultPartTypeKey = input();
|
|
1331
|
+
/**
|
|
1332
|
+
* True if when a new ID is set it should be internal rather than
|
|
1333
|
+
* external by default.
|
|
1334
|
+
*/
|
|
1335
|
+
internalDefault = input();
|
|
1336
|
+
/**
|
|
1337
|
+
* Emitted whenever any ID changes.
|
|
1338
|
+
*/
|
|
1339
|
+
idsChange = output();
|
|
1340
|
+
entries;
|
|
1341
|
+
form;
|
|
1177
1342
|
constructor(formBuilder, _dialogService) {
|
|
1178
1343
|
this._dialogService = _dialogService;
|
|
1179
1344
|
this._ids = [];
|
|
1180
1345
|
this._editedIndex = -1;
|
|
1181
|
-
this.idsChange = new EventEmitter();
|
|
1182
1346
|
this.entries = formBuilder.control([], { nonNullable: true });
|
|
1183
1347
|
// form
|
|
1184
1348
|
this.form = formBuilder.group({
|
|
@@ -1271,10 +1435,10 @@ class AssertedCompositeIdsComponent {
|
|
|
1271
1435
|
this.saveId(id);
|
|
1272
1436
|
this.emitIdsChange();
|
|
1273
1437
|
}
|
|
1274
|
-
static
|
|
1275
|
-
static
|
|
1438
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: AssertedCompositeIdsComponent, deps: [{ token: i1$1.FormBuilder }, { token: i2.DialogService }], target: i0.ɵɵFactoryTarget.Component });
|
|
1439
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.5", type: AssertedCompositeIdsComponent, isStandalone: true, selector: "cadmus-refs-asserted-composite-ids", inputs: { ids: { classPropertyName: "ids", publicName: "ids", isSignal: false, isRequired: false, transformFunction: null }, idScopeEntries: { classPropertyName: "idScopeEntries", publicName: "idScopeEntries", isSignal: true, isRequired: false, transformFunction: null }, idTagEntries: { classPropertyName: "idTagEntries", publicName: "idTagEntries", isSignal: true, isRequired: false, transformFunction: null }, assTagEntries: { classPropertyName: "assTagEntries", publicName: "assTagEntries", isSignal: true, isRequired: false, transformFunction: null }, refTypeEntries: { classPropertyName: "refTypeEntries", publicName: "refTypeEntries", isSignal: true, isRequired: false, transformFunction: null }, refTagEntries: { classPropertyName: "refTagEntries", publicName: "refTagEntries", isSignal: true, isRequired: false, transformFunction: null }, pinByTypeMode: { classPropertyName: "pinByTypeMode", publicName: "pinByTypeMode", isSignal: true, isRequired: false, transformFunction: null }, canSwitchMode: { classPropertyName: "canSwitchMode", publicName: "canSwitchMode", isSignal: true, isRequired: false, transformFunction: null }, canEditTarget: { classPropertyName: "canEditTarget", publicName: "canEditTarget", isSignal: true, isRequired: false, transformFunction: null }, lookupDefinitions: { classPropertyName: "lookupDefinitions", publicName: "lookupDefinitions", isSignal: true, isRequired: false, transformFunction: null }, defaultPartTypeKey: { classPropertyName: "defaultPartTypeKey", publicName: "defaultPartTypeKey", isSignal: true, isRequired: false, transformFunction: null }, internalDefault: { classPropertyName: "internalDefault", publicName: "internalDefault", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { idsChange: "idsChange" }, ngImport: i0, template: "<form [formGroup]=\"form\">\r\n <!-- buttons -->\r\n <button type=\"button\" class=\"mat-primary\" mat-flat-button (click)=\"addId()\">\r\n <mat-icon>add_circle</mat-icon> ID\r\n </button>\r\n <!-- list -->\r\n @if (entries.value.length) {\r\n <table>\r\n <thead>\r\n <tr>\r\n <th></th>\r\n <th>scope</th>\r\n <th>label</th>\r\n <th>gid</th>\r\n <th>ass.</th>\r\n </tr>\r\n </thead>\r\n <tbody>\r\n @for ( entry of entries.value; track entry; let i = $index; let first =\r\n $first; let last = $last) {\r\n <tr>\r\n <td class=\"fit-width\">\r\n <button\r\n type=\"button\"\r\n mat-icon-button\r\n matTooltip=\"Edit this ID\"\r\n (click)=\"editId(entry, i)\"\r\n >\r\n <mat-icon class=\"mat-primary\">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 matTooltip=\"Delete this ID\"\r\n (click)=\"deleteId(i)\"\r\n >\r\n <mat-icon class=\"mat-warn\">remove_circle</mat-icon>\r\n </button>\r\n </td>\r\n <td>{{ entry.scope }}</td>\r\n <td>{{ entry?.target?.label }}</td>\r\n <td>{{ entry?.target?.gid }}</td>\r\n <td>{{ entry?.assertion ? \"Y\" : \"N\" }}</td>\r\n </tr>\r\n }\r\n </tbody>\r\n </table>\r\n }\r\n\r\n <!-- editor -->\r\n <mat-expansion-panel [expanded]=\"edited\" [disabled]=\"!edited\">\r\n <mat-expansion-panel-header\r\n >ID {{ edited?.target?.label }}</mat-expansion-panel-header\r\n >\r\n <cadmus-refs-asserted-composite-id\r\n [idScopeEntries]=\"idScopeEntries()\"\r\n [idTagEntries]=\"idTagEntries()\"\r\n [assTagEntries]=\"assTagEntries()\"\r\n [refTypeEntries]=\"refTypeEntries()\"\r\n [refTagEntries]=\"refTagEntries()\"\r\n [hasSubmit]=\"true\"\r\n [pinByTypeMode]=\"pinByTypeMode()\"\r\n [canSwitchMode]=\"canSwitchMode()\"\r\n [canEditTarget]=\"canEditTarget()\"\r\n [lookupDefinitions]=\"lookupDefinitions()\"\r\n [defaultPartTypeKey]=\"defaultPartTypeKey()\"\r\n [internalDefault]=\"internalDefault()\"\r\n [id]=\"edited\"\r\n (idChange)=\"onIdChange($event)\"\r\n (editorClose)=\"closeId()\"\r\n ></cadmus-refs-asserted-composite-id>\r\n </mat-expansion-panel>\r\n</form>\r\n", styles: ["th{font-weight:400;color:silver;text-align:left}td{padding-right:4px}td.fit-width{width:1px;white-space:nowrap;padding:0}\n"], dependencies: [{ kind: "ngmodule", type: FormsModule }, { 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: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i3.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", exportAs: ["matButton"] }, { kind: "component", type: i3.MatIconButton, selector: "button[mat-icon-button]", exportAs: ["matButton"] }, { kind: "ngmodule", type: MatCheckboxModule }, { kind: "ngmodule", type: MatExpansionModule }, { kind: "component", type: i4.MatExpansionPanel, selector: "mat-expansion-panel", inputs: ["hideToggle", "togglePosition"], outputs: ["afterExpand", "afterCollapse"], exportAs: ["matExpansionPanel"] }, { kind: "component", type: i4.MatExpansionPanelHeader, selector: "mat-expansion-panel-header", inputs: ["expandedHeight", "collapsedHeight", "tabIndex"] }, { kind: "ngmodule", type: MatFormFieldModule }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i7.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: MatInputModule }, { kind: "component", type: AssertedCompositeIdComponent, selector: "cadmus-refs-asserted-composite-id", inputs: ["idScopeEntries", "idTagEntries", "assTagEntries", "refTypeEntries", "refTagEntries", "id", "internalDefault", "hasSubmit", "pinByTypeMode", "canSwitchMode", "canEditTarget", "lookupDefinitions", "defaultPartTypeKey"], outputs: ["idChange", "editorClose", "extMoreRequest"] }] });
|
|
1276
1440
|
}
|
|
1277
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.
|
|
1441
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: AssertedCompositeIdsComponent, decorators: [{
|
|
1278
1442
|
type: Component,
|
|
1279
1443
|
args: [{ selector: 'cadmus-refs-asserted-composite-ids', imports: [
|
|
1280
1444
|
FormsModule,
|
|
@@ -1286,33 +1450,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.1", ngImpor
|
|
|
1286
1450
|
MatIconModule,
|
|
1287
1451
|
MatInputModule,
|
|
1288
1452
|
AssertedCompositeIdComponent,
|
|
1289
|
-
], template: "<form [formGroup]=\"form\">\r\n <!-- buttons -->\r\n <button
|
|
1453
|
+
], template: "<form [formGroup]=\"form\">\r\n <!-- buttons -->\r\n <button type=\"button\" class=\"mat-primary\" mat-flat-button (click)=\"addId()\">\r\n <mat-icon>add_circle</mat-icon> ID\r\n </button>\r\n <!-- list -->\r\n @if (entries.value.length) {\r\n <table>\r\n <thead>\r\n <tr>\r\n <th></th>\r\n <th>scope</th>\r\n <th>label</th>\r\n <th>gid</th>\r\n <th>ass.</th>\r\n </tr>\r\n </thead>\r\n <tbody>\r\n @for ( entry of entries.value; track entry; let i = $index; let first =\r\n $first; let last = $last) {\r\n <tr>\r\n <td class=\"fit-width\">\r\n <button\r\n type=\"button\"\r\n mat-icon-button\r\n matTooltip=\"Edit this ID\"\r\n (click)=\"editId(entry, i)\"\r\n >\r\n <mat-icon class=\"mat-primary\">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 matTooltip=\"Delete this ID\"\r\n (click)=\"deleteId(i)\"\r\n >\r\n <mat-icon class=\"mat-warn\">remove_circle</mat-icon>\r\n </button>\r\n </td>\r\n <td>{{ entry.scope }}</td>\r\n <td>{{ entry?.target?.label }}</td>\r\n <td>{{ entry?.target?.gid }}</td>\r\n <td>{{ entry?.assertion ? \"Y\" : \"N\" }}</td>\r\n </tr>\r\n }\r\n </tbody>\r\n </table>\r\n }\r\n\r\n <!-- editor -->\r\n <mat-expansion-panel [expanded]=\"edited\" [disabled]=\"!edited\">\r\n <mat-expansion-panel-header\r\n >ID {{ edited?.target?.label }}</mat-expansion-panel-header\r\n >\r\n <cadmus-refs-asserted-composite-id\r\n [idScopeEntries]=\"idScopeEntries()\"\r\n [idTagEntries]=\"idTagEntries()\"\r\n [assTagEntries]=\"assTagEntries()\"\r\n [refTypeEntries]=\"refTypeEntries()\"\r\n [refTagEntries]=\"refTagEntries()\"\r\n [hasSubmit]=\"true\"\r\n [pinByTypeMode]=\"pinByTypeMode()\"\r\n [canSwitchMode]=\"canSwitchMode()\"\r\n [canEditTarget]=\"canEditTarget()\"\r\n [lookupDefinitions]=\"lookupDefinitions()\"\r\n [defaultPartTypeKey]=\"defaultPartTypeKey()\"\r\n [internalDefault]=\"internalDefault()\"\r\n [id]=\"edited\"\r\n (idChange)=\"onIdChange($event)\"\r\n (editorClose)=\"closeId()\"\r\n ></cadmus-refs-asserted-composite-id>\r\n </mat-expansion-panel>\r\n</form>\r\n", styles: ["th{font-weight:400;color:silver;text-align:left}td{padding-right:4px}td.fit-width{width:1px;white-space:nowrap;padding:0}\n"] }]
|
|
1290
1454
|
}], ctorParameters: () => [{ type: i1$1.FormBuilder }, { type: i2.DialogService }], propDecorators: { ids: [{
|
|
1291
1455
|
type: Input
|
|
1292
|
-
}], idScopeEntries: [{
|
|
1293
|
-
type: Input
|
|
1294
|
-
}], idTagEntries: [{
|
|
1295
|
-
type: Input
|
|
1296
|
-
}], assTagEntries: [{
|
|
1297
|
-
type: Input
|
|
1298
|
-
}], refTypeEntries: [{
|
|
1299
|
-
type: Input
|
|
1300
|
-
}], refTagEntries: [{
|
|
1301
|
-
type: Input
|
|
1302
|
-
}], pinByTypeMode: [{
|
|
1303
|
-
type: Input
|
|
1304
|
-
}], canSwitchMode: [{
|
|
1305
|
-
type: Input
|
|
1306
|
-
}], canEditTarget: [{
|
|
1307
|
-
type: Input
|
|
1308
|
-
}], lookupDefinitions: [{
|
|
1309
|
-
type: Input
|
|
1310
|
-
}], defaultPartTypeKey: [{
|
|
1311
|
-
type: Input
|
|
1312
|
-
}], internalDefault: [{
|
|
1313
|
-
type: Input
|
|
1314
|
-
}], idsChange: [{
|
|
1315
|
-
type: Output
|
|
1316
1456
|
}] } });
|
|
1317
1457
|
|
|
1318
1458
|
/*
|