@hbdlzy/ui-core 0.1.7 → 0.1.8

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 (67) hide show
  1. package/README.md +30 -2
  2. package/components.manifest.json +15 -1
  3. package/dist/index.cjs +5 -5
  4. package/dist/index.d.ts +50 -13
  5. package/dist/index.js +229 -17
  6. package/dist/ripple/index.cjs +42 -0
  7. package/dist/ripple/index.d.ts +8 -1
  8. package/dist/ripple/index.js +171 -0
  9. package/dist/style.css +1 -1
  10. package/package.json +17 -2
  11. package/src/components/BaseCard/BaseCard.types.d.ts +36 -0
  12. package/src/components/BaseCard/BaseCard.vue.d.ts +122 -0
  13. package/src/components/BaseCard/README.md +33 -0
  14. package/src/components/BaseCard/index.d.ts +3 -0
  15. package/src/components/BaseEChart/BaseEChart.types.d.ts +26 -0
  16. package/src/components/BaseEChart/BaseEChart.vue.d.ts +66 -0
  17. package/src/components/BaseEChart/README.md +33 -0
  18. package/src/components/BaseEChart/index.d.ts +3 -0
  19. package/src/components/BaseExportButton/BaseExportButton.types.d.ts +21 -0
  20. package/src/components/BaseExportButton/BaseExportButton.utils.d.ts +4 -0
  21. package/src/components/BaseExportButton/BaseExportButton.vue.d.ts +128 -0
  22. package/src/components/BaseExportButton/README.md +34 -0
  23. package/src/components/BaseExportButton/index.d.ts +5 -0
  24. package/src/components/BaseTable/BaseTable.types.d.ts +178 -0
  25. package/src/components/BaseTable/BaseTable.vue +16 -13
  26. package/src/components/BaseTable/BaseTable.vue.d.ts +157 -0
  27. package/src/components/BaseTable/README.md +45 -0
  28. package/src/components/BaseTable/index.d.ts +3 -0
  29. package/src/components/OutlinedCascader/OutlinedCascader.types.d.ts +28 -0
  30. package/src/components/OutlinedCascader/OutlinedCascader.vue.d.ts +94 -0
  31. package/src/components/OutlinedCascader/README.md +34 -0
  32. package/src/components/OutlinedCascader/index.d.ts +3 -0
  33. package/src/components/OutlinedDatePicker/OutlinedDatePicker.types.d.ts +30 -0
  34. package/src/components/OutlinedDatePicker/OutlinedDatePicker.vue.d.ts +97 -0
  35. package/src/components/OutlinedDatePicker/README.md +34 -0
  36. package/src/components/OutlinedDatePicker/index.d.ts +3 -0
  37. package/src/components/OutlinedDateTimePicker/OutlinedDateTimePicker.types.d.ts +29 -0
  38. package/src/components/OutlinedDateTimePicker/OutlinedDateTimePicker.vue.d.ts +106 -0
  39. package/src/components/OutlinedDateTimePicker/README.md +33 -0
  40. package/src/components/OutlinedDateTimePicker/index.d.ts +3 -0
  41. package/src/components/OutlinedInput/OutlinedInput.types.d.ts +32 -0
  42. package/src/components/OutlinedInput/OutlinedInput.vue.d.ts +106 -0
  43. package/src/components/OutlinedInput/README.md +34 -0
  44. package/src/components/OutlinedInput/index.d.ts +3 -0
  45. package/src/components/OutlinedSelect/OutlinedSelect.types.d.ts +41 -0
  46. package/src/components/OutlinedSelect/OutlinedSelect.vue.d.ts +125 -0
  47. package/src/components/OutlinedSelect/README.md +34 -0
  48. package/src/components/OutlinedSelect/index.d.ts +3 -0
  49. package/src/components/OutlinedTimePicker/OutlinedTimePicker.types.d.ts +31 -0
  50. package/src/components/OutlinedTimePicker/OutlinedTimePicker.vue.d.ts +103 -0
  51. package/src/components/OutlinedTimePicker/README.md +33 -0
  52. package/src/components/OutlinedTimePicker/index.d.ts +3 -0
  53. package/src/components/OutlinedTreeSelect/OutlinedTreeSelect.types.d.ts +49 -0
  54. package/src/components/OutlinedTreeSelect/OutlinedTreeSelect.vue.d.ts +146 -0
  55. package/src/components/OutlinedTreeSelect/README.md +34 -0
  56. package/src/components/OutlinedTreeSelect/index.d.ts +3 -0
  57. package/src/components/SvgIcon/README.md +33 -0
  58. package/src/components/SvgIcon/SvgIcon.types.d.ts +6 -0
  59. package/src/components/SvgIcon/SvgIcon.vue.d.ts +32 -0
  60. package/src/components/SvgIcon/index.d.ts +3 -0
  61. package/src/echarts/index.d.ts +9 -0
  62. package/src/excel/exportExcel.d.ts +18 -0
  63. package/src/index.d.ts +30 -0
  64. package/src/index.ts +78 -13
  65. package/src/ripple/README.md +160 -0
  66. package/src/ripple/index.d.ts +9 -0
  67. package/src/ripple/index.ts +15 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hbdlzy/ui-core",
