@volverjs/ui-vue 0.0.10-beta.15 → 0.0.10-beta.17
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/README.md +96 -2
- package/auto-imports.d.ts +2 -0
- package/dist/components/VvAccordion/VvAccordion.es.js +33 -9
- package/dist/components/VvAccordion/VvAccordion.umd.js +1 -1
- package/dist/components/VvAccordion/VvAccordion.vue.d.ts +9 -2
- package/dist/components/VvAccordion/index.d.ts +4 -1
- package/dist/components/VvAccordionGroup/VvAccordionGroup.es.js +33 -9
- package/dist/components/VvAccordionGroup/VvAccordionGroup.umd.js +1 -1
- package/dist/components/VvAccordionGroup/VvAccordionGroup.vue.d.ts +9 -2
- package/dist/components/VvAccordionGroup/index.d.ts +4 -1
- package/dist/components/VvAction/VvAction.es.js +29 -8
- package/dist/components/VvAction/VvAction.umd.js +1 -1
- package/dist/components/VvAction/VvAction.vue.d.ts +44 -10
- package/dist/components/VvAction/index.d.ts +21 -5
- package/dist/components/VvAlert/VvAlert.es.js +91 -107
- package/dist/components/VvAlert/VvAlert.umd.js +1 -1
- package/dist/components/VvAlert/VvAlert.vue.d.ts +14 -4
- package/dist/components/VvAlert/index.d.ts +7 -3
- package/dist/components/VvAlertGroup/VvAlertGroup.es.js +91 -107
- package/dist/components/VvAlertGroup/VvAlertGroup.umd.js +1 -1
- package/dist/components/VvAlertGroup/VvAlertGroup.vue.d.ts +9 -2
- package/dist/components/VvAlertGroup/index.d.ts +6 -2
- package/dist/components/VvAvatar/VvAvatar.es.js +33 -9
- package/dist/components/VvAvatar/VvAvatar.umd.js +1 -1
- package/dist/components/VvAvatar/VvAvatar.vue.d.ts +11 -3
- package/dist/components/VvAvatar/index.d.ts +4 -1
- package/dist/components/VvAvatarGroup/VvAvatarGroup.es.js +33 -9
- package/dist/components/VvAvatarGroup/VvAvatarGroup.umd.js +1 -1
- package/dist/components/VvAvatarGroup/VvAvatarGroup.vue.d.ts +9 -2
- package/dist/components/VvAvatarGroup/index.d.ts +4 -1
- package/dist/components/VvBadge/VvBadge.es.js +33 -9
- package/dist/components/VvBadge/VvBadge.umd.js +1 -1
- package/dist/components/VvBadge/VvBadge.vue.d.ts +11 -3
- package/dist/components/VvBadge/index.d.ts +4 -1
- package/dist/components/VvBreadcrumb/VvBreadcrumb.es.js +33 -9
- package/dist/components/VvBreadcrumb/VvBreadcrumb.umd.js +1 -1
- package/dist/components/VvBreadcrumb/VvBreadcrumb.vue.d.ts +11 -3
- package/dist/components/VvBreadcrumb/index.d.ts +4 -1
- package/dist/components/VvButton/VvButton.es.js +100 -119
- package/dist/components/VvButton/VvButton.umd.js +1 -1
- package/dist/components/VvButton/VvButton.vue.d.ts +78 -20
- package/dist/components/VvButton/index.d.ts +34 -12
- package/dist/components/VvButtonGroup/VvButtonGroup.es.js +33 -9
- package/dist/components/VvButtonGroup/VvButtonGroup.umd.js +1 -1
- package/dist/components/VvButtonGroup/VvButtonGroup.vue.d.ts +17 -4
- package/dist/components/VvButtonGroup/index.d.ts +8 -2
- package/dist/components/VvCard/VvCard.es.js +33 -9
- package/dist/components/VvCard/VvCard.umd.js +1 -1
- package/dist/components/VvCard/VvCard.vue.d.ts +11 -3
- package/dist/components/VvCard/index.d.ts +4 -1
- package/dist/components/VvCheckbox/VvCheckbox.es.js +56 -17
- package/dist/components/VvCheckbox/VvCheckbox.umd.js +1 -1
- package/dist/components/VvCheckbox/VvCheckbox.vue.d.ts +94 -22
- package/dist/components/VvCheckbox/index.d.ts +44 -11
- package/dist/components/VvCheckboxGroup/VvCheckboxGroup.es.js +64 -19
- package/dist/components/VvCheckboxGroup/VvCheckboxGroup.umd.js +1 -1
- package/dist/components/VvCheckboxGroup/VvCheckboxGroup.vue.d.ts +93 -22
- package/dist/components/VvCheckboxGroup/index.d.ts +44 -11
- package/dist/components/VvCombobox/VvCombobox.es.js +108 -165
- package/dist/components/VvCombobox/VvCombobox.umd.js +1 -1
- package/dist/components/VvCombobox/VvCombobox.vue.d.ts +97 -24
- package/dist/components/VvCombobox/index.d.ts +42 -11
- package/dist/components/VvDialog/VvDialog.es.js +51 -103
- package/dist/components/VvDialog/VvDialog.umd.js +1 -1
- package/dist/components/VvDropdown/VvDropdown.es.js +33 -9
- package/dist/components/VvDropdown/VvDropdown.umd.js +1 -1
- package/dist/components/VvDropdown/VvDropdown.vue.d.ts +14 -2
- package/dist/components/VvDropdown/VvDropdownAction.vue.d.ts +61 -12
- package/dist/components/VvDropdown/VvDropdownOptgroup.vue.d.ts +11 -3
- package/dist/components/VvDropdown/VvDropdownOption.vue.d.ts +25 -6
- package/dist/components/VvDropdown/index.d.ts +6 -1
- package/dist/components/VvDropdownAction/VvDropdownAction.es.js +33 -9
- package/dist/components/VvDropdownAction/VvDropdownAction.umd.js +1 -1
- package/dist/components/VvDropdownOptgroup/VvDropdownOptgroup.es.js +29 -8
- package/dist/components/VvDropdownOptgroup/VvDropdownOptgroup.umd.js +1 -1
- package/dist/components/VvDropdownOption/VvDropdownOption.es.js +37 -10
- package/dist/components/VvDropdownOption/VvDropdownOption.umd.js +1 -1
- package/dist/components/VvIcon/VvIcon.es.js +22 -95
- package/dist/components/VvIcon/VvIcon.umd.js +1 -1
- package/dist/components/VvIcon/VvIcon.vue.d.ts +81 -44
- package/dist/components/VvIcon/index.d.ts +21 -48
- package/dist/components/VvInputFile/VvInputFile.es.js +146 -140
- package/dist/components/VvInputFile/VvInputFile.umd.js +1 -1
- package/dist/components/VvInputFile/VvInputFile.vue.d.ts +52 -12
- package/dist/components/VvInputFile/index.d.ts +24 -6
- package/dist/components/VvInputText/VvInputText.es.js +115 -147
- package/dist/components/VvInputText/VvInputText.umd.js +1 -1
- package/dist/components/VvInputText/VvInputText.vue.d.ts +141 -34
- package/dist/components/VvInputText/index.d.ts +71 -26
- package/dist/components/VvNav/VvNav.es.js +33 -9
- package/dist/components/VvNav/VvNav.umd.js +1 -1
- package/dist/components/VvNav/VvNav.vue.d.ts +9 -2
- package/dist/components/VvNav/index.d.ts +4 -1
- package/dist/components/VvNavItem/VvNavItem.es.js +29 -8
- package/dist/components/VvNavItem/VvNavItem.umd.js +1 -1
- package/dist/components/VvProgress/VvProgress.es.js +33 -9
- package/dist/components/VvProgress/VvProgress.umd.js +1 -1
- package/dist/components/VvProgress/VvProgress.vue.d.ts +9 -2
- package/dist/components/VvProgress/index.d.ts +4 -1
- package/dist/components/VvRadio/VvRadio.es.js +56 -17
- package/dist/components/VvRadio/VvRadio.umd.js +1 -1
- package/dist/components/VvRadio/VvRadio.vue.d.ts +94 -22
- package/dist/components/VvRadio/index.d.ts +44 -11
- package/dist/components/VvRadioGroup/VvRadioGroup.es.js +64 -19
- package/dist/components/VvRadioGroup/VvRadioGroup.umd.js +1 -1
- package/dist/components/VvRadioGroup/VvRadioGroup.vue.d.ts +93 -22
- package/dist/components/VvRadioGroup/index.d.ts +44 -11
- package/dist/components/VvSelect/VvSelect.es.js +95 -138
- package/dist/components/VvSelect/VvSelect.umd.js +1 -1
- package/dist/components/VvSelect/VvSelect.vue.d.ts +97 -24
- package/dist/components/VvSelect/index.d.ts +46 -12
- package/dist/components/VvTab/VvTab.es.js +33 -9
- package/dist/components/VvTab/VvTab.umd.js +1 -1
- package/dist/components/VvTab/VvTab.vue.d.ts +9 -2
- package/dist/components/VvTab/index.d.ts +4 -1
- package/dist/components/VvTextarea/VvTextarea.es.js +109 -143
- package/dist/components/VvTextarea/VvTextarea.umd.js +1 -1
- package/dist/components/VvTextarea/VvTextarea.vue.d.ts +141 -34
- package/dist/components/VvTextarea/index.d.ts +66 -17
- package/dist/components/VvTooltip/VvTooltip.es.js +33 -9
- package/dist/components/VvTooltip/VvTooltip.umd.js +1 -1
- package/dist/components/VvTooltip/VvTooltip.vue.d.ts +9 -2
- package/dist/components/VvTooltip/index.d.ts +4 -1
- package/dist/components/index.es.js +217 -249
- package/dist/components/index.umd.js +1 -1
- package/dist/composables/useComponentIcon.d.ts +9 -8
- package/dist/directives/index.es.js +33 -9
- package/dist/directives/index.umd.js +1 -1
- package/dist/directives/v-tooltip.es.js +33 -9
- package/dist/directives/v-tooltip.umd.js +1 -1
- package/dist/icons.es.js +3 -3
- package/dist/icons.umd.js +1 -1
- package/dist/props/index.d.ts +251 -61
- package/dist/stories/AccordionGroup/AccordionGroup.stories.d.ts +15 -4
- package/dist/stories/AccordionGroup/AccordionGroupSlots.stories.d.ts +77 -22
- package/dist/stories/Icon/Icon.settings.d.ts +1 -0
- package/package.json +33 -33
- package/src/assets/icons/detailed.json +1 -1
- package/src/assets/icons/normal.json +1 -1
- package/src/assets/icons/simple.json +1 -1
- package/src/components/VvAlert/index.ts +1 -3
- package/src/components/VvAlertGroup/index.ts +2 -1
- package/src/components/VvButton/VvButton.vue +6 -6
- package/src/components/VvButton/index.ts +2 -4
- package/src/components/VvCombobox/VvCombobox.vue +5 -8
- package/src/components/VvIcon/VvIcon.vue +2 -2
- package/src/components/VvIcon/index.ts +22 -48
- package/src/components/VvInputFile/VvInputFile.vue +33 -10
- package/src/components/VvInputText/VvInputText.vue +11 -12
- package/src/components/VvSelect/VvSelect.vue +5 -8
- package/src/components/VvTextarea/VvTextarea.vue +5 -8
- package/src/composables/useComponentIcon.ts +15 -14
- package/src/props/index.ts +89 -25
- package/src/stories/Icon/Icon.settings.ts +3 -3
|
@@ -86,9 +86,7 @@ export const useVvAlert = (
|
|
|
86
86
|
const hasTitleId = computed(() => `${hasId.value}-title`)
|
|
87
87
|
|
|
88
88
|
// icon
|
|
89
|
-
const hasIcon = computed(() =>
|
|
90
|
-
typeof props.icon === 'string' ? { name: props.icon } : props.icon,
|
|
91
|
-
)
|
|
89
|
+
const { hasIcon } = useComponentIcon(computed(() => props.icon))
|
|
92
90
|
|
|
93
91
|
// props
|
|
94
92
|
const hasClass = useModifiers(
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { ModifiersProps } from '@/props'
|
|
2
2
|
import type { ExtractPropTypes } from 'vue'
|
|
3
|
+
import type { VvIconProps } from '../VvIcon'
|
|
3
4
|
|
|
4
5
|
export type AlertItem = {
|
|
5
6
|
id: string | number
|
|
6
7
|
title?: string
|
|
7
|
-
icon?: string |
|
|
8
|
+
icon?: string | VvIconProps
|
|
8
9
|
content?: string
|
|
9
10
|
footer?: string
|
|
10
11
|
modifiers?: string | string[]
|
|
@@ -74,9 +74,7 @@
|
|
|
74
74
|
* @description Define icon attributes.
|
|
75
75
|
* @returns {Object} The icon attributes.
|
|
76
76
|
*/
|
|
77
|
-
const
|
|
78
|
-
typeof icon?.value === 'string' ? { name: icon?.value } : icon?.value,
|
|
79
|
-
)
|
|
77
|
+
const { hasIcon } = useComponentIcon(icon)
|
|
80
78
|
|
|
81
79
|
/**
|
|
82
80
|
* @description Catch click event
|
|
@@ -146,9 +144,11 @@
|
|
|
146
144
|
<template v-else>
|
|
147
145
|
<!-- @slot Before label and icon -->
|
|
148
146
|
<slot name="before" />
|
|
149
|
-
<
|
|
150
|
-
|
|
151
|
-
|
|
147
|
+
<VvIcon
|
|
148
|
+
v-if="hasIcon"
|
|
149
|
+
v-bind="hasIcon"
|
|
150
|
+
class="vv-button__icon"
|
|
151
|
+
/>
|
|
152
152
|
<span v-if="label" class="vv-button__label">
|
|
153
153
|
<!-- @slot Use this slot for button label -->
|
|
154
154
|
<slot name="label">
|
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
LoadingProps,
|
|
7
7
|
ModifiersProps,
|
|
8
8
|
UnselectableProps,
|
|
9
|
+
IconProps,
|
|
9
10
|
} from '../../props'
|
|
10
11
|
import { INJECTION_KEY_BUTTON_GROUP, Side } from '../../constants'
|
|
11
12
|
|
|
@@ -17,10 +18,7 @@ export const VvButtonProps = {
|
|
|
17
18
|
...ModifiersProps,
|
|
18
19
|
...UnselectableProps,
|
|
19
20
|
...LoadingProps,
|
|
20
|
-
|
|
21
|
-
* Button icon
|
|
22
|
-
*/
|
|
23
|
-
icon: [String, Object],
|
|
21
|
+
...IconProps,
|
|
24
22
|
/**
|
|
25
23
|
* Button icon position
|
|
26
24
|
*/
|
|
@@ -151,10 +151,7 @@
|
|
|
151
151
|
const dropdownEl = ref()
|
|
152
152
|
|
|
153
153
|
// icons
|
|
154
|
-
const {
|
|
155
|
-
icon,
|
|
156
|
-
iconPosition,
|
|
157
|
-
)
|
|
154
|
+
const { hasIconBefore, hasIconAfter } = useComponentIcon(icon, iconPosition)
|
|
158
155
|
|
|
159
156
|
// dirty
|
|
160
157
|
const isDirty = computed(() => !isEmpty(props.modelValue))
|
|
@@ -172,8 +169,8 @@
|
|
|
172
169
|
disabled: disabled.value,
|
|
173
170
|
loading: isLoading.value,
|
|
174
171
|
readonly: readonly.value,
|
|
175
|
-
'icon-before':
|
|
176
|
-
'icon-after':
|
|
172
|
+
'icon-before': hasIconBefore.value !== undefined,
|
|
173
|
+
'icon-after': hasIconAfter.value !== undefined,
|
|
177
174
|
valid: valid.value,
|
|
178
175
|
invalid: invalid.value,
|
|
179
176
|
dirty: isDirty.value,
|
|
@@ -429,8 +426,8 @@
|
|
|
429
426
|
<div class="vv-select__inner">
|
|
430
427
|
<VvIcon
|
|
431
428
|
v-if="hasIconBefore"
|
|
429
|
+
v-bind="hasIconBefore"
|
|
432
430
|
class="vv-select__icon"
|
|
433
|
-
v-bind="hasIcon"
|
|
434
431
|
/>
|
|
435
432
|
<div
|
|
436
433
|
ref="inputEl"
|
|
@@ -493,8 +490,8 @@
|
|
|
493
490
|
</div>
|
|
494
491
|
<VvIcon
|
|
495
492
|
v-if="hasIconAfter"
|
|
493
|
+
v-bind="hasIconAfter"
|
|
496
494
|
class="vv-select__icon vv-select__icon-after"
|
|
497
|
-
v-bind="hasIcon"
|
|
498
495
|
/>
|
|
499
496
|
</div>
|
|
500
497
|
<div v-if="$slots.after" class="vv-select__input-after">
|
|
@@ -6,10 +6,10 @@
|
|
|
6
6
|
|
|
7
7
|
<script setup lang="ts">
|
|
8
8
|
import { Icon, addIcon, iconExists } from '@iconify/vue'
|
|
9
|
-
import { VvIconProps } from '.'
|
|
9
|
+
import { type VvIconProps, VvIconPropsDefaults } from '.'
|
|
10
10
|
|
|
11
11
|
// props
|
|
12
|
-
const props = defineProps(
|
|
12
|
+
const props = withDefaults(defineProps<VvIconProps>(), VvIconPropsDefaults)
|
|
13
13
|
|
|
14
14
|
const hasRotate = computed(() => {
|
|
15
15
|
if (typeof props.rotate === 'string') {
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { PropType } from 'vue'
|
|
2
1
|
import type { IconifyIconOnLoad, IconifyRenderMode } from '@iconify/vue'
|
|
3
2
|
|
|
4
3
|
export enum IconPrefix {
|
|
@@ -7,65 +6,38 @@ export enum IconPrefix {
|
|
|
7
6
|
detailed = 'detailed',
|
|
8
7
|
}
|
|
9
8
|
|
|
10
|
-
export
|
|
11
|
-
/**
|
|
12
|
-
* Color
|
|
13
|
-
*/
|
|
14
|
-
color: String,
|
|
15
|
-
/**
|
|
16
|
-
* Width
|
|
17
|
-
*/
|
|
18
|
-
width: {
|
|
19
|
-
type: [String, Number],
|
|
20
|
-
},
|
|
21
|
-
/**
|
|
22
|
-
* Height
|
|
23
|
-
*/
|
|
24
|
-
height: {
|
|
25
|
-
type: [String, Number],
|
|
26
|
-
},
|
|
9
|
+
export type VvIconProps = {
|
|
27
10
|
/**
|
|
28
11
|
* Icon name
|
|
29
12
|
* Can be the full composition of iconify name "@{provider}:{prefix}:{name}" or "{prefix}:{name}" or "{name}"
|
|
30
13
|
* https://docs.iconify.design/api/providers.html#provider-in-icon-name
|
|
31
14
|
*/
|
|
32
|
-
name:
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
15
|
+
name: string
|
|
16
|
+
color?: string
|
|
17
|
+
width?: string | number
|
|
18
|
+
height?: string | number
|
|
36
19
|
/**
|
|
37
|
-
* By default 'vv'
|
|
38
20
|
* If custom collection is not added with "addCollection" DS class method, this prop could not be used
|
|
39
21
|
* Icon provider: https://docs.iconify.design/api/providers.html#provider-in-icon-name
|
|
40
22
|
*/
|
|
41
|
-
provider
|
|
42
|
-
type: String,
|
|
43
|
-
},
|
|
23
|
+
provider?: string
|
|
44
24
|
/**
|
|
25
|
+
* @default 'normal'
|
|
45
26
|
* The name of icon set.
|
|
46
27
|
* Icon default options prefix: simple | normal | detailed
|
|
47
28
|
*/
|
|
48
|
-
prefix
|
|
49
|
-
type: String as PropType<`${IconPrefix}` | string>,
|
|
50
|
-
default: 'normal',
|
|
51
|
-
},
|
|
29
|
+
prefix?: IconPrefix | string
|
|
52
30
|
/**
|
|
53
31
|
* Url remote SVG icon
|
|
54
32
|
*/
|
|
55
|
-
src
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
*/
|
|
59
|
-
horizontalFlip: Boolean,
|
|
60
|
-
/**
|
|
61
|
-
* Vertical flip
|
|
62
|
-
*/
|
|
63
|
-
verticalFlip: Boolean,
|
|
33
|
+
src?: string
|
|
34
|
+
horizontalFlip?: boolean
|
|
35
|
+
verticalFlip?: boolean
|
|
64
36
|
/**
|
|
65
37
|
* String alternative to "horizontalFlip" and "verticalFlip".
|
|
66
38
|
* Example: https://docs.iconify.design/icon-components/vue/transform.html
|
|
67
39
|
*/
|
|
68
|
-
flip
|
|
40
|
+
flip?: string
|
|
69
41
|
/**
|
|
70
42
|
* Icon render mode
|
|
71
43
|
* 'style' = 'bg' or 'mask', depending on icon content
|
|
@@ -74,30 +46,32 @@ export const VvIconProps = {
|
|
|
74
46
|
* 'svg' = svg
|
|
75
47
|
* Iconify doc: https://docs.iconify.design/iconify-icon/modes.html
|
|
76
48
|
*/
|
|
77
|
-
mode
|
|
49
|
+
mode?: IconifyRenderMode
|
|
78
50
|
/**
|
|
79
51
|
* Toggles inline or block mode
|
|
80
52
|
* Example https://docs.iconify.design/icon-components/vue/inline.html
|
|
81
53
|
*/
|
|
82
|
-
inline
|
|
54
|
+
inline?: boolean
|
|
83
55
|
/**
|
|
84
56
|
* rotates icon
|
|
85
57
|
* Example https://docs.iconify.design/icon-components/vue/transform.html
|
|
86
58
|
*/
|
|
87
|
-
rotate
|
|
59
|
+
rotate?: number | string
|
|
88
60
|
/**
|
|
89
61
|
* A callback that is called when icon data has been loaded
|
|
90
62
|
*/
|
|
91
|
-
onLoad
|
|
63
|
+
onLoad?: IconifyIconOnLoad
|
|
92
64
|
/**
|
|
93
65
|
* SVG icon string
|
|
94
66
|
*/
|
|
95
|
-
svg
|
|
67
|
+
svg?: string
|
|
96
68
|
/**
|
|
97
69
|
* Icon modifiers: vv-icon css helper classes, value/s are concatened with prefix 'vv-icon--'
|
|
98
70
|
* @values string | string[]
|
|
99
71
|
*/
|
|
100
|
-
modifiers
|
|
101
|
-
|
|
102
|
-
|
|
72
|
+
modifiers?: string | string[]
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export const VvIconPropsDefaults = {
|
|
76
|
+
prefix: IconPrefix.normal,
|
|
103
77
|
}
|
|
@@ -155,14 +155,17 @@
|
|
|
155
155
|
localModelValue.value = toReturn
|
|
156
156
|
}
|
|
157
157
|
|
|
158
|
+
const currentFileIndex = ref(0)
|
|
158
159
|
const previewSrc = computed(() => {
|
|
159
160
|
if (files.value.length === 0) {
|
|
160
161
|
return
|
|
161
162
|
}
|
|
162
|
-
if (files.value[
|
|
163
|
-
return URL.createObjectURL(
|
|
163
|
+
if (files.value[currentFileIndex.value] instanceof File) {
|
|
164
|
+
return URL.createObjectURL(
|
|
165
|
+
files.value[currentFileIndex.value] as File,
|
|
166
|
+
)
|
|
164
167
|
}
|
|
165
|
-
return files.value[
|
|
168
|
+
return (files.value[currentFileIndex.value] as UploadedFile).url
|
|
166
169
|
})
|
|
167
170
|
|
|
168
171
|
onBeforeUnmount(() => {
|
|
@@ -177,6 +180,18 @@
|
|
|
177
180
|
}
|
|
178
181
|
return Math.floor(size / 1024)
|
|
179
182
|
}
|
|
183
|
+
|
|
184
|
+
const onClickDownloadFile = (file: File | UploadedFile) => {
|
|
185
|
+
const link = document.createElement('a')
|
|
186
|
+
if (file instanceof File) {
|
|
187
|
+
link.href = URL.createObjectURL(file)
|
|
188
|
+
} else if (file.url) {
|
|
189
|
+
link.href = file.url
|
|
190
|
+
}
|
|
191
|
+
link.setAttribute('download', file.name)
|
|
192
|
+
document.body.appendChild(link)
|
|
193
|
+
link.click()
|
|
194
|
+
}
|
|
180
195
|
</script>
|
|
181
196
|
|
|
182
197
|
<template>
|
|
@@ -201,7 +216,7 @@
|
|
|
201
216
|
:class="{
|
|
202
217
|
'absolute top-8 right-8': previewSrc,
|
|
203
218
|
}"
|
|
204
|
-
:icon="!previewSrc ? 'image' : 'edit'"
|
|
219
|
+
:icon="!previewSrc ? 'image' : isMultiple ? 'add' : 'edit'"
|
|
205
220
|
class="z-1"
|
|
206
221
|
@click.stop="onClick"
|
|
207
222
|
/>
|
|
@@ -209,7 +224,7 @@
|
|
|
209
224
|
<img
|
|
210
225
|
v-if="previewSrc"
|
|
211
226
|
:src="previewSrc"
|
|
212
|
-
:alt="files[
|
|
227
|
+
:alt="files[currentFileIndex].name"
|
|
213
228
|
/>
|
|
214
229
|
</picture>
|
|
215
230
|
</slot>
|
|
@@ -238,12 +253,20 @@
|
|
|
238
253
|
v-for="(file, index) in files"
|
|
239
254
|
:key="index"
|
|
240
255
|
class="vv-input-file__item"
|
|
256
|
+
@click.stop="currentFileIndex = index"
|
|
241
257
|
>
|
|
242
|
-
<
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
258
|
+
<button
|
|
259
|
+
type="button"
|
|
260
|
+
class="vv-input-file__item-icon cursor-pointer"
|
|
261
|
+
title="Download"
|
|
262
|
+
aria-label="download-file"
|
|
263
|
+
@click.stop="onClickDownloadFile(file)"
|
|
264
|
+
>
|
|
265
|
+
<VvIcon name="download" />
|
|
266
|
+
</button>
|
|
267
|
+
<div class="vv-input-file__item-name cursor-pointer">
|
|
268
|
+
{{ file.name }}
|
|
269
|
+
</div>
|
|
247
270
|
<small class="vv-input-file__item-info">
|
|
248
271
|
{{ sizeInKiB(file.size) }} KB
|
|
249
272
|
</small>
|
|
@@ -249,11 +249,11 @@
|
|
|
249
249
|
}
|
|
250
250
|
|
|
251
251
|
// icons
|
|
252
|
-
const {
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
252
|
+
const { hasIconBefore, hasIconAfter } = useComponentIcon(icon, iconPosition)
|
|
253
|
+
const iconAfter = computed(() => {
|
|
254
|
+
if (hasIconAfter.value !== undefined) {
|
|
255
|
+
return hasIconAfter.value
|
|
256
|
+
}
|
|
257
257
|
switch (props.type) {
|
|
258
258
|
case INPUT_TYPES.COLOR:
|
|
259
259
|
return { name: TYPES_ICON.COLOR }
|
|
@@ -264,9 +264,8 @@
|
|
|
264
264
|
return { name: TYPES_ICON.DATE }
|
|
265
265
|
case INPUT_TYPES.TIME:
|
|
266
266
|
return { name: TYPES_ICON.TIME }
|
|
267
|
-
default:
|
|
268
|
-
return ''
|
|
269
267
|
}
|
|
268
|
+
return undefined
|
|
270
269
|
})
|
|
271
270
|
|
|
272
271
|
// count
|
|
@@ -307,8 +306,8 @@
|
|
|
307
306
|
loading: loading.value,
|
|
308
307
|
disabled: props.disabled,
|
|
309
308
|
readonly: props.readonly,
|
|
310
|
-
'icon-before': hasIconBefore.value,
|
|
311
|
-
'icon-after':
|
|
309
|
+
'icon-before': hasIconBefore.value !== undefined,
|
|
310
|
+
'icon-after': iconAfter.value !== undefined,
|
|
312
311
|
floating: props.floating && !isEmpty(props.label),
|
|
313
312
|
dirty: isDirty.value,
|
|
314
313
|
focus: isFocused.value,
|
|
@@ -476,8 +475,8 @@
|
|
|
476
475
|
>
|
|
477
476
|
<VvIcon
|
|
478
477
|
v-if="hasIconBefore"
|
|
478
|
+
v-bind="hasIconBefore"
|
|
479
479
|
class="vv-input-text__icon"
|
|
480
|
-
v-bind="hasIcon"
|
|
481
480
|
/>
|
|
482
481
|
<input
|
|
483
482
|
:id="hasId"
|
|
@@ -500,9 +499,9 @@
|
|
|
500
499
|
</div>
|
|
501
500
|
<!-- @slot Slot to replace right icon -->
|
|
502
501
|
<VvIcon
|
|
503
|
-
v-if="
|
|
502
|
+
v-if="iconAfter"
|
|
503
|
+
v-bind="iconAfter"
|
|
504
504
|
class="vv-input-text__icon vv-input-text__icon-after"
|
|
505
|
-
v-bind="hasIconAfter ? hasIcon : defaultAfterIcon"
|
|
506
505
|
/>
|
|
507
506
|
<PasswordInputActions
|
|
508
507
|
v-else-if="isPassword && !hideActions && isClickable"
|
|
@@ -65,10 +65,7 @@
|
|
|
65
65
|
})
|
|
66
66
|
|
|
67
67
|
// icons
|
|
68
|
-
const {
|
|
69
|
-
icon,
|
|
70
|
-
iconPosition,
|
|
71
|
-
)
|
|
68
|
+
const { hasIconBefore, hasIconAfter } = useComponentIcon(icon, iconPosition)
|
|
72
69
|
|
|
73
70
|
// dirty
|
|
74
71
|
const isDirty = computed(() => !isEmpty(props.modelValue))
|
|
@@ -100,8 +97,8 @@
|
|
|
100
97
|
loading: loading.value,
|
|
101
98
|
disabled: disabled.value,
|
|
102
99
|
readonly: readonly.value,
|
|
103
|
-
'icon-before': hasIconBefore.value,
|
|
104
|
-
'icon-after': hasIconAfter.value,
|
|
100
|
+
'icon-before': hasIconBefore.value !== undefined,
|
|
101
|
+
'icon-after': hasIconAfter.value !== undefined,
|
|
105
102
|
dirty: isDirty.value,
|
|
106
103
|
focus: focused.value,
|
|
107
104
|
floating: floating.value,
|
|
@@ -174,8 +171,8 @@
|
|
|
174
171
|
<div class="vv-select__inner">
|
|
175
172
|
<VvIcon
|
|
176
173
|
v-if="hasIconBefore"
|
|
174
|
+
v-bind="hasIconBefore"
|
|
177
175
|
class="vv-select__icon"
|
|
178
|
-
v-bind="hasIcon"
|
|
179
176
|
/>
|
|
180
177
|
<select
|
|
181
178
|
:id="hasId"
|
|
@@ -219,8 +216,8 @@
|
|
|
219
216
|
</select>
|
|
220
217
|
<VvIcon
|
|
221
218
|
v-if="hasIconAfter"
|
|
219
|
+
v-bind="hasIconAfter"
|
|
222
220
|
class="vv-select__icon vv-select__icon-after"
|
|
223
|
-
v-bind="hasIcon"
|
|
224
221
|
/>
|
|
225
222
|
</div>
|
|
226
223
|
<div v-if="$slots.after" class="vv-select__input-after">
|
|
@@ -52,10 +52,7 @@
|
|
|
52
52
|
const localModelValue = useDebouncedInput(modelValue, emit, debounce?.value)
|
|
53
53
|
|
|
54
54
|
// icons
|
|
55
|
-
const {
|
|
56
|
-
icon,
|
|
57
|
-
iconPosition,
|
|
58
|
-
)
|
|
55
|
+
const { hasIconBefore, hasIconAfter } = useComponentIcon(icon, iconPosition)
|
|
59
56
|
|
|
60
57
|
// focus
|
|
61
58
|
const { focused } = useComponentFocus(textarea, emit)
|
|
@@ -113,8 +110,8 @@
|
|
|
113
110
|
loading: loading.value,
|
|
114
111
|
disabled: props.disabled,
|
|
115
112
|
readonly: props.readonly,
|
|
116
|
-
'icon-before': hasIconBefore.value,
|
|
117
|
-
'icon-after': hasIconAfter.value,
|
|
113
|
+
'icon-before': hasIconBefore.value !== undefined,
|
|
114
|
+
'icon-after': hasIconAfter.value !== undefined,
|
|
118
115
|
floating: props.floating && !isEmpty(props.label),
|
|
119
116
|
dirty: isDirty.value,
|
|
120
117
|
focus: focused.value,
|
|
@@ -180,8 +177,8 @@
|
|
|
180
177
|
<div class="vv-textarea__inner">
|
|
181
178
|
<VvIcon
|
|
182
179
|
v-if="hasIconBefore"
|
|
180
|
+
v-bind="hasIconBefore"
|
|
183
181
|
class="vv-textarea__icon"
|
|
184
|
-
v-bind="hasIcon"
|
|
185
182
|
/>
|
|
186
183
|
<textarea
|
|
187
184
|
:id="hasId"
|
|
@@ -192,8 +189,8 @@
|
|
|
192
189
|
/>
|
|
193
190
|
<VvIcon
|
|
194
191
|
v-if="hasIconAfter"
|
|
192
|
+
v-bind="hasIconAfter"
|
|
195
193
|
class="vv-textarea__icon vv-textarea__icon-after"
|
|
196
|
-
v-bind="hasIcon"
|
|
197
194
|
/>
|
|
198
195
|
</div>
|
|
199
196
|
<div v-if="$slots.after" class="vv-textarea__input-after">
|
|
@@ -1,34 +1,35 @@
|
|
|
1
1
|
import type { Ref } from 'vue'
|
|
2
|
+
import type { VvIconProps } from '../components/VvIcon'
|
|
2
3
|
import { Position, Side } from '../constants'
|
|
3
4
|
|
|
4
5
|
export function useComponentIcon(
|
|
5
|
-
icon
|
|
6
|
-
iconPosition
|
|
6
|
+
icon?: Ref<string | VvIconProps | undefined>,
|
|
7
|
+
iconPosition?: Ref<string | undefined>,
|
|
7
8
|
) {
|
|
9
|
+
const hasIcon = computed(() => {
|
|
10
|
+
if (typeof icon?.value === 'string') {
|
|
11
|
+
return { name: icon?.value }
|
|
12
|
+
}
|
|
13
|
+
return icon?.value
|
|
14
|
+
})
|
|
8
15
|
const hasIconBefore = computed(() =>
|
|
9
|
-
|
|
16
|
+
iconPosition?.value === Position.before ? hasIcon.value : undefined,
|
|
10
17
|
)
|
|
11
18
|
const hasIconAfter = computed(() =>
|
|
12
|
-
|
|
19
|
+
iconPosition?.value === Position.after ? hasIcon.value : undefined,
|
|
13
20
|
)
|
|
14
21
|
const hasIconLeft = computed(() =>
|
|
15
|
-
|
|
22
|
+
iconPosition?.value === Side.left ? hasIcon.value : undefined,
|
|
16
23
|
)
|
|
17
24
|
const hasIconRight = computed(() =>
|
|
18
|
-
|
|
25
|
+
iconPosition?.value === Side.right ? hasIcon.value : undefined,
|
|
19
26
|
)
|
|
20
27
|
const hasIconTop = computed(() =>
|
|
21
|
-
|
|
28
|
+
iconPosition?.value === Side.top ? hasIcon.value : undefined,
|
|
22
29
|
)
|
|
23
30
|
const hasIconBottom = computed(() =>
|
|
24
|
-
|
|
31
|
+
iconPosition?.value === Side.bottom ? hasIcon.value : undefined,
|
|
25
32
|
)
|
|
26
|
-
const hasIcon = computed(() => {
|
|
27
|
-
if (typeof icon?.value === 'string') {
|
|
28
|
-
return { name: icon?.value }
|
|
29
|
-
}
|
|
30
|
-
return icon?.value
|
|
31
|
-
})
|
|
32
33
|
return {
|
|
33
34
|
hasIcon,
|
|
34
35
|
hasIconLeft,
|