@vue-skuilder/edit-ui 0.1.18 → 0.1.21
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/assets/index.css +1 -1
- package/dist/edit-ui.es.js +1 -1
- package/dist/edit-ui.es.js.map +1 -1
- package/dist/edit-ui.umd.js +1 -1
- package/dist/edit-ui.umd.js.map +1 -1
- package/package.json +9 -9
- package/src/components/NavigationStrategy/HierarchyConfigForm.vue +1 -1
- package/src/components/NavigationStrategy/InterferenceConfigForm.vue +1 -1
- package/src/components/NavigationStrategy/NavigationStrategyEditor.vue +6 -34
- package/src/components/NavigationStrategy/RelativePriorityConfigForm.vue +1 -1
- package/src/components/NavigationStrategy/HardcodedOrderConfigForm.vue +0 -108
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "0.1.
|
|
6
|
+
"version": "0.1.21",
|
|
7
7
|
"main": "./dist/edit-ui.umd.js",
|
|
8
8
|
"module": "./dist/edit-ui.es.js",
|
|
9
9
|
"types": "./dist/index.d.ts",
|
|
@@ -31,10 +31,10 @@
|
|
|
31
31
|
"cypress:run": "cypress run --component"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@vue-skuilder/common": "0.1.
|
|
35
|
-
"@vue-skuilder/common-ui": "0.1.
|
|
36
|
-
"@vue-skuilder/courseware": "0.1.
|
|
37
|
-
"@vue-skuilder/db": "0.1.
|
|
34
|
+
"@vue-skuilder/common": "0.1.21",
|
|
35
|
+
"@vue-skuilder/common-ui": "0.1.21",
|
|
36
|
+
"@vue-skuilder/courseware": "0.1.21",
|
|
37
|
+
"@vue-skuilder/db": "0.1.21",
|
|
38
38
|
"pinia": "^2.3.0",
|
|
39
39
|
"vue": "^3.5.13",
|
|
40
40
|
"vuetify": "^3.7.0"
|
|
@@ -49,8 +49,8 @@
|
|
|
49
49
|
"@testing-library/jest-dom": "^6.6.3",
|
|
50
50
|
"@testing-library/vue": "^8.1.0",
|
|
51
51
|
"@types/pouchdb": "^6.4.2",
|
|
52
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
53
|
-
"@typescript-eslint/parser": "^8.
|
|
52
|
+
"@typescript-eslint/eslint-plugin": "^8.48.1",
|
|
53
|
+
"@typescript-eslint/parser": "^8.48.1",
|
|
54
54
|
"@vitejs/plugin-vue": "^6.0.0",
|
|
55
55
|
"@vue/eslint-config-typescript": "^14.4.0",
|
|
56
56
|
"@vue/test-utils": "^2.4.6",
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
"sass": "^1.83.0",
|
|
64
64
|
"typescript": "~5.9.3",
|
|
65
65
|
"vite": "^7.0.0",
|
|
66
|
-
"vitest": "^
|
|
66
|
+
"vitest": "^4.0.15"
|
|
67
67
|
},
|
|
68
|
-
"stableVersion": "0.1.
|
|
68
|
+
"stableVersion": "0.1.21"
|
|
69
69
|
}
|
|
@@ -189,7 +189,7 @@ export default defineComponent({
|
|
|
189
189
|
const jsonError = ref<string | null>(null);
|
|
190
190
|
const loadingTags = ref(true);
|
|
191
191
|
|
|
192
|
-
const delegateStrategies = ['elo', 'srs'
|
|
192
|
+
const delegateStrategies = ['elo', 'srs'];
|
|
193
193
|
|
|
194
194
|
// Reactive copy of config for editing
|
|
195
195
|
const config = computed(() => props.modelValue);
|
|
@@ -235,7 +235,7 @@ export default defineComponent({
|
|
|
235
235
|
const jsonError = ref<string | null>(null);
|
|
236
236
|
const loadingTags = ref(true);
|
|
237
237
|
|
|
238
|
-
const delegateStrategies = ['elo', 'srs'
|
|
238
|
+
const delegateStrategies = ['elo', 'srs'];
|
|
239
239
|
|
|
240
240
|
const config = computed(() => props.modelValue);
|
|
241
241
|
|
|
@@ -70,13 +70,8 @@
|
|
|
70
70
|
></v-text-field>
|
|
71
71
|
|
|
72
72
|
<!-- Strategy-specific configuration forms -->
|
|
73
|
-
<hardcoded-order-config-form
|
|
74
|
-
v-if="newStrategy.type === 'hardcoded'"
|
|
75
|
-
v-model="newStrategy.config"
|
|
76
|
-
/>
|
|
77
|
-
|
|
78
73
|
<hierarchy-config-form
|
|
79
|
-
v-
|
|
74
|
+
v-if="newStrategy.type === 'hierarchy'"
|
|
80
75
|
v-model="newStrategy.config"
|
|
81
76
|
:course-id="courseId"
|
|
82
77
|
/>
|
|
@@ -137,7 +132,6 @@
|
|
|
137
132
|
import { defineComponent } from 'vue';
|
|
138
133
|
import type { ContentNavigationStrategyData } from '@vue-skuilder/db/src/core/types/contentNavigationStrategy';
|
|
139
134
|
import NavigationStrategyList from './NavigationStrategyList.vue';
|
|
140
|
-
import HardcodedOrderConfigForm from './HardcodedOrderConfigForm.vue';
|
|
141
135
|
import HierarchyConfigForm from './HierarchyConfigForm.vue';
|
|
142
136
|
import InterferenceConfigForm from './InterferenceConfigForm.vue';
|
|
143
137
|
import RelativePriorityConfigForm from './RelativePriorityConfigForm.vue';
|
|
@@ -148,7 +142,6 @@ export default defineComponent({
|
|
|
148
142
|
|
|
149
143
|
components: {
|
|
150
144
|
NavigationStrategyList,
|
|
151
|
-
HardcodedOrderConfigForm,
|
|
152
145
|
HierarchyConfigForm,
|
|
153
146
|
InterferenceConfigForm,
|
|
154
147
|
RelativePriorityConfigForm,
|
|
@@ -168,13 +161,12 @@ export default defineComponent({
|
|
|
168
161
|
showDeleteConfirm: false,
|
|
169
162
|
strategyToDelete: null as ContentNavigationStrategyData | null,
|
|
170
163
|
strategyTypes: [
|
|
171
|
-
{ label: 'Hardcoded Order', value: 'hardcoded' },
|
|
172
164
|
{ label: 'Hierarchy Definition', value: 'hierarchy' },
|
|
173
165
|
{ label: 'Interference Mitigator', value: 'interference' },
|
|
174
166
|
{ label: 'Relative Priority', value: 'relativePriority' },
|
|
175
167
|
],
|
|
176
168
|
newStrategy: {
|
|
177
|
-
type: '
|
|
169
|
+
type: 'hierarchy' as string,
|
|
178
170
|
name: '',
|
|
179
171
|
description: '',
|
|
180
172
|
config: { cardIds: [] } as any,
|
|
@@ -198,8 +190,6 @@ export default defineComponent({
|
|
|
198
190
|
methods: {
|
|
199
191
|
getDefaultConfig(strategyType: string) {
|
|
200
192
|
switch (strategyType) {
|
|
201
|
-
case 'hardcoded':
|
|
202
|
-
return { cardIds: [] };
|
|
203
193
|
case 'hierarchy':
|
|
204
194
|
return {
|
|
205
195
|
prerequisites: {},
|
|
@@ -231,8 +221,6 @@ export default defineComponent({
|
|
|
231
221
|
// Map implementing class to strategy type
|
|
232
222
|
getStrategyTypeFromClass(implementingClass: string): string {
|
|
233
223
|
switch (implementingClass) {
|
|
234
|
-
case Navigators.HARDCODED:
|
|
235
|
-
return 'hardcoded';
|
|
236
224
|
case Navigators.HIERARCHY:
|
|
237
225
|
return 'hierarchy';
|
|
238
226
|
case Navigators.INTERFERENCE:
|
|
@@ -240,22 +228,14 @@ export default defineComponent({
|
|
|
240
228
|
case Navigators.RELATIVE_PRIORITY:
|
|
241
229
|
return 'relativePriority';
|
|
242
230
|
default:
|
|
243
|
-
return '
|
|
231
|
+
return 'hierarchy';
|
|
244
232
|
}
|
|
245
233
|
},
|
|
246
234
|
|
|
247
235
|
// Parse serialized data back to config object
|
|
248
236
|
parseSerializedData(strategyType: string, serializedData: string): any {
|
|
249
237
|
try {
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
if (strategyType === 'hardcoded') {
|
|
253
|
-
// Hardcoded stores just the array, wrap it
|
|
254
|
-
return { cardIds: Array.isArray(parsed) ? parsed : [] };
|
|
255
|
-
} else {
|
|
256
|
-
// Other strategies store the full config object
|
|
257
|
-
return parsed;
|
|
258
|
-
}
|
|
238
|
+
return JSON.parse(serializedData);
|
|
259
239
|
} catch (error) {
|
|
260
240
|
console.error('Failed to parse strategy data:', error);
|
|
261
241
|
return this.getDefaultConfig(strategyType);
|
|
@@ -316,7 +296,7 @@ export default defineComponent({
|
|
|
316
296
|
},
|
|
317
297
|
|
|
318
298
|
startNewStrategy() {
|
|
319
|
-
const defaultType = '
|
|
299
|
+
const defaultType = 'hierarchy';
|
|
320
300
|
this.newStrategy = {
|
|
321
301
|
type: defaultType,
|
|
322
302
|
name: '',
|
|
@@ -386,21 +366,13 @@ export default defineComponent({
|
|
|
386
366
|
|
|
387
367
|
// Map strategy type to implementing class
|
|
388
368
|
const implementingClassMap: Record<string, string> = {
|
|
389
|
-
hardcoded: Navigators.HARDCODED,
|
|
390
369
|
hierarchy: Navigators.HIERARCHY,
|
|
391
370
|
interference: Navigators.INTERFERENCE,
|
|
392
371
|
relativePriority: Navigators.RELATIVE_PRIORITY,
|
|
393
372
|
};
|
|
394
373
|
|
|
395
374
|
// Serialize config based on strategy type
|
|
396
|
-
let serializedData: string;
|
|
397
|
-
if (this.newStrategy.type === 'hardcoded') {
|
|
398
|
-
// Hardcoded stores just the array of card IDs
|
|
399
|
-
serializedData = JSON.stringify(this.newStrategy.config.cardIds);
|
|
400
|
-
} else {
|
|
401
|
-
// Other strategies store their full config object
|
|
402
|
-
serializedData = JSON.stringify(this.newStrategy.config);
|
|
403
|
-
}
|
|
375
|
+
let serializedData: string = JSON.stringify(this.newStrategy.config);
|
|
404
376
|
|
|
405
377
|
if (this.editingStrategy) {
|
|
406
378
|
// Update existing strategy
|
|
@@ -202,7 +202,7 @@ export default defineComponent({
|
|
|
202
202
|
const jsonError = ref<string | null>(null);
|
|
203
203
|
const loadingTags = ref(true);
|
|
204
204
|
|
|
205
|
-
const delegateStrategies = ['elo', 'srs'
|
|
205
|
+
const delegateStrategies = ['elo', 'srs'];
|
|
206
206
|
const combineModes = [
|
|
207
207
|
{ title: 'Max (highest priority wins)', value: 'max' },
|
|
208
208
|
{ title: 'Average (average all priorities)', value: 'average' },
|
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="hardcoded-order-config-form">
|
|
3
|
-
<v-textarea
|
|
4
|
-
:model-value="cardIdsText"
|
|
5
|
-
@update:model-value="updateCardIds"
|
|
6
|
-
label="Card IDs"
|
|
7
|
-
placeholder="Enter card IDs, one per line or separated by commas"
|
|
8
|
-
rows="10"
|
|
9
|
-
hint="Paste card IDs in the order they should be presented"
|
|
10
|
-
persistent-hint
|
|
11
|
-
required
|
|
12
|
-
></v-textarea>
|
|
13
|
-
|
|
14
|
-
<v-alert v-if="cardCount > 0" type="info" density="compact" class="mt-2">
|
|
15
|
-
{{ cardCount }} card{{ cardCount === 1 ? '' : 's' }} configured
|
|
16
|
-
</v-alert>
|
|
17
|
-
|
|
18
|
-
<v-alert v-if="validationError" type="error" density="compact" class="mt-2">
|
|
19
|
-
{{ validationError }}
|
|
20
|
-
</v-alert>
|
|
21
|
-
</div>
|
|
22
|
-
</template>
|
|
23
|
-
|
|
24
|
-
<script lang="ts">
|
|
25
|
-
import { defineComponent, computed, ref, watch } from 'vue';
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* Configuration for hardcoded order strategy
|
|
29
|
-
* Serialized format: JSON array of card IDs
|
|
30
|
-
*/
|
|
31
|
-
export interface HardcodedOrderConfig {
|
|
32
|
-
cardIds: string[];
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
export default defineComponent({
|
|
36
|
-
name: 'HardcodedOrderConfigForm',
|
|
37
|
-
|
|
38
|
-
props: {
|
|
39
|
-
modelValue: {
|
|
40
|
-
type: Object as () => HardcodedOrderConfig,
|
|
41
|
-
required: true,
|
|
42
|
-
},
|
|
43
|
-
},
|
|
44
|
-
|
|
45
|
-
emits: ['update:modelValue'],
|
|
46
|
-
|
|
47
|
-
setup(props, { emit }) {
|
|
48
|
-
const validationError = ref<string | null>(null);
|
|
49
|
-
|
|
50
|
-
// Convert card IDs array to text representation
|
|
51
|
-
const cardIdsText = computed(() => {
|
|
52
|
-
return props.modelValue.cardIds.join('\n');
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
// Count of configured cards
|
|
56
|
-
const cardCount = computed(() => {
|
|
57
|
-
return props.modelValue.cardIds.length;
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* Update card IDs from text input
|
|
62
|
-
* Splits on newlines or commas, trims, and filters empty strings
|
|
63
|
-
*/
|
|
64
|
-
function updateCardIds(text: string) {
|
|
65
|
-
validationError.value = null;
|
|
66
|
-
|
|
67
|
-
try {
|
|
68
|
-
const cardIdArray = text
|
|
69
|
-
.split(/[\n,]+/)
|
|
70
|
-
.map((id) => id.trim())
|
|
71
|
-
.filter((id) => id);
|
|
72
|
-
|
|
73
|
-
emit('update:modelValue', {
|
|
74
|
-
cardIds: cardIdArray,
|
|
75
|
-
});
|
|
76
|
-
} catch (error) {
|
|
77
|
-
validationError.value = error instanceof Error ? error.message : 'Invalid input';
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
// Validate on mount and when config changes
|
|
82
|
-
watch(
|
|
83
|
-
() => props.modelValue,
|
|
84
|
-
() => {
|
|
85
|
-
if (props.modelValue.cardIds.length === 0) {
|
|
86
|
-
validationError.value = 'At least one card ID is required';
|
|
87
|
-
} else {
|
|
88
|
-
validationError.value = null;
|
|
89
|
-
}
|
|
90
|
-
},
|
|
91
|
-
{ immediate: true }
|
|
92
|
-
);
|
|
93
|
-
|
|
94
|
-
return {
|
|
95
|
-
cardIdsText,
|
|
96
|
-
cardCount,
|
|
97
|
-
validationError,
|
|
98
|
-
updateCardIds,
|
|
99
|
-
};
|
|
100
|
-
},
|
|
101
|
-
});
|
|
102
|
-
</script>
|
|
103
|
-
|
|
104
|
-
<style scoped>
|
|
105
|
-
.hardcoded-order-config-form {
|
|
106
|
-
padding: 16px 0;
|
|
107
|
-
}
|
|
108
|
-
</style>
|