@myrmidon/cadmus-item-editor 2.0.7 → 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 (27) hide show
  1. package/esm2022/lib/cadmus-item-editor.module.mjs +128 -0
  2. package/esm2022/lib/has-preview.pipe.mjs +48 -0
  3. package/esm2022/lib/item-editor/item-editor.component.mjs +380 -0
  4. package/esm2022/lib/missing-parts/missing-parts.component.mjs +72 -0
  5. package/esm2022/lib/parts-scope-editor/parts-scope-editor.component.mjs +125 -0
  6. package/esm2022/lib/state/edited-item.repository.mjs +333 -0
  7. package/{esm2020 → esm2022}/myrmidon-cadmus-item-editor.mjs +4 -4
  8. package/{esm2020 → esm2022}/public-api.mjs +6 -6
  9. package/{fesm2020 → fesm2022}/myrmidon-cadmus-item-editor.mjs +978 -979
  10. package/{fesm2020 → fesm2022}/myrmidon-cadmus-item-editor.mjs.map +1 -1
  11. package/index.d.ts +5 -5
  12. package/lib/cadmus-item-editor.module.d.ts +34 -34
  13. package/lib/has-preview.pipe.d.ts +27 -27
  14. package/lib/item-editor/item-editor.component.d.ts +88 -88
  15. package/lib/missing-parts/missing-parts.component.d.ts +25 -25
  16. package/lib/parts-scope-editor/parts-scope-editor.component.d.ts +44 -44
  17. package/lib/state/edited-item.repository.d.ts +102 -102
  18. package/package.json +8 -14
  19. package/public-api.d.ts +3 -3
  20. package/esm2020/lib/cadmus-item-editor.module.mjs +0 -127
  21. package/esm2020/lib/has-preview.pipe.mjs +0 -47
  22. package/esm2020/lib/item-editor/item-editor.component.mjs +0 -379
  23. package/esm2020/lib/missing-parts/missing-parts.component.mjs +0 -71
  24. package/esm2020/lib/parts-scope-editor/parts-scope-editor.component.mjs +0 -124
  25. package/esm2020/lib/state/edited-item.repository.mjs +0 -332
  26. package/fesm2015/myrmidon-cadmus-item-editor.mjs +0 -1043
  27. package/fesm2015/myrmidon-cadmus-item-editor.mjs.map +0 -1
