workdesktop-ai 1.1.1 → 1.2.1

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.
Files changed (174) hide show
  1. package/CHANGELOG.md +43 -6
  2. package/README.md +26 -13
  3. package/dist/api-button/index.mjs +1 -1
  4. package/dist/auto-complete/index.mjs +1 -1
  5. package/dist/base.css +1 -1
  6. package/dist/checkbox-list/index.mjs +1 -1
  7. package/dist/chunks/{ApiButton.vue_vue_type_script_setup_true_lang-KKzJxwpV.mjs → ApiButton.vue_vue_type_script_setup_true_lang-3BjZSAPZ.mjs} +2 -2
  8. package/dist/chunks/{ApiButton.vue_vue_type_script_setup_true_lang-KKzJxwpV.mjs.map → ApiButton.vue_vue_type_script_setup_true_lang-3BjZSAPZ.mjs.map} +1 -1
  9. package/dist/chunks/{AutoComplete-CLV_PwcZ.mjs → AutoComplete-C6Nxatvt.mjs} +2 -2
  10. package/dist/chunks/{AutoComplete-CLV_PwcZ.mjs.map → AutoComplete-C6Nxatvt.mjs.map} +1 -1
  11. package/dist/chunks/{CheckboxList-Bx3Ce1q5.mjs → CheckboxList-5AEx33r5.mjs} +2 -2
  12. package/dist/chunks/{CheckboxList-Bx3Ce1q5.mjs.map → CheckboxList-5AEx33r5.mjs.map} +1 -1
  13. package/dist/chunks/{ConfirmButton.vue_vue_type_script_setup_true_lang-D4w6G2Kv.mjs → ConfirmButton.vue_vue_type_script_setup_true_lang-CXYH1Rlc.mjs} +2 -2
  14. package/dist/chunks/{ConfirmButton.vue_vue_type_script_setup_true_lang-D4w6G2Kv.mjs.map → ConfirmButton.vue_vue_type_script_setup_true_lang-CXYH1Rlc.mjs.map} +1 -1
  15. package/dist/chunks/{DataForm-C5MBVdei.mjs → DataForm-C6VLTSOm.mjs} +16 -16
  16. package/dist/chunks/{DataForm-C5MBVdei.mjs.map → DataForm-C6VLTSOm.mjs.map} +1 -1
  17. package/dist/chunks/{DataGrid-HUzKWuQx.mjs → DataGrid-Dd7n5JM7.mjs} +4 -4
  18. package/dist/chunks/{DataGrid-HUzKWuQx.mjs.map → DataGrid-Dd7n5JM7.mjs.map} +1 -1
  19. package/dist/chunks/{EditableGrid-C8A-nJZv.mjs → EditableGrid-CDeeVkaX.mjs} +330 -333
  20. package/dist/chunks/EditableGrid-CDeeVkaX.mjs.map +1 -0
  21. package/dist/chunks/{ImageUpload-DGehzaYa.mjs → ImageUpload-CQA9XQ7Q.mjs} +2 -2
  22. package/dist/chunks/{ImageUpload-DGehzaYa.mjs.map → ImageUpload-CQA9XQ7Q.mjs.map} +1 -1
  23. package/dist/chunks/{Panel-CrRqBTj6.mjs → Panel-BHqAeBaH.mjs} +8 -8
  24. package/dist/chunks/Panel-BHqAeBaH.mjs.map +1 -0
  25. package/dist/chunks/Path-C_oyo6Dg.mjs +200 -0
  26. package/dist/chunks/Path-C_oyo6Dg.mjs.map +1 -0
  27. package/dist/chunks/{PromptButton.vue_vue_type_script_setup_true_lang-Gck1QAHc.mjs → PromptButton.vue_vue_type_script_setup_true_lang-oYaMH-CI.mjs} +2 -2
  28. package/dist/chunks/{PromptButton.vue_vue_type_script_setup_true_lang-Gck1QAHc.mjs.map → PromptButton.vue_vue_type_script_setup_true_lang-oYaMH-CI.mjs.map} +1 -1
  29. package/dist/chunks/{RadioList-vE8JOuST.mjs → RadioList-BUWcP_Pk.mjs} +2 -2
  30. package/dist/chunks/{RadioList-vE8JOuST.mjs.map → RadioList-BUWcP_Pk.mjs.map} +1 -1
  31. package/dist/chunks/{Requester.vue_vue_type_script_setup_true_lang-B8TwXbYR.mjs → Requester.vue_vue_type_script_setup_true_lang-DkLqAjug.mjs} +2 -2
  32. package/dist/chunks/{Requester.vue_vue_type_script_setup_true_lang-B8TwXbYR.mjs.map → Requester.vue_vue_type_script_setup_true_lang-DkLqAjug.mjs.map} +1 -1
  33. package/dist/chunks/{SearchPanel-xQ1hPaNq.mjs → SearchPanel-DPlWWuXb.mjs} +2 -2
  34. package/dist/chunks/{SearchPanel-xQ1hPaNq.mjs.map → SearchPanel-DPlWWuXb.mjs.map} +1 -1
  35. package/dist/chunks/{Select-DAGZDXvI.mjs → Select-uvFy7_NU.mjs} +2 -2
  36. package/dist/chunks/{Select-DAGZDXvI.mjs.map → Select-uvFy7_NU.mjs.map} +1 -1
  37. package/dist/chunks/Station-DLV19USa.mjs +780 -0
  38. package/dist/chunks/Station-DLV19USa.mjs.map +1 -0
  39. package/dist/chunks/{Switch.vue_vue_type_script_setup_true_lang-CulPqp7M.mjs → Switch.vue_vue_type_script_setup_true_lang-DUhXAGs2.mjs} +2 -2
  40. package/dist/chunks/{Switch.vue_vue_type_script_setup_true_lang-CulPqp7M.mjs.map → Switch.vue_vue_type_script_setup_true_lang-DUhXAGs2.mjs.map} +1 -1
  41. package/dist/chunks/{Upload.vue_vue_type_script_setup_true_lang-D07Bhllc.mjs → Upload.vue_vue_type_script_setup_true_lang-CHGCjpKK.mjs} +2 -2
  42. package/dist/chunks/{Upload.vue_vue_type_script_setup_true_lang-D07Bhllc.mjs.map → Upload.vue_vue_type_script_setup_true_lang-CHGCjpKK.mjs.map} +1 -1
  43. package/dist/chunks/{Viewer-iub6TjoD.mjs → Viewer-CjLSQTrw.mjs} +2 -2
  44. package/dist/chunks/{Viewer-iub6TjoD.mjs.map → Viewer-CjLSQTrw.mjs.map} +1 -1
  45. package/dist/chunks/http-C06mNpwY.mjs +4141 -0
  46. package/dist/chunks/http-C06mNpwY.mjs.map +1 -0
  47. package/dist/chunks/station-linkage-D54-_iyL.mjs +77 -0
  48. package/dist/chunks/station-linkage-D54-_iyL.mjs.map +1 -0
  49. package/dist/chunks/{useApiAction-6_vvf5Fd.mjs → useApiAction-DxVQWWxv.mjs} +2 -2
  50. package/dist/chunks/{useApiAction-6_vvf5Fd.mjs.map → useApiAction-DxVQWWxv.mjs.map} +1 -1
  51. package/dist/chunks/{useColumnSettings-BYDQdk4o.mjs → useColumnSettings-BwG2V9xp.mjs} +2 -2
  52. package/dist/chunks/{useColumnSettings-BYDQdk4o.mjs.map → useColumnSettings-BwG2V9xp.mjs.map} +1 -1
  53. package/dist/chunks/{useOptionsLoader-Bi8oqNbG.mjs → useOptionsLoader-DEVCYhrp.mjs} +2 -2
  54. package/dist/chunks/{useOptionsLoader-Bi8oqNbG.mjs.map → useOptionsLoader-DEVCYhrp.mjs.map} +1 -1
  55. package/dist/confirm-button/index.mjs +1 -1
  56. package/dist/data-form/index.mjs +1 -1
  57. package/dist/data-form/style.css +1 -1
  58. package/dist/data-grid/index.mjs +1 -1
  59. package/dist/data-grid/style.css +1 -1
  60. package/dist/editable-grid/index.mjs +1 -1
  61. package/dist/editable-grid/style.css +1 -1
  62. package/dist/image-upload/index.mjs +1 -1
  63. package/dist/index.esm.js +133 -124
  64. package/dist/index.esm.js.map +1 -1
  65. package/dist/index.umd.js +705 -15
  66. package/dist/index.umd.js.map +1 -1
  67. package/dist/panel/index.mjs +1 -1
  68. package/dist/panel/style.css +1 -1
  69. package/dist/path/index.mjs +7 -0
  70. package/dist/path/index.mjs.map +1 -0
  71. package/dist/path/style.css +1 -0
  72. package/dist/prompt-button/index.mjs +1 -1
  73. package/dist/radio-list/index.mjs +1 -1
  74. package/dist/requester/index.mjs +1 -1
  75. package/dist/search-panel/index.mjs +1 -1
  76. package/dist/search-panel/style.css +1 -1
  77. package/dist/select/index.mjs +1 -1
  78. package/dist/station/index.mjs +1 -1
  79. package/dist/station/style.css +1 -1
  80. package/dist/style.css +1 -1
  81. package/dist/switch/index.mjs +1 -1
  82. package/dist/upload/index.mjs +1 -1
  83. package/dist/viewer/index.mjs +1 -1
  84. package/llms.txt +99 -9
  85. package/package.json +6 -1
  86. package/dist/chunks/EditableGrid-C8A-nJZv.mjs.map +0 -1
  87. package/dist/chunks/Panel-CrRqBTj6.mjs.map +0 -1
  88. package/dist/chunks/Station-BF_QlQ8c.mjs +0 -796
  89. package/dist/chunks/Station-BF_QlQ8c.mjs.map +0 -1
  90. package/dist/chunks/http-Bs-dM076.mjs +0 -2951
  91. package/dist/chunks/http-Bs-dM076.mjs.map +0 -1
  92. package/dist/types/src/components/buttons/ApiButton.vue.d.ts +0 -134
  93. package/dist/types/src/components/buttons/ConfirmButton.vue.d.ts +0 -169
  94. package/dist/types/src/components/buttons/DialogButton.vue.d.ts +0 -167
  95. package/dist/types/src/components/buttons/DrawerButton.vue.d.ts +0 -186
  96. package/dist/types/src/components/buttons/PopconfirmButton.vue.d.ts +0 -317
  97. package/dist/types/src/components/buttons/PromptButton.vue.d.ts +0 -180
  98. package/dist/types/src/components/buttons/RouteButton.vue.d.ts +0 -122
  99. package/dist/types/src/components/buttons/TipsButton.vue.d.ts +0 -66
  100. package/dist/types/src/components/buttons/useApiAction.d.ts +0 -20
  101. package/dist/types/src/components/common/props.d.ts +0 -122
  102. package/dist/types/src/components/containers/Drawer.vue.d.ts +0 -172
  103. package/dist/types/src/components/containers/Iframe.vue.d.ts +0 -81
  104. package/dist/types/src/components/containers/containerContext.d.ts +0 -15
  105. package/dist/types/src/components/containers/useContainerController.d.ts +0 -24
  106. package/dist/types/src/components/containers/useIframeContainer.d.ts +0 -20
  107. package/dist/types/src/components/core/Requester.vue.d.ts +0 -41
  108. package/dist/types/src/components/data/datagrid/DataGrid.vue.d.ts +0 -542
  109. package/dist/types/src/components/data/datagrid/useColumnSettings.d.ts +0 -62
  110. package/dist/types/src/components/data/editable-grid/EditableGrid.vue.d.ts +0 -586
  111. package/dist/types/src/components/data/viewer/Viewer.vue.d.ts +0 -187
  112. package/dist/types/src/components/form/FormItem.vue.d.ts +0 -62
  113. package/dist/types/src/components/form/SearchItem.vue.d.ts +0 -62
  114. package/dist/types/src/components/form/SearchPanel.vue.d.ts +0 -167
  115. package/dist/types/src/components/form/data-form/DataForm.vue.d.ts +0 -311
  116. package/dist/types/src/components/index.d.ts +0 -31
  117. package/dist/types/src/components/inputs/AutoComplete.vue.d.ts +0 -166
  118. package/dist/types/src/components/inputs/CheckboxList.vue.d.ts +0 -166
  119. package/dist/types/src/components/inputs/RadioList.vue.d.ts +0 -166
  120. package/dist/types/src/components/inputs/Select.vue.d.ts +0 -176
  121. package/dist/types/src/components/inputs/Switch.vue.d.ts +0 -116
  122. package/dist/types/src/components/inputs/useOptionsLoader.d.ts +0 -32
  123. package/dist/types/src/components/layout/Station.vue.d.ts +0 -302
  124. package/dist/types/src/components/layout/StationMenuNode.vue.d.ts +0 -20
  125. package/dist/types/src/components/layout/types.d.ts +0 -54
  126. package/dist/types/src/components/styles/Panel.vue.d.ts +0 -94
  127. package/dist/types/src/components/styles/Tips.vue.d.ts +0 -60
  128. package/dist/types/src/components/upload/ImageUpload.vue.d.ts +0 -176
  129. package/dist/types/src/components/upload/Upload.vue.d.ts +0 -235
  130. package/dist/types/src/entries/api-button.d.ts +0 -9
  131. package/dist/types/src/entries/auto-complete.d.ts +0 -9
  132. package/dist/types/src/entries/checkbox-list.d.ts +0 -9
  133. package/dist/types/src/entries/components-map.d.ts +0 -8
  134. package/dist/types/src/entries/confirm-button.d.ts +0 -9
  135. package/dist/types/src/entries/data-form.d.ts +0 -9
  136. package/dist/types/src/entries/data-grid.d.ts +0 -9
  137. package/dist/types/src/entries/dialog-button.d.ts +0 -9
  138. package/dist/types/src/entries/drawer-button.d.ts +0 -9
  139. package/dist/types/src/entries/drawer.d.ts +0 -9
  140. package/dist/types/src/entries/editable-grid.d.ts +0 -9
  141. package/dist/types/src/entries/form-item.d.ts +0 -9
  142. package/dist/types/src/entries/iframe.d.ts +0 -9
  143. package/dist/types/src/entries/image-upload.d.ts +0 -9
  144. package/dist/types/src/entries/panel.d.ts +0 -9
  145. package/dist/types/src/entries/prompt-button.d.ts +0 -9
  146. package/dist/types/src/entries/radio-list.d.ts +0 -9
  147. package/dist/types/src/entries/requester.d.ts +0 -9
  148. package/dist/types/src/entries/route-button.d.ts +0 -9
  149. package/dist/types/src/entries/search-item.d.ts +0 -9
  150. package/dist/types/src/entries/search-panel.d.ts +0 -9
  151. package/dist/types/src/entries/select.d.ts +0 -9
  152. package/dist/types/src/entries/station.d.ts +0 -9
  153. package/dist/types/src/entries/switch.d.ts +0 -9
  154. package/dist/types/src/entries/tips-button.d.ts +0 -9
  155. package/dist/types/src/entries/tips.d.ts +0 -9
  156. package/dist/types/src/entries/upload.d.ts +0 -9
  157. package/dist/types/src/entries/viewer.d.ts +0 -9
  158. package/dist/types/src/index.d.ts +0 -21
  159. package/dist/types/src/lib/composables/useConfig.d.ts +0 -19
  160. package/dist/types/src/lib/composables/useDataGrid.d.ts +0 -69
  161. package/dist/types/src/lib/composables/useEventBus.d.ts +0 -16
  162. package/dist/types/src/lib/composables/useGlobalState.d.ts +0 -5
  163. package/dist/types/src/lib/composables/useRequest.d.ts +0 -42
  164. package/dist/types/src/lib/configs/default-config.d.ts +0 -6
  165. package/dist/types/src/lib/core/config.d.ts +0 -28
  166. package/dist/types/src/lib/core/http.d.ts +0 -100
  167. package/dist/types/src/lib/core/linkage.d.ts +0 -48
  168. package/dist/types/src/lib/core/station-linkage.d.ts +0 -41
  169. package/dist/types/src/lib/core/theme.d.ts +0 -6
  170. package/dist/types/src/lib/core/utils.d.ts +0 -28
  171. package/dist/types/src/lib/install.d.ts +0 -11
  172. package/dist/types/src/types/config.d.ts +0 -126
  173. package/dist/types/src/types/index.d.ts +0 -4
  174. package/dist/types/vite.config.d.ts +0 -7
