workdesktop-ai 1.2.1 → 1.2.3
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/CHANGELOG.md +190 -190
- package/dist/chunks/Path-pIP0JQ0c.mjs +245 -0
- package/dist/chunks/Path-pIP0JQ0c.mjs.map +1 -0
- package/dist/chunks/Station-BTP0SbBg.mjs +818 -0
- package/dist/chunks/Station-BTP0SbBg.mjs.map +1 -0
- package/dist/index.esm.js +2 -2
- package/dist/index.umd.js +19 -19
- package/dist/index.umd.js.map +1 -1
- package/dist/path/index.mjs +1 -1
- package/dist/path/style.css +1 -1
- package/dist/station/index.mjs +1 -1
- package/dist/station/style.css +1 -1
- package/dist/style.css +1 -1
- package/dist/types/src/components/buttons/ApiButton.vue.d.ts +134 -0
- package/dist/types/src/components/buttons/ConfirmButton.vue.d.ts +169 -0
- package/dist/types/src/components/buttons/DialogButton.vue.d.ts +167 -0
- package/dist/types/src/components/buttons/DrawerButton.vue.d.ts +186 -0
- package/dist/types/src/components/buttons/PopconfirmButton.vue.d.ts +317 -0
- package/dist/types/src/components/buttons/PromptButton.vue.d.ts +180 -0
- package/dist/types/src/components/buttons/RouteButton.vue.d.ts +122 -0
- package/dist/types/src/components/buttons/TipsButton.vue.d.ts +66 -0
- package/dist/types/src/components/buttons/useApiAction.d.ts +20 -0
- package/dist/types/src/components/common/props.d.ts +122 -0
- package/dist/types/src/components/containers/Drawer.vue.d.ts +172 -0
- package/dist/types/src/components/containers/Iframe.vue.d.ts +81 -0
- package/dist/types/src/components/containers/containerContext.d.ts +15 -0
- package/dist/types/src/components/containers/useContainerController.d.ts +24 -0
- package/dist/types/src/components/containers/useIframeContainer.d.ts +20 -0
- package/dist/types/src/components/core/Requester.vue.d.ts +41 -0
- package/dist/types/src/components/data/datagrid/DataGrid.vue.d.ts +542 -0
- package/dist/types/src/components/data/datagrid/useColumnSettings.d.ts +62 -0
- package/dist/types/src/components/data/editable-grid/EditableGrid.vue.d.ts +586 -0
- package/dist/types/src/components/data/viewer/Viewer.vue.d.ts +187 -0
- package/dist/types/src/components/form/FormItem.vue.d.ts +62 -0
- package/dist/types/src/components/form/SearchItem.vue.d.ts +62 -0
- package/dist/types/src/components/form/SearchPanel.vue.d.ts +167 -0
- package/dist/types/src/components/form/data-form/DataForm.vue.d.ts +311 -0
- package/dist/types/src/components/index.d.ts +32 -0
- package/dist/types/src/components/inputs/AutoComplete.vue.d.ts +166 -0
- package/dist/types/src/components/inputs/CheckboxList.vue.d.ts +166 -0
- package/dist/types/src/components/inputs/RadioList.vue.d.ts +166 -0
- package/dist/types/src/components/inputs/Select.vue.d.ts +176 -0
- package/dist/types/src/components/inputs/Switch.vue.d.ts +116 -0
- package/dist/types/src/components/inputs/useOptionsLoader.d.ts +32 -0
- package/dist/types/src/components/layout/Station.vue.d.ts +313 -0
- package/dist/types/src/components/layout/StationMenuNode.vue.d.ts +20 -0
- package/dist/types/src/components/layout/types.d.ts +67 -0
- package/dist/types/src/components/styles/Panel.vue.d.ts +94 -0
- package/dist/types/src/components/styles/Path.vue.d.ts +103 -0
- package/dist/types/src/components/styles/Tips.vue.d.ts +60 -0
- package/dist/types/src/components/upload/ImageUpload.vue.d.ts +176 -0
- package/dist/types/src/components/upload/Upload.vue.d.ts +235 -0
- package/dist/types/src/entries/api-button.d.ts +9 -0
- package/dist/types/src/entries/auto-complete.d.ts +9 -0
- package/dist/types/src/entries/checkbox-list.d.ts +9 -0
- package/dist/types/src/entries/components-map.d.ts +8 -0
- package/dist/types/src/entries/confirm-button.d.ts +9 -0
- package/dist/types/src/entries/data-form.d.ts +9 -0
- package/dist/types/src/entries/data-grid.d.ts +9 -0
- package/dist/types/src/entries/dialog-button.d.ts +9 -0
- package/dist/types/src/entries/drawer-button.d.ts +9 -0
- package/dist/types/src/entries/drawer.d.ts +9 -0
- package/dist/types/src/entries/editable-grid.d.ts +9 -0
- package/dist/types/src/entries/form-item.d.ts +9 -0
- package/dist/types/src/entries/iframe.d.ts +9 -0
- package/dist/types/src/entries/image-upload.d.ts +9 -0
- package/dist/types/src/entries/panel.d.ts +9 -0
- package/dist/types/src/entries/path.d.ts +9 -0
- package/dist/types/src/entries/prompt-button.d.ts +9 -0
- package/dist/types/src/entries/radio-list.d.ts +9 -0
- package/dist/types/src/entries/requester.d.ts +9 -0
- package/dist/types/src/entries/route-button.d.ts +9 -0
- package/dist/types/src/entries/search-item.d.ts +9 -0
- package/dist/types/src/entries/search-panel.d.ts +9 -0
- package/dist/types/src/entries/select.d.ts +9 -0
- package/dist/types/src/entries/station.d.ts +9 -0
- package/dist/types/src/entries/switch.d.ts +9 -0
- package/dist/types/src/entries/tips-button.d.ts +9 -0
- package/dist/types/src/entries/tips.d.ts +9 -0
- package/dist/types/src/entries/upload.d.ts +9 -0
- package/dist/types/src/entries/viewer.d.ts +9 -0
- package/dist/types/src/index.d.ts +24 -0
- package/dist/types/src/lib/composables/useConfig.d.ts +19 -0
- package/dist/types/src/lib/composables/useDataGrid.d.ts +69 -0
- package/dist/types/src/lib/composables/useEventBus.d.ts +16 -0
- package/dist/types/src/lib/composables/useGlobalState.d.ts +5 -0
- package/dist/types/src/lib/composables/useRequest.d.ts +42 -0
- package/dist/types/src/lib/configs/default-config.d.ts +6 -0
- package/dist/types/src/lib/core/config.d.ts +28 -0
- package/dist/types/src/lib/core/http.d.ts +100 -0
- package/dist/types/src/lib/core/linkage.d.ts +48 -0
- package/dist/types/src/lib/core/skins/apple.d.ts +3 -0
- package/dist/types/src/lib/core/skins/business.d.ts +3 -0
- package/dist/types/src/lib/core/skins/chinese.d.ts +3 -0
- package/dist/types/src/lib/core/skins/cool.d.ts +3 -0
- package/dist/types/src/lib/core/skins/cyberpunk.d.ts +3 -0
- package/dist/types/src/lib/core/skins/default.d.ts +3 -0
- package/dist/types/src/lib/core/skins/fashion.d.ts +3 -0
- package/dist/types/src/lib/core/skins/flat.d.ts +3 -0
- package/dist/types/src/lib/core/skins/governance.d.ts +3 -0
- package/dist/types/src/lib/core/skins/index.d.ts +15 -0
- package/dist/types/src/lib/core/skins/tech.d.ts +3 -0
- package/dist/types/src/lib/core/skins/types.d.ts +19 -0
- package/dist/types/src/lib/core/station-linkage.d.ts +72 -0
- package/dist/types/src/lib/core/theme.d.ts +11 -0
- package/dist/types/src/lib/core/utils.d.ts +28 -0
- package/dist/types/src/lib/install.d.ts +11 -0
- package/dist/types/src/types/config.d.ts +130 -0
- package/dist/types/src/types/index.d.ts +4 -0
- package/dist/types/vite.config.d.ts +7 -0
- package/package.json +7 -2
- package/dist/chunks/Path-C_oyo6Dg.mjs +0 -200
- package/dist/chunks/Path-C_oyo6Dg.mjs.map +0 -1
- package/dist/chunks/Station-DLV19USa.mjs +0 -780
- package/dist/chunks/Station-DLV19USa.mjs.map +0 -1
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WdTipsButton 单独入口
|
|
3
|
+
* 用法:import WdTipsButton from 'workdesktop-ai/tips-button'
|
|
4
|
+
* import 'workdesktop-ai/tips-button/style.css'
|
|
5
|
+
*/
|
|
6
|
+
import '../styles/index.css';
|
|
7
|
+
import WdTipsButton from '../components/buttons/TipsButton.vue';
|
|
8
|
+
export { WdTipsButton };
|
|
9
|
+
export default WdTipsButton;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WdViewer 单独入口
|
|
3
|
+
* 用法:import WdViewer from 'workdesktop-ai/viewer'
|
|
4
|
+
* import 'workdesktop-ai/viewer/style.css'
|
|
5
|
+
*/
|
|
6
|
+
import '../styles/index.css';
|
|
7
|
+
import WdViewer from '../components/data/viewer/Viewer.vue';
|
|
8
|
+
export { WdViewer };
|
|
9
|
+
export default WdViewer;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WorkDesktop 组件库主入口
|
|
3
|
+
*
|
|
4
|
+
* ESM:import WorkDesktop from 'workdesktop-ai'
|
|
5
|
+
* UMD:window.WorkDesktop(script 标签,配合 window.workDesktopConfig)
|
|
6
|
+
*/
|
|
7
|
+
import './styles/index.css';
|
|
8
|
+
export { default as WorkDesktop, default } from './lib/install';
|
|
9
|
+
export * from './components';
|
|
10
|
+
export { initConfig, setGlobalConfig, getGlobalConfig, resetConfig, mergeConfig, getComponentDefault } from './lib/core/config';
|
|
11
|
+
export { SKIN_PRESETS, getSkinPreset, listSkins } from './lib/core/skins';
|
|
12
|
+
export type { SkinPreset } from './lib/core/skins';
|
|
13
|
+
export { RequestAPI, request, default as http } from './lib/core/http';
|
|
14
|
+
export type { ApiResult, ApiEventPayload, ApiEventType, ApiEventHandler } from './lib/core/http';
|
|
15
|
+
export { registerDataGrid, refreshDataGrid, searchDataGrid, resetSearchDataGrid, getDataGrids, clearLinkageRegistry } from './lib/core/linkage';
|
|
16
|
+
export { registerStation, setStationFooter, refreshStationView, getStationMenuChain, subscribeStationChange, notifyStationChange } from './lib/core/station-linkage';
|
|
17
|
+
export type { StationInstance, MenuChainItem } from './lib/core/station-linkage';
|
|
18
|
+
export { useRequest } from './lib/composables/useRequest';
|
|
19
|
+
export { useDataGrid } from './lib/composables/useDataGrid';
|
|
20
|
+
export { useConfig, useGlobalConfig } from './lib/composables/useConfig';
|
|
21
|
+
export { useEventBus } from './lib/composables/useEventBus';
|
|
22
|
+
export { useGlobalState } from './lib/composables/useGlobalState';
|
|
23
|
+
export { deepMerge } from './lib/core/utils';
|
|
24
|
+
export type * from './types';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { WorkDesktopConfig } from '../../types/config';
|
|
2
|
+
/**
|
|
3
|
+
* useConfig(PRD 5.3 / 5.2)
|
|
4
|
+
*
|
|
5
|
+
* 组件内合并三级配置:全局 componentDefault[组件名] → 本地 props。
|
|
6
|
+
* 全局配置在组件 onMounted 时读取一次并缓存(运行中改配置只影响新挂载组件)。
|
|
7
|
+
*
|
|
8
|
+
* 返回一个响应式 ref,merge 后的组件配置对象:
|
|
9
|
+
* componentDefault 的值作为默认,props 中非 undefined 的值覆盖。
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* const cfg = useConfig('WdDataGrid', props)
|
|
13
|
+
* cfg.value.withPager
|
|
14
|
+
*/
|
|
15
|
+
export declare function useConfig<T extends Record<string, any> = Record<string, any>>(componentName?: string, props?: T): import("vue").Ref<any, any> extends T ? T extends T & import("vue").Ref<any, any> ? import("@vue/shared").IfAny<T, import("vue").ShallowRef<T, T>, T> : import("vue").ShallowRef<T, T> : import("vue").ShallowRef<T, T>;
|
|
16
|
+
/**
|
|
17
|
+
* 非响应式:直接取当前全局 WorkDesktopConfig
|
|
18
|
+
*/
|
|
19
|
+
export declare function useGlobalConfig(): WorkDesktopConfig;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* useDataGrid(PRD 5.3)
|
|
3
|
+
* DataGrid 状态管理:分页 / 搜索 / 选中 / 请求
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* const grid = useDataGrid({ pageSize: 20 })
|
|
7
|
+
* grid.fetchData()
|
|
8
|
+
*/
|
|
9
|
+
export interface SortState {
|
|
10
|
+
prop: string;
|
|
11
|
+
order: 'ascending' | 'descending';
|
|
12
|
+
}
|
|
13
|
+
export interface UseDataGridOptions {
|
|
14
|
+
/** 数据接口地址 */
|
|
15
|
+
api?: string;
|
|
16
|
+
/** 请求方法,默认 post */
|
|
17
|
+
apiMethod?: 'get' | 'post' | 'put' | 'delete';
|
|
18
|
+
/** 固定请求参数 */
|
|
19
|
+
apiParam?: Record<string, any>;
|
|
20
|
+
/** 初始每页条数 */
|
|
21
|
+
pageSize?: number;
|
|
22
|
+
/** 是否自动请求 */
|
|
23
|
+
immediate?: boolean;
|
|
24
|
+
/** 请求级覆盖 */
|
|
25
|
+
reqOptions?: import('../../types/config').ReqOptions;
|
|
26
|
+
/** 请求成功回调(解封后的列表结果) */
|
|
27
|
+
onLoaded?: (result: {
|
|
28
|
+
list: any[];
|
|
29
|
+
total: number;
|
|
30
|
+
}) => void;
|
|
31
|
+
}
|
|
32
|
+
export interface ListData {
|
|
33
|
+
list: any[];
|
|
34
|
+
total: number;
|
|
35
|
+
pageSize: number;
|
|
36
|
+
currentPage: number;
|
|
37
|
+
}
|
|
38
|
+
export declare function useDataGrid(options?: UseDataGridOptions): {
|
|
39
|
+
currentPage: import("vue").Ref<number, number>;
|
|
40
|
+
page: import("vue").Ref<number, number>;
|
|
41
|
+
pageSize: import("vue").Ref<number, number>;
|
|
42
|
+
total: import("vue").Ref<number, number>;
|
|
43
|
+
list: import("vue").ShallowRef<any[], any[]>;
|
|
44
|
+
loading: import("vue").Ref<boolean, boolean>;
|
|
45
|
+
searchParams: Record<string, any>;
|
|
46
|
+
selection: import("vue").Ref<any[], any[]>;
|
|
47
|
+
sortState: import("vue").Ref<{
|
|
48
|
+
prop: string;
|
|
49
|
+
order: "ascending" | "descending";
|
|
50
|
+
} | null, SortState | {
|
|
51
|
+
prop: string;
|
|
52
|
+
order: "ascending" | "descending";
|
|
53
|
+
} | null>;
|
|
54
|
+
fetchData: (extra?: Record<string, any>) => Promise<ListData>;
|
|
55
|
+
refresh: () => Promise<ListData>;
|
|
56
|
+
reset: () => Promise<ListData>;
|
|
57
|
+
search: (params?: Record<string, any>) => Promise<ListData>;
|
|
58
|
+
changeSort: ({ prop, order }: {
|
|
59
|
+
prop: string;
|
|
60
|
+
order: "ascending" | "descending" | null;
|
|
61
|
+
}) => Promise<ListData>;
|
|
62
|
+
onChangeCurrentpage: (value: number) => Promise<ListData>;
|
|
63
|
+
onChangePagesize: (value: number) => Promise<ListData>;
|
|
64
|
+
setSelection: (rows: any[]) => void;
|
|
65
|
+
getSelection: () => any[];
|
|
66
|
+
clearSelection: () => void;
|
|
67
|
+
buildParams: (extra?: Record<string, any>) => Record<string, any>;
|
|
68
|
+
};
|
|
69
|
+
export type DataGridController = ReturnType<typeof useDataGrid>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 轻量事件总线(PRD 5.3 / 6.3)
|
|
3
|
+
* 跨组件事件联动。组件卸载自动 off。
|
|
4
|
+
*/
|
|
5
|
+
type Handler = (payload?: any) => void;
|
|
6
|
+
declare function emit(event: string, payload?: any): void;
|
|
7
|
+
declare function off(event: string, handler: Handler): void;
|
|
8
|
+
declare function clear(event?: string): void;
|
|
9
|
+
export declare function useEventBus(): {
|
|
10
|
+
emit: typeof emit;
|
|
11
|
+
on: (event: string, handler: Handler) => () => void;
|
|
12
|
+
off: typeof off;
|
|
13
|
+
clear: typeof clear;
|
|
14
|
+
};
|
|
15
|
+
export type EventBus = ReturnType<typeof useEventBus>;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { type ApiResult } from '../core/http';
|
|
2
|
+
import type { ReqOptions } from '../../types/config';
|
|
3
|
+
/**
|
|
4
|
+
* useRequest(PRD 5.3)
|
|
5
|
+
* 封装请求逻辑,返回 data/loading/error + 请求方法。
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* const { data, loading, run } = useRequest<User[]>('/api/users', {
|
|
9
|
+
* method: 'post',
|
|
10
|
+
* immediate: false,
|
|
11
|
+
* reqConfig: { showTips: false }
|
|
12
|
+
* })
|
|
13
|
+
* run({ page: 1 })
|
|
14
|
+
*/
|
|
15
|
+
export interface UseRequestOptions {
|
|
16
|
+
/** 请求方法,默认 post */
|
|
17
|
+
method?: 'get' | 'post' | 'put' | 'delete';
|
|
18
|
+
/** 是否立即自动请求,默认 true */
|
|
19
|
+
immediate?: boolean;
|
|
20
|
+
/** 自动请求时的初始参数 */
|
|
21
|
+
initialParams?: any;
|
|
22
|
+
/** 请求级覆盖项(透传给 http) */
|
|
23
|
+
reqOptions?: ReqOptions;
|
|
24
|
+
/** 成功回调(data 为解封后的业务数据) */
|
|
25
|
+
onSuccess?: (data: any, result: ApiResult) => void;
|
|
26
|
+
/** 业务失败回调 */
|
|
27
|
+
onFail?: (result: ApiResult) => void;
|
|
28
|
+
/** 异常回调 */
|
|
29
|
+
onError?: (error: any) => void;
|
|
30
|
+
}
|
|
31
|
+
export declare function useRequest<T = any>(api: string | (() => string), options?: UseRequestOptions): {
|
|
32
|
+
data: import("vue").Ref<any, any> extends T | null ? import("vue").ShallowRef<null, null> | (T extends T & import("vue").Ref<any, any> ? import("@vue/shared").IfAny<T, import("vue").ShallowRef<T, T>, T> : import("vue").ShallowRef<T, T>) : import("vue").ShallowRef<T | null, T | null>;
|
|
33
|
+
loading: import("vue").Ref<boolean, boolean>;
|
|
34
|
+
error: import("vue").ShallowRef<Error | null, Error | null>;
|
|
35
|
+
run: (params?: any) => Promise<ApiResult<T> | null>;
|
|
36
|
+
refresh: () => Promise<ApiResult<T> | null>;
|
|
37
|
+
abort: () => void;
|
|
38
|
+
};
|
|
39
|
+
/** 工具:解包可能为 ref 的值 */
|
|
40
|
+
export declare function unrefValue<T>(v: T | {
|
|
41
|
+
value: T;
|
|
42
|
+
}): T;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { DeepPartial, WorkDesktopConfig } from '../../types/config';
|
|
2
|
+
/**
|
|
3
|
+
* 增量合并到全局层。库 install 时与运行时 setGlobalConfig 共用。
|
|
4
|
+
* 返回 merge 后的有效配置。
|
|
5
|
+
*/
|
|
6
|
+
export declare function setGlobalConfig(partial?: DeepPartial<WorkDesktopConfig>): WorkDesktopConfig;
|
|
7
|
+
/**
|
|
8
|
+
* 读取当前全局层(含默认层 merge 结果)
|
|
9
|
+
*/
|
|
10
|
+
export declare function getGlobalConfig(): WorkDesktopConfig;
|
|
11
|
+
/**
|
|
12
|
+
* 恢复默认层
|
|
13
|
+
*/
|
|
14
|
+
export declare function resetConfig(): WorkDesktopConfig;
|
|
15
|
+
/**
|
|
16
|
+
* 合并本地层(组件 props / 组件级配置),产出最终配置。
|
|
17
|
+
* 优先级:localProps > globalConfig > defaultConfig
|
|
18
|
+
*/
|
|
19
|
+
export declare function mergeConfig(local?: DeepPartial<WorkDesktopConfig> | Record<string, any>): WorkDesktopConfig;
|
|
20
|
+
/**
|
|
21
|
+
* 取某组件类型的全局默认配置(page.componentDefault[PascalName])
|
|
22
|
+
*/
|
|
23
|
+
export declare function getComponentDefault(componentName: string): Record<string, any>;
|
|
24
|
+
/**
|
|
25
|
+
* 库初始化:合并双入口配置(npm app.use 参数 + window.workDesktopConfig)
|
|
26
|
+
* 两条入口汇入同一套 merge 逻辑,行为一致(PRD 8.2)
|
|
27
|
+
*/
|
|
28
|
+
export declare function initConfig(useConfig?: DeepPartial<WorkDesktopConfig>): WorkDesktopConfig;
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { type AxiosRequestConfig } from 'axios';
|
|
2
|
+
import type { ReqOptions } from '../../types/config';
|
|
3
|
+
/**
|
|
4
|
+
* HTTP 请求模块(PRD 5.1 / 第 7 章)
|
|
5
|
+
*
|
|
6
|
+
* RequestAPI 是本库的请求核心(PRD 5.1):所有请求类组件(DataGrid/DataForm/
|
|
7
|
+
* 按钮组/输入选择/上传等)都基于它开发;同时对外公开,允许开发者在组件外
|
|
8
|
+
* 手动调用 API 请求代码。库内置全局单例 `request`,也可 `new RequestAPI()` 自建实例。
|
|
9
|
+
*
|
|
10
|
+
* 响应处理流程:
|
|
11
|
+
* 1. 请求前显示 loading(可配置)
|
|
12
|
+
* 2. 响应到达,按 resConfig 解封:取 code/message/data
|
|
13
|
+
* 3. code 匹配成功码 → apiSuccess + 成功提示
|
|
14
|
+
* 4. code 不匹配 → apiFail + 失败提示(业务失败 resolve,不 reject)
|
|
15
|
+
* 5. 网络异常 → apiException + 异常提示(reject)
|
|
16
|
+
* 6. 请求完成 → apiAfter + 关闭 loading
|
|
17
|
+
*/
|
|
18
|
+
export type ApiEventType = 'apiBefore' | 'apiSuccess' | 'apiFail' | 'apiException' | 'apiAfter';
|
|
19
|
+
export interface ApiEventPayload {
|
|
20
|
+
type: ApiEventType;
|
|
21
|
+
url?: string;
|
|
22
|
+
method?: string;
|
|
23
|
+
params?: any;
|
|
24
|
+
/** 解封后的业务数据 */
|
|
25
|
+
data?: any;
|
|
26
|
+
code?: number | string;
|
|
27
|
+
message?: string;
|
|
28
|
+
error?: any;
|
|
29
|
+
/** 原始响应 */
|
|
30
|
+
raw?: any;
|
|
31
|
+
}
|
|
32
|
+
export type ApiEventHandler = (payload: ApiEventPayload) => void;
|
|
33
|
+
/** 业务失败时 resolve 的结果(PRD 7.4:不抛异常,组件据此感知) */
|
|
34
|
+
export interface ApiResult<T = any> {
|
|
35
|
+
success: boolean;
|
|
36
|
+
data: T | null;
|
|
37
|
+
code?: number | string;
|
|
38
|
+
message?: string;
|
|
39
|
+
raw?: any;
|
|
40
|
+
}
|
|
41
|
+
type Listener = ApiEventHandler;
|
|
42
|
+
/**
|
|
43
|
+
* RequestAPI 请求客户端(公开类)
|
|
44
|
+
*
|
|
45
|
+
* 所有组件基于它开发;开发者也可手动 new 实例并调用 get/post/put/delete/request。
|
|
46
|
+
* 默认单例见文件底部 `export const request`。
|
|
47
|
+
*/
|
|
48
|
+
export declare class RequestAPI {
|
|
49
|
+
private axiosInstance;
|
|
50
|
+
private listeners;
|
|
51
|
+
/** 组件/实例级配置覆盖(request.create 使用) */
|
|
52
|
+
private instanceConfig;
|
|
53
|
+
private loadingInstance;
|
|
54
|
+
private loadingCount;
|
|
55
|
+
/** 进行中的请求(in-flight dedup):key = method:url:序列化params,并发相同请求合并为一次网络调用 */
|
|
56
|
+
private inFlightRequests;
|
|
57
|
+
constructor(axiosConfig?: AxiosRequestConfig);
|
|
58
|
+
/**
|
|
59
|
+
* 创建绑定组件级配置的实例(PRD 5.1)
|
|
60
|
+
* 子实例复用父级监听器与去重表:同族实例(全局单例 + 各组件 create 出来的子实例)
|
|
61
|
+
* 之间并发相同请求同样合并,保证表列内多行组件发起的相同请求只打一次网络。
|
|
62
|
+
*/
|
|
63
|
+
create(componentReqConfig?: DeepPartialConfig): RequestAPI;
|
|
64
|
+
on(handler: Listener): () => void;
|
|
65
|
+
off(handler: Listener): void;
|
|
66
|
+
private emit;
|
|
67
|
+
/**
|
|
68
|
+
* 取有效配置:全局配置 + 实例级覆盖
|
|
69
|
+
*/
|
|
70
|
+
private resolveConfig;
|
|
71
|
+
private openLoading;
|
|
72
|
+
private closeLoading;
|
|
73
|
+
/**
|
|
74
|
+
* 核心请求方法
|
|
75
|
+
* 返回 Promise<ApiResult<T>>:业务失败也 resolve(success=false),仅网络异常 reject
|
|
76
|
+
*/
|
|
77
|
+
request<T = any>(config: AxiosRequestConfig, reqOptions?: ReqOptions): Promise<ApiResult<T>>;
|
|
78
|
+
/** 去重 key:method + 解析后 url + 序列化请求体;请求体不可序列化时退化为固定后缀(该场景不合并) */
|
|
79
|
+
private buildDedupKey;
|
|
80
|
+
/** 真实请求执行体(含事件/loading/封解封),被 request() 去重包装后调用 */
|
|
81
|
+
private executeRequest;
|
|
82
|
+
/**
|
|
83
|
+
* 解封响应体:按 resConfig 取 code/message/data
|
|
84
|
+
*/
|
|
85
|
+
private unpack;
|
|
86
|
+
private checkSuccess;
|
|
87
|
+
private buildUrl;
|
|
88
|
+
get<T = any>(url: string, params?: any, reqOptions?: ReqOptions): Promise<ApiResult<T>>;
|
|
89
|
+
post<T = any>(url: string, data?: any, reqOptions?: ReqOptions): Promise<ApiResult<T>>;
|
|
90
|
+
put<T = any>(url: string, data?: any, reqOptions?: ReqOptions): Promise<ApiResult<T>>;
|
|
91
|
+
delete<T = any>(url: string, params?: any, reqOptions?: ReqOptions): Promise<ApiResult<T>>;
|
|
92
|
+
}
|
|
93
|
+
type DeepPartialConfig = Record<string, any>;
|
|
94
|
+
/**
|
|
95
|
+
* 全局单例(脱离组件直接调用,PRD 5.1)
|
|
96
|
+
*
|
|
97
|
+
* 所有组件共享该实例;开发者也可直接手动调用,或 `new RequestAPI()` 自建独立实例。
|
|
98
|
+
*/
|
|
99
|
+
export declare const request: RequestAPI;
|
|
100
|
+
export default request;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 声明式联动注册中心(PRD 6.2)
|
|
3
|
+
*
|
|
4
|
+
* filter 分组机制:所有参与联动的组件有通用 prop `filter`(默认 '')。
|
|
5
|
+
* 联动只在 filter 相同的组件之间发生。
|
|
6
|
+
*
|
|
7
|
+
* DataGrid 挂载时按 filter 注册到注册中心;
|
|
8
|
+
* DataForm / ApiButton / Dialog / Drawer 等动作完成后,
|
|
9
|
+
* 调用 refreshDataGrid(headRefreshDatagrid, selfFilter) 刷新目标。
|
|
10
|
+
*/
|
|
11
|
+
export interface DataGridInstance {
|
|
12
|
+
/** 组件 filter 分组标识 */
|
|
13
|
+
filter: string;
|
|
14
|
+
/** 刷新当前页数据 */
|
|
15
|
+
refresh: () => any;
|
|
16
|
+
/** 带搜索参数查询(重置到第一页,合并搜索条件) */
|
|
17
|
+
search?: (params?: Record<string, any>) => any;
|
|
18
|
+
/** 清空搜索条件并刷新 */
|
|
19
|
+
resetSearch?: () => any;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* 注册 DataGrid 实例,返回注销函数(组件 onUnmounted 调用)
|
|
23
|
+
*/
|
|
24
|
+
export declare function registerDataGrid(instance: DataGridInstance): () => void;
|
|
25
|
+
/**
|
|
26
|
+
* 刷新目标 DataGrid
|
|
27
|
+
* @param headRefreshDatagrid true=刷同 filter 组;字符串=定向刷该 filter 组
|
|
28
|
+
* @param selfFilter 发起组件自身 filter
|
|
29
|
+
* @returns 被刷新的实例数量
|
|
30
|
+
*/
|
|
31
|
+
export declare function refreshDataGrid(headRefreshDatagrid: boolean | string | undefined, selfFilter?: string): number;
|
|
32
|
+
/**
|
|
33
|
+
* 获取某 filter 组的 DataGrid 实例(事件联动 / 自定义逻辑用)
|
|
34
|
+
*/
|
|
35
|
+
export declare function getDataGrids(filter?: string): DataGridInstance[];
|
|
36
|
+
/**
|
|
37
|
+
* SearchPanel 联动:带搜索参数刷新目标 DataGrid(重置到第一页)
|
|
38
|
+
* @param params 搜索表单值
|
|
39
|
+
*/
|
|
40
|
+
export declare function searchDataGrid(params: Record<string, any> | undefined, headRefreshDatagrid: boolean | string | undefined, selfFilter?: string): number;
|
|
41
|
+
/**
|
|
42
|
+
* SearchPanel 重置联动:清空目标 DataGrid 搜索条件并刷新
|
|
43
|
+
*/
|
|
44
|
+
export declare function resetSearchDataGrid(headRefreshDatagrid: boolean | string | undefined, selfFilter?: string): number;
|
|
45
|
+
/**
|
|
46
|
+
* 仅供测试 / 调试:清空注册中心
|
|
47
|
+
*/
|
|
48
|
+
export declare function clearLinkageRegistry(): void;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { SkinName } from '../../../types/config';
|
|
2
|
+
import type { SkinPreset } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* 预设皮肤库(接入全局配置能力)
|
|
5
|
+
* 每套皮肤一个文件(本目录下 <key>.ts),新增皮肤在此聚合注册
|
|
6
|
+
* 使用:app.use(WorkDesktop, { theme: { skin: 'tech' } })
|
|
7
|
+
* 或 setGlobalConfig({ theme: { skin: 'cyberpunk' } })
|
|
8
|
+
* 覆盖优先级:theme.cssVars > theme.colors > 皮肤预设
|
|
9
|
+
*/
|
|
10
|
+
export type { SkinPreset } from './types';
|
|
11
|
+
export declare const SKIN_PRESETS: Record<SkinName, SkinPreset>;
|
|
12
|
+
/** 查询皮肤预设;未传 key 或未知 key 返回 undefined(由调用方回退默认行为) */
|
|
13
|
+
export declare function getSkinPreset(key?: string): SkinPreset | undefined;
|
|
14
|
+
/** 列出全部预设皮肤(供设置面板 / 文档展示遍历) */
|
|
15
|
+
export declare function listSkins(): SkinPreset[];
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { SkinName, ThemeConfig } from '../../../types/config';
|
|
2
|
+
/** 预设皮肤结构:每套皮肤一个文件(skins/ 目录),由 skins/index.ts 聚合注册 */
|
|
3
|
+
export interface SkinPreset {
|
|
4
|
+
/** 皮肤唯一标识(theme.skin 取值) */
|
|
5
|
+
key: SkinName;
|
|
6
|
+
/** 中文名 */
|
|
7
|
+
label: string;
|
|
8
|
+
/** 风格描述 */
|
|
9
|
+
desc: string;
|
|
10
|
+
/** 皮肤携带的主题配置(colors/cssVars,结构与 ThemeConfig 一致) */
|
|
11
|
+
theme: ThemeConfig;
|
|
12
|
+
/**
|
|
13
|
+
* 皮肤专属 CSS 规则(可选):applyTheme 时原样追加在 :root 变量块之后。
|
|
14
|
+
* 用于 EP 变量做不到的 rule 级定制(如渐变背景、外发光);仅当 theme.skin
|
|
15
|
+
* 命中该预设时注入,切换皮肤随 styleEl 重建自动移除。规则内引用 var(--el-x/--wd-x)
|
|
16
|
+
* 可保持与用户 colors/cssVars 覆盖联动。
|
|
17
|
+
*/
|
|
18
|
+
cssRules?: string;
|
|
19
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WdStation 联动注册中心
|
|
3
|
+
*
|
|
4
|
+
* 复用 DataGrid linkage 的 filter 分组心智:
|
|
5
|
+
* - Station 挂载时按 filter 注册;
|
|
6
|
+
* - 业务代码调用 setStationFooter(target, info, selfFilter) 更新底部动态信息;
|
|
7
|
+
* - refreshStationView(target, selfFilter) 触发内容区强制刷新(重新挂载)。
|
|
8
|
+
*
|
|
9
|
+
* target:true = 与发起方同 filter 组;字符串 = 定向该 filter 组。
|
|
10
|
+
*/
|
|
11
|
+
export interface StationInstance {
|
|
12
|
+
/** 组件 filter 分组标识 */
|
|
13
|
+
filter: string;
|
|
14
|
+
/** 设置底部动态信息 */
|
|
15
|
+
setFooterInfo: (info: string) => void;
|
|
16
|
+
/** 刷新内容区(强制重挂载) */
|
|
17
|
+
refresh: () => void;
|
|
18
|
+
/** 当前激活菜单的路径链(分组标题 → 菜单 → 子菜单),供 WdPath 自动模式读取 */
|
|
19
|
+
getActiveMenuChain?: () => MenuChainItem[];
|
|
20
|
+
}
|
|
21
|
+
/** 菜单链节点(面包屑自动模式的菜单段) */
|
|
22
|
+
export interface MenuChainItem {
|
|
23
|
+
/** 标题 */
|
|
24
|
+
title: string;
|
|
25
|
+
/** 路由路径 */
|
|
26
|
+
path?: string;
|
|
27
|
+
/** 图标(ElementPlus 图标名字符串或组件) */
|
|
28
|
+
icon?: string | object;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* 注册 Station 实例,返回注销函数(组件 onUnmounted 调用)
|
|
32
|
+
*/
|
|
33
|
+
export declare function registerStation(instance: StationInstance): () => void;
|
|
34
|
+
/**
|
|
35
|
+
* 设置目标 Station 底部动态信息
|
|
36
|
+
* @param target true=同 filter 组;字符串=定向该 filter 组
|
|
37
|
+
* @param info 展示内容(文本)
|
|
38
|
+
* @param selfFilter 发起方自身 filter
|
|
39
|
+
* @returns 被更新的实例数量
|
|
40
|
+
*/
|
|
41
|
+
export declare function setStationFooter(target: boolean | string, info: string, selfFilter?: string): number;
|
|
42
|
+
/**
|
|
43
|
+
* 刷新目标 Station 内容区(强制重新挂载)
|
|
44
|
+
* @param target true=同 filter 组(默认);字符串=定向该 filter 组
|
|
45
|
+
* @param selfFilter 发起方自身 filter
|
|
46
|
+
* @returns 被刷新的实例数量
|
|
47
|
+
*/
|
|
48
|
+
export declare function refreshStationView(target?: boolean | string, selfFilter?: string): number;
|
|
49
|
+
/**
|
|
50
|
+
* 读取目标 Station 当前激活菜单的路径链(供 WdPath 自动模式使用)
|
|
51
|
+
* @param target true=同 filter 组;字符串=定向该 filter 组
|
|
52
|
+
* @param selfFilter 发起方自身 filter
|
|
53
|
+
* @returns 菜单链节点数组(无匹配实例时为空数组)
|
|
54
|
+
*/
|
|
55
|
+
export declare function getStationMenuChain(target: boolean | string | undefined, selfFilter?: string): MenuChainItem[];
|
|
56
|
+
/**
|
|
57
|
+
* 订阅某 filter 组的 Station 变化(菜单/分组切换),返回取消订阅函数
|
|
58
|
+
*/
|
|
59
|
+
export declare function subscribeStationChange(filter: string, cb: () => void): () => void;
|
|
60
|
+
/**
|
|
61
|
+
* 通知某 filter 组的订阅者:Station 的激活菜单/分组发生了变化
|
|
62
|
+
* (Station 内部在菜单选中、分组切换、路由反查、挂载时调用)
|
|
63
|
+
*/
|
|
64
|
+
export declare function notifyStationChange(filter: string): void;
|
|
65
|
+
/**
|
|
66
|
+
* 仅供测试 / 调试:清空路径组件订阅者
|
|
67
|
+
*/
|
|
68
|
+
export declare function clearPathListeners(): void;
|
|
69
|
+
/**
|
|
70
|
+
* 仅供测试 / 调试:清空注册中心
|
|
71
|
+
*/
|
|
72
|
+
export declare function clearStationRegistry(): void;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ThemeConfig } from '../../types/config';
|
|
2
|
+
/**
|
|
3
|
+
* 解析最终生效的主题:皮肤预设打底,用户 colors/cssVars 继续覆盖
|
|
4
|
+
* 优先级:cssVars > colors > 皮肤预设;未知皮肤告警并回退默认
|
|
5
|
+
*/
|
|
6
|
+
export declare function resolveTheme(theme?: ThemeConfig): ThemeConfig | undefined;
|
|
7
|
+
/**
|
|
8
|
+
* 将 theme 配置写入 :root CSS 变量(PRD 9.2 方式二)
|
|
9
|
+
* 输出顺序:colors 语义键 → 语义色 El 派生色阶 → cssVars 精细覆盖(后者覆盖前者)
|
|
10
|
+
*/
|
|
11
|
+
export declare function applyTheme(input?: ThemeConfig): void;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 通用工具函数
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* 判断是否为普通对象(用于 deep merge)
|
|
6
|
+
*/
|
|
7
|
+
export declare function isPlainObject(value: unknown): value is Record<string, any>;
|
|
8
|
+
/**
|
|
9
|
+
* deep merge:对象深合并;数组覆盖;基本类型后者覆盖前者
|
|
10
|
+
* 与 lodash.merge 语义一致:从左到右,后者优先级高
|
|
11
|
+
*/
|
|
12
|
+
export declare function deepMerge<T = any>(...sources: any[]): T;
|
|
13
|
+
/**
|
|
14
|
+
* 按路径取对象值,如 getValue(obj, 'a.b.c')
|
|
15
|
+
*/
|
|
16
|
+
export declare function getValueByPath(obj: any, path: string): any;
|
|
17
|
+
export declare function uniqueId(prefix?: string): string;
|
|
18
|
+
/**
|
|
19
|
+
* 安全 JSON parse(localStorage 用)
|
|
20
|
+
*/
|
|
21
|
+
export declare function safeJsonParse<T>(text: string | null, fallback: T): T;
|
|
22
|
+
/**
|
|
23
|
+
* 防抖
|
|
24
|
+
*/
|
|
25
|
+
export declare function debounce<F extends (...args: any[]) => any>(fn: F, wait?: number): {
|
|
26
|
+
(this: unknown, ...args: Parameters<F>): void;
|
|
27
|
+
cancel(): void;
|
|
28
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Vue 插件入口(PRD 8.2 双入口)
|
|
3
|
+
*
|
|
4
|
+
* npm:app.use(WorkDesktop, config)
|
|
5
|
+
* script:window.workDesktopConfig 配置 + window.WorkDesktop 自动安装
|
|
6
|
+
*/
|
|
7
|
+
import type { Plugin } from 'vue';
|
|
8
|
+
declare const install: Plugin['install'];
|
|
9
|
+
declare const WorkDesktop: Plugin;
|
|
10
|
+
export default WorkDesktop;
|
|
11
|
+
export { install };
|