3
- "version": "0.1.7",
3
+ "version": "0.1.8",
4
4
  "description": "Company shared Vue UI core package.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -17,8 +17,23 @@
17
17
  "require": "./dist/index.cjs",
18
18
  "types": "./dist/index.d.ts"
19
19
  },
20
+ "./ripple": {
21
+ "import": "./dist/ripple/index.js",
22
+ "require": "./dist/ripple/index.cjs",
23
+ "types": "./dist/ripple/index.d.ts"
24
+ },
20
25
  "./components.manifest.json": "./components.manifest.json"
21
26
  },
27
+ "typesVersions": {
28
+ "*": {
29
+ "ripple": [
30
+ "dist/ripple/index.d.ts"
31
+ ],
32
+ "components.manifest.json": [
33
+ "components.manifest.json"
34
+ ]
35
+ }
36
+ },
22
37
  "files": [
23
38
  "dist",
24
39
  "src",
@@ -48,7 +63,7 @@
48
63
  "registry": "https://registry.npmjs.org/"
49
64
  },
50
65
  "scripts": {
51
- "build": "vite build && pnpm run build:types",
66
+ "build": "vite build && vite build --config vite.ripple.config.ts && pnpm run build:types",
52
67
  "build:types": "vue-tsc -p tsconfig.build.json --declaration --emitDeclarationOnly"
53
68
  }
54
69
  }
