@myrmidon/cadmus-state 5.0.0 → 6.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.
@@ -1,24 +1,21 @@
1
1
  import { Injectable } from '@angular/core';
2
2
  import { BehaviorSubject } from 'rxjs';
3
- import { createStore, select, setProp, withProps } from '@ngneat/elf';
4
- import { withRequestsStatus } from '@ngneat/elf-requests';
5
3
  import * as i0 from "@angular/core";
6
4
  import * as i1 from "@myrmidon/cadmus-api";
7
5
  class EditedThesaurusRepository {
6
+ get thesaurus$() {
7
+ return this._thesaurus$.asObservable();
8
+ }
8
9
  constructor(_thesaurusService) {
9
10
  this._thesaurusService = _thesaurusService;
10
- this._store = createStore({ name: 'edited-thesaurus' }, withProps({}), withRequestsStatus());
11
+ this._thesaurus$ = new BehaviorSubject(undefined);
11
12
  this._loading$ = new BehaviorSubject(false);
12
13
  this.loading$ = this._loading$.asObservable();
13
14
  this._saving$ = new BehaviorSubject(false);
14
15
  this.saving$ = this._saving$.asObservable();
15
- this.thesaurus$ = this._store.pipe(select((state) => state.thesaurus));
16
- }
17
- getValue() {
18
- return this._store.getValue();
19
16
  }
20
17
  getThesaurus() {
21
- return this._store.query((state) => state.thesaurus);
18
+ return this._thesaurus$.value;
22
19
  }
23
20
  /**
24
21
  * Load the specified thesaurus.
@@ -31,7 +28,7 @@ class EditedThesaurusRepository {
31
28
  this._thesaurusService.getThesaurus(id, true).subscribe({
32
29
  next: (thesaurus) => {
33
30
  this._loading$.next(false);
34
- this._store.update(setProp('thesaurus', thesaurus));
31
+ this._thesaurus$.next(thesaurus);
35
32
  },
36
33
  error: (error) => {
37
34
  this._loading$.next(false);
@@ -40,11 +37,11 @@ class EditedThesaurusRepository {
40
37
  });
41
38
  }
42
39
  else {
43
- this._store.update(setProp('thesaurus', {
40
+ this._thesaurus$.next({
44
41
  id: '',
45
42
  language: 'en',
46
43
  entries: [],
47
- }));
44
+ });
48
45
  }
49
46
  }
50
47
  /**
@@ -70,12 +67,12 @@ class EditedThesaurusRepository {
70
67
  });
71
68
  });
72
69
  }
73
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.1", ngImport: i0, type: EditedThesaurusRepository, deps: [{ token: i1.ThesaurusService }], target: i0.ɵɵFactoryTarget.Injectable }); }
74
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.0.1", ngImport: i0, type: EditedThesaurusRepository, providedIn: 'root' }); }
70
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.7", ngImport: i0, type: EditedThesaurusRepository, deps: [{ token: i1.ThesaurusService }], target: i0.ɵɵFactoryTarget.Injectable }); }
71
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.7", ngImport: i0, type: EditedThesaurusRepository, providedIn: 'root' }); }
75
72
  }
76
73
  export { EditedThesaurusRepository };
77
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.1", ngImport: i0, type: EditedThesaurusRepository, decorators: [{
74
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.7", ngImport: i0, type: EditedThesaurusRepository, decorators: [{
78
75
  type: Injectable,
79
76
  args: [{ providedIn: 'root' }]
80
77
  }], ctorParameters: function () { return [{ type: i1.ThesaurusService }]; } });
81
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZWRpdGVkLXRoZXNhdXJ1cy5yZXBvc2l0b3J5LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vcHJvamVjdHMvbXlybWlkb24vY2FkbXVzLXN0YXRlL3NyYy9saWIvZWRpdGVkLXRoZXNhdXJ1cy5yZXBvc2l0b3J5LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxVQUFVLEVBQ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29sZS5lcnJvcihcclxuICAgICAgICAgICAgJ0Vycm9yIGxvZGluZyB0aGVzYXVydXM6ICcgKyBKU09OLnN0cmluZ2lmeShlcnJvciB8fCB7fSlcclxuICAgICAgICAgICk7XHJcbiAgICAgICAgICByZWplY3QoZXJyb3IpO1xyXG4gICAgICAgIH0sXHJcbiAgICAgIH0pO1xyXG4gICAgfSk7XHJcbiAgfVxyXG59XHJcbiJdfQ==
@@ -155,11 +155,11 @@ class FragmentEditorService {
155
155
  });
156
156
  });
157
157
  }
158
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.1", ngImport: i0, type: FragmentEditorService, deps: [{ token: i1.ItemService }, { token: i1.ThesaurusService }], target: i0.ɵɵFactoryTarget.Injectable }); }
159
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.0.1", ngImport: i0, type: FragmentEditorService, providedIn: 'root' }); }
158
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.7", ngImport: i0, type: FragmentEditorService, deps: [{ token: i1.ItemService }, { token: i1.ThesaurusService }], target: i0.ɵɵFactoryTarget.Injectable }); }
159
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.7", ngImport: i0, type: FragmentEditorService, providedIn: 'root' }); }
160
160
  }
161
161
  export { FragmentEditorService };
162
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.1", ngImport: i0, type: FragmentEditorService, decorators: [{
162
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.7", ngImport: i0, type: FragmentEditorService, decorators: [{
163
163
  type: Injectable,
164
164
  args: [{
165
165
  providedIn: 'root',
@@ -145,11 +145,11 @@ class PartEditorService {
145
145
  });
146
146
  });
147
147
  }
148
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.1", ngImport: i0, type: PartEditorService, deps: [{ token: i1.ItemService }, { token: i1.ThesaurusService }], target: i0.ɵɵFactoryTarget.Injectable }); }
149
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.0.1", ngImport: i0, type: PartEditorService, providedIn: 'root' }); }
148
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.7", ngImport: i0, type: PartEditorService, deps: [{ token: i1.ItemService }, { token: i1.ThesaurusService }], target: i0.ɵɵFactoryTarget.Injectable }); }
149
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.7", ngImport: i0, type: PartEditorService, providedIn: 'root' }); }
150
150
  }
151
151
  export { PartEditorService };
152
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.1", ngImport: i0, type: PartEditorService, decorators: [{
152
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.7", ngImport: i0, type: PartEditorService, decorators: [{
153
153
  type: Injectable,
154
154
  args: [{
155
155
  providedIn: 'root',
@@ -1,8 +1,6 @@
1
1
  import * as i0 from '@angular/core';
2
2
  import { Injectable, Component, NgModule } from '@angular/core';
3
- import { createStore, withProps, select, setProp } from '@ngneat/elf';
4
- import { withRequestsStatus, updateRequestStatus } from '@ngneat/elf-requests';
5
- import { forkJoin, BehaviorSubject, take, map } from 'rxjs';
3
+ import { BehaviorSubject, forkJoin, take, map } from 'rxjs';
6
4
  import * as i1 from '@myrmidon/cadmus-api';
7
5
  import { CadmusApiModule } from '@myrmidon/cadmus-api';
8
6
  import * as i4 from '@myrmidon/cadmus-core';
@@ -16,31 +14,50 @@ import { CommonModule } from '@angular/common';
16
14
  * App state ELF repository.
17
15
  */
18
16
  class AppRepository {
17
+ get facets$() {
18
+ return this._facets$;
19
+ }
20
+ get flags$() {
21
+ return this._flags$;
22
+ }
23
+ get typeThesaurus$() {
24
+ return this._typeThesaurus$;
25
+ }
26
+ get itemBrowserThesaurus$() {
27
+ return this._itemBrowserThesaurus$;
28
+ }
29
+ get previewJKeys$() {
30
+ return this._previewJKeys$;
31
+ }
32
+ get previewFKeys$() {
33
+ return this._previewFKeys$;
34
+ }
35
+ get previewCKeys$() {
36
+ return this._previewCKeys$;
37
+ }
19
38
  constructor(_facetService, _flagService, _thesaurusService, _previewService) {
20
39
  this._facetService = _facetService;
21
40
  this._flagService = _flagService;
22
41
  this._thesaurusService = _thesaurusService;
23
42
  this._previewService = _previewService;
24
- this._store = createStore({ name: 'app' }, withProps({
25
- facets: [],
26
- flags: [],
27
- previewJKeys: [],
28
- previewFKeys: [],
29
- previewCKeys: [],
30
- }), withRequestsStatus());
31
- this.facets$ = this._store.pipe(select((state) => state.facets));
32
- this.flags$ = this._store.pipe(select((state) => state.flags));
33
- this.typeThesaurus$ = this._store.pipe(select((state) => state.typeThesaurus));
34
- this.itemBrowserThesaurus$ = this._store.pipe(select((state) => state.itemBrowserThesaurus));
35
- this.previewJKeys$ = this._store.pipe(select((state) => state.previewJKeys));
36
- this.previewFKeys$ = this._store.pipe(select((state) => state.previewFKeys));
37
- this.previewCKeys$ = this._store.pipe(select((state) => state.previewCKeys));
38
- }
39
- getValue() {
40
- return this._store.getValue();
43
+ this._facets$ = new BehaviorSubject([]);
44
+ this._flags$ = new BehaviorSubject([]);
45
+ this._typeThesaurus$ = new BehaviorSubject(undefined);
46
+ this._itemBrowserThesaurus$ = new BehaviorSubject(undefined);
47
+ this._previewJKeys$ = new BehaviorSubject([]);
48
+ this._previewFKeys$ = new BehaviorSubject([]);
49
+ this._previewCKeys$ = new BehaviorSubject([]);
50
+ }
51
+ getTypeThesaurus() {
52
+ return this._typeThesaurus$.value;
53
+ }
54
+ getFacets() {
55
+ return this._facets$.value;
56
+ }
57
+ getFlags() {
58
+ return this._flags$.value;
41
59
  }
42
60
  load() {
43
- this._store.update(updateRequestStatus('app', 'pending'));
44
61
  const facets$ = this._facetService.getFacets();
45
62
  const flags$ = this._flagService.getFlags();
46
63
  const thesauri$ = this._thesaurusService.getThesauriSet([
@@ -59,24 +76,20 @@ class AppRepository {
59
76
  cKeys: cKeys$,
60
77
  }).subscribe({
61
78
  next: (result) => {
62
- this._store.update(updateRequestStatus('app', 'success'));
63
- this._store.update((state) => ({
64
- ...state,
65
- facets: result.facets,
66
- flags: result.flags,
67
- typeThesaurus: result.thesauri['model-types'],
68
- itemBrowserThesaurus: result.thesauri['item-browsers'],
69
- previewJKeys: result.jKeys,
70
- previewFKeys: result.fKeys,
71
- previewCKeys: result.cKeys,
72
- }));
79
+ this._facets$.next(result.facets);
80
+ this._flags$.next(result.flags);
81
+ this._typeThesaurus$.next(result.thesauri['model-types']);
82
+ this._itemBrowserThesaurus$.next(result.thesauri['item-browsers']);
83
+ this._previewJKeys$.next(result.jKeys);
84
+ this._previewFKeys$.next(result.fKeys);
85
+ this._previewCKeys$.next(result.cKeys);
73
86
  },
74
87
  });
75
88
  }
76
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.1", ngImport: i0, type: AppRepository, deps: [{ token: i1.FacetService }, { token: i1.FlagService }, { token: i1.ThesaurusService }, { token: i1.PreviewService }], target: i0.ɵɵFactoryTarget.Injectable }); }
77
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.0.1", ngImport: i0, type: AppRepository, providedIn: 'root' }); }
89
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.7", ngImport: i0, type: AppRepository, deps: [{ token: i1.FacetService }, { token: i1.FlagService }, { token: i1.ThesaurusService }, { token: i1.PreviewService }], target: i0.ɵɵFactoryTarget.Injectable }); }
90
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.7", ngImport: i0, type: AppRepository, providedIn: 'root' }); }
78
91
  }
79
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.1", ngImport: i0, type: AppRepository, decorators: [{
92
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.7", ngImport: i0, type: AppRepository, decorators: [{
80
93
  type: Injectable,
81
94
  args: [{ providedIn: 'root' }]
82
95
  }], ctorParameters: function () { return [{ type: i1.FacetService }, { type: i1.FlagService }, { type: i1.ThesaurusService }, { type: i1.PreviewService }]; } });
