@peng_kai/kit 0.1.17 → 0.2.0-beta.0
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/admin/adminPlugin.ts +47 -0
- package/admin/components/filter/src/FilterParam.vue +76 -78
- package/admin/components/filter/src/FilterReset.vue +2 -2
- package/admin/components/filter/src/useFilterParams.ts +75 -25
- package/admin/components/filter/src/useFilterQuery.ts +32 -16
- package/admin/components/rich-text/index.ts +2 -0
- package/admin/components/rich-text/src/RichText.vue +342 -0
- package/admin/components/rich-text/src/imageUploader.ts +34 -0
- package/admin/components/rich-text/src/type.d.ts +7 -0
- package/admin/components/text/src/Datetime.vue +47 -48
- package/admin/components/upload/index.ts +2 -0
- package/admin/components/upload/src/PictureCardUpload.vue +143 -0
- package/admin/components/upload/src/customRequests.ts +31 -0
- package/admin/defines/index.ts +1 -1
- package/admin/defines/route/helpers.ts +0 -1
- package/admin/defines/startup/defineStartup.ts +8 -1
- package/admin/defines/startup/index.ts +1 -1
- package/admin/defines/startup/{getStartups.ts → runStartup.ts} +16 -7
- package/admin/layout/large/Breadcrumb.vue +68 -69
- package/admin/layout/large/Content.vue +23 -24
- package/admin/layout/large/Menu.vue +68 -69
- package/admin/layout/large/PageTab.vue +70 -71
- package/admin/permission/index.ts +2 -4
- package/admin/permission/routerGuard.ts +41 -43
- package/admin/permission/vuePlugin.ts +46 -30
- package/admin/route-guards/collapseMenu.ts +3 -3
- package/admin/route-guards/pageTitle.ts +18 -19
- package/admin/{hooks/useMenu.ts → stores/createUseMenuStore.ts} +133 -128
- package/admin/{hooks/usePage.ts → stores/createUsePageStore.ts} +145 -141
- package/admin/stores/createUsePageTabStore.ts +43 -0
- package/admin/{permission/usePermission.ts → stores/createUsePermissionStore.ts} +57 -52
- package/admin/stores/index.ts +8 -0
- package/admin/styles/classCover.scss +8 -0
- package/antd/hooks/useAntdForm.helpers.ts +92 -8
- package/antd/hooks/useAntdForm.ts +55 -63
- package/antd/hooks/useAntdTable.ts +12 -0
- package/antd/index.ts +1 -1
- package/libs/a-calc.ts +1 -0
- package/libs/axios.ts +2 -0
- package/libs/bignumber.ts +2 -0
- package/libs/dayjs.ts +5 -0
- package/libs/echarts.ts +5 -0
- package/libs/localstorage-slim.ts +2 -0
- package/libs/lodash-es.ts +1 -0
- package/libs/pinia.ts +1 -0
- package/libs/vue-query.ts +1 -0
- package/libs/vueuse.ts +3 -0
- package/package.json +55 -16
- package/request/helpers.ts +20 -1
- package/request/queryClient.ts +34 -21
- package/utils/upload/AwsS3.ts +76 -0
- package/utils/upload/fileHandlers.ts +27 -0
- package/utils/upload/index.ts +2 -0
- package/vite/index.d.ts +1 -0
- package/vite/index.mjs +27 -0
- package/vue/components/echarts/index.ts +1 -0
- package/vue/components/echarts/src/ECharts.vue +48 -0
- package/vue/components/index.ts +1 -0
- package/vue/components/infinite-query/src/InfiniteQuery.vue +2 -8
- package/vue/components/test/KitTest.vue +9 -0
- package/vue/components/test/testStore.ts +11 -0
- package/admin/hooks/index.ts +0 -5
- package/admin/hooks/usePageTab.ts +0 -35
- package/kitDependencies.ts +0 -43
|
@@ -29,8 +29,7 @@ const props = withDefaults(defineProps<{
|
|
|
29
29
|
|
|
30
30
|
const { queryier } = props;
|
|
31
31
|
const pages = computed(() => queryier.data.value?.pages);
|
|
32
|
-
|
|
33
|
-
const isInitialLoading = computed(() => queryier.isInitialLoading.value);
|
|
32
|
+
const isInitialLoading = computed(() => queryier.isPending.value);
|
|
34
33
|
const isInitialLoadingError = computed(() => queryier.isLoadingError.value && !isInitialLoading.value);
|
|
35
34
|
const isMoreLoading = computed(
|
|
36
35
|
() => (queryier.isFetchingNextPage.value || queryier.isFetching.value) && !isInitialLoading.value,
|
|
@@ -60,12 +59,7 @@ const containerCssVars = computed(() => {
|
|
|
60
59
|
});
|
|
61
60
|
|
|
62
61
|
function refetchLastPage() {
|
|
63
|
-
queryier.refetch(
|
|
64
|
-
refetchPage(lastPage: any, _index, allPages: any[]) {
|
|
65
|
-
const lastIndex = allPages?.length - 1;
|
|
66
|
-
return lastPage?.pagination?.page === allPages?.[lastIndex]?.pagination?.page;
|
|
67
|
-
},
|
|
68
|
-
});
|
|
62
|
+
queryier.refetch();
|
|
69
63
|
}
|
|
70
64
|
|
|
71
65
|
function fetchNextPage() {
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { useQueryClient } from '@tanstack/vue-query';
|
|
2
|
+
import { defineStore } from 'pinia';
|
|
3
|
+
import { useRouter } from 'vue-router';
|
|
4
|
+
|
|
5
|
+
export const useTestStore = defineStore('test-store', () => {
|
|
6
|
+
const router = useRouter();
|
|
7
|
+
const queryClient = useQueryClient();
|
|
8
|
+
console.log('🤡 / router:', router);
|
|
9
|
+
console.log('🤡 / queryClient:', queryClient);
|
|
10
|
+
return {};
|
|
11
|
+
});
|
package/admin/hooks/index.ts
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { createGlobalState } from '@vueuse/core';
|
|
2
|
-
import { computed, ref, watch } from 'vue';
|
|
3
|
-
import { usePage } from './usePage';
|
|
4
|
-
|
|
5
|
-
export { usePageTab };
|
|
6
|
-
|
|
7
|
-
const usePageTab = createGlobalState(() => {
|
|
8
|
-
const { currentPageKey, pageStateMap, openPage, closePage } = usePage();
|
|
9
|
-
const tabKeyList = ref<string[]>([]);
|
|
10
|
-
const tabList = computed(() => tabKeyList.value.map((key) => {
|
|
11
|
-
const state = pageStateMap.get(key);
|
|
12
|
-
|
|
13
|
-
return state ? { key, title: state.title, icon: state.icon } : undefined!;
|
|
14
|
-
}).filter(tab => !!tab));
|
|
15
|
-
|
|
16
|
-
const closeTab = (key: string) => {
|
|
17
|
-
const i = tabKeyList.value.indexOf(key);
|
|
18
|
-
|
|
19
|
-
if (i > -1) {
|
|
20
|
-
closePage(key);
|
|
21
|
-
setTimeout(() => tabKeyList.value.splice(i, 1));
|
|
22
|
-
}
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
watch(
|
|
26
|
-
currentPageKey,
|
|
27
|
-
(key) => {
|
|
28
|
-
if (!tabKeyList.value.includes(key))
|
|
29
|
-
tabKeyList.value.push(key);
|
|
30
|
-
},
|
|
31
|
-
{ immediate: true },
|
|
32
|
-
);
|
|
33
|
-
|
|
34
|
-
return { activeTab: currentPageKey, tabList, closeTab, openTab: openPage };
|
|
35
|
-
});
|
package/kitDependencies.ts
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import type dayjs from 'dayjs';
|
|
2
|
-
import type { useRoute, useRouter } from 'vue-router';
|
|
3
|
-
import type { useMenu, usePage, usePageTab } from './admin/hooks';
|
|
4
|
-
import type { TRole, usePermission } from './admin/permission/usePermission';
|
|
5
|
-
|
|
6
|
-
const KEY = '__PK_KIT_DEPENDENCIES__';
|
|
7
|
-
|
|
8
|
-
interface Dependencies {
|
|
9
|
-
dayjs: typeof dayjs
|
|
10
|
-
appName: string
|
|
11
|
-
appId: string
|
|
12
|
-
roles: Record<string, TRole>
|
|
13
|
-
useRoute: typeof useRoute
|
|
14
|
-
useRouter: typeof useRouter
|
|
15
|
-
useMenu: typeof useMenu
|
|
16
|
-
usePage: typeof usePage
|
|
17
|
-
usePageTab: typeof usePageTab
|
|
18
|
-
usePermission: typeof usePermission
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export function setDependencies(deps: Partial<Dependencies>) {
|
|
22
|
-
window[KEY] = { ...window[KEY], ...deps };
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export function getDependencies() {
|
|
26
|
-
if (window[KEY]) {
|
|
27
|
-
return new Proxy(window[KEY], {
|
|
28
|
-
get(target, prop: keyof Dependencies) {
|
|
29
|
-
if (prop in target)
|
|
30
|
-
return target[prop];
|
|
31
|
-
else
|
|
32
|
-
throw new Error(`未发现 kit 依赖 ${prop}`);
|
|
33
|
-
},
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
else { throw new Error('未发现 kit 依赖'); };
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
declare global {
|
|
40
|
-
interface Window {
|
|
41
|
-
[KEY]: Dependencies
|
|
42
|
-
}
|
|
43
|
-
}
|