@myrmidon/cadmus-state 0.0.8 → 0.2.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 (78) hide show
  1. package/README.md +24 -24
  2. package/esm2020/lib/app.query.mjs +29 -0
  3. package/esm2020/lib/app.service.mjs +43 -0
  4. package/esm2020/lib/app.store.mjs +26 -0
  5. package/esm2020/lib/cadmus-state.module.mjs +34 -0
  6. package/esm2020/lib/edit-fragment-feature-base.mjs +115 -0
  7. package/esm2020/lib/edit-fragment-query-base.mjs +32 -0
  8. package/esm2020/lib/edit-fragment-service-base.mjs +137 -0
  9. package/esm2020/lib/edit-fragment.store.mjs +39 -0
  10. package/esm2020/lib/edit-item.query.mjs +52 -0
  11. package/esm2020/lib/edit-item.service.mjs +182 -0
  12. package/esm2020/lib/edit-item.store.mjs +47 -0
  13. package/esm2020/lib/edit-layer-part.query.mjs +35 -0
  14. package/esm2020/lib/edit-layer-part.service.mjs +230 -0
  15. package/esm2020/lib/edit-layer-part.store.mjs +53 -0
  16. package/esm2020/lib/edit-part-feature-base.mjs +116 -0
  17. package/esm2020/lib/edit-part-query-base.mjs +25 -0
  18. package/esm2020/lib/edit-part-service-base.mjs +120 -0
  19. package/esm2020/lib/edit-part.store.mjs +39 -0
  20. package/esm2020/lib/edit-thesaurus.query.mjs +26 -0
  21. package/esm2020/lib/edit-thesaurus.service.mjs +59 -0
  22. package/esm2020/lib/edit-thesaurus.store.mjs +37 -0
  23. package/{esm2015/myrmidon-cadmus-state.js → esm2020/myrmidon-cadmus-state.mjs} +1 -1
  24. package/{esm2015/public-api.js → esm2020/public-api.mjs} +1 -1
  25. package/fesm2015/{myrmidon-cadmus-state.js → myrmidon-cadmus-state.mjs} +316 -255
  26. package/fesm2015/myrmidon-cadmus-state.mjs.map +1 -0
  27. package/fesm2020/myrmidon-cadmus-state.mjs +1418 -0
  28. package/fesm2020/myrmidon-cadmus-state.mjs.map +1 -0
  29. package/lib/app.query.d.ts +3 -0
  30. package/lib/app.service.d.ts +3 -0
  31. package/lib/app.store.d.ts +3 -0
  32. package/lib/cadmus-state.module.d.ts +8 -0
  33. package/lib/edit-fragment-feature-base.d.ts +45 -3
  34. package/lib/edit-fragment-query-base.d.ts +2 -2
  35. package/lib/edit-fragment-service-base.d.ts +10 -7
  36. package/lib/edit-fragment.store.d.ts +3 -0
  37. package/lib/edit-item.query.d.ts +3 -0
  38. package/lib/edit-item.service.d.ts +4 -1
  39. package/lib/edit-item.store.d.ts +3 -0
  40. package/lib/edit-layer-part.query.d.ts +3 -0
  41. package/lib/edit-layer-part.service.d.ts +5 -3
  42. package/lib/edit-layer-part.store.d.ts +3 -0
  43. package/lib/edit-part-feature-base.d.ts +42 -17
  44. package/lib/edit-part-query-base.d.ts +3 -4
  45. package/lib/edit-part-service-base.d.ts +23 -6
  46. package/lib/edit-part.store.d.ts +3 -0
  47. package/lib/edit-thesaurus.query.d.ts +3 -0
  48. package/lib/edit-thesaurus.service.d.ts +4 -1
  49. package/lib/edit-thesaurus.store.d.ts +3 -0
  50. package/myrmidon-cadmus-state.d.ts +1 -0
  51. package/package.json +25 -13
  52. package/bundles/myrmidon-cadmus-state.umd.js +0 -1758
  53. package/bundles/myrmidon-cadmus-state.umd.js.map +0 -1
  54. package/bundles/myrmidon-cadmus-state.umd.min.js +0 -16
  55. package/bundles/myrmidon-cadmus-state.umd.min.js.map +0 -1
  56. package/esm2015/lib/app.query.js +0 -31
  57. package/esm2015/lib/app.service.js +0 -49
  58. package/esm2015/lib/app.store.js +0 -25
  59. package/esm2015/lib/cadmus-state.module.js +0 -19
  60. package/esm2015/lib/edit-fragment-feature-base.js +0 -106
  61. package/esm2015/lib/edit-fragment-query-base.js +0 -29
  62. package/esm2015/lib/edit-fragment-service-base.js +0 -126
  63. package/esm2015/lib/edit-fragment.store.js +0 -38
  64. package/esm2015/lib/edit-item.query.js +0 -56
  65. package/esm2015/lib/edit-item.service.js +0 -184
  66. package/esm2015/lib/edit-item.store.js +0 -46
  67. package/esm2015/lib/edit-layer-part.query.js +0 -37
  68. package/esm2015/lib/edit-layer-part.service.js +0 -238
  69. package/esm2015/lib/edit-layer-part.store.js +0 -52
  70. package/esm2015/lib/edit-part-feature-base.js +0 -107
  71. package/esm2015/lib/edit-part-query-base.js +0 -39
  72. package/esm2015/lib/edit-part-service-base.js +0 -88
  73. package/esm2015/lib/edit-part.store.js +0 -38
  74. package/esm2015/lib/edit-thesaurus.query.js +0 -28
  75. package/esm2015/lib/edit-thesaurus.service.js +0 -63
  76. package/esm2015/lib/edit-thesaurus.store.js +0 -36
  77. package/fesm2015/myrmidon-cadmus-state.js.map +0 -1
  78. package/myrmidon-cadmus-state.metadata.json +0 -1
@@ -1,14 +1,17 @@
1
- import { ɵɵdefineInjectable, Injectable, ɵɵinject, NgModule } from '@angular/core';
1
+ import * as i0 from '@angular/core';
2
+ import { Injectable, NgModule } from '@angular/core';
2
3
  import { Store, StoreConfig, Query } from '@datorama/akita';
3
4
  import { __decorate } from 'tslib';
4
- import { FacetService, FlagService, ThesaurusService, ItemService, CadmusApiModule } from '@myrmidon/cadmus-api';
5
- import { forkJoin, BehaviorSubject } from 'rxjs';
6
- import { LibraryRouteService, TokenLocation, UtilService, CadmusCoreModule } from '@myrmidon/cadmus-core';
7
- import { map } from 'rxjs/operators';
5
+ import { forkJoin } from 'rxjs';
6
+ import * as i2 from '@myrmidon/cadmus-api';
7
+ import { CadmusApiModule } from '@myrmidon/cadmus-api';
8
+ import * as i2$1 from '@myrmidon/cadmus-core';
9
+ import { TokenLocation, CadmusCoreModule } from '@myrmidon/cadmus-core';
10
+ import { deepCopy } from '@myrmidon/ng-tools';
8
11
  import { CommonModule } from '@angular/common';