@@ -234,10 +247,10 @@ class FragmentEditorService {
234
247
  });
235
248
  });
236
249
  }
237
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.1", ngImport: i0, type: FragmentEditorService, deps: [{ token: i1.ItemService }, { token: i1.ThesaurusService }], target: i0.ɵɵFactoryTarget.Injectable }); }
238
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.0.1", ngImport: i0, type: FragmentEditorService, providedIn: 'root' }); }
250
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.7", ngImport: i0, type: FragmentEditorService, deps: [{ token: i1.ItemService }, { token: i1.ThesaurusService }], target: i0.ɵɵFactoryTarget.Injectable }); }
251
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.7", ngImport: i0, type: FragmentEditorService, providedIn: 'root' }); }
239
252
  }
240
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.1", ngImport: i0, type: FragmentEditorService, decorators: [{
253
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.7", ngImport: i0, type: FragmentEditorService, decorators: [{
241
254
  type: Injectable,
242
255
  args: [{
243
256
  providedIn: 'root',
@@ -358,10 +371,10 @@ class EditFragmentFeatureBase {
358
371
  },
359
372
  });
360
373
  }
361
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.1", ngImport: i0, type: EditFragmentFeatureBase, deps: [{ token: i1$1.Router }, { token: i1$1.ActivatedRoute }, { token: i2.MatSnackBar }, { token: FragmentEditorService }, { token: i4.LibraryRouteService }], target: i0.ɵɵFactoryTarget.Component }); }
362
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.0.1", type: EditFragmentFeatureBase, selector: "ng-component", ngImport: i0, template: '', isInline: true }); }
374
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.7", ngImport: i0, type: EditFragmentFeatureBase, deps: [{ token: i1$1.Router }, { token: i1$1.ActivatedRoute }, { token: i2.MatSnackBar }, { token: FragmentEditorService }, { token: i4.LibraryRouteService }], target: i0.ɵɵFactoryTarget.Component }); }
375
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.7", type: EditFragmentFeatureBase, selector: "ng-component", ngImport: i0, template: '', isInline: true }); }
363
376
  }
