@myrmidon/cadmus-state 12.0.0 → 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/fesm2022/myrmidon-cadmus-state.mjs +21 -21
- package/fesm2022/myrmidon-cadmus-state.mjs.map +1 -1
- package/index.d.ts +394 -3
- package/package.json +6 -6
- package/lib/app.repository.d.ts +0 -76
- package/lib/edit-fragment-feature-base.d.ts +0 -76
- package/lib/edit-part-feature-base.d.ts +0 -91
- package/lib/edited-layer.repository.d.ts +0 -64
- package/lib/edited-thesaurus.repository.d.ts +0 -30
- package/lib/fragment-editor.service.d.ts +0 -40
- package/lib/part-editor.service.d.ts +0 -39
- package/public-api.d.ts +0 -7
package/index.d.ts
CHANGED
|
@@ -1,5 +1,396 @@
|
|
|
1
|
+
import { FacetDefinition, FlagDefinition, Thesaurus, Fragment, Part, ComponentCanDeactivate, TokenLocation, LibraryRouteService, TextLayerPart, LayerHint } from '@myrmidon/cadmus-core';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
import { FacetService, FlagService, ThesaurusService, PreviewService, EditorSettingsService, ItemService } from '@myrmidon/cadmus-api';
|
|
4
|
+
import * as i0 from '@angular/core';
|
|
5
|
+
import { OnInit, OnDestroy } from '@angular/core';
|
|
6
|
+
import { Router, ActivatedRoute } from '@angular/router';
|
|
7
|
+
import { MatSnackBar } from '@angular/material/snack-bar';
|
|
8
|
+
import { FragmentIdentity, EditedObject, PartIdentity } from '@myrmidon/cadmus-ui';
|
|
9
|
+
|
|
1
10
|
/**
|
|
2
|
-
*
|
|
11
|
+
* App state repository.
|
|
3
12
|
*/
|
|
4
|
-
|
|
5
|
-
|
|
13
|
+
declare class AppRepository {
|
|
14
|
+
private _facetService;
|
|
15
|
+
private _flagService;
|
|
16
|
+
private _thesaurusService;
|
|
17
|
+
private _previewService;
|
|
18
|
+
private _settingService;
|
|
19
|
+
private readonly _facets$;
|
|
20
|
+
private readonly _flags$;
|
|
21
|
+
private readonly _typeThesaurus$;
|
|
22
|
+
private readonly _itemBrowserThesaurus$;
|
|
23
|
+
private readonly _previewJKeys$;
|
|
24
|
+
private readonly _previewFKeys$;
|
|
25
|
+
private readonly _previewCKeys$;
|
|
26
|
+
private readonly _settingsCache;
|
|
27
|
+
get facets$(): Observable<FacetDefinition[]>;
|
|
28
|
+
get flags$(): Observable<FlagDefinition[]>;
|
|
29
|
+
get typeThesaurus$(): Observable<Thesaurus | undefined>;
|
|
30
|
+
get itemBrowserThesaurus$(): Observable<Thesaurus | undefined>;
|
|
31
|
+
get previewJKeys$(): Observable<string[]>;
|
|
32
|
+
get previewFKeys$(): Observable<string[]>;
|
|
33
|
+
get previewCKeys$(): Observable<string[]>;
|
|
34
|
+
constructor(_facetService: FacetService, _flagService: FlagService, _thesaurusService: ThesaurusService, _previewService: PreviewService, _settingService: EditorSettingsService);
|
|
35
|
+
getTypeThesaurus(): Thesaurus | undefined;
|
|
36
|
+
getFacets(): FacetDefinition[];
|
|
37
|
+
getFlags(): FlagDefinition[];
|
|
38
|
+
/**
|
|
39
|
+
* Load app data from the API. If the data is already loaded, this
|
|
40
|
+
* does nothing unless refresh is true.
|
|
41
|
+
*
|
|
42
|
+
* @param refresh True to force a refresh.
|
|
43
|
+
* @returns Promise.
|
|
44
|
+
*/
|
|
45
|
+
load(refresh?: boolean): Promise<void>;
|
|
46
|
+
/**
|
|
47
|
+
* Clear the repository.
|
|
48
|
+
*/
|
|
49
|
+
clear(): void;
|
|
50
|
+
/**
|
|
51
|
+
* Load the model types and item browsers thesauri.
|
|
52
|
+
*/
|
|
53
|
+
loadThesauri(): Promise<void>;
|
|
54
|
+
/**
|
|
55
|
+
* Get the color defined for the specified part type ID, reading it
|
|
56
|
+
* from the facets definitions.
|
|
57
|
+
* @param typeId The part type ID.
|
|
58
|
+
* @param roleId The optional role type ID.
|
|
59
|
+
* @returns The color key, or undefined if not found.
|
|
60
|
+
*/
|
|
61
|
+
getPartColor(typeId: string, roleId?: string): string | undefined;
|
|
62
|
+
/**
|
|
63
|
+
* Load the flags definitions.
|
|
64
|
+
*/
|
|
65
|
+
loadFlags(): Promise<void>;
|
|
66
|
+
/**
|
|
67
|
+
* Get the editor setting with the specified ID.
|
|
68
|
+
* @returns Promise with the settings object.
|
|
69
|
+
*/
|
|
70
|
+
getSetting(id: string): Promise<any>;
|
|
71
|
+
/**
|
|
72
|
+
* Get the editor setting for the specified part or fragment type ID,
|
|
73
|
+
* optionally having the specified role ID.
|
|
74
|
+
* @param typeId The part or fragment type ID.
|
|
75
|
+
* @param roleId The optional role ID.
|
|
76
|
+
* @returns Promise with settings object.
|
|
77
|
+
*/
|
|
78
|
+
getSettingFor(typeId: string, roleId?: string): Promise<any>;
|
|
79
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<AppRepository, never>;
|
|
80
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<AppRepository>;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Service used by layer part editor wrappers to load part and thesauri
|
|
85
|
+
* or save parts.
|
|
86
|
+
*/
|
|
87
|
+
declare class FragmentEditorService {
|
|
88
|
+
private _itemService;
|
|
89
|
+
private _thesaurusService;
|
|
90
|
+
private _loading$;
|
|
91
|
+
private _saving$;
|
|
92
|
+
loading$: Observable<boolean>;
|
|
93
|
+
saving$: Observable<boolean>;
|
|
94
|
+
constructor(_itemService: ItemService, _thesaurusService: ThesaurusService);
|
|
95
|
+
private getFragmentFromPart;
|
|
96
|
+
private loadWithThesauri;
|
|
97
|
+
private loadWithoutThesauri;
|
|
98
|
+
/**
|
|
99
|
+
* Load into the state the part with the specified ID
|
|
100
|
+
* and its thesauri.
|
|
101
|
+
* If the ID is not specified, it's a new part; in this case,
|
|
102
|
+
* it will get a null ID, but use the specified itemId and roleId.
|
|
103
|
+
*
|
|
104
|
+
* @param identity The part identity.
|
|
105
|
+
* @param thesauriIds The thesauri IDs array.
|
|
106
|
+
*/
|
|
107
|
+
load(identity: FragmentIdentity, thesauriIds?: string[]): Promise<EditedObject<Fragment> | null>;
|
|
108
|
+
/**
|
|
109
|
+
* Save the fragments in their layer part.
|
|
110
|
+
*
|
|
111
|
+
* @param part The part.
|
|
112
|
+
* @returns Promise which when successful returns the saved part.
|
|
113
|
+
*/
|
|
114
|
+
save(part: Part): Promise<Part>;
|
|
115
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<FragmentEditorService, never>;
|
|
116
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<FragmentEditorService>;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Base class for fragment feature editors.
|
|
121
|
+
* This is similar to the EditPartFeatureBase class.
|
|
122
|
+
*/
|
|
123
|
+
declare abstract class EditFragmentFeatureBase implements OnInit, OnDestroy, ComponentCanDeactivate {
|
|
124
|
+
private _router;
|
|
125
|
+
protected snackbar: MatSnackBar;
|
|
126
|
+
protected editorService: FragmentEditorService;
|
|
127
|
+
private _libraryRouteService;
|
|
128
|
+
private _loadingSub?;
|
|
129
|
+
private _savingSub?;
|
|
130
|
+
/**
|
|
131
|
+
* The fragment being edited.
|
|
132
|
+
*/
|
|
133
|
+
data?: EditedObject<Fragment>;
|
|
134
|
+
/**
|
|
135
|
+
* The identity of the fragment being edited. This gets built from the current
|
|
136
|
+
* route.
|
|
137
|
+
*/
|
|
138
|
+
identity: FragmentIdentity;
|
|
139
|
+
/**
|
|
140
|
+
* True when the wrapped editor component data is dirty.
|
|
141
|
+
*/
|
|
142
|
+
dirty?: boolean;
|
|
143
|
+
/**
|
|
144
|
+
* True when loading data.
|
|
145
|
+
*/
|
|
146
|
+
loading?: boolean;
|
|
147
|
+
/**
|
|
148
|
+
* True when saving data.
|
|
149
|
+
*/
|
|
150
|
+
saving?: boolean;
|
|
151
|
+
/**
|
|
152
|
+
* The location of the fragment being edited.
|
|
153
|
+
*/
|
|
154
|
+
frLoc: TokenLocation | undefined;
|
|
155
|
+
constructor(_router: Router, route: ActivatedRoute, snackbar: MatSnackBar, editorService: FragmentEditorService, _libraryRouteService: LibraryRouteService);
|
|
156
|
+
/**
|
|
157
|
+
* Override in derived classes to return the IDs of the thesauri requested
|
|
158
|
+
* for this editor.
|
|
159
|
+
*
|
|
160
|
+
* @return Array with thesauri IDs, eventually empty.
|
|
161
|
+
*/
|
|
162
|
+
protected getReqThesauriIds(): string[];
|
|
163
|
+
/**
|
|
164
|
+
* Called once data has been loaded.
|
|
165
|
+
*/
|
|
166
|
+
protected onDataLoaded(): void;
|
|
167
|
+
ngOnInit(): void;
|
|
168
|
+
ngOnDestroy(): void;
|
|
169
|
+
canDeactivate(): boolean;
|
|
170
|
+
/**
|
|
171
|
+
* Called when the wrapped editor dirty state changes.
|
|
172
|
+
* In the HTML template, you MUST bind this handler to the dirtyChange event
|
|
173
|
+
* emitted by your wrapped editor (i.e. (dirtyChange)="onDirtyChange($event)").
|
|
174
|
+
*
|
|
175
|
+
* @param value The value of the dirty state.
|
|
176
|
+
*/
|
|
177
|
+
onDirtyChange(value: boolean): void;
|
|
178
|
+
/**
|
|
179
|
+
* Save the fragment.
|
|
180
|
+
*
|
|
181
|
+
* @param fragment The fragment to be saved.
|
|
182
|
+
*/
|
|
183
|
+
save(fragment: Fragment): void;
|
|
184
|
+
close(): void;
|
|
185
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<EditFragmentFeatureBase, never>;
|
|
186
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<EditFragmentFeatureBase, "ng-component", never, {}, {}, never, never, false, never>;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* Service used by part editor wrappers to load part and thesauri
|
|
191
|
+
* or save parts.
|
|
192
|
+
*/
|
|
193
|
+
declare class PartEditorService {
|
|
194
|
+
private _itemService;
|
|
195
|
+
private _thesaurusService;
|
|
196
|
+
private _loading$;
|
|
197
|
+
private _saving$;
|
|
198
|
+
loading$: Observable<boolean>;
|
|
199
|
+
saving$: Observable<boolean>;
|
|
200
|
+
constructor(_itemService: ItemService, _thesaurusService: ThesaurusService);
|
|
201
|
+
private loadWithThesauri;
|
|
202
|
+
private loadWithoutThesauri;
|
|
203
|
+
/**
|
|
204
|
+
* Load into the state the part with the specified ID
|
|
205
|
+
* and its thesauri.
|
|
206
|
+
* If the ID is not specified, it's a new part; in this case,
|
|
207
|
+
* it will get a null ID, but use the specified itemId and roleId.
|
|
208
|
+
*
|
|
209
|
+
* @param identity The part identity.
|
|
210
|
+
* @param thesauriIds The thesauri IDs array.
|
|
211
|
+
*/
|
|
212
|
+
load(identity: PartIdentity, thesauriIds?: string[]): Promise<EditedObject<Part> | null>;
|
|
213
|
+
/**
|
|
214
|
+
* Save the part.
|
|
215
|
+
*
|
|
216
|
+
* @param part The part.
|
|
217
|
+
* @returns Promise which when successful returns the saved part.
|
|
218
|
+
*/
|
|
219
|
+
save(part: Part): Promise<Part>;
|
|
220
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<PartEditorService, never>;
|
|
221
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<PartEditorService>;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
/**
|
|
225
|
+
* Base class for part feature editors.
|
|
226
|
+
* A part feature editor is a wrapper component around a model editor component,
|
|
227
|
+
* used to separate the editor's logic from its host infrastructure.
|
|
228
|
+
*/
|
|
229
|
+
declare abstract class EditPartFeatureBase implements OnInit, OnDestroy, ComponentCanDeactivate {
|
|
230
|
+
protected router: Router;
|
|
231
|
+
protected snackbar: MatSnackBar;
|
|
232
|
+
protected itemService: ItemService;
|
|
233
|
+
protected thesaurusService: ThesaurusService;
|
|
234
|
+
protected editorService: PartEditorService;
|
|
235
|
+
private _loadingSub?;
|
|
236
|
+
private _savingSub?;
|
|
237
|
+
/**
|
|
238
|
+
* The part being edited.
|
|
239
|
+
*/
|
|
240
|
+
data?: EditedObject<Part>;
|
|
241
|
+
/**
|
|
242
|
+
* The identity of the part being edited. This gets built from the current
|
|
243
|
+
* route.
|
|
244
|
+
*/
|
|
245
|
+
identity: PartIdentity;
|
|
246
|
+
/**
|
|
247
|
+
* True when the wrapped editor component data is dirty.
|
|
248
|
+
*/
|
|
249
|
+
dirty?: boolean;
|
|
250
|
+
/**
|
|
251
|
+
* True when loading data.
|
|
252
|
+
*/
|
|
253
|
+
loading?: boolean;
|
|
254
|
+
/**
|
|
255
|
+
* True when saving data.
|
|
256
|
+
*/
|
|
257
|
+
saving?: boolean;
|
|
258
|
+
/**
|
|
259
|
+
* Set to true when you want the role ID (defined by identity) to affect
|
|
260
|
+
* the ID of the thesauri to load. You should set this in your editor
|
|
261
|
+
* constructor, or in your getReqThesauriIds override. When true, the role ID
|
|
262
|
+
* will be suffixed (preceded by an underscore) to the thesaurus ID,
|
|
263
|
+
* before its language identifier, i.e. for instance "categories@en"
|
|
264
|
+
* with role "sample" becomes "categories_sample@en". When this option is
|
|
265
|
+
* enabled, and some of your thesauri do not need to be suffixed, just
|
|
266
|
+
* provide an alias for the suffixed thesaurus in the backend.
|
|
267
|
+
*/
|
|
268
|
+
protected roleIdInThesauri?: boolean;
|
|
269
|
+
constructor(router: Router, route: ActivatedRoute, snackbar: MatSnackBar, itemService: ItemService, thesaurusService: ThesaurusService, editorService: PartEditorService);
|
|
270
|
+
/**
|
|
271
|
+
* Override in derived classes to return the IDs of the thesauri requested
|
|
272
|
+
* for this editor.
|
|
273
|
+
*
|
|
274
|
+
* @return Array with thesauri IDs, eventually empty.
|
|
275
|
+
*/
|
|
276
|
+
protected getReqThesauriIds(): string[];
|
|
277
|
+
/**
|
|
278
|
+
* Called once data has been loaded.
|
|
279
|
+
*/
|
|
280
|
+
protected onDataLoaded(): void;
|
|
281
|
+
private suffixThesaurusId;
|
|
282
|
+
private suffixThesauriIds;
|
|
283
|
+
ngOnInit(): void;
|
|
284
|
+
ngOnDestroy(): void;
|
|
285
|
+
canDeactivate(): boolean;
|
|
286
|
+
/**
|
|
287
|
+
* Called when the wrapped editor dirty state changes.
|
|
288
|
+
* In the HTML template, you MUST bind this handler to the dirtyChange event
|
|
289
|
+
* emitted by your wrapped editor (i.e. (dirtyChange)="onDirtyChange($event)").
|
|
290
|
+
*
|
|
291
|
+
* @param value The value of the dirty state.
|
|
292
|
+
*/
|
|
293
|
+
onDirtyChange(value: boolean): void;
|
|
294
|
+
/**
|
|
295
|
+
* Save the part.
|
|
296
|
+
*
|
|
297
|
+
* @param part The part to be saved.
|
|
298
|
+
*/
|
|
299
|
+
save(part: Part): void;
|
|
300
|
+
/**
|
|
301
|
+
* Close the editor by navigating back to the part's item.
|
|
302
|
+
*/
|
|
303
|
+
close(): void;
|
|
304
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<EditPartFeatureBase, never>;
|
|
305
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<EditPartFeatureBase, "ng-component", never, {}, {}, never, never, false, never>;
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
declare class EditedThesaurusRepository {
|
|
309
|
+
private _thesaurusService;
|
|
310
|
+
private _thesaurus$;
|
|
311
|
+
private _loading$;
|
|
312
|
+
private _saving$;
|
|
313
|
+
loading$: Observable<boolean>;
|
|
314
|
+
saving$: Observable<boolean>;
|
|
315
|
+
get thesaurus$(): Observable<Thesaurus | undefined>;
|
|
316
|
+
constructor(_thesaurusService: ThesaurusService);
|
|
317
|
+
getThesaurus(): Thesaurus | undefined;
|
|
318
|
+
/**
|
|
319
|
+
* Load the specified thesaurus.
|
|
320
|
+
*
|
|
321
|
+
* @param id The thesaurus ID or undefined to load a new thesaurus.
|
|
322
|
+
*/
|
|
323
|
+
load(id?: string): void;
|
|
324
|
+
/**
|
|
325
|
+
* Save the specified thesaurus.
|
|
326
|
+
*
|
|
327
|
+
* @param thesaurus The thesaurus to save.
|
|
328
|
+
* @returns Promise with saved thesaurus.
|
|
329
|
+
*/
|
|
330
|
+
save(thesaurus: Thesaurus): Promise<Thesaurus>;
|
|
331
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<EditedThesaurusRepository, never>;
|
|
332
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<EditedThesaurusRepository>;
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
/**
|
|
336
|
+
* Edited layer part repository.
|
|
337
|
+
*/
|
|
338
|
+
declare class EditedLayerRepository {
|
|
339
|
+
private _itemService;
|
|
340
|
+
private _facetService;
|
|
341
|
+
private _thesaurusService;
|
|
342
|
+
private _part$;
|
|
343
|
+
private _baseText$;
|
|
344
|
+
private _baseTextPart$;
|
|
345
|
+
private _locations$;
|
|
346
|
+
private _breakChance$;
|
|
347
|
+
private _layerHints$;
|
|
348
|
+
private _thesauriSet;
|
|
349
|
+
private _loading$;
|
|
350
|
+
private _saving$;
|
|
351
|
+
get loading$(): Observable<boolean>;
|
|
352
|
+
get saving$(): Observable<boolean>;
|
|
353
|
+
get part$(): Observable<TextLayerPart | undefined>;
|
|
354
|
+
get baseText$(): Observable<string | undefined>;
|
|
355
|
+
get baseTextPart$(): Observable<Part | undefined>;
|
|
356
|
+
get locations$(): Observable<TokenLocation[]>;
|
|
357
|
+
get breakChance$(): Observable<number>;
|
|
358
|
+
get layerHints$(): Observable<LayerHint[]>;
|
|
359
|
+
constructor(_itemService: ItemService, _facetService: FacetService, _thesaurusService: ThesaurusService);
|
|
360
|
+
reset(): void;
|
|
361
|
+
getPart(): TextLayerPart | undefined;
|
|
362
|
+
getBaseText(): string | undefined;
|
|
363
|
+
getLocations(): TokenLocation[];
|
|
364
|
+
private getPartLocations;
|
|
365
|
+
private loadWithThesauri;
|
|
366
|
+
private loadWithoutThesauri;
|
|
367
|
+
/**
|
|
368
|
+
* Load the state for editing layer part(s).
|
|
369
|
+
*
|
|
370
|
+
* @param itemId The item ID the layer part belongs to.
|
|
371
|
+
* @param partId The layer part ID.
|
|
372
|
+
* @param thesauriIds The optional thesauri IDs to load.
|
|
373
|
+
*/
|
|
374
|
+
load(itemId: string, partId: string, thesauriIds?: string[]): void;
|
|
375
|
+
/**
|
|
376
|
+
* Refresh the layer part break chance.
|
|
377
|
+
*/
|
|
378
|
+
refreshBreakChance(): void;
|
|
379
|
+
applyLayerPatches(partId: string, patches: string[]): void;
|
|
380
|
+
/**
|
|
381
|
+
* Delete the fragment at the specified location.
|
|
382
|
+
*
|
|
383
|
+
* @param loc The fragment's location.
|
|
384
|
+
*/
|
|
385
|
+
deleteFragment(loc: TokenLocation): void;
|
|
386
|
+
/**
|
|
387
|
+
* Save the specified fragment.
|
|
388
|
+
*
|
|
389
|
+
* @param fragment The fragment.
|
|
390
|
+
*/
|
|
391
|
+
saveFragment(fragment: Fragment): void;
|
|
392
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<EditedLayerRepository, never>;
|
|
393
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<EditedLayerRepository>;
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
export { AppRepository, EditFragmentFeatureBase, EditPartFeatureBase, EditedLayerRepository, EditedThesaurusRepository, FragmentEditorService, PartEditorService };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@myrmidon/cadmus-state",
|
|
3
3
|
"description": "Cadmus - state management.",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "13.0.0",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Cadmus"
|
|
7
7
|
],
|
|
@@ -14,11 +14,11 @@
|
|
|
14
14
|
"name": "Daniele Fusi"
|
|
15
15
|
},
|
|
16
16
|
"peerDependencies": {
|
|
17
|
-
"@angular/common": "^
|
|
18
|
-
"@angular/core": "^
|
|
19
|
-
"@myrmidon/ngx-tools": "^
|
|
20
|
-
"@myrmidon/cadmus-core": "^
|
|
21
|
-
"@myrmidon/cadmus-api": "^
|
|
17
|
+
"@angular/common": "^20.0.0",
|
|
18
|
+
"@angular/core": "^20.0.0",
|
|
19
|
+
"@myrmidon/ngx-tools": "^2.0.0",
|
|
20
|
+
"@myrmidon/cadmus-core": "^12.0.0",
|
|
21
|
+
"@myrmidon/cadmus-api": "^14.0.0"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
24
|
"tslib": "^2.3.0"
|
package/lib/app.repository.d.ts
DELETED
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import { FacetDefinition, FlagDefinition, Thesaurus } from '@myrmidon/cadmus-core';
|
|
2
|
-
import { Observable } from 'rxjs';
|
|
3
|
-
import { FacetService, FlagService, ThesaurusService, PreviewService, EditorSettingsService } from '@myrmidon/cadmus-api';
|
|
4
|
-
import * as i0 from "@angular/core";
|
|
5
|
-
/**
|
|
6
|
-
* App state repository.
|
|
7
|
-
*/
|
|
8
|
-
export declare class AppRepository {
|
|
9
|
-
private _facetService;
|
|
10
|
-
private _flagService;
|
|
11
|
-
private _thesaurusService;
|
|
12
|
-
private _previewService;
|
|
13
|
-
private _settingService;
|
|
14
|
-
private readonly _facets$;
|
|
15
|
-
private readonly _flags$;
|
|
16
|
-
private readonly _typeThesaurus$;
|
|
17
|
-
private readonly _itemBrowserThesaurus$;
|
|
18
|
-
private readonly _previewJKeys$;
|
|
19
|
-
private readonly _previewFKeys$;
|
|
20
|
-
private readonly _previewCKeys$;
|
|
21
|
-
private readonly _settingsCache;
|
|
22
|
-
get facets$(): Observable<FacetDefinition[]>;
|
|
23
|
-
get flags$(): Observable<FlagDefinition[]>;
|
|
24
|
-
get typeThesaurus$(): Observable<Thesaurus | undefined>;
|
|
25
|
-
get itemBrowserThesaurus$(): Observable<Thesaurus | undefined>;
|
|
26
|
-
get previewJKeys$(): Observable<string[]>;
|
|
27
|
-
get previewFKeys$(): Observable<string[]>;
|
|
28
|
-
get previewCKeys$(): Observable<string[]>;
|
|
29
|
-
constructor(_facetService: FacetService, _flagService: FlagService, _thesaurusService: ThesaurusService, _previewService: PreviewService, _settingService: EditorSettingsService);
|
|
30
|
-
getTypeThesaurus(): Thesaurus | undefined;
|
|
31
|
-
getFacets(): FacetDefinition[];
|
|
32
|
-
getFlags(): FlagDefinition[];
|
|
33
|
-
/**
|
|
34
|
-
* Load app data from the API. If the data is already loaded, this
|
|
35
|
-
* does nothing unless refresh is true.
|
|
36
|
-
*
|
|
37
|
-
* @param refresh True to force a refresh.
|
|
38
|
-
* @returns Promise.
|
|
39
|
-
*/
|
|
40
|
-
load(refresh?: boolean): Promise<void>;
|
|
41
|
-
/**
|
|
42
|
-
* Clear the repository.
|
|
43
|
-
*/
|
|
44
|
-
clear(): void;
|
|
45
|
-
/**
|
|
46
|
-
* Load the model types and item browsers thesauri.
|
|
47
|
-
*/
|
|
48
|
-
loadThesauri(): Promise<void>;
|
|
49
|
-
/**
|
|
50
|
-
* Get the color defined for the specified part type ID, reading it
|
|
51
|
-
* from the facets definitions.
|
|
52
|
-
* @param typeId The part type ID.
|
|
53
|
-
* @param roleId The optional role type ID.
|
|
54
|
-
* @returns The color key, or undefined if not found.
|
|
55
|
-
*/
|
|
56
|
-
getPartColor(typeId: string, roleId?: string): string | undefined;
|
|
57
|
-
/**
|
|
58
|
-
* Load the flags definitions.
|
|
59
|
-
*/
|
|
60
|
-
loadFlags(): Promise<void>;
|
|
61
|
-
/**
|
|
62
|
-
* Get the editor setting with the specified ID.
|
|
63
|
-
* @returns Promise with the settings object.
|
|
64
|
-
*/
|
|
65
|
-
getSetting(id: string): Promise<any>;
|
|
66
|
-
/**
|
|
67
|
-
* Get the editor setting for the specified part or fragment type ID,
|
|
68
|
-
* optionally having the specified role ID.
|
|
69
|
-
* @param typeId The part or fragment type ID.
|
|
70
|
-
* @param roleId The optional role ID.
|
|
71
|
-
* @returns Promise with settings object.
|
|
72
|
-
*/
|
|
73
|
-
getSettingFor(typeId: string, roleId?: string): Promise<any>;
|
|
74
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<AppRepository, never>;
|
|
75
|
-
static ɵprov: i0.ɵɵInjectableDeclaration<AppRepository>;
|
|
76
|
-
}
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import { TokenLocation, ComponentCanDeactivate, LibraryRouteService, Fragment } from '@myrmidon/cadmus-core';
|
|
2
|
-
import { Router, ActivatedRoute } from '@angular/router';
|
|
3
|
-
import { MatSnackBar } from '@angular/material/snack-bar';
|
|
4
|
-
import { EditedObject, FragmentIdentity } from '@myrmidon/cadmus-ui';
|
|
5
|
-
import { OnDestroy, OnInit } from '@angular/core';
|
|
6
|
-
import { FragmentEditorService } from './fragment-editor.service';
|
|
7
|
-
import * as i0 from "@angular/core";
|
|
8
|
-
/**
|
|
9
|
-
* Base class for fragment feature editors.
|
|
10
|
-
* This is similar to the EditPartFeatureBase class.
|
|
11
|
-
*/
|
|
12
|
-
export declare abstract class EditFragmentFeatureBase implements OnInit, OnDestroy, ComponentCanDeactivate {
|
|
13
|
-
private _router;
|
|
14
|
-
protected snackbar: MatSnackBar;
|
|
15
|
-
protected editorService: FragmentEditorService;
|
|
16
|
-
private _libraryRouteService;
|
|
17
|
-
private _loadingSub?;
|
|
18
|
-
private _savingSub?;
|
|
19
|
-
/**
|
|
20
|
-
* The fragment being edited.
|
|
21
|
-
*/
|
|
22
|
-
data?: EditedObject<Fragment>;
|
|
23
|
-
/**
|
|
24
|
-
* The identity of the fragment being edited. This gets built from the current
|
|
25
|
-
* route.
|
|
26
|
-
*/
|
|
27
|
-
identity: FragmentIdentity;
|
|
28
|
-
/**
|
|
29
|
-
* True when the wrapped editor component data is dirty.
|
|
30
|
-
*/
|
|
31
|
-
dirty?: boolean;
|
|
32
|
-
/**
|
|
33
|
-
* True when loading data.
|
|
34
|
-
*/
|
|
35
|
-
loading?: boolean;
|
|
36
|
-
/**
|
|
37
|
-
* True when saving data.
|
|
38
|
-
*/
|
|
39
|
-
saving?: boolean;
|
|
40
|
-
/**
|
|
41
|
-
* The location of the fragment being edited.
|
|
42
|
-
*/
|
|
43
|
-
frLoc: TokenLocation | undefined;
|
|
44
|
-
constructor(_router: Router, route: ActivatedRoute, snackbar: MatSnackBar, editorService: FragmentEditorService, _libraryRouteService: LibraryRouteService);
|
|
45
|
-
/**
|
|
46
|
-
* Override in derived classes to return the IDs of the thesauri requested
|
|
47
|
-
* for this editor.
|
|
48
|
-
*
|
|
49
|
-
* @return Array with thesauri IDs, eventually empty.
|
|
50
|
-
*/
|
|
51
|
-
protected getReqThesauriIds(): string[];
|
|
52
|
-
/**
|
|
53
|
-
* Called once data has been loaded.
|
|
54
|
-
*/
|
|
55
|
-
protected onDataLoaded(): void;
|
|
56
|
-
ngOnInit(): void;
|
|
57
|
-
ngOnDestroy(): void;
|
|
58
|
-
canDeactivate(): boolean;
|
|
59
|
-
/**
|
|
60
|
-
* Called when the wrapped editor dirty state changes.
|
|
61
|
-
* In the HTML template, you MUST bind this handler to the dirtyChange event
|
|
62
|
-
* emitted by your wrapped editor (i.e. (dirtyChange)="onDirtyChange($event)").
|
|
63
|
-
*
|
|
64
|
-
* @param value The value of the dirty state.
|
|
65
|
-
*/
|
|
66
|
-
onDirtyChange(value: boolean): void;
|
|
67
|
-
/**
|
|
68
|
-
* Save the fragment.
|
|
69
|
-
*
|
|
70
|
-
* @param fragment The fragment to be saved.
|
|
71
|
-
*/
|
|
72
|
-
save(fragment: Fragment): void;
|
|
73
|
-
close(): void;
|
|
74
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<EditFragmentFeatureBase, never>;
|
|
75
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<EditFragmentFeatureBase, "ng-component", never, {}, {}, never, never, false, never>;
|
|
76
|
-
}
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
import { OnDestroy, OnInit } from '@angular/core';
|
|
2
|
-
import { Router, ActivatedRoute } from '@angular/router';
|
|
3
|
-
import { MatSnackBar } from '@angular/material/snack-bar';
|
|
4
|
-
import { ComponentCanDeactivate, Part } from '@myrmidon/cadmus-core';
|
|
5
|
-
import { ItemService, ThesaurusService } from '@myrmidon/cadmus-api';
|
|
6
|
-
import { EditedObject, PartIdentity } from '@myrmidon/cadmus-ui';
|
|
7
|
-
import { PartEditorService } from './part-editor.service';
|
|
8
|
-
import * as i0 from "@angular/core";
|
|
9
|
-
/**
|
|
10
|
-
* Base class for part feature editors.
|
|
11
|
-
* A part feature editor is a wrapper component around a model editor component,
|
|
12
|
-
* used to separate the editor's logic from its host infrastructure.
|
|
13
|
-
*/
|
|
14
|
-
export declare abstract class EditPartFeatureBase implements OnInit, OnDestroy, ComponentCanDeactivate {
|
|
15
|
-
protected router: Router;
|
|
16
|
-
protected snackbar: MatSnackBar;
|
|
17
|
-
protected itemService: ItemService;
|
|
18
|
-
protected thesaurusService: ThesaurusService;
|
|
19
|
-
protected editorService: PartEditorService;
|
|
20
|
-
private _loadingSub?;
|
|
21
|
-
private _savingSub?;
|
|
22
|
-
/**
|
|
23
|
-
* The part being edited.
|
|
24
|
-
*/
|
|
25
|
-
data?: EditedObject<Part>;
|
|
26
|
-
/**
|
|
27
|
-
* The identity of the part being edited. This gets built from the current
|
|
28
|
-
* route.
|
|
29
|
-
*/
|
|
30
|
-
identity: PartIdentity;
|
|
31
|
-
/**
|
|
32
|
-
* True when the wrapped editor component data is dirty.
|
|
33
|
-
*/
|
|
34
|
-
dirty?: boolean;
|
|
35
|
-
/**
|
|
36
|
-
* True when loading data.
|
|
37
|
-
*/
|
|
38
|
-
loading?: boolean;
|
|
39
|
-
/**
|
|
40
|
-
* True when saving data.
|
|
41
|
-
*/
|
|
42
|
-
saving?: boolean;
|
|
43
|
-
/**
|
|
44
|
-
* Set to true when you want the role ID (defined by identity) to affect
|
|
45
|
-
* the ID of the thesauri to load. You should set this in your editor
|
|
46
|
-
* constructor, or in your getReqThesauriIds override. When true, the role ID
|
|
47
|
-
* will be suffixed (preceded by an underscore) to the thesaurus ID,
|
|
48
|
-
* before its language identifier, i.e. for instance "categories@en"
|
|
49
|
-
* with role "sample" becomes "categories_sample@en". When this option is
|
|
50
|
-
* enabled, and some of your thesauri do not need to be suffixed, just
|
|
51
|
-
* provide an alias for the suffixed thesaurus in the backend.
|
|
52
|
-
*/
|
|
53
|
-
protected roleIdInThesauri?: boolean;
|
|
54
|
-
constructor(router: Router, route: ActivatedRoute, snackbar: MatSnackBar, itemService: ItemService, thesaurusService: ThesaurusService, editorService: PartEditorService);
|
|
55
|
-
/**
|
|
56
|
-
* Override in derived classes to return the IDs of the thesauri requested
|
|
57
|
-
* for this editor.
|
|
58
|
-
*
|
|
59
|
-
* @return Array with thesauri IDs, eventually empty.
|
|
60
|
-
*/
|
|
61
|
-
protected getReqThesauriIds(): string[];
|
|
62
|
-
/**
|
|
63
|
-
* Called once data has been loaded.
|
|
64
|
-
*/
|
|
65
|
-
protected onDataLoaded(): void;
|
|
66
|
-
private suffixThesaurusId;
|
|
67
|
-
private suffixThesauriIds;
|
|
68
|
-
ngOnInit(): void;
|
|
69
|
-
ngOnDestroy(): void;
|
|
70
|
-
canDeactivate(): boolean;
|
|
71
|
-
/**
|
|
72
|
-
* Called when the wrapped editor dirty state changes.
|
|
73
|
-
* In the HTML template, you MUST bind this handler to the dirtyChange event
|
|
74
|
-
* emitted by your wrapped editor (i.e. (dirtyChange)="onDirtyChange($event)").
|
|
75
|
-
*
|
|
76
|
-
* @param value The value of the dirty state.
|
|
77
|
-
*/
|
|
78
|
-
onDirtyChange(value: boolean): void;
|
|
79
|
-
/**
|
|
80
|
-
* Save the part.
|
|
81
|
-
*
|
|
82
|
-
* @param part The part to be saved.
|
|
83
|
-
*/
|
|
84
|
-
save(part: Part): void;
|
|
85
|
-
/**
|
|
86
|
-
* Close the editor by navigating back to the part's item.
|
|
87
|
-
*/
|
|
88
|
-
close(): void;
|
|
89
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<EditPartFeatureBase, never>;
|
|
90
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<EditPartFeatureBase, "ng-component", never, {}, {}, never, never, false, never>;
|
|
91
|
-
}
|