@sigmaott/base-next 1.4.50 → 1.4.52
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,8 +1,9 @@
|
|
|
1
|
-
import SwaggerClient from
|
|
2
|
-
import { useFilterSchema } from
|
|
3
|
-
import service from
|
|
1
|
+
import SwaggerClient from "swagger-client";
|
|
2
|
+
import { useFilterSchema } from "./useFilterSchema";
|
|
3
|
+
import service from "@/api/axios";
|
|
4
|
+
import { createSharedComposable, useAsyncState } from "@vueuse/core";
|
|
4
5
|
|
|
5
|
-
const useSharedSchemaAsync = createSharedComposable(useAsyncState)
|
|
6
|
+
const useSharedSchemaAsync = createSharedComposable(useAsyncState);
|
|
6
7
|
|
|
7
8
|
export function useAsyncSchema(url: string, schemaInput: string) {
|
|
8
9
|
async function fetcher() {
|
|
@@ -10,20 +11,25 @@ export function useAsyncSchema(url: string, schemaInput: string) {
|
|
|
10
11
|
headers: {
|
|
11
12
|
noNotify: true,
|
|
12
13
|
},
|
|
13
|
-
})
|
|
14
|
-
const result = await SwaggerClient.resolveSubtree(
|
|
15
|
-
|
|
14
|
+
});
|
|
15
|
+
const result = await SwaggerClient.resolveSubtree(
|
|
16
|
+
res.data.components.schemas,
|
|
17
|
+
[]
|
|
18
|
+
);
|
|
19
|
+
return result.spec;
|
|
16
20
|
}
|
|
17
21
|
|
|
18
|
-
const { state, ...rest } = useSharedSchemaAsync(fetcher, {})
|
|
22
|
+
const { state, ...rest } = useSharedSchemaAsync(fetcher, {});
|
|
19
23
|
|
|
20
|
-
const schema = computed(() =>
|
|
21
|
-
|
|
24
|
+
const schema = computed(() =>
|
|
25
|
+
useFilterSchema(state.value?.[schemaInput]?.properties || {}, {})
|
|
26
|
+
);
|
|
27
|
+
const schemaItem = computed(() => state.value?.[schemaInput] || {});
|
|
22
28
|
|
|
23
|
-
const schemaObj = computed(() => schemaItem.value?.properties || {})
|
|
29
|
+
const schemaObj = computed(() => schemaItem.value?.properties || {});
|
|
24
30
|
const schemaDesc = computed(() => {
|
|
25
|
-
return objectMap(schemaObj.value || {}, (k, v) => [k, v.description ||
|
|
26
|
-
})
|
|
31
|
+
return objectMap(schemaObj.value || {}, (k, v) => [k, v.description || ""]);
|
|
32
|
+
});
|
|
27
33
|
|
|
28
34
|
return {
|
|
29
35
|
...rest,
|
|
@@ -31,28 +37,28 @@ export function useAsyncSchema(url: string, schemaInput: string) {
|
|
|
31
37
|
schemaItem,
|
|
32
38
|
schemaDesc,
|
|
33
39
|
schemaObj,
|
|
34
|
-
}
|
|
40
|
+
};
|
|
35
41
|
}
|
|
36
42
|
|
|
37
43
|
export function useHelpPanel() {
|
|
38
|
-
const isShowHelpPanel = ref(false)
|
|
39
|
-
const schemaObj = ref({})
|
|
44
|
+
const isShowHelpPanel = ref(false);
|
|
45
|
+
const schemaObj = ref({});
|
|
40
46
|
|
|
41
47
|
function openHelpPanel(schema: any) {
|
|
42
|
-
schemaObj.value = schema
|
|
43
|
-
isShowHelpPanel.value = true
|
|
44
|
-
console.log(
|
|
48
|
+
schemaObj.value = schema;
|
|
49
|
+
isShowHelpPanel.value = true;
|
|
50
|
+
console.log("🚀 ~ openHelpPanel ~ schema:", schema, isShowHelpPanel);
|
|
45
51
|
}
|
|
46
52
|
|
|
47
53
|
function closeHelpPanel() {
|
|
48
|
-
isShowHelpPanel.value = false
|
|
54
|
+
isShowHelpPanel.value = false;
|
|
49
55
|
}
|
|
50
56
|
return {
|
|
51
57
|
isShowHelpPanel,
|
|
52
58
|
openHelpPanel,
|
|
53
59
|
closeHelpPanel,
|
|
54
60
|
schemaObj,
|
|
55
|
-
}
|
|
61
|
+
};
|
|
56
62
|
}
|
|
57
63
|
|
|
58
|
-
export const useSharedHelpPanel = createSharedComposable(useHelpPanel)
|
|
64
|
+
export const useSharedHelpPanel = createSharedComposable(useHelpPanel);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { RouteRecordRaw } from 'vue-router'
|
|
2
2
|
import type { Ref } from 'vue'
|
|
3
|
-
import { ref } from 'vue'
|
|
4
|
-
import { createInjectionState, useStorage, useToggle } from '@vueuse/core'
|
|
3
|
+
import { computed, ref } from 'vue'
|
|
4
|
+
import { createInjectionState, useDark, useStorage, useToggle, syncRef } from '@vueuse/core'
|
|
5
5
|
import { StorageKeys } from '../enums'
|
|
6
6
|
import { __IS_DARK__, __LANGUAGE__ } from '../constants/storage'
|
|
7
7
|
|
package/src/plugins/auth.ts
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
|
+
import { useDocumentVisibility } from "@vueuse/core";
|
|
2
|
+
|
|
1
3
|
export default defineNuxtPlugin(() => {
|
|
2
|
-
const visibility = useDocumentVisibility()
|
|
4
|
+
const visibility = useDocumentVisibility();
|
|
3
5
|
|
|
4
6
|
watch(TOKEN_STORAGE, () => {
|
|
5
7
|
nextTick(() => {
|
|
6
|
-
if (!TOKEN_STORAGE.value && visibility.value ===
|
|
7
|
-
window.location.reload()
|
|
8
|
-
})
|
|
9
|
-
})
|
|
10
|
-
})
|
|
8
|
+
if (!TOKEN_STORAGE.value && visibility.value === "hidden")
|
|
9
|
+
window.location.reload();
|
|
10
|
+
});
|
|
11
|
+
});
|
|
12
|
+
});
|