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