364
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.1", ngImport: i0, type: EditFragmentFeatureBase, decorators: [{
377
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.7", ngImport: i0, type: EditFragmentFeatureBase, decorators: [{
365
378
  type: Component,
366
379
  args: [{
367
380
  template: '',
@@ -511,10 +524,10 @@ class PartEditorService {
511
524
  });
512
525
  });
513
526
  }
514
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.1", ngImport: i0, type: PartEditorService, deps: [{ token: i1.ItemService }, { token: i1.ThesaurusService }], target: i0.ɵɵFactoryTarget.Injectable }); }
515
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.0.1", ngImport: i0, type: PartEditorService, providedIn: 'root' }); }
527
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.7", ngImport: i0, type: PartEditorService, deps: [{ token: i1.ItemService }, { token: i1.ThesaurusService }], target: i0.ɵɵFactoryTarget.Injectable }); }
528
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.7", ngImport: i0, type: PartEditorService, providedIn: 'root' }); }
516
529
  }
517
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.1", ngImport: i0, type: PartEditorService, decorators: [{
530
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.7", ngImport: i0, type: PartEditorService, decorators: [{
518
531
  type: Injectable,
519
532
  args: [{
520
533
  providedIn: 'root',
@@ -653,10 +666,10 @@ class EditPartFeatureBase {
653
666
  close() {
654
667
  this.router.navigate(['items', this.identity.itemId]);
655
668
  }
656
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.1", ngImport: i0, type: EditPartFeatureBase, deps: [{ token: i1$1.Router }, { token: i1$1.ActivatedRoute }, { token: i2.MatSnackBar }, { token: i1.ItemService }, { token: i1.ThesaurusService }, { token: PartEditorService }], target: i0.ɵɵFactoryTarget.Component }); }
657
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.0.1", type: EditPartFeatureBase, selector: "ng-component", ngImport: i0, template: '', isInline: true }); }
669
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.7", ngImport: i0, type: EditPartFeatureBase, deps: [{ token: i1$1.Router }, { token: i1$1.ActivatedRoute }, { token: i2.MatSnackBar }, { token: i1.ItemService }, { token: i1.ThesaurusService }, { token: PartEditorService }], target: i0.ɵɵFactoryTarget.Component }); }
670
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.7", type: EditPartFeatureBase, selector: "ng-component", ngImport: i0, template: '', isInline: true }); }
658
671
  }
659
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.1", ngImport: i0, type: EditPartFeatureBase, decorators: [{
672
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.7", ngImport: i0, type: EditPartFeatureBase, decorators: [{
660
673
  type: Component,
661
674
  args: [{
662
675
  template: '',
@@ -664,20 +677,19 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.1", ngImpor
664
677
  }], ctorParameters: function () { return [{ type: i1$1.Router }, { type: i1$1.ActivatedRoute }, { type: i2.MatSnackBar }, { type: i1.ItemService }, { type: i1.ThesaurusService }, { type: PartEditorService }]; } });