9
12
  import { CadmusMaterialModule } from '@myrmidon/cadmus-material';
10
13
 
11
- const initialState = {
14
+ const initialState$3 = {
12
15
  facets: [],
13
16
  flags: [],
14
17
  typeThesaurus: null,
@@ -16,17 +19,18 @@ const initialState = {
16
19
  };
17
20
  let AppStore = class AppStore extends Store {
18
21
  constructor() {
19
- super(initialState);
22
+ super(initialState$3);
20
23
  }
21
24
  };
22
- AppStore.ɵprov = ɵɵdefineInjectable({ factory: function AppStore_Factory() { return new AppStore(); }, token: AppStore, providedIn: "root" });
23
- AppStore.decorators = [
24
- { type: Injectable, args: [{ providedIn: 'root' },] }
25
- ];
26
- AppStore.ctorParameters = () => [];
25
+ AppStore.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: AppStore, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
26
+ AppStore.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: AppStore, providedIn: 'root' });
27
27
  AppStore = __decorate([
28
28
  StoreConfig({ name: 'app', resettable: false })
29
- ], AppStore);
29
+ ], AppStore);
30
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: AppStore, decorators: [{
31
+ type: Injectable,
32
+ args: [{ providedIn: 'root' }]
33
+ }], ctorParameters: function () { return []; } });
30
34
 
31
35
  class AppQuery extends Query {
32
36
  constructor(store) {
@@ -46,13 +50,12 @@ class AppQuery extends Query {
46
50
  return this.select((state) => state.itemBrowserThesaurus);
47
51
  }
48
52
  }
49
- AppQuery.ɵprov = ɵɵdefineInjectable({ factory: function AppQuery_Factory() { return new AppQuery(ɵɵinject(AppStore)); }, token: AppQuery, providedIn: "root" });
50
- AppQuery.decorators = [
51
- { type: Injectable, args: [{ providedIn: 'root' },] }
52
- ];
53
- AppQuery.ctorParameters = () => [
54
- { type: AppStore }
55
- ];
53
+ AppQuery.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: AppQuery, deps: [{ token: AppStore }], target: i0.ɵɵFactoryTarget.Injectable });
54
+ AppQuery.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: AppQuery, providedIn: 'root' });
55
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: AppQuery, decorators: [{
56
+ type: Injectable,
57
+ args: [{ providedIn: 'root' }]
58
+ }], ctorParameters: function () { return [{ type: AppStore }]; } });
56
59
 
57
60
  class AppService {
58
61
  constructor(_store, _facetService, _flagService, _thesaurusService) {
@@ -85,18 +88,14 @@ class AppService {
85
88
  });
86
89
  }
87
90
  }
88
- AppService.ɵprov = ɵɵdefineInjectable({ factory: function AppService_Factory() { return new AppService(ɵɵinject(AppStore), ɵɵinject(FacetService), ɵɵinject(FlagService), ɵɵinject(ThesaurusService)); }, token: AppService, providedIn: "root" });
89
- AppService.decorators = [
90
- { type: Injectable, args: [{ providedIn: 'root' },] }
91
- ];
92
- AppService.ctorParameters = () => [
93
- { type: AppStore },
94
- { type: FacetService },
95
- { type: FlagService },
96
- { type: ThesaurusService }
97
- ];
91
+ AppService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: AppService, deps: [{ token: AppStore }, { token: i2.FacetService }, { token: i2.FlagService }, { token: i2.ThesaurusService }], target: i0.ɵɵFactoryTarget.Injectable });
92
+ AppService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: AppService, providedIn: 'root' });
93
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: AppService, decorators: [{
94
+ type: Injectable,
95
+ args: [{ providedIn: 'root' }]
96
+ }], ctorParameters: function () { return [{ type: AppStore }, { type: i2.FacetService }, { type: i2.FlagService }, { type: i2.ThesaurusService }]; } });
98
97
 
99
- const initialState$1 = {
98
+ const initialState$2 = {
100
99
  item: null,
101
100
  parts: [],
102
101
  partGroups: [],
@@ -110,7 +109,7 @@ const initialState$1 = {
110
109
  };
111
110
  let EditItemStore = class EditItemStore extends Store {
112
111
  constructor() {
113
- super(initialState$1);
112
+ super(initialState$2);
114
113
  }
115
114
  setDirty(value = true) {
116
115
  this.update({
@@ -128,14 +127,15 @@ let EditItemStore = class EditItemStore extends Store {
128
127
  });
129
128
  }
130
129
  };
131
- EditItemStore.ɵprov = ɵɵdefineInjectable({ factory: function EditItemStore_Factory() { return new EditItemStore(); }, token: EditItemStore, providedIn: "root" });
132
- EditItemStore.decorators = [
133
- { type: Injectable, args: [{ providedIn: 'root' },] }
134
- ];
135
- EditItemStore.ctorParameters = () => [];
130
+ EditItemStore.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: EditItemStore, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
131
+ EditItemStore.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: EditItemStore, providedIn: 'root' });
136
132
  EditItemStore = __decorate([
137
133
  StoreConfig({ name: 'edit-item', resettable: true })
138
- ], EditItemStore);
134
+ ], EditItemStore);
135
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: EditItemStore, decorators: [{
136
+ type: Injectable,
137
+ args: [{ providedIn: 'root' }]
138
+ }], ctorParameters: function () { return []; } });
139
139
 
140
140
  /**
141
141
  * The query facade to the edit item store.
@@ -177,14 +177,12 @@ class EditItemQuery extends Query {
177
177
  .partKey;
178
178
  }
179
179
  }
180
- EditItemQuery.ɵprov = ɵɵdefineInjectable({ factory: function EditItemQuery_Factory() { return new EditItemQuery(ɵɵinject(EditItemStore), ɵɵinject(LibraryRouteService)); }, token: EditItemQuery, providedIn: "root" });
181
- EditItemQuery.decorators = [
182
- { type: Injectable, args: [{ providedIn: 'root' },] }
183
- ];
184
- EditItemQuery.ctorParameters = () => [
185
- { type: EditItemStore },
186
- { type: LibraryRouteService }
187
- ];
180
+ EditItemQuery.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: EditItemQuery, deps: [{ token: EditItemStore }, { token: i2$1.LibraryRouteService }], target: i0.ɵɵFactoryTarget.Injectable });
181
+ EditItemQuery.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: EditItemQuery, providedIn: 'root' });
182
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: EditItemQuery, decorators: [{
183
+ type: Injectable,
184
+ args: [{ providedIn: 'root' }]
185
+ }], ctorParameters: function () { return [{ type: EditItemStore }, { type: i2$1.LibraryRouteService }]; } });
188
186
 
189
187
  /**
190
188
  * The service which handles the edit item store.
@@ -305,22 +303,26 @@ class EditItemService {
305
303
  */
