@volverjs/ui-vue 0.0.5-beta.1 → 0.0.5-beta.2
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/dist/components/VvAction/VvAction.es.js +10 -0
- package/dist/components/VvBadge/VvBadge.es.js +10 -0
- package/dist/components/VvBreadcrumb/VvBreadcrumb.es.js +10 -0
- package/dist/components/VvButton/VvButton.es.js +10 -0
- package/dist/components/VvButtonGroup/VvButtonGroup.es.js +10 -0
- package/dist/components/VvCheckbox/VvCheckbox.es.js +10 -0
- package/dist/components/VvCheckboxGroup/VvCheckboxGroup.es.js +10 -0
- package/dist/components/VvCombobox/VvCombobox.es.js +17 -3
- package/dist/components/VvCombobox/VvCombobox.umd.js +1 -1
- package/dist/components/VvCombobox/VvCombobox.vue.d.ts +24 -11
- package/dist/components/VvCombobox/index.d.ts +6 -1
- package/dist/components/VvDialog/VvDialog.es.js +10 -0
- package/dist/components/VvDropdown/VvDropdown.es.js +14 -2
- package/dist/components/VvDropdown/VvDropdown.umd.js +1 -1
- package/dist/components/VvDropdown/VvDropdown.vue.d.ts +27 -11
- package/dist/components/VvDropdown/index.d.ts +6 -1
- package/dist/components/VvDropdownAction/VvDropdownAction.es.js +10 -0
- package/dist/components/VvDropdownOption/VvDropdownOption.es.js +10 -0
- package/dist/components/VvInputText/VvInputText.es.js +14 -4
- package/dist/components/VvInputText/VvInputText.umd.js +1 -1
- package/dist/components/VvInputText/VvInputText.vue.d.ts +4 -4
- package/dist/components/VvInputText/index.d.ts +2 -2
- package/dist/components/VvProgress/VvProgress.es.js +10 -0
- package/dist/components/VvRadio/VvRadio.es.js +10 -0
- package/dist/components/VvRadioGroup/VvRadioGroup.es.js +10 -0
- package/dist/components/VvSelect/VvSelect.es.js +10 -0
- package/dist/components/VvTextarea/VvTextarea.es.js +14 -4
- package/dist/components/VvTextarea/VvTextarea.umd.js +1 -1
- package/dist/components/VvTextarea/VvTextarea.vue.d.ts +10 -10
- package/dist/components/VvTextarea/index.d.ts +2 -2
- package/dist/components/VvTooltip/VvTooltip.es.js +10 -0
- package/dist/components/index.es.js +23 -9
- package/dist/components/index.umd.js +1 -1
- package/dist/directives/index.d.ts +1 -0
- package/dist/directives/index.es.js +51 -2
- package/dist/directives/index.umd.js +1 -1
- package/dist/directives/v-contextmenu.d.ts +3 -0
- package/dist/directives/v-contextmenu.es.js +42 -0
- package/dist/directives/v-contextmenu.umd.js +1 -0
- package/dist/directives/v-tooltip.es.js +10 -0
- package/dist/icons.d.ts +3 -1
- package/dist/icons.es.js +6 -4
- package/dist/icons.umd.js +1 -1
- package/dist/props/index.d.ts +11 -3
- package/dist/stories/Combobox/Combobox.settings.d.ts +12 -0
- package/dist/stories/Dropdown/Dropdown.settings.d.ts +12 -0
- package/dist/stories/argTypes.d.ts +12 -0
- package/package.json +50 -42
- 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/VvCombobox/VvCombobox.vue +5 -3
- package/src/components/VvDropdown/VvDropdown.vue +3 -2
- package/src/components/VvInputText/VvInputText.vue +2 -2
- package/src/components/VvTextarea/VvTextarea.vue +2 -2
- package/src/directives/index.ts +2 -0
- package/src/directives/v-contextmenu.ts +40 -0
- package/src/icons.ts +1 -1
- package/src/props/index.ts +12 -2
- package/src/stories/Dropdown/DropdownContextmenuDirective.stories.mdx +41 -0
- package/src/stories/Tooltip/TooltipDirective.stories.mdx +1 -1
- package/src/stories/argTypes.ts +10 -0
|
@@ -193,7 +193,7 @@
|
|
|
193
193
|
const selectedOptions = computed(() => {
|
|
194
194
|
let selectedValues: Array<typeof props.modelValue> = []
|
|
195
195
|
if (Array.isArray(props.modelValue)) {
|
|
196
|
-
selectedValues = props.modelValue
|
|
196
|
+
selectedValues = props.modelValue as Array<typeof props.modelValue>
|
|
197
197
|
} else if (props.modelValue) {
|
|
198
198
|
selectedValues = [props.modelValue]
|
|
199
199
|
}
|
|
@@ -237,10 +237,11 @@
|
|
|
237
237
|
if (props.multiple) {
|
|
238
238
|
// check maxValues prop and block check new values
|
|
239
239
|
if (Array.isArray(props.modelValue)) {
|
|
240
|
+
const maxValues = Number(props.maxValues)
|
|
240
241
|
if (
|
|
241
242
|
props.maxValues !== undefined &&
|
|
242
|
-
|
|
243
|
-
props.modelValue?.length >=
|
|
243
|
+
maxValues >= 0 &&
|
|
244
|
+
props.modelValue?.length >= maxValues
|
|
244
245
|
) {
|
|
245
246
|
if (!contains(value, props.modelValue)) {
|
|
246
247
|
// maxValues reached
|
|
@@ -295,6 +296,7 @@
|
|
|
295
296
|
id: hasDropdownId.value,
|
|
296
297
|
reference: wrapperEl.value,
|
|
297
298
|
placement: props.placement,
|
|
299
|
+
strategy: props.strategy,
|
|
298
300
|
transitionName: props.transitionName,
|
|
299
301
|
offset: props.offset,
|
|
300
302
|
shift: props.shift,
|
|
@@ -25,7 +25,6 @@
|
|
|
25
25
|
ShiftOptions,
|
|
26
26
|
SizeOptions,
|
|
27
27
|
} from '../../types/floating-ui'
|
|
28
|
-
import type { Placement } from '@/constants'
|
|
29
28
|
|
|
30
29
|
// props, emit and attrs
|
|
31
30
|
const props = defineProps(VvDropdownProps)
|
|
@@ -128,7 +127,8 @@
|
|
|
128
127
|
floatingEl,
|
|
129
128
|
{
|
|
130
129
|
whileElementsMounted: autoUpdate,
|
|
131
|
-
placement: props.placement
|
|
130
|
+
placement: computed(() => props.placement),
|
|
131
|
+
strategy: computed(() => props.strategy),
|
|
132
132
|
middleware,
|
|
133
133
|
},
|
|
134
134
|
)
|
|
@@ -195,6 +195,7 @@
|
|
|
195
195
|
const init = (el: HTMLElement) => {
|
|
196
196
|
referenceEl.value = el
|
|
197
197
|
}
|
|
198
|
+
defineExpose({ toggle, show, hide, init })
|
|
198
199
|
watch(expanded, (newValue) => {
|
|
199
200
|
if (newValue && props.autofocusFirst) {
|
|
200
201
|
nextTick(() => {
|
|
@@ -147,8 +147,8 @@
|
|
|
147
147
|
// count
|
|
148
148
|
const { formatted: countFormatted } = useTextCount(localModelValue, {
|
|
149
149
|
mode: props.count,
|
|
150
|
-
upperLimit: props.maxlength,
|
|
151
|
-
lowerLimit: props.minlength,
|
|
150
|
+
upperLimit: Number(props.maxlength),
|
|
151
|
+
lowerLimit: Number(props.minlength),
|
|
152
152
|
})
|
|
153
153
|
|
|
154
154
|
// tabindex
|
|
@@ -61,8 +61,8 @@
|
|
|
61
61
|
// count
|
|
62
62
|
const { formatted: countFormatted } = useTextCount(localModelValue, {
|
|
63
63
|
mode: props.count,
|
|
64
|
-
upperLimit: props.maxlength,
|
|
65
|
-
lowerLimit: props.minlength,
|
|
64
|
+
upperLimit: Number(props.maxlength),
|
|
65
|
+
lowerLimit: Number(props.minlength),
|
|
66
66
|
})
|
|
67
67
|
|
|
68
68
|
// tabindex
|
package/src/directives/index.ts
CHANGED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { Directive, DirectiveBinding } from 'vue'
|
|
2
|
+
|
|
3
|
+
const contextmenu: Directive = {
|
|
4
|
+
beforeUpdate(el: HTMLElement, binding: DirectiveBinding) {
|
|
5
|
+
const clientX = ref(0)
|
|
6
|
+
const clientY = ref(0)
|
|
7
|
+
const virtualEl = {
|
|
8
|
+
getBoundingClientRect() {
|
|
9
|
+
return {
|
|
10
|
+
width: 0,
|
|
11
|
+
height: 0,
|
|
12
|
+
x: clientX.value,
|
|
13
|
+
y: clientY.value,
|
|
14
|
+
top: clientY.value,
|
|
15
|
+
left: clientX.value,
|
|
16
|
+
right: clientX.value,
|
|
17
|
+
bottom: clientY.value,
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
}
|
|
21
|
+
if (binding.value?.init) {
|
|
22
|
+
binding.value.init?.(virtualEl)
|
|
23
|
+
}
|
|
24
|
+
el.addEventListener(
|
|
25
|
+
'contextmenu',
|
|
26
|
+
function (ev) {
|
|
27
|
+
if (binding.value?.show) {
|
|
28
|
+
ev.preventDefault()
|
|
29
|
+
clientX.value = ev.clientX
|
|
30
|
+
clientY.value = ev.clientY
|
|
31
|
+
binding.value.show?.()
|
|
32
|
+
return false
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
false,
|
|
36
|
+
)
|
|
37
|
+
},
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export default contextmenu
|
package/src/icons.ts
CHANGED
package/src/props/index.ts
CHANGED
|
@@ -235,6 +235,16 @@ export const DropdownProps = {
|
|
|
235
235
|
)
|
|
236
236
|
},
|
|
237
237
|
},
|
|
238
|
+
/**
|
|
239
|
+
* Dropdown strategy
|
|
240
|
+
*/
|
|
241
|
+
strategy: {
|
|
242
|
+
type: String as PropType<'fixed' | 'absolute'>,
|
|
243
|
+
default: 'absolute',
|
|
244
|
+
validator: (value: 'fixed' | 'absolute') => {
|
|
245
|
+
return ['fixed', 'absolute'].includes(value)
|
|
246
|
+
},
|
|
247
|
+
},
|
|
238
248
|
/**
|
|
239
249
|
* Dropdown show / hide transition name
|
|
240
250
|
*/
|
|
@@ -362,14 +372,14 @@ export const InputTextareaProps = {
|
|
|
362
372
|
* Available for input types: text, search, url, tel, email, password
|
|
363
373
|
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#minlength
|
|
364
374
|
*/
|
|
365
|
-
minlength: Number,
|
|
375
|
+
minlength: [String, Number],
|
|
366
376
|
/**
|
|
367
377
|
* Input / Textarea maxlength
|
|
368
378
|
* Maximum length (number of characters) of value
|
|
369
379
|
* Available for input types: text, search, url, tel, email, password
|
|
370
380
|
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#maxlength
|
|
371
381
|
*/
|
|
372
|
-
maxlength: Number,
|
|
382
|
+
maxlength: [String, Number],
|
|
373
383
|
/**
|
|
374
384
|
* Input / Textarea placeholder
|
|
375
385
|
* Text that appears in the form control when it has no value set
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { ref } from 'vue'
|
|
2
|
+
import { Meta, Story, Canvas } from '@storybook/addon-docs'
|
|
3
|
+
import { defaultArgs, argTypes } from './Dropdown.settings'
|
|
4
|
+
import VvDropdown from '@/components/VvDropdown/VvDropdown.vue'
|
|
5
|
+
import VvDropdownAction from '@/components/VvDropdown/VvDropdownAction.vue'
|
|
6
|
+
import VvIcon from '@/components/VvIcon/VvIcon.vue'
|
|
7
|
+
|
|
8
|
+
<Meta title="Directives/Contextmenu" args={defaultArgs} argTypes={argTypes} />
|
|
9
|
+
|
|
10
|
+
export const Template = (args, { argTypes }) => ({
|
|
11
|
+
props: Object.keys(argTypes),
|
|
12
|
+
components: { VvDropdown, VvDropdownAction, VvIcon },
|
|
13
|
+
setup() {
|
|
14
|
+
const dropdownEl = ref(null)
|
|
15
|
+
return { args, dropdownEl }
|
|
16
|
+
},
|
|
17
|
+
template: /* html */ `
|
|
18
|
+
<div v-contextmenu="dropdownEl" class="w-full h-320 bg-surface-1 flex items-center justify-center">
|
|
19
|
+
<div class="text-word-2 text-18 uppercase w-150 text-center">Right click context menu</div>
|
|
20
|
+
</div>
|
|
21
|
+
<vv-dropdown v-bind="args" ref="dropdownEl">
|
|
22
|
+
<template #items>
|
|
23
|
+
<vv-dropdown-action>
|
|
24
|
+
<vv-icon name="add" /> Create
|
|
25
|
+
</vv-dropdown-action>
|
|
26
|
+
<vv-dropdown-action>
|
|
27
|
+
<vv-icon name="edit" /> Update
|
|
28
|
+
</vv-dropdown-action>
|
|
29
|
+
<vv-dropdown-action>
|
|
30
|
+
<vv-icon name="trash" /> Delete
|
|
31
|
+
</vv-dropdown-action>
|
|
32
|
+
</template>
|
|
33
|
+
</vv-dropdown>
|
|
34
|
+
`,
|
|
35
|
+
})
|
|
36
|
+
|
|
37
|
+
<Canvas>
|
|
38
|
+
<Story name="Default" args={{ placement: 'bottom-start' }}>
|
|
39
|
+
{Template.bind()}
|
|
40
|
+
</Story>
|
|
41
|
+
</Canvas>
|
package/src/stories/argTypes.ts
CHANGED
|
@@ -298,6 +298,16 @@ export const DropdownArgTypes = {
|
|
|
298
298
|
defaultValue: { summary: 'bottom' },
|
|
299
299
|
},
|
|
300
300
|
},
|
|
301
|
+
strategy: {
|
|
302
|
+
description: 'Dropdown strategy',
|
|
303
|
+
options: ['fixed', 'absolute'],
|
|
304
|
+
control: {
|
|
305
|
+
type: 'select',
|
|
306
|
+
},
|
|
307
|
+
table: {
|
|
308
|
+
defaultValue: { summary: 'absolute' },
|
|
309
|
+
},
|
|
310
|
+
},
|
|
301
311
|
transitionName: {
|
|
302
312
|
description: 'Dropdown show / hide transition name',
|
|
303
313
|
control: {
|