@myrmidon/cadmus-ui 14.0.0 → 15.1.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/index.d.ts CHANGED
@@ -1,12 +1,13 @@
1
1
  import * as _angular_core from '@angular/core';
2
- import { OnInit, ElementRef, OnDestroy } from '@angular/core';
3
- import { FormGroup, UntypedFormGroup, FormArray, FormBuilder, UntypedFormControl, UntypedFormBuilder, FormControl, ValidatorFn, AbstractControl } from '@angular/forms';
4
- import { TokenLocation, TextLayerService, FacetDefinition, FlagDefinition, LayerHint, DataPinInfo, IndexLookupDefinitions, Thesaurus, PartTypeIds, ThesaurusEntry, Part, Fragment, PartIdentity, FragmentIdentity, EditedObject } from '@myrmidon/cadmus-core';
2
+ import { OnInit, ElementRef, OnDestroy, Type } from '@angular/core';
3
+ import { FormGroup, UntypedFormGroup, FormArray, FormControl, FormBuilder, UntypedFormControl, UntypedFormBuilder, ValidatorFn, AbstractControl } from '@angular/forms';
4
+ import { TokenLocation, TextLayerService, FacetDefinition, FlagDefinition, LayerHint, DataPinInfo, IndexLookupDefinitions, Thesaurus, PartTypeIds, Part, Fragment, PartIdentity, FragmentIdentity, EditedObject } from '@myrmidon/cadmus-core';
5
5
  import { DialogService } from '@myrmidon/ngx-mat-tools';
6
6
  import { Observable, BehaviorSubject } from 'rxjs';
7
7
  import { ItemService, FacetService, UserService } from '@myrmidon/cadmus-api';
8
- import { NestedTreeControl } from '@angular/cdk/tree';
9
- import { MatTreeNestedDataSource } from '@angular/material/tree';
8
+ import { PagedTreeStoreService, TreeNodeFilter, PagedTreeNode, PagedTreeStore, PageChangeRequest } from '@myrmidon/paged-data-browsers';
9
+ import { DataPage } from '@myrmidon/ngx-tools';
10
+ import { MatDialogRef } from '@angular/material/dialog';
10
11
  import { AuthJwtService, User } from '@myrmidon/auth-jwt-login';
11
12
  import { AppRepository } from '@myrmidon/cadmus-state';
12
13
  import { RefLookupService, RefLookupFilter } from '@myrmidon/cadmus-refs-lookup';
