vue3-smart-table 1.0.2 → 1.0.4

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/src/index.ts ADDED
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Vue3 Smart Table - 主入口文件
3
+ *
4
+ * 基于 Vue 3 + Element Plus 的高可复用表格组件库
5
+ */
6
+ import SmartTable from './components/SmartTable/index.vue'
7
+
8
+ // 导出类型
9
+ export * from './components/SmartTable/types'
10
+
11
+ // 导出核心功能(从 SmartTable 内部导出)
12
+ export {
13
+ getRendererManager,
14
+ wrapSFCComponent,
15
+ createFunctionalRenderer,
16
+ validateRendererProps
17
+ } from './components/SmartTable/renderer'
18
+
19
+ export {
20
+ setSmartTableConfig,
21
+ getSmartTableConfig
22
+ } from './components/SmartTable/config'
23
+
24
+ // 导出内置渲染器
25
+ export {
26
+ builtInRenderers,
27
+ registerBuiltInRenderers,
28
+ createRenderer
29
+ } from './components/SmartTable/renderers'
30
+
31
+ // 导出类型工具
32
+ export { defineColumn } from './types/enhanced'
33
+
34
+ // 导出主组件
35
+ export { SmartTable }
36
+
37
+ // 默认导出
38
+ export default SmartTable
@@ -0,0 +1,51 @@
1
+ /**
2
+ * 增强类型系统 - 提供更好的类型推断
3
+ */
4
+ import type { ColumnConfig, RendererName } from '../components/SmartTable/types'
5
+
6
+ /**
7
+ * 提取行数据的类型
8
+ */
9
+ export type ExtractRowType<T> = T extends ColumnConfig<infer R> ? R : never
10
+
11
+ /**
12
+ * 根据列配置提取表格数据类型
13
+ */
14
+ export type TableDataFromColumns<T extends ColumnConfig[]> = T extends (infer C)[]
15
+ ? C extends ColumnConfig<infer R>
16
+ ? R
17
+ : any
18
+ : any
19
+
20
+ /**
21
+ * 渲染器 Props 类型推断
22
+ */
23
+ export type InferRendererProps<T extends RendererName> =
24
+ T extends 'html'
25
+ ? { style?: string; class?: string; [key: string]: any }
26
+ : T extends 'copy'
27
+ ? { successText?: string; errorText?: string; iconColor?: string; [key: string]: any }
28
+ : T extends 'img'
29
+ ? { width?: string | number; height?: string | number; fit?: string; previewSrcList?: string[]; [key: string]: any }
30
+ : T extends 'dict'
31
+ ? { options: Array<{ label: string; value: string | number; listClass?: string; cssClass?: string }>; showValue?: boolean }
32
+ : T extends 'map'
33
+ ? { options: Record<string | number, any> }
34
+ : T extends 'input'
35
+ ? { placeholder?: string; size?: 'small' | 'default' | 'large'; clearable?: boolean }
36
+ : T extends 'select'
37
+ ? { options: Array<{ label: string; value: string | number }>; placeholder?: string; clearable?: boolean }
38
+ : { [key: string]: any }
39
+
40
+ /**
41
+ * 快捷创建列的辅助函数(类型安全简化版)
42
+ */
43
+ export function defineColumn(
44
+ key: string,
45
+ config?: Partial<Omit<ColumnConfig, 'key'>>
46
+ ): ColumnConfig {
47
+ return {
48
+ key,
49
+ ...config
50
+ } as ColumnConfig
51
+ }
@@ -1 +0,0 @@
1
- .copy-wrapper:hover .copy-btn{display:inline-block!important}.smart-table[data-v-338b77db]{width:100%}