@myrmidon/cadmus-core 13.0.0 → 20.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,122 +1,121 @@
|
|
|
1
|
-
import { Observable } from
|
|
2
|
-
import { CanDeactivateFn } from
|
|
3
|
-
import { DialogService } from
|
|
4
|
-
import * as i0 from
|
|
5
|
-
import { PipeTransform } from
|
|
6
|
-
|
|
1
|
+
import { Observable } from "rxjs";
|
|
2
|
+
import { CanDeactivateFn } from "@angular/router";
|
|
3
|
+
import { DialogService } from "@myrmidon/ngx-mat-tools";
|
|
4
|
+
import * as i0 from "@angular/core";
|
|
5
|
+
import { PipeTransform } from "@angular/core";
|
|
7
6
|
/**
|
|
8
7
|
* Interface implemented by versioned storage objects.
|
|
9
8
|
*/
|
|
10
|
-
interface HasVersion {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
9
|
+
export interface HasVersion {
|
|
10
|
+
timeCreated: Date;
|
|
11
|
+
creatorId: string;
|
|
12
|
+
timeModified: Date;
|
|
13
|
+
userId: string;
|
|
15
14
|
}
|
|
16
15
|
/**
|
|
17
16
|
* Item's properties, excluding its parts.
|
|
18
17
|
*/
|
|
19
|
-
interface Item extends HasVersion {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
18
|
+
export interface Item extends HasVersion {
|
|
19
|
+
id: string;
|
|
20
|
+
title: string;
|
|
21
|
+
description: string;
|
|
22
|
+
facetId: string;
|
|
23
|
+
groupId: string;
|
|
24
|
+
sortKey: string;
|
|
25
|
+
flags: number;
|
|
26
|
+
parts?: Part[];
|
|
28
27
|
}
|
|
29
28
|
/**
|
|
30
29
|
* Flags matching mode.
|
|
31
30
|
*/
|
|
32
|
-
declare enum FlagMatching {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
31
|
+
export declare enum FlagMatching {
|
|
32
|
+
none = -1,
|
|
33
|
+
bitsAllSet = 0,
|
|
34
|
+
bitsAnySet = 1,
|
|
35
|
+
bitsAllClear = 2,
|
|
36
|
+
bitsAnyClear = 3
|
|
38
37
|
}
|
|
39
38
|
/**
|
|
40
39
|
* Filter for items.
|
|
41
40
|
*/
|
|
42
|
-
interface ItemFilter {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
41
|
+
export interface ItemFilter {
|
|
42
|
+
title?: string;
|
|
43
|
+
description?: string;
|
|
44
|
+
facetId?: string;
|
|
45
|
+
groupId?: string;
|
|
46
|
+
flags?: number;
|
|
47
|
+
flagMatching?: FlagMatching;
|
|
48
|
+
minModified?: Date;
|
|
49
|
+
maxModified?: Date;
|
|
50
|
+
userId?: string;
|
|
52
51
|
}
|
|
53
52
|
/**
|
|
54
53
|
* Essential information about an item.
|
|
55
54
|
*/
|
|
56
|
-
interface ItemInfo extends HasVersion {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
55
|
+
export interface ItemInfo extends HasVersion {
|
|
56
|
+
id: string;
|
|
57
|
+
title: string;
|
|
58
|
+
description: string;
|
|
59
|
+
facetId: string;
|
|
60
|
+
groupId: string;
|
|
61
|
+
sortKey: string;
|
|
62
|
+
flags: number;
|
|
63
|
+
payload?: any;
|
|
65
64
|
}
|
|
66
65
|
/**
|
|
67
66
|
* Information about a data pin; returned by pins search.
|
|
68
67
|
*/
|
|
69
|
-
interface DataPinInfo {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
68
|
+
export interface DataPinInfo {
|
|
69
|
+
itemId: string;
|
|
70
|
+
partId: string;
|
|
71
|
+
roleId: string | null;
|
|
72
|
+
partTypeId: string;
|
|
73
|
+
name: string;
|
|
74
|
+
value: string;
|
|
75
|
+
tag?: string;
|
|
77
76
|
}
|
|
78
77
|
/**
|
|
79
78
|
* Data pin value type in a DataPinDefinition.
|
|
80
79
|
*/
|
|
81
|
-
declare enum DataPinValueType {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
80
|
+
export declare enum DataPinValueType {
|
|
81
|
+
string = 0,
|
|
82
|
+
boolean = 1,
|
|
83
|
+
integer = 2,
|
|
84
|
+
decimal = 3
|
|
86
85
|
}
|
|
87
86
|
/**
|
|
88
87
|
* Definition of a data pin.
|
|
89
88
|
*/
|
|
90
|
-
interface DataPinDefinition {
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
89
|
+
export interface DataPinDefinition {
|
|
90
|
+
name: string;
|
|
91
|
+
type: DataPinValueType;
|
|
92
|
+
tip?: string;
|
|
93
|
+
attributes?: string;
|
|
95
94
|
}
|
|
96
95
|
/**
|
|
97
96
|
* Part type and role IDs.
|
|
98
97
|
*/
|
|
99
|
-
interface PartTypeIds {
|
|
100
|
-
|
|
101
|
-
|
|
98
|
+
export interface PartTypeIds {
|
|
99
|
+
typeId: string;
|
|
100
|
+
roleId?: string;
|
|
102
101
|
}
|
|
103
102
|
/**
|
|
104
103
|
* Part. This is the minimal set of properties present in all the
|
|
105
104
|
* parts. Each part then adds its own properties, extending this interface.
|
|
106
105
|
*/
|
|
107
|
-
interface Part extends HasVersion, PartTypeIds {
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
106
|
+
export interface Part extends HasVersion, PartTypeIds {
|
|
107
|
+
id: string;
|
|
108
|
+
itemId: string;
|
|
109
|
+
thesaurusScope?: string;
|
|
111
110
|
}
|
|
112
111
|
/**
|
|
113
112
|
* Essential information about a layer part.
|
|
114
113
|
*/
|
|
115
|
-
interface LayerPartInfo extends HasVersion, PartTypeIds {
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
114
|
+
export interface LayerPartInfo extends HasVersion, PartTypeIds {
|
|
115
|
+
id: string;
|
|
116
|
+
itemId: string;
|
|
117
|
+
fragmentCount: number;
|
|
118
|
+
isAbsent: boolean;
|
|
120
119
|
}
|
|
121
120
|
/**
|
|
122
121
|
* Text layer fragment. This is the minimal set of properties present in all the
|
|
@@ -125,58 +124,58 @@ interface LayerPartInfo extends HasVersion, PartTypeIds {
|
|
|
125
124
|
* Every fragment has a location, and can be enriched with the corresponding
|
|
126
125
|
* base text when used in views.
|
|
127
126
|
*/
|
|
128
|
-
interface Fragment {
|
|
129
|
-
|
|
130
|
-
|
|
127
|
+
export interface Fragment {
|
|
128
|
+
location: string;
|
|
129
|
+
baseText?: string;
|
|
131
130
|
}
|
|
132
131
|
/**
|
|
133
132
|
* Text layer part. This represents a special type of part,
|
|
134
133
|
* whose only content is a collection of fragments.
|
|
135
134
|
*/
|
|
136
|
-
interface TextLayerPart extends Part {
|
|
137
|
-
|
|
135
|
+
export interface TextLayerPart extends Part {
|
|
136
|
+
fragments: Fragment[];
|
|
138
137
|
}
|
|
139
138
|
/**
|
|
140
139
|
* A text line in a base text part.
|
|
141
140
|
*/
|
|
142
|
-
interface TokenTextLayerLine {
|
|
143
|
-
|
|
144
|
-
|
|
141
|
+
export interface TokenTextLayerLine {
|
|
142
|
+
y: number;
|
|
143
|
+
tokens: string[];
|
|
145
144
|
}
|
|
146
145
|
/**
|
|
147
146
|
* Token-based text coordinates.
|
|
148
147
|
*/
|
|
149
|
-
interface TextCoords {
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
148
|
+
export interface TextCoords {
|
|
149
|
+
y: number;
|
|
150
|
+
x: number;
|
|
151
|
+
at?: number;
|
|
152
|
+
run?: number;
|
|
154
153
|
}
|
|
155
154
|
/**
|
|
156
155
|
* Layer reconciliation hint for a single fragment.
|
|
157
156
|
*/
|
|
158
|
-
interface LayerHint {
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
157
|
+
export interface LayerHint {
|
|
158
|
+
location: string;
|
|
159
|
+
editOperation: string;
|
|
160
|
+
patchOperation?: string;
|
|
161
|
+
impactLevel: number;
|
|
162
|
+
description?: string;
|
|
164
163
|
}
|
|
165
164
|
/**
|
|
166
165
|
* A single entry in a thesaurus.
|
|
167
166
|
*/
|
|
168
|
-
interface ThesaurusEntry {
|
|
169
|
-
|
|
170
|
-
|
|
167
|
+
export interface ThesaurusEntry {
|
|
168
|
+
id: string;
|
|
169
|
+
value: string;
|
|
171
170
|
}
|
|
172
171
|
/**
|
|
173
172
|
* A set of thesaurus entries.
|
|
174
173
|
*/
|
|
175
|
-
interface Thesaurus {
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
174
|
+
export interface Thesaurus {
|
|
175
|
+
id: string;
|
|
176
|
+
language?: string;
|
|
177
|
+
targetId?: string;
|
|
178
|
+
entries?: ThesaurusEntry[];
|
|
180
179
|
}
|
|
181
180
|
/**
|
|
182
181
|
* A set of thesauri which get passed to an editor component.
|
|
@@ -184,27 +183,27 @@ interface Thesaurus {
|
|
|
184
183
|
* defined key, which is unique only within the context of the editor
|
|
185
184
|
* consuming the set, and refers to frontend only.
|
|
186
185
|
*/
|
|
187
|
-
interface ThesauriSet {
|
|
188
|
-
|
|
186
|
+
export interface ThesauriSet {
|
|
187
|
+
[key: string]: Thesaurus;
|
|
189
188
|
}
|
|
190
189
|
/**
|
|
191
190
|
* Filter for thesauri.
|
|
192
191
|
*/
|
|
193
|
-
interface ThesaurusFilter {
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
192
|
+
export interface ThesaurusFilter {
|
|
193
|
+
id?: string;
|
|
194
|
+
isAlias?: boolean;
|
|
195
|
+
language?: string;
|
|
197
196
|
}
|
|
198
197
|
/**
|
|
199
198
|
* Part definition in a facet.
|
|
200
199
|
*/
|
|
201
|
-
interface PartDefinition extends PartTypeIds {
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
200
|
+
export interface PartDefinition extends PartTypeIds {
|
|
201
|
+
name: string;
|
|
202
|
+
description?: string;
|
|
203
|
+
isRequired?: boolean;
|
|
204
|
+
colorKey?: string;
|
|
205
|
+
groupKey?: string;
|
|
206
|
+
sortKey?: string;
|
|
208
207
|
}
|
|
209
208
|
/**
|
|
210
209
|
* Fragment definition in a facet.
|
|
@@ -212,22 +211,22 @@ interface PartDefinition extends PartTypeIds {
|
|
|
212
211
|
/**
|
|
213
212
|
* Facet definition.
|
|
214
213
|
*/
|
|
215
|
-
interface FacetDefinition {
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
214
|
+
export interface FacetDefinition {
|
|
215
|
+
id: string;
|
|
216
|
+
label: string;
|
|
217
|
+
colorKey: string;
|
|
218
|
+
description: string;
|
|
219
|
+
partDefinitions: PartDefinition[];
|
|
221
220
|
}
|
|
222
221
|
/**
|
|
223
222
|
* Flag definition.
|
|
224
223
|
*/
|
|
225
|
-
interface FlagDefinition {
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
224
|
+
export interface FlagDefinition {
|
|
225
|
+
id: number;
|
|
226
|
+
label: string;
|
|
227
|
+
description: string;
|
|
228
|
+
colorKey: string;
|
|
229
|
+
isAdmin?: boolean;
|
|
231
230
|
}
|
|
232
231
|
/**
|
|
233
232
|
* The group key for a part type. This is used in EditorKeys objects
|
|
@@ -236,195 +235,189 @@ interface FlagDefinition {
|
|
|
236
235
|
* used in conjunction with 1 or more fragment type IDs, each mapped to
|
|
237
236
|
* a corresponding editor key.
|
|
238
237
|
*/
|
|
239
|
-
interface PartGroupKey {
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
238
|
+
export interface PartGroupKey {
|
|
239
|
+
part: string;
|
|
240
|
+
fragments?: {
|
|
241
|
+
[key: string]: string;
|
|
242
|
+
};
|
|
244
243
|
}
|
|
245
244
|
/**
|
|
246
245
|
* Part type IDs to editor keys mappings. This contains a set of component
|
|
247
246
|
* type IDs (parts and parts + fragments) mapped to editor keys, which are
|
|
248
247
|
* used to build their routes in the UI.
|
|
249
248
|
*/
|
|
250
|
-
interface PartEditorKeys {
|
|
251
|
-
|
|
249
|
+
export interface PartEditorKeys {
|
|
250
|
+
[key: string]: PartGroupKey;
|
|
252
251
|
}
|
|
253
252
|
/**
|
|
254
253
|
* An index lookup definition, used in dynamic lookup to provide the set
|
|
255
254
|
* of parameters required for a data pins based search.
|
|
256
255
|
*/
|
|
257
|
-
interface IndexLookupDefinition {
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
256
|
+
export interface IndexLookupDefinition {
|
|
257
|
+
typeId?: string;
|
|
258
|
+
roleId?: string;
|
|
259
|
+
name: string;
|
|
261
260
|
}
|
|
262
261
|
/**
|
|
263
262
|
* A dictionary of index lookup definitions.
|
|
264
263
|
*/
|
|
265
|
-
interface IndexLookupDefinitions {
|
|
266
|
-
|
|
264
|
+
export interface IndexLookupDefinitions {
|
|
265
|
+
[key: string]: IndexLookupDefinition;
|
|
267
266
|
}
|
|
268
267
|
/**
|
|
269
268
|
* A group of parts. Usually the item's parts are grouped according
|
|
270
269
|
* to their metadata, and presented in this way.
|
|
271
270
|
*/
|
|
272
|
-
interface PartGroup {
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
271
|
+
export interface PartGroup {
|
|
272
|
+
key: string;
|
|
273
|
+
label: string;
|
|
274
|
+
parts: Part[];
|
|
276
275
|
}
|
|
277
276
|
/**
|
|
278
277
|
* Essential information about a user.
|
|
279
278
|
*/
|
|
280
|
-
interface UserInfo {
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
279
|
+
export interface UserInfo {
|
|
280
|
+
userName: string;
|
|
281
|
+
firstName: string;
|
|
282
|
+
lastName: string;
|
|
284
283
|
}
|
|
285
284
|
/**
|
|
286
285
|
* Login credentials.
|
|
287
286
|
*/
|
|
288
|
-
interface LoginCredentials {
|
|
289
|
-
|
|
290
|
-
|
|
287
|
+
export interface LoginCredentials {
|
|
288
|
+
name: string;
|
|
289
|
+
password: string;
|
|
291
290
|
}
|
|
292
291
|
/**
|
|
293
292
|
* The identifiers for an edited part.
|
|
294
293
|
*/
|
|
295
|
-
interface PartIdentity {
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
294
|
+
export interface PartIdentity {
|
|
295
|
+
itemId: string;
|
|
296
|
+
typeId: string;
|
|
297
|
+
partId: string | null;
|
|
298
|
+
roleId: string | null;
|
|
300
299
|
}
|
|
301
300
|
/**
|
|
302
301
|
* The identifiers for an edited fragment.
|
|
303
302
|
*/
|
|
304
|
-
interface FragmentIdentity extends PartIdentity {
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
303
|
+
export interface FragmentIdentity extends PartIdentity {
|
|
304
|
+
frTypeId: string;
|
|
305
|
+
frRoleId: string | null;
|
|
306
|
+
loc: string;
|
|
308
307
|
}
|
|
309
308
|
/**
|
|
310
309
|
* An edited part or fragment.
|
|
311
310
|
*/
|
|
312
|
-
interface EditedObject<T extends Part | Fragment> {
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
311
|
+
export interface EditedObject<T extends Part | Fragment> {
|
|
312
|
+
value: T | null;
|
|
313
|
+
thesauri: ThesauriSet;
|
|
314
|
+
layerPart?: TextLayerPart;
|
|
315
|
+
baseText?: string;
|
|
317
316
|
}
|
|
318
|
-
|
|
319
317
|
/**
|
|
320
318
|
* A simple text range, expressed as start character index and characters
|
|
321
319
|
* length. This is used for misspellings operations.
|
|
322
320
|
*/
|
|
323
|
-
declare class TextRange {
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
}
|
|
355
|
-
|
|
321
|
+
export declare class TextRange {
|
|
322
|
+
/**
|
|
323
|
+
* The start character index.
|
|
324
|
+
*/
|
|
325
|
+
start: number;
|
|
326
|
+
/**
|
|
327
|
+
* The length in characters.
|
|
328
|
+
*/
|
|
329
|
+
length: number;
|
|
330
|
+
/**
|
|
331
|
+
* Parse the specified text representing a range, in the form "startxlength"
|
|
332
|
+
* or just "start" when length is 1.
|
|
333
|
+
*
|
|
334
|
+
* @param text The text.
|
|
335
|
+
*/
|
|
336
|
+
static parse(text: string): TextRange | null;
|
|
337
|
+
constructor(start: number, length: number);
|
|
338
|
+
/**
|
|
339
|
+
* Get the inclusive end of the range.
|
|
340
|
+
*/
|
|
341
|
+
end(): number;
|
|
342
|
+
/**
|
|
343
|
+
* True if this range value is equal to the other range value.
|
|
344
|
+
* @param other The other range.
|
|
345
|
+
*/
|
|
346
|
+
isEqual(other: TextRange): boolean;
|
|
347
|
+
/**
|
|
348
|
+
* Get a parsable textual representation of this range.
|
|
349
|
+
* @returns Text.
|
|
350
|
+
*/
|
|
351
|
+
toString(): string;
|
|
352
|
+
}
|
|
356
353
|
/**
|
|
357
354
|
* A single point in a token-based textual location.
|
|
358
355
|
*/
|
|
359
|
-
declare class TokenPoint {
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
}
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
}
|
|
393
|
-
|
|
356
|
+
export declare class TokenPoint {
|
|
357
|
+
y: number;
|
|
358
|
+
x: number;
|
|
359
|
+
at?: number;
|
|
360
|
+
run?: number;
|
|
361
|
+
/**
|
|
362
|
+
* Parse the specified text representing a token-based point location.
|
|
363
|
+
* @param text The text to parse, in the forms Y.X or Y.X@AxR or
|
|
364
|
+
* Y.X@A, where R=1.
|
|
365
|
+
*/
|
|
366
|
+
static parse(text: string): TokenPoint | null;
|
|
367
|
+
constructor(y: number, x: number, at?: number, run?: number);
|
|
368
|
+
toString(): string;
|
|
369
|
+
compareTo(other: TokenPoint): number;
|
|
370
|
+
integralCompareTo(other: TokenPoint): number;
|
|
371
|
+
}
|
|
372
|
+
export declare class TokenLocation {
|
|
373
|
+
primary: TokenPoint;
|
|
374
|
+
secondary?: TokenPoint;
|
|
375
|
+
/**
|
|
376
|
+
* Parse the text representing a token-based location,
|
|
377
|
+
* which has the form "primary-secondary", or just "primary",
|
|
378
|
+
* where each of these points has the format required by
|
|
379
|
+
* TokenPoint.parse (e.g. Y.X or Y.X@AxR or Y.X@A, where R=1).
|
|
380
|
+
* @param text The text to parse.
|
|
381
|
+
*/
|
|
382
|
+
static parse(text: string): TokenLocation | null;
|
|
383
|
+
constructor(primary: TokenPoint, secondary?: TokenPoint);
|
|
384
|
+
isRange(): boolean;
|
|
385
|
+
toString(): string;
|
|
386
|
+
compareTo(other: TokenLocation): number;
|
|
387
|
+
overlaps(other: TokenLocation): boolean;
|
|
388
|
+
}
|
|
394
389
|
/**
|
|
395
390
|
* Interface implemented by those components which require a pending changes
|
|
396
391
|
* guard. The implementor must keep its canDeactivate property up to date,
|
|
397
392
|
* so that it reflects its dirty state.
|
|
398
393
|
*/
|
|
399
|
-
interface ComponentCanDeactivate {
|
|
400
|
-
|
|
394
|
+
export interface ComponentCanDeactivate {
|
|
395
|
+
canDeactivate: () => boolean | Observable<boolean>;
|
|
401
396
|
}
|
|
402
397
|
/**
|
|
403
398
|
* Pending changes guard.
|
|
404
399
|
* @param component The component to check.
|
|
405
400
|
* @returns True if the user can deactivate the component, false otherwise.
|
|
406
401
|
*/
|
|
407
|
-
declare const pendingChangesGuard: CanDeactivateFn<ComponentCanDeactivate>;
|
|
402
|
+
export declare const pendingChangesGuard: CanDeactivateFn<ComponentCanDeactivate>;
|
|
408
403
|
/**
|
|
409
404
|
* Legacy pending changes guard.
|
|
410
405
|
*/
|
|
411
|
-
declare class PendingChangesGuard {
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
406
|
+
export declare class PendingChangesGuard {
|
|
407
|
+
private _dialogService;
|
|
408
|
+
constructor(_dialogService: DialogService);
|
|
409
|
+
canDeactivate(component: ComponentCanDeactivate): boolean | Observable<boolean>;
|
|
410
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<PendingChangesGuard, never>;
|
|
411
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
417
412
|
}
|
|
418
|
-
|
|
419
413
|
/**
|
|
420
414
|
* Sort pipe. Use like *ngFor="let i of items | sort:'propname'".
|
|
421
415
|
*/
|
|
422
|
-
declare class SortPipe implements PipeTransform {
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
416
|
+
export declare class SortPipe implements PipeTransform {
|
|
417
|
+
transform(value: any[], propName: string): unknown;
|
|
418
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<SortPipe, never>;
|
|
419
|
+
static ɵpipe: i0.ɵɵPipeDeclaration<SortPipe, "sort", true>;
|
|
426
420
|
}
|
|
427
|
-
|
|
428
421
|
/**
|
|
429
422
|
* Library route service.
|
|
430
423
|
* This service is used to build routes to part and fragment editors,
|
|
@@ -443,268 +436,264 @@ declare class SortPipe implements PipeTransform {
|
|
|
443
436
|
* component route is "items/:iid/general/it.vedph.note/:pid", where
|
|
444
437
|
* ":iid" is the item ID and ":pid" the part ID.
|
|
445
438
|
*/
|
|
446
|
-
declare class LibraryRouteService {
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
}
|
|
549
|
-
|
|
439
|
+
export declare class LibraryRouteService {
|
|
440
|
+
private _partEditorKeys;
|
|
441
|
+
constructor(_partEditorKeys: PartEditorKeys);
|
|
442
|
+
/**
|
|
443
|
+
* Strip the eventual fragment-role ID from the specified part's role ID.
|
|
444
|
+
* For instance, a part's role ID like "fr.it.vedph.comment:scholarly"
|
|
445
|
+
* becomes "fr.it.vedph.comment".
|
|
446
|
+
*
|
|
447
|
+
* @param roleId The part's role ID.
|
|
448
|
+
*/
|
|
449
|
+
stripFragmentRoleId(roleId: string): string;
|
|
450
|
+
/**
|
|
451
|
+
* Get the fragment type and role from the part's role ID. This starts
|
|
452
|
+
* with "fr.", and might be followed by the role proper, introduced
|
|
453
|
+
* by the first dot if any. For instance, "fr.it.vedph.comment" would just
|
|
454
|
+
* return "fr.it.vedph.comment", while "fr.it.vedph.comment:scholarly"
|
|
455
|
+
* would return "fr.it.vedph.comment". This is required to navigate to
|
|
456
|
+
* the correct fragment editor, which is the same for each fragment type,
|
|
457
|
+
* independently from its role.
|
|
458
|
+
* @param roleId The part role ID.
|
|
459
|
+
* @returns An object where frTypeId=fragment type ID and frRoleId=fragment role
|
|
460
|
+
* ID, or null.
|
|
461
|
+
*/
|
|
462
|
+
getFragmentTypeAndRole(roleId?: string): {
|
|
463
|
+
frTypeId: string;
|
|
464
|
+
frRoleId?: string;
|
|
465
|
+
} | null;
|
|
466
|
+
/**
|
|
467
|
+
* Find among the specified parts definitions the one matching the specified
|
|
468
|
+
* type ID, and eventually role ID when specified.
|
|
469
|
+
*
|
|
470
|
+
* @param partDefs The parts definitions.
|
|
471
|
+
* @param typeId The type ID.
|
|
472
|
+
* @param roleId The role ID or null.
|
|
473
|
+
* @returns Part definition or undefined if not found.
|
|
474
|
+
*/
|
|
475
|
+
private findPartDefinition;
|
|
476
|
+
/**
|
|
477
|
+
* Get the library editor key from the specified part type, looking up
|
|
478
|
+
* the specified parts definitions.
|
|
479
|
+
*
|
|
480
|
+
* @param typeId The part's type ID.
|
|
481
|
+
* @param roleId The part's role ID.
|
|
482
|
+
*/
|
|
483
|
+
getEditorKeyFromPartType(typeId: string, roleId?: string): {
|
|
484
|
+
partKey: string;
|
|
485
|
+
frKey?: string;
|
|
486
|
+
};
|
|
487
|
+
/**
|
|
488
|
+
* Decompose the specified editor key into part and fragment.
|
|
489
|
+
* A simple editor key will just provide the same value for both.
|
|
490
|
+
*
|
|
491
|
+
* @param key The editor key to decompose.
|
|
492
|
+
*/
|
|
493
|
+
decomposeEditorKey(key: string): {
|
|
494
|
+
partKey: string;
|
|
495
|
+
frKey: string;
|
|
496
|
+
};
|
|
497
|
+
/**
|
|
498
|
+
* Build the route to the part editor corresponding to the specified
|
|
499
|
+
* part.
|
|
500
|
+
*
|
|
501
|
+
* A part editing route is like
|
|
502
|
+
* "/items/<id>/<part-group>/<part-typeid>/<part-id>?rid=<role-id>",
|
|
503
|
+
* where the role ID is optional, and may include the fragment role ID
|
|
504
|
+
* as a suffix preceded by a colon.
|
|
505
|
+
*
|
|
506
|
+
* A fragment editing route is like
|
|
507
|
+
* "/items/<id>/<part-group>/fragment/<part-id>/<fr-typeid>/<loc>?frrid=<role-id>",
|
|
508
|
+
* where the role ID is as above, and the fragment's type ID is derived
|
|
509
|
+
* from the part's role ID, stripping the eventual fragment's role ID out.
|
|
510
|
+
*
|
|
511
|
+
* @param itemId The ID of the item the parts belongs to.
|
|
512
|
+
* @param partId The part's ID.
|
|
513
|
+
* @param typeId The part's type ID.
|
|
514
|
+
* @param roleId The optional part's role ID.
|
|
515
|
+
* @returns Object with a route property and an optional rid property
|
|
516
|
+
* representing the role ID, which will be rendered as a query parameter.
|
|
517
|
+
*/
|
|
518
|
+
buildPartEditorRoute(itemId: string, partId: string, typeId: string, roleId?: string): {
|
|
519
|
+
route: string;
|
|
520
|
+
rid?: string;
|
|
521
|
+
};
|
|
522
|
+
/**
|
|
523
|
+
* Build the route to the fragment editor corresponding to the specified
|
|
524
|
+
* layers part and location.
|
|
525
|
+
*
|
|
526
|
+
* @param partDefs The parts definitions.
|
|
527
|
+
* @param itemId The ID of the item the parts belongs to.
|
|
528
|
+
* @param partId The part's ID.
|
|
529
|
+
* @param typeId The part's type ID.
|
|
530
|
+
* @param roleId The part's role ID.
|
|
531
|
+
* @param loc The fragment's location.
|
|
532
|
+
* @returns Object with a route property and an optional rid property
|
|
533
|
+
* representing the role ID, which will be rendered as a query parameter.
|
|
534
|
+
*/
|
|
535
|
+
buildFragmentEditorRoute(partDefs: PartDefinition[], itemId: string, partId: string, typeId: string, roleId: string | undefined, loc: string): {
|
|
536
|
+
route: string;
|
|
537
|
+
rid?: string;
|
|
538
|
+
};
|
|
539
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<LibraryRouteService, never>;
|
|
540
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
541
|
+
}
|
|
550
542
|
/**
|
|
551
543
|
* The selected range of text. This reflects Range useful properties;
|
|
552
544
|
* in fact, you can just pass a Range to any method requiring this parameter type,
|
|
553
545
|
* but this adds a level of indirection useful in testing.
|
|
554
546
|
*/
|
|
555
|
-
interface SelectedRange {
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
}
|
|
562
|
-
declare class TextLayerService {
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
}
|
|
708
|
-
|
|
709
|
-
export { DataPinValueType, FlagMatching, LibraryRouteService, PendingChangesGuard, SortPipe, TextLayerService, TextRange, TokenLocation, TokenPoint, pendingChangesGuard };
|
|
710
|
-
export type { ComponentCanDeactivate, DataPinDefinition, DataPinInfo, EditedObject, FacetDefinition, FlagDefinition, Fragment, FragmentIdentity, HasVersion, IndexLookupDefinition, IndexLookupDefinitions, Item, ItemFilter, ItemInfo, LayerHint, LayerPartInfo, LoginCredentials, Part, PartDefinition, PartEditorKeys, PartGroup, PartGroupKey, PartIdentity, PartTypeIds, SelectedRange, TextCoords, TextLayerPart, ThesauriSet, Thesaurus, ThesaurusEntry, ThesaurusFilter, TokenTextLayerLine, UserInfo };
|
|
547
|
+
export interface SelectedRange {
|
|
548
|
+
commonAncestorContainer: Node;
|
|
549
|
+
startContainer: Node;
|
|
550
|
+
startOffset: number;
|
|
551
|
+
endContainer: Node;
|
|
552
|
+
endOffset: number;
|
|
553
|
+
}
|
|
554
|
+
export declare class TextLayerService {
|
|
555
|
+
private readonly _wsRegex;
|
|
556
|
+
constructor();
|
|
557
|
+
private isWhitespace;
|
|
558
|
+
/**
|
|
559
|
+
* Extract the lines with their tokens from the specified text.
|
|
560
|
+
* @param text the source text.
|
|
561
|
+
* @returns lines.
|
|
562
|
+
*/
|
|
563
|
+
getLines(text: string): TokenTextLayerLine[];
|
|
564
|
+
/**
|
|
565
|
+
* Get the fragment of text defined by the specified location.
|
|
566
|
+
*
|
|
567
|
+
* @param text The full base text.
|
|
568
|
+
* @param location The location to get text for.
|
|
569
|
+
* @returns A fragment of text corresponding to location.
|
|
570
|
+
*/
|
|
571
|
+
getTextFragment(text: string, location: TokenLocation): string;
|
|
572
|
+
/**
|
|
573
|
+
* Render the opening span for a layer fragment.
|
|
574
|
+
* @param loc location.
|
|
575
|
+
* @param locPortion the index of the token's portion (0-N). This is used
|
|
576
|
+
* to build a unique ID for each HTML span rendering a layer fragment.
|
|
577
|
+
* @param sb the target strings array.
|
|
578
|
+
* @param isSelected true if selected.
|
|
579
|
+
*/
|
|
580
|
+
private renderOpeningSpan;
|
|
581
|
+
/**
|
|
582
|
+
* Render the specified token intersecting the specified end-fragment location.
|
|
583
|
+
* @param pt The point.
|
|
584
|
+
* @param token The token.
|
|
585
|
+
* @param sb The target array.
|
|
586
|
+
*/
|
|
587
|
+
private renderTokenAtEnd;
|
|
588
|
+
/**
|
|
589
|
+
* Render the specified token intersecting the specified single-point location.
|
|
590
|
+
* The received token starts and ends a single-token range.
|
|
591
|
+
* @param loc location.
|
|
592
|
+
* @param token token.
|
|
593
|
+
* @param sb target strings array.
|
|
594
|
+
* @param isSelected True if the token is selected.
|
|
595
|
+
*/
|
|
596
|
+
private renderTokenAtPointStart;
|
|
597
|
+
/**
|
|
598
|
+
* Render the specified token intersecting the specified range start location.
|
|
599
|
+
* The received token starts a multi-tokens range.
|
|
600
|
+
* @param loc location.
|
|
601
|
+
* @param token token.
|
|
602
|
+
* @param sb target strings array.
|
|
603
|
+
* @param isSelected True if the token is selected.
|
|
604
|
+
*/
|
|
605
|
+
private renderTokenAtRangeStart;
|
|
606
|
+
private renderTokenAtStart;
|
|
607
|
+
/**
|
|
608
|
+
* Render to HTML the base text decorated with its layer fragments.
|
|
609
|
+
* @param text The base text.
|
|
610
|
+
* @param locations The locations of all the fragments
|
|
611
|
+
* of the same type to be rendered on top of the base text.
|
|
612
|
+
* @param selectedLoc The optional location of the selected
|
|
613
|
+
* fragment if any. The selected fragment gets decorated with an additional
|
|
614
|
+
* class value.
|
|
615
|
+
*/
|
|
616
|
+
render(text: string, locations?: TokenLocation[], selectedLoc?: TokenLocation): string;
|
|
617
|
+
/**
|
|
618
|
+
* Get the Y bounds from the specified selection.
|
|
619
|
+
* @param range The selection range.
|
|
620
|
+
* @param forNew True if getting bounds for a new fragment.
|
|
621
|
+
* @returns Range, inclusive, or undefined.
|
|
622
|
+
*/
|
|
623
|
+
private getYBoundsFromRange;
|
|
624
|
+
private locatePrevSpace;
|
|
625
|
+
private locateNextSpace;
|
|
626
|
+
/**
|
|
627
|
+
* Get the bounds of the token any character of which is indexed
|
|
628
|
+
* by index.
|
|
629
|
+
* @param line The text line.
|
|
630
|
+
* @param index The index to the text line to start from.
|
|
631
|
+
* @returns Bounds where start=index of the first character of the token,
|
|
632
|
+
* and end=index of the character past the token's last character;
|
|
633
|
+
* or null if index was not valid.
|
|
634
|
+
*/
|
|
635
|
+
private getTokenBounds;
|
|
636
|
+
/**
|
|
637
|
+
* Return the received selection bounds, adjusted to exclude spaces.
|
|
638
|
+
*/
|
|
639
|
+
private getAdjustedSelectionBounds;
|
|
640
|
+
/**
|
|
641
|
+
* Get the start coordinates for the selected range and line.
|
|
642
|
+
* @param range The selected range.
|
|
643
|
+
* @param line The reference text line.
|
|
644
|
+
*/
|
|
645
|
+
private getStartCoordsFromRange;
|
|
646
|
+
private getEndCoordsFromRange;
|
|
647
|
+
private getSpanLocFromId;
|
|
648
|
+
private visitNodes;
|
|
649
|
+
private findFirstDescendantSpan;
|
|
650
|
+
/**
|
|
651
|
+
* Get the base offset for the specified node. This is used
|
|
652
|
+
* when the start container of the selected range has any
|
|
653
|
+
* preceding sibling node, which happens only when you have
|
|
654
|
+
* any spans in the p element (=the line). In this case,
|
|
655
|
+
* the selection offset starts from the start container node,
|
|
656
|
+
* which is preceded by other nodes including other text.
|
|
657
|
+
* As we must get the line-based offset, we have to start
|
|
658
|
+
* from a base offset equal to the sum of the lengths of
|
|
659
|
+
* all the preceding siblings.
|
|
660
|
+
*/
|
|
661
|
+
private getNodeBaseOffset;
|
|
662
|
+
/**
|
|
663
|
+
* Get the location corresponding to the user selection,
|
|
664
|
+
* for editing the first fragment included in it.
|
|
665
|
+
* @param range The selected range. You can get it from the
|
|
666
|
+
* current selection using getSelectedRange().
|
|
667
|
+
* @returns The token location or null.
|
|
668
|
+
*/
|
|
669
|
+
getSelectedLocationForEdit(range: SelectedRange): TokenLocation | null;
|
|
670
|
+
private textLineToString;
|
|
671
|
+
private buildCoords;
|
|
672
|
+
/**
|
|
673
|
+
* Recursively find the node matching the specified matcher
|
|
674
|
+
* function, starting from the specified node (included).
|
|
675
|
+
*
|
|
676
|
+
* @param node The node to start from.
|
|
677
|
+
* @param matcher The matcher function, which receives a node
|
|
678
|
+
* to match, and returns 1=match, 0=no match, -1=stop the
|
|
679
|
+
* find operation with a no match.
|
|
680
|
+
* @return 1=match, 0=no match, -1=stop the find operation with a no match.
|
|
681
|
+
*/
|
|
682
|
+
private matchNode;
|
|
683
|
+
private selHasAnySpan;
|
|
684
|
+
/**
|
|
685
|
+
* Get the location corresponding to the user selection,
|
|
686
|
+
* for adding a new fragment with the same extension.
|
|
687
|
+
* @param range The selected range. You can get it from the
|
|
688
|
+
* current selection using getSelectedRange().
|
|
689
|
+
* @param text The full base text.
|
|
690
|
+
* @returns TokenLocation The token location or undefined.
|
|
691
|
+
*/
|
|
692
|
+
getSelectedLocationForNew(range: SelectedRange, text: string): TokenLocation | null;
|
|
693
|
+
/**
|
|
694
|
+
* Get the currently selected range in the browser's document.
|
|
695
|
+
*/
|
|
696
|
+
getSelectedRange(): Range | null;
|
|
697
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<TextLayerService, never>;
|
|
698
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
699
|
+
}
|