@myrmidon/cadmus-refs-asserted-ids 9.0.0 → 10.0.1

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/index.d.ts CHANGED
@@ -1,5 +1,496 @@
1
+ import * as _angular_core from '@angular/core';
2
+ import { OnInit, OnDestroy } from '@angular/core';
3
+ import { FormControl, FormGroup, FormBuilder } from '@angular/forms';
4
+ import { RamStorageService } from '@myrmidon/ngx-tools';
5
+ import { Assertion } from '@myrmidon/cadmus-refs-assertion';
6
+ import { Item, DataPinInfo, Part, IndexLookupDefinitions, ThesaurusEntry, IndexLookupDefinition } from '@myrmidon/cadmus-core';
7
+ import { RefLookupService, RefLookupFilter, RefLookupConfig, RefLookupSetEvent } from '@myrmidon/cadmus-refs-lookup';
8
+ import { Observable } from 'rxjs';
9
+ import { ItemService, ThesaurusService } from '@myrmidon/cadmus-api';
10
+ import { MatSnackBar } from '@angular/material/snack-bar';
11
+ import { DialogService } from '@myrmidon/ngx-mat-tools';
12
+
1
13
  /**
2
- * Generated bundle index. Do not edit.
14
+ * Pin-based lookup filter. This is a RefLookupFilter with the addition
15
+ * of the item ID and part ID, which are used to filter the results
16
+ * by the ItemPinLookupComponent.
3
17
  */