@@ -39,7 +40,7 @@ declare class DecoratedTokenTextComponent implements OnInit {
39
40
  * A selected token-based location.
40
41
  */
41
42
  readonly selectedLocation: _angular_core.InputSignal<TokenLocation | undefined>;
42
- text?: string;
43
+ readonly text: _angular_core.WritableSignal<string | undefined>;
43
44
  constructor(_textLayerService: TextLayerService);
44
45
  ngOnInit(): void;
45
46
  private decorate;
@@ -110,9 +111,9 @@ declare class FacetBadgeComponent {
110
111
  private _colorService;
111
112
  private _facetColors;
112
113
  private _facetTips;
113
- color: string;
114
- contrastColor: string;
115
- tip?: string;
114
+ readonly color: _angular_core.WritableSignal<string>;
115
+ readonly contrastColor: _angular_core.WritableSignal<string>;
116
+ readonly tip: _angular_core.WritableSignal<string | undefined>;
116
117
  /**
117
118
  * The facet data.
118
119
  */
@@ -137,8 +138,8 @@ interface FlagsBadgeData {
137
138
  * with the flag's color key.
138
139
  */
139
140
  declare class FlagsBadgeComponent {
140
- badgeFlags: FlagDefinition[];
141
141
  readonly data: _angular_core.InputSignal<FlagsBadgeData | undefined>;
142
+ readonly badgeFlags: _angular_core.WritableSignal<FlagDefinition[]>;
142
143
  constructor();
143
144
  private updateBadge;
144
145
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<FlagsBadgeComponent, never>;
@@ -157,7 +158,7 @@ declare class LayerHintsComponent {
157
158
  readonly requestMove: _angular_core.OutputEmitterRef<LayerHint>;
158
159
  readonly requestPatch: _angular_core.OutputEmitterRef<string[]>;
159
160
  form: FormGroup;
160
- checks: FormArray;
161
+ checks: FormArray<FormControl<boolean>>;
161
162
  constructor(_formBuilder: FormBuilder, _dialogService: DialogService);
162
163
  private updateChecks;
163
164
  emitRequestEdit(hint: LayerHint): void;
@@ -211,7 +212,7 @@ declare class LookupPinComponent implements OnInit {
211
212
  form: UntypedFormGroup;
212
213
  lookup: UntypedFormControl;
213
214
  entries$: Observable<DataPinInfo[]> | undefined;
214
- entry: DataPinInfo | undefined;
215
+ readonly entry: _angular_core.WritableSignal<DataPinInfo | undefined>;
215
216
  constructor(formBuilder: UntypedFormBuilder, _itemService: ItemService, _lookupDefs: IndexLookupDefinitions);
216
217
  /**
217
218
  * The lookup key to be used for this component.
@@ -228,6 +229,98 @@ declare class LookupPinComponent implements OnInit {
228
229
  static ɵcmp: _angular_core.ɵɵComponentDeclaration<LookupPinComponent, "cadmus-lookup-pin", never, { "initialValue": { "alias": "initialValue"; "required": false; "isSignal": true; }; "label": { "alias": "label"; "required": false; "isSignal": true; }; "limit": { "alias": "limit"; "required": false; "isSignal": true; }; "resetOnPick": { "alias": "resetOnPick"; "required": false; "isSignal": true; }; "lookupKey": { "alias": "lookupKey"; "required": false; "isSignal": true; }; }, { "entryChange": "entryChange"; }, never, never, true, never>;
229
230
  }
230
231
 
232
+ interface ThesaurusEntry {
233
+ id: string;
234
+ value: string;
235
+ }
236
+ /**
237
+ * The filter for thesaurus entry nodes. The only filtered property is
238
+ * the node's label.
239
+ */
240
+ interface ThesEntryNodeFilter extends TreeNodeFilter {
241
+ label?: string;
242
+ }
243
+ /**
244
+ * The tree node for thesaurus entries in a paging tree node.
245
+ */
246
+ interface ThesEntryPagedTreeNode extends PagedTreeNode<ThesEntryNodeFilter> {
247
+ key: string;
248
+ value: string;
249
+ }
250
+ /**
251
+ * A label rendering function which removes from a label
252
+ * all the characters past the last colon, trimming the result.
253
+ * This is a typical rendering when dealing with hierarchical
254
+ * thesaurus entries, e.g. "furniture: table: color", where
255
+ * we can shorten the label to just "color", as "furniture"
256
+ * and "table" are its ancestors.
257
+ */
258
+ declare const renderLabelFromLastColon: (label: string) => string;
259
+ /**
260
+ * A static paged tree store service for thesaurus entries.
261
+ * This builds the tree nodes from the thesaurus entries, assuming
262
+ * that entry IDs are hierarchical and separated by dots (.).
263
+ */
264
+ declare class StaticThesPagedTreeStoreService implements PagedTreeStoreService<ThesEntryNodeFilter> {
265
+ private _renderLabel?;
266
+ private _nodes;
267
+ private _built;
268
+ private readonly _entries;
269
+ constructor(entries: ThesaurusEntry[], _renderLabel?: ((label: string) => string) | undefined);
270
+ private ensureNodes;
271
+ /**
272
+ * Get the specified page of nodes.
273
+ * @param filter The filter.
274
+ * @param pageNumber The page number.
275
+ * @param pageSize The page size.
276
+ * @param hasMockRoot Whether the root node is a mock node. Not used here.
277
+ */
278
+ getNodes(filter: ThesEntryNodeFilter, pageNumber: number, pageSize: number, hasMockRoot?: boolean): Observable<DataPage<ThesEntryPagedTreeNode>>;
279
+ }
280
+
281
+ declare class ThesPagedTreeBrowserComponent implements OnInit, OnDestroy {
282
+ private _dialog;
283
+ private _sub?;
284
+ /**
285
+ * The service to use to load the nodes.
286
+ */
287
+ readonly service: _angular_core.InputSignal<StaticThesPagedTreeStoreService>;
288
+ /**
289
+ * Emitted when a node is clicked.
290
+ */
291
+ readonly nodePick: _angular_core.OutputEmitterRef<ThesEntryPagedTreeNode>;
292
+ /**
293
+ * The store instance, built from the service.
294
+ */
295
+ readonly store: _angular_core.Signal<PagedTreeStore<ThesEntryPagedTreeNode, ThesEntryNodeFilter>>;
296
+ readonly loading: _angular_core.WritableSignal<boolean>;
297
+ debug: FormControl<boolean>;
298
+ hideLoc: FormControl<boolean>;
299
+ hideFilter: FormControl<boolean>;
300
+ filter$: Observable<Readonly<ThesEntryNodeFilter>>;
301
+ nodes$: Observable<Readonly<ThesEntryPagedTreeNode[]>>;
302
+ label: FormControl<string | null>;
303
+ form: FormGroup<{
304
+ label: FormControl<string | null>;
305
+ }>;
306
+ constructor();
307
+ ngOnInit(): void;
308
+ ngOnDestroy(): void;
309
+ reset(): void;
310
+ onToggleExpanded(node: ThesEntryPagedTreeNode): void;
311
+ onPageChangeRequest(request: PageChangeRequest): void;
312
+ onFilterChange(filter: ThesEntryNodeFilter | null | undefined): void;
313
+ onEditFilterRequest(node: ThesEntryPagedTreeNode): void;
314
+ expandAll(): void;
315
+ collapseAll(): void;
316
+ clear(): void;
317
+ onNodeClick(node: ThesEntryPagedTreeNode): void;
318
+ findLabels(): void;
319
+ removeHilites(): void;
320
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<ThesPagedTreeBrowserComponent, never>;
321
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<ThesPagedTreeBrowserComponent, "cadmus-thes-paged-tree-browser", never, { "service": { "alias": "service"; "required": false; "isSignal": true; }; }, { "nodePick": "nodePick"; }, never, never, true, never>;
322
+ }
323
+
231
324
  declare enum PartBadgeType {
232
325
  partAndRole = 0,
233
326
  partOnly = 1,
@@ -252,10 +345,6 @@ declare function getPartIdName(typeId: string, roleId?: string | null, typeThesa
252
345
  declare class PartBadgeComponent {
253
346
  private _facetService;
254
347
  private _colorService;
255
- typeName: string | undefined;
256
- roleName: string | undefined;
257
- color: string;
258
- contrastColor: string;
259
348
  /**
260
349
  * The badge type: 0=part and role, 1=part only, 2=role only.
261
350
  */
@@ -272,6 +361,10 @@ declare class PartBadgeComponent {
272
361
  * The part type IDs.
273
362
  */
274
363
  readonly partTypeIds: _angular_core.InputSignal<PartTypeIds | undefined>;
364
+ readonly typeName: _angular_core.WritableSignal<string | undefined>;
365
+ readonly roleName: _angular_core.WritableSignal<string | undefined>;
366
+ readonly color: _angular_core.WritableSignal<string>;
367
+ readonly contrastColor: _angular_core.WritableSignal<string>;
275
368
  constructor(_facetService: FacetService, _colorService: ColorService);
276
369
  private getPartColor;
277
370
  /**
@@ -286,23 +379,29 @@ declare class PartBadgeComponent {
286
379
  static ɵcmp: _angular_core.ɵɵComponentDeclaration<PartBadgeComponent, "cadmus-part-badge", never, { "badgeType": { "alias": "badgeType"; "required": false; "isSignal": true; }; "typeThesaurus": { "alias": "typeThesaurus"; "required": false; "isSignal": true; }; "facetDefinition": { "alias": "facetDefinition"; "required": false; "isSignal": true; }; "partTypeIds": { "alias": "partTypeIds"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
287
380
  }
288
381
 
289
- interface TreeNode {
290
- id: string;
291
- label: string;
292
- originalLabel?: string;
293
- parent?: TreeNode;
294
- children?: TreeNode[];
295
- clickable?: boolean;
296
- }
297
382
  /**
298
- * A label rendering function which removes from a label
299
- * all the characters past the last colon, trimming the result.
300
- * This is a typical rendering when dealing with hierarchical
301
- * thesaurus entries, e.g. "furniture: table: color", where
302
- * we can shorten the label to just "color", as "furniture"
303
- * and "table" are its ancestors.
383
+ * A filter to be used for thesaurus paged tree browsers.
304
384
  */
305
- declare const renderLabelFromLastColon: (label: string) => string;
385
+ declare class ThesPagedTreeFilterComponent implements OnInit {
386
+ readonly dialogRef: MatDialogRef<ThesPagedTreeFilterComponent, any> | null;
387
+ readonly data: any;
388
+ /**
389
+ * The filter.
390
+ */
391
+ readonly filter: _angular_core.ModelSignal<ThesEntryNodeFilter | null | undefined>;
392
+ readonly wrapped: _angular_core.WritableSignal<boolean>;
393
+ label: FormControl<string | null>;
394
+ form: FormGroup;
395
+ constructor();
396
+ ngOnInit(): void;
397
+ private updateForm;
398
+ private getFilter;
399
+ reset(): void;
400
+ apply(): void;
401
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<ThesPagedTreeFilterComponent, never>;
402
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<ThesPagedTreeFilterComponent, "cadmus-thes-paged-tree-filter", never, { "filter": { "alias": "filter"; "required": false; "isSignal": true; }; }, { "filter": "filterChange"; }, never, never, true, never>;
403
+ }
404
+
306
405
  /**
307
406
  * Thesaurus tree component.
308
407
  * This component displays a set of hierarchical thesaurus entries
@@ -316,54 +415,30 @@ declare const renderLabelFromLastColon: (label: string) => string;
316
415
  * event is emitted. Note that even if you specify a label renderer
317
416
  * function, the event always emits the original label.
318
417
  */
319
- declare class ThesaurusTreeComponent implements OnInit {
418
+ declare class ThesaurusTreeComponent {
320
419
  /**
321
420
  * The thesaurus entries.
322
421
  */
323
422
  readonly entries: _angular_core.InputSignal<ThesaurusEntry[] | undefined>;
324
- /**
325
- * The label for the root node.
326
- */
327
- readonly rootLabel: _angular_core.InputSignal<string>;
328
423
  /**
329
424
  * The optional node label rendering function.
330
425
  */
331
- readonly renderLabel: _angular_core.InputSignal<((label: string) => string) | undefined>;
426
+ readonly renderLabel: _angular_core.InputSignal<(label: string) => string>;
332
427
  /**
333
428
  * Fired when a thesaurus entry is selected.
334
429
  */
335
430
  readonly entryChange: _angular_core.OutputEmitterRef<ThesaurusEntry>;
336
- root: TreeNode;
337
- treeControl: NestedTreeControl<TreeNode>;
338
- treeDataSource: MatTreeNestedDataSource<TreeNode>;
339
- filter: FormControl<string | null>;
340
- form: FormGroup;
341
- foundNodes: TreeNode[] | undefined;
342
- hasChildren: (index: number, node: TreeNode) => boolean | undefined;
343
- isRoot: (index: number, node: TreeNode) => boolean;
344
- constructor(formBuilder: FormBuilder);
345
- ngOnInit(): void;
346
- private initTree;
347
- private getLabel;
348
- private addNode;
349
- /**
350
- * Build a tree model from a list of name=value pairs,
351
- * where each value can include one or more components separated by
352
- * the specified separator.
353
- * @param entries The entries to add.
354
- * @param separator string The separator string to use for values.
355
- */
356
- buildTreeModel(entries: ThesaurusEntry[], separator?: string): TreeNode;
357
- onTreeNodeClick(node: TreeNode): void;
358
- expandAll(): void;
359
- collapseAll(): void;
360
- private expandFromNode;
361
- private expandMatchingNodes;
362
- find(): void;
363
- resetFilter(): void;
364
- isFoundNode(node: TreeNode): boolean;
431
+ /**
432
+ * The tree store service, dependent on the current entries and renderLabel.
433
+ */
434
+ readonly service: _angular_core.Signal<StaticThesPagedTreeStoreService>;
435
+ /**
436
+ * The filter component class to use.
437
+ */
438
+ readonly filterComponent: Type<ThesPagedTreeFilterComponent>;
439
+ onNodePick(node: ThesEntryPagedTreeNode): void;
365
440
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<ThesaurusTreeComponent, never>;
366
- static ɵcmp: _angular_core.ɵɵComponentDeclaration<ThesaurusTreeComponent, "cadmus-thesaurus-tree", never, { "entries": { "alias": "entries"; "required": false; "isSignal": true; }; "rootLabel": { "alias": "rootLabel"; "required": false; "isSignal": true; }; "renderLabel": { "alias": "renderLabel"; "required": false; "isSignal": true; }; }, { "entryChange": "entryChange"; }, never, never, true, never>;
441
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<ThesaurusTreeComponent, "cadmus-thesaurus-tree", never, { "entries": { "alias": "entries"; "required": false; "isSignal": true; }; "renderLabel": { "alias": "renderLabel"; "required": false; "isSignal": true; }; }, { "entryChange": "entryChange"; }, never, never, true, never>;
367
442
  }
368
443
 
369
444
  /**
@@ -570,5 +645,5 @@ declare const extractTouchedChanges: (control: ObjectLike<AbstractControl, "mark
570
645
  */
571
646
  declare const extractPristineChanges: (control: ObjectLike<AbstractControl, "markAsPristine" | "markAsDirty">) => Observable<boolean>;
572
647
 
573
- export { CloseSaveButtonsComponent, ColorService, CustomValidators, DecoratedTokenTextComponent, ErrorListComponent, FacetBadgeComponent, FlagsBadgeComponent, JsonValidators, LayerHintsComponent, LookupPinComponent, ModelEditorComponentBase, PartBadgeComponent, PartBadgeType, ThesaurusTreeComponent, UserRefLookupService, extractPristineChanges, extractTouchedChanges, getPartIdName, renderLabelFromLastColon };
574
- export type { ArgumentsType, FacetBadgeData, FlagsBadgeData, UserWithRoles };
648
+ export { CloseSaveButtonsComponent, ColorService, CustomValidators, DecoratedTokenTextComponent, ErrorListComponent, FacetBadgeComponent, FlagsBadgeComponent, JsonValidators, LayerHintsComponent, LookupPinComponent, ModelEditorComponentBase, PartBadgeComponent, PartBadgeType, StaticThesPagedTreeStoreService, ThesPagedTreeBrowserComponent, ThesaurusTreeComponent, UserRefLookupService, extractPristineChanges, extractTouchedChanges, getPartIdName, renderLabelFromLastColon };
649
+ export type { ArgumentsType, FacetBadgeData, FlagsBadgeData, ThesEntryNodeFilter, ThesEntryPagedTreeNode, ThesaurusEntry, UserWithRoles };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@myrmidon/cadmus-ui",
3
- "version": "14.0.0",
3
+ "version": "15.1.0",
4
4
  "description": "Cadmus - general UI components.",
5
5
  "keywords": [
6
6
  "Cadmus"
@@ -16,9 +16,10 @@
16
16
  "peerDependencies": {
17
17
  "@angular/common": "^20.0.0",
18
18
  "@angular/core": "^20.0.0",
19
+ "@angular/material": "^20.0.0",
19
20
  "@myrmidon/ngx-tools": "^2.0.0",
20
- "@myrmidon/cadmus-refs-lookup": "^9.0.1",
21
- "@myrmidon/cadmus-core": "^12.0.1"
21
+ "@myrmidon/cadmus-refs-lookup": "^10.0.3",
22
+ "@myrmidon/cadmus-core": "^12.0.2"
22
23
  },
23
24
  "dependencies": {
24
25
  "tslib": "^2.3.0"