@myrmidon/cadmus-core 0.3.0 → 1.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.
- package/README.md +24 -24
- package/esm2020/lib/cadmus-core.module.mjs +4 -4
- package/esm2020/lib/guards/pending-changes.guard.mjs +3 -3
- package/esm2020/lib/models.mjs +1 -1
- package/esm2020/lib/pipes/sort.pipe.mjs +3 -3
- package/esm2020/lib/services/library-route.service.mjs +3 -3
- package/esm2020/lib/services/text-layer.service.mjs +3 -3
- package/esm2020/public-api.mjs +1 -6
- package/fesm2015/myrmidon-cadmus-core.mjs +19 -899
- package/fesm2015/myrmidon-cadmus-core.mjs.map +1 -1
- package/fesm2020/myrmidon-cadmus-core.mjs +19 -898
- package/fesm2020/myrmidon-cadmus-core.mjs.map +1 -1
- package/lib/models.d.ts +0 -48
- package/package.json +5 -5
- package/public-api.d.ts +0 -4
- package/esm2020/lib/datation.mjs +0 -521
- package/esm2020/lib/historical-date.mjs +0 -299
- package/esm2020/lib/services/gravatar.service.mjs +0 -30
- package/esm2020/lib/validators/password.validator.mjs +0 -34
- package/lib/datation.d.ts +0 -157
- package/lib/historical-date.d.ts +0 -84
- package/lib/services/gravatar.service.d.ts +0 -12
- package/lib/validators/password.validator.d.ts +0 -4
|
@@ -1,828 +1,9 @@
|
|
|
1
|
-
import { RomanNumber, NgToolsModule } from '@myrmidon/ng-tools';
|
|
2
1
|
import * as i0 from '@angular/core';
|
|
3
2
|
import { Injectable, Pipe, Inject, NgModule } from '@angular/core';
|
|
4
|
-
import * as gravatar from 'gravatar';
|
|
5
3
|
import * as rangy from 'rangy';
|
|
6
4
|
import { CommonModule } from '@angular/common';
|
|
7
5
|
import { HttpClientModule } from '@angular/common/http';
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Default options for formatting a datation.
|
|
11
|
-
*/
|
|
12
|
-
const DATATION_FORMAT_OPTIONS = {
|
|
13
|
-
aboutText: 'c.',
|
|
14
|
-
bcText: 'BC',
|
|
15
|
-
adText: 'AD',
|
|
16
|
-
dayNames: ['sun', 'mon', 'tue', 'wed', 'thu', 'fri', 'sat'],
|
|
17
|
-
monthNames: [
|
|
18
|
-
'jan',
|
|
19
|
-
'feb',
|
|
20
|
-
'mar',
|
|
21
|
-
'apr',
|
|
22
|
-
'may',
|
|
23
|
-
'jun',
|
|
24
|
-
'jul',
|
|
25
|
-
'aug',
|
|
26
|
-
'sep',
|
|
27
|
-
'oct',
|
|
28
|
-
'nov',
|
|
29
|
-
'dec',
|
|
30
|
-
],
|
|
31
|
-
};
|
|
32
|
-
/**
|
|
33
|
-
* Single datation point in a historical date.
|
|
34
|
-
*/
|
|
35
|
-
// https://github.com/angular/angular/issues/18867#issuecomment-357484102
|
|
36
|
-
// @dynamic
|
|
37
|
-
class Datation {
|
|
38
|
-
/**
|
|
39
|
-
* Create a new datation, optionally setting its data.
|
|
40
|
-
* @param datation The optional data to be copied into the newly created datation.
|
|
41
|
-
*/
|
|
42
|
-
constructor(datation) {
|
|
43
|
-
this.value = 0;
|
|
44
|
-
if (datation) {
|
|
45
|
-
this.copyFrom(datation);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* Sanitize the hint text representing a Datation's hint so that it does not
|
|
50
|
-
* include the reserved sequence -- (which gets replaced with Unicode EM
|
|
51
|
-
* space U+2014), nor the braces. This is because the double dashes are used
|
|
52
|
-
* to separate two datations, and braces to mark a hint in a datation.
|
|
53
|
-
* Also, the whitespaces are all flattened to simple spaces, and normalized
|
|
54
|
-
* (no whitespaces at start/end and no sequence of whitespaces).
|
|
55
|
-
* If the resulting sanitized string is empty, or it was null when received,
|
|
56
|
-
* null is returned.
|
|
57
|
-
* @param hint The hint or null/undefined.
|
|
58
|
-
* @returns The sanitized hint or undefined.
|
|
59
|
-
*/
|
|
60
|
-
static sanitizeHint(hint) {
|
|
61
|
-
if (!hint || !hint.trim()) {
|
|
62
|
-
return undefined;
|
|
63
|
-
}
|
|
64
|
-
// replace reserved characters
|
|
65
|
-
hint = hint.replace('--', '\u2014');
|
|
66
|
-
hint = hint.replace('{', '');
|
|
67
|
-
hint = hint.replace('}', '');
|
|
68
|
-
// flatten and normalize whitespaces
|
|
69
|
-
const s = hint.replace(/\s+/g, ' ').trim();
|
|
70
|
-
return s ? s : undefined;
|
|
71
|
-
}
|
|
72
|
-
static regexEscape(text) {
|
|
73
|
-
// https://stackoverflow.com/questions/3561493/is-there-a-regexp-escape-function-in-javascript
|
|
74
|
-
return text.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');
|
|
75
|
-
}
|
|
76
|
-
/**
|
|
77
|
-
* Get BC and AD patterns for matching.
|
|
78
|
-
* @param options The datation format options.
|
|
79
|
-
*/
|
|
80
|
-
static getErasOptionsForRegex(options = DATATION_FORMAT_OPTIONS) {
|
|
81
|
-
return [
|
|
82
|
-
options.bcText ? this.regexEscape(options.bcText) : 'BC',
|
|
83
|
-
options.adText ? this.regexEscape(options.adText) : 'AD',
|
|
84
|
-
];
|
|
85
|
-
}
|
|
86
|
-
static getParserRegex(options) {
|
|
87
|
-
const bcad = this.getErasOptionsForRegex(options);
|
|
88
|
-
return new RegExp(
|
|
89
|
-
// about (1)
|
|
90
|
-
'(c\\.)?\\s*' +
|
|
91
|
-
// day (2)
|
|
92
|
-
'(?:([0123]?\\d)\\s+)?' +
|
|
93
|
-
// month (3)
|
|
94
|
-
'(?:([a-zA-Z]{3,})\\s+)?' +
|
|
95
|
-
// year/span (4,5)
|
|
96
|
-
'(?:' +
|
|
97
|
-
'(?:(\\d+)(?:\\s*/\\s*(\\d+))?)|' +
|
|
98
|
-
// century (6)
|
|
99
|
-
'([ivxIVX]+)' +
|
|
100
|
-
')\\s*' +
|
|
101
|
-
// era (7)
|
|
102
|
-
'(' +
|
|
103
|
-
bcad[0] +
|
|
104
|
-
'|' +
|
|
105
|
-
bcad[1] +
|
|
106
|
-
')?' +
|
|
107
|
-
// perhaps (8)
|
|
108
|
-
'(\\s*\\?)?' +
|
|
109
|
-
// hint (9)
|
|
110
|
-
'(?:\\s*\\{([^}]+)\\})?', 'i');
|
|
111
|
-
}
|
|
112
|
-
/**
|
|
113
|
-
* Parse the specified text representing a datation.
|
|
114
|
-
* @param text The text to be parsed.
|
|
115
|
-
* @param options The formatter options.
|
|
116
|
-
* @returns The parsed datation, or undefined if invalid or empty.
|
|
117
|
-
* Note that here we return undefined to mean a non-existing point.
|
|
118
|
-
* We do not want a non-existing point to be represented as a null,
|
|
119
|
-
* as this would be included as in the JSON code when serializing.
|
|
120
|
-
*/
|
|
121
|
-
static parse(text, options = DATATION_FORMAT_OPTIONS) {
|
|
122
|
-
if (!text) {
|
|
123
|
-
return null;
|
|
124
|
-
}
|
|
125
|
-
const datation = new Datation();
|
|
126
|
-
const datationRegex = this.getParserRegex(options);
|
|
127
|
-
const m = datationRegex.exec(text);
|
|
128
|
-
if (!m) {
|
|
129
|
-
return null;
|
|
130
|
-
}
|
|
131
|
-
// about
|
|
132
|
-
if (m[1]) {
|
|
133
|
-
datation.isApproximate = true;
|
|
134
|
-
}
|
|
135
|
-
// day
|
|
136
|
-
if (m[2]) {
|
|
137
|
-
datation.day = parseInt(m[2], 10);
|
|
138
|
-
}
|
|
139
|
-
// month
|
|
140
|
-
if (m[3]) {
|
|
141
|
-
const lowerMonth = m[3].toLowerCase();
|
|
142
|
-
const i = options.monthNames.findIndex((name) => name.toLowerCase() === lowerMonth);
|
|
143
|
-
if (i > -1) {
|
|
144
|
-
datation.month = i + 1;
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
// year, span
|
|
148
|
-
if (m[4]) {
|
|
149
|
-
datation.value = parseInt(m[4], 10);
|
|
150
|
-
if (m[5]) {
|
|
151
|
-
datation.isSpan = true;
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
else {
|
|
155
|
-
datation.value = RomanNumber.fromRoman(m[6].toUpperCase());
|
|
156
|
-
datation.isCentury = true;
|
|
157
|
-
}
|
|
158
|
-
// era
|
|
159
|
-
if (m[7]) {
|
|
160
|
-
const era = m[7].replace(' ', '').toLowerCase();
|
|
161
|
-
if (era === options.bcText.toLowerCase()) {
|
|
162
|
-
datation.value = -datation.value;
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
// dubious
|
|
166
|
-
if (m[8]) {
|
|
167
|
-
datation.isDubious = true;
|
|
168
|
-
}
|
|
169
|
-
// hint
|
|
170
|
-
if (m[9]) {
|
|
171
|
-
datation.hint = Datation.sanitizeHint(m[9]);
|
|
172
|
-
}
|
|
173
|
-
return datation;
|
|
174
|
-
}
|
|
175
|
-
/**
|
|
176
|
-
* Strip any era code from the specified datation format string.
|
|
177
|
-
* @param format The format string.
|
|
178
|
-
*/
|
|
179
|
-
static stripFormatStringEra(format) {
|
|
180
|
-
if (!format) {
|
|
181
|
-
return 'i';
|
|
182
|
-
}
|
|
183
|
-
// convert ga gp Ga Gp into simple g G
|
|
184
|
-
format = format.replace(new RegExp('([gG])[ap]', 'gi'), '$1');
|
|
185
|
-
// replace g/G with i/I
|
|
186
|
-
format = format.replace('g', 'i');
|
|
187
|
-
format = format.replace('G', 'I');
|
|
188
|
-
// remove ea ep Ea Ep with preceding w/W if any
|
|
189
|
-
format = format.replace(new RegExp('[wW]?[eE][ap]?', 'gi'), '');
|
|
190
|
-
return format;
|
|
191
|
-
}
|
|
192
|
-
/**
|
|
193
|
-
* Reset this datation.
|
|
194
|
-
*/
|
|
195
|
-
reset() {
|
|
196
|
-
this.value = 0;
|
|
197
|
-
this.isCentury = false;
|
|
198
|
-
this.isSpan = false;
|
|
199
|
-
this.isApproximate = false;
|
|
200
|
-
this.day = 0;
|
|
201
|
-
this.month = 0;
|
|
202
|
-
this.hint = undefined;
|
|
203
|
-
}
|
|
204
|
-
/**
|
|
205
|
-
* Copy data from the specified source datatation.
|
|
206
|
-
* @param datation The source datation.
|
|
207
|
-
*/
|
|
208
|
-
copyFrom(datation) {
|
|
209
|
-
this.value = datation.value;
|
|
210
|
-
this.isCentury = datation.isCentury;
|
|
211
|
-
this.isSpan = datation.isSpan;
|
|
212
|
-
this.isApproximate = datation.isApproximate;
|
|
213
|
-
this.isDubious = datation.isDubious;
|
|
214
|
-
this.day = datation.day;
|
|
215
|
-
this.month = datation.month;
|
|
216
|
-
this.hint = datation.hint ? datation.hint : undefined;
|
|
217
|
-
}
|
|
218
|
-
/**
|
|
219
|
-
* True if this datation is undefined. A datation is undefined when
|
|
220
|
-
* its value is 0. Undefined datations are used as unknown points in a range
|
|
221
|
-
* for termini ante/post.
|
|
222
|
-
*/
|
|
223
|
-
isUndefined() {
|
|
224
|
-
return !this.value;
|
|
225
|
-
}
|
|
226
|
-
/**
|
|
227
|
-
* Get a sort value from this datation.
|
|
228
|
-
*/
|
|
229
|
-
getSortValue() {
|
|
230
|
-
let result;
|
|
231
|
-
if (this.isCentury) {
|
|
232
|
-
result = this.value * 100 + (this.value < 0 ? 50 : -50);
|
|
233
|
-
}
|
|
234
|
-
else {
|
|
235
|
-
result = this.value;
|
|
236
|
-
}
|
|
237
|
-
if (this.isSpan) {
|
|
238
|
-
result += 0.5;
|
|
239
|
-
}
|
|
240
|
-
if (this.month && this.month > 0 && this.month <= 12) {
|
|
241
|
-
result += this.month / 12;
|
|
242
|
-
}
|
|
243
|
-
if (this.day && this.day > 0 && this.day <= 31) {
|
|
244
|
-
result += this.day / (12 * 31);
|
|
245
|
-
}
|
|
246
|
-
return result;
|
|
247
|
-
}
|
|
248
|
-
/**
|
|
249
|
-
* Get the 2-years span end value from this datation.
|
|
250
|
-
* A span year is always represented with its beginning year: e.g. -776/5
|
|
251
|
-
* is -776 with span, and 56/7 is 56 with span. This method returns the end year
|
|
252
|
-
* for a span, i.e. in the above samples -775 and 57 respectively. If this datation
|
|
253
|
-
* is not a span, the function just returns the unique year value.
|
|
254
|
-
*/
|
|
255
|
-
getSpanEnd() {
|
|
256
|
-
if (this.isCentury) {
|
|
257
|
-
return 0;
|
|
258
|
-
}
|
|
259
|
-
return this.isSpan ? this.value + 1 : this.value;
|
|
260
|
-
}
|
|
261
|
-
/**
|
|
262
|
-
* Get the century number corresponding this datation.
|
|
263
|
-
* This function returns 0 if the datation is null, or the century number,
|
|
264
|
-
* less than 0 if B.C. The result is based on the century value, if
|
|
265
|
-
* this is a century datation, or on the year, if this is not a century
|
|
266
|
-
* datation (e.g. -5 for 480 B.C., +1 for 31 A.D.).
|
|
267
|
-
*/
|
|
268
|
-
getCentury() {
|
|
269
|
-
if (this.value === 0) {
|
|
270
|
-
return 0;
|
|
271
|
-
}
|
|
272
|
-
return this.isCentury
|
|
273
|
-
? this.value
|
|
274
|
-
: Math.trunc(this.value / 100 + (this.value < 0 ? -1 : 1));
|
|
275
|
-
}
|
|
276
|
-
matchTokenAt(token, text, index) {
|
|
277
|
-
if (index + token.length > text.length) {
|
|
278
|
-
return false;
|
|
279
|
-
}
|
|
280
|
-
for (let i = 0; i < token.length; i++) {
|
|
281
|
-
if (token.charAt(i) !== text.charAt(i + index)) {
|
|
282
|
-
return false;
|
|
283
|
-
}
|
|
284
|
-
}
|
|
285
|
-
return true;
|
|
286
|
-
}
|
|
287
|
-
parseFormatString(format) {
|
|
288
|
-
if (!format) {
|
|
289
|
-
return ['G'];
|
|
290
|
-
}
|
|
291
|
-
// expand macros
|
|
292
|
-
const macros = [
|
|
293
|
-
'ga',
|
|
294
|
-
'awdwMMMwvwepwpwh',
|
|
295
|
-
'Ga',
|
|
296
|
-
'awdwMMMwvwepwpwh',
|
|
297
|
-
'gp',
|
|
298
|
-
'awdwMMMwvweawpwh',
|
|
299
|
-
'Gp',
|
|
300
|
-
'awdwMMMwvweawpwh',
|
|
301
|
-
'g',
|
|
302
|
-
'awdwMMMwvwewpwh',
|
|
303
|
-
'G',
|
|
304
|
-
'AwdwMMMwVwewPwH',
|
|
305
|
-
'i',
|
|
306
|
-
'awdwMMMwvwpwh',
|
|
307
|
-
'I',
|
|
308
|
-
'AwdwMMMwVwPwH',
|
|
309
|
-
];
|
|
310
|
-
const sb = [];
|
|
311
|
-
let fi = 0;
|
|
312
|
-
let matched;
|
|
313
|
-
while (fi < format.length) {
|
|
314
|
-
matched = false;
|
|
315
|
-
for (let mi = 0; mi < macros.length; mi += 2) {
|
|
316
|
-
if (this.matchTokenAt(macros[mi], format, fi)) {
|
|
317
|
-
sb.push(macros[mi + 1]);
|
|
318
|
-
fi += macros[mi].length;
|
|
319
|
-
matched = true;
|
|
320
|
-
break;
|
|
321
|
-
}
|
|
322
|
-
}
|
|
323
|
-
if (!matched) {
|
|
324
|
-
sb.push(format[fi]);
|
|
325
|
-
fi++;
|
|
326
|
-
}
|
|
327
|
-
}
|
|
328
|
-
format = sb.join();
|
|
329
|
-
// split into tokens and literals
|
|
330
|
-
const tokens = [
|
|
331
|
-
'ddd',
|
|
332
|
-
'MMM',
|
|
333
|
-
'dd',
|
|
334
|
-
'ea',
|
|
335
|
-
'ep',
|
|
336
|
-
'Ea',
|
|
337
|
-
'Ep',
|
|
338
|
-
'ga',
|
|
339
|
-
'Ga',
|
|
340
|
-
'gp',
|
|
341
|
-
'Gp',
|
|
342
|
-
'MM',
|
|
343
|
-
];
|
|
344
|
-
fi = 0;
|
|
345
|
-
const results = [];
|
|
346
|
-
while (fi < format.length) {
|
|
347
|
-
matched = false;
|
|
348
|
-
for (let ti = 0; ti < tokens.length; ti++) {
|
|
349
|
-
if (this.matchTokenAt(tokens[ti], format, fi)) {
|
|
350
|
-
results.push(tokens[ti]);
|
|
351
|
-
fi += tokens[ti].length;
|
|
352
|
-
matched = true;
|
|
353
|
-
break;
|
|
354
|
-
}
|
|
355
|
-
}
|
|
356
|
-
if (!matched) {
|
|
357
|
-
results.push(format.charAt(fi));
|
|
358
|
-
fi++;
|
|
359
|
-
}
|
|
360
|
-
}
|
|
361
|
-
return results;
|
|
362
|
-
}
|
|
363
|
-
/**
|
|
364
|
-
* Convert this datation to a string.
|
|
365
|
-
* @param format The format string, which can include any of the following:
|
|
366
|
-
* v = year or century value, lowercase
|
|
367
|
-
* V = year or century value, uppercase
|
|
368
|
-
* c = century, lowercase
|
|
369
|
-
* C = century, uppercase
|
|
370
|
-
* a or A = 'about' marker when present
|
|
371
|
-
* p or P = 'perhaps' marker when present
|
|
372
|
-
* d = day number when present
|
|
373
|
-
* dd = 2-digits (0-padded at left) day number when present
|
|
374
|
-
* ddd = weekday name when present
|
|
375
|
-
* M = month number when present
|
|
376
|
-
* MM = 2-digits (0-padded at left) month number when present
|
|
377
|
-
* MMM = month name when present
|
|
378
|
-
* e = era
|
|
379
|
-
* E = era, all uppercase
|
|
380
|
-
* ea = era, only if ante Christum natum
|
|
381
|
-
* ep = era, only if post Christum natum
|
|
382
|
-
* Ea = era all uppercase, only if ante Christum natum
|
|
383
|
-
* Ep = era all uppercase, only if post Christum natum
|
|
384
|
-
* h or H = hint when present
|
|
385
|
-
* w or W = smart whitespace (appended only when left char if any
|
|
386
|
-
* is not a whitespace)
|
|
387
|
-
* s or S = sort value
|
|
388
|
-
* g = generic: equal to awdwMMMwvwewpwh
|
|
389
|
-
* G = generic uppercase: equal to AwdwMMMwVwewPwH
|
|
390
|
-
* ga = generic ante Christum: era expressed only when post Christum
|
|
391
|
-
* natum. Equal to awdwMMMwvwepwpwh
|
|
392
|
-
* Ga = generic uppercase ante Christum: equal to awdwMMMwvwepwpwh
|
|
393
|
-
* gp = generic post Christum: era expressed only when ante Christum
|
|
394
|
-
* natum. Equal to awdwMMMwvweawpwh
|
|
395
|
-
* Gp = generic uppercase post Christum: equal to awdwMMMwvweawpwh
|
|
396
|
-
* i = generic with implicit (=not expressed) era: equal to awdwMMMwvwpwh
|
|
397
|
-
* I = generic uppercase with implicit (=not expressed) era: equal to
|
|
398
|
-
* AwdwMMMwVwPwH
|
|
399
|
-
* @param options The options.
|
|
400
|
-
*/
|
|
401
|
-
toString(format = 'G', options = DATATION_FORMAT_OPTIONS) {
|
|
402
|
-
if (this.isUndefined()) {
|
|
403
|
-
return '';
|
|
404
|
-
}
|
|
405
|
-
if (!format) {
|
|
406
|
-
format = 'G';
|
|
407
|
-
}
|
|
408
|
-
if (!options) {
|
|
409
|
-
options = DATATION_FORMAT_OPTIONS;
|
|
410
|
-
}
|
|
411
|
-
const sb = [];
|
|
412
|
-
const tokens = this.parseFormatString(format);
|
|
413
|
-
tokens.forEach((token) => {
|
|
414
|
-
switch (token) {
|
|
415
|
-
case 'v':
|
|
416
|
-
case 'V':
|
|
417
|
-
// year or century
|
|
418
|
-
if (this.isCentury) {
|
|
419
|
-
sb.push(token === 'v'
|
|
420
|
-
? RomanNumber.toRoman(Math.abs(this.value)).toLowerCase()
|
|
421
|
-
: RomanNumber.toRoman(Math.abs(this.value)).toUpperCase());
|
|
422
|
-
}
|
|
423
|
-
else {
|
|
424
|
-
const year = Math.abs(this.value);
|
|
425
|
-
sb.push(year.toString());
|
|
426
|
-
if (this.isSpan) {
|
|
427
|
-
sb.push(`/${year + (this.value < 0 ? -1 : +1)}`);
|
|
428
|
-
}
|
|
429
|
-
}
|
|
430
|
-
break;
|
|
431
|
-
case 'c':
|
|
432
|
-
case 'C':
|
|
433
|
-
const century = Math.abs(this.getCentury());
|
|
434
|
-
sb.push(token === 'c'
|
|
435
|
-
? RomanNumber.toRoman(century).toLowerCase()
|
|
436
|
-
: RomanNumber.toRoman(century).toUpperCase());
|
|
437
|
-
break;
|
|
438
|
-
case 'a':
|
|
439
|
-
case 'A':
|
|
440
|
-
if (this.isApproximate) {
|
|
441
|
-
sb.push(options.aboutText);
|
|
442
|
-
}
|
|
443
|
-
break;
|
|
444
|
-
case 'p':
|
|
445
|
-
case 'P':
|
|
446
|
-
if (this.isDubious) {
|
|
447
|
-
sb.push('?');
|
|
448
|
-
}
|
|
449
|
-
break;
|
|
450
|
-
case 'd':
|
|
451
|
-
if (this.day) {
|
|
452
|
-
sb.push(this.day.toString());
|
|
453
|
-
}
|
|
454
|
-
break;
|
|
455
|
-
case 'dd':
|
|
456
|
-
if (this.day) {
|
|
457
|
-
sb.push(this.day.toString().padStart(2, '0'));
|
|
458
|
-
}
|
|
459
|
-
break;
|
|
460
|
-
case 'ddd':
|
|
461
|
-
if (this.month && this.day) {
|
|
462
|
-
const date = new Date(this.value, this.month, this.day);
|
|
463
|
-
const dow = date.getDay();
|
|
464
|
-
sb.push(options.dayNames[dow]);
|
|
465
|
-
}
|
|
466
|
-
break;
|
|
467
|
-
case 'M':
|
|
468
|
-
if (this.month) {
|
|
469
|
-
sb.push(this.month.toString());
|
|
470
|
-
}
|
|
471
|
-
break;
|
|
472
|
-
case 'MM':
|
|
473
|
-
if (this.month) {
|
|
474
|
-
sb.push(this.month.toString().padStart(2, '0'));
|
|
475
|
-
}
|
|
476
|
-
break;
|
|
477
|
-
case 'MMM':
|
|
478
|
-
if (this.month) {
|
|
479
|
-
sb.push(options.monthNames[this.month - 1]);
|
|
480
|
-
}
|
|
481
|
-
break;
|
|
482
|
-
case 'e':
|
|
483
|
-
sb.push(this.value < 0 ? options.bcText : options.adText);
|
|
484
|
-
break;
|
|
485
|
-
case 'E':
|
|
486
|
-
sb.push(this.value < 0
|
|
487
|
-
? options.bcText.toUpperCase()
|
|
488
|
-
: options.adText.toUpperCase());
|
|
489
|
-
break;
|
|
490
|
-
case 'ea':
|
|
491
|
-
if (this.value < 0) {
|
|
492
|
-
sb.push(options.bcText);
|
|
493
|
-
}
|
|
494
|
-
break;
|
|
495
|
-
case 'ep':
|
|
496
|
-
if (this.value > 0) {
|
|
497
|
-
sb.push(options.adText);
|
|
498
|
-
}
|
|
499
|
-
break;
|
|
500
|
-
case 'h':
|
|
501
|
-
case 'H':
|
|
502
|
-
if (this.hint) {
|
|
503
|
-
sb.push(` {${this.hint}}`);
|
|
504
|
-
}
|
|
505
|
-
break;
|
|
506
|
-
case 'w':
|
|
507
|
-
case 'W':
|
|
508
|
-
if (sb.length > 0) {
|
|
509
|
-
const last = sb[sb.length - 1];
|
|
510
|
-
if (!last.endsWith(' ')) {
|
|
511
|
-
sb.push(' ');
|
|
512
|
-
}
|
|
513
|
-
}
|
|
514
|
-
break;
|
|
515
|
-
case 's':
|
|
516
|
-
case 'S':
|
|
517
|
-
sb.push(this.getSortValue().toString());
|
|
518
|
-
break;
|
|
519
|
-
default:
|
|
520
|
-
// literal
|
|
521
|
-
sb.push(token);
|
|
522
|
-
break;
|
|
523
|
-
}
|
|
524
|
-
});
|
|
525
|
-
return sb.join('').trim().replace(new RegExp('\\s+', 'g'), ' ');
|
|
526
|
-
}
|
|
527
|
-
}
|
|
528
|
-
|
|
529
|
-
const APPROX_DELTA = 10;
|
|
530
|
-
/**
|
|
531
|
-
* Type of historical date.
|
|
532
|
-
*/
|
|
533
|
-
var HistoricalDateType;
|
|
534
|
-
(function (HistoricalDateType) {
|
|
535
|
-
HistoricalDateType[HistoricalDateType["undefined"] = 0] = "undefined";
|
|
536
|
-
HistoricalDateType[HistoricalDateType["point"] = 1] = "point";
|
|
537
|
-
HistoricalDateType[HistoricalDateType["range"] = 2] = "range";
|
|
538
|
-
})(HistoricalDateType || (HistoricalDateType = {}));
|
|
539
|
-
/**
|
|
540
|
-
* A historical date, including 0, 1, or 2 datation points.
|
|
541
|
-
*/
|
|
542
|
-
class HistoricalDate {
|
|
543
|
-
constructor(date) {
|
|
544
|
-
if (!date) {
|
|
545
|
-
this.a = new Datation();
|
|
546
|
-
// B=undefined for a single point
|
|
547
|
-
}
|
|
548
|
-
else {
|
|
549
|
-
this.a = new Datation(date.a);
|
|
550
|
-
if (date.b) {
|
|
551
|
-
this.b = new Datation(date.b);
|
|
552
|
-
}
|
|
553
|
-
}
|
|
554
|
-
}
|
|
555
|
-
/**
|
|
556
|
-
* Parse the specified text representing a historical datation.
|
|
557
|
-
* @param text The text to be parsed.
|
|
558
|
-
* @param options The datation formatter options.
|
|
559
|
-
* @return The datation, or undefined if invalid.
|
|
560
|
-
*/
|
|
561
|
-
static parse(text, options = DATATION_FORMAT_OPTIONS) {
|
|
562
|
-
if (!text) {
|
|
563
|
-
return null;
|
|
564
|
-
}
|
|
565
|
-
const dates = text.split('--');
|
|
566
|
-
let s1 = dates[0].trim();
|
|
567
|
-
const s2 = dates.length > 1 ? dates[1].trim() : null;
|
|
568
|
-
const date = new HistoricalDate();
|
|
569
|
-
if (dates.length > 1) {
|
|
570
|
-
// if both terms are specified, integrate BC/AD indication in 1st if required
|
|
571
|
-
if (s1 && s2) {
|
|
572
|
-
const bcad = Datation.getErasOptionsForRegex(options);
|
|
573
|
-
const tailRegexp = new RegExp(
|
|
574
|
-
// era (1)
|
|
575
|
-
'(' +
|
|
576
|
-
bcad[0] +
|
|
577
|
-
'|' +
|
|
578
|
-
bcad[1] +
|
|
579
|
-
')?' +
|
|
580
|
-
// dubious (2)
|
|
581
|
-
'(\\s*\\?)?' +
|
|
582
|
-
// hint (3)
|
|
583
|
-
'(?:\\s*\\{?:([^)]+)\\})?\\s*$', 'gi');
|
|
584
|
-
const m1 = tailRegexp.exec(s1);
|
|
585
|
-
// if 1st has no era try integration from 2nd
|
|
586
|
-
if (m1 && m1[1] && s2) {
|
|
587
|
-
// get era from 2nd (if 2nd hasn't it too, give up and AD will be assumed)
|
|
588
|
-
const m2 = tailRegexp.exec(s2);
|
|
589
|
-
if (m2 && m2[1]) {
|
|
590
|
-
const era = m2[1] || 'p.C.';
|
|
591
|
-
const sb1 = [];
|
|
592
|
-
if (m1.index > 0) {
|
|
593
|
-
sb1.push(s1.substr(0, m1.index));
|
|
594
|
-
}
|
|
595
|
-
sb1.push(' ' + era);
|
|
596
|
-
if (m1[2]) {
|
|
597
|
-
sb1.push('?');
|
|
598
|
-
}
|
|
599
|
-
if (m1[3]) {
|
|
600
|
-
sb1.push(` (${m1[3]})`);
|
|
601
|
-
}
|
|
602
|
-
s1 = sb1.join('');
|
|
603
|
-
}
|
|
604
|
-
}
|
|
605
|
-
}
|
|
606
|
-
date.setStartPoint(Datation.parse(s1, options));
|
|
607
|
-
if (s2) {
|
|
608
|
-
date.setEndPoint(Datation.parse(s2, options));
|
|
609
|
-
}
|
|
610
|
-
}
|
|
611
|
-
else {
|
|
612
|
-
// here we have a s2, even if empty. When empty, it represents
|
|
613
|
-
// an unknown point in a terminus ante/post, and as such we
|
|
614
|
-
// must set B=null. When B=undefined, it's not a range but a point.
|
|
615
|
-
const d = Datation.parse(s1, options);
|
|
616
|
-
if (d && !d.isUndefined()) {
|
|
617
|
-
date.setSinglePoint(d);
|
|
618
|
-
}
|
|
619
|
-
}
|
|
620
|
-
return date;
|
|
621
|
-
}
|
|
622
|
-
getStartPoint() {
|
|
623
|
-
return this.getDateType() === HistoricalDateType.range ? this.a : undefined;
|
|
624
|
-
}
|
|
625
|
-
setStartPoint(value) {
|
|
626
|
-
this.a = new Datation(value);
|
|
627
|
-
// it's a range, ensure max is not null
|
|
628
|
-
if (!this.b) {
|
|
629
|
-
this.b = new Datation();
|
|
630
|
-
}
|
|
631
|
-
}
|
|
632
|
-
getEndPoint() {
|
|
633
|
-
return this.getDateType() === HistoricalDateType.range ? this.b : undefined;
|
|
634
|
-
}
|
|
635
|
-
setEndPoint(value) {
|
|
636
|
-
this.b = new Datation(value);
|
|
637
|
-
}
|
|
638
|
-
getSinglePoint() {
|
|
639
|
-
return this.getDateType() === HistoricalDateType.point ? this.a : undefined;
|
|
640
|
-
}
|
|
641
|
-
setSinglePoint(value) {
|
|
642
|
-
this.a = new Datation(value);
|
|
643
|
-
// it's a point, ensure max is undefined
|
|
644
|
-
this.b = undefined;
|
|
645
|
-
}
|
|
646
|
-
/**
|
|
647
|
-
* True if this date is undefined.
|
|
648
|
-
*/
|
|
649
|
-
isUndefined() {
|
|
650
|
-
return (!this.a || (this.a.isUndefined() && (!this.b || this.b.isUndefined())));
|
|
651
|
-
}
|
|
652
|
-
/**
|
|
653
|
-
* Get the type of this date.
|
|
654
|
-
*/
|
|
655
|
-
getDateType() {
|
|
656
|
-
if (this.isUndefined()) {
|
|
657
|
-
return HistoricalDateType.undefined;
|
|
658
|
-
}
|
|
659
|
-
return this.b ? HistoricalDateType.range : HistoricalDateType.point;
|
|
660
|
-
}
|
|
661
|
-
/**
|
|
662
|
-
* Validate this date.
|
|
663
|
-
* @returns Error message if invalid, or null if valid.
|
|
664
|
-
*/
|
|
665
|
-
validate() {
|
|
666
|
-
if (!this.a) {
|
|
667
|
-
return 'Missing point A';
|
|
668
|
-
}
|
|
669
|
-
if (this.getDateType() === HistoricalDateType.range) {
|
|
670
|
-
const av = this.a.getSortValue();
|
|
671
|
-
const bv = this.b?.getSortValue() || 0;
|
|
672
|
-
if (av && bv && av >= bv) {
|
|
673
|
-
return 'Point A is past point B';
|
|
674
|
-
}
|
|
675
|
-
}
|
|
676
|
-
return null;
|
|
677
|
-
}
|
|
678
|
-
/**
|
|
679
|
-
* Get the sort value for this date.
|
|
680
|
-
*/
|
|
681
|
-
getSortValue() {
|
|
682
|
-
switch (this.getDateType()) {
|
|
683
|
-
case HistoricalDateType.point:
|
|
684
|
-
return this.a.getSortValue();
|
|
685
|
-
case HistoricalDateType.range:
|
|
686
|
-
if (this.a.isUndefined()) {
|
|
687
|
-
return this.b.getSortValue() - APPROX_DELTA;
|
|
688
|
-
}
|
|
689
|
-
if (!this.b || this.b.isUndefined()) {
|
|
690
|
-
return this.a.getSortValue() + APPROX_DELTA;
|
|
691
|
-
}
|
|
692
|
-
return (this.a.getSortValue() + this.b.getSortValue()) / 2;
|
|
693
|
-
default:
|
|
694
|
-
return 0;
|
|
695
|
-
}
|
|
696
|
-
}
|
|
697
|
-
/**
|
|
698
|
-
* Build a textual representation of this date.
|
|
699
|
-
* @param format The format string.
|
|
700
|
-
* @param options The formatter options.
|
|
701
|
-
*/
|
|
702
|
-
toString(format = 'G', options = DATATION_FORMAT_OPTIONS) {
|
|
703
|
-
const sb = [];
|
|
704
|
-
switch (this.getDateType()) {
|
|
705
|
-
case HistoricalDateType.point:
|
|
706
|
-
sb.push(this.a.toString(format, options));
|
|
707
|
-
break;
|
|
708
|
-
case HistoricalDateType.range:
|
|
709
|
-
// if both terms are present and belong to same era, omit it in 1st
|
|
710
|
-
if (!this.a.isUndefined() &&
|
|
711
|
-
this.b &&
|
|
712
|
-
!this.b.isUndefined() &&
|
|
713
|
-
this.a.value * this.b.value > 0) {
|
|
714
|
-
sb.push(this.a.toString(Datation.stripFormatStringEra(format), options));
|
|
715
|
-
sb.push(' -- ');
|
|
716
|
-
sb.push(this.b.toString(format, options));
|
|
717
|
-
break;
|
|
718
|
-
}
|
|
719
|
-
if (!this.a.isUndefined()) {
|
|
720
|
-
sb.push(this.a.toString(format, options) + ' ');
|
|
721
|
-
}
|
|
722
|
-
sb.push('--');
|
|
723
|
-
if (this.b && !this.b.isUndefined()) {
|
|
724
|
-
sb.push(this.b.toString(format, options));
|
|
725
|
-
}
|
|
726
|
-
break;
|
|
727
|
-
}
|
|
728
|
-
return sb.join('');
|
|
729
|
-
}
|
|
730
|
-
/**
|
|
731
|
-
* Get the approximate year value from the specified century value.
|
|
732
|
-
* @param century The century number, negative if B.C.
|
|
733
|
-
*/
|
|
734
|
-
centuryToYear(century) {
|
|
735
|
-
return century * 100 + (century < 0 ? 50 : -50);
|
|
736
|
-
}
|
|
737
|
-
/**
|
|
738
|
-
* Convert this date into a single approximate year value.
|
|
739
|
-
* For centuries, the central century year is returned (e.g. -350 for IV B.C.
|
|
740
|
-
* and +350 for IV A.D.); when the date is a range with a single boundary only
|
|
741
|
-
* (max or min) the corresponding year minus or plus a predefined delta value
|
|
742
|
-
* (10) is returned; if it's a range with both boundaries (max and min),
|
|
743
|
-
* the middle year between them is returned.
|
|
744
|
-
* @param useTerminusSpan True to add or remove the predefined span from
|
|
745
|
-
* a terminus ante or post.
|
|
746
|
-
*/
|
|
747
|
-
toYear(useTerminusSpan = true) {
|
|
748
|
-
let year = 0;
|
|
749
|
-
switch (this.getDateType()) {
|
|
750
|
-
case HistoricalDateType.point:
|
|
751
|
-
year = Math.trunc(this.a.isCentury ? this.centuryToYear(this.a.value) : this.a.value);
|
|
752
|
-
break;
|
|
753
|
-
case HistoricalDateType.range:
|
|
754
|
-
// min is missing: terminus ante
|
|
755
|
-
if (this.a.isUndefined() && this.b) {
|
|
756
|
-
year = Math.trunc((this.b.isCentury
|
|
757
|
-
? this.centuryToYear(this.b.value)
|
|
758
|
-
: this.b.value) - (useTerminusSpan ? APPROX_DELTA : 0));
|
|
759
|
-
break;
|
|
760
|
-
}
|
|
761
|
-
// max is missing: terminus post
|
|
762
|
-
if (!this.b || this.b.isUndefined()) {
|
|
763
|
-
year = Math.trunc((this.a.isCentury
|
|
764
|
-
? this.centuryToYear(this.a.value)
|
|
765
|
-
: this.a.value) + (useTerminusSpan ? APPROX_DELTA : 0));
|
|
766
|
-
break;
|
|
767
|
-
}
|
|
768
|
-
// both min and max
|
|
769
|
-
const min = this.a.isCentury
|
|
770
|
-
? this.centuryToYear(this.a.value)
|
|
771
|
-
: this.a.value;
|
|
772
|
-
const max = this.b.isCentury
|
|
773
|
-
? this.centuryToYear(this.b.value)
|
|
774
|
-
: this.b.value;
|
|
775
|
-
year = Math.trunc((max - min) / 2 + min);
|
|
776
|
-
if (year === 0) {
|
|
777
|
-
year = 1;
|
|
778
|
-
}
|
|
779
|
-
break;
|
|
780
|
-
}
|
|
781
|
-
return year;
|
|
782
|
-
}
|
|
783
|
-
/**
|
|
784
|
-
* True if any value (either in point or in range) has an about flag.
|
|
785
|
-
*/
|
|
786
|
-
isAbout() {
|
|
787
|
-
let about = false;
|
|
788
|
-
switch (this.getDateType()) {
|
|
789
|
-
case HistoricalDateType.point:
|
|
790
|
-
about = this.a.isApproximate;
|
|
791
|
-
break;
|
|
792
|
-
case HistoricalDateType.range:
|
|
793
|
-
if (!this.a.isUndefined()) {
|
|
794
|
-
about = this.a.isApproximate;
|
|
795
|
-
break;
|
|
796
|
-
}
|
|
797
|
-
if (this.b && !this.b.isUndefined()) {
|
|
798
|
-
about = this.b.isApproximate;
|
|
799
|
-
}
|
|
800
|
-
break;
|
|
801
|
-
}
|
|
802
|
-
return about ? true : false;
|
|
803
|
-
}
|
|
804
|
-
/**
|
|
805
|
-
* True if any value (either in point or in range) has an about flag.
|
|
806
|
-
*/
|
|
807
|
-
isDubious() {
|
|
808
|
-
let dubious = false;
|
|
809
|
-
switch (this.getDateType()) {
|
|
810
|
-
case HistoricalDateType.point:
|
|
811
|
-
dubious = this.a.isDubious;
|
|
812
|
-
break;
|
|
813
|
-
case HistoricalDateType.range:
|
|
814
|
-
if (!this.a.isUndefined()) {
|
|
815
|
-
dubious = this.a.isDubious;
|
|
816
|
-
break;
|
|
817
|
-
}
|
|
818
|
-
if (this.b && !this.b.isUndefined()) {
|
|
819
|
-
dubious = this.b.isDubious;
|
|
820
|
-
}
|
|
821
|
-
break;
|
|
822
|
-
}
|
|
823
|
-
return dubious ? true : false;
|
|
824
|
-
}
|
|
825
|
-
}
|
|
6
|
+
import { NgToolsModule } from '@myrmidon/ng-tools';
|
|
826
7
|
|
|
827
8
|
/**
|
|
828
9
|
* Data pin value type in a DataPinDefinition.
|
|
@@ -1044,9 +225,9 @@ class PendingChangesGuard {
|
|
|
1044
225
|
'Press Cancel to go back and save, OK to continue.');
|
|
1045
226
|
}
|
|
1046
227
|
}
|
|
1047
|
-
PendingChangesGuard.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.
|
|
1048
|
-
PendingChangesGuard.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.
|
|
1049
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.
|
|
228
|
+
PendingChangesGuard.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: PendingChangesGuard, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
229
|
+
PendingChangesGuard.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: PendingChangesGuard, providedIn: 'root' });
|
|
230
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: PendingChangesGuard, decorators: [{
|
|
1050
231
|
type: Injectable,
|
|
1051
232
|
args: [{
|
|
1052
233
|
providedIn: 'root',
|
|
@@ -1084,42 +265,15 @@ class SortPipe {
|
|
|
1084
265
|
});
|
|
1085
266
|
}
|
|
1086
267
|
}
|
|
1087
|
-
SortPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.
|
|
1088
|
-
SortPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "13.0.
|
|
1089
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.
|
|
268
|
+
SortPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: SortPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
269
|
+
SortPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: SortPipe, name: "sort" });
|
|
270
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: SortPipe, decorators: [{
|
|
1090
271
|
type: Pipe,
|
|
1091
272
|
args: [{
|
|
1092
273
|
name: 'sort',
|
|
1093
274
|
}]
|
|
1094
275
|
}] });
|
|
1095
276
|
|
|
1096
|
-
// npm i gravatar --save
|
|
1097
|
-
// npm i @types/gravatar --save
|
|
1098
|
-
class GravatarService {
|
|
1099
|
-
/**
|
|
1100
|
-
* Builds the URL to the Gravatar avatar corresponding to the specified email
|
|
1101
|
-
* address.
|
|
1102
|
-
* @param email: The email address.
|
|
1103
|
-
* @param size The required size in pixels (1-512).
|
|
1104
|
-
*/
|
|
1105
|
-
buildGravatarUrl(email, size = 80) {
|
|
1106
|
-
if (!email) {
|
|
1107
|
-
return '';
|
|
1108
|
-
}
|
|
1109
|
-
return gravatar.url(email, { s: size.toString() });
|
|
1110
|
-
// const hash = this._hash.getMd5(email.trim().toLowerCase());
|
|
1111
|
-
// return this.buildGravatarUrlFromHash(hash, size);
|
|
1112
|
-
}
|
|
1113
|
-
}
|
|
1114
|
-
GravatarService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: GravatarService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1115
|
-
GravatarService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: GravatarService, providedIn: 'root' });
|
|
1116
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: GravatarService, decorators: [{
|
|
1117
|
-
type: Injectable,
|
|
1118
|
-
args: [{
|
|
1119
|
-
providedIn: 'root'
|
|
1120
|
-
}]
|
|
1121
|
-
}] });
|
|
1122
|
-
|
|
1123
277
|
/**
|
|
1124
278
|
* Library route service.
|
|
1125
279
|
* This service is used to build routes to part and fragment editors,
|
|
@@ -1317,9 +471,9 @@ class LibraryRouteService {
|
|
|
1317
471
|
};
|
|
1318
472
|
}
|
|
1319
473
|
}
|
|
1320
|
-
LibraryRouteService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.
|
|
1321
|
-
LibraryRouteService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.
|
|
1322
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.
|
|
474
|
+
LibraryRouteService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: LibraryRouteService, deps: [{ token: 'partEditorKeys' }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
475
|
+
LibraryRouteService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: LibraryRouteService, providedIn: 'root' });
|
|
476
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: LibraryRouteService, decorators: [{
|
|
1323
477
|
type: Injectable,
|
|
1324
478
|
args: [{
|
|
1325
479
|
providedIn: 'root',
|
|
@@ -2000,9 +1154,9 @@ class TextLayerService {
|
|
|
2000
1154
|
return sel.getRangeAt(0);
|
|
2001
1155
|
}
|
|
2002
1156
|
}
|
|
2003
|
-
TextLayerService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.
|
|
2004
|
-
TextLayerService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.
|
|
2005
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.
|
|
1157
|
+
TextLayerService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: TextLayerService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1158
|
+
TextLayerService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: TextLayerService, providedIn: 'root' });
|
|
1159
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: TextLayerService, decorators: [{
|
|
2006
1160
|
type: Injectable,
|
|
2007
1161
|
args: [{ providedIn: 'root' }]
|
|
2008
1162
|
}], ctorParameters: function () { return []; } });
|
|
@@ -2068,46 +1222,12 @@ class CadmusValidators {
|
|
|
2068
1222
|
}
|
|
2069
1223
|
}
|
|
2070
1224
|
|
|
2071
|
-
class PasswordValidator {
|
|
2072
|
-
static isValidPassword(control) {
|
|
2073
|
-
if (!control.value) {
|
|
2074
|
-
return null;
|
|
2075
|
-
}
|
|
2076
|
-
if (control.value.length < 8) {
|
|
2077
|
-
return {
|
|
2078
|
-
passwordTooShort: true,
|
|
2079
|
-
};
|
|
2080
|
-
}
|
|
2081
|
-
if (!/.*[A-Z].*/.test(control.value)) {
|
|
2082
|
-
return {
|
|
2083
|
-
noUpperInPassword: true,
|
|
2084
|
-
};
|
|
2085
|
-
}
|
|
2086
|
-
if (!/.*[a-z].*/.test(control.value)) {
|
|
2087
|
-
return {
|
|
2088
|
-
noLowerInPassword: true,
|
|
2089
|
-
};
|
|
2090
|
-
}
|
|
2091
|
-
if (!/.*[A-Z].*/.test(control.value)) {
|
|
2092
|
-
return {
|
|
2093
|
-
noUpperInPassword: true,
|
|
2094
|
-
};
|
|
2095
|
-
}
|
|
2096
|
-
if (!/.*[-`~!@#$%^&*()_+=\[\]{};:'",.<>/?|\\].*/.test(control.value)) {
|
|
2097
|
-
return {
|
|
2098
|
-
noSymbolInPassword: true,
|
|
2099
|
-
};
|
|
2100
|
-
}
|
|
2101
|
-
return null;
|
|
2102
|
-
}
|
|
2103
|
-
}
|
|
2104
|
-
|
|
2105
1225
|
class CadmusCoreModule {
|
|
2106
1226
|
}
|
|
2107
|
-
CadmusCoreModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.
|
|
2108
|
-
CadmusCoreModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.0.
|
|
2109
|
-
CadmusCoreModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.0.
|
|
2110
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.
|
|
1227
|
+
CadmusCoreModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: CadmusCoreModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
1228
|
+
CadmusCoreModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: CadmusCoreModule, declarations: [SortPipe], imports: [CommonModule, HttpClientModule, NgToolsModule], exports: [SortPipe] });
|
|
1229
|
+
CadmusCoreModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: CadmusCoreModule, imports: [[CommonModule, HttpClientModule, NgToolsModule]] });
|
|
1230
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: CadmusCoreModule, decorators: [{
|
|
2111
1231
|
type: NgModule,
|
|
2112
1232
|
args: [{
|
|
2113
1233
|
imports: [CommonModule, HttpClientModule, NgToolsModule],
|
|
@@ -2124,4 +1244,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.2", ngImpor
|
|
|
2124
1244
|
* Generated bundle index. Do not edit.
|
|
2125
1245
|
*/
|
|
2126
1246
|
|
|
2127
|
-
export { CadmusCoreModule, CadmusValidators,
|
|
1247
|
+
export { CadmusCoreModule, CadmusValidators, DataPinValueType, LibraryRouteService, PendingChangesGuard, SortPipe, TextLayerService, TextRange, TokenLocation, TokenPoint };
|
|
1248
|
+
//# sourceMappingURL=myrmidon-cadmus-core.mjs.map
|