@myrmidon/cadmus-state 2.0.4 → 5.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.
Files changed (34) hide show
  1. package/esm2022/lib/app.repository.mjs +76 -0
  2. package/esm2022/lib/cadmus-state.module.mjs +33 -0
  3. package/esm2022/lib/edit-fragment-feature-base.mjs +132 -0
  4. package/esm2022/lib/edit-part-feature-base.mjs +149 -0
  5. package/esm2022/lib/edited-layer.repository.mjs +281 -0
  6. package/esm2022/lib/edited-thesaurus.repository.mjs +81 -0
  7. package/esm2022/lib/fragment-editor.service.mjs +168 -0
  8. package/esm2022/lib/part-editor.service.mjs +158 -0
  9. package/{esm2020 → esm2022}/myrmidon-cadmus-state.mjs +4 -4
  10. package/{esm2020 → esm2022}/public-api.mjs +11 -11
  11. package/{fesm2020 → fesm2022}/myrmidon-cadmus-state.mjs +1011 -993
  12. package/fesm2022/myrmidon-cadmus-state.mjs.map +1 -0
  13. package/index.d.ts +5 -5
  14. package/lib/app.repository.d.ts +63 -63
  15. package/lib/cadmus-state.module.d.ts +10 -10
  16. package/lib/edit-fragment-feature-base.d.ts +76 -76
  17. package/lib/edit-part-feature-base.d.ts +91 -78
  18. package/lib/edited-layer.repository.d.ts +91 -91
  19. package/lib/edited-thesaurus.repository.d.ts +34 -34
  20. package/lib/fragment-editor.service.d.ts +40 -40
  21. package/lib/part-editor.service.d.ts +39 -39
  22. package/package.json +8 -14
  23. package/public-api.d.ts +8 -8
  24. package/esm2020/lib/app.repository.mjs +0 -75
  25. package/esm2020/lib/cadmus-state.module.mjs +0 -32
  26. package/esm2020/lib/edit-fragment-feature-base.mjs +0 -131
  27. package/esm2020/lib/edit-part-feature-base.mjs +0 -129
  28. package/esm2020/lib/edited-layer.repository.mjs +0 -280
  29. package/esm2020/lib/edited-thesaurus.repository.mjs +0 -80
  30. package/esm2020/lib/fragment-editor.service.mjs +0 -167
  31. package/esm2020/lib/part-editor.service.mjs +0 -157
  32. package/fesm2015/myrmidon-cadmus-state.mjs +0 -1000
  33. package/fesm2015/myrmidon-cadmus-state.mjs.map +0 -1
  34. package/fesm2020/myrmidon-cadmus-state.mjs.map +0 -1
