@myrmidon/cadmus-state 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm2020/lib/app.query.mjs +1 -1
- package/esm2020/lib/app.service.mjs +1 -1
- package/esm2020/lib/app.store.mjs +1 -3
- package/esm2020/lib/cadmus-state.module.mjs +6 -2
- package/esm2020/lib/edit-fragment-feature-base.mjs +6 -3
- package/esm2020/lib/edit-fragment-query-base.mjs +1 -1
- package/esm2020/lib/edit-fragment-service-base.mjs +7 -4
- package/esm2020/lib/edit-fragment.store.mjs +1 -4
- package/esm2020/lib/edit-item.query.mjs +3 -3
- package/esm2020/lib/edit-item.service.mjs +18 -18
- package/esm2020/lib/edit-item.store.mjs +4 -11
- package/esm2020/lib/edit-layer-part.query.mjs +1 -1
- package/esm2020/lib/edit-layer-part.service.mjs +7 -7
- package/esm2020/lib/edit-layer-part.store.mjs +1 -5
- package/esm2020/lib/edit-part-feature-base.mjs +3 -3
- package/esm2020/lib/edit-part-query-base.mjs +3 -3
- package/esm2020/lib/edit-part-service-base.mjs +7 -7
- package/esm2020/lib/edit-part.store.mjs +2 -10
- package/esm2020/lib/edit-thesaurus.query.mjs +4 -4
- package/esm2020/lib/edit-thesaurus.service.mjs +2 -2
- package/esm2020/lib/edit-thesaurus.store.mjs +2 -9
- package/fesm2015/myrmidon-cadmus-state.mjs +77 -89
- package/fesm2015/myrmidon-cadmus-state.mjs.map +1 -1
- package/fesm2020/myrmidon-cadmus-state.mjs +68 -89
- package/fesm2020/myrmidon-cadmus-state.mjs.map +1 -1
- package/lib/app.query.d.ts +4 -4
- package/lib/app.service.d.ts +1 -1
- package/lib/app.store.d.ts +2 -2
- package/lib/cadmus-state.module.d.ts +2 -1
- package/lib/edit-fragment-feature-base.d.ts +7 -7
- package/lib/edit-fragment-query-base.d.ts +5 -5
- package/lib/edit-fragment-service-base.d.ts +1 -1
- package/lib/edit-fragment.store.d.ts +2 -2
- package/lib/edit-item.query.d.ts +6 -6
- package/lib/edit-item.service.d.ts +2 -2
- package/lib/edit-item.store.d.ts +5 -5
- package/lib/edit-layer-part.query.d.ts +6 -6
- package/lib/edit-layer-part.service.d.ts +1 -1
- package/lib/edit-layer-part.store.d.ts +3 -3
- package/lib/edit-part-feature-base.d.ts +9 -9
- package/lib/edit-part-query-base.d.ts +4 -4
- package/lib/edit-part-service-base.d.ts +3 -3
- package/lib/edit-part.store.d.ts +2 -3
- package/lib/edit-thesaurus.query.d.ts +2 -3
- package/lib/edit-thesaurus.service.d.ts +1 -1
- package/lib/edit-thesaurus.store.d.ts +1 -1
- package/package.json +3 -3
|
@@ -7,19 +7,17 @@ import * as i2 from '@myrmidon/cadmus-api';
|
|
|
7
7
|
import { CadmusApiModule } from '@myrmidon/cadmus-api';
|
|
8
8
|
import * as i2$1 from '@myrmidon/cadmus-core';
|
|
9
9
|
import { TokenLocation, CadmusCoreModule } from '@myrmidon/cadmus-core';
|
|
10
|
-
import { deepCopy } from '@myrmidon/ng-tools';
|
|
10
|
+
import { deepCopy, NgToolsModule } from '@myrmidon/ng-tools';
|
|
11
11
|
import { CommonModule } from '@angular/common';
|
|
12
12
|
import { CadmusMaterialModule } from '@myrmidon/cadmus-material';
|
|
13
13
|
|
|
14
|
-
const initialState$
|
|
14
|
+
const initialState$2 = {
|
|
15
15
|
facets: [],
|
|
16
16
|
flags: [],
|
|
17
|
-
typeThesaurus: null,
|
|
18
|
-
itemBrowserThesaurus: null,
|
|
19
17
|
};
|
|
20
18
|
let AppStore = class AppStore extends Store {
|
|
21
19
|
constructor() {
|
|
22
|
-
super(initialState$
|
|
20
|
+
super(initialState$2);
|
|
23
21
|
}
|
|
24
22
|
};
|
|
25
23
|
AppStore.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: AppStore, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
@@ -95,35 +93,28 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.2", ngImpor
|
|
|
95
93
|
args: [{ providedIn: 'root' }]
|
|
96
94
|
}], ctorParameters: function () { return [{ type: AppStore }, { type: i2.FacetService }, { type: i2.FlagService }, { type: i2.ThesaurusService }]; } });
|
|
97
95
|
|
|
98
|
-
const initialState$
|
|
99
|
-
item: null,
|
|
96
|
+
const initialState$1 = {
|
|
100
97
|
parts: [],
|
|
101
98
|
partGroups: [],
|
|
102
99
|
layerPartInfos: [],
|
|
103
|
-
facet: null,
|
|
104
|
-
dirty: false,
|
|
105
|
-
saving: false,
|
|
106
|
-
deletingPart: false,
|
|
107
|
-
loading: false,
|
|
108
|
-
error: null
|
|
109
100
|
};
|
|
110
101
|
let EditItemStore = class EditItemStore extends Store {
|
|
111
102
|
constructor() {
|
|
112
|
-
super(initialState$
|
|
103
|
+
super(initialState$1);
|
|
113
104
|
}
|
|
114
105
|
setDirty(value = true) {
|
|
115
106
|
this.update({
|
|
116
|
-
dirty: value
|
|
107
|
+
dirty: value,
|
|
117
108
|
});
|
|
118
109
|
}
|
|
119
110
|
setSaving(value = true) {
|
|
120
111
|
this.update({
|
|
121
|
-
saving: value
|
|
112
|
+
saving: value,
|
|
122
113
|
});
|
|
123
114
|
}
|
|
124
115
|
setDeletingPart(value = true) {
|
|
125
116
|
this.update({
|
|
126
|
-
deletingPart: value
|
|
117
|
+
deletingPart: value,
|
|
127
118
|
});
|
|
128
119
|
}
|
|
129
120
|
};
|
|
@@ -161,14 +152,14 @@ class EditItemQuery extends Query {
|
|
|
161
152
|
selectDeletingPart() {
|
|
162
153
|
return this.select((state) => state.deletingPart);
|
|
163
154
|
}
|
|
164
|
-
hasItem(id
|
|
155
|
+
hasItem(id) {
|
|
165
156
|
const item = this.getValue().item;
|
|
166
157
|
if (!item || (id && id !== item.id)) {
|
|
167
158
|
return false;
|
|
168
159
|
}
|
|
169
160
|
return true;
|
|
170
161
|
}
|
|
171
|
-
getEditorKeyFromPartTypeId(typeId, roleId
|
|
162
|
+
getEditorKeyFromPartTypeId(typeId, roleId) {
|
|
172
163
|
const facet = this.getValue().facet;
|
|
173
164
|
if (!facet) {
|
|
174
165
|
return 'default';
|
|
@@ -195,7 +186,7 @@ class EditItemService {
|
|
|
195
186
|
}
|
|
196
187
|
pickDefaultFacet(facets) {
|
|
197
188
|
if (!facets.length) {
|
|
198
|
-
return
|
|
189
|
+
return undefined;
|
|
199
190
|
}
|
|
200
191
|
// if there is a facet with id="default", pick it
|
|
201
192
|
const defaultFacet = facets.find((f) => f.id === 'default');
|
|
@@ -211,9 +202,9 @@ class EditItemService {
|
|
|
211
202
|
*/
|
|
212
203
|
load(itemId) {
|
|
213
204
|
this._store.setLoading(true);
|
|
214
|
-
const layers$ = this._itemService.getItemLayerInfo(itemId, true);
|
|
215
205
|
const appState = this._appQuery.getValue();
|
|
216
206
|
// if not a new item, include it in load
|
|
207
|
+
const layers$ = this._itemService.getItemLayerInfo(itemId || '', true);
|
|
217
208
|
if (itemId) {
|
|
218
209
|
forkJoin({
|
|
219
210
|
item: this._itemService.getItem(itemId, true),
|
|
@@ -228,7 +219,7 @@ class EditItemService {
|
|
|
228
219
|
this._store.update({
|
|
229
220
|
item: result.item,
|
|
230
221
|
parts: result.item.parts,
|
|
231
|
-
partGroups: this._itemService.groupParts(result.item.parts, facetParts),
|
|
222
|
+
partGroups: this._itemService.groupParts(result.item.parts || [], facetParts),
|
|
232
223
|
layerPartInfos: result.layers,
|
|
233
224
|
facet: appState.facets.find((f) => f.id === result.item.facetId),
|
|
234
225
|
});
|
|
@@ -247,17 +238,17 @@ class EditItemService {
|
|
|
247
238
|
this._store.setError(null);
|
|
248
239
|
this._store.update({
|
|
249
240
|
item: {
|
|
250
|
-
id:
|
|
251
|
-
title:
|
|
252
|
-
description:
|
|
253
|
-
facetId:
|
|
254
|
-
groupId:
|
|
255
|
-
sortKey:
|
|
241
|
+
id: '',
|
|
242
|
+
title: '',
|
|
243
|
+
description: '',
|
|
244
|
+
facetId: '',
|
|
245
|
+
groupId: '',
|
|
246
|
+
sortKey: '',
|
|
256
247
|
flags: 0,
|
|
257
248
|
timeCreated: new Date(),
|
|
258
|
-
creatorId:
|
|
249
|
+
creatorId: '',
|
|
259
250
|
timeModified: new Date(),
|
|
260
|
-
userId:
|
|
251
|
+
userId: '',
|
|
261
252
|
},
|
|
262
253
|
parts: [],
|
|
263
254
|
partGroups: [],
|
|
@@ -308,7 +299,7 @@ class EditItemService {
|
|
|
308
299
|
this._itemService.deletePart(id).subscribe((_) => {
|
|
309
300
|
this._store.setDeletingPart(false);
|
|
310
301
|
// reload the store
|
|
311
|
-
this.load(this._store.getValue().item
|
|
302
|
+
this.load(this._store.getValue().item?.id);
|
|
312
303
|
resolve(id);
|
|
313
304
|
}, (error) => {
|
|
314
305
|
console.log(error);
|
|
@@ -323,9 +314,9 @@ class EditItemService {
|
|
|
323
314
|
itemId,
|
|
324
315
|
typeId,
|
|
325
316
|
roleId,
|
|
326
|
-
id:
|
|
327
|
-
creatorId:
|
|
328
|
-
userId:
|
|
317
|
+
id: '',
|
|
318
|
+
creatorId: '',
|
|
319
|
+
userId: '',
|
|
329
320
|
timeCreated: new Date(),
|
|
330
321
|
timeModified: new Date(),
|
|
331
322
|
};
|
|
@@ -333,7 +324,7 @@ class EditItemService {
|
|
|
333
324
|
this._itemService.addPart(part).subscribe((_) => {
|
|
334
325
|
this._store.setSaving(false);
|
|
335
326
|
// reload the store
|
|
336
|
-
this.load(this._store.getValue().item
|
|
327
|
+
this.load(this._store.getValue().item?.id);
|
|
337
328
|
}, (error) => {
|
|
338
329
|
console.log(error);
|
|
339
330
|
this._store.setSaving(false);
|
|
@@ -345,7 +336,7 @@ class EditItemService {
|
|
|
345
336
|
this._itemService.setPartThesaurusScope(ids, scope).subscribe((_) => {
|
|
346
337
|
this._store.setSaving(false);
|
|
347
338
|
// reload the store
|
|
348
|
-
this.load(this._store.getValue().item
|
|
339
|
+
this.load(this._store.getValue().item?.id);
|
|
349
340
|
}, (error) => {
|
|
350
341
|
console.log(error);
|
|
351
342
|
this._store.setSaving(false);
|
|
@@ -375,6 +366,9 @@ class EditFragmentFeatureBase {
|
|
|
375
366
|
this._editLayersQuery = _editLayersQuery;
|
|
376
367
|
this._editLayersService = _editLayersService;
|
|
377
368
|
this._libraryRouteService = _libraryRouteService;
|
|
369
|
+
this.fragment$ = this._editFrQuery.selectFragment();
|
|
370
|
+
this.thesauri$ = this._editFrQuery.selectThesauri();
|
|
371
|
+
this.baseText$ = this._editLayersQuery.select((state) => state.baseText);
|
|
378
372
|
this.itemId = route.snapshot.params.iid;
|
|
379
373
|
this.partId = route.snapshot.params.pid;
|
|
380
374
|
this.frTypeId = route.snapshot.url[2]?.path;
|
|
@@ -383,7 +377,7 @@ class EditFragmentFeatureBase {
|
|
|
383
377
|
// connect _stateDirty to the value of the edit state
|
|
384
378
|
this._editFrQuery.selectDirty().subscribe((d) => {
|
|
385
379
|
console.log('fr dirty change (from state): ' + d);
|
|
386
|
-
this._stateDirty = d;
|
|
380
|
+
this._stateDirty = d ? true : false;
|
|
387
381
|
});
|
|
388
382
|
}
|
|
389
383
|
/**
|
|
@@ -416,7 +410,7 @@ class EditFragmentFeatureBase {
|
|
|
416
410
|
this.fragment$ = this._editFrQuery.selectFragment();
|
|
417
411
|
this.thesauri$ = this._editFrQuery.selectThesauri();
|
|
418
412
|
this.baseText$ = this._editLayersQuery.select((state) => state.baseText);
|
|
419
|
-
this.frLoc = TokenLocation.parse(this.loc);
|
|
413
|
+
this.frLoc = TokenLocation.parse(this.loc) ?? undefined;
|
|
420
414
|
// load item if required
|
|
421
415
|
this.ensureItemLoaded(this.itemId);
|
|
422
416
|
// load layers if required
|
|
@@ -506,12 +500,9 @@ class EditFragmentQueryBase extends Query {
|
|
|
506
500
|
}
|
|
507
501
|
|
|
508
502
|
const editFragmentInitialState = {
|
|
509
|
-
fragment: null,
|
|
510
|
-
thesauri: null,
|
|
511
503
|
dirty: false,
|
|
512
504
|
saving: false,
|
|
513
505
|
loading: false,
|
|
514
|
-
error: null,
|
|
515
506
|
};
|
|
516
507
|
/**
|
|
517
508
|
* General-purpose edit-fragment store. This can be used with any fragment,
|
|
@@ -556,13 +547,16 @@ class EditFragmentServiceBase {
|
|
|
556
547
|
* @param thesauriIds The thesauri IDs array, or null.
|
|
557
548
|
*/
|
|
558
549
|
load(partId, loc, thesauriIds = null) {
|
|
550
|
+
if (!this.store) {
|
|
551
|
+
return;
|
|
552
|
+
}
|
|
559
553
|
// signal that we're loading
|
|
560
554
|
this.store.setLoading(true);
|
|
561
555
|
// if thesauri are required:
|
|
562
556
|
if (thesauriIds) {
|
|
563
557
|
// remove trailing ! from IDs if any
|
|
564
558
|
const unscopedIds = thesauriIds.map((id) => {
|
|
565
|
-
return this._thesaurusService.getScopedId(id
|
|
559
|
+
return this._thesaurusService.getScopedId(id);
|
|
566
560
|
});
|
|
567
561
|
// fetch fragment and thesauri
|
|
568
562
|
forkJoin({
|
|
@@ -594,9 +588,9 @@ class EditFragmentServiceBase {
|
|
|
594
588
|
});
|
|
595
589
|
}
|
|
596
590
|
// if the loaded layer part has a thesaurus scope, reload the thesauri
|
|
597
|
-
if (result.part
|
|
591
|
+
if (result.part?.thesaurusScope) {
|
|
598
592
|
const scopedIds = thesauriIds.map((id) => {
|
|
599
|
-
return this._thesaurusService.getScopedId(id, result.part
|
|
593
|
+
return this._thesaurusService.getScopedId(id, result.part?.thesaurusScope);
|
|
600
594
|
});
|
|
601
595
|
// loading again
|
|
602
596
|
this.store.setLoading(true);
|
|
@@ -704,12 +698,12 @@ class EditPartFeatureBase {
|
|
|
704
698
|
// part ID or null (if "new")
|
|
705
699
|
this.partId = route.snapshot.params.pid;
|
|
706
700
|
if (this.partId === 'new') {
|
|
707
|
-
this.partId =
|
|
701
|
+
this.partId = undefined;
|
|
708
702
|
}
|
|
709
703
|
// role ID or null (if "default")
|
|
710
704
|
this.roleId = route.snapshot.queryParams.rid;
|
|
711
705
|
if (this.roleId === 'default') {
|
|
712
|
-
this.roleId =
|
|
706
|
+
this.roleId = undefined;
|
|
713
707
|
}
|
|
714
708
|
// connect _stateDirty to the value observed in the part state
|
|
715
709
|
this._editPartQuery.selectDirty().subscribe((d) => {
|
|
@@ -808,10 +802,10 @@ class EditPartQueryBase extends Query {
|
|
|
808
802
|
return this.select((state) => state.saving);
|
|
809
803
|
}
|
|
810
804
|
selectPart() {
|
|
811
|
-
return this.select((state) => state.part);
|
|
805
|
+
return this.select((state) => state.part || undefined);
|
|
812
806
|
}
|
|
813
807
|
selectThesauri() {
|
|
814
|
-
return this.select((state) => state.thesauri);
|
|
808
|
+
return this.select((state) => state.thesauri || undefined);
|
|
815
809
|
}
|
|
816
810
|
}
|
|
817
811
|
|
|
@@ -830,23 +824,23 @@ class EditPartServiceBase {
|
|
|
830
824
|
* it will get a null ID, but use the specified itemId and roleId.
|
|
831
825
|
*
|
|
832
826
|
* @param partId The part ID, unless it's a new part.
|
|
833
|
-
* @param thesauriIds The thesauri IDs array
|
|
827
|
+
* @param thesauriIds The thesauri IDs array.
|
|
834
828
|
* @param itemId The item ID for the new part.
|
|
835
829
|
* @param typeId The part type ID for the new part.
|
|
836
830
|
* @param roleId The role ID for the new part.
|
|
837
831
|
*/
|
|
838
|
-
load(partId, thesauriIds
|
|
832
|
+
load(partId, thesauriIds, itemId, typeId, roleId) {
|
|
839
833
|
// signal that we're loading
|
|
840
834
|
this.store.setLoading(true);
|
|
841
835
|
// if thesauri are required:
|
|
842
836
|
if (thesauriIds) {
|
|
843
837
|
// remove trailing ! from IDs if any
|
|
844
838
|
const unscopedIds = thesauriIds.map((id) => {
|
|
845
|
-
return this.thesaurusService.getScopedId(id
|
|
839
|
+
return this.thesaurusService.getScopedId(id);
|
|
846
840
|
});
|
|
847
841
|
// fetch part and thesauri
|
|
848
842
|
forkJoin({
|
|
849
|
-
part: this.itemService.getPart(partId),
|
|
843
|
+
part: this.itemService.getPart(partId || ''),
|
|
850
844
|
thesauri: this.thesaurusService.getThesauriSet(unscopedIds),
|
|
851
845
|
}).subscribe((result) => {
|
|
852
846
|
// loading has ended
|
|
@@ -865,7 +859,7 @@ class EditPartServiceBase {
|
|
|
865
859
|
// if the loaded part has a thesaurus scope, reload the thesauri
|
|
866
860
|
if (result.part?.thesaurusScope) {
|
|
867
861
|
const scopedIds = thesauriIds.map((id) => {
|
|
868
|
-
return this.thesaurusService.getScopedId(id, result.part
|
|
862
|
+
return this.thesaurusService.getScopedId(id, result.part?.thesaurusScope);
|
|
869
863
|
});
|
|
870
864
|
// loading again
|
|
871
865
|
this.store.setLoading(true);
|
|
@@ -885,7 +879,7 @@ class EditPartServiceBase {
|
|
|
885
879
|
}
|
|
886
880
|
else {
|
|
887
881
|
// without thesauri to be fetched, just fetch the part
|
|
888
|
-
this.itemService.getPart(partId).subscribe((part) => {
|
|
882
|
+
this.itemService.getPart(partId || '').subscribe((part) => {
|
|
889
883
|
this.store.update({
|
|
890
884
|
part: part || {
|
|
891
885
|
id: null,
|
|
@@ -934,14 +928,6 @@ class EditPartServiceBase {
|
|
|
934
928
|
}
|
|
935
929
|
}
|
|
936
930
|
|
|
937
|
-
const editPartInitialState = {
|
|
938
|
-
part: null,
|
|
939
|
-
thesauri: null,
|
|
940
|
-
dirty: false,
|
|
941
|
-
saving: false,
|
|
942
|
-
loading: false,
|
|
943
|
-
error: null,
|
|
944
|
-
};
|
|
945
931
|
/**
|
|
946
932
|
* General-purpose edit-part store. This can be used with any part, so that
|
|
947
933
|
* you should only provide your part store, query, and service (usually
|
|
@@ -949,7 +935,7 @@ const editPartInitialState = {
|
|
|
949
935
|
*/
|
|
950
936
|
let EditPartStore = class EditPartStore extends Store {
|
|
951
937
|
constructor() {
|
|
952
|
-
super(
|
|
938
|
+
super({});
|
|
953
939
|
}
|
|
954
940
|
setDirty(value) {
|
|
955
941
|
this.update({ dirty: value });
|
|
@@ -968,16 +954,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.2", ngImpor
|
|
|
968
954
|
args: [{ providedIn: 'root' }]
|
|
969
955
|
}], ctorParameters: function () { return []; } });
|
|
970
956
|
|
|
971
|
-
const initialState
|
|
972
|
-
part: null,
|
|
973
|
-
baseText: null,
|
|
974
|
-
baseTextPart: null,
|
|
957
|
+
const initialState = {
|
|
975
958
|
locations: [],
|
|
976
959
|
breakChance: -1,
|
|
977
960
|
layerHints: [],
|
|
978
961
|
thesauri: {},
|
|
979
962
|
loading: false,
|
|
980
|
-
error: null,
|
|
981
963
|
deletingFragment: false,
|
|
982
964
|
savingFragment: false,
|
|
983
965
|
refreshingBreakChance: false,
|
|
@@ -985,7 +967,7 @@ const initialState$1 = {
|
|
|
985
967
|
};
|
|
986
968
|
let EditLayerPartStore = class EditLayerPartStore extends Store {
|
|
987
969
|
constructor() {
|
|
988
|
-
super(initialState
|
|
970
|
+
super(initialState);
|
|
989
971
|
}
|
|
990
972
|
setDeletingFragment(value = true) {
|
|
991
973
|
this.update({ deletingFragment: value });
|
|
@@ -1070,7 +1052,7 @@ class EditLayerPartService {
|
|
|
1070
1052
|
* @param partId The layer part ID.
|
|
1071
1053
|
* @param thesauriIds The optional thesauri IDs to load.
|
|
1072
1054
|
*/
|
|
1073
|
-
load(itemId, partId, thesauriIds
|
|
1055
|
+
load(itemId, partId, thesauriIds) {
|
|
1074
1056
|
if (this._store.getValue().loading) {
|
|
1075
1057
|
return;
|
|
1076
1058
|
}
|
|
@@ -1078,7 +1060,7 @@ class EditLayerPartService {
|
|
|
1078
1060
|
if (thesauriIds) {
|
|
1079
1061
|
// remove trailing ! from IDs if any
|
|
1080
1062
|
const unscopedIds = thesauriIds.map((id) => {
|
|
1081
|
-
return this._thesaurusService.getScopedId(id
|
|
1063
|
+
return this._thesaurusService.getScopedId(id);
|
|
1082
1064
|
});
|
|
1083
1065
|
forkJoin({
|
|
1084
1066
|
// TODO: eventually optimize by adding method param to load only fragments locations
|
|
@@ -1098,10 +1080,10 @@ class EditLayerPartService {
|
|
|
1098
1080
|
layerHints: result.layerHints,
|
|
1099
1081
|
thesauri: result.thesauri,
|
|
1100
1082
|
loading: false,
|
|
1101
|
-
error:
|
|
1083
|
+
error: undefined,
|
|
1102
1084
|
});
|
|
1103
1085
|
// if the loaded part has a thesaurus scope, reload the thesauri
|
|
1104
|
-
if (result.layerPart
|
|
1086
|
+
if (result.layerPart?.thesaurusScope) {
|
|
1105
1087
|
const scopedIds = thesauriIds.map((id) => {
|
|
1106
1088
|
return this._thesaurusService.getScopedId(id, result.layerPart.thesaurusScope);
|
|
1107
1089
|
});
|
|
@@ -1139,7 +1121,7 @@ class EditLayerPartService {
|
|
|
1139
1121
|
breakChance: result.breakChance.chance,
|
|
1140
1122
|
layerHints: result.layerHints,
|
|
1141
1123
|
loading: false,
|
|
1142
|
-
error:
|
|
1124
|
+
error: undefined,
|
|
1143
1125
|
});
|
|
1144
1126
|
}, (error) => {
|
|
1145
1127
|
console.error(error);
|
|
@@ -1192,7 +1174,7 @@ class EditLayerPartService {
|
|
|
1192
1174
|
return;
|
|
1193
1175
|
}
|
|
1194
1176
|
const i = part.fragments.findIndex((p) => {
|
|
1195
|
-
return TokenLocation.parse(p.location)
|
|
1177
|
+
return TokenLocation.parse(p.location)?.overlaps(loc);
|
|
1196
1178
|
});
|
|
1197
1179
|
if (i === -1) {
|
|
1198
1180
|
return;
|
|
@@ -1270,16 +1252,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.2", ngImpor
|
|
|
1270
1252
|
args: [{ providedIn: 'root' }]
|
|
1271
1253
|
}], ctorParameters: function () { return [{ type: EditLayerPartStore }, { type: i2.ItemService }, { type: i2.FacetService }, { type: i2.ThesaurusService }]; } });
|
|
1272
1254
|
|
|
1273
|
-
const initialState = {
|
|
1274
|
-
thesaurus: null,
|
|
1275
|
-
dirty: false,
|
|
1276
|
-
saving: false,
|
|
1277
|
-
loading: false,
|
|
1278
|
-
error: null,
|
|
1279
|
-
};
|
|
1280
1255
|
let EditThesaurusStore = class EditThesaurusStore extends Store {
|
|
1281
1256
|
constructor() {
|
|
1282
|
-
super(
|
|
1257
|
+
super({});
|
|
1283
1258
|
}
|
|
1284
1259
|
setDirty(value = true) {
|
|
1285
1260
|
this.update({
|
|
@@ -1310,9 +1285,9 @@ class EditThesaurusQuery extends Query {
|
|
|
1310
1285
|
selectThesaurus() {
|
|
1311
1286
|
return this.select(state => state.thesaurus);
|
|
1312
1287
|
}
|
|
1313
|
-
selectLoading() {
|
|
1314
|
-
|
|
1315
|
-
}
|
|
1288
|
+
// public selectLoading(): Observable<boolean | undefined> {
|
|
1289
|
+
// return this.select(state => state.loading);
|
|
1290
|
+
// }
|
|
1316
1291
|
selectSaving() {
|
|
1317
1292
|
return this.select(state => state.saving);
|
|
1318
1293
|
}
|
|
@@ -1346,7 +1321,7 @@ class EditThesaurusService {
|
|
|
1346
1321
|
else {
|
|
1347
1322
|
this._store.update({
|
|
1348
1323
|
thesaurus: {
|
|
1349
|
-
id:
|
|
1324
|
+
id: '',
|
|
1350
1325
|
language: 'en',
|
|
1351
1326
|
entries: [],
|
|
1352
1327
|
},
|
|
@@ -1386,13 +1361,15 @@ CadmusStateModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", versi
|
|
|
1386
1361
|
// Cadmus
|
|
1387
1362
|
CadmusCoreModule,
|
|
1388
1363
|
CadmusApiModule,
|
|
1389
|
-
CadmusMaterialModule
|
|
1364
|
+
CadmusMaterialModule,
|
|
1365
|
+
NgToolsModule] });
|
|
1390
1366
|
CadmusStateModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: CadmusStateModule, imports: [[
|
|
1391
1367
|
CommonModule,
|
|
1392
1368
|
// Cadmus
|
|
1393
1369
|
CadmusCoreModule,
|
|
1394
1370
|
CadmusApiModule,
|
|
1395
1371
|
CadmusMaterialModule,
|
|
1372
|
+
NgToolsModule
|
|
1396
1373
|
]] });
|
|
1397
1374
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: CadmusStateModule, decorators: [{
|
|
1398
1375
|
type: NgModule,
|
|
@@ -1403,6 +1380,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.2", ngImpor
|
|
|
1403
1380
|
CadmusCoreModule,
|
|
1404
1381
|
CadmusApiModule,
|
|
1405
1382
|
CadmusMaterialModule,
|
|
1383
|
+
NgToolsModule
|
|
1406
1384
|
],
|
|
1407
1385
|
}]
|
|
1408
1386
|
}] });
|
|
@@ -1415,4 +1393,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.2", ngImpor
|
|
|
1415
1393
|
* Generated bundle index. Do not edit.
|
|
1416
1394
|
*/
|
|
1417
1395
|
|
|
1418
|
-
export { AppQuery, AppService, AppStore, CadmusStateModule, EditFragmentFeatureBase, EditFragmentQueryBase, EditFragmentServiceBase, EditFragmentStore, EditItemQuery, EditItemService, EditItemStore, EditLayerPartQuery, EditLayerPartService, EditLayerPartStore, EditPartFeatureBase, EditPartQueryBase, EditPartServiceBase, EditPartStore, EditThesaurusQuery, EditThesaurusService, EditThesaurusStore, editFragmentInitialState
|
|
1396
|
+
export { AppQuery, AppService, AppStore, CadmusStateModule, EditFragmentFeatureBase, EditFragmentQueryBase, EditFragmentServiceBase, EditFragmentStore, EditItemQuery, EditItemService, EditItemStore, EditLayerPartQuery, EditLayerPartService, EditLayerPartStore, EditPartFeatureBase, EditPartQueryBase, EditPartServiceBase, EditPartStore, EditThesaurusQuery, EditThesaurusService, EditThesaurusStore, editFragmentInitialState };
|
|
1397
|
+
//# sourceMappingURL=myrmidon-cadmus-state.mjs.map
|