@vue-skuilder/platform-ui 0.1.4 → 0.1.6

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.
Files changed (36) hide show
  1. package/dist/assets/{index-CQ-sNKGW.css → index-C5DT5vWX.css} +6 -6
  2. package/dist/assets/{index-DSI_T0JD.js → index-D6gUuyAZ.js} +55 -60
  3. package/dist/assets/index-D6gUuyAZ.js.map +1 -0
  4. package/dist/assets/workbox-window.prod.es5-p40uij6f.js +1 -0
  5. package/dist/assets/workbox-window.prod.es5-p40uij6f.js.map +1 -0
  6. package/dist/index.html +2 -2
  7. package/dist/sw.js +2 -1
  8. package/dist/sw.js.map +1 -0
  9. package/dist/workbox-1be04862.js +1 -0
  10. package/dist/workbox-1be04862.js.map +1 -0
  11. package/package.json +5 -6
  12. package/src/components/Courses/CourseInformationWrapper.vue +117 -0
  13. package/src/components/Courses/CourseRouter.vue +3 -3
  14. package/src/components/Courses/TagInformation.vue +7 -2
  15. package/src/components/Edit/BulkImport/CardPreviewList.vue +1 -1
  16. package/src/components/Edit/BulkImportView.vue +6 -6
  17. package/src/components/Edit/CourseEditor.vue +5 -6
  18. package/src/components/Edit/ViewableDataInputForm/DataInputForm.vue +5 -4
  19. package/src/components/Edit/ViewableDataInputForm/FieldInputs/AudioInput.vue +1 -1
  20. package/src/components/Edit/ViewableDataInputForm/FieldInputs/ImageInput.vue +1 -1
  21. package/src/components/Edit/ViewableDataInputForm/FieldInputs/IntegerInput.vue +1 -1
  22. package/src/components/Edit/ViewableDataInputForm/FieldInputs/NumberInput.vue +1 -1
  23. package/src/components/Edit/ViewableDataInputForm/OptionsFieldInput.ts +1 -1
  24. package/src/components/Study/SessionConfiguration.vue +34 -4
  25. package/src/main.ts +5 -2
  26. package/src/server/index.ts +1 -1
  27. package/src/store.mock.ts +4 -4
  28. package/src/stores/useDataInputFormStore.ts +4 -4
  29. package/src/views/Classrooms.vue +2 -2
  30. package/src/views/Courses.vue +2 -2
  31. package/src/views/Home.vue +2 -2
  32. package/src/views/Study.vue +7 -10
  33. package/src/components/Courses/CourseCardBrowser.vue +0 -365
  34. package/src/components/Courses/CourseInformation.vue +0 -164
  35. package/src/components/Edit/CardBrowser.vue +0 -79
  36. package/src/components/Edit/TagsInput.vue +0 -247
