Skip to content

Commit 370f62a

Browse files
committed
chore: update
1 parent 9760345 commit 370f62a

File tree

2 files changed

+4
-28
lines changed

2 files changed

+4
-28
lines changed

Diff for: packages/core/src/components/Input.ts

+2-13
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import chalk from 'chalk'
44
import { TuiText } from './Text'
55
import { onInputData } from '../composables/input'
66
import type { KeyDataEvent } from '../input/types'
7-
import { useFocus } from '../focus/Focusable'
87

98
const SKIP_EVENT_KEY = ['ArrowUp', 'ArrowDown', 'Ctrl', 'Tab', 'Shift']
109
const PWD_FIGURE = '*'
@@ -23,16 +22,11 @@ export const TuiInput = defineComponent({
2322
type: String as PropType<'text' | 'password'>,
2423
default: 'text',
2524
},
26-
focus: {
27-
type: Boolean,
28-
required: true,
29-
},
3025
},
3126
emits: ['update:modelValue'],
3227
setup(props, { emit }) {
33-
const { active, isFocus } = useFocus({
34-
active: props.focus,
35-
})
28+
// TODO: focus,blur support
29+
const active = ref(true)
3630
const cursorOffset = ref(props.modelValue.length)
3731
const content = computed(() => {
3832
if (active.value) {
@@ -67,11 +61,6 @@ export const TuiInput = defineComponent({
6761
}
6862
})
6963

70-
watch(
71-
() => props.focus,
72-
(value) => (isFocus.value = value)
73-
)
74-
7564
function updateCursorOffset(offset: number) {
7665
cursorOffset.value = Math.max(
7766
0,

Diff for: packages/core/src/focus/Focusable.ts

+2-15
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import {
88
unref,
99
onMounted,
1010
} from '@vue/runtime-core'
11-
import type { WritableComputedRef } from '@vue/runtime-core'
1211
import { checkCurrentInstance, MaybeRef } from '../utils'
1312
import { Focusable, FocusId } from './types'
1413
import { useFocusManager } from './FocusManager'
@@ -35,9 +34,7 @@ export function useFocus({
3534
active: startsActive,
3635
disabled: startsDisabled,
3736
id: idSource,
38-
}: FocusableOptions = {}): Focusable & {
39-
isFocus: WritableComputedRef<boolean>
40-
} {
37+
}: FocusableOptions = {}): Focusable {
4138
if (!checkCurrentInstance('useFocus')) {
4239
throw new Error('Cannot create a focusable without an instance')
4340
}
@@ -87,15 +84,5 @@ export function useFocus({
8784
focusable._i = null
8885
})
8986

90-
return {
91-
...focusable,
92-
isFocus: computed<boolean>({
93-
get() {
94-
return active.value
95-
},
96-
set(value) {
97-
focus(value ? unref(id) : null)
98-
},
99-
}),
100-
}
87+
return focusable
10188
}

0 commit comments

Comments
 (0)