gi-component 0.0.18 → 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "gi-component",
3
3
  "type": "module",
4
- "version": "0.0.18",
4
+ "version": "0.0.20",
5
5
  "description": "Vue3中基于Element Plus二次封装基础组件库",
6
6
  "author": "lin",
7
7
  "license": "MIT",
@@ -0,0 +1,5 @@
1
+ import Dot from './src/dot.vue'
2
+
3
+ export type DotInstance = InstanceType<typeof Dot>
4
+ export * from './src/type'
5
+ export default Dot
@@ -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>
@@ -0,0 +1,6 @@
1
+ export interface DotProps {
2
+ type?: 'circle' | 'square'
3
+ size?: number
4
+ color?: string | 'primary' | 'success' | 'warning' | 'danger' | 'info'
5
+ animation?: boolean
6
+ }
@@ -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