@veltra/desktop 1.1.21 → 1.1.23
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/action/action-group.vue.d.ts +1 -1
- package/dist/components/action/action.vue.d.ts +1 -1
- package/dist/components/auto-complete/auto-complete.vue.d.ts +1 -1
- package/dist/components/batch-edit/batch-edit.vue.d.ts +1 -1
- package/dist/components/cascade/cascade.vue.d.ts +5 -5
- package/dist/components/checkbox/checkbox-button.vue.d.ts +1 -1
- package/dist/components/checkbox-group/checkbox-group.vue.d.ts +1 -1
- package/dist/components/collapse/collapse-item.js +1 -2
- package/dist/components/collapse/collapse-item.js.map +1 -1
- package/dist/components/collapse/collapse.js +1 -11
- package/dist/components/collapse/collapse.js.map +1 -1
- package/dist/components/collapse/collapse.vue.d.ts +0 -1
- package/dist/components/collapse/di.js.map +1 -1
- package/dist/components/collapse/style2.css +29 -17
- package/dist/components/date-panel/date-panel.vue.d.ts +1 -1
- package/dist/components/date-picker/date-picker.vue.d.ts +1 -1
- package/dist/components/date-range-picker/date-range-picker.vue.d.ts +1 -1
- package/dist/components/drawer/drawer.vue.d.ts +2 -2
- package/dist/components/empty/empty.vue.d.ts +1 -1
- package/dist/components/file-viewer/file-viewer.vue.d.ts +1 -1
- package/dist/components/input/input.vue.d.ts +3 -3
- package/dist/components/input/style2.css +5 -2
- package/dist/components/multi-select/multi-select.vue.d.ts +4 -4
- package/dist/components/multi-tree-select/multi-tree-select.vue.d.ts +6 -6
- package/dist/components/notification/notification.vue.d.ts +1 -1
- package/dist/components/number/number.vue.d.ts +1 -1
- package/dist/components/number-input/number-input.vue.d.ts +3 -3
- package/dist/components/number-range-input/number-range-input.vue.d.ts +1 -1
- package/dist/components/password-input/password-input.js +30 -13
- package/dist/components/password-input/password-input.js.map +1 -1
- package/dist/components/password-input/password-input.vue.d.ts +1 -1
- package/dist/components/password-input/style2.css +21 -0
- package/dist/components/pop-confirm/pop-confirm.vue.d.ts +1 -1
- package/dist/components/progress-nodes/progress-nodes.vue.d.ts +2 -2
- package/dist/components/radio-group/radio-group.vue.d.ts +1 -1
- package/dist/components/rich-text-editor/rich-text-editor.vue.d.ts +1 -1
- package/dist/components/select/select.vue.d.ts +3 -3
- package/dist/components/table/node/col.js +2 -2
- package/dist/components/table/node/col.js.map +1 -1
- package/dist/components/tabs/tabs-horizontal.vue.d.ts +3 -3
- package/dist/components/tabs/tabs-vertical.vue.d.ts +3 -3
- package/dist/components/tabs/tabs.vue.d.ts +3 -3
- package/dist/components/textarea/style2.css +7 -4
- package/dist/components/textarea/textarea.vue.d.ts +3 -3
- package/dist/components/tip/tip.vue.d.ts +1 -1
- package/dist/components/tree-select/tree-select.vue.d.ts +6 -6
- package/dist/components/watermark/watermark.vue.d.ts +1 -1
- package/dist/types/collapse.d.ts +0 -5
- package/package.json +23 -25
- package/src/components/collapse/collapse-item.vue +1 -2
- package/src/components/collapse/collapse.vue +2 -6
- package/src/components/collapse/di.ts +0 -1
- package/src/components/collapse/style.scss +57 -37
- package/src/components/input/style.scss +3 -6
- package/src/components/password-input/__test__/password-input.test.ts +90 -0
- package/src/components/password-input/password-input.vue +28 -13
- package/src/components/password-input/style.scss +22 -1
- package/src/components/table/node/col.ts +2 -2
- package/src/components/textarea/style.scss +3 -2
- package/src/types/collapse.ts +0 -6
|
@@ -28,15 +28,12 @@ $root-name: input;
|
|
|
28
28
|
height: fn.use-var(form-component-height, $size);
|
|
29
29
|
border-radius: fn.use-var(radius, $size);
|
|
30
30
|
padding: 0 calc(fn.use-var(gap, $size) / 2);
|
|
31
|
+
font-size: fn.use-var(font-size-main, $size);
|
|
31
32
|
|
|
32
33
|
@include m.bem($root-name, native) {
|
|
33
34
|
height: fn.use-var(form-component-height, $size);
|
|
34
35
|
line-height: fn.use-var(form-component-height, $size);
|
|
35
36
|
}
|
|
36
|
-
|
|
37
|
-
// @include m.bem($root-name, clear) {
|
|
38
|
-
// font-size: fn.use-var(font-size-main, $size);
|
|
39
|
-
// }
|
|
40
37
|
}
|
|
41
38
|
|
|
42
39
|
@include m.is(focus) {
|
|
@@ -51,7 +48,7 @@ $root-name: input;
|
|
|
51
48
|
width: 100%;
|
|
52
49
|
flex-grow: 1;
|
|
53
50
|
color: fn.use-var(text-color, main);
|
|
54
|
-
font-size:
|
|
51
|
+
font-size: inherit;
|
|
55
52
|
padding: 0;
|
|
56
53
|
font-family: fn.use-var(font-family);
|
|
57
54
|
|
|
@@ -66,7 +63,7 @@ $root-name: input;
|
|
|
66
63
|
}
|
|
67
64
|
|
|
68
65
|
@include m.e(prefix, suffix) {
|
|
69
|
-
font-size:
|
|
66
|
+
font-size: inherit;
|
|
70
67
|
color: fn.use-var(text-color, main);
|
|
71
68
|
flex-shrink: 0;
|
|
72
69
|
min-width: 20px;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest'
|
|
2
|
+
import { createApp, h, nextTick, ref } from 'vue'
|
|
3
|
+
|
|
4
|
+
import UPasswordInput from '../password-input.vue'
|
|
5
|
+
|
|
6
|
+
function mountPasswordInput(props: Record<string, unknown>) {
|
|
7
|
+
const host = document.createElement('div')
|
|
8
|
+
document.body.appendChild(host)
|
|
9
|
+
|
|
10
|
+
const model = ref(props.modelValue as string | undefined)
|
|
11
|
+
const app = createApp({
|
|
12
|
+
render() {
|
|
13
|
+
return h(UPasswordInput, {
|
|
14
|
+
...props,
|
|
15
|
+
modelValue: model.value,
|
|
16
|
+
'onUpdate:modelValue': (value: string | undefined) => {
|
|
17
|
+
model.value = value
|
|
18
|
+
}
|
|
19
|
+
})
|
|
20
|
+
}
|
|
21
|
+
})
|
|
22
|
+
|
|
23
|
+
app.mount(host)
|
|
24
|
+
|
|
25
|
+
return {
|
|
26
|
+
host,
|
|
27
|
+
model,
|
|
28
|
+
unmount() {
|
|
29
|
+
app.unmount()
|
|
30
|
+
host.remove()
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
describe('PasswordInput', () => {
|
|
36
|
+
it('keeps visibility toggle while clear control is shown on hover', async () => {
|
|
37
|
+
const { host, unmount } = mountPasswordInput({ modelValue: 'secret', clearable: true })
|
|
38
|
+
|
|
39
|
+
try {
|
|
40
|
+
expect(host.querySelector('.u-password-input__visibility-toggle')).not.toBeNull()
|
|
41
|
+
|
|
42
|
+
host.querySelector('.u-password-input')?.dispatchEvent(new MouseEvent('mouseenter'))
|
|
43
|
+
await nextTick()
|
|
44
|
+
|
|
45
|
+
expect(host.querySelector('.u-password-input__clear')).not.toBeNull()
|
|
46
|
+
expect(host.querySelector('.u-password-input__visibility-toggle')).not.toBeNull()
|
|
47
|
+
} finally {
|
|
48
|
+
unmount()
|
|
49
|
+
}
|
|
50
|
+
})
|
|
51
|
+
|
|
52
|
+
it('toggles password visibility when clearable', async () => {
|
|
53
|
+
const { host, unmount } = mountPasswordInput({ modelValue: 'secret', clearable: true })
|
|
54
|
+
|
|
55
|
+
try {
|
|
56
|
+
const native = host.querySelector('.u-input__native') as HTMLInputElement
|
|
57
|
+
expect(native.value).toBe('●●●●●●')
|
|
58
|
+
|
|
59
|
+
host
|
|
60
|
+
.querySelector('.u-password-input__visibility-toggle')
|
|
61
|
+
?.dispatchEvent(new MouseEvent('click', { bubbles: true }))
|
|
62
|
+
await nextTick()
|
|
63
|
+
|
|
64
|
+
expect(native.value).toBe('secret')
|
|
65
|
+
} finally {
|
|
66
|
+
unmount()
|
|
67
|
+
}
|
|
68
|
+
})
|
|
69
|
+
|
|
70
|
+
it('toggles password visibility when clear control is visible on hover', async () => {
|
|
71
|
+
const { host, unmount } = mountPasswordInput({ modelValue: 'secret', clearable: true })
|
|
72
|
+
|
|
73
|
+
try {
|
|
74
|
+
const native = host.querySelector('.u-input__native') as HTMLInputElement
|
|
75
|
+
host.querySelector('.u-password-input')?.dispatchEvent(new MouseEvent('mouseenter'))
|
|
76
|
+
await nextTick()
|
|
77
|
+
|
|
78
|
+
expect(host.querySelector('.u-password-input__clear')).not.toBeNull()
|
|
79
|
+
|
|
80
|
+
host
|
|
81
|
+
.querySelector('.u-password-input__visibility-toggle')
|
|
82
|
+
?.dispatchEvent(new MouseEvent('click', { bubbles: true }))
|
|
83
|
+
await nextTick()
|
|
84
|
+
|
|
85
|
+
expect(native.value).toBe('secret')
|
|
86
|
+
} finally {
|
|
87
|
+
unmount()
|
|
88
|
+
}
|
|
89
|
+
})
|
|
90
|
+
})
|
|
@@ -6,17 +6,22 @@
|
|
|
6
6
|
:size="size"
|
|
7
7
|
:readonly="readonly"
|
|
8
8
|
:disabled="disabled"
|
|
9
|
+
:clearable="false"
|
|
9
10
|
@native:input="handleUpdatePwd"
|
|
10
11
|
@update:model-value="!$event && handleClear()"
|
|
11
|
-
@
|
|
12
|
+
@mouseenter="handleMouseEnter"
|
|
13
|
+
@mouseleave="handleMouseLeave"
|
|
12
14
|
>
|
|
13
15
|
<template #suffix>
|
|
14
|
-
<
|
|
15
|
-
<UIcon :class="cls.e('
|
|
16
|
+
<span :class="cls.e('suffix')">
|
|
17
|
+
<UIcon v-if="showClear" :class="cls.e('clear')" title="清除" @click.stop="handleClear">
|
|
18
|
+
<Close />
|
|
19
|
+
</UIcon>
|
|
20
|
+
<UIcon :class="cls.e('visibility-toggle')" :size="18" @click.stop="toggleVisible">
|
|
16
21
|
<Hide v-if="pwdVisible" />
|
|
17
22
|
<View v-else />
|
|
18
23
|
</UIcon>
|
|
19
|
-
</
|
|
24
|
+
</span>
|
|
20
25
|
</template>
|
|
21
26
|
|
|
22
27
|
<template #prefix v-if="slots.prefix">
|
|
@@ -28,18 +33,16 @@
|
|
|
28
33
|
<script lang="ts" setup>
|
|
29
34
|
import { o } from '@cat-kit/core'
|
|
30
35
|
import { useFormFallbackProps } from '@veltra/compositions'
|
|
31
|
-
import { Hide, View } from '@veltra/icons/normal'
|
|
36
|
+
import { Close, Hide, View } from '@veltra/icons/normal'
|
|
32
37
|
import { bem } from '@veltra/utils'
|
|
33
38
|
import { injectFormContext } from '@veltra/utils'
|
|
34
|
-
import { computed, nextTick, shallowRef } from 'vue'
|
|
39
|
+
import { computed, nextTick, ref, shallowRef } from 'vue'
|
|
35
40
|
|
|
36
41
|
import type { PasswordInputProps } from '../../types'
|
|
37
42
|
import { UIcon } from '../icon'
|
|
38
43
|
import { UInput } from '../input'
|
|
39
44
|
|
|
40
|
-
defineOptions({
|
|
41
|
-
name: 'PasswordInput'
|
|
42
|
-
})
|
|
45
|
+
defineOptions({ name: 'PasswordInput' })
|
|
43
46
|
|
|
44
47
|
const props = withDefaults(defineProps<PasswordInputProps>(), {
|
|
45
48
|
clearable: false,
|
|
@@ -47,9 +50,7 @@ const props = withDefaults(defineProps<PasswordInputProps>(), {
|
|
|
47
50
|
readonly: undefined
|
|
48
51
|
})
|
|
49
52
|
|
|
50
|
-
const slots = defineSlots<{
|
|
51
|
-
prefix?: () => any
|
|
52
|
-
}>()
|
|
53
|
+
const slots = defineSlots<{ prefix?: () => any }>()
|
|
53
54
|
|
|
54
55
|
const { formProps } = injectFormContext()
|
|
55
56
|
|
|
@@ -60,13 +61,27 @@ const { size, disabled, readonly } = useFormFallbackProps([formProps ?? {}, prop
|
|
|
60
61
|
})
|
|
61
62
|
|
|
62
63
|
const inputProps = computed(() => {
|
|
63
|
-
return o(props).pick(['
|
|
64
|
+
return o(props).pick(['disabled', 'placeholder', 'size'])
|
|
64
65
|
})
|
|
65
66
|
|
|
66
67
|
const cls = bem('password-input')
|
|
67
68
|
|
|
68
69
|
const model = defineModel<string>()
|
|
69
70
|
|
|
71
|
+
const hovered = ref(false)
|
|
72
|
+
|
|
73
|
+
const handleMouseEnter = (): void => {
|
|
74
|
+
hovered.value = true
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
const handleMouseLeave = (): void => {
|
|
78
|
+
hovered.value = false
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
const showClear = computed(() => {
|
|
82
|
+
return props.clearable && !disabled.value && !!model.value && hovered.value
|
|
83
|
+
})
|
|
84
|
+
|
|
70
85
|
const passwordChar = '●'
|
|
71
86
|
|
|
72
87
|
const handleUpdatePwd = (e: Event): void => {
|
|
@@ -5,7 +5,28 @@
|
|
|
5
5
|
$root-name: password-input;
|
|
6
6
|
|
|
7
7
|
@include m.b($root-name) {
|
|
8
|
+
@include m.e(suffix) {
|
|
9
|
+
display: inline-flex;
|
|
10
|
+
align-items: center;
|
|
11
|
+
justify-content: center;
|
|
12
|
+
height: 100%;
|
|
13
|
+
gap: 2px;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
@include m.e(clear) {
|
|
17
|
+
cursor: pointer;
|
|
18
|
+
flex-shrink: 0;
|
|
19
|
+
width: 20px;
|
|
20
|
+
border-radius: fn.use-var(radius, default);
|
|
21
|
+
transition: color 0.25s;
|
|
22
|
+
|
|
23
|
+
&:hover {
|
|
24
|
+
color: fn.use-var(color, primary);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
8
28
|
@include m.e(visibility-toggle) {
|
|
9
|
-
|
|
29
|
+
cursor: pointer;
|
|
30
|
+
flex-shrink: 0;
|
|
10
31
|
}
|
|
11
32
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { TreeNode } from '@cat-kit/core'
|
|
2
|
-
import { reactive, shallowReactive } from 'vue'
|
|
2
|
+
import { isReactive, reactive, shallowReactive } from 'vue'
|
|
3
3
|
|
|
4
4
|
import type { TableColumn, TableColumnAlign } from '../../../types'
|
|
5
5
|
|
|
@@ -97,6 +97,6 @@ export class ColumnNode extends TreeNode<TableColumn, ColumnNode> {
|
|
|
97
97
|
style: Record<string, number> = reactive({})
|
|
98
98
|
|
|
99
99
|
constructor(val: TableColumn, index: number, depth: number, parent?: ColumnNode) {
|
|
100
|
-
super(val ?
|
|
100
|
+
super(isReactive(val) ? val : shallowReactive(val), index, depth, parent)
|
|
101
101
|
}
|
|
102
102
|
}
|
|
@@ -23,6 +23,7 @@ $root-name: textarea;
|
|
|
23
23
|
|
|
24
24
|
@include m.size using ($size) {
|
|
25
25
|
border-radius: fn.use-var(radius, $size);
|
|
26
|
+
font-size: fn.use-var(font-size-main, $size);
|
|
26
27
|
|
|
27
28
|
@include m.bem($root-name, native) {
|
|
28
29
|
padding: calc(fn.use-var(gap, $size) / 2);
|
|
@@ -31,7 +32,7 @@ $root-name: textarea;
|
|
|
31
32
|
}
|
|
32
33
|
|
|
33
34
|
@include m.bem($root-name, clear) {
|
|
34
|
-
font-size:
|
|
35
|
+
font-size: inherit;
|
|
35
36
|
}
|
|
36
37
|
}
|
|
37
38
|
|
|
@@ -41,7 +42,7 @@ $root-name: textarea;
|
|
|
41
42
|
border: none;
|
|
42
43
|
background-color: transparent;
|
|
43
44
|
font-family: fn.use-var(font-family);
|
|
44
|
-
font-size:
|
|
45
|
+
font-size: inherit;
|
|
45
46
|
width: 100%;
|
|
46
47
|
display: block;
|
|
47
48
|
padding: 0;
|
package/src/types/collapse.ts
CHANGED