@hbdlzy/ui-core 0.1.6 → 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 (79) hide show
  1. package/README.md +34 -2
  2. package/components.manifest.json +31 -2
  3. package/dist/components/BaseTable/BaseTable.types.d.ts +17 -2
  4. package/dist/components/BaseTable/BaseTable.vue.d.ts +4 -4
  5. package/dist/components/BaseTable/index.d.ts +1 -1
  6. package/dist/components/OutlinedTreeSelect/OutlinedTreeSelect.vue.d.ts +1 -1
  7. package/dist/components/SvgIcon/SvgIcon.types.d.ts +6 -0
  8. package/dist/components/SvgIcon/SvgIcon.vue.d.ts +32 -0
  9. package/dist/components/SvgIcon/index.d.ts +3 -0
  10. package/dist/index.cjs +5 -5
  11. package/dist/index.d.ts +51 -12
  12. package/dist/index.js +1014 -147
  13. package/dist/ripple/index.cjs +42 -0
  14. package/dist/ripple/index.d.ts +8 -1
  15. package/dist/ripple/index.js +171 -0
  16. package/dist/style.css +1 -1
  17. package/package.json +17 -2
  18. package/src/components/BaseCard/BaseCard.types.d.ts +36 -0
  19. package/src/components/BaseCard/BaseCard.vue.d.ts +122 -0
  20. package/src/components/BaseCard/README.md +33 -0
  21. package/src/components/BaseCard/index.d.ts +3 -0
  22. package/src/components/BaseEChart/BaseEChart.types.d.ts +26 -0
  23. package/src/components/BaseEChart/BaseEChart.vue.d.ts +66 -0
  24. package/src/components/BaseEChart/README.md +33 -0
  25. package/src/components/BaseEChart/index.d.ts +3 -0
  26. package/src/components/BaseExportButton/BaseExportButton.types.d.ts +21 -0
  27. package/src/components/BaseExportButton/BaseExportButton.utils.d.ts +4 -0
  28. package/src/components/BaseExportButton/BaseExportButton.vue.d.ts +128 -0
  29. package/src/components/BaseExportButton/README.md +34 -0
  30. package/src/components/BaseExportButton/index.d.ts +5 -0
  31. package/src/components/BaseTable/BaseTable.types.d.ts +178 -0
  32. package/src/components/BaseTable/BaseTable.types.ts +19 -2
  33. package/src/components/BaseTable/BaseTable.vue +1105 -118
  34. package/src/components/BaseTable/BaseTable.vue.d.ts +157 -0
  35. package/src/components/BaseTable/README.md +133 -5
  36. package/src/components/BaseTable/index.d.ts +3 -0
  37. package/src/components/BaseTable/index.ts +5 -0
  38. package/src/components/OutlinedCascader/OutlinedCascader.types.d.ts +28 -0
  39. package/src/components/OutlinedCascader/OutlinedCascader.vue.d.ts +94 -0
  40. package/src/components/OutlinedCascader/README.md +34 -0
  41. package/src/components/OutlinedCascader/index.d.ts +3 -0
  42. package/src/components/OutlinedDatePicker/OutlinedDatePicker.types.d.ts +30 -0
  43. package/src/components/OutlinedDatePicker/OutlinedDatePicker.vue.d.ts +97 -0
  44. package/src/components/OutlinedDatePicker/README.md +34 -0
  45. package/src/components/OutlinedDatePicker/index.d.ts +3 -0
  46. package/src/components/OutlinedDateTimePicker/OutlinedDateTimePicker.types.d.ts +29 -0
  47. package/src/components/OutlinedDateTimePicker/OutlinedDateTimePicker.vue.d.ts +106 -0
  48. package/src/components/OutlinedDateTimePicker/README.md +33 -0
  49. package/src/components/OutlinedDateTimePicker/index.d.ts +3 -0
  50. package/src/components/OutlinedInput/OutlinedInput.types.d.ts +32 -0
  51. package/src/components/OutlinedInput/OutlinedInput.vue.d.ts +106 -0
  52. package/src/components/OutlinedInput/README.md +34 -0
  53. package/src/components/OutlinedInput/index.d.ts +3 -0
  54. package/src/components/OutlinedSelect/OutlinedSelect.types.d.ts +41 -0
  55. package/src/components/OutlinedSelect/OutlinedSelect.vue.d.ts +125 -0
  56. package/src/components/OutlinedSelect/README.md +34 -0
  57. package/src/components/OutlinedSelect/index.d.ts +3 -0
  58. package/src/components/OutlinedTimePicker/OutlinedTimePicker.types.d.ts +31 -0
  59. package/src/components/OutlinedTimePicker/OutlinedTimePicker.vue.d.ts +103 -0
  60. package/src/components/OutlinedTimePicker/README.md +33 -0
  61. package/src/components/OutlinedTimePicker/index.d.ts +3 -0
  62. package/src/components/OutlinedTreeSelect/OutlinedTreeSelect.types.d.ts +49 -0
  63. package/src/components/OutlinedTreeSelect/OutlinedTreeSelect.vue.d.ts +146 -0
  64. package/src/components/OutlinedTreeSelect/README.md +34 -0
  65. package/src/components/OutlinedTreeSelect/index.d.ts +3 -0
  66. package/src/components/SvgIcon/README.md +86 -0
  67. package/src/components/SvgIcon/SvgIcon.types.d.ts +6 -0
  68. package/src/components/SvgIcon/SvgIcon.types.ts +6 -0
  69. package/src/components/SvgIcon/SvgIcon.vue +68 -0
  70. package/src/components/SvgIcon/SvgIcon.vue.d.ts +32 -0
  71. package/src/components/SvgIcon/index.d.ts +3 -0
  72. package/src/components/SvgIcon/index.ts +5 -0
  73. package/src/echarts/index.d.ts +9 -0
  74. package/src/excel/exportExcel.d.ts +18 -0
  75. package/src/index.d.ts +30 -0
  76. package/src/index.ts +79 -12
  77. package/src/ripple/README.md +160 -0
  78. package/src/ripple/index.d.ts +9 -0
  79. package/src/ripple/index.ts +15 -1
