@done-coding/admin-core 0.0.1-alpha.0 → 0.1.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/es/components/form/FormMain.vue.mjs +65 -61
- package/es/components/form/FormSearch.vue2.mjs +24 -23
- package/es/components/list-page/ListPage.vue.mjs +1 -1
- package/es/components/list-page/ListPage.vue2.mjs +105 -93
- package/es/components/modal/DetailModal.vue.mjs +31 -29
- package/es/components/table/TableMain.vue.mjs +2 -2
- package/es/components/table/TableMain.vue2.mjs +154 -117
- package/es/components/table/TableToolbar.vue.mjs +7 -0
- package/es/components/table/TableToolbar.vue2.mjs +95 -0
- package/es/helpers/list-helper.mjs +66 -0
- package/es/hooks/timeout.mjs +21 -0
- package/es/index.mjs +43 -37
- package/es/style.css +1 -1
- package/package.json +3 -3
- package/types/components/form/FormMain.vue.d.ts +3 -0
- package/types/components/form/types.d.ts +1 -0
- package/types/components/list-page/ListPage.vue.d.ts +18 -2
- package/types/components/modal/types.d.ts +2 -0
- package/types/components/table/TableMain.vue.d.ts +13 -1
- package/types/components/table/TableToolbar.vue.d.ts +43 -0
- package/types/components/table/types.d.ts +18 -0
- package/types/helpers/index.d.ts +2 -0
- package/types/helpers/list-helper.d.ts +36 -0
- package/types/helpers/types.d.ts +15 -0
- package/types/hooks/index.d.ts +1 -0
- package/types/hooks/timeout.d.ts +7 -0
package/es/index.mjs
CHANGED
|
@@ -5,15 +5,15 @@ import { miscInstall as a } from "./components/misc/index.mjs";
|
|
|
5
5
|
import { modalInstall as m } from "./components/modal/index.mjs";
|
|
6
6
|
import { tableInstall as f } from "./components/table/index.mjs";
|
|
7
7
|
import { listPageInstall as s } from "./components/list-page/index.mjs";
|
|
8
|
-
import { default as
|
|
9
|
-
import { default as
|
|
8
|
+
import { default as E } from "./components/modal/DetailModal.vue.mjs";
|
|
9
|
+
import { default as _ } from "./components/form/FormMain.vue.mjs";
|
|
10
10
|
import { default as M } from "./components/form/FormRadioGroup.vue.mjs";
|
|
11
|
-
import { default as
|
|
12
|
-
import { default as
|
|
13
|
-
import { default as
|
|
11
|
+
import { default as S } from "./components/form/FormSelect.vue.mjs";
|
|
12
|
+
import { default as L } from "./components/form/FormTree.vue.mjs";
|
|
13
|
+
import { default as D } from "./components/form/FormVerifyCode.vue.mjs";
|
|
14
14
|
import { default as P } from "./components/menu/MenuItemSub.vue.mjs";
|
|
15
|
-
import { default as
|
|
16
|
-
import { default as
|
|
15
|
+
import { default as G } from "./components/menu/MenuTree.vue.mjs";
|
|
16
|
+
import { default as b } from "./components/misc/TriggerAutoImport.vue.mjs";
|
|
17
17
|
import { default as y } from "./components/display/WatchSize.vue.mjs";
|
|
18
18
|
import { APP_API_LIST_MODEL_KEY_CONFIG as v } from "./config/list-model.mjs";
|
|
19
19
|
import { BODY_CONTENT_VIEWPORT_HEIGHT as H } from "./inject/key.mjs";
|
|
@@ -24,16 +24,18 @@ import { default as le } from "./components/form/FormSearch.vue.mjs";
|
|
|
24
24
|
import { default as ie } from "./components/form/FormVerifyImage.vue.mjs";
|
|
25
25
|
import { default as ne } from "./components/list-page/ListPage.vue.mjs";
|
|
26
26
|
import { ROUTE_MODULE_LEVEL as de } from "./config/route.mjs";
|
|
27
|
-
import { default as
|
|
28
|
-
import {
|
|
29
|
-
import {
|
|
30
|
-
import {
|
|
31
|
-
import {
|
|
32
|
-
import {
|
|
33
|
-
import {
|
|
34
|
-
import {
|
|
35
|
-
import {
|
|
36
|
-
import {
|
|
27
|
+
import { default as ce } from "./components/table/TableMain.vue.mjs";
|
|
28
|
+
import { countAll as Ee, createListApi as Fe, fetchListAll as _e } from "./helpers/list-helper.mjs";
|
|
29
|
+
import { createGenerateRouteMetaRawTree as Me } from "./helpers/route.mjs";
|
|
30
|
+
import { createStorageWithNamespace as Se } from "./helpers/storage.mjs";
|
|
31
|
+
import { createUseState as Le } from "./helpers/state.mjs";
|
|
32
|
+
import { flatRouteMetaResolveRaw as De, getRoutePermissionKey as Oe } from "./utils/router.mjs";
|
|
33
|
+
import { getId as he } from "./utils/id.mjs";
|
|
34
|
+
import { timeCountDown as Ne } from "./utils/time.mjs";
|
|
35
|
+
import { useActivated as we, useActivatedEvent as ye, useActivatedExec as Ve } from "./hooks/activated.mjs";
|
|
36
|
+
import { useFeelSize as Ue } from "./hooks/feel-size.mjs";
|
|
37
|
+
import { useMenusDataDispatch as We } from "./hooks/menus-dispatch.mjs";
|
|
38
|
+
import { useTimeout as Be } from "./hooks/timeout.mjs";
|
|
37
39
|
const I = {
|
|
38
40
|
install(e) {
|
|
39
41
|
e.use(t), e.use(o), e.use(r), e.use(a), e.use(m), e.use(f), e.use(s);
|
|
@@ -43,37 +45,40 @@ export {
|
|
|
43
45
|
v as APP_API_LIST_MODEL_KEY_CONFIG,
|
|
44
46
|
H as BODY_CONTENT_VIEWPORT_HEIGHT,
|
|
45
47
|
z as ConfirmModal,
|
|
46
|
-
|
|
48
|
+
E as DetailModal,
|
|
47
49
|
K as FORM_CONFIG_SELECT_ALL_VALUE,
|
|
48
50
|
J as FORM_ITEM_CHANGE_LOADING,
|
|
49
|
-
|
|
51
|
+
_ as FormMain,
|
|
50
52
|
M as FormRadioGroup,
|
|
51
53
|
le as FormSearch,
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
54
|
+
S as FormSelect,
|
|
55
|
+
L as FormTree,
|
|
56
|
+
D as FormVerifyCode,
|
|
55
57
|
ie as FormVerifyImage,
|
|
56
58
|
ne as ListPage,
|
|
57
59
|
P as MenuItemSub,
|
|
58
|
-
|
|
60
|
+
G as MenuTree,
|
|
59
61
|
de as ROUTE_MODULE_LEVEL,
|
|
60
|
-
|
|
61
|
-
|
|
62
|
+
ce as TableMain,
|
|
63
|
+
b as TriggerAutoImport,
|
|
62
64
|
y as WatchSize,
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
65
|
+
Ee as countAll,
|
|
66
|
+
Me as createGenerateRouteMetaRawTree,
|
|
67
|
+
Fe as createListApi,
|
|
68
|
+
Se as createStorageWithNamespace,
|
|
69
|
+
Le as createUseState,
|
|
66
70
|
r as displayInstall,
|
|
67
|
-
|
|
71
|
+
_e as fetchListAll,
|
|
72
|
+
De as flatRouteMetaResolveRaw,
|
|
68
73
|
t as formInstall,
|
|
69
74
|
Q as generateFormData,
|
|
70
75
|
X as getBlurSubmit,
|
|
71
76
|
Z as getChangeSubmit,
|
|
72
77
|
Y as getConfirmPasswordRule,
|
|
73
78
|
$ as getEnterSubmit,
|
|
74
|
-
|
|
79
|
+
he as getId,
|
|
75
80
|
ee as getPlaceholder,
|
|
76
|
-
|
|
81
|
+
Oe as getRoutePermissionKey,
|
|
77
82
|
te as getVModelSugar,
|
|
78
83
|
I as installComponents,
|
|
79
84
|
s as listPageInstall,
|
|
@@ -88,10 +93,11 @@ export {
|
|
|
88
93
|
me as stringifyFormData,
|
|
89
94
|
fe as swiftFormItemConfig,
|
|
90
95
|
f as tableInstall,
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
96
|
+
Ne as timeCountDown,
|
|
97
|
+
we as useActivated,
|
|
98
|
+
ye as useActivatedEvent,
|
|
99
|
+
Ve as useActivatedExec,
|
|
100
|
+
Ue as useFeelSize,
|
|
101
|
+
We as useMenusDataDispatch,
|
|
102
|
+
Be as useTimeout
|
|
97
103
|
};
|
package/es/style.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.form-item-tip[data-v-e889a0ed]{text-align:left;line-height:1.5;font-size:12px}.form-search_show[data-v-8896356d]{margin-bottom:10px}.form-search .btn-box[data-v-8896356d]{padding-left:20px}.form-search[data-v-8896356d] .el-col{padding-left:14px}.form-verify-image[data-v-a4baf877] .el-input__suffix-inner *{margin:0}.form-verify-image-suffix[data-v-a4baf877]{position:absolute;height:100%;border-radius:var(--el-input-border-radius, var(--el-border-radius-base));top:50%;transform:translateY(-50%);overflow:hidden;cursor:pointer}.form-verify-image-suffix-main[data-v-a4baf877]{position:absolute;left:0;top:0;width:100%;height:100%;background-color:#f4f4f4}.confirm-dialog .content[data-v-2f0c870e]{overflow-x:hidden;overflow-y:auto;max-height:calc(100vh - 200px)}.confirm-dialog .btn[data-v-2f0c870e]{width:150px;height:40px;border-radius:4px}.confirm-dialog .main[data-v-2f0c870e]{position:relative;text-align:center}.confirm-dialog .main .close-box[data-v-2f0c870e]{position:absolute;top:0;right:0;cursor:pointer;z-index:2}.confirm-dialog .main .shim[data-v-2f0c870e]{position:relative;z-index:1}.confirm-dialog .main .shim .title[data-v-2f0c870e]{font-size:18px;font-weight:500}.confirm-dialog .main .shim .content[data-v-2f0c870e]{font-size:16px;margin-top:15px}.confirm-dialog .main .shim .footer[data-v-2f0c870e]{display:flex;justify-content:center;align-items:center;padding-top:5px}.confirm-dialog .main .shim .footer>.btn[data-v-2f0c870e]:not(:last-child){margin-right:30px}.confirm-dialog .main .shim .footer[reverse=true][data-v-2f0c870e]{flex-direction:row-reverse}.confirm-dialog .main .shim .footer[reverse=true]>.btn[data-v-2f0c870e]:not(:last-child){margin-right:0;margin-left:30px}.confirm-dialog .el-dialog__header,.confirm-dialog .el-dialog__body{padding:0;background-color:transparent}.table-main-table[data-v-
|
|
1
|
+
.form-item-tip[data-v-e889a0ed]{text-align:left;line-height:1.5;font-size:12px}.form-search_show[data-v-8896356d]{margin-bottom:10px}.form-search .btn-box[data-v-8896356d]{padding-left:20px}.form-search[data-v-8896356d] .el-col{padding-left:14px}.form-verify-image[data-v-a4baf877] .el-input__suffix-inner *{margin:0}.form-verify-image-suffix[data-v-a4baf877]{position:absolute;height:100%;border-radius:var(--el-input-border-radius, var(--el-border-radius-base));top:50%;transform:translateY(-50%);overflow:hidden;cursor:pointer}.form-verify-image-suffix-main[data-v-a4baf877]{position:absolute;left:0;top:0;width:100%;height:100%;background-color:#f4f4f4}.confirm-dialog .content[data-v-2f0c870e]{overflow-x:hidden;overflow-y:auto;max-height:calc(100vh - 200px)}.confirm-dialog .btn[data-v-2f0c870e]{width:150px;height:40px;border-radius:4px}.confirm-dialog .main[data-v-2f0c870e]{position:relative;text-align:center}.confirm-dialog .main .close-box[data-v-2f0c870e]{position:absolute;top:0;right:0;cursor:pointer;z-index:2}.confirm-dialog .main .shim[data-v-2f0c870e]{position:relative;z-index:1}.confirm-dialog .main .shim .title[data-v-2f0c870e]{font-size:18px;font-weight:500}.confirm-dialog .main .shim .content[data-v-2f0c870e]{font-size:16px;margin-top:15px}.confirm-dialog .main .shim .footer[data-v-2f0c870e]{display:flex;justify-content:center;align-items:center;padding-top:5px}.confirm-dialog .main .shim .footer>.btn[data-v-2f0c870e]:not(:last-child){margin-right:30px}.confirm-dialog .main .shim .footer[reverse=true][data-v-2f0c870e]{flex-direction:row-reverse}.confirm-dialog .main .shim .footer[reverse=true]>.btn[data-v-2f0c870e]:not(:last-child){margin-right:0;margin-left:30px}.confirm-dialog .el-dialog__header,.confirm-dialog .el-dialog__body{padding:0;background-color:transparent}.table-toolbar[data-v-d2a1aea9]{display:flex;justify-content:flex-end;align-items:center;padding-bottom:8px}.table-toolbar-right[data-v-d2a1aea9]{display:flex;align-items:center;gap:8px}.table-toolbar-label[data-v-d2a1aea9]{font-size:13px;color:var(--el-text-color-regular)}.table-toolbar-interval[data-v-d2a1aea9]{width:80px}.table-toolbar-icon--rotating[data-v-d2a1aea9]{animation:table-toolbar-rotating-d2a1aea9 1s linear infinite}@keyframes table-toolbar-rotating-d2a1aea9{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.table-main-table[data-v-08dc9d04]{--el-table-header-bg-color: var(--v1961e86c)}.table-main-pagination[data-v-08dc9d04]{margin-top:10px;display:flex;justify-content:flex-end}.list-page[data-v-767c1592]{min-height:var(--v036568fb)}.list-page-operation[data-v-767c1592]{margin-bottom:10px}.list-page[data-v-767c1592] .el-loading-mask{left:-10px;top:-10px;right:-10px;bottom:-10px}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@done-coding/admin-core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.1.0",
|
|
4
4
|
"description": "后台管理核心",
|
|
5
5
|
"private": false,
|
|
6
6
|
"main": "lib/index.cjs",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"predev": "dc-inject",
|
|
27
27
|
"dev": "vite build -w -m hotBuild",
|
|
28
28
|
"prebuild": "dc-inject",
|
|
29
|
-
"build": "
|
|
29
|
+
"build": "vue-tsc && vite build",
|
|
30
30
|
"prepack": "pnpm build",
|
|
31
31
|
"test": "vitest",
|
|
32
32
|
"coverage": "vitest run --coverage"
|
|
@@ -77,5 +77,5 @@
|
|
|
77
77
|
"node": ">=18.0.0",
|
|
78
78
|
"pnpm": ">=9.0.0"
|
|
79
79
|
},
|
|
80
|
-
"gitHead": "
|
|
80
|
+
"gitHead": "c36a32fd56c54e6450e2abd2124bdc1642c8bb80"
|
|
81
81
|
}
|
|
@@ -149,6 +149,7 @@ export interface FormMainProps<PO extends Record<string, any>, SO extends Record
|
|
|
149
149
|
list: FormItemConfigList<PO, SO>;
|
|
150
150
|
data: PO;
|
|
151
151
|
layout?: Partial<ColProps>;
|
|
152
|
+
rowGutter?: number;
|
|
152
153
|
}
|
|
153
154
|
/** FormSearch props */
|
|
154
155
|
export interface FormSearchProps<PO extends Record<string, any>, SO extends Record<string, any>, SQ extends Record<string, any>> extends FormMainProps<PO, SO> {
|
|
@@ -3,7 +3,14 @@ import { TableMainInstance } from '../table';
|
|
|
3
3
|
import { ListPageInnerInjectInfo, ListPageInstance } from './types';
|
|
4
4
|
|
|
5
5
|
declare const _default: <T extends Record<string, any>, PO extends Record<string, any>, SO extends Record<string, any>, SQ extends Record<string, any>, F extends Record<string, any>>(__VLS_props: Awaited<typeof __VLS_setup>["props"], __VLS_ctx?: __VLS_Prettify<Pick<Awaited<typeof __VLS_setup>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
6
|
-
props: __VLS_Prettify<__VLS_OmitKeepDiscriminatedUnion<(Partial<{}> & Omit<{
|
|
6
|
+
props: __VLS_Prettify<__VLS_OmitKeepDiscriminatedUnion<(Partial<{}> & Omit<{
|
|
7
|
+
readonly onDataChange?: ((data: T[]) => any) | undefined;
|
|
8
|
+
readonly onPageInfoChange?: ((info: {
|
|
9
|
+
pageSize: number;
|
|
10
|
+
currentPage: number;
|
|
11
|
+
total: number;
|
|
12
|
+
}) => any) | undefined;
|
|
13
|
+
} & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, never>) & (Partial<Pick<import('../form').FormSearchProps<PO, SO, {}>, "staticQuery">> & {
|
|
7
14
|
formSearchProps?: Partial<Omit<import('../form').FormSearchProps<PO, SO, {}>, "list" | "staticQuery">> | undefined;
|
|
8
15
|
} & Pick<import('../table').TableMainProps<T, import('../form').ExcludeNeverProperties<import('../form').ExtractFormStringifyRawFromObject<PO, SO>> & SQ, ListPageInnerInjectInfo<PO, F>>, import('./types').TableMainRequiredKey> & Partial<Pick<import('../table').TableMainProps<T, import('../form').ExcludeNeverProperties<import('../form').ExtractFormStringifyRawFromObject<PO, SO>> & SQ, ListPageInnerInjectInfo<PO, F>>, import('./types').TableMainOptionsKey>> & {
|
|
9
16
|
tableMainProps?: Partial<Omit<import('../table').TableMainProps<T, import('../form').ExcludeNeverProperties<import('../form').ExtractFormStringifyRawFromObject<PO, SO>> & SQ, ListPageInnerInjectInfo<PO, F>>, import('./types').TableMainOptionsKey | import('./types').TableMainRewriteKey>> | undefined;
|
|
@@ -15,6 +22,8 @@ declare const _default: <T extends Record<string, any>, PO extends Record<string
|
|
|
15
22
|
injectInfo?: F | undefined;
|
|
16
23
|
beforeSearch?: ((data: import('../form').ExcludeNeverProperties<import('../form').ExtractFormStringifyRawFromObject<PO, SO>>, type: FormSearchSearchType) => import('../form').ExcludeNeverProperties<import('../form').ExtractFormStringifyRawFromObject<PO, SO>>) | undefined;
|
|
17
24
|
clearTableFilterOnReset?: boolean;
|
|
25
|
+
} & {
|
|
26
|
+
isAutoRefresh?: boolean;
|
|
18
27
|
}), keyof import('vue').VNodeProps | keyof import('vue').AllowedComponentProps>> & {} & (import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps);
|
|
19
28
|
expose(exposed: import('vue').ShallowUnwrapRef<ListPageInstance<PO>>): void;
|
|
20
29
|
attrs: any;
|
|
@@ -34,7 +43,14 @@ declare const _default: <T extends Record<string, any>, PO extends Record<string
|
|
|
34
43
|
}) => any>> & {
|
|
35
44
|
operation?(_: {}): any;
|
|
36
45
|
}>;
|
|
37
|
-
emit:
|
|
46
|
+
emit: {
|
|
47
|
+
(e: "dataChange", data: T[]): void;
|
|
48
|
+
(e: "pageInfoChange", info: {
|
|
49
|
+
pageSize: number;
|
|
50
|
+
currentPage: number;
|
|
51
|
+
total: number;
|
|
52
|
+
}): void;
|
|
53
|
+
};
|
|
38
54
|
}>) => import('vue').VNode & {
|
|
39
55
|
__ctx?: Awaited<typeof __VLS_setup>;
|
|
40
56
|
};
|
|
@@ -6,7 +6,14 @@ declare const _default: <T extends Record<string, any>, SQ extends Record<string
|
|
|
6
6
|
readonly onPageChange?: ((value: number) => any) | undefined;
|
|
7
7
|
readonly onPageSizeChange?: ((value: number) => any) | undefined;
|
|
8
8
|
readonly onDataChange?: ((data: T[]) => any) | undefined;
|
|
9
|
-
|
|
9
|
+
readonly onPageInfoChange?: ((info: {
|
|
10
|
+
pageSize: number;
|
|
11
|
+
currentPage: number;
|
|
12
|
+
total: number;
|
|
13
|
+
}) => any) | undefined;
|
|
14
|
+
} & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, never>) & (TableMainProps<T, SQ, F> & {
|
|
15
|
+
isAutoRefresh?: boolean;
|
|
16
|
+
}), keyof import('vue').VNodeProps | keyof import('vue').AllowedComponentProps>> & {} & (import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps);
|
|
10
17
|
expose(exposed: import('vue').ShallowUnwrapRef<TableMainInstance>): void;
|
|
11
18
|
attrs: any;
|
|
12
19
|
slots: ReturnType<() => Partial<Record<NonNullable<Uppercase<string> | Extract<keyof T, string> | undefined>, (_: {
|
|
@@ -25,6 +32,11 @@ declare const _default: <T extends Record<string, any>, SQ extends Record<string
|
|
|
25
32
|
(e: "pageChange" | "pageSizeChange", value: number): void;
|
|
26
33
|
(e: "dataChange", data: T[]): void;
|
|
27
34
|
(e: "loadingChange", value: boolean): void;
|
|
35
|
+
(e: "pageInfoChange", info: {
|
|
36
|
+
pageSize: number;
|
|
37
|
+
currentPage: number;
|
|
38
|
+
total: number;
|
|
39
|
+
}): void;
|
|
28
40
|
};
|
|
29
41
|
}>) => import('vue').VNode & {
|
|
30
42
|
__ctx?: Awaited<typeof __VLS_setup>;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { TableMainInstance } from './types';
|
|
2
|
+
|
|
3
|
+
declare const _default: import('vue').DefineComponent<globalThis.ExtractPropTypes<{
|
|
4
|
+
isAutoRefresh: import('vue').PropType<boolean>;
|
|
5
|
+
loading: {
|
|
6
|
+
type: globalThis.PropType<boolean>;
|
|
7
|
+
required: true;
|
|
8
|
+
};
|
|
9
|
+
features: {
|
|
10
|
+
type: globalThis.PropType<import('./types').TableToolbarFeature[]>;
|
|
11
|
+
default: () => string[];
|
|
12
|
+
};
|
|
13
|
+
refreshInterval: {
|
|
14
|
+
type: globalThis.PropType<number>;
|
|
15
|
+
default: number;
|
|
16
|
+
};
|
|
17
|
+
tableExpose: {
|
|
18
|
+
type: globalThis.PropType<TableMainInstance>;
|
|
19
|
+
required: true;
|
|
20
|
+
};
|
|
21
|
+
}>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<globalThis.ExtractPropTypes<{
|
|
22
|
+
isAutoRefresh: import('vue').PropType<boolean>;
|
|
23
|
+
loading: {
|
|
24
|
+
type: globalThis.PropType<boolean>;
|
|
25
|
+
required: true;
|
|
26
|
+
};
|
|
27
|
+
features: {
|
|
28
|
+
type: globalThis.PropType<import('./types').TableToolbarFeature[]>;
|
|
29
|
+
default: () => string[];
|
|
30
|
+
};
|
|
31
|
+
refreshInterval: {
|
|
32
|
+
type: globalThis.PropType<number>;
|
|
33
|
+
default: number;
|
|
34
|
+
};
|
|
35
|
+
tableExpose: {
|
|
36
|
+
type: globalThis.PropType<TableMainInstance>;
|
|
37
|
+
required: true;
|
|
38
|
+
};
|
|
39
|
+
}>> & Readonly<{}>, {
|
|
40
|
+
features: import('./types').TableToolbarFeature[];
|
|
41
|
+
refreshInterval: number;
|
|
42
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
43
|
+
export default _default;
|
|
@@ -22,6 +22,20 @@ export interface TableMainInstance {
|
|
|
22
22
|
reload: (slice?: boolean) => void;
|
|
23
23
|
getTableInstance: () => TableInstance | undefined;
|
|
24
24
|
}
|
|
25
|
+
/** toolbar 可配置功能列表 */
|
|
26
|
+
export type TableToolbarFeature = "refresh" | "autoRefresh";
|
|
27
|
+
/** toolbar 可配置项(通过 TableMain 的 toolbar prop 传入) */
|
|
28
|
+
export interface TableToolbarConfig {
|
|
29
|
+
/**
|
|
30
|
+
* 功能列表。
|
|
31
|
+
* - undefined(默认):显示所有功能
|
|
32
|
+
* - [](空数组):不渲染 toolbar
|
|
33
|
+
* - 枚举子集:仅显示指定功能
|
|
34
|
+
*/
|
|
35
|
+
features?: TableToolbarFeature[];
|
|
36
|
+
/** 自动刷新默认间隔(秒),默认 30 */
|
|
37
|
+
refreshInterval?: number;
|
|
38
|
+
}
|
|
25
39
|
/** 表格列默认作用域 */
|
|
26
40
|
export interface TableColumnDefaultScope<T extends Record<string, any>, F extends Record<string, any>> {
|
|
27
41
|
row: T;
|
|
@@ -66,6 +80,10 @@ SQ extends Record<string, any>,
|
|
|
66
80
|
F extends Record<string, any>> {
|
|
67
81
|
/** 展示分页器 */
|
|
68
82
|
showPager?: boolean;
|
|
83
|
+
/** 是否显示 toolbar(顶层开关,默认 true,优先级高于 toolbar.features) */
|
|
84
|
+
showToolbar?: boolean;
|
|
85
|
+
/** toolbar 配置 */
|
|
86
|
+
toolbar?: TableToolbarConfig;
|
|
69
87
|
/** 参数 */
|
|
70
88
|
query?: SQ;
|
|
71
89
|
/** 每页条数 */
|
package/types/helpers/index.d.ts
CHANGED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { TableApiParams, TableApiResult } from '../components/table/types';
|
|
2
|
+
|
|
3
|
+
export interface FetchListAllOptions {
|
|
4
|
+
/** 单页大小,默认 200,范围 [1, 1000] */
|
|
5
|
+
pageSize?: number;
|
|
6
|
+
/** 累计抓取上限,默认 10000;totalRecord > limit 则 throw */
|
|
7
|
+
limit?: number;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* 全量翻页拉取(串行,提前终止)
|
|
11
|
+
* ---
|
|
12
|
+
* @param api 原始分页 api 函数(签名同 TableMain :api prop)
|
|
13
|
+
* @param baseParams 业务侧固定参数,会透传到每页 api 调用(不被改写)
|
|
14
|
+
* @param opts pageSize / limit 覆盖
|
|
15
|
+
* @returns 全量 items 数组
|
|
16
|
+
*
|
|
17
|
+
* 行为:
|
|
18
|
+
* - totalRecord = 0 → 直接 [] 返回(仅调 1 次)
|
|
19
|
+
* - 单页 items.length < pageSize → 视为末页提前终止
|
|
20
|
+
* - 任一页 reject → 整体 reject 透传原错误
|
|
21
|
+
* - totalRecord > limit → throw 兜底
|
|
22
|
+
*/
|
|
23
|
+
export declare function fetchListAll<T extends Record<string, any>, P extends Record<string, any> = {}>(api: (params: TableApiParams<P>) => Promise<TableApiResult<T>>, baseParams?: P, opts?: FetchListAllOptions): Promise<T[]>;
|
|
24
|
+
export type ListApiSource<T> = T[] | (() => T[]) | (() => Promise<T[]>);
|
|
25
|
+
/**
|
|
26
|
+
* 用本地数组 / 同步函数 / 异步函数生成符合 TableMain :api prop 签名的 api
|
|
27
|
+
* ---
|
|
28
|
+
* 内部识别 source 类型 + 分页切片;无缓存,每次调用 source 重新求值
|
|
29
|
+
*/
|
|
30
|
+
export declare function createListApi<T extends Record<string, any>>(source: ListApiSource<T>): (params: TableApiParams<{}>) => Promise<TableApiResult<T>>;
|
|
31
|
+
/**
|
|
32
|
+
* countAll: 仅探测列表总记录数,不拉数据。
|
|
33
|
+
* 1 次 api 调用 page=1/pageSize=1,返回 totalRecord。
|
|
34
|
+
* 用于"探测是否有数据 / 数据计数 / 存在性判断"等场景,替代手工 pageSize: 9999 hack。
|
|
35
|
+
*/
|
|
36
|
+
export declare function countAll<P extends Record<string, any> = {}>(api: (params: TableApiParams<P>) => Promise<TableApiResult<any>>, baseParams?: P): Promise<number>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 深度递归 Partial(函数类型保持不变,object 类型字段递归可选)
|
|
3
|
+
* ---
|
|
4
|
+
* 应用场景:SDK 请求参数嵌套结构的可选化(如 PagingInput)
|
|
5
|
+
*/
|
|
6
|
+
export type DeepPartial<T> = T extends (...args: any[]) => any ? T : T extends object ? {
|
|
7
|
+
[K in keyof T]?: DeepPartial<T[K]>;
|
|
8
|
+
} : T;
|
|
9
|
+
/**
|
|
10
|
+
* 分页请求参数的可选包装
|
|
11
|
+
* ---
|
|
12
|
+
* 与 SDK 1.1.40 嵌套契约耦合:业务侧手包 list api wrapper 时
|
|
13
|
+
* 常以 PagingInput<RawApiParams> 作为入参类型,兜底字段缺失
|
|
14
|
+
*/
|
|
15
|
+
export type PagingInput<T> = DeepPartial<T>;
|
package/types/hooks/index.d.ts
CHANGED