@@ -1,78 +1,91 @@
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
- constructor(router: Router, route: ActivatedRoute, snackbar: MatSnackBar, itemService: ItemService, thesaurusService: ThesaurusService, editorService: PartEditorService);
44
- /**
45
- * Override in derived classes to return the IDs of the thesauri requested
46
- * for this editor.
47
- *
48
- * @return Array with thesauri IDs, eventually empty.
49
- */
50
- protected getReqThesauriIds(): string[];
51
- /**
52
- * Called once data has been loaded.
53
- */
54
- protected onDataLoaded(): void;
55
- ngOnInit(): void;
56
- ngOnDestroy(): void;
57
- canDeactivate(): boolean;
58
- /**
59
- * Called when the wrapped editor dirty state changes.
60
- * In the HTML template, you MUST bind this handler to the dirtyChange event
61
- * emitted by your wrapped editor (i.e. (dirtyChange)="onDirtyChange($event)").
62
- *
63
- * @param value The value of the dirty state.
64
- */
65
- onDirtyChange(value: boolean): void;
66
- /**
67
- * Save the part.
68
- *
69
- * @param part The part to be saved.
70
- */
71
- save(part: Part): void;
72
- /**
73
- * Close the editor by navigating back to the part's item.
74
- */
75
- close(): void;
76
- static ɵfac: i0.ɵɵFactoryDeclaration<EditPartFeatureBase, never>;
77
- static ɵcmp: i0.ɵɵComponentDeclaration<EditPartFeatureBase, "ng-component", never, {}, {}, never, never, false, never>;
78
- }
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
+ }
@@ -1,91 +1,91 @@
1
- import { Fragment, LayerHint, Part, TextLayerPart, TokenLocation } from '@myrmidon/cadmus-core';
2
- import { Observable } from 'rxjs';
3
- import { FacetService, ItemService, ThesaurusService } from '@myrmidon/cadmus-api';
4
- import * as i0 from "@angular/core";
5
- export interface EditedLayerState {
6
- /**
7
- * The layer part (=collection of fragments) being edited.
8
- */
9
- part?: TextLayerPart;
10
- /**
11
- * The base text rendered into a plain string, whatever its original model.
12
- * This is used for reference (e.g. show it to the user while editing),
13
- * even if in some cases it can be enough to work with the base text in the
14
- * layer part editor itself (this is the case of the token-based text,
15
- * but not e.g. for the tiles-based text).
16
- */
17
- baseText?: string;
18
- /**
19
- * The base text part.
20
- */
21
- baseTextPart?: Part;
22
- /**
23
- * The fragments locations, collected from all the fragments.
24
- */
25
- locations: TokenLocation[];
26
- /**
27
- * The estimated chance of broken fragments in this layer: 0=safe,
28
- * 1=potentially broken, 2=broken.
29
- */
30
- breakChance: number;
31
- /**
32
- * The layer fragments reconciliation hints. There is one hint for each
33
- * fragment in the layer.
34
- */
35
- layerHints: LayerHint[];
36
- }
37
- /**
38
- * Edited layer part ELF repository.
39
- */
40
- export declare class EditedLayerRepository {
41
- private _itemService;
42
- private _facetService;
43
- private _thesaurusService;
44
- private _store;
45
- private _loading$;
46
- private _saving$;
47
- loading$: Observable<boolean>;
48
- saving$: Observable<boolean>;
49
- part$: Observable<TextLayerPart | undefined>;
50
- baseText$: Observable<string | undefined>;
51
- baseTextPart$: Observable<Part | undefined>;
52
- locations$: Observable<TokenLocation[]>;
53
- breakChance$: Observable<number>;
54
- layerHints$: Observable<LayerHint[]>;
55
- constructor(_itemService: ItemService, _facetService: FacetService, _thesaurusService: ThesaurusService);
56
- reset(): void;
57
- getValue(): EditedLayerState;
58
- getPart(): TextLayerPart | undefined;
59
- getBaseText(): string | undefined;
60
- getLocations(): TokenLocation[];
61
- private getPartLocations;
62
- private loadWithThesauri;
63
- private loadWithoutThesauri;
64
- /**
65
- * Load the state for editing layer part(s).
66
- *
67
- * @param itemId The item ID the layer part belongs to.
68
- * @param partId The layer part ID.
69
- * @param thesauriIds The optional thesauri IDs to load.
70
- */
71
- load(itemId: string, partId: string, thesauriIds?: string[]): void;
72
- /**
73
- * Refresh the layer part break chance.
74
- */
75
- refreshBreakChance(): void;
76
- applyLayerPatches(partId: string, patches: string[]): void;
77
- /**
78
- * Delete the fragment at the specified location.
79
- *
80
- * @param loc The fragment's location.
81
- */
82
- deleteFragment(loc: TokenLocation): void;
83
- /**
84
- * Save the specified fragment.
85
- *
86
- * @param fragment The fragment.
87
- */
88
- saveFragment(fragment: Fragment): void;
89
- static ɵfac: i0.ɵɵFactoryDeclaration<EditedLayerRepository, never>;
90
- static ɵprov: i0.ɵɵInjectableDeclaration<EditedLayerRepository>;
91
- }
1
+ import { Fragment, LayerHint, Part, TextLayerPart, TokenLocation } from '@myrmidon/cadmus-core';
2
+ import { Observable } from 'rxjs';
3
+ import { FacetService, ItemService, ThesaurusService } from '@myrmidon/cadmus-api';
4
+ import * as i0 from "@angular/core";
5
+ export interface EditedLayerState {
6
+ /**
7
+ * The layer part (=collection of fragments) being edited.
8
+ */
9
+ part?: TextLayerPart;
10
+ /**
11
+ * The base text rendered into a plain string, whatever its original model.
12
+ * This is used for reference (e.g. show it to the user while editing),
13
+ * even if in some cases it can be enough to work with the base text in the
14
+ * layer part editor itself (this is the case of the token-based text,
15
+ * but not e.g. for the tiles-based text).
16
+ */
17
+ baseText?: string;
18
+ /**
19
+ * The base text part.
20
+ */
21
+ baseTextPart?: Part;
22
+ /**
23
+ * The fragments locations, collected from all the fragments.
24
+ */
25
+ locations: TokenLocation[];
26
+ /**
27
+ * The estimated chance of broken fragments in this layer: 0=safe,
28
+ * 1=potentially broken, 2=broken.
29
+ */
30
+ breakChance: number;
31
+ /**
32
+ * The layer fragments reconciliation hints. There is one hint for each
33
+ * fragment in the layer.
34
+ */
35
+ layerHints: LayerHint[];
36
+ }
37
+ /**
38
+ * Edited layer part ELF repository.
39
+ */
40
+ export declare class EditedLayerRepository {
41
+ private _itemService;
42
+ private _facetService;
43
+ private _thesaurusService;
44
+ private _store;
45
+ private _loading$;
46
+ private _saving$;
47
+ loading$: Observable<boolean>;
48
+ saving$: Observable<boolean>;
49
+ part$: Observable<TextLayerPart | undefined>;
50
+ baseText$: Observable<string | undefined>;
51
+ baseTextPart$: Observable<Part | undefined>;
52
+ locations$: Observable<TokenLocation[]>;
53
+ breakChance$: Observable<number>;
54
+ layerHints$: Observable<LayerHint[]>;
55
+ constructor(_itemService: ItemService, _facetService: FacetService, _thesaurusService: ThesaurusService);
56
+ reset(): void;
57
+ getValue(): EditedLayerState;
58
+ getPart(): TextLayerPart | undefined;
59
+ getBaseText(): string | undefined;
60
+ getLocations(): TokenLocation[];
61
+ private getPartLocations;
62
+ private loadWithThesauri;
63
+ private loadWithoutThesauri;
64
+ /**
65
+ * Load the state for editing layer part(s).
66
+ *
67
+ * @param itemId The item ID the layer part belongs to.
68
+ * @param partId The layer part ID.
69
+ * @param thesauriIds The optional thesauri IDs to load.
70
+ */
71
+ load(itemId: string, partId: string, thesauriIds?: string[]): void;
72
+ /**
73
+ * Refresh the layer part break chance.
74
+ */
75
+ refreshBreakChance(): void;
76
+ applyLayerPatches(partId: string, patches: string[]): void;
77
+ /**
78
+ * Delete the fragment at the specified location.
79
+ *
80
+ * @param loc The fragment's location.
81
+ */
82
+ deleteFragment(loc: TokenLocation): void;
83
+ /**
84
+ * Save the specified fragment.
85
+ *
86
+ * @param fragment The fragment.
87
+ */
88
+ saveFragment(fragment: Fragment): void;
89
+ static ɵfac: i0.ɵɵFactoryDeclaration<EditedLayerRepository, never>;
90
+ static ɵprov: i0.ɵɵInjectableDeclaration<EditedLayerRepository>;
91
+ }
@@ -1,34 +1,34 @@
1
- import { Observable } from 'rxjs';
2
- import { Thesaurus } from '@myrmidon/cadmus-core';
3
- import { ThesaurusService } from '@myrmidon/cadmus-api';
4
- import * as i0 from "@angular/core";
5
- export interface EditedThesaurusState {
6
- thesaurus?: Thesaurus;
7
- }
8
- export declare class EditedThesaurusRepository {
9
- private _thesaurusService;
10
- private _store;
11
- private _loading$;
12
- private _saving$;
13
- loading$: Observable<boolean>;
14
- saving$: Observable<boolean>;
15
- thesaurus$: Observable<Thesaurus | undefined>;
16
- constructor(_thesaurusService: ThesaurusService);
17
- getValue(): EditedThesaurusState;
18
- getThesaurus(): Thesaurus | undefined;
19
- /**
20
- * Load the specified thesaurus.
21
- *
22
- * @param id The thesaurus ID or undefined to load a new thesaurus.
23
- */
24
- load(id?: string): void;
25
- /**
26
- * Save the specified thesaurus.
27
- *
28
- * @param thesaurus The thesaurus to save.
29
- * @returns Promise with saved thesaurus.
30
- */
31
- save(thesaurus: Thesaurus): Promise<Thesaurus>;
32
- static ɵfac: i0.ɵɵFactoryDeclaration<EditedThesaurusRepository, never>;
33
- static ɵprov: i0.ɵɵInjectableDeclaration<EditedThesaurusRepository>;
34
- }
1
+ import { Observable } from 'rxjs';
2
+ import { Thesaurus } from '@myrmidon/cadmus-core';
3
+ import { ThesaurusService } from '@myrmidon/cadmus-api';
4
+ import * as i0 from "@angular/core";
5
+ export interface EditedThesaurusState {
6
+ thesaurus?: Thesaurus;
7
+ }
8
+ export declare class EditedThesaurusRepository {
9
+ private _thesaurusService;
10
+ private _store;
11
+ private _loading$;
12
+ private _saving$;
13
+ loading$: Observable<boolean>;
14
+ saving$: Observable<boolean>;
15
+ thesaurus$: Observable<Thesaurus | undefined>;
16
+ constructor(_thesaurusService: ThesaurusService);
17
+ getValue(): EditedThesaurusState;
18
+ getThesaurus(): Thesaurus | undefined;
19
+ /**
20
+ * Load the specified thesaurus.
21
+ *
22
+ * @param id The thesaurus ID or undefined to load a new thesaurus.
23
+ */
24
+ load(id?: string): void;
25
+ /**
26
+ * Save the specified thesaurus.
27
+ *
28
+ * @param thesaurus The thesaurus to save.
29
+ * @returns Promise with saved thesaurus.
30
+ */
31
+ save(thesaurus: Thesaurus): Promise<Thesaurus>;
32
+ static ɵfac: i0.ɵɵFactoryDeclaration<EditedThesaurusRepository, never>;
33
+ static ɵprov: i0.ɵɵInjectableDeclaration<EditedThesaurusRepository>;
34
+ }
@@ -1,40 +1,40 @@
1
- import { Observable } from 'rxjs';
2
- import { ItemService, ThesaurusService } from '@myrmidon/cadmus-api';
3
- import { Fragment, Part } from '@myrmidon/cadmus-core';
4
- import { EditedObject, FragmentIdentity } from '@myrmidon/cadmus-ui';
5
- import * as i0 from "@angular/core";
6
- /**
7
- * Service used by layer part editor wrappers to load part and thesauri
8
- * or save parts.
9
- */
10
- export declare class FragmentEditorService {
11
- private _itemService;
12
- private _thesaurusService;
13
- private _loading$;
14
- private _saving$;
15
- loading$: Observable<boolean>;
16
- saving$: Observable<boolean>;
17
- constructor(_itemService: ItemService, _thesaurusService: ThesaurusService);
18
- private getFragmentFromPart;
19
- private loadWithThesauri;
20
- private loadWithoutThesauri;
21
- /**
22
- * Load into the state the part with the specified ID
23
- * and its thesauri.
24
- * If the ID is not specified, it's a new part; in this case,
25
- * it will get a null ID, but use the specified itemId and roleId.
26
- *
27
- * @param identity The part identity.
28
- * @param thesauriIds The thesauri IDs array.
29
- */
30
- load(identity: FragmentIdentity, thesauriIds?: string[]): Promise<EditedObject<Fragment> | null>;
31
- /**
32
- * Save the fragments in their layer part.
33
- *
34
- * @param part The part.
35
- * @returns Promise which when successful returns the saved part.
36
- */
37
- save(part: Part): Promise<Part>;
38
- static ɵfac: i0.ɵɵFactoryDeclaration<FragmentEditorService, never>;
39
- static ɵprov: i0.ɵɵInjectableDeclaration<FragmentEditorService>;
40
- }
1
+ import { Observable } from 'rxjs';
2
+ import { ItemService, ThesaurusService } from '@myrmidon/cadmus-api';
3
+ import { Fragment, Part } from '@myrmidon/cadmus-core';
4
+ import { EditedObject, FragmentIdentity } from '@myrmidon/cadmus-ui';
5
+ import * as i0 from "@angular/core";
6
+ /**
7
+ * Service used by layer part editor wrappers to load part and thesauri
8
+ * or save parts.
9
+ */
10
+ export declare class FragmentEditorService {
11
+ private _itemService;
12
+ private _thesaurusService;
13
+ private _loading$;
14
+ private _saving$;
15
+ loading$: Observable<boolean>;
16
+ saving$: Observable<boolean>;
17
+ constructor(_itemService: ItemService, _thesaurusService: ThesaurusService);
18
+ private getFragmentFromPart;
19
+ private loadWithThesauri;
20
+ private loadWithoutThesauri;
21
+ /**
22
+ * Load into the state the part with the specified ID
23
+ * and its thesauri.
24
+ * If the ID is not specified, it's a new part; in this case,
25
+ * it will get a null ID, but use the specified itemId and roleId.
26
+ *
27
+ * @param identity The part identity.
28
+ * @param thesauriIds The thesauri IDs array.
29
+ */
30
+ load(identity: FragmentIdentity, thesauriIds?: string[]): Promise<EditedObject<Fragment> | null>;
31
+ /**
32
+ * Save the fragments in their layer part.
33
+ *
34
+ * @param part The part.
35
+ * @returns Promise which when successful returns the saved part.
36
+ */
37
+ save(part: Part): Promise<Part>;
38
+ static ɵfac: i0.ɵɵFactoryDeclaration<FragmentEditorService, never>;
39
+ static ɵprov: i0.ɵɵInjectableDeclaration<FragmentEditorService>;
40
+ }
@@ -1,39 +1,39 @@
1
- import { Observable } from 'rxjs';
2
- import { ItemService, ThesaurusService } from '@myrmidon/cadmus-api';
3
- import { Part } from '@myrmidon/cadmus-core';
4
- import { EditedObject, PartIdentity } from '@myrmidon/cadmus-ui';
5
- import * as i0 from "@angular/core";
6
- /**
7
- * Service used by part editor wrappers to load part and thesauri
8
- * or save parts.
9
- */
10
- export declare class PartEditorService {
11
- private _itemService;
12
- private _thesaurusService;
13
- private _loading$;
14
- private _saving$;
15
- loading$: Observable<boolean>;
16
- saving$: Observable<boolean>;
17
- constructor(_itemService: ItemService, _thesaurusService: ThesaurusService);
18
- private loadWithThesauri;
19
- private loadWithoutThesauri;
20
- /**
21
- * Load into the state the part with the specified ID
22
- * and its thesauri.
23
- * If the ID is not specified, it's a new part; in this case,
24
- * it will get a null ID, but use the specified itemId and roleId.
25
- *
26
- * @param identity The part identity.
27
- * @param thesauriIds The thesauri IDs array.
28
- */
29
- load(identity: PartIdentity, thesauriIds?: string[]): Promise<EditedObject<Part> | null>;
30
- /**
31
- * Save the part.
32
- *
33
- * @param part The part.
34
- * @returns Promise which when successful returns the saved part.
35
- */
36
- save(part: Part): Promise<Part>;
37
- static ɵfac: i0.ɵɵFactoryDeclaration<PartEditorService, never>;
38
- static ɵprov: i0.ɵɵInjectableDeclaration<PartEditorService>;
39
- }
1
+ import { Observable } from 'rxjs';
2
+ import { ItemService, ThesaurusService } from '@myrmidon/cadmus-api';
3
+ import { Part } from '@myrmidon/cadmus-core';
4
+ import { EditedObject, PartIdentity } from '@myrmidon/cadmus-ui';
5
+ import * as i0 from "@angular/core";
6
+ /**
7
+ * Service used by part editor wrappers to load part and thesauri
8
+ * or save parts.
9
+ */
10
+ export declare class PartEditorService {
11
+ private _itemService;
12
+ private _thesaurusService;
13
+ private _loading$;
14
+ private _saving$;
15
+ loading$: Observable<boolean>;
16
+ saving$: Observable<boolean>;
17
+ constructor(_itemService: ItemService, _thesaurusService: ThesaurusService);
18
+ private loadWithThesauri;
19
+ private loadWithoutThesauri;
20
+ /**
21
+ * Load into the state the part with the specified ID
22
+ * and its thesauri.
23
+ * If the ID is not specified, it's a new part; in this case,
24
+ * it will get a null ID, but use the specified itemId and roleId.
25
+ *
26
+ * @param identity The part identity.
27
+ * @param thesauriIds The thesauri IDs array.
28
+ */
29
+ load(identity: PartIdentity, thesauriIds?: string[]): Promise<EditedObject<Part> | null>;
30
+ /**
31
+ * Save the part.
32
+ *
33
+ * @param part The part.
34
+ * @returns Promise which when successful returns the saved part.
35
+ */
36
+ save(part: Part): Promise<Part>;
37
+ static ɵfac: i0.ɵɵFactoryDeclaration<PartEditorService, never>;
38
+ static ɵprov: i0.ɵɵInjectableDeclaration<PartEditorService>;
39
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@myrmidon/cadmus-state",
3
3
  "description": "Cadmus - state management.",
4
- "version": "2.0.4",
4
+ "version": "5.0.0",
5
5
  "keywords": [
6
6
  "Cadmus"
7
7
  ],
@@ -14,17 +14,13 @@
14
14
  "name": "Daniele Fusi"
15
15
  },