@@ -1,27 +1,27 @@
1
- import { PipeTransform } from '@angular/core';
2
- import { Part } from '@myrmidon/cadmus-core';
3
- import * as i0 from "@angular/core";
4
- /**
5
- * A pipe used locally in the item editor to determine whether
6
- * any of its parts can be previewed. To this end, this pipe requires
7
- * the part plus the list of available renderers keys and flatteners
8
- * keys. When the part is a base text, it is checked against flatteners
9
- * and renderers; else, it is checked against renderers only.
10
- * Ideally, a text part should have a flattener, while any other part
11
- * should have a renderer. When there is no flattener, we fallback
12
- * to the renderer if any.
13
- */
14
- export declare class HasPreviewPipe implements PipeTransform {
15
- /**
16
- * Transform the received part into a boolean value telling whether
17
- * that part can be previewed or not.
18
- *
19
- * @param value The part.
20
- * @param rKeys The list of available renderers keys.
21
- * @param fKeys The list of available flatteners keys.
22
- * @returns True if preview available; else false.
23
- */
24
- transform(value: Part | undefined | null, rKeys: string[] | undefined | null, fKeys: string[] | undefined | null): boolean;
25
- static ɵfac: i0.ɵɵFactoryDeclaration<HasPreviewPipe, never>;
26
- static ɵpipe: i0.ɵɵPipeDeclaration<HasPreviewPipe, "hasPreview", false>;
27
- }
1
+ import { PipeTransform } from '@angular/core';
2
+ import { Part } from '@myrmidon/cadmus-core';
3
+ import * as i0 from "@angular/core";
4
+ /**
5
+ * A pipe used locally in the item editor to determine whether
6
+ * any of its parts can be previewed. To this end, this pipe requires
7
+ * the part plus the list of available renderers keys and flatteners
8
+ * keys. When the part is a base text, it is checked against flatteners
9
+ * and renderers; else, it is checked against renderers only.
10
+ * Ideally, a text part should have a flattener, while any other part
11
+ * should have a renderer. When there is no flattener, we fallback
12
+ * to the renderer if any.
13
+ */
14
+ export declare class HasPreviewPipe implements PipeTransform {
15
+ /**
16
+ * Transform the received part into a boolean value telling whether
17
+ * that part can be previewed or not.
18
+ *
19
+ * @param value The part.
20
+ * @param rKeys The list of available renderers keys.
21
+ * @param fKeys The list of available flatteners keys.
22
+ * @returns True if preview available; else false.
23
+ */
24
+ transform(value: Part | undefined | null, rKeys: string[] | undefined | null, fKeys: string[] | undefined | null): boolean;
25
+ static ɵfac: i0.ɵɵFactoryDeclaration<HasPreviewPipe, never>;
26
+ static ɵpipe: i0.ɵɵPipeDeclaration<HasPreviewPipe, "hasPreview", false>;
27
+ }
@@ -1,88 +1,88 @@
1
- import { OnInit } from '@angular/core';
2
- import { FormControl, FormGroup, FormBuilder, FormArray } from '@angular/forms';
3
- import { ActivatedRoute, Router } from '@angular/router';
4
- import { MatSnackBar } from '@angular/material/snack-bar';
5
- import { Observable } from 'rxjs';
6
- import { Item, PartGroup, PartDefinition, FacetDefinition, FlagDefinition, Part, LibraryRouteService, LayerPartInfo, Thesaurus, ComponentCanDeactivate } from '@myrmidon/cadmus-core';
7
- import { AppRepository } from '@myrmidon/cadmus-state';
8
- import { DialogService } from '@myrmidon/ng-mat-tools';
9
- import { AuthJwtService, User } from '@myrmidon/auth-jwt-login';
10
- import { ItemService, UserLevelService } from '@myrmidon/cadmus-api';
11
- import { ItemListRepository } from '@myrmidon/cadmus-item-list';
12
- import { PartScopeSetRequest } from '../parts-scope-editor/parts-scope-editor.component';
13
- import { EditedItemRepository } from '../state/edited-item.repository';
14
- import * as i0 from "@angular/core";
15
- /**
16
- * Item editor. This can edit a new or existing item's metadata and parts.
17
- * The ID of the item being edited is extracted from the route. For a new item
18
- * this is 'new', which here is stored as an empty string.
19
- */
20
- export declare class ItemEditorComponent implements OnInit, ComponentCanDeactivate {
21
- private _router;
22
- private _route;
23
- private _snackbar;
24
- private _appRepository;
25
- private _repository;
26
- private _itemService;
27
- private _itemListRepository;
28
- private _libraryRouteService;
29
- private _dialogService;
30
- private _authService;
31
- private _userLevelService;
32
- private _formBuilder;
33
- private _flagsFrozen?;
34
- flagDefinitions: FlagDefinition[];
35
- id?: string;
36
- item$: Observable<Item | undefined>;
37
- parts$: Observable<Part[] | undefined>;
38
- partGroups$: Observable<PartGroup[] | undefined>;
39
- layerPartInfos$: Observable<LayerPartInfo[] | undefined>;
40
- user?: User;
41
- userLevel: number;
42
- busy?: boolean;
43
- facet$: Observable<FacetDefinition | undefined>;
44
- newPartDefinitions$: Observable<PartDefinition[]>;
45
- facets$: Observable<FacetDefinition[] | undefined>;
46
- typeThesaurus$: Observable<Thesaurus | undefined>;
47
- previewJKeys$: Observable<string[]>;
48
- previewFKeys$: Observable<string[]>;
49
- newPartType: FormControl<PartDefinition | null>;
50
- newPart: FormGroup;
51
- title: FormControl<string | null>;
52
- sortKey: FormControl<string | null>;
53
- description: FormControl<string | null>;
54
- facet: FormControl<string | null>;
55
- group: FormControl<string | null>;
56
- flags: FormControl<number>;
57
- flagChecks: FormArray;
58
- metadata: FormGroup;
59
- constructor(_router: Router, _route: ActivatedRoute, _snackbar: MatSnackBar, _appRepository: AppRepository, _repository: EditedItemRepository, _itemService: ItemService, _itemListRepository: ItemListRepository, _libraryRouteService: LibraryRouteService, _dialogService: DialogService, _authService: AuthJwtService, _userLevelService: UserLevelService, _formBuilder: FormBuilder);
60
- ngOnInit(): void;
61
- canDeactivate(): boolean | Observable<boolean>;
62
- /**
63
- * Builds the array of flags controls according to the current flags
64
- * definitions and the current flags value.
65
- */
66
- private buildFlagsControls;
67
- /**
68
- * Update the flags controls from the current flags value.
69
- */
70
- private updateFlagControls;
71
- /**
72
- * Get the flags value from the flags controls.
73
- */
74
- private getFlagsValue;
75
- private updateMetadataForm;
76
- getTypeIdName(typeId: string): string;
77
- getRoleIdName(roleId: string): string;
78
- save(): void;
79
- private partExists;
80
- addPart(def?: PartDefinition): void;
81
- editPart(part: Part): void;
82
- previewPart(part: Part): void;
83
- deletePart(part: Part): void;
84
- addLayerPart(part: LayerPartInfo): void;
85
- setPartsScope(request: PartScopeSetRequest): void;
86
- static ɵfac: i0.ɵɵFactoryDeclaration<ItemEditorComponent, never>;
87
- static ɵcmp: i0.ɵɵComponentDeclaration<ItemEditorComponent, "cadmus-item-editor", never, {}, {}, never, never, false, never>;
88
- }
1
+ import { OnInit } from '@angular/core';
2
+ import { FormControl, FormGroup, FormBuilder, FormArray } from '@angular/forms';
3
+ import { ActivatedRoute, Router } from '@angular/router';
4
+ import { MatSnackBar } from '@angular/material/snack-bar';
5
+ import { Observable } from 'rxjs';
6
+ import { Item, PartGroup, PartDefinition, FacetDefinition, FlagDefinition, Part, LibraryRouteService, LayerPartInfo, Thesaurus, ComponentCanDeactivate } from '@myrmidon/cadmus-core';
7
+ import { AppRepository } from '@myrmidon/cadmus-state';
8
+ import { DialogService } from '@myrmidon/ng-mat-tools';
9
+ import { AuthJwtService, User } from '@myrmidon/auth-jwt-login';
10
+ import { ItemService, UserLevelService } from '@myrmidon/cadmus-api';
11
+ import { ItemListRepository } from '@myrmidon/cadmus-item-list';
12
+ import { PartScopeSetRequest } from '../parts-scope-editor/parts-scope-editor.component';
13
+ import { EditedItemRepository } from '../state/edited-item.repository';
14
+ import * as i0 from "@angular/core";
15
+ /**
16
+ * Item editor. This can edit a new or existing item's metadata and parts.
17
+ * The ID of the item being edited is extracted from the route. For a new item
18
+ * this is 'new', which here is stored as an empty string.
19
+ */
20
+ export declare class ItemEditorComponent implements OnInit, ComponentCanDeactivate {
21
+ private _router;
22
+ private _route;
23
+ private _snackbar;
24
+ private _appRepository;
25
+ private _repository;
26
+ private _itemService;
27
+ private _itemListRepository;
28
+ private _libraryRouteService;
29
+ private _dialogService;
30
+ private _authService;
31
+ private _userLevelService;
32
+ private _formBuilder;
33
+ private _flagsFrozen?;
34
+ flagDefinitions: FlagDefinition[];
35
+ id?: string;
36
+ item$: Observable<Item | undefined>;
37
+ parts$: Observable<Part[] | undefined>;
38
+ partGroups$: Observable<PartGroup[] | undefined>;
39
+ layerPartInfos$: Observable<LayerPartInfo[] | undefined>;
40
+ user?: User;
41
+ userLevel: number;
42
+ busy?: boolean;
43
+ facet$: Observable<FacetDefinition | undefined>;
44
+ newPartDefinitions$: Observable<PartDefinition[]>;
45
+ facets$: Observable<FacetDefinition[] | undefined>;
46
+ typeThesaurus$: Observable<Thesaurus | undefined>;
47
+ previewJKeys$: Observable<string[]>;
48
+ previewFKeys$: Observable<string[]>;
49
+ newPartType: FormControl<PartDefinition | null>;
50
+ newPart: FormGroup;
51
+ title: FormControl<string | null>;
52
+ sortKey: FormControl<string | null>;
53
+ description: FormControl<string | null>;
54
+ facet: FormControl<string | null>;
55
+ group: FormControl<string | null>;
56
+ flags: FormControl<number>;
57
+ flagChecks: FormArray;
58
+ metadata: FormGroup;
59
+ constructor(_router: Router, _route: ActivatedRoute, _snackbar: MatSnackBar, _appRepository: AppRepository, _repository: EditedItemRepository, _itemService: ItemService, _itemListRepository: ItemListRepository, _libraryRouteService: LibraryRouteService, _dialogService: DialogService, _authService: AuthJwtService, _userLevelService: UserLevelService, _formBuilder: FormBuilder);
60
+ ngOnInit(): void;
61
+ canDeactivate(): boolean | Observable<boolean>;
62
+ /**
63
+ * Builds the array of flags controls according to the current flags
64
+ * definitions and the current flags value.
65
+ */
66
+ private buildFlagsControls;
67
+ /**
68
+ * Update the flags controls from the current flags value.
69
+ */
70
+ private updateFlagControls;
71
+ /**
72
+ * Get the flags value from the flags controls.
73
+ */
74
+ private getFlagsValue;
75
+ private updateMetadataForm;
76
+ getTypeIdName(typeId: string): string;
77
+ getRoleIdName(roleId: string): string;
78
+ save(): void;
79
+ private partExists;
80
+ addPart(def?: PartDefinition): void;
81
+ editPart(part: Part): void;
82
+ previewPart(part: Part): void;
83
+ deletePart(part: Part): void;
84
+ addLayerPart(part: LayerPartInfo): void;
85
+ setPartsScope(request: PartScopeSetRequest): void;
86
+ static ɵfac: i0.ɵɵFactoryDeclaration<ItemEditorComponent, never>;
87
+ static ɵcmp: i0.ɵɵComponentDeclaration<ItemEditorComponent, "cadmus-item-editor", never, {}, {}, never, never, false, never>;
88
+ }
@@ -1,25 +1,25 @@
1
- import { OnInit, EventEmitter } from '@angular/core';
2
- import { PartDefinition, Part, Thesaurus } from '@myrmidon/cadmus-core';
3
- import * as i0 from "@angular/core";
4
- export declare class MissingPartsComponent implements OnInit {
5
- private _partDefinitions?;
6
- private _parts?;
7
- private _typeThesaurus?;
8
- missingDefinitions: PartDefinition[];
9
- get partDefinitions(): PartDefinition[] | undefined;
10
- set partDefinitions(value: PartDefinition[] | undefined);
11
- get parts(): Part[] | undefined;
12
- set parts(value: Part[] | undefined);
13
- /**
14
- * The types thesaurus.
15
- */
16
- get typeThesaurus(): Thesaurus | undefined;
17
- set typeThesaurus(value: Thesaurus | undefined);
18
- addRequest: EventEmitter<PartDefinition>;
19
- constructor();
20
- ngOnInit(): void;
21
- private isPartPresent;
22
- private updateMissing;
23
- static ɵfac: i0.ɵɵFactoryDeclaration<MissingPartsComponent, never>;
24
- static ɵcmp: i0.ɵɵComponentDeclaration<MissingPartsComponent, "cadmus-missing-parts", never, { "partDefinitions": "partDefinitions"; "parts": "parts"; "typeThesaurus": "typeThesaurus"; }, { "addRequest": "addRequest"; }, never, never, false, never>;
25
- }
1
+ import { OnInit, EventEmitter } from '@angular/core';
2
+ import { PartDefinition, Part, Thesaurus } from '@myrmidon/cadmus-core';
3
+ import * as i0 from "@angular/core";
4
+ export declare class MissingPartsComponent implements OnInit {
5
+ private _partDefinitions?;
6
+ private _parts?;
7
+ private _typeThesaurus?;
8
+ missingDefinitions: PartDefinition[];
9
+ get partDefinitions(): PartDefinition[] | undefined;
10
+ set partDefinitions(value: PartDefinition[] | undefined);
11
+ get parts(): Part[] | undefined;
12
+ set parts(value: Part[] | undefined);
13
+ /**
14
+ * The types thesaurus.
15
+ */
16
+ get typeThesaurus(): Thesaurus | undefined;
17
+ set typeThesaurus(value: Thesaurus | undefined);
18
+ addRequest: EventEmitter<PartDefinition>;
19
+ constructor();
20
+ ngOnInit(): void;
21
+ private isPartPresent;
22
+ private updateMissing;
23
+ static ɵfac: i0.ɵɵFactoryDeclaration<MissingPartsComponent, never>;
24
+ static ɵcmp: i0.ɵɵComponentDeclaration<MissingPartsComponent, "cadmus-missing-parts", never, { "partDefinitions": { "alias": "partDefinitions"; "required": false; }; "parts": { "alias": "parts"; "required": false; }; "typeThesaurus": { "alias": "typeThesaurus"; "required": false; }; }, { "addRequest": "addRequest"; }, never, never, false, never>;
25
+ }
@@ -1,44 +1,44 @@
1
- import { OnInit, EventEmitter } from '@angular/core';
2
- import { FormGroup, FormArray, FormBuilder, FormControl } from '@angular/forms';
3
- import { Part } from '@myrmidon/cadmus-core';
4
- import { ColorService } from '@myrmidon/cadmus-ui';
5
- import { FacetService } from '@myrmidon/cadmus-api';
6
- import { AppRepository } from '@myrmidon/cadmus-state';
7
- import { DialogService } from '@myrmidon/ng-mat-tools';
8
- import { EditedItemRepository } from '../state/edited-item.repository';
9
- import * as i0 from "@angular/core";
10
- export interface PartScopeSetRequest {
11
- ids: string[];
12
- scope: string;
13
- }
14
- /**
15
- * Parts thesaurus scope dumb editor component.
16
- * This is used to set the thesaurus scope of multiple item's parts at once
17
- * in the item editor.
18
- */
19
- export declare class PartsScopeEditorComponent implements OnInit {
20
- private _formBuilder;
21
- private _facetService;
22
- private _dialogService;
23
- private _appRepository;
24
- private _colorService;
25
- private _editedItemRepository;
26
- private _parts;
27
- get parts(): Part[] | undefined;
28
- set parts(value: Part[] | undefined);
29
- readonly?: boolean;
30
- setScopeRequest: EventEmitter<PartScopeSetRequest>;
31
- checks: FormArray;
32
- scope: FormControl<string | null>;
33
- form: FormGroup;
34
- constructor(_formBuilder: FormBuilder, _facetService: FacetService, _dialogService: DialogService, _appRepository: AppRepository, _colorService: ColorService, _editedItemRepository: EditedItemRepository);
35
- ngOnInit(): void;
36
- private updateForm;
37
- getPartColor(typeId: string, roleId?: string): string;
38
- getContrastColor(typeId: string, roleId?: string): string;
39
- getTypeIdName(typeId: string): string;
40
- getRoleIdName(roleId: string): string;
41
- submit(): void;
42
- static ɵfac: i0.ɵɵFactoryDeclaration<PartsScopeEditorComponent, never>;
43
- static ɵcmp: i0.ɵɵComponentDeclaration<PartsScopeEditorComponent, "cadmus-parts-scope-editor", never, { "parts": "parts"; "readonly": "readonly"; }, { "setScopeRequest": "setScopeRequest"; }, never, never, false, never>;
44
- }
1
+ import { OnInit, EventEmitter } from '@angular/core';
2
+ import { FormGroup, FormArray, FormBuilder, FormControl } from '@angular/forms';
3
+ import { Part } from '@myrmidon/cadmus-core';
4
+ import { ColorService } from '@myrmidon/cadmus-ui';
5
+ import { FacetService } from '@myrmidon/cadmus-api';
6
+ import { AppRepository } from '@myrmidon/cadmus-state';
7
+ import { DialogService } from '@myrmidon/ng-mat-tools';
8
+ import { EditedItemRepository } from '../state/edited-item.repository';
9
+ import * as i0 from "@angular/core";
10
+ export interface PartScopeSetRequest {
11
+ ids: string[];
12
+ scope: string;
13
+ }
14
+ /**
15
+ * Parts thesaurus scope dumb editor component.
16
+ * This is used to set the thesaurus scope of multiple item's parts at once
17
+ * in the item editor.
18
+ */
19
+ export declare class PartsScopeEditorComponent implements OnInit {
20
+ private _formBuilder;
21
+ private _facetService;
22
+ private _dialogService;
23
+ private _appRepository;
24
+ private _colorService;
25
+ private _editedItemRepository;
26
+ private _parts;
27
+ get parts(): Part[] | undefined;
28
+ set parts(value: Part[] | undefined);
29
+ readonly?: boolean;
30
+ setScopeRequest: EventEmitter<PartScopeSetRequest>;
31
+ checks: FormArray;
32
+ scope: FormControl<string | null>;
33
+ form: FormGroup;
34
+ constructor(_formBuilder: FormBuilder, _facetService: FacetService, _dialogService: DialogService, _appRepository: AppRepository, _colorService: ColorService, _editedItemRepository: EditedItemRepository);
35
+ ngOnInit(): void;
36
+ private updateForm;
37
+ getPartColor(typeId: string, roleId?: string): string;
38
+ getContrastColor(typeId: string, roleId?: string): string;
39
+ getTypeIdName(typeId: string): string;
40
+ getRoleIdName(roleId: string): string;
41
+ submit(): void;
42
+ static ɵfac: i0.ɵɵFactoryDeclaration<PartsScopeEditorComponent, never>;
43
+ static ɵcmp: i0.ɵɵComponentDeclaration<PartsScopeEditorComponent, "cadmus-parts-scope-editor", never, { "parts": { "alias": "parts"; "required": false; }; "readonly": { "alias": "readonly"; "required": false; }; }, { "setScopeRequest": "setScopeRequest"; }, never, never, false, never>;
44
+ }
@@ -1,102 +1,102 @@
1
- import { FacetDefinition, Item, LayerPartInfo, Part, PartDefinition, PartGroup } from '@myrmidon/cadmus-core';
2
- import { Observable } from 'rxjs';
3
- import { ItemService } from '@myrmidon/cadmus-api';
4
- import { AppRepository } from '@myrmidon/cadmus-state';
5
- import * as i0 from "@angular/core";
6
- /**
7
- * Edited item store properties.
8
- */
9
- export interface EditedItemProps {
10
- /**
11
- * The item being edited.
12
- */
13
- item?: Item;
14
- /**
15
- * The raw list of item's parts.
16
- */
17
- parts: Part[];
18
- /**
19
- * The item's parts, grouped.
20
- */
21
- partGroups: PartGroup[];
22
- /**
23
- * The set of all the possible layer parts for this item, either
24
- * present or absent.
25
- */
26
- layerPartInfos: LayerPartInfo[];
27
- /**
28
- * The facet definition assigned to the item.
29
- */
30
- facet?: FacetDefinition;
31
- /**
32
- * The part definitions for adding a new part, filtered by the selected
33
- * facet and the parts already present in the item.
34
- */
35
- newPartDefinitions: PartDefinition[];
36
- }
37
- /**
38
- * Edited item ELF repository.
39
- */
40
- export declare class EditedItemRepository {
41
- private _appRepository;
42
- private _itemService;
43
- private _store;
44
- item$: Observable<Item | undefined>;
45
- parts$: Observable<Part[]>;
46
- partGroups$: Observable<PartGroup[]>;
47
- layers$: Observable<LayerPartInfo[]>;
48
- facet$: Observable<FacetDefinition | undefined>;
49
- newPartDefinitions$: Observable<PartDefinition[]>;
50
- constructor(_appRepository: AppRepository, _itemService: ItemService);
51
- getValue(): EditedItemProps;
52
- getItem(): Item | undefined;
53
- getFacet(): FacetDefinition | undefined;
54
- private getExistingPartTypeAndRoleIds;
55
- private getNewPartDefinitions;
56
- getPartGroups(): PartGroup[];
57
- private pickDefaultFacet;
58
- /**
59
- * Load the specified item or a new item.
60
- *
61
- * @param itemId The item ID, or falsy for a new item.
62
- */
63
- load(itemId?: string): void;
64
- /**
65
- * Ensure that the item with the specified ID is loaded.
66
- *
67
- * @param id The item ID.
68
- */
69
- ensureItemLoaded(id: string): void;
70
- /**
71
- * Save the specified item in the backend and update this store.
72
- *
73
- * @param item The item.
74
- * @returns Promise with saved item.
75
- */
76
- save(item: Item): Promise<Item>;
77
- /**
78
- * Delete the specified part from this edited item.
79
- *
80
- * @param id The part's ID.
81
- * @returns Promise with part ID.
82
- */
83
- deletePart(id: string): Promise<string>;
84
- /**
85
- * Add a new layer part to this item.
86
- *
87
- * @param typeId The part type ID.
88
- * @param roleId The part role ID.
89
- * @returns Promise with new part.
90
- */
91
- addNewLayerPart(typeId: string, roleId?: string): Promise<Part>;
92
- /**
93
- * Set the scope for the specified parts in this item.
94
- *
95
- * @param ids The part IDs.
96
- * @param scope The scope to set.
97
- * @returns Promise.
98
- */
99
- setPartThesaurusScope(ids: string[], scope: string): Promise<boolean>;
100
- static ɵfac: i0.ɵɵFactoryDeclaration<EditedItemRepository, never>;
101
- static ɵprov: i0.ɵɵInjectableDeclaration<EditedItemRepository>;
102
- }
1
+ import { FacetDefinition, Item, LayerPartInfo, Part, PartDefinition, PartGroup } from '@myrmidon/cadmus-core';
2
+ import { Observable } from 'rxjs';
3
+ import { ItemService } from '@myrmidon/cadmus-api';
4
+ import { AppRepository } from '@myrmidon/cadmus-state';
5
+ import * as i0 from "@angular/core";
6
+ /**
7
+ * Edited item store properties.
8
+ */
9
+ export interface EditedItemProps {
10
+ /**
11
+ * The item being edited.
12
+ */
13
+ item?: Item;
14
+ /**
15
+ * The raw list of item's parts.
16
+ */
17
+ parts: Part[];
18
+ /**
19
+ * The item's parts, grouped.
20
+ */
21
+ partGroups: PartGroup[];
22
+ /**
23
+ * The set of all the possible layer parts for this item, either
24
+ * present or absent.
25
+ */
26
+ layerPartInfos: LayerPartInfo[];
27
+ /**
28
+ * The facet definition assigned to the item.
29
+ */
30
+ facet?: FacetDefinition;
31
+ /**
32
+ * The part definitions for adding a new part, filtered by the selected
33
+ * facet and the parts already present in the item.
34
+ */
35
+ newPartDefinitions: PartDefinition[];
36
+ }
37
+ /**
38
+ * Edited item ELF repository.
39
+ */
40
+ export declare class EditedItemRepository {
41
+ private _appRepository;
42
+ private _itemService;
43
+ private _store;
44
+ item$: Observable<Item | undefined>;
45
+ parts$: Observable<Part[]>;
46
+ partGroups$: Observable<PartGroup[]>;
47
+ layers$: Observable<LayerPartInfo[]>;
48
+ facet$: Observable<FacetDefinition | undefined>;
49
+ newPartDefinitions$: Observable<PartDefinition[]>;
50
+ constructor(_appRepository: AppRepository, _itemService: ItemService);
51
+ getValue(): EditedItemProps;
52
+ getItem(): Item | undefined;
53
+ getFacet(): FacetDefinition | undefined;
54
+ private getExistingPartTypeAndRoleIds;
55
+ private getNewPartDefinitions;
56
+ getPartGroups(): PartGroup[];
57
+ private pickDefaultFacet;
58
+ /**
59
+ * Load the specified item or a new item.
60
+ *
61
+ * @param itemId The item ID, or falsy for a new item.
62
+ */
63
+ load(itemId?: string): void;
64
+ /**
65
+ * Ensure that the item with the specified ID is loaded.
66
+ *
67
+ * @param id The item ID.
68
+ */
69
+ ensureItemLoaded(id: string): void;
70
+ /**
71
+ * Save the specified item in the backend and update this store.
72
+ *
73
+ * @param item The item.
74
+ * @returns Promise with saved item.
75
+ */
76
+ save(item: Item): Promise<Item>;
77
+ /**
78
+ * Delete the specified part from this edited item.
79
+ *
80
+ * @param id The part's ID.
81
+ * @returns Promise with part ID.
82
+ */
83
+ deletePart(id: string): Promise<string>;
84
+ /**
85
+ * Add a new layer part to this item.
86
+ *
87
+ * @param typeId The part type ID.
88
+ * @param roleId The part role ID.
89
+ * @returns Promise with new part.
90
+ */
91
+ addNewLayerPart(typeId: string, roleId?: string): Promise<Part>;
92
+ /**
93
+ * Set the scope for the specified parts in this item.
94
+ *
95
+ * @param ids The part IDs.
96
+ * @param scope The scope to set.
97
+ * @returns Promise.
98
+ */
99
+ setPartThesaurusScope(ids: string[], scope: string): Promise<boolean>;
100
+ static ɵfac: i0.ɵɵFactoryDeclaration<EditedItemRepository, never>;
101
+ static ɵprov: i0.ɵɵInjectableDeclaration<EditedItemRepository>;
102
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@myrmidon/cadmus-item-editor",
3
- "version": "2.0.7",
3
+ "version": "5.0.0",
4
4
  "description": "Cadmus - item editor.",
5
5
  "keywords": [
6
6
  "Cadmus"
@@ -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-item-editor.mjs",
24
- "es2020": "fesm2020/myrmidon-cadmus-item-editor.mjs",
25
- "esm2020": "esm2020/myrmidon-cadmus-item-editor.mjs",
26
- "fesm2020": "fesm2020/myrmidon-cadmus-item-editor.mjs",
27
- "fesm2015": "fesm2015/myrmidon-cadmus-item-editor.mjs",
23
+ "module": "fesm2022/myrmidon-cadmus-item-editor.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-item-editor.mjs",
36
- "es2020": "./fesm2020/myrmidon-cadmus-item-editor.mjs",
37
- "es2015": "./fesm2015/myrmidon-cadmus-item-editor.mjs",
38
- "node": "./fesm2015/myrmidon-cadmus-item-editor.mjs",
39
- "default": "./fesm2020/myrmidon-cadmus-item-editor.mjs"
31
+ "esm2022": "./esm2022/myrmidon-cadmus-item-editor.mjs",
32
+ "esm": "./esm2022/myrmidon-cadmus-item-editor.mjs",
33
+ "default": "./fesm2022/myrmidon-cadmus-item-editor.mjs"
40
34
  }
41
35
  },
42
36
  "sideEffects": false
package/public-api.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- export * from './lib/state/edited-item.repository';
2
- export * from './lib/item-editor/item-editor.component';
3
- export * from './lib/cadmus-item-editor.module';
1
+ export * from './lib/state/edited-item.repository';
2
+ export * from './lib/item-editor/item-editor.component';
3
+ export * from './lib/cadmus-item-editor.module';