gi-component 0.0.19 → 0.0.20
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/package.json +1 -1
- package/packages/components/button/src/button.vue +1 -3
- package/packages/components/dot/index.ts +5 -0
- package/packages/components/dot/src/dot.vue +107 -0
- package/packages/components/dot/src/type.ts +6 -0
- package/packages/components.d.ts +1 -0
- package/packages/index.ts +3 -0
package/package.json
CHANGED
|
@@ -17,11 +17,9 @@ import {
|
|
|
17
17
|
Upload
|
|
18
18
|
} from '@element-plus/icons-vue'
|
|
19
19
|
import { ElButton } from 'element-plus'
|
|
20
|
-
import { computed,
|
|
20
|
+
import { computed, useAttrs } from 'vue'
|
|
21
21
|
import { useBemClass } from '../../../hooks'
|
|
22
22
|
|
|
23
|
-
defineOptions({ components: { ElButton } })
|
|
24
|
-
|
|
25
23
|
const props = withDefaults(defineProps<ButtonProps>(), {
|
|
26
24
|
type: ''
|
|
27
25
|
})
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<span :class="getClass" :style="getStyle"></span>
|
|
3
|
+
</template>
|
|
4
|
+
|
|
5
|
+
<script setup lang="ts">
|
|
6
|
+
import type { CSSProperties } from 'vue'
|
|
7
|
+
import type { DotProps } from './type.ts'
|
|
8
|
+
import { computed } from 'vue'
|
|
9
|
+
import { useBemClass } from '../../../hooks'
|
|
10
|
+
|
|
11
|
+
const props = withDefaults(defineProps<DotProps>(), {
|
|
12
|
+
type: 'circle',
|
|
13
|
+
size: 7,
|
|
14
|
+
color: 'primary'
|
|
15
|
+
})
|
|
16
|
+
|
|
17
|
+
const { b } = useBemClass()
|
|
18
|
+
|
|
19
|
+
const getClass = computed(() => {
|
|
20
|
+
const arr = [b('dot'), b(`dot--${props.type}`)]
|
|
21
|
+
if (['primary', 'success', 'danger', 'warning', 'info'].includes(props.color)) {
|
|
22
|
+
arr.push(b(`dot--${props.color}`))
|
|
23
|
+
}
|
|
24
|
+
if (props.animation) {
|
|
25
|
+
arr.push(b('dot--animation'))
|
|
26
|
+
}
|
|
27
|
+
return arr.join(' ')
|
|
28
|
+
})
|
|
29
|
+
|
|
30
|
+
const getStyle = computed(() => {
|
|
31
|
+
const obj: CSSProperties = {}
|
|
32
|
+
if (props.color && !['primary', 'success', 'danger', 'warning', 'info'].includes(props.color)) {
|
|
33
|
+
obj.backgroundColor = props.color
|
|
34
|
+
}
|
|
35
|
+
if (props.size) {
|
|
36
|
+
obj.width = `${props.size}px`
|
|
37
|
+
obj.height = `${props.size}px`
|
|
38
|
+
}
|
|
39
|
+
return obj
|
|
40
|
+
})
|
|
41
|
+
</script>
|
|
42
|
+
|
|
43
|
+
<style scoped lang="scss">
|
|
44
|
+
@use '../../../styles/var.scss' as a;
|
|
45
|
+
|
|
46
|
+
.#{a.$prefix}-dot {
|
|
47
|
+
display: inline-flex;
|
|
48
|
+
border-radius: 100px;
|
|
49
|
+
background-color: var(--el-color-info);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.#{a.$prefix}-dot--square {
|
|
53
|
+
border-radius: 0;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.#{a.$prefix}-dot--primary {
|
|
57
|
+
background-color: var(--el-color-primary);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.#{a.$prefix}-dot--success {
|
|
61
|
+
background-color: var(--el-color-success);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.#{a.$prefix}-dot--danger {
|
|
65
|
+
background-color: var(--el-color-danger);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.#{a.$prefix}-dot--warning {
|
|
69
|
+
background-color: var(--el-color-warning);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.#{a.$prefix}-dot--info {
|
|
73
|
+
background-color: var(--el-color-info);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.#{a.$prefix}-dot--animation {
|
|
77
|
+
position: relative;
|
|
78
|
+
|
|
79
|
+
&::after {
|
|
80
|
+
position: absolute;
|
|
81
|
+
top: 0;
|
|
82
|
+
left: 0;
|
|
83
|
+
width: 100%;
|
|
84
|
+
height: 100%;
|
|
85
|
+
content: '';
|
|
86
|
+
background: inherit;
|
|
87
|
+
border-radius: 50%;
|
|
88
|
+
animation: dot-animation 1.2s ease-in-out infinite;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
@keyframes dot-animation {
|
|
93
|
+
0% {
|
|
94
|
+
opacity: 1;
|
|
95
|
+
transform: scale(0.5);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
30% {
|
|
99
|
+
opacity: 0.7;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
100% {
|
|
103
|
+
opacity: 0;
|
|
104
|
+
transform: scale(2.5);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
</style>
|
package/packages/components.d.ts
CHANGED
|
@@ -12,6 +12,7 @@ declare module 'vue' {
|
|
|
12
12
|
GiCard: typeof import('./components/card/src/card.vue')['default']
|
|
13
13
|
GiDialog: typeof import('./components/dialog/src/dialog.vue')['default']
|
|
14
14
|
GiDrawer: typeof import('./components/drawer/src/drawer.vue')['default']
|
|
15
|
+
GiDot: typeof import('./components/dot/src/dot.vue')['default']
|
|
15
16
|
GiEditTable: typeof import('./components/edit-table/src/edit-table.vue')['default']
|
|
16
17
|
GiForm: typeof import('./components/form/src/form.vue')['default']
|
|
17
18
|
GiGrid: typeof import('./components/grid/src/grid.vue')['default']
|
package/packages/index.ts
CHANGED
|
@@ -3,6 +3,7 @@ import type { App } from 'vue'
|
|
|
3
3
|
import Button from './components/button'
|
|
4
4
|
import Card from './components/card'
|
|
5
5
|
import Dialog from './components/dialog'
|
|
6
|
+
import Dot from './components/dot'
|
|
6
7
|
import Drawer from './components/drawer'
|
|
7
8
|
import EditTable from './components/edit-table'
|
|
8
9
|
import Form from './components/form'
|
|
@@ -29,6 +30,7 @@ const components = {
|
|
|
29
30
|
Button,
|
|
30
31
|
Card,
|
|
31
32
|
Drawer,
|
|
33
|
+
Dot,
|
|
32
34
|
Tabs,
|
|
33
35
|
InputGroup,
|
|
34
36
|
InputSearch,
|
|
@@ -46,6 +48,7 @@ const components = {
|
|
|
46
48
|
export const GiButton: typeof Button = Button
|
|
47
49
|
export const GiCard: typeof Card = Card
|
|
48
50
|
export const GiDrawer: typeof Drawer = Drawer
|
|
51
|
+
export const GiDot: typeof Dot = Dot
|
|
49
52
|
export const GiTabs: typeof Tabs = Tabs
|
|
50
53
|
export const GiInputGroup: typeof InputGroup = InputGroup
|
|
51
54
|
export const GiInputSearch: typeof InputSearch = InputSearch
|