@christianriedl/media 1.0.207 → 1.0.209
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/dist/iBooks.d.ts
CHANGED
|
@@ -56,6 +56,10 @@ export interface IPlace {
|
|
|
56
56
|
hintenBookId: number;
|
|
57
57
|
vorneAuthorId: number;
|
|
58
58
|
vorneBookId: number;
|
|
59
|
+
hintenSelFrom?: number;
|
|
60
|
+
hintenSelTo?: number;
|
|
61
|
+
vorneSelFrom?: number;
|
|
62
|
+
vorneSelTo?: number;
|
|
59
63
|
}
|
|
60
64
|
export interface IBooksService {
|
|
61
65
|
categories: string[];
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import { StyleValue } from 'vue';
|
|
2
|
+
import { StyleValue, computed } from 'vue';
|
|
3
3
|
import { IPlace } from '@christianriedl/media';
|
|
4
4
|
const props = defineProps<{ place: IPlace, height: number, ismobile: boolean }>();
|
|
5
5
|
const emits = defineEmits<{
|
|
@@ -9,6 +9,31 @@
|
|
|
9
9
|
const heightStyle: StyleValue = { height: props.height + "px" };
|
|
10
10
|
const vorne = { vorne: !props.ismobile, vorneM: props.ismobile };
|
|
11
11
|
const hinten = { hinten: !props.ismobile, hintenM: props.ismobile };
|
|
12
|
+
const textVorne = computed (() => buildText (place.vorne, place.vorne2, place.vorneSelFrom, place.vorneSelTo));
|
|
13
|
+
const textHinten = computed (() => buildText (place.hinten, place.hinten2, place.hintenSelFrom, place.hintenSelTo));
|
|
14
|
+
|
|
15
|
+
function buildText (buchstaben: string, buchstaben2: string, selFrom?: number, selTo?: number) : string {
|
|
16
|
+
let text1 = buchstaben;
|
|
17
|
+
let text2 = buchstaben2;
|
|
18
|
+
if (selFrom !== undefined && selTo !== undefined)
|
|
19
|
+
{
|
|
20
|
+
selTo++;
|
|
21
|
+
if (selFrom > 0) {
|
|
22
|
+
text1 = '<span>' + buchstaben.substring(0, selFrom) + '</span>';
|
|
23
|
+
text2 = '<span>' + buchstaben2.substring(0, selFrom) + '</span>';
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
text1 = text2 = '';
|
|
27
|
+
}
|
|
28
|
+
text1 += '<span style="color: red; font-weight: 900">' + buchstaben.substring(selFrom, selTo) + '</span>';
|
|
29
|
+
text2 += '<span style="color: red; font-weight: 900">' + buchstaben2.substring(selFrom, selTo) + '</span>';
|
|
30
|
+
if (selTo < buchstaben.length) {
|
|
31
|
+
text1 += '<span>' + buchstaben.substring(selTo) + '</span>';
|
|
32
|
+
text2 += '<span>' + buchstaben2.substring(selTo) + '</span>';
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return text1 + "<br>" + text2;
|
|
36
|
+
}
|
|
12
37
|
|
|
13
38
|
function selectVorne () {
|
|
14
39
|
emits('select', place, false);
|
|
@@ -21,10 +46,10 @@
|
|
|
21
46
|
<template>
|
|
22
47
|
<v-row dense :class="[place.color,'place']" :style="heightStyle" >
|
|
23
48
|
<v-col v-if="place.vorne" cols="12" @click="selectVorne">
|
|
24
|
-
<p :class="vorne"
|
|
49
|
+
<p :class="vorne" v-html="textVorne"></p>
|
|
25
50
|
</v-col>
|
|
26
51
|
<v-col v-if="place.hinten" cols="12" @click="selectHinten" >
|
|
27
|
-
<p :class="hinten"
|
|
52
|
+
<p :class="hinten" v-html="textHinten"></p>
|
|
28
53
|
</v-col>
|
|
29
54
|
</v-row>
|
|
30
55
|
<v-divider></v-divider>
|
package/src/views/BooksPage.vue
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import { inject, ref, reactive, onMounted, onUnmounted, computed, StyleValue } from 'vue';
|
|
3
|
-
import { useRouter } from 'vue-router';
|
|
3
|
+
import { useRouter, useRoute } from 'vue-router';
|
|
4
4
|
import { IAppState, appStateSymbol, getOpenAISymbol, IOpenAIService, ICompleteData, EScope, EDevice } from '@christianriedl/utils';
|
|
5
5
|
import { BooksService, getBooksSymbol, IAuthorShort, IAuthor, IBook } from '@christianriedl/media';
|
|
6
6
|
import BookLine from '../components/BookLine.vue';
|
|
@@ -37,9 +37,9 @@
|
|
|
37
37
|
}
|
|
38
38
|
if (booksService.selectedAuthorId) {
|
|
39
39
|
selectedAuthor.value = authors.find ((x) => x.id == booksService.selectedAuthorId);
|
|
40
|
-
getCurrentAuthor (booksService.selectedAuthorId, true)
|
|
41
|
-
|
|
42
|
-
|
|
40
|
+
if (await getCurrentAuthor (booksService.selectedAuthorId, true) && booksService.selectedBookId) {
|
|
41
|
+
selectBook (booksService.selectedBookId, () => {});
|
|
42
|
+
}
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
45
|
async function addAuthor() {
|
|
@@ -87,6 +87,7 @@
|
|
|
87
87
|
const authors = await booksService.getAuthors(undefined, undefined, withBooks, id);
|
|
88
88
|
if (authors && authors.length > 0) {
|
|
89
89
|
const a = authors[0];
|
|
90
|
+
booksService.selectedAuthorId = a.id;
|
|
90
91
|
currentAuthor.id = a.id;
|
|
91
92
|
currentAuthor.surName = a.surName;
|
|
92
93
|
currentAuthor.givenName = a.givenName;
|
|
@@ -134,12 +135,12 @@
|
|
|
134
135
|
}
|
|
135
136
|
}
|
|
136
137
|
function search () {
|
|
137
|
-
|
|
138
|
-
|
|
138
|
+
const url = `/books?authorId=${currentAuthor.id}&bookId=${selectedBook.value.id}`;
|
|
139
|
+
router.options.history.replace (url);
|
|
139
140
|
router.push({ path: 'booksearch' });
|
|
140
141
|
}
|
|
141
142
|
function places () {
|
|
142
|
-
router.push({ path: 'bookplaces' });
|
|
143
|
+
router.push({ path: 'bookplaces', query: { author: currentAuthor.surName, authorId: currentAuthor.id, bookId: selectedBook.value.id } });
|
|
143
144
|
}
|
|
144
145
|
async function addNewBook() {
|
|
145
146
|
if (lastAllBooksId.value != currentAuthor.id) {
|
|
@@ -158,6 +159,7 @@
|
|
|
158
159
|
return;
|
|
159
160
|
}
|
|
160
161
|
setBookChanged = func;
|
|
162
|
+
booksService.selectedBookId = id;
|
|
161
163
|
if (currentAuthor.books) {
|
|
162
164
|
selectedBook.value = currentAuthor.books.find (x => x.id == id) as IBook;
|
|
163
165
|
if (selectedBook.value && !selectedBook.value.description && !selectedBook.value.comment) {
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import { inject, ref, reactive, onMounted, onUnmounted, computed, StyleValue } from 'vue';
|
|
3
|
+
import { useRouter, useRoute } from 'vue-router';
|
|
3
4
|
import { IAppState, appStateSymbol, getOpenAISymbol, IOpenAIService, ICompleteData, EScope, EDevice } from '@christianriedl/utils';
|
|
4
5
|
import { BooksService, getBooksSymbol, IAuthorShort, IAuthor, IFullBook, IPlace } from '@christianriedl/media';
|
|
5
6
|
import BookPlace from '../components/BookPlace.vue';
|
|
6
7
|
|
|
8
|
+
const route = useRoute();
|
|
7
9
|
const appState = inject(appStateSymbol)!;
|
|
8
10
|
const getBooksService = inject(getBooksSymbol)!;
|
|
9
11
|
const booksService = getBooksService() as BooksService;
|
|
@@ -25,6 +27,9 @@
|
|
|
25
27
|
const maxFillPerc = ref(86);
|
|
26
28
|
const showDistribute = ref(false);
|
|
27
29
|
const placeName = ref("");
|
|
30
|
+
const selectedAuthor = ref("");
|
|
31
|
+
const selectedAuthorId = ref(0);
|
|
32
|
+
const selectedBookId = ref(0);
|
|
28
33
|
|
|
29
34
|
start();
|
|
30
35
|
|
|
@@ -54,10 +59,38 @@
|
|
|
54
59
|
}
|
|
55
60
|
|
|
56
61
|
async function start() {
|
|
62
|
+
if (route.query) {
|
|
63
|
+
if (route.query.author)
|
|
64
|
+
selectedAuthor.value = route.query.author.toString();
|
|
65
|
+
if (route.query.authorId)
|
|
66
|
+
selectedAuthorId.value = Number(route.query.authorId);
|
|
67
|
+
if (route.query.bookId)
|
|
68
|
+
selectedBookId.value = Number(route.query.bookId);
|
|
69
|
+
}
|
|
57
70
|
const places = await booksService.getBookPlaces();
|
|
58
71
|
for (let i = 0; i < places.length; i++) {
|
|
59
72
|
const place = places[i];
|
|
60
73
|
let regal: Regal;
|
|
74
|
+
let selFrom: number | undefined;
|
|
75
|
+
let selTo: number | undefined;
|
|
76
|
+
if (selectedAuthor.value && place.buchstaben.includes(selectedAuthor.value.substring(0,1)) && place.zweitBuchstaben.includes(selectedAuthor.value.substring(1,2))) {
|
|
77
|
+
const fullBooks = await booksService.getBooksFrom (place.firstAuthorId, place.firstBookId, place.buchstaben.length);
|
|
78
|
+
for (let j = 0; j < fullBooks.length; j++) {
|
|
79
|
+
const fullBook = fullBooks[j];
|
|
80
|
+
if (selectedBookId.value) {
|
|
81
|
+
if (selectedBookId.value == fullBook.bookId) {
|
|
82
|
+
selFrom = selTo = j; break;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
else if (selectedAuthorId.value) {
|
|
86
|
+
if (selectedAuthorId.value == fullBook.authorId) {
|
|
87
|
+
if (selFrom === undefined)
|
|
88
|
+
selFrom = j;
|
|
89
|
+
selTo = j;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
61
94
|
if (place.vorzimmer) {
|
|
62
95
|
regal = regale[8 + place.regalVonLinks - 1];
|
|
63
96
|
}
|
|
@@ -70,12 +103,16 @@
|
|
|
70
103
|
fach.hintenBookId = place.firstBookId;
|
|
71
104
|
fach.hinten = place.buchstaben;
|
|
72
105
|
fach.hinten2 = place.zweitBuchstaben;
|
|
106
|
+
fach.hintenSelFrom = selFrom;
|
|
107
|
+
fach.hintenSelTo = selTo;
|
|
73
108
|
}
|
|
74
109
|
else {
|
|
75
110
|
fach.vorneAuthorId = place.firstAuthorId;
|
|
76
111
|
fach.vorneBookId = place.firstBookId;
|
|
77
112
|
fach.vorne = place.buchstaben;
|
|
78
113
|
fach.vorne2 = place.zweitBuchstaben;
|
|
114
|
+
fach.vorneSelFrom = selFrom;
|
|
115
|
+
fach.vorneSelTo = selTo;
|
|
79
116
|
}
|
|
80
117
|
}
|
|
81
118
|
}
|
|
@@ -85,17 +122,17 @@
|
|
|
85
122
|
placeName.value = place.placeName;
|
|
86
123
|
if (place.placeName.startsWith ("Wohn"))
|
|
87
124
|
placeName.value += hinten ? "hinten" : "vorne";
|
|
88
|
-
const
|
|
89
|
-
if (
|
|
90
|
-
books.splice (0, 0, ...
|
|
125
|
+
const fullBooks = await booksService.getBooksFrom (place.hintenAuthorId, place.hintenBookId, place.hinten.length);
|
|
126
|
+
if (fullBooks)
|
|
127
|
+
books.splice (0, 0, ...fullBooks);
|
|
91
128
|
}
|
|
92
129
|
if (!hinten && place.vorneAuthorId && place.vorneBookId) {
|
|
93
130
|
placeName.value = place.placeName;
|
|
94
131
|
if (place.placeName.startsWith ("Wohn"))
|
|
95
132
|
placeName.value += hinten ? "hinten" : "vorne";
|
|
96
|
-
const
|
|
97
|
-
if (
|
|
98
|
-
books.splice (0, 0, ...
|
|
133
|
+
const fullBooks = await booksService.getBooksFrom (place.vorneAuthorId, place.vorneBookId, place.vorne.length);
|
|
134
|
+
if (fullBooks)
|
|
135
|
+
books.splice (0, 0, ...fullBooks);
|
|
99
136
|
}
|
|
100
137
|
showBooks.value = true;
|
|
101
138
|
}
|