@@ -0,0 +1,36 @@
1
+ export type BaseCardCssValue = string | number;
2
+ export interface BaseCardDefaultExportPayload {
3
+ title?: string;
4
+ metaText?: string;
5
+ }
6
+ export interface BaseCardProps {
7
+ title?: string;
8
+ metaText?: string;
9
+ showHeader?: boolean;
10
+ showRight?: boolean;
11
+ showTitleMarker?: boolean;
12
+ showExport?: boolean;
13
+ exportText?: string;
14
+ exportDisabled?: boolean;
15
+ exportPayload?: unknown;
16
+ padding?: BaseCardCssValue;
17
+ radius?: BaseCardCssValue;
18
+ borderColor?: string;
19
+ backgroundColor?: string;
20
+ shadowColor?: string;
21
+ headerGap?: BaseCardCssValue;
22
+ headerMarginBottom?: BaseCardCssValue;
23
+ leftGap?: BaseCardCssValue;
24
+ rightGap?: BaseCardCssValue;
25
+ titleColor?: string;
26
+ titleSize?: BaseCardCssValue;
27
+ titleWeight?: string | number;
28
+ markerColor?: string;
29
+ markerWidth?: BaseCardCssValue;
30
+ markerHeight?: BaseCardCssValue;
31
+ markerRadius?: BaseCardCssValue;
32
+ markerGap?: BaseCardCssValue;
33
+ metaColor?: string;
34
+ metaSize?: BaseCardCssValue;
35
+ exportColor?: string;
36
+ }
@@ -0,0 +1,122 @@
1
+ import type { BaseCardCssValue, BaseCardProps } from './BaseCard.types';
2
+ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<BaseCardProps>, {
3
+ title: string;
4
+ metaText: string;
5
+ showHeader: boolean;
6
+ showRight: boolean;
7
+ showTitleMarker: boolean;
8
+ showExport: boolean;
9
+ exportText: string;
10
+ exportDisabled: boolean;
11
+ padding: number;
12
+ radius: number;
13
+ borderColor: string;
14
+ backgroundColor: string;
15
+ shadowColor: string;
16
+ headerGap: number;
17
+ headerMarginBottom: number;
18
+ leftGap: number;
19
+ rightGap: number;
20
+ titleColor: string;
21
+ titleSize: number;
22
+ titleWeight: number;
23
+ markerColor: string;
24
+ markerWidth: number;
25
+ markerHeight: number;
26
+ markerRadius: string;
27
+ markerGap: number;
28
+ metaColor: string;
29
+ metaSize: number;
30
+ exportColor: string;
31
+ }>>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
32
+ export: (payload?: unknown) => void;
33
+ }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<BaseCardProps>, {
34
+ title: string;
35
+ metaText: string;
36
+ showHeader: boolean;
37
+ showRight: boolean;
38
+ showTitleMarker: boolean;
39
+ showExport: boolean;
40
+ exportText: string;
41
+ exportDisabled: boolean;
42
+ padding: number;
43
+ radius: number;
44
+ borderColor: string;
45
+ backgroundColor: string;
46
+ shadowColor: string;
47
+ headerGap: number;
48
+ headerMarginBottom: number;
49
+ leftGap: number;
50
+ rightGap: number;
51
+ titleColor: string;
52
+ titleSize: number;
53
+ titleWeight: number;
54
+ markerColor: string;
55
+ markerWidth: number;
56
+ markerHeight: number;
57
+ markerRadius: string;
58
+ markerGap: number;
59
+ metaColor: string;
60
+ metaSize: number;
61
+ exportColor: string;
62
+ }>>> & Readonly<{
63
+ onExport?: ((payload?: unknown) => any) | undefined;
64
+ }>, {
65
+ title: string;
66
+ metaText: string;
67
+ showHeader: boolean;
68
+ showRight: boolean;
69
+ showTitleMarker: boolean;
70
+ showExport: boolean;
71
+ exportText: string;
72
+ exportDisabled: boolean;
73
+ padding: BaseCardCssValue;
74
+ radius: BaseCardCssValue;
75
+ borderColor: string;
76
+ backgroundColor: string;
77
+ shadowColor: string;
78
+ headerGap: BaseCardCssValue;
79
+ headerMarginBottom: BaseCardCssValue;
80
+ leftGap: BaseCardCssValue;
81
+ rightGap: BaseCardCssValue;
82
+ titleColor: string;
83
+ titleSize: BaseCardCssValue;
84
+ titleWeight: string | number;
85
+ markerColor: string;
86
+ markerWidth: BaseCardCssValue;
87
+ markerHeight: BaseCardCssValue;
88
+ markerRadius: BaseCardCssValue;
89
+ markerGap: BaseCardCssValue;
90
+ metaColor: string;
91
+ metaSize: BaseCardCssValue;
92
+ exportColor: string;
93
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>, {
94
+ "title-label"?(_: {}): any;
95
+ title?(_: {}): any;
96
+ "header-right"?(_: {}): any;
97
+ tip?(_: {}): any;
98
+ default?(_: {}): any;
99
+ }>;
100
+ export default _default;
101
+ type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
102
+ type __VLS_TypePropsToRuntimeProps<T> = {
103
+ [K in keyof T]-?: {} extends Pick<T, K> ? {
104
+ type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
105
+ } : {
106
+ type: import('vue').PropType<T[K]>;
107
+ required: true;
108
+ };
109
+ };
110
+ type __VLS_WithDefaults<P, D> = {
111
+ [K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
112
+ default: D[K];
113
+ }> : P[K];
114
+ };
115
+ type __VLS_Prettify<T> = {
116
+ [K in keyof T]: T[K];
117
+ } & {};
118
+ type __VLS_WithTemplateSlots<T, S> = T & {
119
+ new (): {
120
+ $slots: S;
121
+ };
122
+ };
@@ -162,3 +162,36 @@ const handleExport = (payload?: unknown) => {
162
162
  - 只要不是强业务容器,就尽量不要在页面层重复写卡片壳子
163
163
  - 简单场景直接用 `title + 默认插槽`
164
164
  - 需要扩展时优先使用 `title` 和 `header-right` 插槽,而不是复制组件结构
165
+
166
+ ## AI 使用指引
167
+
168
+ AI 在生成页面时,如果遇到统计块、图表块、列表块、详情块等需要统一外壳的区域,应优先使用 `BaseCard`,不要在页面里重新手写卡片标题、左侧竖杠、右侧时间和导出区域。
169
+
170
+ 推荐优先从统一入口导入:
171
+
172
+ ```ts
173
+ import { BaseCard } from '@hbdlzy/ui'
174
+ ```
175
+
176
+ 如果当前只安装了核心包,也可以从 `@hbdlzy/ui-core` 导入。
177
+
178
+ AI 生成代码时按下面顺序判断:
179
+
180
+ 1. 只有标题和内容时,使用 `title + 默认插槽`
181
+ 2. 标题右侧有更新时间、单位、按钮时,优先使用 `metaText`、`header-right` 插槽
182
+ 3. 标题旁有单选、筛选、标签时,优先使用 `title` 插槽
183
+ 4. 内容顶部有单位提示或说明时,优先使用 `tip` 插槽
184
+ 5. 需要导出入口时,优先使用 `showExport + @export`,复杂导出可配合 `BaseExportButton`
185
+
186
+ AI 不应该做这些事:
187
+
188
+ - 不要复制 `BaseCard` 的 DOM 和 CSS 到业务页面
189
+ - 不要在每个页面重复实现标题左侧标记、卡片边框、标题区 flex 布局
190
+ - 不要为了一个右侧按钮而重写整个卡片结构,优先用插槽扩展
191
+ - 不要把接口请求、图表初始化、表格逻辑塞进 `BaseCard`,这些能力应由 `BaseEChart`、`BaseTable` 或业务页面负责
192
+
193
+ 生成代码前建议同时读取:
194
+
195
+ - `packages/ui-core/components.manifest.json`
196
+ - `packages/ui-core/src/components/BaseCard/BaseCard.types.ts`
197
+ - 本 README 的 `Props / Slots / Events` 部分
@@ -0,0 +1,3 @@
1
+ import BaseCard from './BaseCard.vue';
2
+ export default BaseCard;
3
+ export type { BaseCardCssValue, BaseCardDefaultExportPayload, BaseCardProps } from './BaseCard.types';
@@ -0,0 +1,26 @@
1
+ import type { EChartInitOptions, EChartInstance, EChartLoadingOptions, EChartOption, EChartResizeOptions, EChartSetOptionOptions } from '../../echarts';
2
+ export interface BaseEChartProps {
3
+ option?: EChartOption;
4
+ theme?: string | Record<string, unknown>;
5
+ initOptions?: EChartInitOptions;
6
+ setOptionOptions?: boolean | EChartSetOptionOptions;
7
+ loading?: boolean;
8
+ loadingOptions?: EChartLoadingOptions;
9
+ autoResize?: boolean;
10
+ useDefaultColors?: boolean;
11
+ colorStorageKey?: string;
12
+ defaultColors?: string[];
13
+ group?: string;
14
+ }
15
+ export interface BaseEChartExpose {
16
+ getInstance: () => EChartInstance | null;
17
+ setOption: (option: EChartOption, setOptionOptions?: boolean | EChartSetOptionOptions) => EChartInstance | null;
18
+ resize: (resizeOptions?: EChartResizeOptions) => void;
19
+ dispatchAction: (payload: Record<string, unknown>) => void;
20
+ showLoading: (type?: string, loadingOptions?: EChartLoadingOptions) => void;
21
+ hideLoading: () => void;
22
+ clear: () => void;
23
+ dispose: () => void;
24
+ on: (eventName: string, handler: (...args: any[]) => void, context?: unknown) => void;
25
+ off: (eventName?: string, handler?: (...args: any[]) => void) => void;
26
+ }
@@ -0,0 +1,66 @@
1
+ import { echarts } from '../../echarts';
2
+ import type { BaseEChartProps } from './BaseEChart.types';
3
+ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<BaseEChartProps>, {
4
+ option: () => {};
5
+ initOptions: () => echarts.EChartsInitOpts;
6
+ setOptionOptions: () => echarts.SetOptionOpts;
7
+ loading: boolean;
8
+ autoResize: boolean;
9
+ useDefaultColors: boolean;
10
+ colorStorageKey: string;
11
+ defaultColors: () => never[];
12
+ group: undefined;
13
+ }>>, {
14
+ getInstance: () => echarts.ECharts | null;
15
+ setOption: (option: echarts.EChartsOption, setOptionOptions?: boolean | echarts.SetOptionOpts | undefined) => echarts.ECharts | null;
16
+ resize: (resizeOptions?: echarts.ResizeOpts | undefined) => void;
17
+ dispatchAction: (payload: Record<string, unknown>) => void;
18
+ showLoading: (type?: string | undefined, loadingOptions?: object | undefined) => void;
19
+ hideLoading: () => void;
20
+ clear: () => void;
21
+ dispose: () => void;
22
+ on: (eventName: string, handler: (...args: any[]) => void, context?: unknown) => void;
23
+ off: (eventName?: string | undefined, handler?: ((...args: any[]) => void) | undefined) => void;
24
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
25
+ ready: (chart: echarts.ECharts) => void;
26
+ }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<BaseEChartProps>, {
27
+ option: () => {};
28
+ initOptions: () => echarts.EChartsInitOpts;
29
+ setOptionOptions: () => echarts.SetOptionOpts;
30
+ loading: boolean;
31
+ autoResize: boolean;
32
+ useDefaultColors: boolean;
33
+ colorStorageKey: string;
34
+ defaultColors: () => never[];
35
+ group: undefined;
36
+ }>>> & Readonly<{
37
+ onReady?: ((chart: echarts.ECharts) => any) | undefined;
38
+ }>, {
39
+ option: echarts.EChartsOption;
40
+ loading: boolean;
41
+ initOptions: echarts.EChartsInitOpts;
42
+ setOptionOptions: boolean | echarts.SetOptionOpts;
43
+ autoResize: boolean;
44
+ useDefaultColors: boolean;
45
+ colorStorageKey: string;
46
+ defaultColors: string[];
47
+ group: string;
48
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
49
+ export default _default;
50
+ type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
51
+ type __VLS_TypePropsToRuntimeProps<T> = {
52
+ [K in keyof T]-?: {} extends Pick<T, K> ? {
53
+ type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
54
+ } : {
55
+ type: import('vue').PropType<T[K]>;
56
+ required: true;
57
+ };
58
+ };
59
+ type __VLS_WithDefaults<P, D> = {
60
+ [K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
61
+ default: D[K];
62
+ }> : P[K];
63
+ };
64
+ type __VLS_Prettify<T> = {
65
+ [K in keyof T]: T[K];
66
+ } & {};
@@ -134,3 +134,36 @@ const gradient = new echarts.graphic.LinearGradient(0, 0, 0, 1, [
134
134
  - 页面层只维护 `option`,不要重复写 `echarts.init`
135
135
  - 默认走 `BaseEChart + option`,只有确实需要时再通过 `ref` 调暴露方法
136
136
  - 渐变色、图形工具优先从 `@hbdlzy/ui-core` 导出的 `echarts` 使用
137
+
138
+ ## AI 使用指引
139
+
140
+ AI 在生成 ECharts 图表页面时,应优先使用 `BaseEChart`,不要在页面组件里重复写 `echarts.init`、`setOption`、`resize`、`dispose` 和窗口尺寸监听。
141
+
142
+ 推荐优先从统一入口导入:
143
+
144
+ ```ts
145
+ import { BaseEChart, echarts, type EChartOption, type BaseEChartExpose } from '@hbdlzy/ui'
146
+ ```
147
+
148
+ 如果当前只安装了核心包,也可以从 `@hbdlzy/ui-core` 导入。
149
+
150
+ AI 生成代码时按下面顺序判断:
151
+
152
+ 1. 父容器必须给出明确高度,再放入 `<BaseEChart :option="option" />`
153
+ 2. 图表配置统一维护在 `option` 或 `computed option` 中
154
+ 3. 需要渐变色、图形工具时,使用统一导出的 `echarts`
155
+ 4. 需要手动刷新、隐藏 tooltip、派发 action 时,再通过 `ref<BaseEChartExpose>` 调用暴露方法
156
+ 5. 后端数据变化时,只更新 `option` 数据,不重新初始化图表实例
157
+
158
+ AI 不应该做这些事:
159
+
160
+ - 不要在业务页面直接调用 `echarts.init(dom)`
161
+ - 不要手动注册 `window.resize` 来处理普通图表自适应
162
+ - 不要在页面卸载时重复写 `dispose`,组件已处理
163
+ - 不要把接口请求逻辑放进 `BaseEChart`,页面层负责取数,图表组件只接收 `option`
164
+
165
+ 生成代码前建议同时读取:
166
+
167
+ - `packages/ui-core/components.manifest.json`
168
+ - `packages/ui-core/src/components/BaseEChart/BaseEChart.types.ts`
169
+ - 本 README 的 `Props / Events / Expose` 部分
@@ -0,0 +1,3 @@
1
+ import BaseEChart from './BaseEChart.vue';
2
+ export default BaseEChart;
3
+ export type { BaseEChartExpose, BaseEChartProps } from './BaseEChart.types';
@@ -0,0 +1,21 @@
1
+ import type { ExcelExportOptions } from '../../excel/exportExcel';
2
+ export interface ExportResponseHeaders {
3
+ [key: string]: string | undefined;
4
+ }
5
+ export interface ExportResponseLike {
6
+ data: Blob | BlobPart | ArrayBuffer;
7
+ headers?: ExportResponseHeaders;
8
+ }
9
+ export type ExportRequestHandler = () => Promise<ExportResponseLike>;
10
+ export type ExportMode = 'excel' | 'request' | 'none' | 'invalid';
11
+ export type ExportBeforeHandler = () => boolean | void | Promise<boolean | void>;
12
+ export interface ExportSuccessPayload {
13
+ mode: Exclude<ExportMode, 'none' | 'invalid'>;
14
+ fileName?: string;
15
+ }
16
+ export interface BaseExportExcelConfig<Row = Record<string, any>> {
17
+ excelOptions: ExcelExportOptions<Row>;
18
+ }
19
+ export interface BaseExportRequestConfig {
20
+ requestHandler: ExportRequestHandler;
21
+ }
@@ -0,0 +1,4 @@
1
+ import type { ExportResponseLike } from './BaseExportButton.types';
2
+ export declare function extractFileNameFromDisposition(contentDisposition?: string): string;
3
+ export declare function normalizeExportFileName(fileName?: string): string;
4
+ export declare function downloadExportResponse(response: ExportResponseLike, fallbackFileName?: string): string;
@@ -0,0 +1,128 @@
1
+ import type { PropType } from 'vue';
2
+ import { type ExcelExportOptions } from '../../excel/exportExcel';
3
+ import type { ExportBeforeHandler, ExportRequestHandler, ExportSuccessPayload } from './BaseExportButton.types';
4
+ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<import("vue").ExtractPropTypes<{
5
+ label: {
6
+ type: StringConstructor;
7
+ default: string;
8
+ };
9
+ type: {
10
+ type: PropType<"" | "success" | "warning" | "info" | "danger" | "primary">;
11
+ default: string;
12
+ };
13
+ size: {
14
+ type: PropType<"small" | "default" | "large">;
15
+ default: string;
16
+ };
17
+ plain: {
18
+ type: BooleanConstructor;
19
+ default: boolean;
20
+ };
21
+ link: {
22
+ type: BooleanConstructor;
23
+ default: boolean;
24
+ };
25
+ text: {
26
+ type: BooleanConstructor;
27
+ default: boolean;
28
+ };
29
+ disabled: {
30
+ type: BooleanConstructor;
31
+ default: boolean;
32
+ };
33
+ fileName: {
34
+ type: StringConstructor;
35
+ default: string;
36
+ };
37
+ excelOptions: PropType<ExcelExportOptions<Record<string, any>>>;
38
+ requestHandler: PropType<ExportRequestHandler>;
39
+ beforeExport: PropType<ExportBeforeHandler>;
40
+ successMessage: {
41
+ type: StringConstructor;
42
+ default: string;
43
+ };
44
+ errorMessage: {
45
+ type: StringConstructor;
46
+ default: string;
47
+ };
48
+ autoMessage: {
49
+ type: BooleanConstructor;
50
+ default: boolean;
51
+ };
52
+ }>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
53
+ start: () => void;
54
+ success: (payload: ExportSuccessPayload) => void;
55
+ error: (error: unknown) => void;
56
+ }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
57
+ label: {
58
+ type: StringConstructor;
59
+ default: string;
60
+ };
61
+ type: {
62
+ type: PropType<"" | "success" | "warning" | "info" | "danger" | "primary">;
63
+ default: string;
64
+ };
65
+ size: {
66
+ type: PropType<"small" | "default" | "large">;
67
+ default: string;
68
+ };
69
+ plain: {
70
+ type: BooleanConstructor;
71
+ default: boolean;
72
+ };
73
+ link: {
74
+ type: BooleanConstructor;
75
+ default: boolean;
76
+ };
77
+ text: {
78
+ type: BooleanConstructor;
79
+ default: boolean;
80
+ };
81
+ disabled: {
82
+ type: BooleanConstructor;
83
+ default: boolean;
84
+ };
85
+ fileName: {
86
+ type: StringConstructor;
87
+ default: string;
88
+ };
89
+ excelOptions: PropType<ExcelExportOptions<Record<string, any>>>;
90
+ requestHandler: PropType<ExportRequestHandler>;
91
+ beforeExport: PropType<ExportBeforeHandler>;
92
+ successMessage: {
93
+ type: StringConstructor;
94
+ default: string;
95
+ };
96
+ errorMessage: {
97
+ type: StringConstructor;
98
+ default: string;
99
+ };
100
+ autoMessage: {
101
+ type: BooleanConstructor;
102
+ default: boolean;
103
+ };
104
+ }>> & Readonly<{
105
+ onError?: ((error: unknown) => any) | undefined;
106
+ onSuccess?: ((payload: ExportSuccessPayload) => any) | undefined;
107
+ onStart?: (() => any) | undefined;
108
+ }>, {
109
+ label: string;
110
+ link: boolean;
111
+ text: boolean;
112
+ type: "" | "success" | "warning" | "info" | "danger" | "primary";
113
+ disabled: boolean;
114
+ size: "small" | "default" | "large";
115
+ fileName: string;
116
+ plain: boolean;
117
+ successMessage: string;
118
+ errorMessage: string;
119
+ autoMessage: boolean;
120
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>, {
121
+ default?(_: {}): any;
122
+ }>;
123
+ export default _default;
124
+ type __VLS_WithTemplateSlots<T, S> = T & {
125
+ new (): {
126
+ $slots: S;
127
+ };
128
+ };
@@ -119,3 +119,37 @@ const requestHandler = async () => {
119
119
  ## 相关能力
120
120
 
121
121
  - 工具函数:`@hbdlzy/ui-core` 中的 `exportExcel`
122
+
123
+ ## AI 使用指引
124
+
125
+ AI 在生成导出入口时,应优先使用 `BaseExportButton` 或 `exportExcel`,不要在每个页面重复写导出按钮 loading、二进制下载、成功失败提示和前端 Excel 生成逻辑。
126
+
127
+ 推荐优先从统一入口导入:
128
+
129
+ ```ts
130
+ import { BaseExportButton, type ExcelExportOptions } from '@hbdlzy/ui'
131
+ ```
132
+
133
+ 如果当前只安装了核心包,也可以从 `@hbdlzy/ui-core` 导入。
134
+
135
+ AI 生成代码时按下面顺序判断:
136
+
137
+ 1. 前端已有完整表格数据时,优先使用 `excelOptions`
138
+ 2. 后端返回文件流时,优先使用 `requestHandler + fileName`
139
+ 3. 导出前需要校验筛选条件时,使用 `beforeExport`
140
+ 4. 页面需要感知结果时,监听 `start`、`success`、`error`
141
+ 5. 只需要工具函数而不是按钮时,直接使用 `exportExcel`
142
+
143
+ AI 不应该做这些事:
144
+
145
+ - 不要同时传 `excelOptions` 和 `requestHandler`
146
+ - 不要在页面里重复写 `Blob`、`URL.createObjectURL`、临时 `a` 标签下载逻辑
147
+ - 不要在多个页面复制同一套导出 loading 和消息提示
148
+ - 不要把业务查询流程塞进组件,查询参数应由页面层准备好后再触发导出
149
+
150
+ 生成代码前建议同时读取:
151
+
152
+ - `packages/ui-core/components.manifest.json`
153
+ - `packages/ui-core/src/components/BaseExportButton/BaseExportButton.types.ts`
154
+ - `packages/ui-core/src/excel/exportExcel.ts`
155
+ - 本 README 的 `Props / Events / 约束` 部分
@@ -0,0 +1,5 @@
1
+ import BaseExportButton from './BaseExportButton.vue';
2
+ export { BaseExportButton };
3
+ export { downloadExportResponse, extractFileNameFromDisposition, normalizeExportFileName } from './BaseExportButton.utils';
4
+ export type { BaseExportExcelConfig, BaseExportRequestConfig, ExportBeforeHandler, ExportMode, ExportRequestHandler, ExportResponseHeaders, ExportResponseLike, ExportSuccessPayload } from './BaseExportButton.types';
5
+ export default BaseExportButton;