@myrmidon/cadmus-refs-asserted-ids 10.0.17 → 11.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@myrmidon/cadmus-refs-asserted-ids",
3
- "version": "10.0.17",
3
+ "version": "11.0.1",
4
4
  "description": "Cadmus - asserted IDs components.",
5
5
  "keywords": [
6
6
  "Cadmus",
@@ -15,13 +15,15 @@
15
15
  "name": "Daniele Fusi"
16
16
  },
17
17
  "peerDependencies": {
18
- "@angular/common": "^20.0.0 || ^21.0.0",
19
- "@angular/core": "^20.0.0 || ^21.0.0",
20
- "@angular/material": "^20.0.0 || ^21.0.0",
21
- "@myrmidon/ngx-mat-tools": "^1.0.2",
22
- "@myrmidon/cadmus-api": "^14.0.7",
23
- "@myrmidon/cadmus-refs-assertion": "^10.0.6",
24
- "@myrmidon/cadmus-thesaurus-store": "^0.1.0"
18
+ "@angular/common": "^22.0.0",
19
+ "@angular/core": "^22.0.0",
20
+ "@angular/material": "^22.0.0",
21
+ "@myrmidon/ngx-mat-tools": "^2.0.0",
22
+ "@myrmidon/cadmus-api": "^15.0.0",
23
+ "@myrmidon/cadmus-refs-assertion": "^11.0.0",
24
+ "@myrmidon/cadmus-thesaurus-store": "^1.0.0",
25
+ "@myrmidon/taxo-store-api": "^1.0.1",
26
+ "@myrmidon/taxo-store-picker": "^1.0.0"
25
27
  },
26
28
  "dependencies": {
27
29
  "tslib": "^2.3.0"
@@ -37,5 +39,6 @@
37
39
  "types": "./types/myrmidon-cadmus-refs-asserted-ids.d.ts",
38
40
  "default": "./fesm2022/myrmidon-cadmus-refs-asserted-ids.mjs"
39
41
  }
40
- }
42
+ },
43
+ "type": "module"
41
44
  }
@@ -5,6 +5,8 @@ import { RamStorageService } from '@myrmidon/ngx-tools';
5
5
  import { Assertion } from '@myrmidon/cadmus-refs-assertion';
6
6
  import { Item, DataPinInfo, Part, IndexLookupDefinitions, IndexLookupDefinition, ThesaurusEntry } from '@myrmidon/cadmus-core';
7
7
  import { RefLookupService, RefLookupFilter, RefLookupConfig, LookupProviderOptions, RefLookupSetEvent } from '@myrmidon/cadmus-refs-lookup';
8
+ import { TaxoStoreNode } from '@myrmidon/taxo-store-api';
9
+ import { FlagOption } from '@myrmidon/taxo-store-picker';
8
10
  import { Observable } from 'rxjs';
9
11
  import { ItemService, ThesaurusService } from '@myrmidon/cadmus-api';
10
12
  import { MatSnackBar } from '@angular/material/snack-bar';
