@firerian/fireui 1.0.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/LICENSE +21 -0
- package/README.md +74 -0
- package/dist/fireui.cjs +2 -0
- package/dist/fireui.cjs.map +1 -0
- package/dist/fireui.css +1 -0
- package/dist/fireui.es.mjs +3867 -0
- package/dist/fireui.es.mjs.map +1 -0
- package/dist/fireui.umd.js +2 -0
- package/dist/fireui.umd.js.map +1 -0
- package/dist/types/index.d.ts +1590 -0
- package/package.json +132 -0
- package/src/components/button/button.test.ts +357 -0
- package/src/components/button/button.vue +366 -0
- package/src/components/button/index.ts +17 -0
- package/src/components/button/types.ts +76 -0
- package/src/components/form/form-item.vue +136 -0
- package/src/components/form/form.vue +76 -0
- package/src/components/form/index.ts +16 -0
- package/src/components/grid/col.vue +99 -0
- package/src/components/grid/index.ts +16 -0
- package/src/components/grid/row.vue +85 -0
- package/src/components/grid/types.ts +66 -0
- package/src/components/index.ts +36 -0
- package/src/components/input/index.ts +8 -0
- package/src/components/input/input.test.ts +129 -0
- package/src/components/input/input.vue +256 -0
- package/src/components/input/types.ts +100 -0
- package/src/components/layout/aside.vue +89 -0
- package/src/components/layout/container.vue +53 -0
- package/src/components/layout/footer.vue +57 -0
- package/src/components/layout/header.vue +56 -0
- package/src/components/layout/index.ts +28 -0
- package/src/components/layout/main.vue +36 -0
- package/src/components/layout/types.ts +74 -0
- package/src/components/table/index.ts +16 -0
- package/src/components/table/table-column.vue +69 -0
- package/src/components/table/table.vue +354 -0
- package/src/components/tips/index.ts +12 -0
- package/src/components/tips/tips.test.ts +96 -0
- package/src/components/tips/tips.vue +206 -0
- package/src/components/tips/types.ts +56 -0
- package/src/components/tooltip/index.ts +8 -0
- package/src/components/tooltip/tooltip.test.ts +187 -0
- package/src/components/tooltip/tooltip.vue +261 -0
- package/src/components/tooltip/types.ts +60 -0
- package/src/hooks/useForm.ts +233 -0
- package/src/hooks/useTable.ts +153 -0
- package/src/index.ts +48 -0
- package/src/styles/main.scss +6 -0
- package/src/styles/mixins.scss +48 -0
- package/src/styles/reset.scss +49 -0
- package/src/styles/variables.scss +137 -0
- package/src/types/component.ts +9 -0
- package/src/types/form.ts +149 -0
- package/src/types/global.d.ts +49 -0
- package/src/types/grid.ts +76 -0
- package/src/types/index.ts +23 -0
- package/src/types/table.ts +181 -0
- package/src/types/tooltip.ts +44 -0
- package/src/utils/auto-import.ts +41 -0
- package/src/utils/index.ts +2 -0
- package/src/utils/install.ts +20 -0
- package/src/utils/useNamespace.ts +29 -0
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import type { RuleItem, ValidateError } from 'async-validator'
|
|
2
|
+
|
|
3
|
+
export type { RuleItem, ValidateError }
|
|
4
|
+
|
|
5
|
+
export type FormLabelPosition = 'left' | 'top'
|
|
6
|
+
|
|
7
|
+
export interface FormProps<T = Record<string, any>> {
|
|
8
|
+
/**
|
|
9
|
+
* 表单数据模型
|
|
10
|
+
*/
|
|
11
|
+
model?: T
|
|
12
|
+
/**
|
|
13
|
+
* 表单验证规则
|
|
14
|
+
*/
|
|
15
|
+
rules?: Record<keyof T, RuleItem | RuleItem[]>
|
|
16
|
+
/**
|
|
17
|
+
* 标签宽度
|
|
18
|
+
*/
|
|
19
|
+
labelWidth?: string | number
|
|
20
|
+
/**
|
|
21
|
+
* 标签位置
|
|
22
|
+
*/
|
|
23
|
+
labelPosition?: FormLabelPosition
|
|
24
|
+
/**
|
|
25
|
+
* 是否为行内表单
|
|
26
|
+
*/
|
|
27
|
+
inline?: boolean
|
|
28
|
+
/**
|
|
29
|
+
* 是否显示必填星号
|
|
30
|
+
*/
|
|
31
|
+
hideRequiredAsterisk?: boolean
|
|
32
|
+
/**
|
|
33
|
+
* 必填符号
|
|
34
|
+
*/
|
|
35
|
+
requiredSymbol?: string
|
|
36
|
+
/**
|
|
37
|
+
* 是否显示状态图标
|
|
38
|
+
*/
|
|
39
|
+
statusIcon?: boolean
|
|
40
|
+
/**
|
|
41
|
+
* 自定义类名
|
|
42
|
+
*/
|
|
43
|
+
class?: string
|
|
44
|
+
/**
|
|
45
|
+
* 自定义样式
|
|
46
|
+
*/
|
|
47
|
+
style?: string | object
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export interface FormEmits {
|
|
51
|
+
/**
|
|
52
|
+
* 表单提交事件
|
|
53
|
+
*/
|
|
54
|
+
(e: 'submit', evt: Event): void
|
|
55
|
+
/**
|
|
56
|
+
* 表单重置事件
|
|
57
|
+
*/
|
|
58
|
+
(e: 'reset'): void
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export interface FormInstance<T = Record<string, any>> {
|
|
62
|
+
/**
|
|
63
|
+
* 验证表单
|
|
64
|
+
*/
|
|
65
|
+
validate: (callback?: (valid: boolean, errors?: ValidateError[]) => void) => Promise<boolean>
|
|
66
|
+
/**
|
|
67
|
+
* 验证指定字段
|
|
68
|
+
*/
|
|
69
|
+
validateField: (props: keyof T | Array<keyof T>, callback?: (error: ValidateError | null, fields?: Record<string, ValidateError[]>) => void) => Promise<boolean>
|
|
70
|
+
/**
|
|
71
|
+
* 重置表单
|
|
72
|
+
*/
|
|
73
|
+
resetFields: () => void
|
|
74
|
+
/**
|
|
75
|
+
* 清除验证状态
|
|
76
|
+
*/
|
|
77
|
+
clearValidate: (props?: keyof T | Array<keyof T>) => void
|
|
78
|
+
/**
|
|
79
|
+
* 滚动到指定字段
|
|
80
|
+
*/
|
|
81
|
+
scrollToField: (prop: keyof T) => void
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export interface FormItemProps {
|
|
85
|
+
/**
|
|
86
|
+
* 字段名
|
|
87
|
+
*/
|
|
88
|
+
prop?: string
|
|
89
|
+
/**
|
|
90
|
+
* 标签文本
|
|
91
|
+
*/
|
|
92
|
+
label?: string
|
|
93
|
+
/**
|
|
94
|
+
* 标签宽度
|
|
95
|
+
*/
|
|
96
|
+
labelWidth?: string | number
|
|
97
|
+
/**
|
|
98
|
+
* 是否必填
|
|
99
|
+
*/
|
|
100
|
+
required?: boolean
|
|
101
|
+
/**
|
|
102
|
+
* 错误信息
|
|
103
|
+
*/
|
|
104
|
+
error?: string
|
|
105
|
+
/**
|
|
106
|
+
* 自定义类名
|
|
107
|
+
*/
|
|
108
|
+
class?: string
|
|
109
|
+
/**
|
|
110
|
+
* 自定义样式
|
|
111
|
+
*/
|
|
112
|
+
style?: string | object
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
export interface FormItemEmits {
|
|
116
|
+
/**
|
|
117
|
+
* 验证状态变化事件
|
|
118
|
+
*/
|
|
119
|
+
(e: 'validate', valid: boolean, errorMessage: string): void
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
export interface FormItemInstance {
|
|
123
|
+
/**
|
|
124
|
+
* 验证字段
|
|
125
|
+
*/
|
|
126
|
+
validate: (trigger?: string, callback?: (valid: boolean, errorMessage: string) => void) => Promise<boolean>
|
|
127
|
+
/**
|
|
128
|
+
* 重置字段
|
|
129
|
+
*/
|
|
130
|
+
resetField: () => void
|
|
131
|
+
/**
|
|
132
|
+
* 清除验证状态
|
|
133
|
+
*/
|
|
134
|
+
clearValidate: () => void
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
export interface FormContext<T = Record<string, any>> {
|
|
138
|
+
model: T
|
|
139
|
+
rules: Record<keyof T, RuleItem | RuleItem[]>
|
|
140
|
+
labelWidth: string | number
|
|
141
|
+
labelPosition: FormLabelPosition
|
|
142
|
+
inline: boolean
|
|
143
|
+
hideRequiredAsterisk: boolean
|
|
144
|
+
requiredSymbol: string
|
|
145
|
+
statusIcon: boolean
|
|
146
|
+
form: FormInstance<T>
|
|
147
|
+
addFormItem: (formItem: FormItemInstance) => void
|
|
148
|
+
removeFormItem: (formItem: FormItemInstance) => void
|
|
149
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { App } from 'vue'
|
|
2
|
+
import type {
|
|
3
|
+
FButton,
|
|
4
|
+
FireRow,
|
|
5
|
+
FireCol,
|
|
6
|
+
FireContainer,
|
|
7
|
+
FireHeader,
|
|
8
|
+
FireAside,
|
|
9
|
+
FireMain,
|
|
10
|
+
FireFooter,
|
|
11
|
+
FireTooltip,
|
|
12
|
+
FireTips,
|
|
13
|
+
FireInput,
|
|
14
|
+
FireForm,
|
|
15
|
+
FireFormItem,
|
|
16
|
+
FireTable,
|
|
17
|
+
FireTableColumn
|
|
18
|
+
} from '../components'
|
|
19
|
+
|
|
20
|
+
// 全局组件类型声明
|
|
21
|
+
declare module '@vue/runtime-core' {
|
|
22
|
+
export interface GlobalComponents {
|
|
23
|
+
// Button 组件
|
|
24
|
+
FButton: typeof FButton
|
|
25
|
+
// Grid 组件
|
|
26
|
+
FireRow: typeof FireRow
|
|
27
|
+
FireCol: typeof FireCol
|
|
28
|
+
// Layout 组件
|
|
29
|
+
FireContainer: typeof FireContainer
|
|
30
|
+
FireHeader: typeof FireHeader
|
|
31
|
+
FireAside: typeof FireAside
|
|
32
|
+
FireMain: typeof FireMain
|
|
33
|
+
FireFooter: typeof FireFooter
|
|
34
|
+
// Tooltip 组件
|
|
35
|
+
FireTooltip: typeof FireTooltip
|
|
36
|
+
// Tips 组件
|
|
37
|
+
FireTips: typeof FireTips
|
|
38
|
+
// Input 组件
|
|
39
|
+
FireInput: typeof FireInput
|
|
40
|
+
// Form 组件
|
|
41
|
+
FireForm: typeof FireForm
|
|
42
|
+
FireFormItem: typeof FireFormItem
|
|
43
|
+
// Table 组件
|
|
44
|
+
FireTable: typeof FireTable
|
|
45
|
+
FireTableColumn: typeof FireTableColumn
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export {}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file 栅格系统类型定义
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
export interface ResponsiveProps {
|
|
6
|
+
/**
|
|
7
|
+
* 占列数
|
|
8
|
+
*/
|
|
9
|
+
span?: number
|
|
10
|
+
/**
|
|
11
|
+
* 偏移量
|
|
12
|
+
*/
|
|
13
|
+
offset?: number
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export interface RowProps {
|
|
17
|
+
/**
|
|
18
|
+
* 栅格间距
|
|
19
|
+
*/
|
|
20
|
+
gutter?: number | [number, number]
|
|
21
|
+
/**
|
|
22
|
+
* 水平对齐方式
|
|
23
|
+
*/
|
|
24
|
+
justify?: 'start' | 'end' | 'center' | 'space-between' | 'space-around' | 'space-evenly'
|
|
25
|
+
/**
|
|
26
|
+
* 垂直对齐方式
|
|
27
|
+
*/
|
|
28
|
+
align?: 'top' | 'middle' | 'bottom'
|
|
29
|
+
/**
|
|
30
|
+
* 自定义类名
|
|
31
|
+
*/
|
|
32
|
+
class?: string
|
|
33
|
+
/**
|
|
34
|
+
* 自定义样式
|
|
35
|
+
*/
|
|
36
|
+
style?: string | object
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export interface ColProps {
|
|
40
|
+
/**
|
|
41
|
+
* 占列数
|
|
42
|
+
*/
|
|
43
|
+
span?: number
|
|
44
|
+
/**
|
|
45
|
+
* 偏移量
|
|
46
|
+
*/
|
|
47
|
+
offset?: number
|
|
48
|
+
/**
|
|
49
|
+
* 超小屏幕响应式配置
|
|
50
|
+
*/
|
|
51
|
+
xs?: number | ResponsiveProps
|
|
52
|
+
/**
|
|
53
|
+
* 小屏幕响应式配置
|
|
54
|
+
*/
|
|
55
|
+
sm?: number | ResponsiveProps
|
|
56
|
+
/**
|
|
57
|
+
* 中等屏幕响应式配置
|
|
58
|
+
*/
|
|
59
|
+
md?: number | ResponsiveProps
|
|
60
|
+
/**
|
|
61
|
+
* 大屏幕响应式配置
|
|
62
|
+
*/
|
|
63
|
+
lg?: number | ResponsiveProps
|
|
64
|
+
/**
|
|
65
|
+
* 超大屏幕响应式配置
|
|
66
|
+
*/
|
|
67
|
+
xl?: number | ResponsiveProps
|
|
68
|
+
/**
|
|
69
|
+
* 自定义类名
|
|
70
|
+
*/
|
|
71
|
+
class?: string
|
|
72
|
+
/**
|
|
73
|
+
* 自定义样式
|
|
74
|
+
*/
|
|
75
|
+
style?: string | object
|
|
76
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// Button 组件
|
|
2
|
+
export type { ButtonProps, ButtonEmits, ButtonSlots } from '../components/button/types'
|
|
3
|
+
|
|
4
|
+
// Grid 组件
|
|
5
|
+
export type { RowProps, ColProps, ResponsiveProps } from '../components/grid/types'
|
|
6
|
+
|
|
7
|
+
// Layout 组件
|
|
8
|
+
export type { ContainerProps, HeaderProps, AsideProps, MainProps, FooterProps } from '../components/layout/types'
|
|
9
|
+
|
|
10
|
+
// Tooltip 组件
|
|
11
|
+
export type { TooltipProps, TooltipEmits, TooltipPlacement, TooltipTrigger } from './tooltip'
|
|
12
|
+
|
|
13
|
+
// Tips 组件
|
|
14
|
+
export type { TipsProps, TipsEmits, TipsSlots } from '../components/tips/types'
|
|
15
|
+
|
|
16
|
+
// Input 组件
|
|
17
|
+
export type { InputProps, InputEmits, InputSlots } from '../components/input/types'
|
|
18
|
+
|
|
19
|
+
// Form 组件
|
|
20
|
+
export type { FormProps, FormEmits, FormInstance, FormItemProps, FormItemEmits, FormItemInstance } from './form'
|
|
21
|
+
|
|
22
|
+
// Table 组件
|
|
23
|
+
export type { TableProps, TableEmits, TableInstance, TableColumnProps, TableColumnSlots } from './table'
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
export type TableColumnFixed = 'left' | 'right'
|
|
2
|
+
|
|
3
|
+
export type TableColumnSortOrder = 'ascending' | 'descending' | null
|
|
4
|
+
|
|
5
|
+
export interface TableColumnFilterOption {
|
|
6
|
+
text: string
|
|
7
|
+
value: string | number
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface TableColumnProps {
|
|
11
|
+
/**
|
|
12
|
+
* 列字段名
|
|
13
|
+
*/
|
|
14
|
+
prop?: string
|
|
15
|
+
/**
|
|
16
|
+
* 列标题
|
|
17
|
+
*/
|
|
18
|
+
label?: string
|
|
19
|
+
/**
|
|
20
|
+
* 列宽度
|
|
21
|
+
*/
|
|
22
|
+
width?: string | number
|
|
23
|
+
/**
|
|
24
|
+
* 是否固定列
|
|
25
|
+
*/
|
|
26
|
+
fixed?: TableColumnFixed
|
|
27
|
+
/**
|
|
28
|
+
* 是否可排序
|
|
29
|
+
*/
|
|
30
|
+
sortable?: boolean
|
|
31
|
+
/**
|
|
32
|
+
* 排序方法
|
|
33
|
+
*/
|
|
34
|
+
sortMethod?: (a: any, b: any) => number
|
|
35
|
+
/**
|
|
36
|
+
* 排序顺序
|
|
37
|
+
*/
|
|
38
|
+
sortOrder?: TableColumnSortOrder
|
|
39
|
+
/**
|
|
40
|
+
* 过滤选项
|
|
41
|
+
*/
|
|
42
|
+
filters?: TableColumnFilterOption[]
|
|
43
|
+
/**
|
|
44
|
+
* 过滤方法
|
|
45
|
+
*/
|
|
46
|
+
filterMethod?: (value: string | number, row: any) => boolean
|
|
47
|
+
/**
|
|
48
|
+
* 过滤值
|
|
49
|
+
*/
|
|
50
|
+
filteredValue?: Array<string | number>
|
|
51
|
+
/**
|
|
52
|
+
* 自定义类名
|
|
53
|
+
*/
|
|
54
|
+
class?: string
|
|
55
|
+
/**
|
|
56
|
+
* 自定义样式
|
|
57
|
+
*/
|
|
58
|
+
style?: string | object
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export interface TableColumnSlots {
|
|
62
|
+
/**
|
|
63
|
+
* 列标题
|
|
64
|
+
*/
|
|
65
|
+
header?: (props: { column: TableColumnProps }) => any
|
|
66
|
+
/**
|
|
67
|
+
* 列内容
|
|
68
|
+
*/
|
|
69
|
+
default?: (props: { row: any; column: TableColumnProps; $index: number }) => any
|
|
70
|
+
/**
|
|
71
|
+
* 排序图标
|
|
72
|
+
*/
|
|
73
|
+
sortIcon?: (props: { sortOrder: TableColumnSortOrder }) => any
|
|
74
|
+
/**
|
|
75
|
+
* 过滤图标
|
|
76
|
+
*/
|
|
77
|
+
filterIcon?: (props: { filtered: boolean }) => any
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export interface TableProps<T = any> {
|
|
81
|
+
/**
|
|
82
|
+
* 表格数据
|
|
83
|
+
*/
|
|
84
|
+
data?: T[]
|
|
85
|
+
/**
|
|
86
|
+
* 是否显示边框
|
|
87
|
+
*/
|
|
88
|
+
border?: boolean
|
|
89
|
+
/**
|
|
90
|
+
* 是否显示斑马纹
|
|
91
|
+
*/
|
|
92
|
+
stripe?: boolean
|
|
93
|
+
/**
|
|
94
|
+
* 是否高亮当前行
|
|
95
|
+
*/
|
|
96
|
+
highlightCurrentRow?: boolean
|
|
97
|
+
/**
|
|
98
|
+
* 当前行索引
|
|
99
|
+
*/
|
|
100
|
+
currentRowKey?: string | number
|
|
101
|
+
/**
|
|
102
|
+
* 表格高度
|
|
103
|
+
*/
|
|
104
|
+
height?: string | number
|
|
105
|
+
/**
|
|
106
|
+
* 表格最大高度
|
|
107
|
+
*/
|
|
108
|
+
maxHeight?: string | number
|
|
109
|
+
/**
|
|
110
|
+
* 自定义类名
|
|
111
|
+
*/
|
|
112
|
+
class?: string
|
|
113
|
+
/**
|
|
114
|
+
* 自定义样式
|
|
115
|
+
*/
|
|
116
|
+
style?: string | object
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
export interface TableEmits<T = any> {
|
|
120
|
+
/**
|
|
121
|
+
* 选择行事件
|
|
122
|
+
*/
|
|
123
|
+
(e: 'row-click', row: T, event: Event): void
|
|
124
|
+
/**
|
|
125
|
+
* 排序事件
|
|
126
|
+
*/
|
|
127
|
+
(e: 'sort-change', column: TableColumnProps, order: TableColumnSortOrder): void
|
|
128
|
+
/**
|
|
129
|
+
* 过滤事件
|
|
130
|
+
*/
|
|
131
|
+
(e: 'filter-change', filters: Record<string, Array<string | number>>): void
|
|
132
|
+
/**
|
|
133
|
+
* 当前行变化事件
|
|
134
|
+
*/
|
|
135
|
+
(e: 'current-change', currentRow: T | null, oldCurrentRow: T | null): void
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
export interface TableInstance<T = any> {
|
|
139
|
+
/**
|
|
140
|
+
* 清空排序
|
|
141
|
+
*/
|
|
142
|
+
clearSort: () => void
|
|
143
|
+
/**
|
|
144
|
+
* 清空过滤
|
|
145
|
+
*/
|
|
146
|
+
clearFilter: (columnKey?: string | string[]) => void
|
|
147
|
+
/**
|
|
148
|
+
* 设置当前行
|
|
149
|
+
*/
|
|
150
|
+
setCurrentRow: (row: T | null) => void
|
|
151
|
+
/**
|
|
152
|
+
* 刷新表格
|
|
153
|
+
*/
|
|
154
|
+
doLayout: () => void
|
|
155
|
+
/**
|
|
156
|
+
* 获取所有行
|
|
157
|
+
*/
|
|
158
|
+
getRows: () => T[]
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
export interface TableColumnInstance {
|
|
162
|
+
/**
|
|
163
|
+
* 列配置
|
|
164
|
+
*/
|
|
165
|
+
column: TableColumnProps
|
|
166
|
+
/**
|
|
167
|
+
* 更新列配置
|
|
168
|
+
*/
|
|
169
|
+
updateColumn: (props: Partial<TableColumnProps>) => void
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
export interface TableContext<T = any> {
|
|
173
|
+
data: T[]
|
|
174
|
+
border: boolean
|
|
175
|
+
stripe: boolean
|
|
176
|
+
highlightCurrentRow: boolean
|
|
177
|
+
currentRowKey: string | number
|
|
178
|
+
table: TableInstance<T>
|
|
179
|
+
addColumn: (column: TableColumnInstance) => void
|
|
180
|
+
removeColumn: (column: TableColumnInstance) => void
|
|
181
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Tooltip 组件类型定义
|
|
3
|
+
* @description 定义 Tooltip 组件的 Props、Emits 接口
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Tooltip 位置类型
|
|
8
|
+
*/
|
|
9
|
+
export type TooltipPlacement = 'top' | 'bottom' | 'left' | 'right'
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Tooltip 触发方式类型
|
|
13
|
+
*/
|
|
14
|
+
export type TooltipTrigger = 'hover' | 'click' | 'focus'
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Tooltip 组件 Props 接口
|
|
18
|
+
*/
|
|
19
|
+
export interface TooltipProps {
|
|
20
|
+
/** 提示内容 */
|
|
21
|
+
content?: string
|
|
22
|
+
/** 位置 */
|
|
23
|
+
placement?: TooltipPlacement
|
|
24
|
+
/** 触发方式 */
|
|
25
|
+
trigger?: TooltipTrigger
|
|
26
|
+
/** 是否禁用 */
|
|
27
|
+
disabled?: boolean
|
|
28
|
+
/** 是否可见(受控模式) */
|
|
29
|
+
visible?: boolean
|
|
30
|
+
/** 偏移量 */
|
|
31
|
+
offset?: number
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Tooltip 组件 Emits 接口
|
|
36
|
+
*/
|
|
37
|
+
export interface TooltipEmits {
|
|
38
|
+
/** 更新可见状态 */
|
|
39
|
+
(e: 'update:visible', value: boolean): void
|
|
40
|
+
/** 显示事件 */
|
|
41
|
+
(e: 'show'): void
|
|
42
|
+
/** 隐藏事件 */
|
|
43
|
+
(e: 'hide'): void
|
|
44
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file 自动导入配置
|
|
3
|
+
* @description 用于 unplugin-vue-components 的组件自动注册
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
// 暂时移除类型导入,避免依赖问题
|
|
7
|
+
type ComponentResolver = (name: string) => { name: string; from: string } | undefined
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* FireUI 组件解析器
|
|
11
|
+
* @returns 组件解析器
|
|
12
|
+
*/
|
|
13
|
+
export const FireUIRegistrar: ComponentResolver = (name: string) => {
|
|
14
|
+
if (name.startsWith('F') || name.startsWith('Fire')) {
|
|
15
|
+
return {
|
|
16
|
+
name,
|
|
17
|
+
from: 'fireui'
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* 组件列表
|
|
24
|
+
*/
|
|
25
|
+
export const components = [
|
|
26
|
+
'FButton',
|
|
27
|
+
'FireRow',
|
|
28
|
+
'FireCol',
|
|
29
|
+
'FireContainer',
|
|
30
|
+
'FireHeader',
|
|
31
|
+
'FireAside',
|
|
32
|
+
'FireMain',
|
|
33
|
+
'FireFooter',
|
|
34
|
+
'FireTooltip',
|
|
35
|
+
'FireTips',
|
|
36
|
+
'FireInput',
|
|
37
|
+
'FireForm',
|
|
38
|
+
'FireFormItem',
|
|
39
|
+
'FireTable',
|
|
40
|
+
'FireTableColumn'
|
|
41
|
+
]
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { App, Component } from 'vue'
|
|
2
|
+
|
|
3
|
+
export function withInstall<T>(component: T & { name?: string }) {
|
|
4
|
+
const comp = component as any
|
|
5
|
+
comp.install = (app: App) => {
|
|
6
|
+
app.component(comp.name || comp.__name, component)
|
|
7
|
+
}
|
|
8
|
+
return component as T & { install: (app: App) => void }
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export function registerComponent(app: App, component: Component) {
|
|
12
|
+
const comp = component as any
|
|
13
|
+
app.component(comp.name || comp.__name, component)
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export function registerComponents(app: App, components: Component[]) {
|
|
17
|
+
components.forEach((component) => {
|
|
18
|
+
registerComponent(app, component)
|
|
19
|
+
})
|
|
20
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { computed } from 'vue'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* 生成 BEM 命名空间
|
|
5
|
+
* @param block 组件名称
|
|
6
|
+
* @returns BEM 命名空间对象
|
|
7
|
+
*/
|
|
8
|
+
export function useNamespace(block: string) {
|
|
9
|
+
const b = computed(() => `fire-${block}`)
|
|
10
|
+
|
|
11
|
+
const e = (element: string) => {
|
|
12
|
+
return element ? `${b.value}__${element}` : b.value
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const m = (modifier: string) => {
|
|
16
|
+
return modifier ? `${b.value}--${modifier}` : b.value
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const em = (element: string, modifier: string) => {
|
|
20
|
+
return `${e(element)}--${modifier}`
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
return {
|
|
24
|
+
b: b.value,
|
|
25
|
+
e,
|
|
26
|
+
m,
|
|
27
|
+
em
|
|
28
|
+
}
|
|
29
|
+
}
|