4
- /// <amd-module name="@myrmidon/cadmus-refs-asserted-ids" />
5
- export * from './public-api';
18
+ interface PinRefLookupFilter extends RefLookupFilter {
19
+ itemId?: string;
20
+ partId?: string;
21
+ }
22
+ /**
23
+ * Cadmus pin-based lookup data service. The text being searched here is just
24
+ * the pin's value, according to the options specified. These options correspond
25
+ * to an index lookup definition. The resulting items are of type DataPinInfo.
26
+ */
27
+ declare class PinRefLookupService implements RefLookupService {
28
+ private _itemService;
29
+ constructor(_itemService: ItemService);
30
+ getName(item: any | undefined): string;
31
+ private buildQuery;
32
+ lookup(filter: PinRefLookupFilter, options?: any): Observable<any[]>;
33
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<PinRefLookupService, never>;
34
+ static ɵprov: _angular_core.ɵɵInjectableDeclaration<PinRefLookupService>;
35
+ }
36
+
37
+ declare class ItemRefLookupService implements RefLookupService {
38
+ private _itemService;
39
+ constructor(_itemService: ItemService);
40
+ lookup(filter: RefLookupFilter, options?: any): Observable<Item[]>;
41
+ getName(item: Item): string;
42
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<ItemRefLookupService, never>;
43
+ static ɵprov: _angular_core.ɵɵInjectableDeclaration<ItemRefLookupService>;
44
+ }
45
+
46
+ interface MetadataPart$1 extends Part {
47
+ metadata: {
48
+ type?: string;
49
+ name: string;
50
+ value: string;
51
+ }[];
52
+ }
53
+ /**
54
+ * Pin lookup data used internally by the component.
55
+ */
56
+ interface PinLookupData {
57
+ pin: DataPinInfo;
58
+ item?: Item;
59
+ metaPart?: MetadataPart$1;
60
+ }
61
+ /**
62
+ * A pin-based target. This includes pin's name and value, and
63
+ * the item's ID and optional part IDs. The label is a user friendly
64
+ * string representation of the target, while the gid is a globally
65
+ * unique identifier for the target.
66
+ */
67
+ interface PinTarget {
68
+ gid: string;
69
+ label: string;
70
+ itemId?: string;
71
+ partId?: string;
72
+ partTypeId?: string;
73
+ roleId?: string;
74
+ name?: string;
75
+ value?: string;
76
+ }
77
+ declare class PinTargetLookupComponent implements OnInit, OnDestroy {
78
+ private _presetLookupDefs;
79
+ itemLookupService: ItemRefLookupService;
80
+ pinLookupService: PinRefLookupService;
81
+ private _itemService;
82
+ private _thesService;
83
+ private _snackbar;
84
+ private readonly _subs;
85
+ private _noTargetUpdate?;
86
+ private _noFormUpdate?;
87
+ private _startWithByTypeMode?;
88
+ /**
89
+ * True when the by-type pin lookup mode is active.
90
+ * User can change mode unless modeSwitching is false.
91
+ */
92
+ readonly pinByTypeMode: _angular_core.ModelSignal<boolean | undefined>;
93
+ /**
94
+ * True when the user can switch between by-type and by-item mode.
95
+ */
96
+ readonly canSwitchMode: _angular_core.ModelSignal<boolean | undefined>;
97
+ /**
98
+ * True when the user can edit the target's gid/label for internal
99
+ * targets.
100
+ */
101
+ readonly canEditTarget: _angular_core.InputSignal<boolean | undefined>;
102
+ /**
103
+ * The lookup definitions to be used for the by-type lookup. If
104
+ * not specified, the lookup definitions will be got via injection
105
+ * when available; if the injected definitions are empty, the
106
+ * lookup definitions will be built from the model-types thesaurus;
107
+ * if this is not available either, the by-type lookup will be
108
+ * disabled.
109
+ */
110
+ readonly lookupDefinitions: _angular_core.ModelSignal<IndexLookupDefinitions | undefined>;
111
+ /**
112
+ * The optional configurations for using external lookup services.
113
+ */
114
+ readonly extLookupConfigs: _angular_core.InputSignal<RefLookupConfig[]>;
115
+ /**
116
+ * True if when a new target is set it should be internal rather than
117
+ * external by default.
118
+ */
119
+ readonly internalDefault: _angular_core.InputSignal<boolean | undefined>;
120
+ /**
121
+ * The target to be edited.
122
+ */
123
+ readonly target: _angular_core.ModelSignal<PinTarget | undefined>;
124
+ /**
125
+ * The default value for part type key when the by-type mode is active.
126
+ */
127
+ readonly defaultPartTypeKey: _angular_core.InputSignal<string | undefined>;
128
+ /**
129
+ * Emitted when user closes the editor.
130
+ */
131
+ readonly editorClose: _angular_core.OutputEmitterRef<void>;
132
+ /**
133
+ * Emitted when the user requests more items from an external lookup.
134
+ */
135
+ readonly extMoreRequest: _angular_core.OutputEmitterRef<RefLookupSetEvent>;
136
+ /**
137
+ * Emitted when the user changes the external lookup configuration.
138
+ */
139
+ readonly extLookupConfigChange: _angular_core.OutputEmitterRef<RefLookupConfig>;
140
+ modelEntries: ThesaurusEntry[];
141
+ partTypeKeys: string[];
142
+ itemParts: Part[];
143
+ item: FormControl<Item | null>;
144
+ itemPart: FormControl<Part | null>;
145
+ partTypeKey: FormControl<string | null>;
146
+ gid: FormControl<string | null>;
147
+ label: FormControl<string | null>;
148
+ byTypeMode: FormControl<boolean>;
149
+ external: FormControl<boolean>;
150
+ form: FormGroup;
151
+ filter: PinRefLookupFilter;
152
+ pinFilterOptions?: IndexLookupDefinition;
153
+ lookupData?: PinLookupData;
154
+ constructor(_presetLookupDefs: IndexLookupDefinitions, itemLookupService: ItemRefLookupService, pinLookupService: PinRefLookupService, _itemService: ItemService, _thesService: ThesaurusService, _snackbar: MatSnackBar, formBuilder: FormBuilder);
155
+ private forceByItem;
156
+ private setupKeys;
157
+ ngOnInit(): void;
158
+ ngOnDestroy(): void;
159
+ private buildGid;
160
+ private buildLabel;
161
+ private getTarget;
162
+ private emitChange;
163
+ private updateTarget;
164
+ private updateForm;
165
+ /**
166
+ * Called when the item lookup changes (item is looked up
167
+ * by its title).
168
+ *
169
+ * @param item The item got from lookup.
170
+ */
171
+ onItemLookupChange(item: unknown): void;
172
+ private loadItemInfo;
173
+ /**
174
+ * Called when the pin lookup change. A pin is looked up by its
175
+ * name and value (=the filter's text), and optionally by:
176
+ * - its index lookup definition (selected by partTypeKey).
177
+ * - its item (defined by item, in filter).
178
+ * - its part (defined by itemPart, in filter).
179
+ *
180
+ * @param info The pin info from pin lookup.
181
+ */
182
+ onPinLookupChange(info: unknown): void;
183
+ onExtItemChange(event: RefLookupSetEvent): void;
184
+ onExtMoreRequest(event: RefLookupSetEvent): void;
185
+ onCopied(): void;
186
+ onExtConfigChange(config: RefLookupConfig): void;
187
+ close(): void;
188
+ save(): void;
189
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<PinTargetLookupComponent, never>;
190
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<PinTargetLookupComponent, "cadmus-pin-target-lookup", never, { "pinByTypeMode": { "alias": "pinByTypeMode"; "required": false; "isSignal": true; }; "canSwitchMode": { "alias": "canSwitchMode"; "required": false; "isSignal": true; }; "canEditTarget": { "alias": "canEditTarget"; "required": false; "isSignal": true; }; "lookupDefinitions": { "alias": "lookupDefinitions"; "required": false; "isSignal": true; }; "extLookupConfigs": { "alias": "extLookupConfigs"; "required": false; "isSignal": true; }; "internalDefault": { "alias": "internalDefault"; "required": false; "isSignal": true; }; "target": { "alias": "target"; "required": false; "isSignal": true; }; "defaultPartTypeKey": { "alias": "defaultPartTypeKey"; "required": false; "isSignal": true; }; }, { "pinByTypeMode": "pinByTypeModeChange"; "canSwitchMode": "canSwitchModeChange"; "lookupDefinitions": "lookupDefinitionsChange"; "target": "targetChange"; "editorClose": "editorClose"; "extMoreRequest": "extMoreRequest"; "extLookupConfigChange": "extLookupConfigChange"; }, never, never, true, never>;
191
+ }
192
+
193
+ /**
194
+ * An asserted composite ID. This can be an external ID, having only the ID value
195
+ * as its target.gid property; or a lookup ID, with a pin-based target.
196
+ * In both cases, we can add a tag, a scope, and an assertion.
197
+ */
198
+ interface AssertedCompositeId {
199
+ target: PinTarget;
200
+ tag?: string;
201
+ scope?: string;
202
+ assertion?: Assertion;
203
+ }
204
+ /**
205
+ * The key to be used to retrieve the external lookup configs from the
206
+ * settings storage. This is equal to the selector of
207
+ * AssertedCompositeIdComponent plus ".configs".
208
+ */
209
+ declare const ASSERTED_COMPOSITE_ID_CONFIGS_KEY = "cadmus-refs-asserted-composite-id.configs";
210
+ /**
211
+ * An asserted composite ID editor. This allows the user to edit an asserted
212
+ * composite ID, which can be an external ID or a lookup ID.
213
+ */
214
+ declare class AssertedCompositeIdComponent implements OnInit, OnDestroy {
215
+ lookupService: PinRefLookupService;
216
+ lookupDefs: IndexLookupDefinitions;
217
+ private _sub?;
218
+ private _updatingForm;
219
+ extLookupConfigs: RefLookupConfig[];
220
+ targetExpanded: boolean;
221
+ target: FormControl<PinTarget | null>;
222
+ scope: FormControl<string | null>;
223
+ tag: FormControl<string | null>;
224
+ assertion: FormControl<Assertion | null>;
225
+ form: FormGroup;
226
+ readonly idScopeEntries: _angular_core.InputSignal<ThesaurusEntry[] | undefined>;
227
+ readonly idTagEntries: _angular_core.InputSignal<ThesaurusEntry[] | undefined>;
228
+ readonly assTagEntries: _angular_core.InputSignal<ThesaurusEntry[] | undefined>;
229
+ readonly refTypeEntries: _angular_core.InputSignal<ThesaurusEntry[] | undefined>;
230
+ readonly refTagEntries: _angular_core.InputSignal<ThesaurusEntry[] | undefined>;
231
+ /**
232
+ * The ID being edited.
233
+ */
234
+ readonly id: _angular_core.ModelSignal<AssertedCompositeId | undefined>;
235
+ /**
236
+ * True if when a new ID is set it should be internal rather than
237
+ * external by default.
238
+ */
239
+ readonly internalDefault: _angular_core.InputSignal<boolean | undefined>;
240
+ /**
241
+ * True if the UI has a submit button.
242
+ */
243
+ readonly hasSubmit: _angular_core.InputSignal<boolean | undefined>;
244
+ /**
245
+ * True when the internal UI preselected mode should be by type rather than
246
+ * by item. User can change mode unless modeSwitching is false.
247
+ */
248
+ readonly pinByTypeMode: _angular_core.InputSignal<boolean | undefined>;
249
+ /**
250
+ * True when the user can switch between by-type and by-item mode in
251
+ * the internal UI.
252
+ */
253
+ readonly canSwitchMode: _angular_core.InputSignal<boolean | undefined>;
254
+ /**
255
+ * True when the user can edit the target's gid/label for internal targets.
256
+ */
257
+ readonly canEditTarget: _angular_core.InputSignal<boolean | undefined>;
258
+ /**
259
+ * The lookup definitions to be used for the by-type lookup in the internal UI.
260
+ * If not specified, the lookup definitions will be got via injection
261
+ * when available; if the injected definitions are empty, the
262
+ * lookup definitions will be built from the model-types thesaurus;
263
+ * if this is not available either, the by-type lookup will be
264
+ * disabled.
265
+ */
266
+ readonly lookupDefinitions: _angular_core.InputSignal<IndexLookupDefinitions | undefined>;
267
+ /**
268
+ * The default part type key to be used.
269
+ */
270
+ readonly defaultPartTypeKey: _angular_core.InputSignal<string | undefined>;
271
+ /**
272
+ * Emitted whenever the user requests to close the editor.
273
+ */
274
+ readonly editorClose: _angular_core.OutputEmitterRef<void>;
275
+ /**
276
+ * Emitted when the user requests more.
277
+ */
278
+ readonly extMoreRequest: _angular_core.OutputEmitterRef<RefLookupSetEvent>;
279
+ constructor(formBuilder: FormBuilder, lookupService: PinRefLookupService, lookupDefs: IndexLookupDefinitions, settings: RamStorageService);
280
+ ngOnInit(): void;
281
+ ngOnDestroy(): void;
282
+ onAssertionChange(assertion: Assertion | undefined): void;
283
+ onTargetChange(target?: PinTarget): void;
284
+ private updateForm;
285
+ private getId;
286
+ emitIdChange(): void;
287
+ onEditorClose(): void;
288
+ onExtMoreRequest(event: RefLookupSetEvent): void;
289
+ onExtLookupConfigChange(config: RefLookupConfig): void;
290
+ cancel(): void;
291
+ save(): void;
292
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<AssertedCompositeIdComponent, never>;
293
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<AssertedCompositeIdComponent, "cadmus-refs-asserted-composite-id", never, { "idScopeEntries": { "alias": "idScopeEntries"; "required": false; "isSignal": true; }; "idTagEntries": { "alias": "idTagEntries"; "required": false; "isSignal": true; }; "assTagEntries": { "alias": "assTagEntries"; "required": false; "isSignal": true; }; "refTypeEntries": { "alias": "refTypeEntries"; "required": false; "isSignal": true; }; "refTagEntries": { "alias": "refTagEntries"; "required": false; "isSignal": true; }; "id": { "alias": "id"; "required": false; "isSignal": true; }; "internalDefault": { "alias": "internalDefault"; "required": false; "isSignal": true; }; "hasSubmit": { "alias": "hasSubmit"; "required": false; "isSignal": true; }; "pinByTypeMode": { "alias": "pinByTypeMode"; "required": false; "isSignal": true; }; "canSwitchMode": { "alias": "canSwitchMode"; "required": false; "isSignal": true; }; "canEditTarget": { "alias": "canEditTarget"; "required": false; "isSignal": true; }; "lookupDefinitions": { "alias": "lookupDefinitions"; "required": false; "isSignal": true; }; "defaultPartTypeKey": { "alias": "defaultPartTypeKey"; "required": false; "isSignal": true; }; }, { "id": "idChange"; "editorClose": "editorClose"; "extMoreRequest": "extMoreRequest"; }, never, never, true, never>;
294
+ }
295
+
296
+ /**
297
+ * Asserted composite IDs editor.
298
+ */
299
+ declare class AssertedCompositeIdsComponent {
300
+ private _dialogService;
301
+ private _ids;
302
+ private _editedIndex;
303
+ edited?: AssertedCompositeId;
304
+ /**
305
+ * The asserted IDs.
306
+ */
307
+ get ids(): AssertedCompositeId[];
308
+ set ids(value: AssertedCompositeId[]);
309
+ readonly idScopeEntries: _angular_core.InputSignal<ThesaurusEntry[] | undefined>;
310
+ readonly idTagEntries: _angular_core.InputSignal<ThesaurusEntry[] | undefined>;
311
+ readonly assTagEntries: _angular_core.InputSignal<ThesaurusEntry[] | undefined>;
312
+ readonly refTypeEntries: _angular_core.InputSignal<ThesaurusEntry[] | undefined>;
313
+ readonly refTagEntries: _angular_core.InputSignal<ThesaurusEntry[] | undefined>;
314
+ /**
315
+ * True when the internal UI preselected mode should be by type rather than
316
+ * by item. User can change mode unless modeSwitching is false.
317
+ */
318
+ readonly pinByTypeMode: _angular_core.InputSignal<boolean | undefined>;
319
+ /**
320
+ * True when the user can switch between by-type and by-item mode in
321
+ * the internal UI.
322
+ */
323
+ readonly canSwitchMode: _angular_core.InputSignal<boolean | undefined>;
324
+ /**
325
+ * True when the user can edit the target's gid/label for internal targets.
326
+ */
327
+ readonly canEditTarget: _angular_core.InputSignal<boolean | undefined>;
328
+ /**
329
+ * The lookup definitions to be used for the by-type lookup in the internal UI.
330
+ * If not specified, the lookup definitions will be got via injection
331
+ * when available; if the injected definitions are empty, the
332
+ * lookup definitions will be built from the model-types thesaurus;
333
+ * if this is not available either, the by-type lookup will be
334
+ * disabled.
335
+ */
336
+ readonly lookupDefinitions: _angular_core.InputSignal<IndexLookupDefinitions | undefined>;
337
+ /**
338
+ * The default part type key.
339
+ */
340
+ readonly defaultPartTypeKey: _angular_core.InputSignal<string | undefined>;
341
+ /**
342
+ * True if when a new ID is set it should be internal rather than
343
+ * external by default.
344
+ */
345
+ readonly internalDefault: _angular_core.InputSignal<boolean | undefined>;
346
+ /**
347
+ * Emitted whenever any ID changes.
348
+ */
349
+ readonly idsChange: _angular_core.OutputEmitterRef<AssertedCompositeId[]>;
350
+ entries: FormControl<AssertedCompositeId[]>;
351
+ form: FormGroup;
352
+ constructor(formBuilder: FormBuilder, _dialogService: DialogService);
353
+ private updateForm;
354
+ private emitIdsChange;
355
+ addId(): void;
356
+ editId(id: AssertedCompositeId, index: number): void;
357
+ closeId(): void;
358
+ saveId(entry: AssertedCompositeId): void;
359
+ deleteId(index: number): void;
360
+ moveIdUp(index: number): void;
361
+ moveIdDown(index: number): void;
362
+ onIdChange(id?: AssertedCompositeId): void;
363
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<AssertedCompositeIdsComponent, never>;
364
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<AssertedCompositeIdsComponent, "cadmus-refs-asserted-composite-ids", never, { "ids": { "alias": "ids"; "required": false; }; "idScopeEntries": { "alias": "idScopeEntries"; "required": false; "isSignal": true; }; "idTagEntries": { "alias": "idTagEntries"; "required": false; "isSignal": true; }; "assTagEntries": { "alias": "assTagEntries"; "required": false; "isSignal": true; }; "refTypeEntries": { "alias": "refTypeEntries"; "required": false; "isSignal": true; }; "refTagEntries": { "alias": "refTagEntries"; "required": false; "isSignal": true; }; "pinByTypeMode": { "alias": "pinByTypeMode"; "required": false; "isSignal": true; }; "canSwitchMode": { "alias": "canSwitchMode"; "required": false; "isSignal": true; }; "canEditTarget": { "alias": "canEditTarget"; "required": false; "isSignal": true; }; "lookupDefinitions": { "alias": "lookupDefinitions"; "required": false; "isSignal": true; }; "defaultPartTypeKey": { "alias": "defaultPartTypeKey"; "required": false; "isSignal": true; }; "internalDefault": { "alias": "internalDefault"; "required": false; "isSignal": true; }; }, { "idsChange": "idsChange"; }, never, never, true, never>;
365
+ }
366
+
367
+ /**
368
+ * An asserted ID.
369
+ */
370
+ interface AssertedId {
371
+ tag?: string;
372
+ value: string;
373
+ label?: string;
374
+ scope: string;
375
+ assertion?: Assertion;
376
+ }
377
+ /**
378
+ * Asserted ID editor component.
379
+ */
380
+ declare class AssertedIdComponent implements OnInit, OnDestroy {
381
+ lookupService: PinRefLookupService;
382
+ lookupDefs: IndexLookupDefinitions;
383
+ private _sub?;
384
+ private _updatingForm;
385
+ tag: FormControl<string | null>;
386
+ value: FormControl<string | null>;
387
+ label: FormControl<string | null>;
388
+ scope: FormControl<string | null>;
389
+ assertion: FormControl<Assertion | null>;
390
+ form: FormGroup;
391
+ lookupExpanded: boolean;
392
+ readonly idScopeEntries: _angular_core.InputSignal<ThesaurusEntry[] | undefined>;
393
+ readonly idTagEntries: _angular_core.InputSignal<ThesaurusEntry[] | undefined>;
394
+ readonly assTagEntries: _angular_core.InputSignal<ThesaurusEntry[] | undefined>;
395
+ readonly refTypeEntries: _angular_core.InputSignal<ThesaurusEntry[] | undefined>;
396
+ readonly refTagEntries: _angular_core.InputSignal<ThesaurusEntry[] | undefined>;
397
+ /**
398
+ * The asserted ID being edited.
399
+ */
400
+ readonly id: _angular_core.ModelSignal<AssertedId | undefined>;
401
+ /**
402
+ * True to hide the pin-based EID lookup UI.
403
+ */
404
+ readonly noEidLookup: _angular_core.InputSignal<boolean | undefined>;
405
+ /**
406
+ * True to show the submit button.
407
+ */
408
+ readonly hasSubmit: _angular_core.InputSignal<boolean | undefined>;
409
+ /**
410
+ * Emitted when the editor is closed.
411
+ */
412
+ readonly editorClose: _angular_core.OutputEmitterRef<void>;
413
+ constructor(formBuilder: FormBuilder, lookupService: PinRefLookupService, lookupDefs: IndexLookupDefinitions);
414
+ ngOnInit(): void;
415
+ ngOnDestroy(): void;
416
+ onAssertionChange(assertion: Assertion | undefined): void;
417
+ onIdPick(id: string): void;
418
+ private updateForm;
419
+ private getId;
420
+ emitIdChange(): void;
421
+ cancel(): void;
422
+ save(): void;
423
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<AssertedIdComponent, never>;
424
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<AssertedIdComponent, "cadmus-refs-asserted-id", never, { "idScopeEntries": { "alias": "idScopeEntries"; "required": false; "isSignal": true; }; "idTagEntries": { "alias": "idTagEntries"; "required": false; "isSignal": true; }; "assTagEntries": { "alias": "assTagEntries"; "required": false; "isSignal": true; }; "refTypeEntries": { "alias": "refTypeEntries"; "required": false; "isSignal": true; }; "refTagEntries": { "alias": "refTagEntries"; "required": false; "isSignal": true; }; "id": { "alias": "id"; "required": false; "isSignal": true; }; "noEidLookup": { "alias": "noEidLookup"; "required": false; "isSignal": true; }; "hasSubmit": { "alias": "hasSubmit"; "required": false; "isSignal": true; }; }, { "id": "idChange"; "editorClose": "editorClose"; }, never, never, true, never>;
425
+ }
426
+
427
+ /**
428
+ * Asserted IDs editor.
429
+ */
430
+ declare class AssertedIdsComponent {
431
+ private _dialogService;
432
+ private _editedIndex;
433
+ edited?: AssertedId;
434
+ /**
435
+ * The asserted IDs.
436
+ */
437
+ readonly ids: _angular_core.ModelSignal<AssertedId[]>;
438
+ readonly idScopeEntries: _angular_core.InputSignal<ThesaurusEntry[] | undefined>;
439
+ readonly idTagEntries: _angular_core.InputSignal<ThesaurusEntry[] | undefined>;
440
+ readonly assTagEntries: _angular_core.InputSignal<ThesaurusEntry[] | undefined>;
441
+ readonly refTypeEntries: _angular_core.InputSignal<ThesaurusEntry[] | undefined>;
442
+ readonly refTagEntries: _angular_core.InputSignal<ThesaurusEntry[] | undefined>;
443
+ entries: FormControl<AssertedId[]>;
444
+ form: FormGroup;
445
+ constructor(formBuilder: FormBuilder, _dialogService: DialogService);
446
+ private updateForm;
447
+ addId(): void;
448
+ editId(id: AssertedId, index: number): void;
449
+ closeId(): void;
450
+ saveId(entry: AssertedId): void;
451
+ deleteId(index: number): void;
452
+ moveIdUp(index: number): void;
453
+ moveIdDown(index: number): void;
454
+ onIdChange(id?: AssertedId): void;
455
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<AssertedIdsComponent, never>;
456
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<AssertedIdsComponent, "cadmus-refs-asserted-ids", never, { "ids": { "alias": "ids"; "required": false; "isSignal": true; }; "idScopeEntries": { "alias": "idScopeEntries"; "required": false; "isSignal": true; }; "idTagEntries": { "alias": "idTagEntries"; "required": false; "isSignal": true; }; "assTagEntries": { "alias": "assTagEntries"; "required": false; "isSignal": true; }; "refTypeEntries": { "alias": "refTypeEntries"; "required": false; "isSignal": true; }; "refTagEntries": { "alias": "refTagEntries"; "required": false; "isSignal": true; }; }, { "ids": "idsChange"; }, never, never, true, never>;
457
+ }
458
+
459
+ interface MetadataPart extends Part {
460
+ metadata: {
461
+ type?: string;
462
+ name: string;
463
+ value: string;
464
+ }[];
465
+ }
466
+ interface LookupInfo {
467
+ pin: DataPinInfo;
468
+ item?: Item;
469
+ part?: MetadataPart;
470
+ }
471
+ declare class ScopedPinLookupComponent {
472
+ private _itemService;
473
+ lookupService: PinRefLookupService;
474
+ lookupDefs: IndexLookupDefinitions;
475
+ key: FormControl<string | null>;
476
+ keyForm: FormGroup;
477
+ keys: string[];
478
+ info?: LookupInfo;
479
+ id: FormControl<string | null>;
480
+ idForm: FormGroup;
481
+ /**
482
+ * Emitted whenever the user picks an ID.
483
+ */
484
+ readonly idPick: _angular_core.OutputEmitterRef<string>;
485
+ constructor(formBuilder: FormBuilder, _itemService: ItemService, lookupService: PinRefLookupService, lookupDefs: IndexLookupDefinitions);
486
+ ngOnInit(): void;
487
+ onItemChange(item: unknown): void;
488
+ appendIdComponent(type: string, metaIndex?: number): void;
489
+ pickId(): void;
490
+ resetId(): void;
491
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<ScopedPinLookupComponent, never>;
492
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<ScopedPinLookupComponent, "cadmus-scoped-pin-lookup", never, {}, { "idPick": "idPick"; }, never, never, true, never>;
493
+ }
494
+
495
+ export { ASSERTED_COMPOSITE_ID_CONFIGS_KEY, AssertedCompositeIdComponent, AssertedCompositeIdsComponent, AssertedIdComponent, AssertedIdsComponent, ItemRefLookupService, PinRefLookupService, PinTargetLookupComponent, ScopedPinLookupComponent };
496
+ export type { AssertedCompositeId, AssertedId, PinLookupData, PinRefLookupFilter, PinTarget };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@myrmidon/cadmus-refs-asserted-ids",
3
- "version": "9.0.0",
3
+ "version": "10.0.1",
4
4
  "description": "Cadmus - asserted IDs components.",
