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