@@ -124,6 +126,19 @@ declare class PinTargetLookupComponent implements OnInit, OnDestroy {
124
126
  * The target to be edited.
125
127
  */
126
128
  readonly target: _angular_core.ModelSignal<PinTarget | undefined>;
129
+ /**
130
+ * True to hide the internal "external" target source checkbox,
131
+ * letting the parent component fully command the source mode via
132
+ * externalMode.
133
+ */
134
+ readonly hideTargetSelector: _angular_core.InputSignal<boolean>;
135
+ /**
136
+ * When set, commands whether the target source is external (true)
137
+ * or internal (false), overriding the internal heuristic based on
138
+ * the target's itemId. Leave unset to let this component decide on
139
+ * its own, as before.
140
+ */
141
+ readonly externalMode: _angular_core.InputSignal<boolean | undefined>;
127
142
  /**
128
143
  * The default value for part type key when the by-type mode is active.
129
144
  */
@@ -192,9 +207,50 @@ declare class PinTargetLookupComponent implements OnInit, OnDestroy {
192
207
  close(): void;
193
208
  save(): void;
194
209
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<PinTargetLookupComponent, never>;
195
- 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; }; "lookupProviderOptions": { "alias": "lookupProviderOptions"; "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>;
210
+ 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; }; "lookupProviderOptions": { "alias": "lookupProviderOptions"; "required": false; "isSignal": true; }; "target": { "alias": "target"; "required": false; "isSignal": true; }; "hideTargetSelector": { "alias": "hideTargetSelector"; "required": false; "isSignal": true; }; "externalMode": { "alias": "externalMode"; "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>;
196
211
  }
197
212
 
213
+ /**
214
+ * The mode used to source the target of an asserted composite ID:
215
+ * - internal: the target points to a pin/item in this database.
216
+ * - external: the target is a free GID/label pair.
217
+ * - taxonomy: the target is picked from a taxonomy tree (TaxoStorePicker).
218
+ */
219
+ type AssertedCompositeIdTargetMode = 'internal' | 'external' | 'taxonomy';
220
+ /**
221
+ * The prefix prepended to the GID of any target sourced from a taxonomy
222
+ * tree, so that it can be told apart from a plain external GID when
223
+ * reloading an existing ID.
224
+ */
225
+ declare const TAXONOMY_GID_PREFIX = "@TX:";
226
+ /**
227
+ * The key used to retrieve the taxonomy lookup configurations via
228
+ * RamStorageService.
229
+ */
230
+ declare const LOOKUP_TAXOSTORE_CONFIGS_KEY = "cadmus-refs-asserted-ids.taxostore-configs";
231
+ /**
232
+ * Configuration for a taxonomy tree to be used as a lookup source for
233
+ * an asserted composite ID's target.
234
+ */
235
+ interface TaxoStoreLookupConfig {
236
+ /**
237
+ * The ID of the taxonomy tree to pick nodes from.
238
+ */
239
+ treeId: string;
240
+ /**
241
+ * A human-friendly name for this source, used both in the source
242
+ * selector and as the label for the taxonomy lookup component.
243
+ */
244
+ treeName: string;
245
+ hasTopNodeFilter?: boolean;
246
+ hasFlagsFilter?: boolean;
247
+ availableFlags?: FlagOption[];
248
+ canEdit?: boolean;
249
+ canAdd?: boolean;
250
+ canDelete?: boolean;
251
+ hideLoc?: boolean;
252
+ hideFilter?: boolean;
253
+ }
198
254
  /**
199
255
  * An asserted composite ID. This can be an external ID, having only the ID value
200
256
  * as its target.gid property; or a lookup ID, with a pin-based target.
@@ -210,7 +266,7 @@ interface AssertedCompositeId {
210
266
  }
211
267
  /**
212
268
  * An asserted composite ID editor. This allows the user to edit an asserted
213
- * composite ID, which can be an external ID or a lookup ID.
269
+ * composite ID, which can be an external ID, a lookup ID or a taxonomy ID.
214
270
  */
215
271
  declare class AssertedCompositeIdComponent {
216
272
  lookupService: PinRefLookupService;
@@ -219,6 +275,24 @@ declare class AssertedCompositeIdComponent {
219
275
  private _lookupConfigDirty;
220
276
  readonly extLookupConfigs: _angular_core.WritableSignal<RefLookupConfig[]>;
221
277
  readonly targetExpanded: _angular_core.WritableSignal<boolean>;
278
+ /**
279
+ * The taxonomy lookup configurations, if any.
280
+ */
281
+ readonly taxoLookupConfigs: _angular_core.WritableSignal<TaxoStoreLookupConfig[]>;
282
+ /**
283
+ * True if at least 1 taxonomy lookup configuration is available, so
284
+ * that the taxonomy source mode can be selected.
285
+ */
286
+ readonly hasTaxonomy: _angular_core.Signal<boolean>;
287
+ /**
288
+ * The currently selected target source mode.
289
+ */
290
+ readonly targetMode: _angular_core.WritableSignal<AssertedCompositeIdTargetMode>;
291
+ /**
292
+ * The taxonomy lookup configuration currently selected when
293
+ * targetMode is 'taxonomy'.
294
+ */
295
+ readonly selectedTaxoConfig: _angular_core.WritableSignal<TaxoStoreLookupConfig | undefined>;
222
296
  target: FormControl<PinTarget | null>;
223
297
  scope: FormControl<string | null>;
224
298
  tag: FormControl<string | null>;
@@ -289,7 +363,31 @@ declare class AssertedCompositeIdComponent {
289
363
  onEntriesChange(entries: ThesaurusEntry[]): void;
290
364
  onAssertionChange(assertion: Assertion | undefined): void;
291
365
  onTargetChange(target?: PinTarget): void;
366
+ /**
367
+ * Reset the target to an empty value without collapsing the target
368
+ * panel. This is used when switching source mode, as opposed to
369
+ * onTargetChange, which is used when the user has actually picked a
370
+ * target and the panel can be collapsed.
371
+ */
372
+ private resetTarget;
292
373
  private updateForm;
374
+ /**
375
+ * Detect the target source mode from the target itself, and update
376
+ * targetMode and selectedTaxoConfig accordingly.
377
+ */
378
+ private updateTargetMode;
379
+ /**
380
+ * Called when the user changes the target source mode.
381
+ */
382
+ onTargetModeChange(mode: AssertedCompositeIdTargetMode): void;
383
+ /**
384
+ * Called when the user changes the taxonomy tree to pick nodes from.
385
+ */
386
+ onTaxoConfigChange(config: TaxoStoreLookupConfig): void;
387
+ /**
388
+ * Called when the user picks a node from the taxonomy picker.
389
+ */
390
+ onTaxoNodePick(node: TaxoStoreNode | null): void;
293
391
  private getId;
294
392
  emitIdChange(): void;
295
393
  onEditorClose(): void;
@@ -503,5 +601,5 @@ declare class ScopedPinLookupComponent {
503
601
  static ɵcmp: _angular_core.ɵɵComponentDeclaration<ScopedPinLookupComponent, "cadmus-scoped-pin-lookup", never, { "lookupProviderOptions": { "alias": "lookupProviderOptions"; "required": false; "isSignal": true; }; }, { "idPick": "idPick"; }, never, never, true, never>;
504
602
  }
505
603
 
506
- export { AssertedCompositeIdComponent, AssertedCompositeIdsComponent, AssertedIdComponent, AssertedIdsComponent, ItemRefLookupService, PinRefLookupService, PinTargetLookupComponent, ScopedPinLookupComponent };
507
- export type { AssertedCompositeId, AssertedId, PinLookupData, PinRefLookupFilter, PinTarget };
604
+ export { AssertedCompositeIdComponent, AssertedCompositeIdsComponent, AssertedIdComponent, AssertedIdsComponent, ItemRefLookupService, LOOKUP_TAXOSTORE_CONFIGS_KEY, PinRefLookupService, PinTargetLookupComponent, ScopedPinLookupComponent, TAXONOMY_GID_PREFIX };
605
+ export type { AssertedCompositeId, AssertedCompositeIdTargetMode, AssertedId, PinLookupData, PinRefLookupFilter, PinTarget, TaxoStoreLookupConfig };