5
5
  "keywords": [
6
6
  "Cadmus",
@@ -15,11 +15,11 @@
15
15
  "name": "Daniele Fusi"
16
16
  },
17
17
  "peerDependencies": {
18
- "@angular/common": "^19.0.0",
19
- "@angular/core": "^19.0.0",
20
- "@myrmidon/ngx-mat-tools": "^0.0.1",
21
- "@myrmidon/cadmus-api": "^11.0.0",
22
- "@myrmidon/cadmus-refs-assertion": "^9.0.0"
18
+ "@angular/common": "^20.0.0",
19
+ "@angular/core": "^20.0.0",
20
+ "@myrmidon/ngx-mat-tools": "^1.0.0",
21
+ "@myrmidon/cadmus-api": "^14.0.0",
22
+ "@myrmidon/cadmus-refs-assertion": "^10.0.0"
23
23
  },
24
24
  "dependencies": {
25
25
  "tslib": "^2.3.0"
@@ -1,111 +0,0 @@
1
- import { OnDestroy, OnInit } from '@angular/core';
2
- import { FormBuilder, FormControl, FormGroup } from '@angular/forms';
3
- import { RamStorageService } from '@myrmidon/ngx-tools';
4
- import { IndexLookupDefinitions, ThesaurusEntry } from '@myrmidon/cadmus-core';
5
- import { Assertion } from '@myrmidon/cadmus-refs-assertion';
6
- import { RefLookupConfig, RefLookupSetEvent } from '@myrmidon/cadmus-refs-lookup';
7
- import { PinRefLookupService } from '../services/pin-ref-lookup.service';
8
- import { PinTarget } from '../pin-target-lookup/pin-target-lookup.component';
9
- import * as i0 from "@angular/core";
10
- /**
11
- * An asserted composite ID. This can be an external ID, having only the ID value
12
- * as its target.gid property; or a lookup ID, with a pin-based target.
13
- * In both cases, we can add a tag, a scope, and an assertion.
14
- */
15
- export interface AssertedCompositeId {
16
- target: PinTarget;
17
- tag?: string;
18
- scope?: string;
19
- assertion?: Assertion;
20
- }
21
- /**
22
- * The key to be used to retrieve the external lookup configs from the
23
- * settings storage. This is equal to the selector of
24
- * AssertedCompositeIdComponent plus ".configs".
25
- */
26
- export declare const ASSERTED_COMPOSITE_ID_CONFIGS_KEY = "cadmus-refs-asserted-composite-id.configs";
27
- /**
28
- * An asserted composite ID editor. This allows the user to edit an asserted
29
- * composite ID, which can be an external ID or a lookup ID.
30
- */
31
- export declare class AssertedCompositeIdComponent implements OnInit, OnDestroy {
32
- lookupService: PinRefLookupService;
33
- lookupDefs: IndexLookupDefinitions;
34
- private _sub?;
35
- private _updatingForm;
36
- extLookupConfigs: RefLookupConfig[];
37
- targetExpanded: boolean;
38
- target: FormControl<PinTarget | null>;
39
- scope: FormControl<string | null>;
40
- tag: FormControl<string | null>;
41
- assertion: FormControl<Assertion | null>;
42
- form: FormGroup;
43
- readonly idScopeEntries: import("@angular/core").InputSignal<ThesaurusEntry[] | undefined>;
44
- readonly idTagEntries: import("@angular/core").InputSignal<ThesaurusEntry[] | undefined>;
45
- readonly assTagEntries: import("@angular/core").InputSignal<ThesaurusEntry[] | undefined>;
46
- readonly refTypeEntries: import("@angular/core").InputSignal<ThesaurusEntry[] | undefined>;
47
- readonly refTagEntries: import("@angular/core").InputSignal<ThesaurusEntry[] | undefined>;
48
- /**
49
- * The ID being edited.
50
- */
51
- readonly id: import("@angular/core").ModelSignal<AssertedCompositeId | undefined>;
52
- /**
53
- * True if when a new ID is set it should be internal rather than
54
- * external by default.
55
- */
56
- readonly internalDefault: import("@angular/core").InputSignal<boolean | undefined>;
57
- /**
58
- * True if the UI has a submit button.
59
- */
60
- readonly hasSubmit: import("@angular/core").InputSignal<boolean | undefined>;
61
- /**
62
- * True when the internal UI preselected mode should be by type rather than
63
- * by item. User can change mode unless modeSwitching is false.
64
- */
65
- readonly pinByTypeMode: import("@angular/core").InputSignal<boolean | undefined>;
66
- /**
67
- * True when the user can switch between by-type and by-item mode in
68
- * the internal UI.
69
- */
70
- readonly canSwitchMode: import("@angular/core").InputSignal<boolean | undefined>;
71
- /**
72
- * True when the user can edit the target's gid/label for internal targets.
73
- */
74
- readonly canEditTarget: import("@angular/core").InputSignal<boolean | undefined>;
75
- /**
76
- * The lookup definitions to be used for the by-type lookup in the internal UI.
77
- * If not specified, the lookup definitions will be got via injection
78
- * when available; if the injected definitions are empty, the
79
- * lookup definitions will be built from the model-types thesaurus;
80
- * if this is not available either, the by-type lookup will be
81
- * disabled.
82
- */
83
- readonly lookupDefinitions: import("@angular/core").InputSignal<IndexLookupDefinitions | undefined>;
84
- /**
85
- * The default part type key to be used.
86
- */
87
- readonly defaultPartTypeKey: import("@angular/core").InputSignal<string | undefined>;
88
- /**
89
- * Emitted whenever the user requests to close the editor.
90
- */
91
- readonly editorClose: import("@angular/core").OutputEmitterRef<void>;
92
- /**
93
- * Emitted when the user requests more.
94
- */
95
- readonly extMoreRequest: import("@angular/core").OutputEmitterRef<RefLookupSetEvent>;
96
- constructor(formBuilder: FormBuilder, lookupService: PinRefLookupService, lookupDefs: IndexLookupDefinitions, settings: RamStorageService);
97
- ngOnInit(): void;
98
- ngOnDestroy(): void;
99
- onAssertionChange(assertion: Assertion | undefined): void;
100
- onTargetChange(target?: PinTarget): void;
101
- private updateForm;
102
- private getId;
103
- emitIdChange(): void;
104
- onEditorClose(): void;
105
- onExtMoreRequest(event: RefLookupSetEvent): void;
106
- onExtLookupConfigChange(config: RefLookupConfig): void;
107
- cancel(): void;
108
- save(): void;
109
- static ɵfac: i0.ɵɵFactoryDeclaration<AssertedCompositeIdComponent, never>;
110
- static ɵcmp: i0.ɵɵComponentDeclaration<AssertedCompositeIdComponent, "cadmus-refs-asserted-composite-id", never, { "idScopeEntries": { "alias": "idScopeEntries"; "required": false; "isSignal": true; }; "idTagEntries": { "alias": "idTagEntries"; "required": false; "isSignal": true; }; "assTagEntries": { "alias": "assTagEntries"; "required": false; "isSignal": true; }; "refTypeEntries": { "alias": "refTypeEntries"; "required": false; "isSignal": true; }; "refTagEntries": { "alias": "refTagEntries"; "required": false; "isSignal": true; }; "id": { "alias": "id"; "required": false; "isSignal": true; }; "internalDefault": { "alias": "internalDefault"; "required": false; "isSignal": true; }; "hasSubmit": { "alias": "hasSubmit"; "required": false; "isSignal": true; }; "pinByTypeMode": { "alias": "pinByTypeMode"; "required": false; "isSignal": true; }; "canSwitchMode": { "alias": "canSwitchMode"; "required": false; "isSignal": true; }; "canEditTarget": { "alias": "canEditTarget"; "required": false; "isSignal": true; }; "lookupDefinitions": { "alias": "lookupDefinitions"; "required": false; "isSignal": true; }; "defaultPartTypeKey": { "alias": "defaultPartTypeKey"; "required": false; "isSignal": true; }; }, { "id": "idChange"; "editorClose": "editorClose"; "extMoreRequest": "extMoreRequest"; }, never, never, true, never>;
111
- }