element-like 0.1.1 → 0.2.0
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 +5 -1
- package/dist/es/bundle.d.ts +276 -1
- package/dist/es/element-like.js +1 -696
- package/dist/es/style.css +1 -1
- package/dist/style.css +1 -1
- package/dist/umd/bundle.d.ts +276 -1
- package/dist/umd/element-like.umd.cjs +5 -6
- package/dist/umd/style.css +1 -1
- package/docs/build-optimization-report.md +131 -0
- package/docs/code-inspector-source-location.md +287 -0
- package/docs/code-splitting.md +251 -0
- package/docs/usage.md +3 -0
- package/package.json +6 -2
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
一个仿 Element UI / Element Plus 的 Vue 3 组件库:从零封装常用 UI 组件,配套设计 token 体系、组件文档与单元测试。支持 npm 安装全量/按需注册,也支持 CDN `<script>` 直引。
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
**在线预览**:[https://xiaoquan-test.xyz/element-like/](https://xiaoquan-test.xyz/element-like/),可直接体验各组件的交互效果。
|
|
6
6
|
|
|
7
7
|
## 安装
|
|
8
8
|
|
|
@@ -64,6 +64,10 @@ CDN `<script>` 直引、图标机制、TypeScript 支持与常见问题等完整
|
|
|
64
64
|
- ✅ **Collapse 折叠面板** —— 含 CollapseItem,支持手风琴模式、自定义标题与禁用面板,详见 [src/components/Collapse/README.md](src/components/Collapse/README.md)
|
|
65
65
|
- ✅ **Tooltip 文字提示** —— 支持 hover / click / focus 三种触发方式、延时与手动控制、自动翻转定位,详见 [src/components/Tooltip/README.md](src/components/Tooltip/README.md)
|
|
66
66
|
- ✅ **Dropdown 下拉菜单** —— 复用 Tooltip 的显示/定位机制,选择条目触发 select 事件,详见 [src/components/Dropdown/README.md](src/components/Dropdown/README.md)
|
|
67
|
+
- ✅ **VirtualList 虚拟列表** —— 支持动态行高、高度缓存与滚动定位,详见 [src/components/VirtualList/README.md](src/components/VirtualList/README.md)
|
|
68
|
+
- ✅ **Cascader 级联选择器** —— 支持单选、多选、任意级选择、搜索与懒加载,详见 [src/components/Cascader/README.md](src/components/Cascader/README.md)
|
|
69
|
+
- ✅ **CountUp 数字滚动** —— 支持缓动、数字格式化、视口触发及暂停续播控制,详见 [src/components/CountUp/README.md](src/components/CountUp/README.md)
|
|
70
|
+
- ✅ **Table 数据表格** —— 支持排序、筛选、分页、选择、树形数据、展开行与固定列,详见 [src/components/Table/README.md](src/components/Table/README.md)
|
|
67
71
|
|
|
68
72
|
各组件的示例页(`src/views/*View.vue`)已接入路由,除在开发服务器中预览外,也可通过上文的在线预览地址直接体验。
|
|
69
73
|
|
package/dist/es/bundle.d.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// 新增组件在 bundle.ts 登记后,须同步在此登记导出与 GlobalComponents(见 docs/packaging.md)。
|
|
4
4
|
// 除模块导出外,还通过 declare module 'vue' 增强 GlobalComponents,
|
|
5
5
|
// 让使用方模板里的 <el-like-button> 等标签获得 Volar 的组件解析与提示。
|
|
6
|
-
import type { App, Component } from 'vue'
|
|
6
|
+
import type { App, Component, CSSProperties, VNodeChild } from 'vue'
|
|
7
7
|
|
|
8
8
|
// withInstall 装配后的组件形态:组件本身 + install 方法(app.use 直接可用)
|
|
9
9
|
export interface SFCWithInstall<T> extends Component {
|
|
@@ -21,6 +21,273 @@ export const ElLikeCollapse: SFCWithInstall<Component>
|
|
|
21
21
|
export const ElLikeCollapseItem: SFCWithInstall<Component>
|
|
22
22
|
export const ElLikeTooltip: SFCWithInstall<Component>
|
|
23
23
|
export const ElLikeDropdown: SFCWithInstall<Component>
|
|
24
|
+
export const ElLikeVirtualList: SFCWithInstall<Component>
|
|
25
|
+
export const ElLikeCascader: SFCWithInstall<Component>
|
|
26
|
+
export const ElLikeCountUp: SFCWithInstall<Component>
|
|
27
|
+
export const ElLikeTable: SFCWithInstall<Component>
|
|
28
|
+
|
|
29
|
+
export type CountUpEasingName = 'linear' | 'easeOut' | 'easeInOut'
|
|
30
|
+
export type CountUpEasingFunction = (progress: number) => number
|
|
31
|
+
export type CountUpEasing = CountUpEasingName | CountUpEasingFunction
|
|
32
|
+
export type CountUpFormatter = (value: number) => string
|
|
33
|
+
export interface CountUpExpose {
|
|
34
|
+
start: () => void
|
|
35
|
+
pause: () => void
|
|
36
|
+
resume: () => void
|
|
37
|
+
reset: () => void
|
|
38
|
+
}
|
|
39
|
+
export interface CountUpSlotProps {
|
|
40
|
+
value: number
|
|
41
|
+
formattedValue: string
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export type CascaderNodeValue = string | number
|
|
45
|
+
export type CascaderValue = CascaderNodeValue | CascaderNodeValue[] | CascaderNodeValue[][] | null
|
|
46
|
+
export interface CascaderOption {
|
|
47
|
+
value?: CascaderNodeValue
|
|
48
|
+
label?: string
|
|
49
|
+
disabled?: boolean
|
|
50
|
+
leaf?: boolean
|
|
51
|
+
children?: CascaderOption[]
|
|
52
|
+
[key: string]: unknown
|
|
53
|
+
}
|
|
54
|
+
export interface CascaderNode {
|
|
55
|
+
data: CascaderOption
|
|
56
|
+
value: CascaderNodeValue
|
|
57
|
+
label: string
|
|
58
|
+
level: number
|
|
59
|
+
leaf: boolean
|
|
60
|
+
disabled: boolean
|
|
61
|
+
loading: boolean
|
|
62
|
+
loaded: boolean
|
|
63
|
+
parent: CascaderNode | null
|
|
64
|
+
children: CascaderNode[]
|
|
65
|
+
pathValues: CascaderNodeValue[]
|
|
66
|
+
}
|
|
67
|
+
export type CascaderLazyLoad = (
|
|
68
|
+
node: CascaderNode,
|
|
69
|
+
resolve: (data?: CascaderOption[]) => void,
|
|
70
|
+
) => void | CascaderOption[] | Promise<void | CascaderOption[]>
|
|
71
|
+
export interface CascaderConfig {
|
|
72
|
+
expandTrigger?: 'click' | 'hover'
|
|
73
|
+
multiple?: boolean
|
|
74
|
+
checkStrictly?: boolean
|
|
75
|
+
emitPath?: boolean
|
|
76
|
+
lazy?: boolean
|
|
77
|
+
lazyLoad?: CascaderLazyLoad
|
|
78
|
+
value?: string
|
|
79
|
+
label?: string
|
|
80
|
+
children?: string
|
|
81
|
+
disabled?: string
|
|
82
|
+
leaf?: string
|
|
83
|
+
}
|
|
84
|
+
export type CascaderSize = 'large' | 'default' | 'small'
|
|
85
|
+
export type CascaderPlacement = 'top-start' | 'top-end' | 'bottom-start' | 'bottom-end'
|
|
86
|
+
export type CascaderFilterMethod = (node: CascaderNode, keyword: string) => boolean
|
|
87
|
+
export type CascaderBeforeFilter = (keyword: string) => boolean | Promise<boolean>
|
|
88
|
+
export interface CascaderExpose {
|
|
89
|
+
focus: () => void
|
|
90
|
+
blur: () => void
|
|
91
|
+
toggleDropDownVisible: (visible?: boolean) => void
|
|
92
|
+
updatePopperPosition: () => void
|
|
93
|
+
getCheckedNodes: (leafOnly?: boolean) => CascaderNode[]
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export type VirtualListKey = string | number
|
|
97
|
+
export type ScrollAlign = 'start' | 'center' | 'end'
|
|
98
|
+
export interface VirtualListRange {
|
|
99
|
+
startIndex: number
|
|
100
|
+
endIndex: number
|
|
101
|
+
}
|
|
102
|
+
export interface VirtualListExpose {
|
|
103
|
+
scrollToIndex: (index: number, align?: ScrollAlign) => void
|
|
104
|
+
scrollToOffset: (offset: number) => void
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
export type TableKey = string | number
|
|
108
|
+
export type TableData = Record<string, unknown>
|
|
109
|
+
export type TableSortDirection = 'ascend' | 'descend'
|
|
110
|
+
export type TableFilterValue = string | number | boolean
|
|
111
|
+
export type TableSize = 'default' | 'middle' | 'small' | 'mini'
|
|
112
|
+
export type TableFixed = 'left' | 'right'
|
|
113
|
+
export type TablePagePosition = 'br' | 'bl' | 'tr' | 'tl' | 'topCenter' | 'bottomCenter'
|
|
114
|
+
export type TableChangeAction = 'paginate' | 'sort' | 'filter'
|
|
115
|
+
export interface TableFilterOption {
|
|
116
|
+
text: string
|
|
117
|
+
value: TableFilterValue
|
|
118
|
+
}
|
|
119
|
+
export type TableSorterFn<T extends object = TableData> = (a: T, b: T) => number
|
|
120
|
+
export interface TableSorter<T extends object = TableData> {
|
|
121
|
+
compare?: TableSorterFn<T>
|
|
122
|
+
multiple?: number
|
|
123
|
+
}
|
|
124
|
+
export interface TableCellCallbackProps {
|
|
125
|
+
onClick?: (event: MouseEvent) => void
|
|
126
|
+
onDoubleClick?: (event: MouseEvent) => void
|
|
127
|
+
onDblclick?: (event: MouseEvent) => void
|
|
128
|
+
onContextMenu?: (event: MouseEvent) => void
|
|
129
|
+
onContextmenu?: (event: MouseEvent) => void
|
|
130
|
+
onMouseEnter?: (event: MouseEvent) => void
|
|
131
|
+
onMouseenter?: (event: MouseEvent) => void
|
|
132
|
+
onMouseLeave?: (event: MouseEvent) => void
|
|
133
|
+
onMouseleave?: (event: MouseEvent) => void
|
|
134
|
+
class?: string | string[]
|
|
135
|
+
style?: CSSProperties
|
|
136
|
+
[name: string]: unknown
|
|
137
|
+
}
|
|
138
|
+
export interface TableColumn<T extends object = TableData> {
|
|
139
|
+
title?: string
|
|
140
|
+
dataIndex?: string
|
|
141
|
+
key?: TableKey
|
|
142
|
+
width?: number | string
|
|
143
|
+
align?: 'left' | 'center' | 'right'
|
|
144
|
+
fixed?: TableFixed
|
|
145
|
+
ellipsis?: boolean
|
|
146
|
+
className?: string | string[]
|
|
147
|
+
headerCellStyle?: CSSProperties
|
|
148
|
+
bodyCellStyle?: CSSProperties
|
|
149
|
+
cellStyle?: CSSProperties
|
|
150
|
+
placeholder?: string
|
|
151
|
+
children?: TableColumn<T>[]
|
|
152
|
+
colSpan?: number
|
|
153
|
+
rowSpan?: number
|
|
154
|
+
render?: (value: unknown, record: T, index: number) => VNodeChild
|
|
155
|
+
sorter?: boolean | TableSorterFn<T> | TableSorter<T>
|
|
156
|
+
defaultSortOrder?: TableSortDirection
|
|
157
|
+
sortOrder?: TableSortDirection
|
|
158
|
+
sortDirections?: TableSortDirection[]
|
|
159
|
+
filters?: TableFilterOption[]
|
|
160
|
+
defaultFilters?: TableFilterValue[]
|
|
161
|
+
filteredValue?: TableFilterValue[]
|
|
162
|
+
filterMultiple?: boolean
|
|
163
|
+
onFilter?: (value: TableFilterValue, record: T) => boolean
|
|
164
|
+
onHeaderCell?: (column: TableColumn<T>, index: number) => TableCellCallbackProps
|
|
165
|
+
onCell?: (record: T, index: number) => TableCellCallbackProps
|
|
166
|
+
}
|
|
167
|
+
export interface TableBorder {
|
|
168
|
+
wrapper?: boolean
|
|
169
|
+
headerCell?: boolean
|
|
170
|
+
bodyCell?: boolean
|
|
171
|
+
cell?: boolean
|
|
172
|
+
}
|
|
173
|
+
export interface TableScroll {
|
|
174
|
+
x?: number | string | boolean
|
|
175
|
+
y?: number | string | boolean
|
|
176
|
+
}
|
|
177
|
+
export interface TableLoading {
|
|
178
|
+
text?: string
|
|
179
|
+
}
|
|
180
|
+
export interface TableExpandProps<T extends object = TableData> {
|
|
181
|
+
width?: number
|
|
182
|
+
columnTitle?: string
|
|
183
|
+
rowExpandable?: (record: T) => boolean
|
|
184
|
+
expandRowByClick?: boolean
|
|
185
|
+
strictTreeData?: boolean
|
|
186
|
+
icon?: (props: { expanded: boolean; record: T }) => VNodeChild
|
|
187
|
+
}
|
|
188
|
+
export interface TableCheckboxProps {
|
|
189
|
+
disabled?: boolean
|
|
190
|
+
name?: string
|
|
191
|
+
ariaLabel?: string
|
|
192
|
+
}
|
|
193
|
+
export interface TableRowSelection<T extends object = TableData> {
|
|
194
|
+
type?: 'checkbox' | 'radio'
|
|
195
|
+
checkAll?: boolean
|
|
196
|
+
checkStrictly?: boolean
|
|
197
|
+
checkCrossPage?: boolean
|
|
198
|
+
columnTitle?: string
|
|
199
|
+
columnWidth?: number
|
|
200
|
+
fixed?: boolean
|
|
201
|
+
selectedRowKeys?: TableKey[]
|
|
202
|
+
preserveSelectedRowKeys?: boolean
|
|
203
|
+
checkboxProps?: (record: T) => TableCheckboxProps
|
|
204
|
+
renderCell?: (originNode: VNodeChild, checked: boolean, record: T) => VNodeChild
|
|
205
|
+
}
|
|
206
|
+
export interface TablePagination {
|
|
207
|
+
current?: number
|
|
208
|
+
pageSize?: number
|
|
209
|
+
total?: number
|
|
210
|
+
defaultCurrent?: number
|
|
211
|
+
defaultPageSize?: number
|
|
212
|
+
disabled?: boolean
|
|
213
|
+
hideOnSinglePage?: boolean
|
|
214
|
+
showTotal?: boolean | ((total: number, range: [number, number]) => VNodeChild)
|
|
215
|
+
sizeCanChange?: boolean
|
|
216
|
+
sizeOptions?: number[]
|
|
217
|
+
pageSizeChangeResetCurrent?: boolean
|
|
218
|
+
showJumper?: boolean
|
|
219
|
+
simple?: boolean
|
|
220
|
+
}
|
|
221
|
+
export interface TableSorterInfo<T extends object = TableData> {
|
|
222
|
+
direction?: TableSortDirection
|
|
223
|
+
field?: TableKey
|
|
224
|
+
sorterFn?: TableSorterFn<T>
|
|
225
|
+
priority?: number
|
|
226
|
+
}
|
|
227
|
+
export type TableFilters = Record<string, TableFilterValue[]>
|
|
228
|
+
export interface TablePaginationState {
|
|
229
|
+
current: number
|
|
230
|
+
pageSize: number
|
|
231
|
+
total: number
|
|
232
|
+
}
|
|
233
|
+
export interface TableChangeExtra<T extends object = TableData> {
|
|
234
|
+
currentData: T[]
|
|
235
|
+
currentAllData: T[]
|
|
236
|
+
action: TableChangeAction
|
|
237
|
+
}
|
|
238
|
+
export interface TableProps<T extends object = TableData> {
|
|
239
|
+
columns?: TableColumn<T>[]
|
|
240
|
+
data?: T[]
|
|
241
|
+
rowKey?: string | ((record: T) => TableKey)
|
|
242
|
+
border?: boolean | TableBorder
|
|
243
|
+
borderCell?: boolean
|
|
244
|
+
hover?: boolean
|
|
245
|
+
stripe?: boolean
|
|
246
|
+
size?: TableSize
|
|
247
|
+
loading?: boolean | TableLoading
|
|
248
|
+
noDataElement?: string
|
|
249
|
+
showHeader?: boolean
|
|
250
|
+
showSorterTooltip?: boolean
|
|
251
|
+
tableLayoutFixed?: boolean
|
|
252
|
+
pagination?: boolean | TablePagination
|
|
253
|
+
pagePosition?: TablePagePosition
|
|
254
|
+
scroll?: TableScroll
|
|
255
|
+
rowClassName?: (record: T, index: number) => string
|
|
256
|
+
onRow?: (record: T, index: number) => TableCellCallbackProps
|
|
257
|
+
onHeaderRow?: (columns: TableColumn<T>[], index: number) => TableCellCallbackProps
|
|
258
|
+
placeholder?: string
|
|
259
|
+
childrenColumnName?: string
|
|
260
|
+
indentSize?: number
|
|
261
|
+
defaultExpandAllRows?: boolean
|
|
262
|
+
expandedRowKeys?: TableKey[]
|
|
263
|
+
defaultExpandedRowKeys?: TableKey[]
|
|
264
|
+
expandedRowRender?: (record: T, index: number) => VNodeChild
|
|
265
|
+
expandProps?: TableExpandProps<T>
|
|
266
|
+
rowSelection?: TableRowSelection<T>
|
|
267
|
+
footer?: (currentPageData: T[]) => VNodeChild
|
|
268
|
+
summary?: (currentData: T[]) => VNodeChild
|
|
269
|
+
}
|
|
270
|
+
export interface TableCellSlotProps<T extends object = TableData> {
|
|
271
|
+
record: T
|
|
272
|
+
column: TableColumn<T>
|
|
273
|
+
value: unknown
|
|
274
|
+
rowIndex: number
|
|
275
|
+
columnIndex: number
|
|
276
|
+
}
|
|
277
|
+
export interface TableExpandSlotProps<T extends object = TableData> {
|
|
278
|
+
record: T
|
|
279
|
+
rowIndex: number
|
|
280
|
+
expanded: boolean
|
|
281
|
+
}
|
|
282
|
+
export interface TableExpose<T extends object = TableData> {
|
|
283
|
+
clearSelection: () => void
|
|
284
|
+
toggleRowSelection: (record: T, selected?: boolean) => void
|
|
285
|
+
getSelectionRows: () => T[]
|
|
286
|
+
toggleRowExpansion: (record: T, expanded?: boolean) => void
|
|
287
|
+
clearSort: () => void
|
|
288
|
+
clearFilter: (field?: TableKey) => void
|
|
289
|
+
scrollTo: (options: ScrollToOptions) => void
|
|
290
|
+
}
|
|
24
291
|
|
|
25
292
|
declare const _default: {
|
|
26
293
|
install: (app: App) => void
|
|
@@ -33,6 +300,10 @@ declare const _default: {
|
|
|
33
300
|
ElLikeCollapseItem: typeof ElLikeCollapseItem
|
|
34
301
|
ElLikeTooltip: typeof ElLikeTooltip
|
|
35
302
|
ElLikeDropdown: typeof ElLikeDropdown
|
|
303
|
+
ElLikeVirtualList: typeof ElLikeVirtualList
|
|
304
|
+
ElLikeCascader: typeof ElLikeCascader
|
|
305
|
+
ElLikeCountUp: typeof ElLikeCountUp
|
|
306
|
+
ElLikeTable: typeof ElLikeTable
|
|
36
307
|
}
|
|
37
308
|
|
|
38
309
|
export default _default
|
|
@@ -48,5 +319,9 @@ declare module 'vue' {
|
|
|
48
319
|
ElLikeCollapseItem: typeof ElLikeCollapseItem
|
|
49
320
|
ElLikeTooltip: typeof ElLikeTooltip
|
|
50
321
|
ElLikeDropdown: typeof ElLikeDropdown
|
|
322
|
+
ElLikeVirtualList: typeof ElLikeVirtualList
|
|
323
|
+
ElLikeCascader: typeof ElLikeCascader
|
|
324
|
+
ElLikeCountUp: typeof ElLikeCountUp
|
|
325
|
+
ElLikeTable: typeof ElLikeTable
|
|
51
326
|
}
|
|
52
327
|
}
|