@myrmidon/cadmus-ui 12.0.1 → 13.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/index.d.ts CHANGED
@@ -1,5 +1,600 @@
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, ThesauriSet, TextLayerPart } from '@myrmidon/cadmus-core';
5
+ import { DialogService } from '@myrmidon/ngx-mat-tools';
6
+ import { Observable, BehaviorSubject } from 'rxjs';
7
+ import { ItemService, FacetService, UserService } from '@myrmidon/cadmus-api';
8
+ import { NestedTreeControl } from '@angular/cdk/tree';
9
+ import { MatTreeNestedDataSource } from '@angular/material/tree';
10
+ import { AuthJwtService, User } from '@myrmidon/auth-jwt-login';
11
+ import { AppRepository } from '@myrmidon/cadmus-state';
12
+ import { RefLookupService, RefLookupFilter } from '@myrmidon/cadmus-refs-lookup';
13
+
14
+ declare class CloseSaveButtonsComponent {
15
+ readonly form: _angular_core.InputSignal<FormGroup<any> | UntypedFormGroup | undefined>;
16
+ readonly noSave: _angular_core.InputSignal<boolean | undefined>;
17
+ readonly closeRequest: _angular_core.OutputEmitterRef<void>;
18
+ close(): void;
19
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<CloseSaveButtonsComponent, never>;
20
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<CloseSaveButtonsComponent, "cadmus-close-save-buttons", never, { "form": { "alias": "form"; "required": false; "isSignal": true; }; "noSave": { "alias": "noSave"; "required": false; "isSignal": true; }; }, { "closeRequest": "closeRequest"; }, never, never, true, never>;
21
+ }
22
+
1
23
  /**
2
- * Generated bundle index. Do not edit.
24
+ * Decorated token-based text visualizer. This is used when editing
25
+ * token-based text layers.
3
26
  */
