@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.
- package/README.md +30 -2
- package/components.manifest.json +15 -1
- package/dist/index.cjs +5 -5
- package/dist/index.d.ts +50 -13
- package/dist/index.js +229 -17
- package/dist/ripple/index.cjs +42 -0
- package/dist/ripple/index.d.ts +8 -1
- package/dist/ripple/index.js +171 -0
- package/dist/style.css +1 -1
- package/package.json +17 -2
- package/src/components/BaseCard/BaseCard.types.d.ts +36 -0
- package/src/components/BaseCard/BaseCard.vue.d.ts +122 -0
- package/src/components/BaseCard/README.md +33 -0
- package/src/components/BaseCard/index.d.ts +3 -0
- package/src/components/BaseEChart/BaseEChart.types.d.ts +26 -0
- package/src/components/BaseEChart/BaseEChart.vue.d.ts +66 -0
- package/src/components/BaseEChart/README.md +33 -0
- package/src/components/BaseEChart/index.d.ts +3 -0
- package/src/components/BaseExportButton/BaseExportButton.types.d.ts +21 -0
- package/src/components/BaseExportButton/BaseExportButton.utils.d.ts +4 -0
- package/src/components/BaseExportButton/BaseExportButton.vue.d.ts +128 -0
- package/src/components/BaseExportButton/README.md +34 -0
- package/src/components/BaseExportButton/index.d.ts +5 -0
- package/src/components/BaseTable/BaseTable.types.d.ts +178 -0
- package/src/components/BaseTable/BaseTable.vue +16 -13
- package/src/components/BaseTable/BaseTable.vue.d.ts +157 -0
- package/src/components/BaseTable/README.md +45 -0
- package/src/components/BaseTable/index.d.ts +3 -0
- package/src/components/OutlinedCascader/OutlinedCascader.types.d.ts +28 -0
- package/src/components/OutlinedCascader/OutlinedCascader.vue.d.ts +94 -0
- package/src/components/OutlinedCascader/README.md +34 -0
- package/src/components/OutlinedCascader/index.d.ts +3 -0
- package/src/components/OutlinedDatePicker/OutlinedDatePicker.types.d.ts +30 -0
- package/src/components/OutlinedDatePicker/OutlinedDatePicker.vue.d.ts +97 -0
- package/src/components/OutlinedDatePicker/README.md +34 -0
- package/src/components/OutlinedDatePicker/index.d.ts +3 -0
- package/src/components/OutlinedDateTimePicker/OutlinedDateTimePicker.types.d.ts +29 -0
- package/src/components/OutlinedDateTimePicker/OutlinedDateTimePicker.vue.d.ts +106 -0
- package/src/components/OutlinedDateTimePicker/README.md +33 -0
- package/src/components/OutlinedDateTimePicker/index.d.ts +3 -0
- package/src/components/OutlinedInput/OutlinedInput.types.d.ts +32 -0
- package/src/components/OutlinedInput/OutlinedInput.vue.d.ts +106 -0
- package/src/components/OutlinedInput/README.md +34 -0
- package/src/components/OutlinedInput/index.d.ts +3 -0
- package/src/components/OutlinedSelect/OutlinedSelect.types.d.ts +41 -0
- package/src/components/OutlinedSelect/OutlinedSelect.vue.d.ts +125 -0
- package/src/components/OutlinedSelect/README.md +34 -0
- package/src/components/OutlinedSelect/index.d.ts +3 -0
- package/src/components/OutlinedTimePicker/OutlinedTimePicker.types.d.ts +31 -0
- package/src/components/OutlinedTimePicker/OutlinedTimePicker.vue.d.ts +103 -0
- package/src/components/OutlinedTimePicker/README.md +33 -0
- package/src/components/OutlinedTimePicker/index.d.ts +3 -0
- package/src/components/OutlinedTreeSelect/OutlinedTreeSelect.types.d.ts +49 -0
- package/src/components/OutlinedTreeSelect/OutlinedTreeSelect.vue.d.ts +146 -0
- package/src/components/OutlinedTreeSelect/README.md +34 -0
- package/src/components/OutlinedTreeSelect/index.d.ts +3 -0
- package/src/components/SvgIcon/README.md +33 -0
- package/src/components/SvgIcon/SvgIcon.types.d.ts +6 -0
- package/src/components/SvgIcon/SvgIcon.vue.d.ts +32 -0
- package/src/components/SvgIcon/index.d.ts +3 -0
- package/src/echarts/index.d.ts +9 -0
- package/src/excel/exportExcel.d.ts +18 -0
- package/src/index.d.ts +30 -0
- package/src/index.ts +78 -13
- package/src/ripple/README.md +160 -0
- package/src/ripple/index.d.ts +9 -0
- package/src/ripple/index.ts +15 -1
|
@@ -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
|
+
}
|
|
@@ -38,19 +38,21 @@
|
|
|
38
38
|
<slot name="toolbar"></slot>
|
|
39
39
|
</div>
|
|
40
40
|
<div v-if="showPagination" class="base-table__toolbar-right">
|
|
41
|
-
<el-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
41
|
+
<el-config-provider :locale="zhCn">
|
|
42
|
+
<el-pagination
|
|
43
|
+
small
|
|
44
|
+
background
|
|
45
|
+
layout="total, prev, pager, next, sizes, jumper"
|
|
46
|
+
:total="paginationState.total"
|
|
47
|
+
:current-page="paginationState.currentPage"
|
|
48
|
+
:page-size="paginationState.pageSize"
|
|
49
|
+
:page-sizes="paginationState.pageSizes"
|
|
50
|
+
:pager-count="5"
|
|
51
|
+
:popper-append-to-body="false"
|
|
52
|
+
@size-change="handleSizeChange"
|
|
53
|
+
@current-change="handleCurrentChange"
|
|
54
|
+
/>
|
|
55
|
+
</el-config-provider>
|
|
54
56
|
</div>
|
|
55
57
|
</div>
|
|
56
58
|
|
|
@@ -392,6 +394,7 @@
|
|
|
392
394
|
import { computed, onBeforeUnmount, onMounted, reactive, ref, useSlots, watch } from 'vue'
|
|
393
395
|
import type { ComponentPublicInstance } from 'vue'
|
|
394
396
|
import type { TableInstance } from 'element-plus'
|
|
397
|
+
import zhCn from 'element-plus/es/locale/lang/zh-cn'
|
|
395
398
|
import SvgIcon from '../SvgIcon'
|
|
396
399
|
import type {
|
|
397
400
|
BaseTableAction,
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import type { BaseTableCellPayload, BaseTableColumn, BaseTableCssValue, BaseTableHeaderSearchValue, BaseTableLoadedPayload, BaseTablePagination, BaseTableProps, BaseTableRowActionPayload, BaseTableSortPayload } from './BaseTable.types';
|
|
2
|
+
type BaseTableRow = Record<string, any>;
|
|
3
|
+
declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<BaseTableProps<Record<string, any>>>, {
|
|
4
|
+
data: () => never[];
|
|
5
|
+
requestParams: () => {};
|
|
6
|
+
autoLoad: boolean;
|
|
7
|
+
reloadOnParamsChange: boolean;
|
|
8
|
+
reloadOnSortChange: boolean;
|
|
9
|
+
rowKey: string;
|
|
10
|
+
height: string;
|
|
11
|
+
border: boolean;
|
|
12
|
+
stripe: boolean;
|
|
13
|
+
showToolbar: boolean;
|
|
14
|
+
showPagination: boolean;
|
|
15
|
+
hasSelection: boolean;
|
|
16
|
+
hasIndex: boolean;
|
|
17
|
+
indexLabel: string;
|
|
18
|
+
indexWidth: number;
|
|
19
|
+
selectionWidth: number;
|
|
20
|
+
pagination: () => {};
|
|
21
|
+
currentPageKey: string;
|
|
22
|
+
pageSizeKey: string;
|
|
23
|
+
defaultSort: () => {
|
|
24
|
+
prop: undefined;
|
|
25
|
+
order: null;
|
|
26
|
+
};
|
|
27
|
+
sortFieldKey: string;
|
|
28
|
+
sortOrderKey: string;
|
|
29
|
+
sortOrderMap: () => {
|
|
30
|
+
ascending: string;
|
|
31
|
+
descending: string;
|
|
32
|
+
};
|
|
33
|
+
emptyText: string;
|
|
34
|
+
loadingText: string;
|
|
35
|
+
}>>, {
|
|
36
|
+
load: (data?: Record<string, any>[] | undefined) => Promise<void>;
|
|
37
|
+
refresh: () => Promise<void>;
|
|
38
|
+
setData: (data: Record<string, any>[]) => void;
|
|
39
|
+
resetPage: () => Promise<void>;
|
|
40
|
+
setHeaderSearchValue: (key: string, value: BaseTableHeaderSearchValue, shouldReload?: boolean | undefined) => Promise<void>;
|
|
41
|
+
resetHeaderSearch: (key?: string | undefined) => Promise<void>;
|
|
42
|
+
getHeaderSearchValues: () => Record<string, BaseTableHeaderSearchValue>;
|
|
43
|
+
clearSelection: () => void;
|
|
44
|
+
toggleRowSelection: (row: Record<string, any>, selected?: boolean | undefined) => void;
|
|
45
|
+
getSelectionRows: () => Record<string, any>[];
|
|
46
|
+
getRows: () => Record<string, any>[];
|
|
47
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
48
|
+
"selection-change": (rows: BaseTableRow[]) => void;
|
|
49
|
+
"sort-change": (payload: BaseTableSortPayload<Record<string, any>>) => void;
|
|
50
|
+
"row-action": (payload: BaseTableRowActionPayload<Record<string, any>>) => void;
|
|
51
|
+
"cell-click": (payload: BaseTableCellPayload<Record<string, any>>) => void;
|
|
52
|
+
"cell-input": (payload: BaseTableCellPayload<Record<string, any>>) => void;
|
|
53
|
+
"page-change": (currentPage: number) => void;
|
|
54
|
+
"size-change": (pageSize: number) => void;
|
|
55
|
+
"update:pagination": (pagination: BaseTablePagination) => void;
|
|
56
|
+
loaded: (payload: BaseTableLoadedPayload<Record<string, any>>) => void;
|
|
57
|
+
"request-error": (error: unknown) => void;
|
|
58
|
+
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<BaseTableProps<Record<string, any>>>, {
|
|
59
|
+
data: () => never[];
|
|
60
|
+
requestParams: () => {};
|
|
61
|
+
autoLoad: boolean;
|
|
62
|
+
reloadOnParamsChange: boolean;
|
|
63
|
+
reloadOnSortChange: boolean;
|
|
64
|
+
rowKey: string;
|
|
65
|
+
height: string;
|
|
66
|
+
border: boolean;
|
|
67
|
+
stripe: boolean;
|
|
68
|
+
showToolbar: boolean;
|
|
69
|
+
showPagination: boolean;
|
|
70
|
+
hasSelection: boolean;
|
|
71
|
+
hasIndex: boolean;
|
|
72
|
+
indexLabel: string;
|
|
73
|
+
indexWidth: number;
|
|
74
|
+
selectionWidth: number;
|
|
75
|
+
pagination: () => {};
|
|
76
|
+
currentPageKey: string;
|
|
77
|
+
pageSizeKey: string;
|
|
78
|
+
defaultSort: () => {
|
|
79
|
+
prop: undefined;
|
|
80
|
+
order: null;
|
|
81
|
+
};
|
|
82
|
+
sortFieldKey: string;
|
|
83
|
+
sortOrderKey: string;
|
|
84
|
+
sortOrderMap: () => {
|
|
85
|
+
ascending: string;
|
|
86
|
+
descending: string;
|
|
87
|
+
};
|
|
88
|
+
emptyText: string;
|
|
89
|
+
loadingText: string;
|
|
90
|
+
}>>> & Readonly<{
|
|
91
|
+
"onSelection-change"?: ((rows: BaseTableRow[]) => any) | undefined;
|
|
92
|
+
"onSort-change"?: ((payload: BaseTableSortPayload<Record<string, any>>) => any) | undefined;
|
|
93
|
+
"onRow-action"?: ((payload: BaseTableRowActionPayload<Record<string, any>>) => any) | undefined;
|
|
94
|
+
"onCell-click"?: ((payload: BaseTableCellPayload<Record<string, any>>) => any) | undefined;
|
|
95
|
+
"onCell-input"?: ((payload: BaseTableCellPayload<Record<string, any>>) => any) | undefined;
|
|
96
|
+
"onPage-change"?: ((currentPage: number) => any) | undefined;
|
|
97
|
+
"onSize-change"?: ((pageSize: number) => any) | undefined;
|
|
98
|
+
"onUpdate:pagination"?: ((pagination: BaseTablePagination) => any) | undefined;
|
|
99
|
+
onLoaded?: ((payload: BaseTableLoadedPayload<Record<string, any>>) => any) | undefined;
|
|
100
|
+
"onRequest-error"?: ((error: unknown) => any) | undefined;
|
|
101
|
+
}>, {
|
|
102
|
+
data: Record<string, any>[];
|
|
103
|
+
border: boolean;
|
|
104
|
+
requestParams: Record<string, unknown>;
|
|
105
|
+
autoLoad: boolean;
|
|
106
|
+
reloadOnParamsChange: boolean;
|
|
107
|
+
reloadOnSortChange: boolean;
|
|
108
|
+
rowKey: string;
|
|
109
|
+
height: BaseTableCssValue;
|
|
110
|
+
stripe: boolean;
|
|
111
|
+
showToolbar: boolean;
|
|
112
|
+
showPagination: boolean;
|
|
113
|
+
hasSelection: boolean;
|
|
114
|
+
hasIndex: boolean;
|
|
115
|
+
indexLabel: string;
|
|
116
|
+
indexWidth: BaseTableCssValue;
|
|
117
|
+
selectionWidth: BaseTableCssValue;
|
|
118
|
+
pagination: Partial<BaseTablePagination>;
|
|
119
|
+
currentPageKey: string;
|
|
120
|
+
pageSizeKey: string;
|
|
121
|
+
defaultSort: import("./BaseTable.types").BaseTableSortState;
|
|
122
|
+
sortFieldKey: string;
|
|
123
|
+
sortOrderKey: string;
|
|
124
|
+
sortOrderMap: import("./BaseTable.types").BaseTableSortOrderMap;
|
|
125
|
+
emptyText: string;
|
|
126
|
+
loadingText: string;
|
|
127
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>, Partial<Record<string, (_: any) => any>> & Partial<Record<string, (_: {
|
|
128
|
+
row: any;
|
|
129
|
+
columnConfig: BaseTableColumn<Record<string, any>>;
|
|
130
|
+
columnIndex: any;
|
|
131
|
+
value: any;
|
|
132
|
+
}) => any>> & {
|
|
133
|
+
toolbar?(_: {}): any;
|
|
134
|
+
}>;
|
|
135
|
+
export default _default;
|
|
136
|
+
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
137
|
+
type __VLS_TypePropsToRuntimeProps<T> = {
|
|
138
|
+
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
139
|
+
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
140
|
+
} : {
|
|
141
|
+
type: import('vue').PropType<T[K]>;
|
|
142
|
+
required: true;
|
|
143
|
+
};
|
|
144
|
+
};
|
|
145
|
+
type __VLS_WithDefaults<P, D> = {
|
|
146
|
+
[K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
|
|
147
|
+
default: D[K];
|
|
148
|
+
}> : P[K];
|
|
149
|
+
};
|
|
150
|
+
type __VLS_Prettify<T> = {
|
|
151
|
+
[K in keyof T]: T[K];
|
|
152
|
+
} & {};
|
|
153
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
154
|
+
new (): {
|
|
155
|
+
$slots: S;
|
|
156
|
+
};
|
|
157
|
+
};
|
|
@@ -465,3 +465,48 @@ tableRef.value?.resetHeaderSearch()
|
|
|
465
465
|
- 默认优先使用列配置驱动,只有复杂单元格才使用插槽
|
|
466
466
|
- 通用操作列尽量统一收敛到 `row-action`
|
|
467
467
|
- 复杂筛选表单不要内置到表格组件里,统一通过 `toolbar` 扩展
|
|
468
|
+
|
|
469
|
+
## AI 使用指引
|
|
470
|
+
|
|
471
|
+
AI 在生成列表页、管理页、日志页、明细页时,应优先使用 `BaseTable`,不要在页面里重复封装 `el-table + el-pagination + loading + request + sort + selection`。
|
|
472
|
+
|
|
473
|
+
推荐优先从统一入口导入:
|
|
474
|
+
|
|
475
|
+
```ts
|
|
476
|
+
import { BaseTable, type BaseTableColumn, type BaseTableExpose } from '@hbdlzy/ui'
|
|
477
|
+
```
|
|
478
|
+
|
|
479
|
+
如果当前只安装了核心包,也可以从 `@hbdlzy/ui-core` 导入。
|
|
480
|
+
|
|
481
|
+
AI 生成代码时按下面顺序判断:
|
|
482
|
+
|
|
483
|
+
1. 先定义业务行类型 `RowItem`
|
|
484
|
+
2. 再定义 `BaseTableColumn<RowItem>[]`
|
|
485
|
+
3. 本地静态数据用 `data`
|
|
486
|
+
4. 远程分页数据用 `request`,不要把 `listUrl` 字符串直接塞给组件
|
|
487
|
+
5. 接口返回结构不统一时,用 `resultAdapter` 映射成 `{ rows, total }`
|
|
488
|
+
6. 顶部筛选表单放进 `toolbar` 插槽
|
|
489
|
+
7. 行操作统一配置 `kind: 'actions'`,通过 `@row-action` 承接
|
|
490
|
+
8. 复杂单元格才使用 `cell-${prop}` 插槽
|
|
491
|
+
|
|
492
|
+
AI 不应该做这些事:
|
|
493
|
+
|
|
494
|
+
- 不要在页面里重新写分页状态、页码变化、每页条数变化和远程加载逻辑
|
|
495
|
+
- 不要在页面里重复写通用排序参数映射,优先使用 `sortFieldKey`、`sortOrderKey`、`sortMapper`
|
|
496
|
+
- 不要为常见状态标签、图片、链接、操作列重复写模板,优先使用 `kind`
|
|
497
|
+
- 不要把复杂业务筛选塞进列头搜索,复杂筛选应放在 `toolbar`
|
|
498
|
+
- 不要绕过 `BaseTableExpose` 直接操作内部 `el-table`
|
|
499
|
+
|
|
500
|
+
旧项目迁移时,AI 可以按这个映射处理:
|
|
501
|
+
|
|
502
|
+
- `columnsList` 迁移为 `columns`
|
|
503
|
+
- `listUrl + paramsData` 迁移为 `request + requestParams`
|
|
504
|
+
- `isSearch / isFilter / isCity` 迁移为 `headerSearch`
|
|
505
|
+
- `actions` 迁移为 `kind: 'actions'`
|
|
506
|
+
- `@handleAction` 迁移为 `@row-action`
|
|
507
|
+
|
|
508
|
+
生成代码前建议同时读取:
|
|
509
|
+
|
|
510
|
+
- `packages/ui-core/components.manifest.json`
|
|
511
|
+
- `packages/ui-core/src/components/BaseTable/BaseTable.types.ts`
|
|
512
|
+
- 本 README 的 `Props / Column 能力 / Events / Expose` 部分
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import BaseTable from './BaseTable.vue';
|
|
2
|
+
export default BaseTable;
|
|
3
|
+
export type { BaseTableAction, BaseTableAlign, BaseTableCellPayload, BaseTableColumn, BaseTableColumnKind, BaseTableCssValue, BaseTableExpose, BaseTableHeaderSearchConfig, BaseTableHeaderSearchPathValue, BaseTableHeaderSearchPrimitiveValue, BaseTableHeaderSearchType, BaseTableHeaderSearchValue, BaseTableLoadedPayload, BaseTableNormalizedResult, BaseTableOption, BaseTablePagination, BaseTableProps, BaseTableResultAdapter, BaseTableRequestHandler, BaseTableRequestParams, BaseTableRequestResult, BaseTableRowActionPayload, BaseTableSortOrder, BaseTableSortPayload } from './BaseTable.types';
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export type OutlinedCascaderCssValue = string | number;
|
|
2
|
+
export type OutlinedCascaderValue = Array<string | number>;
|
|
3
|
+
export interface OutlinedCascaderProps {
|
|
4
|
+
value?: OutlinedCascaderValue;
|
|
5
|
+
options?: Record<string, unknown>[];
|
|
6
|
+
clearable?: boolean;
|
|
7
|
+
propsValue?: Record<string, unknown>;
|
|
8
|
+
placeholder?: string;
|
|
9
|
+
label?: string;
|
|
10
|
+
popperClass?: string;
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
inputHeight?: number;
|
|
13
|
+
isBorder?: boolean;
|
|
14
|
+
filterable?: boolean;
|
|
15
|
+
levels?: boolean;
|
|
16
|
+
marginBottom?: OutlinedCascaderCssValue;
|
|
17
|
+
paddingTop?: OutlinedCascaderCssValue;
|
|
18
|
+
required?: boolean;
|
|
19
|
+
error?: boolean;
|
|
20
|
+
errorMessage?: string;
|
|
21
|
+
}
|
|
22
|
+
export interface OutlinedCascaderExpose {
|
|
23
|
+
focus: () => void;
|
|
24
|
+
blur: () => void;
|
|
25
|
+
togglePopperVisible: () => void;
|
|
26
|
+
clear: () => void;
|
|
27
|
+
getCascaderRef: () => unknown | null;
|
|
28
|
+
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import type { OutlinedCascaderCssValue, OutlinedCascaderProps, OutlinedCascaderValue } from './OutlinedCascader.types';
|
|
2
|
+
declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<OutlinedCascaderProps>, {
|
|
3
|
+
value: () => never[];
|
|
4
|
+
options: () => never[];
|
|
5
|
+
clearable: boolean;
|
|
6
|
+
propsValue: undefined;
|
|
7
|
+
placeholder: string;
|
|
8
|
+
label: string;
|
|
9
|
+
popperClass: string;
|
|
10
|
+
disabled: boolean;
|
|
11
|
+
inputHeight: number;
|
|
12
|
+
isBorder: boolean;
|
|
13
|
+
filterable: boolean;
|
|
14
|
+
levels: boolean;
|
|
15
|
+
marginBottom: number;
|
|
16
|
+
paddingTop: number;
|
|
17
|
+
required: boolean;
|
|
18
|
+
error: boolean;
|
|
19
|
+
errorMessage: string;
|
|
20
|
+
}>>, {
|
|
21
|
+
focus: () => void;
|
|
22
|
+
blur: () => void;
|
|
23
|
+
togglePopperVisible: () => void;
|
|
24
|
+
clear: () => void;
|
|
25
|
+
getCascaderRef: () => unknown;
|
|
26
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
27
|
+
input: (value: OutlinedCascaderValue) => void;
|
|
28
|
+
"update:value": (value: OutlinedCascaderValue) => void;
|
|
29
|
+
change: (value: OutlinedCascaderValue) => void;
|
|
30
|
+
focus: (value: FocusEvent) => void;
|
|
31
|
+
blur: (value: FocusEvent) => void;
|
|
32
|
+
"visible-change": (value: boolean) => void;
|
|
33
|
+
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<OutlinedCascaderProps>, {
|
|
34
|
+
value: () => never[];
|
|
35
|
+
options: () => never[];
|
|
36
|
+
clearable: boolean;
|
|
37
|
+
propsValue: undefined;
|
|
38
|
+
placeholder: string;
|
|
39
|
+
label: string;
|
|
40
|
+
popperClass: string;
|
|
41
|
+
disabled: boolean;
|
|
42
|
+
inputHeight: number;
|
|
43
|
+
isBorder: boolean;
|
|
44
|
+
filterable: boolean;
|
|
45
|
+
levels: boolean;
|
|
46
|
+
marginBottom: number;
|
|
47
|
+
paddingTop: number;
|
|
48
|
+
required: boolean;
|
|
49
|
+
error: boolean;
|
|
50
|
+
errorMessage: string;
|
|
51
|
+
}>>> & Readonly<{
|
|
52
|
+
onBlur?: ((value: FocusEvent) => any) | undefined;
|
|
53
|
+
onChange?: ((value: OutlinedCascaderValue) => any) | undefined;
|
|
54
|
+
onFocus?: ((value: FocusEvent) => any) | undefined;
|
|
55
|
+
onInput?: ((value: OutlinedCascaderValue) => any) | undefined;
|
|
56
|
+
"onUpdate:value"?: ((value: OutlinedCascaderValue) => any) | undefined;
|
|
57
|
+
"onVisible-change"?: ((value: boolean) => any) | undefined;
|
|
58
|
+
}>, {
|
|
59
|
+
error: boolean;
|
|
60
|
+
label: string;
|
|
61
|
+
disabled: boolean;
|
|
62
|
+
required: boolean;
|
|
63
|
+
popperClass: string;
|
|
64
|
+
value: OutlinedCascaderValue;
|
|
65
|
+
placeholder: string;
|
|
66
|
+
options: Record<string, unknown>[];
|
|
67
|
+
errorMessage: string;
|
|
68
|
+
inputHeight: number;
|
|
69
|
+
isBorder: boolean;
|
|
70
|
+
clearable: boolean;
|
|
71
|
+
marginBottom: OutlinedCascaderCssValue;
|
|
72
|
+
paddingTop: OutlinedCascaderCssValue;
|
|
73
|
+
filterable: boolean;
|
|
74
|
+
propsValue: Record<string, unknown>;
|
|
75
|
+
levels: boolean;
|
|
76
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
77
|
+
export default _default;
|
|
78
|
+
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
79
|
+
type __VLS_TypePropsToRuntimeProps<T> = {
|
|
80
|
+
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
81
|
+
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
82
|
+
} : {
|
|
83
|
+
type: import('vue').PropType<T[K]>;
|
|
84
|
+
required: true;
|
|
85
|
+
};
|
|
86
|
+
};
|
|
87
|
+
type __VLS_WithDefaults<P, D> = {
|
|
88
|
+
[K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
|
|
89
|
+
default: D[K];
|
|
90
|
+
}> : P[K];
|
|
91
|
+
};
|
|
92
|
+
type __VLS_Prettify<T> = {
|
|
93
|
+
[K in keyof T]: T[K];
|
|
94
|
+
} & {};
|
|
@@ -92,3 +92,37 @@ const areaOptions = [
|
|
|
92
92
|
- 组件只负责通用级联选择壳子和交互状态,不直接耦合区域接口、组织树接口等业务数据源
|
|
93
93
|
- 页面层如果需要多选级联、懒加载或复杂回填逻辑,优先先通过 `propsValue` 和插值配置解决
|
|
94
94
|
- 如果业务需要固定某种树结构,可以在业务包里再封一层领域组件,而不是反向污染 `ui-core`
|
|
95
|
+
|
|
96
|
+
## AI 使用指引
|
|
97
|
+
|
|
98
|
+
AI 在生成区域、组织、站点、分类等级联选择项时,应优先使用 `OutlinedCascader`,不要重复封装 `el-cascader` 的浮动标签、面板显隐和清空逻辑。
|
|
99
|
+
|
|
100
|
+
推荐优先从统一入口导入:
|
|
101
|
+
|
|
102
|
+
```ts
|
|
103
|
+
import { OutlinedCascader, type OutlinedCascaderExpose } from '@hbdlzy/ui'
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
如果当前只安装了核心包,也可以从 `@hbdlzy/ui-core` 导入。
|
|
107
|
+
|
|
108
|
+
AI 生成代码时按下面顺序判断:
|
|
109
|
+
|
|
110
|
+
1. 选项为标准 `label/value/children` 时直接传 `options`
|
|
111
|
+
2. 后端字段不同,优先通过 `propsValue` 映射,不要先复制转换一份树
|
|
112
|
+
3. 需要搜索时传 `filterable`
|
|
113
|
+
4. 需要展示完整路径时保持 `levels` 为 `true`
|
|
114
|
+
5. 需要下边框风格,传 `:is-border="true"`
|
|
115
|
+
6. 需要手动打开、关闭、清空时,使用 `ref<OutlinedCascaderExpose>`
|
|
116
|
+
|
|
117
|
+
AI 不应该做这些事:
|
|
118
|
+
|
|
119
|
+
- 不要为普通级联选择重复写 `el-cascader` 外壳
|
|
120
|
+
- 不要把区域接口、组织接口请求逻辑写进基础组件
|
|
121
|
+
- 不要为了字段映射在页面层重复转换大树,优先使用 `propsValue`
|
|
122
|
+
- 不要把业务固定层级、路径拼接规则塞回 `ui-core`
|
|
123
|
+
|
|
124
|
+
生成代码前建议同时读取:
|
|
125
|
+
|
|
126
|
+
- `packages/ui-core/components.manifest.json`
|
|
127
|
+
- `packages/ui-core/src/components/OutlinedCascader/OutlinedCascader.types.ts`
|
|
128
|
+
- 本 README 的 `Props / Emits / Expose` 部分
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export type OutlinedDatePickerCssValue = string | number;
|
|
2
|
+
export type OutlinedDatePickerValue = string | number | Date | Array<string | number | Date> | null;
|
|
3
|
+
export type OutlinedDatePickerDisabledDate = string | number | Date | ((date: Date) => boolean);
|
|
4
|
+
export interface OutlinedDatePickerProps {
|
|
5
|
+
value?: OutlinedDatePickerValue;
|
|
6
|
+
placeholder?: string;
|
|
7
|
+
label?: string;
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
timeValue?: boolean;
|
|
10
|
+
typeDate?: string;
|
|
11
|
+
format?: string;
|
|
12
|
+
valueFormat?: string;
|
|
13
|
+
showPassword?: boolean;
|
|
14
|
+
multiple?: boolean;
|
|
15
|
+
inputHeight?: number;
|
|
16
|
+
isBorder?: boolean;
|
|
17
|
+
disabledDate?: OutlinedDatePickerDisabledDate;
|
|
18
|
+
marginBottom?: OutlinedDatePickerCssValue;
|
|
19
|
+
paddingTop?: OutlinedDatePickerCssValue;
|
|
20
|
+
required?: boolean;
|
|
21
|
+
error?: boolean;
|
|
22
|
+
errorMessage?: string;
|
|
23
|
+
}
|
|
24
|
+
export interface OutlinedDatePickerExpose {
|
|
25
|
+
focus: () => void;
|
|
26
|
+
blur: () => void;
|
|
27
|
+
handleOpen: () => void;
|
|
28
|
+
handleClose: () => void;
|
|
29
|
+
getPickerRef: () => unknown | null;
|
|
30
|
+
}
|