@@ -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;
@@ -0,0 +1,178 @@
1
+ export type BaseTableCssValue = string | number;
2
+ export type BaseTableAlign = 'left' | 'center' | 'right';
3
+ export type BaseTableColumnKind = 'text' | 'link' | 'actions' | 'image' | 'tag' | 'html' | 'input';
4
+ export type BaseTableSortOrder = 'ascending' | 'descending' | null;
5
+ export type BaseTableSortDirection = string | null;
6
+ export type BaseTableHeaderSearchType = 'input' | 'select' | 'cascader';
7
+ export type BaseTableHeaderSearchPrimitiveValue = string | number | boolean;
8
+ export type BaseTableHeaderSearchPathValue = BaseTableHeaderSearchPrimitiveValue[];
9
+ export type BaseTableHeaderSearchValue = BaseTableHeaderSearchPrimitiveValue | BaseTableHeaderSearchPrimitiveValue[];
10
+ export interface BaseTableHeaderSearchConfig {
11
+ type?: BaseTableHeaderSearchType;
12
+ paramKey?: string;
13
+ placeholder?: string;
14
+ width?: BaseTableCssValue;
15
+ searchText?: string;
16
+ resetText?: string;
17
+ options?: BaseTableOption[];
18
+ multiple?: boolean;
19
+ clearable?: boolean;
20
+ filterable?: boolean;
21
+ optionValueKey?: string;
22
+ optionLabelKey?: string;
23
+ optionDisabledKey?: string;
24
+ optionChildrenKey?: string;
25
+ }
26
+ export interface BaseTableOption {
27
+ label: string;
28
+ value: string | number | boolean;
29
+ tagType?: '' | 'success' | 'warning' | 'info' | 'danger' | 'primary';
30
+ color?: string;
31
+ disabled?: boolean;
32
+ children?: BaseTableOption[];
33
+ }
34
+ export interface BaseTableAction<Row = Record<string, any>> {
35
+ label: string;
36
+ type: string;
37
+ buttonType?: '' | 'primary' | 'success' | 'warning' | 'info' | 'danger';
38
+ disabled?: boolean | ((row: Row) => boolean);
39
+ visible?: boolean | ((row: Row) => boolean);
40
+ }
41
+ export interface BaseTableColumn<Row = Record<string, any>> {
42
+ label: string;
43
+ prop?: keyof Row | string;
44
+ kind?: BaseTableColumnKind;
45
+ type?: string;
46
+ width?: BaseTableCssValue;
47
+ minWidth?: BaseTableCssValue;
48
+ align?: BaseTableAlign;
49
+ headerAlign?: BaseTableAlign;
50
+ fixed?: boolean | 'left' | 'right';
51
+ sortable?: boolean | 'custom';
52
+ sortField?: string;
53
+ headerSearch?: boolean | BaseTableHeaderSearchConfig;
54
+ showOverflowTooltip?: boolean;
55
+ className?: string;
56
+ headerClassName?: string;
57
+ actions?: BaseTableAction<Row>[];
58
+ clickable?: boolean;
59
+ options?: BaseTableOption[];
60
+ optionValueKey?: string;
61
+ optionLabelKey?: string;
62
+ optionTagTypeKey?: string;
63
+ emptyText?: string;
64
+ inputType?: string;
65
+ imageFit?: '' | 'fill' | 'contain' | 'cover' | 'none' | 'scale-down';
66
+ imageWidth?: BaseTableCssValue;
67
+ imageHeight?: BaseTableCssValue;
68
+ slotName?: string;
69
+ headerSlotName?: string;
70
+ formatter?: (row: Row, column: BaseTableColumn<Row>) => unknown;
71
+ html?: (row: Row, column: BaseTableColumn<Row>) => string;
72
+ clickHandler?: (row: Row, column: BaseTableColumn<Row>) => void;
73
+ inputHandler?: (value: string, row: Row, column: BaseTableColumn<Row>) => void;
74
+ }
75
+ export interface BaseTablePagination {
76
+ currentPage: number;
77
+ pageSize: number;
78
+ total: number;
79
+ pageSizes: number[];
80
+ }
81
+ export interface BaseTableRequestParams {
82
+ currentPage: number;
83
+ pageSize: number;
84
+ [key: string]: unknown;
85
+ }
86
+ export interface BaseTableSortState {
87
+ prop?: string;
88
+ order: BaseTableSortOrder;
89
+ }
90
+ export interface BaseTableSortOrderMap {
91
+ ascending: string;
92
+ descending: string;
93
+ }
94
+ export interface BaseTableRequestResult<Row = Record<string, any>> {
95
+ records?: Row[];
96
+ list?: Row[];
97
+ items?: Row[];
98
+ total?: number;
99
+ data?: {
100
+ records?: Row[];
101
+ list?: Row[];
102
+ items?: Row[];
103
+ total?: number;
104
+ };
105
+ }
106
+ export interface BaseTableNormalizedResult<Row = Record<string, any>> {
107
+ rows?: Row[];
108
+ total?: number;
109
+ }
110
+ export type BaseTableRequestHandler<Row = Record<string, any>> = (params: BaseTableRequestParams) => Promise<BaseTableRequestResult<Row> | Row[]>;
111
+ export type BaseTableResultAdapter<Row = Record<string, any>> = (result: unknown, params: BaseTableRequestParams) => BaseTableNormalizedResult<Row>;
112
+ export interface BaseTableProps<Row = Record<string, any>> {
113
+ columns: BaseTableColumn<Row>[];
114
+ data?: Row[];
115
+ request?: BaseTableRequestHandler<Row>;
116
+ requestParams?: Record<string, unknown>;
117
+ resultAdapter?: BaseTableResultAdapter<Row>;
118
+ autoLoad?: boolean;
119
+ reloadOnParamsChange?: boolean;
120
+ reloadOnSortChange?: boolean;
121
+ rowKey?: string;
122
+ height?: BaseTableCssValue;
123
+ border?: boolean;
124
+ stripe?: boolean;
125
+ showToolbar?: boolean;
126
+ showPagination?: boolean;
127
+ hasSelection?: boolean;
128
+ hasIndex?: boolean;
129
+ indexLabel?: string;
130
+ indexWidth?: BaseTableCssValue;
131
+ selectionWidth?: BaseTableCssValue;
132
+ rowSelectable?: (row: Row, index: number) => boolean;
133
+ pagination?: Partial<BaseTablePagination>;
134
+ currentPageKey?: string;
135
+ pageSizeKey?: string;
136
+ defaultSort?: BaseTableSortState;
137
+ sortFieldKey?: string;
138
+ sortOrderKey?: string;
139
+ sortOrderMap?: BaseTableSortOrderMap;
140
+ sortMapper?: (payload: BaseTableSortPayload<Row>) => Record<string, unknown> | void;
141
+ emptyText?: string;
142
+ loadingText?: string;
143
+ }
144
+ export interface BaseTableSortPayload<Row = Record<string, any>> {
145
+ column: BaseTableColumn<Row> | undefined;
146
+ prop?: string;
147
+ order: BaseTableSortOrder;
148
+ field?: string;
149
+ direction: BaseTableSortDirection;
150
+ }
151
+ export interface BaseTableRowActionPayload<Row = Record<string, any>> {
152
+ row: Row;
153
+ action: BaseTableAction<Row>;
154
+ column: BaseTableColumn<Row>;
155
+ }
156
+ export interface BaseTableCellPayload<Row = Record<string, any>> {
157
+ row: Row;
158
+ column: BaseTableColumn<Row>;
159
+ value: unknown;
160
+ }
161
+ export interface BaseTableLoadedPayload<Row = Record<string, any>> {
162
+ rows: Row[];
163
+ total: number;
164
+ params: BaseTableRequestParams;
165
+ }
166
+ export interface BaseTableExpose<Row = Record<string, any>> {
167
+ load: (data?: Row[]) => Promise<void>;
168
+ refresh: () => Promise<void>;
169
+ setData: (data: Row[]) => void;
170
+ resetPage: () => Promise<void>;
171
+ setHeaderSearchValue: (key: string, value: BaseTableHeaderSearchValue, shouldReload?: boolean) => Promise<void>;
172
+ resetHeaderSearch: (key?: string) => Promise<void>;
173
+ getHeaderSearchValues: () => Record<string, BaseTableHeaderSearchValue>;
174
+ clearSelection: () => void;
175
+ toggleRowSelection: (row: Row, selected?: boolean) => void;
176
+ getSelectionRows: () => Row[];
177
+ getRows: () => Row[];
178
+ }
@@ -3,13 +3,28 @@ export type BaseTableAlign = 'left' | 'center' | 'right'
3
3
  export type BaseTableColumnKind = 'text' | 'link' | 'actions' | 'image' | 'tag' | 'html' | 'input'