@@ -1,247 +0,0 @@
1
- <template>
2
- <div>
3
- <vue-tags-input
4
- v-model="tag"
5
- :tags="tags"
6
- :autocomplete-items="autoCompleteSuggestions"
7
- :separators="separators"
8
- :add-on-key="separators"
9
- @tags-changed="tagsChanged"
10
- >
11
- <template #autocomplete-item="props">
12
- <div class="autocomplete-item" :class="{ 'is-active': props.selected }">
13
- <span class="tag-name">{{ props.item.text }}</span>
14
- <span v-if="props.item.data && props.item.data.snippet" class="tag-snippet">
15
- - {{ props.item.data.snippet }}
16
- </span>
17
- </div>
18
- </template>
19
- </vue-tags-input>
20
-
21
- <v-btn v-if="!hideSubmit" color="success" :loading="loading" @click="submit">Save Changes</v-btn>
22
- </div>
23
- </template>
24
-
25
- <script lang="ts">
26
- import { defineComponent } from 'vue';
27
- import { getDataLayer, Tag, CourseDBInterface } from '@vue-skuilder/db';
28
- // @ts-expect-error - suppress TS error for VueTagsInput - no types available
29
- import { VueTagsInput } from '@vojtechlanka/vue-tags-input';
30
-
31
- export interface TagObject {
32
- text: string;
33
- style?: string;
34
- classes?: string;
35
- data?: {
36
- snippet: string;
37
- };
38
- }
39
-
40
- export interface TagsInputInstance {
41
- tags: Array<{
42
- text: string;
43
- style?: string;
44
- classes?: string;
45
- data?: {
46
- snippet: string;
47
- };
48
- }>;
49
- submit: () => Promise<void>;
50
- updateAvailableCourseTags: () => Promise<void>;
51
- }
52
-
53
- export default defineComponent({
54
- name: 'SkTagsInput',
55
-
56
- components: {
57
- VueTagsInput,
58
- },
59
-
60
- props: {
61
- courseID: {
62
- type: String,
63
- required: true,
64
- default: '',
65
- },
66
- cardID: {
67
- type: String,
68
- required: false,
69
- default: '',
70
- },
71
- hideSubmit: {
72
- type: Boolean,
73
- required: false,
74
- default: false,
75
- },
76
- },
77
-
78
- data() {
79
- return {
80
- loading: true,
81
- tag: '',
82
- tags: [] as TagObject[],
83
- initialTags: [] as string[],
84
- availableCourseTags: [] as Tag[],
85
- separators: [';', ',', ' '] as string[],
86
- courseDB: null as CourseDBInterface | null,
87
- };
88
- },
89
-
90
- computed: {
91
- autoCompleteSuggestions(): TagObject[] {
92
- return this.availableCourseTags
93
- .filter((availableTag) => {
94
- return availableTag.name.toLowerCase().indexOf(this.tag.toLowerCase()) !== -1;
95
- })
96
- .map((availableTag) => {
97
- return {
98
- text: availableTag.name,
99
- data: {
100
- snippet: availableTag.snippet,
101
- },
102
- };
103
- });
104
- },
105
- },
106
-
107
- watch: {
108
- async cardID() {
109
- await this.getAppliedTags();
110
- },
111
- async courseID() {
112
- this.courseDB = getDataLayer().getCourseDB(this.courseID);
113
- await this.updateAvailableCourseTags();
114
- },
115
- },
116
-
117
- async created() {
118
- this.courseDB = getDataLayer().getCourseDB(this.courseID);
119
-
120
- await this.updateAvailableCourseTags();
121
- await this.getAppliedTags();
122
- },
123
-
124
- methods: {
125
- tagsChanged(newTags: TagObject[]) {
126
- console.log(`[TagsInput] Tags changing: ${JSON.stringify(newTags)}`);
127
- this.tags = newTags;
128
- },
129
-
130
- async getAppliedTags() {
131
- this.initialTags = [];
132
- this.tags = [];
133
- try {
134
- const appliedDocsFindResult = await this.courseDB!.getAppliedTags(this.cardID);
135
- appliedDocsFindResult.rows.forEach((row) => {
136
- console.log(`[TagsInput] The following tag is applied:
137
- \t${JSON.stringify(row)}`);
138
- this.tags.push({
139
- text: row!.value.name,
140
- style: '',
141
- classes: '',
142
- });
143
- });
144
- this.initialTags = this.tags.map((tag) => tag.text);
145
- } catch (e) {
146
- console.error(`Error in init-getAppliedTags: ${JSON.stringify(e)}, ${e}`);
147
- } finally {
148
- this.loading = false;
149
- }
150
- },
151
-
152
- async updateAvailableCourseTags() {
153
- try {
154
- this.availableCourseTags = (await this.courseDB!.getCourseTagStubs()).rows.map((row) => {
155
- console.log(`[TagsInput] available tag: ${JSON.stringify(row)}`);
156
- return row.doc! as Tag;
157
- });
158
- } catch (e) {
159
- console.error(`Error in init-availableCourseTags: ${JSON.stringify(e)}`);
160
- }
161
- },
162
-
163
- async submit() {
164
- console.log(`[TagsInput] tagsInput is submitting...`);
165
- this.loading = true;
166
-
167
- try {
168
- await Promise.all(
169
- this.tags.map(async (currentTag) => {
170
- if (!this.initialTags.includes(currentTag.text)) {
171
- try {
172
- await this.courseDB!.addTagToCard(this.cardID, currentTag.text);
173
- console.log(`[TagsInput] Successfully added tag: ${currentTag.text}`);
174
- } catch (error) {
175
- console.error(`Failed to add tag ${currentTag.text}:`, error);
176
- }
177
- }
178
- })
179
- );
180
- } catch (e) {
181
- console.error(`Exception adding tags: ${JSON.stringify(e)}`);
182
- }
183
-
184
- try {
185
- await Promise.all(
186
- this.initialTags.map(async (initialTag) => {
187
- if (
188
- this.tags.filter((tag) => {
189
- return tag.text === initialTag;
190
- }).length === 0
191
- ) {
192
- try {
193
- await this.courseDB!.removeTagFromCard(this.cardID, initialTag);
194
- console.log(`[TagsInput] Successfully removed tag: ${initialTag}`);
195
- } catch (error) {
196
- console.error(`Failed to remove tag ${initialTag}:`, error);
197
- }
198
- }
199
- })
200
- );
201
- } catch (e) {
202
- console.error(`Exception removing tags: ${JSON.stringify(e)}`);
203
- }
204
- this.loading = false;
205
- },
206
- },
207
- });
208
- </script>
209
-
210
- <style scoped>
211
- .vue-tags-input {
212
- max-width: 100%;
213
- }
214
-
215
- .autocomplete-item {
216
- display: flex;
217
- align-items: center;
218
- padding: 5px;
219
- }
220
-
221
- .autocomplete-item.is-active {
222
- background-color: #e8e8e8;
223
- }
224
-
225
- .autocomplete-item.is-active > .tag-name {
226
- background-color: #5c6bc0;
227
- color: white;
228
- }
229
-
230
- .tag-name {
231
- background-color: #e0e0e0;
232
- color: #333;
233
- padding: 2px 6px;
234
- border-radius: 3px;
235
- font-weight: bold;
236
- margin-right: 5px;
237
- }
238
-
239
- .tag-snippet {
240
- color: #666;
241
- font-size: 0.9em;
242
- }
243
-
244
- .autocomplete-item.is-active .tag-snippet {
245
- color: #333; /* Ensure snippet text is visible when item is active */
246
- }
247
- </style>