306
304
  deletePart(id) {
307
305
  this._store.setDeletingPart();
308
- // delete from server
309
- this._itemService.deletePart(id).subscribe((_) => {
310
- this._store.setDeletingPart(false);
311
- // reload the store
312
- this.load(this._store.getValue().item.id);
313
- }, (error) => {
314
- console.log(error);
315
- this._store.setDeletingPart(false);
316
- this._store.setError('Error deleting part ' + id);
306
+ return new Promise((resolve, reject) => {
307
+ // delete from server
308
+ this._itemService.deletePart(id).subscribe((_) => {
309
+ this._store.setDeletingPart(false);
310
+ // reload the store
311
+ this.load(this._store.getValue().item.id);
312
+ resolve(id);
313
+ }, (error) => {
314
+ console.log(error);
315
+ this._store.setDeletingPart(false);
316
+ this._store.setError('Error deleting part ' + id);
317
+ reject(error);
318
+ });
317
319
  });
318
320
  }
319
321
  addNewLayerPart(itemId, typeId, roleId) {
320
322
  const part = {
321
- itemId: itemId,
322
- typeId: typeId,
323
- roleId: roleId,
323
+ itemId,
324
+ typeId,
325
+ roleId,
324
326
  id: null,
325
327
  creatorId: null,
326
328
  userId: null,
@@ -351,16 +353,17 @@ class EditItemService {
351
353
  });
352
354
  }
353
355
  }
354
- EditItemService.ɵprov = ɵɵdefineInjectable({ factory: function EditItemService_Factory() { return new EditItemService(ɵɵinject(EditItemStore), ɵɵinject(AppQuery), ɵɵinject(ItemService)); }, token: EditItemService, providedIn: "root" });
355
- EditItemService.decorators = [
356
- { type: Injectable, args: [{ providedIn: 'root' },] }
357
- ];
358
- EditItemService.ctorParameters = () => [
359
- { type: EditItemStore },
360
- { type: AppQuery },
361
- { type: ItemService }
362
- ];
356
+ EditItemService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: EditItemService, deps: [{ token: EditItemStore }, { token: AppQuery }, { token: i2.ItemService }], target: i0.ɵɵFactoryTarget.Injectable });
357
+ EditItemService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: EditItemService, providedIn: 'root' });
358
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: EditItemService, decorators: [{
359
+ type: Injectable,
360
+ args: [{ providedIn: 'root' }]
361
+ }], ctorParameters: function () { return [{ type: EditItemStore }, { type: AppQuery }, { type: i2.ItemService }]; } });
363
362
 
