@drax/settings-vue 0.11.5 → 0.12.8
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
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "0.
|
|
6
|
+
"version": "0.12.8",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"main": "./src/index.ts",
|
|
9
9
|
"module": "./src/index.ts",
|
|
@@ -24,9 +24,9 @@
|
|
|
24
24
|
"format": "prettier --write src/"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@drax/common-front": "^0.
|
|
28
|
-
"@drax/settings-front": "^0.
|
|
29
|
-
"@drax/settings-share": "^0.
|
|
27
|
+
"@drax/common-front": "^0.12.1",
|
|
28
|
+
"@drax/settings-front": "^0.12.8",
|
|
29
|
+
"@drax/settings-share": "^0.12.1"
|
|
30
30
|
},
|
|
31
31
|
"peerDependencies": {
|
|
32
32
|
"pinia": "^2.2.2",
|
|
@@ -63,5 +63,5 @@
|
|
|
63
63
|
"vue-tsc": "^2.1.10",
|
|
64
64
|
"vuetify": "^3.7.1"
|
|
65
65
|
},
|
|
66
|
-
"gitHead": "
|
|
66
|
+
"gitHead": "54ceaf876ec121b9bc604160dceb0d2ce1b8c78b"
|
|
67
67
|
}
|
|
@@ -5,7 +5,7 @@ import SettingEditor from "./SettingEditor.vue";
|
|
|
5
5
|
import {onMounted, ref} from "vue";
|
|
6
6
|
import type {ISetting} from "@drax/settings-share";
|
|
7
7
|
|
|
8
|
-
const {fetchSettings, settingsGrouped
|
|
8
|
+
const {fetchSettings, settingsGrouped} = useSetting()
|
|
9
9
|
|
|
10
10
|
onMounted(async () => {
|
|
11
11
|
await fetchSettings()
|
|
@@ -38,13 +38,13 @@ function clearEdit() {
|
|
|
38
38
|
></setting-editor>
|
|
39
39
|
|
|
40
40
|
<v-row >
|
|
41
|
-
<v-col cols="12" v-for="(
|
|
41
|
+
<v-col cols="12" v-for="(category,k) in settingsGrouped">
|
|
42
42
|
<v-card>
|
|
43
43
|
<v-card-title>
|
|
44
44
|
{{ k }}
|
|
45
45
|
</v-card-title>
|
|
46
46
|
<v-card-text>
|
|
47
|
-
<v-row v-for="(setting, i) in
|
|
47
|
+
<v-row v-for="(setting, i) in category" :key="i">
|
|
48
48
|
<v-col cols="9">
|
|
49
49
|
<setting-field
|
|
50
50
|
|
|
@@ -27,7 +27,7 @@ const emit = defineEmits(['updateValue'])
|
|
|
27
27
|
async function updateValue() {
|
|
28
28
|
try {
|
|
29
29
|
loading.value = true
|
|
30
|
-
await updateSettingValue(setting.
|
|
30
|
+
await updateSettingValue(setting._id, value.value)
|
|
31
31
|
emit('updateValue', value.value)
|
|
32
32
|
} catch (e) {
|
|
33
33
|
console.error(e)
|
|
@@ -31,10 +31,10 @@ export function useSetting() {
|
|
|
31
31
|
|
|
32
32
|
const settingsGrouped = computed(() => {
|
|
33
33
|
return settings.value.reduce((acc, item) => {
|
|
34
|
-
if (!acc[item.
|
|
35
|
-
acc[item.
|
|
34
|
+
if (!acc[item.category]) {
|
|
35
|
+
acc[item.category] = [];
|
|
36
36
|
}
|
|
37
|
-
acc[item.
|
|
37
|
+
acc[item.category].push(item);
|
|
38
38
|
return acc;
|
|
39
39
|
}, {} as { [key: string]: ISetting[] });
|
|
40
40
|
})
|
|
@@ -26,7 +26,7 @@ export const useSettingStore = defineStore('SettingStore', {
|
|
|
26
26
|
this.settings = settings
|
|
27
27
|
},
|
|
28
28
|
updateSetting(setting: ISetting): void {
|
|
29
|
-
const index = this.settings.findIndex((s) => s.
|
|
29
|
+
const index = this.settings.findIndex((s) => s._id === setting._id)
|
|
30
30
|
if (index > -1) {
|
|
31
31
|
this.settings[index] = setting
|
|
32
32
|
} else {
|