665
678
 
666
679
  class EditedThesaurusRepository {
680
+ get thesaurus$() {
681
+ return this._thesaurus$.asObservable();
682
+ }
667
683
  constructor(_thesaurusService) {
668
684
  this._thesaurusService = _thesaurusService;
669
- this._store = createStore({ name: 'edited-thesaurus' }, withProps({}), withRequestsStatus());
685
+ this._thesaurus$ = new BehaviorSubject(undefined);
670
686
  this._loading$ = new BehaviorSubject(false);
671
687
  this.loading$ = this._loading$.asObservable();
672
688
  this._saving$ = new BehaviorSubject(false);
673
689
  this.saving$ = this._saving$.asObservable();
674
- this.thesaurus$ = this._store.pipe(select((state) => state.thesaurus));
675
- }
676
- getValue() {
677
- return this._store.getValue();
678
690
  }
679
691
  getThesaurus() {
680
- return this._store.query((state) => state.thesaurus);
692
+ return this._thesaurus$.value;
681
693
  }
682
694
  /**
683
695
  * Load the specified thesaurus.
@@ -690,7 +702,7 @@ class EditedThesaurusRepository {
690
702
  this._thesaurusService.getThesaurus(id, true).subscribe({
691
703
  next: (thesaurus) => {
692
704
  this._loading$.next(false);
693
- this._store.update(setProp('thesaurus', thesaurus));
705
+ this._thesaurus$.next(thesaurus);
694
706
  },
695
707
  error: (error) => {
696
708
  this._loading$.next(false);
@@ -699,11 +711,11 @@ class EditedThesaurusRepository {
699
711
  });
700
712
  }
701
713
  else {
702
- this._store.update(setProp('thesaurus', {
714
+ this._thesaurus$.next({
703
715
  id: '',
704
716
  language: 'en',
705
717
  entries: [],
706
- }));
718
+ });
707
719
  }
708
720
  }
709
721
  /**
@@ -729,52 +741,72 @@ class EditedThesaurusRepository {
729
741
  });
730
742
  });
731
743
  }
732
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.1", ngImport: i0, type: EditedThesaurusRepository, deps: [{ token: i1.ThesaurusService }], target: i0.ɵɵFactoryTarget.Injectable }); }
733
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.0.1", ngImport: i0, type: EditedThesaurusRepository, providedIn: 'root' }); }
744
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.7", ngImport: i0, type: EditedThesaurusRepository, deps: [{ token: i1.ThesaurusService }], target: i0.ɵɵFactoryTarget.Injectable }); }
745
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.7", ngImport: i0, type: EditedThesaurusRepository, providedIn: 'root' }); }
734
746
  }
735
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.1", ngImport: i0, type: EditedThesaurusRepository, decorators: [{
747
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.7", ngImport: i0, type: EditedThesaurusRepository, decorators: [{
736
748
  type: Injectable,
737
749
  args: [{ providedIn: 'root' }]
738
750
  }], ctorParameters: function () { return [{ type: i1.ThesaurusService }]; } });
739
751
 
740
752
  /**
741
- * Edited layer part ELF repository.
753
+ * Edited layer part repository.
742
754
  */
743
755
  class EditedLayerRepository {
756
+ get loading$() {
757
+ return this._loading$.asObservable();
758
+ }
759
+ get saving$() {
760
+ return this._saving$.asObservable();
761
+ }
762
+ get part$() {
763
+ return this._part$.asObservable();
764
+ }
765
+ get baseText$() {
766
+ return this._baseText$.asObservable();
767
+ }
768
+ get baseTextPart$() {
769
+ return this._baseTextPart$.asObservable();
770
+ }
771
+ get locations$() {
772
+ return this._locations$.asObservable();
773
+ }
774
+ get breakChance$() {
775
+ return this._breakChance$.asObservable();
776
+ }
777
+ get layerHints$() {
778
+ return this._layerHints$.asObservable();
779
+ }
744
780
  constructor(_itemService, _facetService, _thesaurusService) {
745
781
  this._itemService = _itemService;
746
782
  this._facetService = _facetService;
747
783
  this._thesaurusService = _thesaurusService;
748
- this._store = createStore({ name: 'edited-layer' }, withProps({
749
- locations: [],
750
- breakChance: 0,
751
- layerHints: [],
752
- }), withRequestsStatus());
784
+ this._part$ = new BehaviorSubject(undefined);
785
+ this._baseText$ = new BehaviorSubject(undefined);
786
+ this._baseTextPart$ = new BehaviorSubject(undefined);
787
+ this._locations$ = new BehaviorSubject([]);
788
+ this._breakChance$ = new BehaviorSubject(-1);
789
+ this._layerHints$ = new BehaviorSubject([]);
790
+ this._thesauriSet = new BehaviorSubject(undefined);
753
791
  this._loading$ = new BehaviorSubject(false);
754
- this.loading$ = this._loading$.asObservable();
755
792
  this._saving$ = new BehaviorSubject(false);
756
- this.saving$ = this._saving$.asObservable();
757
- this.part$ = this._store.pipe(select((state) => state.part));
758
- this.baseText$ = this._store.pipe(select((state) => state.baseText));
759
- this.baseTextPart$ = this._store.pipe(select((state) => state.baseTextPart));
760
- this.locations$ = this._store.pipe(select((state) => state.locations));
761
- this.breakChance$ = this._store.pipe(select((state) => state.breakChance));
762
- this.layerHints$ = this._store.pipe(select((state) => state.layerHints));
763
793
  }
764
794
  reset() {
765
- this._store.reset();
766
- }
767
- getValue() {
768
- return this._store.getValue();
795
+ this._part$.next(undefined);
796
+ this._baseText$.next(undefined);
797
+ this._baseTextPart$.next(undefined);
798
+ this._locations$.next([]);
799
+ this._breakChance$.next(-1);
800
+ this._layerHints$.next([]);
769
801
  }
770
802
  getPart() {
771
- return this._store.query((state) => state.part);
803
+ return this._part$.value;
772
804
  }
773
805
  getBaseText() {
774
- return this._store.query((state => state.baseText));
806
+ return this._baseText$.value;
775
807
  }
776
808
  getLocations() {
777
- return this._store.query((state) => state.locations);
809
+ return this._locations$.value;
778
810
  }
779
811
  getPartLocations(part) {
780
812
  const locations = [];
@@ -809,16 +841,13 @@ class EditedLayerRepository {
809
841
  this._thesaurusService.getThesauriSet(scopedIds).subscribe({
810
842
  next: (thesauri) => {
811
843
  this._loading$.next(false);
812
- this._store.update((state) => ({
813
- ...state,
814
- part: result.layerPart,
815
- baseText: result.baseText.text,
816
- baseTextPart: result.baseText.part,
817
- locations: this.getPartLocations(result.layerPart),
818
- breakChance: result.breakChance.chance,
819
- layerHints: result.layerHints,
820
- thesauri: thesauri,
821
- }));
844
+ this._part$.next(result.layerPart);
845
+ this._baseText$.next(result.baseText.text);
846
+ this._baseTextPart$.next(result.baseText.part);
847
+ this._locations$.next(this.getPartLocations(result.layerPart));
848
+ this._breakChance$.next(result.breakChance.chance);
849
+ this._layerHints$.next(result.layerHints);
850
+ this._thesauriSet.next(thesauri);
822
851
  },
823
852
  error: (error) => {
824
853
  this._loading$.next(false);
@@ -828,16 +857,13 @@ class EditedLayerRepository {
828
857
  }
829
858
  else {
830
859
  this._loading$.next(false);
831
- this._store.update((state) => ({
832
- ...state,
833
- part: result.layerPart,
834
- baseText: result.baseText.text,
835
- baseTextPart: result.baseText.part,
836
- locations: this.getPartLocations(result.layerPart),
837
- breakChance: result.breakChance.chance,
838
- layerHints: result.layerHints,
839
- thesauri: result.thesauri,
840
- }));
860
+ this._part$.next(result.layerPart);
861
+ this._baseText$.next(result.baseText.text);
862
+ this._baseTextPart$.next(result.baseText.part);
863
+ this._locations$.next(this.getPartLocations(result.layerPart));
864
+ this._breakChance$.next(result.breakChance.chance);
865
+ this._layerHints$.next(result.layerHints);
866
+ this._thesauriSet.next(result.thesauri);
841
867
  }
842
868
  },
843
869
  error: (error) => {
@@ -858,15 +884,12 @@ class EditedLayerRepository {
858
884
  }).subscribe({
859
885
  next: (result) => {
860
886
  this._loading$.next(false);
861
- this._store.update((state) => ({
862
- ...state,
863
- part: result.layerPart,
864
- baseText: result.baseText.text,
865
- baseTextPart: result.baseText.part,
866
- locations: this.getPartLocations(result.layerPart),
867
- breakChance: result.breakChance.chance,
868
- layerHints: result.layerHints,
869
- }));
887
+ this._part$.next(result.layerPart);
888
+ this._baseText$.next(result.baseText.text);
889
+ this._baseTextPart$.next(result.baseText.part);
890
+ this._locations$.next(this.getPartLocations(result.layerPart));
891
+ this._breakChance$.next(result.breakChance.chance);
892
+ this._layerHints$.next(result.layerHints);
870
893
  },
871
894
  error: (error) => {
872
895
  this._loading$.next(false);
@@ -893,18 +916,17 @@ class EditedLayerRepository {
893
916
  * Refresh the layer part break chance.
894
917
  */
895
918
  refreshBreakChance() {
896
- const store = this._store.getValue();
897
- const part = store.part;
919
+ const part = this._part$.value;
898
920
  if (!part) {
899
921
  return;
900
922
  }
901
923
  this._itemService.getLayerPartBreakChance(part.id).subscribe({
902
924
  next: (result) => {
903
- this._store.update(setProp('breakChance', result.chance));
925
+ this._breakChance$.next(result.chance);
904
926
  },
905
927
  error: (error) => {
906
928
  console.error('Error calculating break chance: ' + JSON.stringify(error || {}));
907
- this._store.update(setProp('breakChance', -1));
929
+ this._breakChance$.next(-1);
908
930
  },
909
931
  });
910
932
  }
@@ -928,7 +950,7 @@ class EditedLayerRepository {
928
950
  */
929
951
  deleteFragment(loc) {
930
952
  // find the fragment
931
- let part = this._store.getValue().part;
953
+ let part = this._part$.value;
932
954
  if (!part) {
933
955
  return;
934
956
  }
@@ -964,7 +986,7 @@ class EditedLayerRepository {
964
986
  */
965
987
  saveFragment(fragment) {
966
988
  // find the fragment
967
- let part = this._store.getValue().part;
989
+ let part = this._part$.value;
968
990
  if (!part) {
969
991
  return;
970
992
  }
@@ -1001,28 +1023,28 @@ class EditedLayerRepository {
1001
1023
  },
1002
1024
  });
1003
1025
  }
1004
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.1", ngImport: i0, type: EditedLayerRepository, deps: [{ token: i1.ItemService }, { token: i1.FacetService }, { token: i1.ThesaurusService }], target: i0.ɵɵFactoryTarget.Injectable }); }
1005
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.0.1", ngImport: i0, type: EditedLayerRepository, providedIn: 'root' }); }
1026
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.7", ngImport: i0, type: EditedLayerRepository, deps: [{ token: i1.ItemService }, { token: i1.FacetService }, { token: i1.ThesaurusService }], target: i0.ɵɵFactoryTarget.Injectable }); }
1027
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.7", ngImport: i0, type: EditedLayerRepository, providedIn: 'root' }); }
1006
1028
  }
1007
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.1", ngImport: i0, type: EditedLayerRepository, decorators: [{
1029
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.7", ngImport: i0, type: EditedLayerRepository, decorators: [{
1008
1030
  type: Injectable,
1009
1031
  args: [{ providedIn: 'root' }]
1010
1032
  }], ctorParameters: function () { return [{ type: i1.ItemService }, { type: i1.FacetService }, { type: i1.ThesaurusService }]; } });
1011
1033
 
1012
1034
  class CadmusStateModule {
1013
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.1", ngImport: i0, type: CadmusStateModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
1014
- static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.0.1", ngImport: i0, type: CadmusStateModule, imports: [CommonModule,
1035
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.7", ngImport: i0, type: CadmusStateModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
1036
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.2.7", ngImport: i0, type: CadmusStateModule, imports: [CommonModule,
1015
1037
  // Cadmus
1016
1038
  CadmusCoreModule,
1017
1039
  CadmusApiModule,
1018
1040
  NgToolsModule] }); }
1019
- static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.0.1", ngImport: i0, type: CadmusStateModule, imports: [CommonModule,
1041
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.2.7", ngImport: i0, type: CadmusStateModule, imports: [CommonModule,
1020
1042
  // Cadmus
1021
1043
  CadmusCoreModule,
1022
1044
  CadmusApiModule,
1023
1045
  NgToolsModule] }); }
1024
1046
  }
1025
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.1", ngImport: i0, type: CadmusStateModule, decorators: [{
1047
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.7", ngImport: i0, type: CadmusStateModule, decorators: [{
1026
1048
  type: NgModule,
1027
1049
  args: [{
1028
1050
  imports: [