363
+ /**
364
+ * Base class for fragment feature editors.
365
+ * This is similar to the EditPartFeatureBase class.
366
+ */
364
367
  class EditFragmentFeatureBase {
365
368
  constructor(_router, route, snackbar, _editFrQuery, _editFrService, _editItemQuery, _editItemService, _editLayersQuery, _editLayersService, _libraryRouteService) {
366
369
  var _a;
@@ -380,7 +383,7 @@ class EditFragmentFeatureBase {
380
383
  this.frRoleId = route.snapshot.queryParams.frrid;
381
384
  // connect _stateDirty to the value of the edit state
382
385
  this._editFrQuery.selectDirty().subscribe((d) => {
383
- console.log('fr-state dirty change: ' + d);
386
+ console.log('fr dirty change (from state): ' + d);
384
387
  this._stateDirty = d;
385
388
  });
386
389
  }
@@ -404,8 +407,14 @@ class EditFragmentFeatureBase {
404
407
  this._editLayersService.load(this.itemId, this.partId, thesauriIds);
405
408
  }
406
409
  }
410
+ /**
411
+ * Initialize the editor. You MUST call this in your OnInit.
412
+ *
413
+ * @param thesauriIds The optional ID(s) of the thesauri sets you want
414
+ * to use in your editor.
415
+ */
407
416
  initEditor(thesauriIds) {
408
- this.json$ = this._editFrQuery.selectJson();
417
+ this.fragment$ = this._editFrQuery.selectFragment();
409
418
  this.thesauri$ = this._editFrQuery.selectThesauri();
410
419
  this.baseText$ = this._editLayersQuery.select((state) => state.baseText);
411
420
  this.frLoc = TokenLocation.parse(this.loc);
@@ -423,20 +432,27 @@ class EditFragmentFeatureBase {
423
432
  * @param value The value of the dirty state.
424
433
  */
425
434
  onDirtyChange(value) {
426
- console.log('fr dirty change: ' + value);
435
+ console.log('fr dirty change (from editor): ' + value);
427
436
  this._formDirty = value;
428
437
  }
429
- save(json) {
438
+ /**
439
+ * Save the fragment.
440
+ *
441
+ * @param fragment The fragment to be saved.
442
+ */
443
+ save(fragment) {
444
+ // get a copy of the container part
430
445
  const part = JSON.parse(JSON.stringify(this._editLayersQuery.getValue().part));
431
- const fr = JSON.parse(json);
446
+ // replace the fragment edited in it
432
447
  const frIndex = part.fragments.findIndex((f) => f.location === this.loc);
433
448
  if (frIndex > -1) {
434
- part.fragments.splice(frIndex, 1, fr);
449
+ part.fragments.splice(frIndex, 1, fragment);
435
450
  }
436
451
  else {
437
- part.fragments.push(fr);
452
+ part.fragments.push(fragment);
438
453
  }
439
- this._editFrService.save(JSON.stringify(part)).then((p) => {
454
+ // save the new layer part with the replaced fragment
455
+ this._editFrService.save(part).then((p) => {
440
456
  console.log(p.id);
441
457
  this.snackbar.open('Fragment saved', 'OK', {
442
458
  duration: 3000,
@@ -449,13 +465,6 @@ class EditFragmentFeatureBase {
449
465
  close() {
450
466
  // /items/<id>/<part-group>/<part-typeid>/<part-id>?rid=<role-id>
451
467
  const part = this._editLayersQuery.getValue().part;
452
- // const item = this._editItemQuery.getValue().item;
453
- // const facet: FacetDefinition = this._appQuery.getValue().facets.find(f => {
454
- // return f.id === item.facetId;
455
- // });
456
- // const partDef = facet.partDefinitions.find(d => {
457
- // return d.typeId === part.typeId && d.roleId === d.roleId;
458
- // });
459
468
  const editorKey = this._libraryRouteService.getEditorKeyFromPartType(part.typeId, part.roleId);
460
469
  const url = `/items/${this.itemId}/${editorKey.partKey}/${part.typeId}/${this.partId}`;
461
470
  this._router.navigate([url], {
@@ -477,17 +486,21 @@ class EditFragmentQueryBase extends Query {
477
486
  selectSaving() {
478
487
  return this.select((state) => state.saving);
479
488
  }
480
- selectJson() {
481
- return this.select((state) => state.fragment).pipe(map((fr) => {
482
- // supply IDs
483
- if (fr) {
484
- return JSON.stringify(fr);
485
- }
486
- else {
487
- return '{}';
488
- }
489
- }));
490
- }
489
+ selectFragment() {
490
+ return this.select((state) => state.fragment);
491
+ }
492
+ // public selectJson(): Observable<string> {
493
+ // return this.select((state) => state.fragment).pipe(
494
+ // map((fr: Fragment) => {
495
+ // // supply IDs
496
+ // if (fr) {
497
+ // return JSON.stringify(fr);
498
+ // } else {
499
+ // return '{}';
500
+ // }
501
+ // })
502
+ // );
503
+ // }
491
504
  selectThesauri() {
492
505
  return this.select((state) => state.thesauri);
493
506
  }
@@ -517,17 +530,18 @@ let EditFragmentStore = class EditFragmentStore extends Store {
517
530
  this.update({ saving: value });
518
531
  }
519
532
  };
520
- EditFragmentStore.ɵprov = ɵɵdefineInjectable({ factory: function EditFragmentStore_Factory() { return new EditFragmentStore(); }, token: EditFragmentStore, providedIn: "root" });
521
- EditFragmentStore.decorators = [
522
- { type: Injectable, args: [{ providedIn: 'root' },] }
523
- ];
524
- EditFragmentStore.ctorParameters = () => [];
533
+ EditFragmentStore.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: EditFragmentStore, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
534
+ EditFragmentStore.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: EditFragmentStore, providedIn: 'root' });
525
535
  EditFragmentStore = __decorate([
526
536
  StoreConfig({ name: 'edit-fragment' })
527
- ], EditFragmentStore);
537
+ ], EditFragmentStore);
538
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: EditFragmentStore, decorators: [{
539
+ type: Injectable,
540
+ args: [{ providedIn: 'root' }]
541
+ }], ctorParameters: function () { return []; } });
528
542
 
529
543
  /**
530
- * Base class for fragment editing services.
544
+ * Base class for fragment editor services.
531
545
  */
532
546
  class EditFragmentServiceBase {
533
547
  constructor(_itemService, _thesaurusService) {
@@ -535,24 +549,30 @@ class EditFragmentServiceBase {
535
549
  this._thesaurusService = _thesaurusService;
536
550
  }
537
551
  /**
538
- * Load the specified fragment and thesauri.
552
+ * Load into the state the fragment with the specified ID
553
+ * and its thesauri.
539
554
  *
540
555
  * @param partId The ID of the part the fragment belongs to.
541
556
  * @param loc The fragment's location.
542
- * @param thesauriIds The optional requested thesauri IDs.
557
+ * @param thesauriIds The thesauri IDs array, or null.
543
558
  */
544
559
  load(partId, loc, thesauriIds = null) {
560
+ // signal that we're loading
545
561
  this.store.setLoading(true);
562
+ // if thesauri are required:
546
563
  if (thesauriIds) {
547
564
  // remove trailing ! from IDs if any
548
565
  const unscopedIds = thesauriIds.map((id) => {
549
566
  return this._thesaurusService.getScopedId(id, null);
550
567
  });
551
- forkJoin([
552
- this._itemService.getPart(partId),
553
- this._thesaurusService.getThesauriSet(unscopedIds),
554
- ]).subscribe(([part, thesauri]) => {
555
- const layerPart = part;
568
+ // fetch fragment and thesauri
569
+ forkJoin({
570
+ part: this._itemService.getPart(partId),
571
+ thesauri: this._thesaurusService.getThesauriSet(unscopedIds),
572
+ }).subscribe((result) => {
573
+ // loading has ended
574
+ this.store.setLoading(false);
575
+ const layerPart = result.part;
556
576
  const fr = layerPart.fragments.find((f) => f.location === loc);
557
577
  if (!fr) {
558
578
  // not found: new fragment
@@ -560,7 +580,7 @@ class EditFragmentServiceBase {
560
580
  fragment: {
561
581
  location: loc,
562
582
  },
563
- thesauri,
583
+ thesauri: result.thesauri,
564
584
  loading: false,
565
585
  error: null,
566
586
  });
@@ -569,20 +589,23 @@ class EditFragmentServiceBase {
569
589
  // found: existing fragment
570
590
  this.store.update({
571
591
  fragment: fr,
572
- thesauri,
592
+ thesauri: result.thesauri,
573
593
  loading: false,
574
594
  error: null,
575
595
  });
576
596
  }
577
597
  // if the loaded layer part has a thesaurus scope, reload the thesauri
578
- if (part.thesaurusScope) {
598
+ if (result.part.thesaurusScope) {
579
599
  const scopedIds = thesauriIds.map((id) => {
580
- return this._thesaurusService.getScopedId(id, part.thesaurusScope);
600
+ return this._thesaurusService.getScopedId(id, result.part.thesaurusScope);
581
601
  });
602
+ // loading again
582
603
  this.store.setLoading(true);
583
- this._thesaurusService.getThesauriSet(scopedIds).subscribe((scopedThesauri) => {
604
+ this._thesaurusService.getThesauriSet(scopedIds).subscribe((thesauri) => {
605
+ // completed, replace the thesauri
584
606
  this.store.update({
585
- thesauri: scopedThesauri,
607
+ thesauri,
608
+ loading: false
586
609
  });
587
610
  }, (error) => {
588
611
  console.error(error);
@@ -593,6 +616,7 @@ class EditFragmentServiceBase {
593
616
  });
594
617
  }
595
618
  else {
619
+ // without thesauri to be fetched, just fetch the part
596
620
  this._itemService.getPart(partId).subscribe((part) => {
597
621
  const layerPart = part;
598
622
  const fr = layerPart.fragments.find((f) => f.location === loc);
@@ -616,32 +640,33 @@ class EditFragmentServiceBase {
616
640
  }, (error) => {
617
641
  console.error(error);
618
642
  this.store.setLoading(false);
619
- this.store.setError('Error loading part ' + partId);
643
+ this.store.setError('Error loading fragment\'s part ' + partId);
620
644
  });
621
645
  }
622
646
  }
623
647
  /**
624
- * Save the fragments serialized into the specified JSON code
625
- * representing their part.
648
+ * Save the fragments in their layer part.
626
649
  *
627
- * @param json The JSON code representing the fragment.
650
+ * @param part The part.
628
651
  * @returns Promise which when successful returns the
629
652
  * saved part (which contains the fragment being saved).
630
653
  */
631
- save(json) {
654
+ save(part) {
632
655
  this.store.setSaving(true);
633
656
  this.store.setDirty(true);
634
657
  return new Promise((resolve, reject) => {
635
- this._itemService.addPartJson(json).subscribe((part) => {
636
- this.store.update({ part });
637
- this.store.setSaving(false);
638
- this.store.setDirty(false);
639
- this.store.setError(null);
658
+ this._itemService.addPart(part).subscribe((saved) => {
659
+ this.store.update({
660
+ part: saved,
661
+ saving: false,
662
+ dirty: false,
663
+ error: null,
664
+ });
640
665
  resolve(part);
641
666
  }, (error) => {
642
667
  console.error(error);
643
668
  this.store.setSaving(false);
644
- this.store.setError('Error saving fragment');
669
+ this.store.setError('Error saving fragment\'s part');
645
670
  reject(error);
646
671
  });
647
672
  });
@@ -653,16 +678,17 @@ class EditFragmentServiceBase {
653
678
 
654
679
  /**
655
680
  * Base class for part feature editors.
656
- * A part feature editor is a wrapper component, linking a part edit state
657
- * (accessed from a part query and loaded with a part service) to a corresponding
658
- * child UI editor.
659
- * It implements ComponentCanDeactivate to allow using the PendingChangesGuard.
660
- * To this end, it tracks the dirty state of the edited data coming from 2
661
- * different sources: the wrapped editor state (from its "root" form), and
662
- * the store edit state. This is set to dirty when a save attempt fails.
663
- * Thus, at the end the user will be prompted when closing an editor either
664
- * because he has changed data in it, or because he attempted a save without
665
- * success.
681
+ * A part feature editor is a wrapper component, linking a part edit
682
+ * state (accessed from a part query and loaded with a part service)
683
+ * to a corresponding wrapped UI editor.
684
+ * It implements ComponentCanDeactivate to allow using the
685
+ * PendingChangesGuard. To this end, it tracks the dirty state of
686
+ * the edited data coming from 2 different sources: the wrapped editor
687
+ * state (from its "root" form), and the store edit state. This is
688
+ * set to dirty when a save attempt fails.
689
+ * Thus, at the end the user will be prompted when closing an editor
690
+ * either because he has changed data in it, or because he attempted
691
+ * a save without success.
666
692
  */
667
693
  class EditPartFeatureBase {
668
694
  constructor(router, route, snackbar, _editPartQuery, _editPartService, _editItemQuery, _editItemService) {
@@ -672,18 +698,23 @@ class EditPartFeatureBase {
672
698
  this._editPartService = _editPartService;
673
699
  this._editItemQuery = _editItemQuery;
674
700
  this._editItemService = _editItemService;
701
+ // item ID
675
702
  this.itemId = route.snapshot.params.iid;
703
+ // type ID (from "TYPEID/:pid")
704
+ this.typeId = route.snapshot.routeConfig.path.substr(0, route.snapshot.routeConfig.path.indexOf('/'));
705
+ // part ID or null (if "new")
676
706
  this.partId = route.snapshot.params.pid;
677
707
  if (this.partId === 'new') {
678
708
  this.partId = null;
679
709
  }
710
+ // role ID or null (if "default")
680
711
  this.roleId = route.snapshot.queryParams.rid;
681
712
  if (this.roleId === 'default') {
682
713
  this.roleId = null;
683
714
  }
684
- // connect _stateDirty to the value of the edit state
715
+ // connect _stateDirty to the value observed in the part state
685
716
  this._editPartQuery.selectDirty().subscribe((d) => {
686
- console.log('part-state dirty change: ' + d);
717
+ console.log('part dirty change (from state): ' + d);
687
718
  this._stateDirty = d;
688
719
  });
689
720
  }
@@ -704,43 +735,47 @@ class EditPartFeatureBase {
704
735
  }
705
736
  /**
706
737
  * Initialize the editor. You MUST call this in your OnInit.
738
+ *
707
739
  * @param thesauriIds The optional ID(s) of the thesauri sets you want
708
740
  * to use in your editor.
709
741
  */
710
742
  initEditor(thesauriIds) {
711
- this.json$ = new BehaviorSubject('{}');
712
- this._editPartQuery.selectJson(this.itemId, this.partId, this.roleId).subscribe(json => {
713
- this.json$.next(json);
714
- });
743
+ // connect part and thesauri to state via query
744
+ this.part$ = this._editPartQuery.selectPart();
715
745
  this.thesauri$ = this._editPartQuery.selectThesauri();
716
746
  // load item if required
717
747
  this.ensureItemLoaded(this.itemId);
718
748
  // load part (none if new) and thesauri
719
- this._editPartService.load(this.partId, thesauriIds);
749
+ this._editPartService.load(this.partId, // a new part has null here
750
+ thesauriIds,
751
+ // for a new part, we must supply item and role
752
+ this.itemId, this.typeId, this.roleId);
720
753
  }
721
754
  /**
722
755
  * Called when the wrapped editor dirty state changes.
723
756
  * In the HTML template, you MUST bind this handler to the dirtyChange event
724
757
  * emitted by your wrapped editor (i.e. (dirtyChange)="onDirtyChange($event)").
758
+ *
725
759
  * @param value The value of the dirty state.
726
760
  */
727
761
  onDirtyChange(value) {
728
- console.log('part dirty change: ' + value);
762
+ console.log('part dirty change (from editor): ' + value);
729
763
  this._formDirty = value;
730
764
  }
731
765
  /**
732
766
  * Save the part.
733
- * @param json The JSON code representing the edited part.
767
+ *
768
+ * @param part The part to be saved.
734
769
  */
735
- save(json) {
736
- this._editPartService.save(json).then((part) => {
737
- // update part ID if it was null (new part)
770
+ save(part) {
771
+ // save via part service, which invokes item service
772
+ // for the backend, and then updates the part's store
773
+ this._editPartService.save(part).then((saved) => {
774
+ // update the route-defined part ID if it was null (new part)
738
775
  if (!this.partId) {
739
- this.partId = part.id;
776
+ this.partId = saved.id;
740
777
  }
741
- console.log('Part saved: ' + part.id);
742
- // emit the updated saved part
743
- this.json$.next(json);
778
+ console.log('Part saved: ' + saved.id);
744
779
  this.snackbar.open('Part saved', 'OK', {
745
780
  duration: 3000,
746
781
  });
@@ -763,10 +798,9 @@ class EditPartFeatureBase {
763
798
  * part's store to the constructor.
764
799
  */
765
800
  class EditPartQueryBase extends Query {
766
- constructor(store, _utilService) {
801
+ constructor(store) {
767
802
  super(store);
768
803
  this.store = store;
769
- this._utilService = _utilService;
770
804
  }
771
805
  selectDirty() {
772
806
  return this.select((state) => state.dirty);
@@ -774,46 +808,60 @@ class EditPartQueryBase extends Query {
774
808
  selectSaving() {
775
809
  return this.select((state) => state.saving);
776
810
  }
777
- selectJson(itemId, partId, roleId) {
778
- return this.select((state) => state.part).pipe(map((part) => {
779
- // supply IDs
780
- if (part) {
781
- const clone = this._utilService.deepCopy(part);
782
- clone.itemId = itemId;
783
- clone.id = partId;
784
- clone.roleId = roleId;
785
- return JSON.stringify(clone);
786
- }
787
- else {
788
- return '{}';
789
- }
790
- }));
811
+ selectPart() {
812
+ return this.select((state) => state.part);
791
813
  }
792
814
  selectThesauri() {
793
815
  return this.select((state) => state.thesauri);
794
816
  }
795
817
  }
796
818
 
819
+ /**
820
+ * Base class for part editor services.
821
+ */
797
822
  class EditPartServiceBase {
798
823
  constructor(itemService, thesaurusService) {
799
824
  this.itemService = itemService;
800
825
  this.thesaurusService = thesaurusService;
801
826
  }
802
- load(partId, thesauriIds = null) {
827
+ /**
828
+ * Load into the state the part with the specified ID
829
+ * and its thesauri.
830
+ * If the ID is not specified, it's a new part; in this case,
831
+ * it will get a null ID, but use the specified itemId and roleId.
832
+ *
833
+ * @param partId The part ID, unless it's a new part.
834
+ * @param thesauriIds The thesauri IDs array, or null.
835
+ * @param itemId The item ID for the new part.
836
+ * @param typeId The part type ID for the new part.
837
+ * @param roleId The role ID for the new part.
838
+ */
839
+ load(partId, thesauriIds = null, itemId, typeId, roleId) {
840
+ // signal that we're loading
803
841
  this.store.setLoading(true);
842
+ // if thesauri are required:
804
843
  if (thesauriIds) {
805
844
  // remove trailing ! from IDs if any
806
845
  const unscopedIds = thesauriIds.map((id) => {
807
846
  return this.thesaurusService.getScopedId(id, null);
808
847
  });
848
+ // fetch part and thesauri
809
849
  forkJoin({
810
850
  part: this.itemService.getPart(partId),
811
851
  thesauri: this.thesaurusService.getThesauriSet(unscopedIds),
812
852
  }).subscribe((result) => {
813
853
  var _a;
854
+ // loading has ended
814
855
  this.store.setLoading(false);
856
+ // update the store with a new or existing part,
857
+ // and its requested thesauri
815
858
  this.store.update({
816
- part: result.part,
859
+ part: result.part || {
860
+ id: null,
861
+ itemId,
862
+ typeId,
863
+ roleId,
864
+ },
817
865
  thesauri: result.thesauri,
818
866
  });
819
867
  // if the loaded part has a thesaurus scope, reload the thesauri
@@ -821,10 +869,13 @@ class EditPartServiceBase {
821
869
  const scopedIds = thesauriIds.map((id) => {
822
870
  return this.thesaurusService.getScopedId(id, result.part.thesaurusScope);
823
871
  });
872
+ // loading again
824
873
  this.store.setLoading(true);
825
- this.thesaurusService.getThesauriSet(thesauriIds).subscribe((thesauri) => {
874
+ this.thesaurusService.getThesauriSet(scopedIds).subscribe((thesauri) => {
875
+ // completed, replace the thesauri
826
876
  this.store.update({
827
877
  thesauri,
878
+ loading: false,
828
879
  });
829
880
  }, (error) => {
830
881
  console.error(error);
@@ -835,12 +886,15 @@ class EditPartServiceBase {
835
886
  });
836
887
  }
837
888
  else {
838
- if (!partId) {
839
- return;
840
- }
889
+ // without thesauri to be fetched, just fetch the part
841
890
  this.itemService.getPart(partId).subscribe((part) => {
842
891
  this.store.update({
843
- part,
892
+ part: part || {
893
+ id: null,
894
+ itemId,
895
+ typeId,
896
+ roleId,
897
+ },
844
898
  loading: false,
845
899
  error: null,
846
900
  });
@@ -852,21 +906,22 @@ class EditPartServiceBase {
852
906
  }
853
907
  }
854
908
  /**
855
- * Save the JSON code representing a part.
909
+ * Save the part.
856
910
  *
857
- * @param json The JSON code representing the part.
858
- * @returns Promise which when successful returns the
859
- * saved part.
911
+ * @param part The part.
912
+ * @returns Promise which when successful returns the saved part.
860
913
  */
861
- save(json) {
914
+ save(part) {
862
915
  this.store.setSaving(true);
863
916
  this.store.setDirty(true);
864
917
  return new Promise((resolve, reject) => {
865
- this.itemService.addPartJson(json).subscribe((part) => {
866
- this.store.update({ part });
867
- this.store.setSaving(false);
868
- this.store.setDirty(false);
869
- this.store.setError(null);
918
+ this.itemService.addPart(part).subscribe((saved) => {
919
+ this.store.update({
920
+ part: saved,
921
+ saving: false,
922
+ dirty: false,
923
+ error: null,
924
+ });
870
925
  resolve(part);
871
926
  }, (error) => {
872
927
  console.error(error);
@@ -887,7 +942,7 @@ const editPartInitialState = {
887
942
  dirty: false,
888
943
  saving: false,
889
944
  loading: false,
890
- error: null
945
+ error: null,
891
946
  };
892
947
  /**
893
948
  * General-purpose edit-part store. This can be used with any part, so that
@@ -905,16 +960,17 @@ let EditPartStore = class EditPartStore extends Store {
905
960
  this.update({ saving: value });
906
961
  }
907
962
  };
908
- EditPartStore.ɵprov = ɵɵdefineInjectable({ factory: function EditPartStore_Factory() { return new EditPartStore(); }, token: EditPartStore, providedIn: "root" });
909
- EditPartStore.decorators = [
910
- { type: Injectable, args: [{ providedIn: 'root' },] }
911
- ];
912
- EditPartStore.ctorParameters = () => [];
963
+ EditPartStore.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: EditPartStore, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
964
+ EditPartStore.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: EditPartStore, providedIn: 'root' });
913
965
  EditPartStore = __decorate([
914
966
  StoreConfig({ name: 'edit-part' })
915
- ], EditPartStore);
967
+ ], EditPartStore);
968
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: EditPartStore, decorators: [{
969
+ type: Injectable,
970
+ args: [{ providedIn: 'root' }]
971
+ }], ctorParameters: function () { return []; } });
916
972
 
917
- const initialState$2 = {
973
+ const initialState$1 = {
918
974
  part: null,
919
975
  baseText: null,
920
976
  baseTextPart: null,
@@ -931,7 +987,7 @@ const initialState$2 = {
931
987
  };
932
988
  let EditLayerPartStore = class EditLayerPartStore extends Store {
933
989
  constructor() {
934
- super(initialState$2);
990
+ super(initialState$1);
935
991
  }
936
992
  setDeletingFragment(value = true) {
937
993
  this.update({ deletingFragment: value });
@@ -952,14 +1008,15 @@ let EditLayerPartStore = class EditLayerPartStore extends Store {
952
1008
  this.update({ locations });
953
1009
  }
954
1010
  };
955
- EditLayerPartStore.ɵprov = ɵɵdefineInjectable({ factory: function EditLayerPartStore_Factory() { return new EditLayerPartStore(); }, token: EditLayerPartStore, providedIn: "root" });
956
- EditLayerPartStore.decorators = [
957
- { type: Injectable, args: [{ providedIn: 'root' },] }
958
- ];
959
- EditLayerPartStore.ctorParameters = () => [];
1011
+ EditLayerPartStore.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: EditLayerPartStore, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1012
+ EditLayerPartStore.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: EditLayerPartStore, providedIn: 'root' });
960
1013
  EditLayerPartStore = __decorate([
961
1014
  StoreConfig({ name: 'edit-layer-part' })
962
- ], EditLayerPartStore);
1015
+ ], EditLayerPartStore);
1016
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: EditLayerPartStore, decorators: [{
1017
+ type: Injectable,
1018
+ args: [{ providedIn: 'root' }]
1019
+ }], ctorParameters: function () { return []; } });
963
1020
 
964
1021
  class EditLayerPartQuery extends Query {
965
1022
  constructor(store) {
@@ -985,20 +1042,18 @@ class EditLayerPartQuery extends Query {
985
1042
  return this.select((state) => state.patchingLayer);
986
1043
  }
987
1044
  }
988
- EditLayerPartQuery.ɵprov = ɵɵdefineInjectable({ factory: function EditLayerPartQuery_Factory() { return new EditLayerPartQuery(ɵɵinject(EditLayerPartStore)); }, token: EditLayerPartQuery, providedIn: "root" });
989
- EditLayerPartQuery.decorators = [
990
- { type: Injectable, args: [{ providedIn: 'root' },] }
991
- ];
992
- EditLayerPartQuery.ctorParameters = () => [
993
- { type: EditLayerPartStore }
994
- ];
1045
+ EditLayerPartQuery.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: EditLayerPartQuery, deps: [{ token: EditLayerPartStore }], target: i0.ɵɵFactoryTarget.Injectable });
1046
+ EditLayerPartQuery.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: EditLayerPartQuery, providedIn: 'root' });
1047
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: EditLayerPartQuery, decorators: [{
1048
+ type: Injectable,
1049
+ args: [{ providedIn: 'root' }]
1050
+ }], ctorParameters: function () { return [{ type: EditLayerPartStore }]; } });
995
1051
 
996
1052
  class EditLayerPartService {
997
- constructor(_store, _itemService, _facetService, _utilService, _thesaurusService) {
1053
+ constructor(_store, _itemService, _facetService, _thesaurusService) {
998
1054
  this._store = _store;
999
1055
  this._itemService = _itemService;
1000
1056
  this._facetService = _facetService;
1001
- this._utilService = _utilService;
1002
1057
  this._thesaurusService = _thesaurusService;
1003
1058
  }
1004
1059
  getLocations(part) {
@@ -1146,7 +1201,7 @@ class EditLayerPartService {
1146
1201
  }
1147
1202
  // remove it from the part
1148
1203
  // work on a copy, as store objects are immutable
1149
- part = this._utilService.deepCopy(part);
1204
+ part = deepCopy(part);
1150
1205
  part.fragments.splice(i, 1);
1151
1206
  // update the part and reload state once done
1152
1207
  this._itemService.addPart(part).subscribe((_) => {
@@ -1177,7 +1232,7 @@ class EditLayerPartService {
1177
1232
  }
1178
1233
  // add or replace it
1179
1234
  // work on a copy, as store objects are immutable
1180
- part = this._utilService.deepCopy(part);
1235
+ part = deepCopy(part);
1181
1236
  // replace all the overlapping fragments with the new one
1182
1237
  const newLoc = TokenLocation.parse(fragment.location);
1183
1238
  let insertAt = 0;
@@ -1210,19 +1265,14 @@ class EditLayerPartService {
1210
1265
  });
1211
1266
  }
1212
1267
  }
1213
- EditLayerPartService.ɵprov = ɵɵdefineInjectable({ factory: function EditLayerPartService_Factory() { return new EditLayerPartService(ɵɵinject(EditLayerPartStore), ɵɵinject(ItemService), ɵɵinject(FacetService), ɵɵinject(UtilService), ɵɵinject(ThesaurusService)); }, token: EditLayerPartService, providedIn: "root" });
1214
- EditLayerPartService.decorators = [
1215
- { type: Injectable, args: [{ providedIn: 'root' },] }
1216
- ];
1217
- EditLayerPartService.ctorParameters = () => [
1218
- { type: EditLayerPartStore },
1219
- { type: ItemService },
1220
- { type: FacetService },
1221
- { type: UtilService },
1222
- { type: ThesaurusService }
1223
- ];
1268
+ EditLayerPartService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: EditLayerPartService, deps: [{ token: EditLayerPartStore }, { token: i2.ItemService }, { token: i2.FacetService }, { token: i2.ThesaurusService }], target: i0.ɵɵFactoryTarget.Injectable });
1269
+ EditLayerPartService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: EditLayerPartService, providedIn: 'root' });
1270
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: EditLayerPartService, decorators: [{
1271
+ type: Injectable,
1272
+ args: [{ providedIn: 'root' }]
1273
+ }], ctorParameters: function () { return [{ type: EditLayerPartStore }, { type: i2.ItemService }, { type: i2.FacetService }, { type: i2.ThesaurusService }]; } });
1224
1274
 
1225
- const initialState$3 = {
1275
+ const initialState = {
1226
1276
  thesaurus: null,
1227
1277
  dirty: false,
1228
1278
  saving: false,
@@ -1231,7 +1281,7 @@ const initialState$3 = {
1231
1281
  };
1232
1282
  let EditThesaurusStore = class EditThesaurusStore extends Store {
1233
1283
  constructor() {
1234
- super(initialState$3);
1284
+ super(initialState);
1235
1285
  }
1236
1286
  setDirty(value = true) {
1237
1287
  this.update({
@@ -1244,14 +1294,15 @@ let EditThesaurusStore = class EditThesaurusStore extends Store {
1244
1294
  });
1245
1295
  }
1246
1296
  };
1247
- EditThesaurusStore.ɵprov = ɵɵdefineInjectable({ factory: function EditThesaurusStore_Factory() { return new EditThesaurusStore(); }, token: EditThesaurusStore, providedIn: "root" });
1248
- EditThesaurusStore.decorators = [
1249
- { type: Injectable, args: [{ providedIn: 'root' },] }
1250
- ];
1251
- EditThesaurusStore.ctorParameters = () => [];
1297
+ EditThesaurusStore.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: EditThesaurusStore, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1298
+ EditThesaurusStore.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: EditThesaurusStore, providedIn: 'root' });
1252
1299
  EditThesaurusStore = __decorate([
1253
1300
  StoreConfig({ name: 'edit-thesaurus', resettable: true })
1254
- ], EditThesaurusStore);
1301
+ ], EditThesaurusStore);
1302
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: EditThesaurusStore, decorators: [{
1303
+ type: Injectable,
1304
+ args: [{ providedIn: 'root' }]
1305
+ }], ctorParameters: function () { return []; } });
1255
1306
 
1256
1307
  class EditThesaurusQuery extends Query {
1257
1308
  constructor(store) {
@@ -1268,13 +1319,12 @@ class EditThesaurusQuery extends Query {
1268
1319
  return this.select(state => state.saving);
1269
1320
  }
1270
1321
  }
1271
- EditThesaurusQuery.ɵprov = ɵɵdefineInjectable({ factory: function EditThesaurusQuery_Factory() { return new EditThesaurusQuery(ɵɵinject(EditThesaurusStore)); }, token: EditThesaurusQuery, providedIn: "root" });
1272
- EditThesaurusQuery.decorators = [
1273
- { type: Injectable, args: [{ providedIn: 'root' },] }
1274
- ];
1275
- EditThesaurusQuery.ctorParameters = () => [
1276
- { type: EditThesaurusStore }
1277
- ];
1322
+ EditThesaurusQuery.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: EditThesaurusQuery, deps: [{ token: EditThesaurusStore }], target: i0.ɵɵFactoryTarget.Injectable });
1323
+ EditThesaurusQuery.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: EditThesaurusQuery, providedIn: 'root' });
1324
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: EditThesaurusQuery, decorators: [{
1325
+ type: Injectable,
1326
+ args: [{ providedIn: 'root' }]
1327
+ }], ctorParameters: function () { return [{ type: EditThesaurusStore }]; } });
1278
1328
 
1279
1329
  class EditThesaurusService {
1280
1330
  constructor(_store, _thesaurusService) {
@@ -1324,28 +1374,40 @@ class EditThesaurusService {
1324
1374
  });
1325
1375
  }
1326
1376
  }
1327
- EditThesaurusService.ɵprov = ɵɵdefineInjectable({ factory: function EditThesaurusService_Factory() { return new EditThesaurusService(ɵɵinject(EditThesaurusStore), ɵɵinject(ThesaurusService)); }, token: EditThesaurusService, providedIn: "root" });
1328
- EditThesaurusService.decorators = [
1329
- { type: Injectable, args: [{ providedIn: 'root' },] }
1330
- ];
1331
- EditThesaurusService.ctorParameters = () => [
1332
- { type: EditThesaurusStore },
1333
- { type: ThesaurusService }
1334
- ];
1377
+ EditThesaurusService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: EditThesaurusService, deps: [{ token: EditThesaurusStore }, { token: i2.ThesaurusService }], target: i0.ɵɵFactoryTarget.Injectable });
1378
+ EditThesaurusService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: EditThesaurusService, providedIn: 'root' });
1379
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: EditThesaurusService, decorators: [{
1380
+ type: Injectable,
1381
+ args: [{ providedIn: 'root' }]
1382
+ }], ctorParameters: function () { return [{ type: EditThesaurusStore }, { type: i2.ThesaurusService }]; } });
1335
1383
 
1336
1384
  class CadmusStateModule {
1337
1385
  }
1338
- CadmusStateModule.decorators = [
1339
- { type: NgModule, args: [{
1340
- imports: [
1341
- CommonModule,
1342
- // Cadmus
1343
- CadmusCoreModule,
1344
- CadmusApiModule,
1345
- CadmusMaterialModule,
1346
- ],
1347
- },] }
1348
- ];
1386
+ CadmusStateModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: CadmusStateModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1387
+ CadmusStateModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: CadmusStateModule, imports: [CommonModule,
1388
+ // Cadmus
1389
+ CadmusCoreModule,
1390
+ CadmusApiModule,
1391
+ CadmusMaterialModule] });
1392
+ CadmusStateModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: CadmusStateModule, imports: [[
1393
+ CommonModule,
1394
+ // Cadmus
1395
+ CadmusCoreModule,
1396
+ CadmusApiModule,
1397
+ CadmusMaterialModule,
1398
+ ]] });
1399
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: CadmusStateModule, decorators: [{
1400
+ type: NgModule,
1401
+ args: [{
1402
+ imports: [
1403
+ CommonModule,
1404
+ // Cadmus
1405
+ CadmusCoreModule,
1406
+ CadmusApiModule,
1407
+ CadmusMaterialModule,
1408
+ ],
1409
+ }]
1410
+ }] });
1349
1411
 
1350
1412
  /*
1351
1413
  * Public API Surface of cadmus-state
@@ -1356,4 +1418,3 @@ CadmusStateModule.decorators = [
1356
1418
  */
1357
1419
 
1358
1420
  export { AppQuery, AppService, AppStore, CadmusStateModule, EditFragmentFeatureBase, EditFragmentQueryBase, EditFragmentServiceBase, EditFragmentStore, EditItemQuery, EditItemService, EditItemStore, EditLayerPartQuery, EditLayerPartService, EditLayerPartStore, EditPartFeatureBase, EditPartQueryBase, EditPartServiceBase, EditPartStore, EditThesaurusQuery, EditThesaurusService, EditThesaurusStore, editFragmentInitialState, editPartInitialState };
1359
- //# sourceMappingURL=myrmidon-cadmus-state.js.map