4
4
  export type BaseTableSortOrder = 'ascending' | 'descending' | null
5
5
  export type BaseTableSortDirection = string | null
6
+ export type BaseTableHeaderSearchType = 'input' | 'select' | 'cascader'
7
+ export type BaseTableHeaderSearchPrimitiveValue = string | number | boolean
8
+ export type BaseTableHeaderSearchPathValue = BaseTableHeaderSearchPrimitiveValue[]
9
+ export type BaseTableHeaderSearchValue =
10
+ | BaseTableHeaderSearchPrimitiveValue
11
+ | BaseTableHeaderSearchPrimitiveValue[]
6
12
 
7
13
  export interface BaseTableHeaderSearchConfig {
14
+ type?: BaseTableHeaderSearchType
8
15
  paramKey?: string
9
16
  placeholder?: string
10
17
  width?: BaseTableCssValue
11
18
  searchText?: string
12
19
  resetText?: string
20
+ options?: BaseTableOption[]
21
+ multiple?: boolean
22
+ clearable?: boolean
23
+ filterable?: boolean
24
+ optionValueKey?: string
25
+ optionLabelKey?: string
26
+ optionDisabledKey?: string
27
+ optionChildrenKey?: string
13
28
  }
14
29
 
15
30
  export interface BaseTableOption {
@@ -17,6 +32,8 @@ export interface BaseTableOption {
17
32
  value: string | number | boolean
18
33
  tagType?: '' | 'success' | 'warning' | 'info' | 'danger' | 'primary'
19
34
  color?: string
35
+ disabled?: boolean
36
+ children?: BaseTableOption[]
20
37
  }
21
38
 
22
39
  export interface BaseTableAction<Row = Record<string, any>> {
@@ -176,9 +193,9 @@ export interface BaseTableExpose<Row = Record<string, any>> {
176
193
  refresh: () => Promise<void>
177
194
  setData: (data: Row[]) => void
178
195
  resetPage: () => Promise<void>
179
- setHeaderSearchValue: (key: string, value: string, shouldReload?: boolean) => Promise<void>
196
+ setHeaderSearchValue: (key: string, value: BaseTableHeaderSearchValue, shouldReload?: boolean) => Promise<void>
180
197
  resetHeaderSearch: (key?: string) => Promise<void>
181
- getHeaderSearchValues: () => Record<string, string>
198
+ getHeaderSearchValues: () => Record<string, BaseTableHeaderSearchValue>
182
199
  clearSelection: () => void
183
200
  toggleRowSelection: (row: Row, selected?: boolean) => void
184
201
  getSelectionRows: () => Row[]