@glissandoo/lib 1.16.3 → 1.16.4
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/package.json
CHANGED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const lang_1 = require("../../lang");
|
|
7
|
-
const Instrument_1 = __importDefault(require("../Instrument"));
|
|
8
|
-
class Section {
|
|
9
|
-
constructor(id, lang = lang_1.defaultLocale) {
|
|
10
|
-
this.id = id;
|
|
11
|
-
this.lang = lang;
|
|
12
|
-
}
|
|
13
|
-
get name() {
|
|
14
|
-
return ((this.id === 'all'
|
|
15
|
-
? lang_1.getTranslation(`sections.all`, this.lang)
|
|
16
|
-
: new Instrument_1.default(this.id).name) || this.id);
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
exports.default = Section;
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { GroupRepertoireFile, GroupRepertoireSectionId as SectionId } from './types';
|
|
2
|
-
export default class ThemeFile {
|
|
3
|
-
id: string;
|
|
4
|
-
private data;
|
|
5
|
-
constructor(id: string, data: GroupRepertoireFile);
|
|
6
|
-
get path(): string;
|
|
7
|
-
get filetype(): string;
|
|
8
|
-
get isAudio(): boolean;
|
|
9
|
-
get isPdf(): boolean;
|
|
10
|
-
get uploadedAt(): number;
|
|
11
|
-
get pageCount(): number | null;
|
|
12
|
-
get isEncrypted(): boolean;
|
|
13
|
-
get isFileByPages(): boolean;
|
|
14
|
-
get sections(): Partial<Record<import("../../../helpers/fileSections").SectionIdType, import("./types").GroupRepertoireFileSections>>;
|
|
15
|
-
get sectionIds(): import("../../../helpers/fileSections").SectionIdType[];
|
|
16
|
-
get sectionsList(): {
|
|
17
|
-
id: SectionId;
|
|
18
|
-
tagsByFile: string[];
|
|
19
|
-
tagsByPages: Record<string, number[]>;
|
|
20
|
-
}[];
|
|
21
|
-
get sectionListByTags(): {
|
|
22
|
-
id: SectionId;
|
|
23
|
-
tag: string;
|
|
24
|
-
pages: number[] | null;
|
|
25
|
-
}[];
|
|
26
|
-
get identifyAt(): number | null;
|
|
27
|
-
protected isAllTag(tags?: string[]): boolean;
|
|
28
|
-
}
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const utils_1 = require("../../../helpers/utils");
|
|
4
|
-
const types_1 = require("../types");
|
|
5
|
-
class ThemeFile {
|
|
6
|
-
constructor(id, data) {
|
|
7
|
-
this.id = id;
|
|
8
|
-
this.data = data;
|
|
9
|
-
}
|
|
10
|
-
get path() {
|
|
11
|
-
return this.data.path;
|
|
12
|
-
}
|
|
13
|
-
get filetype() {
|
|
14
|
-
return this.data.filetype;
|
|
15
|
-
}
|
|
16
|
-
get isAudio() {
|
|
17
|
-
return this.filetype.includes('audio');
|
|
18
|
-
}
|
|
19
|
-
get isPdf() {
|
|
20
|
-
return this.filetype === 'application/pdf';
|
|
21
|
-
}
|
|
22
|
-
get uploadedAt() {
|
|
23
|
-
return this.data.uploadedAt;
|
|
24
|
-
}
|
|
25
|
-
get pageCount() {
|
|
26
|
-
return this.data.pageCount || null;
|
|
27
|
-
}
|
|
28
|
-
get isEncrypted() {
|
|
29
|
-
return this.data.isEncrypted;
|
|
30
|
-
}
|
|
31
|
-
get isFileByPages() {
|
|
32
|
-
return this.isPdf && !this.isEncrypted;
|
|
33
|
-
}
|
|
34
|
-
get sections() {
|
|
35
|
-
return this.data.sections || {};
|
|
36
|
-
}
|
|
37
|
-
get sectionIds() {
|
|
38
|
-
return Object.keys(this.sections);
|
|
39
|
-
}
|
|
40
|
-
get sectionsList() {
|
|
41
|
-
const list = utils_1.objToArray(this.sections);
|
|
42
|
-
return list.map((section) => this.isFileByPages
|
|
43
|
-
? {
|
|
44
|
-
id: section.id,
|
|
45
|
-
tagsByFile: [],
|
|
46
|
-
tagsByPages: Object.entries(section.pages || {}).reduce((acc, [page, { tags }]) => ({
|
|
47
|
-
...acc,
|
|
48
|
-
...(this.isAllTag(tags)
|
|
49
|
-
? {
|
|
50
|
-
[types_1.GroupRepertoireTagReserved.All]: [
|
|
51
|
-
...(acc[types_1.GroupRepertoireTagReserved.All] || []),
|
|
52
|
-
Number(page),
|
|
53
|
-
],
|
|
54
|
-
}
|
|
55
|
-
: tags.reduce((accTags, tag) => ({
|
|
56
|
-
...accTags,
|
|
57
|
-
[tag]: [...(acc[tag] || []), Number(page)],
|
|
58
|
-
}), {})),
|
|
59
|
-
}), {}),
|
|
60
|
-
}
|
|
61
|
-
: {
|
|
62
|
-
id: section.id,
|
|
63
|
-
tagsByFile: this.isAllTag(section.tags)
|
|
64
|
-
? [types_1.GroupRepertoireTagReserved.All]
|
|
65
|
-
: section.tags || [],
|
|
66
|
-
tagsByPages: {},
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
get sectionListByTags() {
|
|
70
|
-
const list = this.sectionsList;
|
|
71
|
-
return list.reduce((acc, section) => {
|
|
72
|
-
const tagItems = this.isFileByPages
|
|
73
|
-
? Object.entries(section.tagsByPages).reduce((accTags, [tag, pages]) => {
|
|
74
|
-
return [...accTags, { id: section.id, tag, pages }];
|
|
75
|
-
}, [])
|
|
76
|
-
: section.tagsByFile.map((tag) => ({ id: section.id, tag, pages: null }));
|
|
77
|
-
return [...acc, ...tagItems];
|
|
78
|
-
}, []);
|
|
79
|
-
}
|
|
80
|
-
// get sectionListByTags() {
|
|
81
|
-
// const list = this.sectionsList;
|
|
82
|
-
// return list;
|
|
83
|
-
// return list.reduce((acc, section) => {
|
|
84
|
-
// const tagItems = this.isFileByPages
|
|
85
|
-
// ? Object.entries(section.tagsByPages).reduce((accTags, [tag, pages]) => {
|
|
86
|
-
// return [...accTags, { id: section.id, tag, pages }];
|
|
87
|
-
// }, [])
|
|
88
|
-
// : section.tagsByFile.map((tag) => ({ id: section.id, tag, pages: null }));
|
|
89
|
-
// return [...acc, ...tagItems];
|
|
90
|
-
// }, []);
|
|
91
|
-
// }
|
|
92
|
-
get identifyAt() {
|
|
93
|
-
return this.data.identifyAt || null;
|
|
94
|
-
}
|
|
95
|
-
isAllTag(tags = []) {
|
|
96
|
-
return tags.length === 0 || tags.includes(types_1.GroupRepertoireTagReserved.All);
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
exports.default = ThemeFile;
|