4
- /// <amd-module name="@myrmidon/cadmus-ui" />
5
- export * from './public-api';
27
+ declare class DecoratedTokenTextComponent implements OnInit {
28
+ private _textLayerService;
29
+ _textElement?: ElementRef;
30
+ /**
31
+ * The base text.
32
+ */
33
+ readonly baseText: _angular_core.InputSignal<string>;
34
+ /**
35
+ * The token-based locations of all the fragments in the layer.
36
+ */
37
+ readonly locations: _angular_core.InputSignal<TokenLocation[]>;
38
+ /**
39
+ * A selected token-based location.
40
+ */
41
+ readonly selectedLocation: _angular_core.InputSignal<TokenLocation | undefined>;
42
+ text?: string;
43
+ constructor(_textLayerService: TextLayerService);
44
+ ngOnInit(): void;
45
+ private decorate;
46
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<DecoratedTokenTextComponent, never>;
47
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<DecoratedTokenTextComponent, "cadmus-decorated-token-text", never, { "baseText": { "alias": "baseText"; "required": false; "isSignal": true; }; "locations": { "alias": "locations"; "required": false; "isSignal": true; }; "selectedLocation": { "alias": "selectedLocation"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
48
+ }
49
+
50
+ declare class ErrorListComponent {
51
+ readonly errors: _angular_core.InputSignal<string[] | undefined>;
52
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<ErrorListComponent, never>;
53
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<ErrorListComponent, "cadmus-error-list", never, { "errors": { "alias": "errors"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
54
+ }
55
+
56
+ /**
57
+ * Colors helper service.
58
+ */
59
+ declare class ColorService {
60
+ /**
61
+ * Get the R,G,B components of the color expressed by the specified
62
+ * RGB string (3 or 6 digits format).
63
+ *
64
+ * @param rgb The RGB color string (3 or 6 digits).
65
+ * @returns An array where [0]=R, [1]=G, [2]=B, or null if invalid
66
+ * input string.
67
+ */
68
+ getRgb(rgb: string): number[] | null;
69
+ /**
70
+ * Get black or white according to which of them has the maximum contrast
71
+ * against the specified color.
72
+ *
73
+ * @param rgb The RGB color string.
74
+ * @returns Black or white. If rgb is invalid, always black.
75
+ */
76
+ getContrastColor(rgb: string): string;
77
+ /**
78
+ * Convert HSL to RGB.
79
+ *
80
+ * @param h Hue
81
+ * @param s Saturation
82
+ * @param l Lightness
83
+ * @returns Object with r, g, b values.
84
+ */
85
+ hslToRgb(h: number, s: number, l: number): {
86
+ r: number;
87
+ g: number;
88
+ b: number;
89
+ };
90
+ rgbToString(r: number, g: number, b: number): string;
91
+ /**
92
+ * Get the next color from a palette generated to include
93
+ * the specified count of colors.
94
+ *
95
+ * @param index The index of the next color in the palette.
96
+ * @param count The total count of colors in the palette.
97
+ * @param blueBoost True to adjust colors for the eye's lack of sensitivity to blue.
98
+ * @returns The RRGGBB values string.
99
+ */
100
+ nextPaletteColor(index: number, count: number, blueBoost?: boolean): string;
101
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<ColorService, never>;
102
+ static ɵprov: _angular_core.ɵɵInjectableDeclaration<ColorService>;
103
+ }
104
+
105
+ interface FacetBadgeData {
106
+ definitions: FacetDefinition[];
107
+ facetId?: string;
108
+ }
109
+ declare class FacetBadgeComponent {
110
+ private _colorService;
111
+ private _facetColors;
112
+ private _facetTips;
113
+ color: string;
114
+ contrastColor: string;
115
+ tip?: string;
116
+ /**
117
+ * The facet data.
118
+ */
119
+ readonly data: _angular_core.InputSignal<FacetBadgeData>;
120
+ constructor(_colorService: ColorService);
121
+ private getFacetColor;
122
+ private getFacetTip;
123
+ private updateBadge;
124
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<FacetBadgeComponent, never>;
125
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<FacetBadgeComponent, "cadmus-facet-badge", never, { "data": { "alias": "data"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
126
+ }
127
+
128
+ /**
129
+ * Data for FlagsBadgeComponent, including flags and their definitions.
130
+ */
131
+ interface FlagsBadgeData {
132
+ definitions: FlagDefinition[];
133
+ flags: number;
134
+ }
135
+ /**
136
+ * Badge with item's flags. Each flag is represented by a circle filled
137
+ * with the flag's color key.
138
+ */
139
+ declare class FlagsBadgeComponent {
140
+ badgeFlags: FlagDefinition[];
141
+ readonly data: _angular_core.InputSignal<FlagsBadgeData | undefined>;
142
+ constructor();
143
+ private updateBadge;
144
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<FlagsBadgeComponent, never>;
145
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<FlagsBadgeComponent, "cadmus-flags-badge", never, { "data": { "alias": "data"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
146
+ }
147
+
148
+ declare class LayerHintsComponent {
149
+ private _formBuilder;
150
+ private _dialogService;
151
+ readonly hints: _angular_core.InputSignal<LayerHint[]>;
152
+ readonly targetLocation: _angular_core.InputSignal<string | undefined>;
153
+ readonly disabled: _angular_core.InputSignal<boolean | undefined>;
154
+ readonly readonly: _angular_core.InputSignal<boolean | undefined>;
155
+ readonly requestEdit: _angular_core.OutputEmitterRef<LayerHint>;
156
+ readonly requestDelete: _angular_core.OutputEmitterRef<LayerHint>;
157
+ readonly requestMove: _angular_core.OutputEmitterRef<LayerHint>;
158
+ readonly requestPatch: _angular_core.OutputEmitterRef<string[]>;
159
+ form: FormGroup;
160
+ checks: FormArray;
161
+ constructor(_formBuilder: FormBuilder, _dialogService: DialogService);
162
+ private updateChecks;
163
+ emitRequestEdit(hint: LayerHint): void;
164
+ emitRequestDelete(hint: LayerHint): void;
165
+ emitRequestMove(hint: LayerHint): void;
166
+ emitRequestPatch(): void;
167
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<LayerHintsComponent, never>;
168
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<LayerHintsComponent, "cadmus-layer-hints", never, { "hints": { "alias": "hints"; "required": false; "isSignal": true; }; "targetLocation": { "alias": "targetLocation"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "readonly": { "alias": "readonly"; "required": false; "isSignal": true; }; }, { "requestEdit": "requestEdit"; "requestDelete": "requestDelete"; "requestMove": "requestMove"; "requestPatch": "requestPatch"; }, never, never, true, never>;
169
+ }
170
+
171
+ /**
172
+ * Generic data pin lookup component. This allows users typing a part
173
+ * of a pin's value, and get the full pin. For instance, if you have
174
+ * a lookup set of colors and type "gr", you might get the pins
175
+ * corresponding to "green" (e.g. id=color, value=green), "gray", etc.
176
+ * Usage: add a FormControl to hold a DataPinInfo value; in the HTML
177
+ * template set the component's lookupKey, label, initialValue, and
178
+ * entryChange handler. The initialValue, if any, should be the initial
179
+ * DataPinInfo value.
180
+ * If you are using this component as a pure lookup device, don't set
181
+ * the initialValue and set resetOnPick=true.
182
+ */
183
+ declare class LookupPinComponent implements OnInit {
184
+ private _itemService;
185
+ private _lookupDefs;
186
+ /**
187
+ * The entry value initially set when the component loads.
188
+ */
189
+ readonly initialValue: _angular_core.InputSignal<string | undefined>;
190
+ /**
191
+ * The label to be displayed for this lookup.
192
+ */
193
+ readonly label: _angular_core.InputSignal<string>;
194
+ /**
195
+ * The maximum count of lookup entries to retrieve.
196
+ * Default is 10.
197
+ */
198
+ readonly limit: _angular_core.InputSignal<number>;
199
+ /**
200
+ * True to reset the lookup value after it is picked.
201
+ * This is typically used when you use this component
202
+ * as a pure lookup device, storing the picked value
203
+ * elsewhere when handling its entryChange event.
204
+ */
205
+ readonly resetOnPick: _angular_core.InputSignal<boolean | undefined>;
206
+ /**
207
+ * Fired whenever an entry is picked. Usually you should
208
+ * cast the received argument to a more specific type.
209
+ */
210
+ readonly entryChange: _angular_core.OutputEmitterRef<DataPinInfo | null>;
211
+ form: UntypedFormGroup;
212
+ lookup: UntypedFormControl;
213
+ entries$: Observable<DataPinInfo[]> | undefined;
214
+ entry: DataPinInfo | undefined;
215
+ constructor(formBuilder: UntypedFormBuilder, _itemService: ItemService, _lookupDefs: IndexLookupDefinitions);
216
+ /**
217
+ * The lookup key to be used for this component.
218
+ * This should be a key from the injectable indexLookupDefinitions.
219
+ */
220
+ readonly lookupKey: _angular_core.InputSignal<string | undefined>;
221
+ ngOnInit(): void;
222
+ private lookupEntries;
223
+ private resetToInitial;
224
+ clear(): void;
225
+ entryToName(entry: DataPinInfo): string;
226
+ pickEntry(entry: DataPinInfo): void;
227
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<LookupPinComponent, never>;
228
+ 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
+
231
+ declare enum PartBadgeType {
232
+ partAndRole = 0,
233
+ partOnly = 1,
234
+ roleOnly = 2
235
+ }
236
+ /**
237
+ * Function used to get the part's human-friendly name from its ID and role ID.
238
+ * This assumes that thesaurus entries with role ID specified have form
239
+ * partId:roleId.
240
+ * @param typeId The part type ID.
241
+ * @param roleId The optional role ID.
242
+ * @param typeThesaurus The types thesaurus.
243
+ * @param noFallback If true, and no thesaurus is provided, return undefined
244
+ * rather than the type and role IDs.
245
+ * @returns The name.
246
+ */
247
+ declare function getPartIdName(typeId: string, roleId?: string | null, typeThesaurus?: Thesaurus, noFallback?: boolean): string | undefined;
248
+ /**
249
+ * Part badge component. This component displays a badge with the
250
+ * part's type name and role name, if any, and a background color.
251
+ */
252
+ declare class PartBadgeComponent {
253
+ private _facetService;
254
+ private _colorService;
255
+ typeName: string | undefined;
256
+ roleName: string | undefined;
257
+ color: string;
258
+ contrastColor: string;
259
+ /**
260
+ * The badge type: 0=part and role, 1=part only, 2=role only.
261
+ */
262
+ readonly badgeType: _angular_core.InputSignal<PartBadgeType>;
263
+ /**
264
+ * The types thesaurus.
265
+ */
266
+ readonly typeThesaurus: _angular_core.InputSignal<Thesaurus | undefined>;
267
+ /**
268
+ * The part's facet definition.
269
+ */
270
+ readonly facetDefinition: _angular_core.InputSignal<FacetDefinition | undefined>;
271
+ /**
272
+ * The part type IDs.
273
+ */
274
+ readonly partTypeIds: _angular_core.InputSignal<PartTypeIds | undefined>;
275
+ constructor(_facetService: FacetService, _colorService: ColorService);
276
+ private getPartColor;
277
+ /**
278
+ * Get the role's human-friendly name from its ID.
279
+ * @param roleId The role ID.
280
+ * @param typeThesaurus The types thesaurus.
281
+ * @returns The name.?
282
+ */
283
+ private getRoleIdName;
284
+ private updateBadge;
285
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<PartBadgeComponent, never>;
286
+ 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
+ }
288
+
289
+ interface TreeNode {
290
+ id: string;
291
+ label: string;
292
+ originalLabel?: string;
293
+ parent?: TreeNode;
294
+ children?: TreeNode[];
295
+ clickable?: boolean;
296
+ }
297
+ /**
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.
304
+ */
305
+ declare const renderLabelFromLastColon: (label: string) => string;
306
+ /**
307
+ * Thesaurus tree component.
308
+ * This component displays a set of hierarchical thesaurus entries
309
+ * in a tree, provided that each entry marks its hierarchy with
310
+ * dots. For instance, say you have the hierarchy "furniture" -
311
+ * "type" - "color". You might have an entry whose ID is
312
+ * "furniture.table.red", with a sibling "furniture.table.green",
313
+ * and a parent "furniture.table". This parent is there only to
314
+ * provide a label to the parent node, but only leaf nodes can be
315
+ * picked by the user. Whenever one is picked, the entryChange
316
+ * event is emitted. Note that even if you specify a label renderer
317
+ * function, the event always emits the original label.
318
+ */
319
+ declare class ThesaurusTreeComponent implements OnInit {
320
+ /**
321
+ * The thesaurus entries.
322
+ */
323
+ readonly entries: _angular_core.InputSignal<ThesaurusEntry[] | undefined>;
324
+ /**
325
+ * The label for the root node.
326
+ */
327
+ readonly rootLabel: _angular_core.InputSignal<string>;
328
+ /**
329
+ * The optional node label rendering function.
330
+ */
331
+ readonly renderLabel: _angular_core.InputSignal<((label: string) => string) | undefined>;
332
+ /**
333
+ * Fired when a thesaurus entry is selected.
334
+ */
335
+ 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;
365
+ 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>;
367
+ }
368
+
369
+ /**
370
+ * The identifiers for an edited part.
371
+ */
372
+ interface PartIdentity {
373
+ itemId: string;
374
+ typeId: string;
375
+ partId: string | null;
376
+ roleId: string | null;
377
+ }
378
+ /**
379
+ * The identifiers for an edited fragment.
380
+ */
381
+ interface FragmentIdentity extends PartIdentity {
382
+ frTypeId: string;
383
+ frRoleId: string | null;
384
+ loc: string;
385
+ }
386
+ /**
387
+ * An edited part or fragment.
388
+ */
389
+ interface EditedObject<T extends Part | Fragment> {
390
+ value: T | null;
391
+ thesauri: ThesauriSet;
392
+ layerPart?: TextLayerPart;
393
+ baseText?: string;
394
+ }
395
+ /**
396
+ * Base class for part/fragment editors dumb components.
397
+ * The model type is the templated argument T.
398
+ *
399
+ * When deriving from this editor, be sure to call super.ngOnInit()
400
+ * from the derived editor's ngOnInit handler.
401
+ */
402
+ declare abstract class ModelEditorComponentBase<T extends Part | Fragment> implements OnInit, OnDestroy {
403
+ protected authService: AuthJwtService;
404
+ protected formBuilder: FormBuilder;
405
+ private readonly _mebSubs;
406
+ protected readonly _appRepository?: AppRepository;
407
+ /**
408
+ * The root form of the editor.
409
+ */
410
+ form: FormGroup | UntypedFormGroup;
411
+ /**
412
+ * The current user.
413
+ */
414
+ user?: User;
415
+ /**
416
+ * The user authorization level (0-4).
417
+ */
418
+ userLevel: number;
419
+ /**
420
+ * An observable with the current dirty state of the editor.
421
+ */
422
+ isDirty$: BehaviorSubject<boolean>;
423
+ /**
424
+ * The identity of the edited model.
425
+ */
426
+ readonly identity: _angular_core.InputSignal<PartIdentity | FragmentIdentity | undefined>;
427
+ /**
428
+ * The data being edited.
429
+ */
430
+ readonly data: _angular_core.ModelSignal<EditedObject<T> | undefined>;
431
+ /**
432
+ * True to disable the editor.
433
+ */
434
+ readonly disabled: _angular_core.InputSignal<boolean | undefined>;
435
+ /**
436
+ * Event emitted when the dirty state has changed.
437
+ * This event just reflects changes in isDirty$, and is a facility
438
+ * for propagating it to the parent's component.
439
+ */
440
+ readonly dirtyChange: _angular_core.OutputEmitterRef<boolean>;
441
+ /**
442
+ * Emitted when the user requests to close the editor.
443
+ */
444
+ readonly editorClose: _angular_core.OutputEmitterRef<void>;
445
+ /**
446
+ * The human-friendly model name. This is computed from the model's
447
+ * type ID and role ID, if any, using the types thesaurus set provided
448
+ * by the app repository.
449
+ */
450
+ readonly modelName: _angular_core.Signal<string | undefined>;
451
+ /**
452
+ * Create a new instance of the editor.
453
+ *
454
+ * @param authService The authentication service.
455
+ * @param formBuilder Form builder.
456
+ */
457
+ constructor(authService: AuthJwtService, formBuilder: FormBuilder);
458
+ private disableForm;
459
+ private onIdentitySet;
460
+ ngOnInit(): void;
461
+ ngOnDestroy(): void;
462
+ /**
463
+ * Implement in the derived class to build the root form of this editor.
464
+ * The form built will then be attached to the dirty check mechanism
465
+ * provided by this base class.
466
+ *
467
+ * @param formBuilder The form builder.
468
+ */
469
+ protected abstract buildForm(formBuilder: FormBuilder): FormGroup | UntypedFormGroup;
470
+ /**
471
+ * Get the authorization level of the current user if any.
472
+ * @returns 4-1 for admin, editor, operator, visitor; else 0.
473
+ */
474
+ private getCurrentUserLevel;
475
+ private updateUserProperties;
476
+ /**
477
+ * Update the data value property and emit the corresponding
478
+ * modelChange event.
479
+ *
480
+ * @param value The value.
481
+ */
482
+ protected updateValue(value: T): void;
483
+ /**
484
+ * Invoked whenever the model property is set (=data comes from input model
485
+ * property), unless setting it via updateModel. Implement to update the form
486
+ * controls to reflect the new model data.
487
+ *
488
+ * @param data The data set, or undefined.
489
+ */
490
+ protected abstract onDataSet(data?: EditedObject<T>): void;
491
+ /**
492
+ * Get a new object from the edited part if any, else as a new part.
493
+ *
494
+ * @param typeId The part's type ID. This is a constant received
495
+ * from the implementor.
496
+ * @returns Part object.
497
+ */
498
+ protected getEditedPart(typeId: string): Part;
499
+ /**
500
+ * Get a new object from the edited fragment if any, else a new fragment.
501
+ *
502
+ * @returns Fragment object.
503
+ */
504
+ protected getEditedFragment(): Fragment;
505
+ /**
506
+ * Implement in derived classes to get the data from form's controls.
507
+ * This is used when saving.
508
+ */
509
+ protected abstract getValue(): T;
510
+ /**
511
+ * True if this editor has the thesaurus having the specified key in the
512
+ * loaded thesauri set.
513
+ */
514
+ protected hasThesaurus(key: string): boolean;
515
+ /**
516
+ * Emit a request to close the editor.
517
+ */
518
+ close(): void;
519
+ /**
520
+ * Save the edited data if valid.
521
+ */
522
+ save(): void;
523
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<ModelEditorComponentBase<any>, never>;
524
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<ModelEditorComponentBase<any>, "ng-component", never, { "identity": { "alias": "identity"; "required": false; "isSignal": true; }; "data": { "alias": "data"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; }, { "data": "dataChange"; "dirtyChange": "dirtyChange"; "editorClose": "editorClose"; }, never, never, false, never>;
525
+ }
526
+
527
+ /**
528
+ * General-purpose custom validators.
529
+ */
530
+ declare class CustomValidators {
531
+ /**
532
+ * Validates a FormGroup or FormArray control checking if the count of their
533
+ * controls with a true value is equal to or greater than the specified
534
+ * number.
535
+ *
536
+ * @param min The minimum number of checked controls.
537
+ */
538
+ static minChecked(min?: number): ValidatorFn;
539
+ }
540
+
541
+ /**
542
+ * Simple JSON validator.
543
+ */
544
+ declare class JsonValidators {
545
+ static json(control: AbstractControl): {
546
+ [key: string]: boolean;
547
+ } | null;
548
+ }
549
+
550
+ interface UserWithRoles {
551
+ user: {
552
+ id: string;
553
+ firstName: string;
554
+ lastName: string;
555
+ userName: string;
556
+ email: string;
557
+ };
558
+ roles: string[];
559
+ }
560
+ /**
561
+ * Service for users lookup.
562
+ */
563
+ declare class UserRefLookupService implements RefLookupService {
564
+ private _userService;
565
+ constructor(_userService: UserService);
566
+ lookup(filter: RefLookupFilter, options?: any): Observable<UserWithRoles[]>;
567
+ getName(item: UserWithRoles): string;
568
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<UserRefLookupService, never>;
569
+ static ɵprov: _angular_core.ɵɵInjectableDeclaration<UserRefLookupService>;
570
+ }
571
+
572
+ /**
573
+ * Extract arguments of function
574
+ */
575
+ type ArgumentsType<F> = F extends (...args: infer A) => any ? A : never;
576
+ /**
577
+ * Creates an object like O. Optionally provide minimum set of properties P
578
+ * which the objects must share to conform.
579
+ */
580
+ type ObjectLike<O extends object, P extends keyof O = keyof O> = Pick<O, P>;
581
+ /**
582
+ * Extract a touched changed observable from an abstract control.
583
+ * Use in component code like:
584
+ * this.touchedChanges$ = extractTouchedChanges(this.form);
585
+ *
586
+ * @param control AbstractControl-like object with markAsTouched method.
587
+ */
588
+ declare const extractTouchedChanges: (control: ObjectLike<AbstractControl, "markAsTouched" | "markAsUntouched">) => Observable<boolean>;
589
+ /**
590
+ * Extract a pristine changed observable from an abstract control.
591
+ * Use in component code like:
592
+ * this.pristineChanges$ = extractPristineChanges(this.form);
593
+ *
594
+ * @param control AbstractControl-like object with markAsPristine and markAsDirty
595
+ * methods.
596
+ */
597
+ declare const extractPristineChanges: (control: ObjectLike<AbstractControl, "markAsPristine" | "markAsDirty">) => Observable<boolean>;
598
+
599
+ export { CloseSaveButtonsComponent, ColorService, CustomValidators, DecoratedTokenTextComponent, ErrorListComponent, FacetBadgeComponent, FlagsBadgeComponent, JsonValidators, LayerHintsComponent, LookupPinComponent, ModelEditorComponentBase, PartBadgeComponent, PartBadgeType, ThesaurusTreeComponent, UserRefLookupService, extractPristineChanges, extractTouchedChanges, getPartIdName, renderLabelFromLastColon };
600
+ export type { ArgumentsType, EditedObject, FacetBadgeData, FlagsBadgeData, FragmentIdentity, PartIdentity, UserWithRoles };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@myrmidon/cadmus-ui",
3
- "version": "12.0.1",
3
+ "version": "13.0.0",
4
4
  "description": "Cadmus - general UI components.",
5
5
  "keywords": [
6
6
  "Cadmus"
@@ -14,11 +14,11 @@
14
14
  "name": "Daniele Fusi"
15
15
  },
16
16
  "peerDependencies": {
17
- "@angular/common": "^19.0.0",
18
- "@angular/core": "^19.0.0",
19
- "@myrmidon/ngx-tools": "^1.0.2",
20
- "@myrmidon/cadmus-refs-lookup": "^8.0.1",
21
- "@myrmidon/cadmus-core": "^11.0.0"
17
+ "@angular/common": "^20.0.0",
18
+ "@angular/core": "^20.0.0",
19
+ "@myrmidon/ngx-tools": "^2.0.0",
20
+ "@myrmidon/cadmus-refs-lookup": "^9.0.0",
21
+ "@myrmidon/cadmus-core": "^12.0.0"
22
22
  },
23
23
  "dependencies": {
24
24
  "tslib": "^2.3.0"
@@ -1,10 +0,0 @@
1
- import { FormGroup, UntypedFormGroup } from '@angular/forms';
2
- import * as i0 from "@angular/core";
3
- export declare class CloseSaveButtonsComponent {
4
- readonly form: import("@angular/core").InputSignal<FormGroup<any> | UntypedFormGroup | undefined>;
5
- readonly noSave: import("@angular/core").InputSignal<boolean | undefined>;
6
- readonly closeRequest: import("@angular/core").OutputEmitterRef<void>;
7
- close(): void;
8
- static ɵfac: i0.ɵɵFactoryDeclaration<CloseSaveButtonsComponent, never>;
9
- static ɵcmp: i0.ɵɵComponentDeclaration<CloseSaveButtonsComponent, "cadmus-close-save-buttons", never, { "form": { "alias": "form"; "required": false; "isSignal": true; }; "noSave": { "alias": "noSave"; "required": false; "isSignal": true; }; }, { "closeRequest": "closeRequest"; }, never, never, true, never>;
10
- }
@@ -1,29 +0,0 @@
1
- import { OnInit, ElementRef } from '@angular/core';
2
- import { TokenLocation, TextLayerService } from '@myrmidon/cadmus-core';
3
- import * as i0 from "@angular/core";
4
- /**
5
- * Decorated token-based text visualizer. This is used when editing
6
- * token-based text layers.
7
- */
8
- export declare class DecoratedTokenTextComponent implements OnInit {
9
- private _textLayerService;
10
- _textElement?: ElementRef;
11
- /**
12
- * The base text.
13
- */
14
- readonly baseText: import("@angular/core").InputSignal<string>;
15
- /**
16
- * The token-based locations of all the fragments in the layer.
17
- */
18
- readonly locations: import("@angular/core").InputSignal<TokenLocation[]>;
19
- /**
20
- * A selected token-based location.
21
- */
22
- readonly selectedLocation: import("@angular/core").InputSignal<TokenLocation | undefined>;
23
- text?: string;
24
- constructor(_textLayerService: TextLayerService);
25
- ngOnInit(): void;
26
- private decorate;
27
- static ɵfac: i0.ɵɵFactoryDeclaration<DecoratedTokenTextComponent, never>;
28
- static ɵcmp: i0.ɵɵComponentDeclaration<DecoratedTokenTextComponent, "cadmus-decorated-token-text", never, { "baseText": { "alias": "baseText"; "required": false; "isSignal": true; }; "locations": { "alias": "locations"; "required": false; "isSignal": true; }; "selectedLocation": { "alias": "selectedLocation"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
29
- }
@@ -1,6 +0,0 @@
1
- import * as i0 from "@angular/core";
2
- export declare class ErrorListComponent {
3
- readonly errors: import("@angular/core").InputSignal<string[] | undefined>;
4
- static ɵfac: i0.ɵɵFactoryDeclaration<ErrorListComponent, never>;
5
- static ɵcmp: i0.ɵɵComponentDeclaration<ErrorListComponent, "cadmus-error-list", never, { "errors": { "alias": "errors"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
6
- }