16
16
  "peerDependencies": {
17
- "@angular/common": "^15.0.0",
18
- "@angular/core": "^15.0.0"
17
+ "@angular/common": "^16.0.0",
18
+ "@angular/core": "^16.0.0"
19
19
  },
20
20
  "dependencies": {
21
- "tslib": "^2.3.0"
21
+ "tslib": "^2.5.0"
22
22
  },
23
- "module": "fesm2015/myrmidon-cadmus-state.mjs",
24
- "es2020": "fesm2020/myrmidon-cadmus-state.mjs",
25
- "esm2020": "esm2020/myrmidon-cadmus-state.mjs",
26
- "fesm2020": "fesm2020/myrmidon-cadmus-state.mjs",
27
- "fesm2015": "fesm2015/myrmidon-cadmus-state.mjs",
23
+ "module": "fesm2022/myrmidon-cadmus-state.mjs",
28
24
  "typings": "index.d.ts",
29
25
  "exports": {
30
26
  "./package.json": {
@@ -32,11 +28,9 @@
32
28
  },
33
29
  ".": {
34
30
  "types": "./index.d.ts",
35
- "esm2020": "./esm2020/myrmidon-cadmus-state.mjs",
36
- "es2020": "./fesm2020/myrmidon-cadmus-state.mjs",
37
- "es2015": "./fesm2015/myrmidon-cadmus-state.mjs",
38
- "node": "./fesm2015/myrmidon-cadmus-state.mjs",
39
- "default": "./fesm2020/myrmidon-cadmus-state.mjs"
31
+ "esm2022": "./esm2022/myrmidon-cadmus-state.mjs",
32
+ "esm": "./esm2022/myrmidon-cadmus-state.mjs",
33
+ "default": "./fesm2022/myrmidon-cadmus-state.mjs"
40
34
  }
41
35
  },
42
36
  "sideEffects": false
package/public-api.d.ts CHANGED
@@ -1,8 +1,8 @@
1
- export * from './lib/app.repository';
2
- export * from './lib/edit-fragment-feature-base';
3
- export * from './lib/edit-part-feature-base';
4
- export * from './lib/edited-thesaurus.repository';
5
- export * from './lib/edited-layer.repository';
6
- export * from './lib/fragment-editor.service';
7
- export * from './lib/part-editor.service';
8
- export * from './lib/cadmus-state.module';
1
+ export * from './lib/app.repository';
2
+ export * from './lib/edit-fragment-feature-base';
3
+ export * from './lib/edit-part-feature-base';
4
+ export * from './lib/edited-thesaurus.repository';
5
+ export * from './lib/edited-layer.repository';
6
+ export * from './lib/fragment-editor.service';
7
+ export * from './lib/part-editor.service';
8
+ export * from './lib/cadmus-state.module';