@done-coding/admin-core 0.0.1-alpha.0 → 0.0.1-alpha.2
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/display/TabsMain.vue.mjs +61 -0
- package/es/components/display/TabsMain.vue2.mjs +4 -0
- package/es/components/display/index.mjs +9 -7
- package/es/components/form/FormDateTimeRange.vue.mjs +46 -0
- package/es/components/form/FormDateTimeRange.vue2.mjs +4 -0
- package/es/components/form/FormMain.vue.mjs +65 -61
- package/es/components/form/FormRadio.vue.mjs +69 -0
- package/es/components/form/FormRadio.vue2.mjs +4 -0
- package/es/components/form/FormSearch.vue2.mjs +24 -23
- package/es/components/form/index.mjs +29 -23
- package/es/components/list-page/ListPage.vue.mjs +1 -1
- package/es/components/list-page/ListPage.vue2.mjs +107 -95
- package/es/components/misc/AutoRefresh.vue.mjs +7 -0
- package/es/components/misc/AutoRefresh.vue2.mjs +57 -0
- package/es/components/misc/index.mjs +7 -5
- 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 +159 -118
- package/es/components/table/TableToolbar.vue.mjs +7 -0
- package/es/components/table/TableToolbar.vue2.mjs +75 -0
- package/es/config/route.mjs +3 -2
- package/es/helpers/list-helper.mjs +66 -0
- package/es/hooks/timeout.mjs +21 -0
- package/es/index.mjs +88 -73
- package/es/style.css +1 -1
- package/package.json +3 -3
- package/types/components/display/TabsMain.vue.d.ts +52 -0
- package/types/components/display/index.d.ts +2 -1
- package/types/components/form/FormDateTimeRange.vue.d.ts +18 -0
- package/types/components/form/FormMain.vue.d.ts +3 -0
- package/types/components/form/FormRadio.vue.d.ts +35 -0
- package/types/components/form/FormSearch.vue.d.ts +1 -1
- package/types/components/form/FormSelect.vue.d.ts +2 -6
- package/types/components/form/index.d.ts +3 -1
- package/types/components/form/types.d.ts +13 -0
- package/types/components/list-page/ListPage.vue.d.ts +18 -2
- package/types/components/misc/AutoRefresh.vue.d.ts +14 -0
- package/types/components/misc/index.d.ts +2 -1
- package/types/components/modal/ConfirmModal.vue.d.ts +1 -1
- 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 +22 -2
- package/types/config/route.d.ts +2 -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/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