@@ -1,9 +0,0 @@
1
- /**
2
- * WdTips 单独入口
3
- * 用法:import WdTips from 'workdesktop-ai/tips'
4
- * import 'workdesktop-ai/tips/style.css'
5
- */
6
- import '../styles/index.css';
7
- import WdTips from '../components/styles/Tips.vue';
8
- export { WdTips };
9
- export default WdTips;
@@ -1,9 +0,0 @@
1
- /**
2
- * WdUpload 单独入口
3
- * 用法:import WdUpload from 'workdesktop-ai/upload'
4
- * import 'workdesktop-ai/upload/style.css'
5
- */
6
- import '../styles/index.css';
7
- import WdUpload from '../components/upload/Upload.vue';
8
- export { WdUpload };
9
- export default WdUpload;
@@ -1,9 +0,0 @@
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;
@@ -1,21 +0,0 @@
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 { RequestAPI, request, default as http } from './lib/core/http';
12
- export type { ApiResult, ApiEventPayload, ApiEventType, ApiEventHandler } from './lib/core/http';
13
- export { registerDataGrid, refreshDataGrid, searchDataGrid, resetSearchDataGrid, getDataGrids, clearLinkageRegistry } from './lib/core/linkage';
14
- export { registerStation, setStationFooter, refreshStationView } from './lib/core/station-linkage';
15
- export { useRequest } from './lib/composables/useRequest';
16
- export { useDataGrid } from './lib/composables/useDataGrid';
17
- export { useConfig, useGlobalConfig } from './lib/composables/useConfig';
18
- export { useEventBus } from './lib/composables/useEventBus';
19
- export { useGlobalState } from './lib/composables/useGlobalState';
20
- export { deepMerge } from './lib/core/utils';
21
- export type * from './types';
@@ -1,19 +0,0 @@
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;
@@ -1,69 +0,0 @@
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>;
@@ -1,16 +0,0 @@
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 {};
@@ -1,5 +0,0 @@
1
- export declare function useGlobalState<T extends object = Record<string, any>>(key: string, initial?: T): {
2
- state: T;
3
- set: (partial: Partial<T> | ((prev: T) => Partial<T>)) => void;
4
- reset: () => void;
5
- };
@@ -1,42 +0,0 @@
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;
@@ -1,6 +0,0 @@
1
- import type { WorkDesktopConfig } from '../../types/config';
2
- /**
3
- * 默认配置层(库内置,不可改)
4
- * PRD 5.2 / 第 7 章
5
- */
6
- export declare const defaultConfig: WorkDesktopConfig;
@@ -1,28 +0,0 @@
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;
@@ -1,100 +0,0 @@
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;
@@ -1,48 +0,0 @@
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;
@@ -1,41 +0,0 @@
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
- }
19
- /**
20
- * 注册 Station 实例,返回注销函数(组件 onUnmounted 调用)
21
- */
22
- export declare function registerStation(instance: StationInstance): () => void;
23
- /**
24
- * 设置目标 Station 底部动态信息
25
- * @param target true=同 filter 组;字符串=定向该 filter 组
26
- * @param info 展示内容(文本)
27
- * @param selfFilter 发起方自身 filter
28
- * @returns 被更新的实例数量
29
- */
30
- export declare function setStationFooter(target: boolean | string, info: string, selfFilter?: string): number;
31
- /**
32
- * 刷新目标 Station 内容区(强制重新挂载)
33
- * @param target true=同 filter 组(默认);字符串=定向该 filter 组
34
- * @param selfFilter 发起方自身 filter
35
- * @returns 被刷新的实例数量
36
- */
37
- export declare function refreshStationView(target?: boolean | string, selfFilter?: string): number;
38
- /**
39
- * 仅供测试 / 调试:清空注册中心
40
- */
41
- export declare function clearStationRegistry(): void;
@@ -1,6 +0,0 @@
1
- import type { ThemeConfig } from '../../types/config';
2
- /**
3
- * 将 theme 配置写入 :root CSS 变量(PRD 9.2 方式二)
4
- * colors 展开优先级低于 cssVars(cssVars 可直接覆盖 colors 生成的变量)
5
- */
6
- export declare function applyTheme(theme?: ThemeConfig): void;
@@ -1,28 +0,0 @@
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
- };
@@ -1,11 +0,0 @@
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 };
@@ -1,126 +0,0 @@
1
- /**
2
- * WorkDesktop 全局配置类型(PRD 5.2)
3
- */
4
- export type DeepPartial<T> = {
5
- [P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : T[P];
6
- };
7
- export interface RequestLoadingConfig {
8
- enable: boolean;
9
- props?: Record<string, any>;
10
- }
11
- export interface PageParamConfig {
12
- /** 当前页字段名,默认 'currentPage' */
13
- pageField: string;
14
- /** 每页条数字段名,默认 'pageSize' */
15
- sizeField: string;
16
- /** 搜索条件外层字段名,默认 'param' */
17
- searchField: string;
18
- }
19
- export interface TransformConfig {
20
- /** 请求拦截器(加 token 等),返回处理后的 axios config */
21
- requestInterceptor?: (config: any) => any;
22
- /** 响应拦截器 */
23
- responseInterceptor?: (response: any) => any;
24
- }
25
- export interface RequestConfig {
26
- /** 接口地址前缀 */
27
- urlPrefix: string;
28
- /** 网络异常是否抛出 */
29
- throwException: boolean;
30
- /** 并发相同请求合并去重(method+url+params 一致只发一次),默认 true;reqOptions.dedup 可单次覆盖 */
31
- dedup: boolean;
32
- loading: RequestLoadingConfig;
33
- /** 透传给 axios 的配置(headers、timeout、withCredentials 等) */
34
- axiosConfig: Record<string, any>;
35
- pageParam: PageParamConfig;
36
- transform: TransformConfig;
37
- }
38
- export interface ResponsePropsConfig {
39
- codeName: string;
40
- messageName: string;
41
- dataName: string;
42
- }
43
- export interface ResponseListConfig {
44
- listName: string;
45
- totalName: string;
46
- pageSizeName: string;
47
- currentPageName: string;
48
- }
49
- export interface TipsConfig {
50
- /** 提示呈现方式:
51
- * - 'message':轻量消息提示(ElMessage)
52
- * - 'notify':右上角通知(ElNotification)
53
- * - 'messagebox':模态弹框(ElMessageBox.alert),需用户手动确认
54
- * - 'none':不提示
55
- */
56
- tipsMode: 'message' | 'notify' | 'messagebox' | 'none';
57
- /** 提示语义类型:success/warning/error/info */
58
- tipsType: 'success' | 'warning' | 'error' | 'info';
59
- /** 是否显示提示 */
60
- showTips?: boolean;
61
- /** 弹框标题(仅 messagebox 模式有效) */
62
- title?: string;
63
- /** 透传给对应组件的属性(ElMessage / ElNotification / ElMessageBox) */
64
- props?: Record<string, any>;
65
- }
66
- export interface ResponseConfig {
67
- props: ResponsePropsConfig;
68
- /** code >= successCode 视为成功(负数为失败) */
69
- successCode: number;
70
- list: ResponseListConfig;
71
- success: TipsConfig;
72
- fail: TipsConfig;
73
- exception: TipsConfig;
74
- complete: {
75
- tipsType: string;
76
- };
77
- }
78
- export interface PagerConfig {
79
- size: number;
80
- pageSizes: number[];
81
- pageSize: number;
82
- layout: string;
83
- hideOnSinglePage: boolean;
84
- /** 分页在底栏的水平位置:left/center/right,默认 right */
85
- position: 'left' | 'center' | 'right';
86
- }
87
- export interface PageConfig {
88
- /** 全局尺寸:large/default/small */
89
- global: {
90
- size: string;
91
- };
92
- /** 按组件类型的默认配置,key 为组件 PascalName,如 WdDataGrid */
93
- componentDefault: Record<string, any>;
94
- pager: PagerConfig;
95
- }
96
- export interface ThemeConfig {
97
- /** 语义令牌覆盖(primary/success/warning/danger/info) */
98
- colors?: Record<string, string>;
99
- /** CSS 变量覆盖(--wd-* / --el-*),优先级高于 colors */
100
- cssVars?: Record<string, string>;
101
- }
102
- export interface WorkDesktopConfig {
103
- /** 库版本号,界面上显示的版本号统一从这里读取(与 package.json version 保持一致) */
104
- version: string;
105
- page: PageConfig;
106
- request: RequestConfig;
107
- response: ResponseConfig;
108
- theme: ThemeConfig;
109
- }
110
- /** 请求级覆盖项(PRD 5.1 reqOptions) */
111
- export interface ReqOptions {
112
- /** 是否显示 loading */
113
- showLoading?: boolean;
114
- /** 是否显示提示 */
115
- showTips?: boolean;
116
- /** 提示配置覆盖 */
117
- tipsConfig?: Partial<Record<'success' | 'fail' | 'exception', TipsConfig>>;
118
- /** 透传给 axios 的单次配置 */
119
- axiosConfig?: Record<string, any>;
120
- /** AbortSignal,用于中断 */
121
- signal?: AbortSignal;
122
- /** 单次请求是否参与去重(默认取全局 request.dedup) */
123
- dedup?: boolean;
124
- /** 是否列表请求(影响封包分页参数与解封列表结构),由调用方组件控制,http 不强制 */
125
- [key: string]: any;
126
- }
@@ -1,4 +0,0 @@
1
- /**
2
- * 类型汇总导出
3
- */
4
- export type * from './config';
@@ -1,7 +0,0 @@
1
- /**
2
- * 双产物构建:
3
- * - vite build → ESM 多入口(主入口 + 27 个子入口,支持按需加载 + tree-shaking)
4
- * - vite build --mode umd → UMD 单入口(script 标签全量引入)
5
- */
6
- declare const _default: import("vite").UserConfigFnObject;
7
- export default _default;