its_ui_vite 0.0.5 → 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/package.json +1 -1
- package/src/components/CAlert.vue +107 -137
- package/src/components/CButton.vue +23 -58
- package/src/components/CCheckbox.vue +25 -59
- package/src/components/CInput.vue +28 -57
- package/src/components/CPopup.vue +7 -10
- package/src/components/CSelect.vue +224 -275
- package/src/components/CTabs.vue +140 -170
- package/src/components/CTooltip.vue +68 -89
- package/src/pages/index.vue +10 -10
package/package.json
CHANGED
|
@@ -19,153 +19,123 @@
|
|
|
19
19
|
</div>
|
|
20
20
|
</template>
|
|
21
21
|
|
|
22
|
-
<script>
|
|
23
|
-
import {
|
|
22
|
+
<script setup lang="ts">
|
|
23
|
+
import {
|
|
24
|
+
ref,
|
|
25
|
+
watch,
|
|
26
|
+
computed,
|
|
27
|
+
onMounted,
|
|
28
|
+
onUnmounted
|
|
29
|
+
} from 'vue'
|
|
30
|
+
|
|
24
31
|
import CIcon from './CIcons/index.vue'
|
|
25
32
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
33
|
+
type TProp = {
|
|
34
|
+
liveTime?: number,
|
|
35
|
+
variant?: 'notification' | 'success' | 'error',
|
|
36
|
+
width?: string,
|
|
37
|
+
text?: string,
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const props = withDefaults(defineProps<TProp>(), {
|
|
41
|
+
liveTime: 10000,
|
|
42
|
+
variant: 'notification',
|
|
43
|
+
width: 'auto',
|
|
44
|
+
text: ''
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
onMounted(addListener)
|
|
48
|
+
onUnmounted(removeListener)
|
|
49
|
+
|
|
50
|
+
const iconId = computed(() => {
|
|
51
|
+
const iconsIds = {
|
|
52
|
+
notification: 'bell',
|
|
53
|
+
success: 'success',
|
|
54
|
+
error: 'error',
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
return iconsIds[props.variant]
|
|
58
|
+
})
|
|
59
|
+
|
|
60
|
+
let root = ref(null)
|
|
44
61
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
62
|
+
let isLockLiveTime = false,
|
|
63
|
+
isShow = ref(true),
|
|
64
|
+
isFade = ref(false)
|
|
48
65
|
|
|
49
|
-
|
|
50
|
-
|
|
66
|
+
const timeFade = 5000
|
|
67
|
+
const classes = {
|
|
68
|
+
root: 'c-alert',
|
|
69
|
+
}
|
|
51
70
|
|
|
52
|
-
|
|
53
|
-
|
|
71
|
+
type TTimers = {
|
|
72
|
+
live: ReturnType<typeof setTimeout>,
|
|
73
|
+
fade: ReturnType<typeof setTimeout>,
|
|
74
|
+
}
|
|
54
75
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
76
|
+
const timers: TTimers = {
|
|
77
|
+
live: 0,
|
|
78
|
+
fade: 0,
|
|
79
|
+
}
|
|
58
80
|
|
|
59
|
-
|
|
60
|
-
|
|
81
|
+
watch(props, updateLiveTime, {
|
|
82
|
+
deep: true,
|
|
83
|
+
immediate: true,
|
|
84
|
+
})
|
|
61
85
|
|
|
62
|
-
|
|
63
|
-
|
|
86
|
+
function close() {
|
|
87
|
+
isShow.value = false
|
|
88
|
+
isLockLiveTime = true
|
|
89
|
+
}
|
|
64
90
|
|
|
65
|
-
|
|
66
|
-
|
|
91
|
+
function updateLiveTime() {
|
|
92
|
+
if (!isShow.value) return
|
|
67
93
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
* @param {MouseEvent} evt
|
|
114
|
-
*/
|
|
115
|
-
handleMouseout(evt) {
|
|
116
|
-
const tooltipTarget = evt.target.closest(`.${this.classes.root}`)
|
|
117
|
-
|
|
118
|
-
if (tooltipTarget !== this.$refs.root) return
|
|
119
|
-
|
|
120
|
-
this.isLockLiveTime = false
|
|
121
|
-
this.updateLiveTime()
|
|
122
|
-
},
|
|
123
|
-
|
|
124
|
-
addListener() {
|
|
125
|
-
document.body.addEventListener('mouseover', this.handleMouseover)
|
|
126
|
-
document.body.addEventListener('mouseout', this.handleMouseout)
|
|
127
|
-
},
|
|
128
|
-
|
|
129
|
-
removeListener() {
|
|
130
|
-
document.body.removeEventListener('mouseover', this.handleMouseover)
|
|
131
|
-
document.body.removeEventListener('mouseout', this.handleMouseout)
|
|
132
|
-
},
|
|
133
|
-
},
|
|
134
|
-
|
|
135
|
-
mounted() {
|
|
136
|
-
this.addListener()
|
|
137
|
-
},
|
|
138
|
-
|
|
139
|
-
beforeDestroy() {
|
|
140
|
-
this.removeListener()
|
|
141
|
-
},
|
|
142
|
-
|
|
143
|
-
watch: {
|
|
144
|
-
$props: {
|
|
145
|
-
deep: true,
|
|
146
|
-
immediate: true,
|
|
147
|
-
|
|
148
|
-
handler(newWal) {
|
|
149
|
-
this.updateLiveTime()
|
|
150
|
-
},
|
|
151
|
-
},
|
|
152
|
-
},
|
|
153
|
-
|
|
154
|
-
computed: {
|
|
155
|
-
iconId() {
|
|
156
|
-
const iconsIds = {
|
|
157
|
-
notification: 'bell',
|
|
158
|
-
success: 'success',
|
|
159
|
-
error: 'error',
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
return iconsIds[this.variant]
|
|
163
|
-
},
|
|
164
|
-
},
|
|
165
|
-
|
|
166
|
-
components: {
|
|
167
|
-
CIcon,
|
|
168
|
-
},
|
|
94
|
+
isShow.value = true
|
|
95
|
+
isFade.value = false
|
|
96
|
+
|
|
97
|
+
clearTimeout(timers.fade)
|
|
98
|
+
clearTimeout(timers.live)
|
|
99
|
+
|
|
100
|
+
if (isLockLiveTime) return
|
|
101
|
+
|
|
102
|
+
timers.fade = setTimeout(() => {
|
|
103
|
+
isFade.value = true
|
|
104
|
+
}, Math.max(props.liveTime - timeFade, 0));
|
|
105
|
+
|
|
106
|
+
timers.live = setTimeout(() => {
|
|
107
|
+
isShow.value = false
|
|
108
|
+
}, props.liveTime);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
// слушатели
|
|
112
|
+
function handleMouseover(evt: MouseEvent){
|
|
113
|
+
const tooltipTarget = (evt.target as HTMLDivElement).closest(`.${classes.root}`)
|
|
114
|
+
|
|
115
|
+
if (tooltipTarget !== root.value) return
|
|
116
|
+
|
|
117
|
+
isLockLiveTime = true
|
|
118
|
+
evt.stopPropagation()
|
|
119
|
+
updateLiveTime()
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
function handleMouseout(evt: MouseEvent) {
|
|
123
|
+
const tooltipTarget = (evt.target as HTMLDivElement).closest(`.${classes.root}`)
|
|
124
|
+
|
|
125
|
+
if (tooltipTarget !== root.value) return
|
|
126
|
+
|
|
127
|
+
isLockLiveTime = false
|
|
128
|
+
updateLiveTime()
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
function addListener() {
|
|
132
|
+
document.body.addEventListener('mouseover', handleMouseover)
|
|
133
|
+
document.body.addEventListener('mouseout', handleMouseout)
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
function removeListener() {
|
|
137
|
+
document.body.removeEventListener('mouseover', handleMouseover)
|
|
138
|
+
document.body.removeEventListener('mouseout', handleMouseout)
|
|
169
139
|
}
|
|
170
140
|
|
|
171
141
|
</script>
|
|
@@ -12,67 +12,32 @@
|
|
|
12
12
|
</button>
|
|
13
13
|
</template>
|
|
14
14
|
|
|
15
|
-
<script>
|
|
15
|
+
<script setup lang="ts">
|
|
16
16
|
import CIcon from './CIcons/index.vue'
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
size: {
|
|
33
|
-
type: String,
|
|
34
|
-
|
|
35
|
-
default: "lg",
|
|
36
|
-
validator: getPropValidator('CButton', 'size', ['lg', 'md', 'sm']),
|
|
37
|
-
},
|
|
38
|
-
|
|
39
|
-
variant: {
|
|
40
|
-
type: String,
|
|
41
|
-
|
|
42
|
-
default: "tonal",
|
|
43
|
-
validator: getPropValidator('CButton', 'variant', ['tonal', 'outlined', 'text', 'nav_item']),
|
|
44
|
-
},
|
|
45
|
-
|
|
46
|
-
color: {
|
|
47
|
-
type: String,
|
|
48
|
-
|
|
49
|
-
default: "green",
|
|
50
|
-
validator: getPropValidator('CButton', 'color', ['green', 'black']),
|
|
51
|
-
},
|
|
52
|
-
|
|
53
|
-
active: {
|
|
54
|
-
type: Boolean,
|
|
55
|
-
|
|
56
|
-
default: false,
|
|
57
|
-
},
|
|
58
|
-
|
|
59
|
-
disabled: {
|
|
60
|
-
type: Boolean,
|
|
61
|
-
|
|
62
|
-
default: false,
|
|
63
|
-
},
|
|
64
|
-
|
|
65
|
-
loading: {
|
|
66
|
-
type: Boolean,
|
|
67
|
-
|
|
68
|
-
default: false,
|
|
69
|
-
}
|
|
70
|
-
},
|
|
18
|
+
const loadingSize = {
|
|
19
|
+
lg: 24,
|
|
20
|
+
md: 20,
|
|
21
|
+
sm: 16,
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
type TProps = {
|
|
25
|
+
size?: 'lg' | 'md' | 'sm',
|
|
26
|
+
variant?: 'tonal' | 'outlined' | 'text' | 'nav_item',
|
|
27
|
+
color?: 'green' | 'black',
|
|
28
|
+
active?: boolean,
|
|
29
|
+
disabled?: boolean,
|
|
30
|
+
loading?: boolean,
|
|
31
|
+
}
|
|
71
32
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
33
|
+
const props = withDefaults(defineProps<TProps>(), {
|
|
34
|
+
size: 'lg',
|
|
35
|
+
variant: 'tonal',
|
|
36
|
+
color: 'green',
|
|
37
|
+
active: false,
|
|
38
|
+
disabled: false,
|
|
39
|
+
loading: false
|
|
40
|
+
});
|
|
76
41
|
</script>
|
|
77
42
|
|
|
78
43
|
<style lang="scss">
|
|
@@ -7,11 +7,8 @@
|
|
|
7
7
|
:value="modelValue || value"
|
|
8
8
|
:checked="isRadio ? value === modelValue : modelValue"
|
|
9
9
|
:disabled="disabled"
|
|
10
|
-
@change="$emit('update:modelValue', isRadio ? value :
|
|
10
|
+
@change="({ target }) => $emit('update:modelValue', isRadio ? value : (target as HTMLInputElement).checked)"
|
|
11
11
|
/>
|
|
12
|
-
<!-- @change="(evt) => $emit('change', isRadio ? (modelValue || value) : evt.target.checked)" -->
|
|
13
|
-
<!-- @change="$emit('update:checked', $event.target.checked), $emit('update:modelValue', $event.target.value)" -->
|
|
14
|
-
|
|
15
12
|
<div class="c-checkbox__checkmark"></div>
|
|
16
13
|
<div class="c-checkbox__text">
|
|
17
14
|
<slot>{{ text }}</slot>
|
|
@@ -19,66 +16,35 @@
|
|
|
19
16
|
</label>
|
|
20
17
|
</template>
|
|
21
18
|
|
|
22
|
-
<script>
|
|
23
|
-
import { getPropValidator } from '../assets/js/helpers.js'
|
|
24
|
-
|
|
25
|
-
export default {
|
|
26
|
-
name: 'CCheckbox',
|
|
27
|
-
|
|
28
|
-
data() {
|
|
29
|
-
return {
|
|
30
|
-
isRadio: this.variant === 'radio',
|
|
31
|
-
}
|
|
32
|
-
},
|
|
33
|
-
|
|
34
|
-
emits: ['update:checked', 'update:modelValue'],
|
|
35
|
-
|
|
36
|
-
props: {
|
|
37
|
-
|
|
38
|
-
variant: {
|
|
39
|
-
type: String,
|
|
19
|
+
<script setup lang="ts">
|
|
40
20
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
validator: getPropValidator('CCheckbox', 'size', ['lg', 'sm'])
|
|
51
|
-
},
|
|
52
|
-
|
|
53
|
-
disabled: {
|
|
54
|
-
type: Boolean,
|
|
21
|
+
type TProps = {
|
|
22
|
+
variant?: 'checkbox' | 'radio' | 'toggle',
|
|
23
|
+
size?: 'lg' | 'sm',
|
|
24
|
+
disabled?: boolean,
|
|
25
|
+
text?: string,
|
|
26
|
+
name?: string,
|
|
27
|
+
value?: any,
|
|
28
|
+
modelValue: any,
|
|
29
|
+
}
|
|
55
30
|
|
|
56
|
-
|
|
57
|
-
|
|
31
|
+
const props = withDefaults(defineProps<TProps>(), {
|
|
32
|
+
variant: 'checkbox',
|
|
33
|
+
size: 'lg',
|
|
34
|
+
disabled: false,
|
|
35
|
+
text: '',
|
|
36
|
+
name: 'c_checkbox',
|
|
37
|
+
value: '',
|
|
38
|
+
modelValue: '',
|
|
39
|
+
});
|
|
58
40
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
},
|
|
41
|
+
const emits = defineEmits<{
|
|
42
|
+
(name: 'update:checked', value: boolean): void,
|
|
43
|
+
(name: 'update:modelValue', value: any): void,
|
|
44
|
+
}>();
|
|
64
45
|
|
|
65
|
-
|
|
66
|
-
type: String,
|
|
67
|
-
|
|
68
|
-
default: 'c_checkbox',
|
|
69
|
-
},
|
|
46
|
+
const isRadio = props.variant === 'radio'
|
|
70
47
|
|
|
71
|
-
value: {
|
|
72
|
-
default: '',
|
|
73
|
-
},
|
|
74
|
-
|
|
75
|
-
modelValue: {
|
|
76
|
-
type: [Boolean, String, Number, Array],
|
|
77
|
-
|
|
78
|
-
default: '',
|
|
79
|
-
},
|
|
80
|
-
},
|
|
81
|
-
}
|
|
82
48
|
</script>
|
|
83
49
|
|
|
84
50
|
<style lang="scss">
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
:placeholder="placeholder"
|
|
8
8
|
:value="modelValue"
|
|
9
9
|
:disabled="disabled"
|
|
10
|
-
@input="$emit('update:modelValue',
|
|
10
|
+
@input="({target}) => $emit('update:modelValue', (target as HTMLInputElement).value)"
|
|
11
11
|
/>
|
|
12
12
|
|
|
13
13
|
<div class="c-input__icon c-input__success-icon">
|
|
@@ -28,65 +28,36 @@
|
|
|
28
28
|
</div>
|
|
29
29
|
</template>
|
|
30
30
|
|
|
31
|
-
<script>
|
|
31
|
+
<script setup lang="ts">
|
|
32
|
+
import { InputTypeHTMLAttribute } from 'vue';
|
|
32
33
|
import CIcon from './CIcons/index.vue'
|
|
33
34
|
|
|
34
|
-
|
|
35
|
+
type TProps = {
|
|
36
|
+
status?: 'static' | 'focus' | 'error' | 'success',
|
|
37
|
+
size?: 'lg' | 'md' | 'sm',
|
|
38
|
+
width?: string,
|
|
39
|
+
disabled?: boolean,
|
|
40
|
+
type?: InputTypeHTMLAttribute,
|
|
41
|
+
name?: string,
|
|
42
|
+
placeholder?: string,
|
|
43
|
+
modelValue?: any,
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const pops = withDefaults(defineProps<TProps>(), {
|
|
47
|
+
status: 'static',
|
|
48
|
+
size: 'lg',
|
|
49
|
+
width: '350px',
|
|
50
|
+
disabled: false,
|
|
51
|
+
type: 'text',
|
|
52
|
+
name: '',
|
|
53
|
+
placeholder: '',
|
|
54
|
+
modelValue: ''
|
|
55
|
+
})
|
|
56
|
+
|
|
57
|
+
const emits = defineEmits<{
|
|
58
|
+
(name: 'update:modelValue', value: any): void
|
|
59
|
+
}>()
|
|
35
60
|
|
|
36
|
-
export default {
|
|
37
|
-
emits: ['update:modelValue'],
|
|
38
|
-
components: {
|
|
39
|
-
CIcon
|
|
40
|
-
},
|
|
41
|
-
|
|
42
|
-
props: {
|
|
43
|
-
status: {
|
|
44
|
-
type: String,
|
|
45
|
-
|
|
46
|
-
default: 'static',
|
|
47
|
-
validator: getPropValidator('CInput', 'status', ['static', 'focus'/* it rofls */, 'error', 'success'])
|
|
48
|
-
},
|
|
49
|
-
|
|
50
|
-
size: {
|
|
51
|
-
type: String,
|
|
52
|
-
|
|
53
|
-
default: 'lg',
|
|
54
|
-
validator: getPropValidator('CInput', 'size', ['lg', 'md', 'sm'])
|
|
55
|
-
},
|
|
56
|
-
|
|
57
|
-
width: {
|
|
58
|
-
type: String,
|
|
59
|
-
|
|
60
|
-
default: '350px'
|
|
61
|
-
},
|
|
62
|
-
|
|
63
|
-
disabled: {
|
|
64
|
-
type: Boolean,
|
|
65
|
-
},
|
|
66
|
-
|
|
67
|
-
type: {
|
|
68
|
-
type: String,
|
|
69
|
-
|
|
70
|
-
default: 'text',
|
|
71
|
-
},
|
|
72
|
-
|
|
73
|
-
name: {
|
|
74
|
-
type: String,
|
|
75
|
-
|
|
76
|
-
default: 'c_inp',
|
|
77
|
-
},
|
|
78
|
-
|
|
79
|
-
placeholder: {
|
|
80
|
-
type: String,
|
|
81
|
-
|
|
82
|
-
default: '',
|
|
83
|
-
},
|
|
84
|
-
|
|
85
|
-
modelValue: {
|
|
86
|
-
default: '',
|
|
87
|
-
}
|
|
88
|
-
},
|
|
89
|
-
}
|
|
90
61
|
</script>
|
|
91
62
|
|
|
92
63
|
<style lang="scss">
|
|
@@ -13,16 +13,13 @@
|
|
|
13
13
|
</div>
|
|
14
14
|
</template>
|
|
15
15
|
|
|
16
|
-
<script>
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
}
|
|
16
|
+
<script setup lang="ts">
|
|
17
|
+
type TProp = {
|
|
18
|
+
isShowTitle?: boolean,
|
|
19
|
+
}
|
|
20
|
+
const props = withDefaults(defineProps<TProp>(), {
|
|
21
|
+
isShowTitle: true
|
|
22
|
+
})
|
|
26
23
|
</script>
|
|
27
24
|
|
|
28
25
|
<style lang="scss">
|