Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
b2e9340
feat: add name
william-xue Mar 3, 2025
dda43c3
feat: add function signature
william-xue Mar 3, 2025
960ad7b
fix: adjust css
william-xue Mar 3, 2025
46e4e7b
fix: adjust css
william-xue Mar 4, 2025
ca79f54
feat: signature finish
william-xue Mar 4, 2025
f4cf2a7
Merge branch 'varletjs:dev' into dev
william-xue Mar 4, 2025
cf7df45
feat: add test cases
william-xue Mar 4, 2025
b15d038
feat: add test cases
william-xue Mar 5, 2025
0796c74
feat: test cases
william-xue Mar 5, 2025
e8bf4ca
feat: resolve
william-xue Mar 9, 2025
600a11c
feat: fix
william-xue Mar 10, 2025
375c477
Merge branch 'varletjs:dev' into dev
william-xue Mar 10, 2025
bb63493
feat: test case
william-xue Mar 10, 2025
62895d4
feat: test case
william-xue Mar 10, 2025
bd7fe46
feat: expose empty
william-xue Mar 10, 2025
5b746cd
Merge branch 'varletjs:dev' into dev
william-xue Mar 11, 2025
8857fb8
feat: resolve
william-xue Mar 11, 2025
34158dc
refactor: optimize event handling with useEventListener hook
william-xue Mar 11, 2025
5cfc324
refactor: remove duplicate onMounted hook and clean up unnecessary code
william-xue Mar 11, 2025
f228328
refactor: add
william-xue Mar 11, 2025
faf5c08
Merge branch 'varletjs:dev' into dev
william-xue Mar 11, 2025
fd9a16c
refactor: add
william-xue Mar 11, 2025
f8ab947
refactor: add
william-xue Mar 11, 2025
c5ad7cd
feat: resolve comment
william-xue Mar 14, 2025
75682a1
feat: resolve comment
william-xue Mar 14, 2025
1268d01
feat: resolve comment
william-xue Mar 14, 2025
a52f477
feat: cleanup
haoziqaq Mar 15, 2025
01f61e7
feat: test cases
william-xue Mar 18, 2025
4e61cfb
feat: docs finish
william-xue Mar 18, 2025
d6811dd
feat: resolve comment
william-xue Mar 18, 2025
e71f0f3
feat: "resolve comment"
william-xue Mar 19, 2025
3e7c88f
refactor: cleanup
haoziqaq Mar 20, 2025
f50640e
types: fix types
haoziqaq Mar 20, 2025
8a6c042
types: fix types
haoziqaq Mar 20, 2025
05a17bd
Merge branch 'varletjs:dev' into dev
william-xue Mar 20, 2025
d150b65
Merge branch 'varletjs:dev' into dev
william-xue Jun 3, 2025
a935cea
Merge branch 'varletjs:dev' into dev
william-xue Jun 30, 2025
dc386a0
feat(theme): support toRem and convert
haoziqaq Jun 11, 2025
ea1fbb0
v3.10.9
haoziqaq Jun 12, 2025
250cde9
refactor(ellipsis): improve availability
haoziqaq Jun 16, 2025
dfb563a
docs: fix quotes (#1905)
A81N9 Jun 20, 2025
0dbb2e0
v3.11.0
haoziqaq Jun 22, 2025
260b2a4
docs: fix english quotation conflict (#1909)
A81N9 Jun 23, 2025
81ffdcd
feat(ui/input): add select method
Jul 2, 2025
6ab2c9d
feat(input): 为轮廓输入框添加全选功能
Jul 10, 2025
cd9f395
fix: resolve merge conflicts
Jul 16, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions packages/varlet-ui/src/input/Input.vue
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,11 @@ export default defineComponent({
;(el.value as HTMLInputElement).blur()
}

// expose
function select() {
;(el.value as HTMLInputElement).select()
}

return {
el,
id,
Expand Down Expand Up @@ -397,6 +402,7 @@ export default defineComponent({
reset,
focus,
blur,
select,
}
},
})
Expand Down
30 changes: 30 additions & 0 deletions packages/varlet-ui/src/input/docs/en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ const value11 = ref('')
const value12 = ref('')
const value13 = ref('')
const value14 = ref('')
const value15 = ref('')
Comment thread
haoziqaq marked this conversation as resolved.
const inputRef = ref()

const selectAll = () => {
inputRef.value?.select()
}
</script>

<template>
Expand Down Expand Up @@ -69,6 +75,14 @@ const value14 = ref('')
<var-input placeholder="Textarea" textarea v-model="value10" />
<var-input placeholder="Small Size" size="small" v-model="value11" />
<var-input placeholder="Removes whitespace from both ends of this string" v-model.trim="value12" />
<var-space>
<var-input
ref="inputRef"
placeholder="Enter text and click the button to select all"
v-model="value15"
/>
<var-button type="primary" @click="selectAll">Select All</var-button>
</var-space>
</var-space>
</template>

Expand Down Expand Up @@ -104,6 +118,12 @@ const value11 = ref('')
const value12 = ref('')
const value13 = ref('')
const value14 = ref('')
const value15 = ref('')
const inputRef = ref()

const selectAll = () => {
inputRef.value?.select()
}
</script>

<template>
Expand Down Expand Up @@ -154,6 +174,14 @@ const value14 = ref('')
<var-input variant="outlined" placeholder="Textarea" textarea v-model="value10" />
<var-input variant="outlined" placeholder="Small Size" size="small" v-model="value11" />
<var-input variant="outlined" placeholder="Removes whitespace from both ends of this string" v-model.trim="value12" />
<var-space>
<var-input
ref="inputRef"
placeholder="Enter text and click the button to select all"
v-model="value15"
/>
<var-button type="primary" @click="selectAll">Select All</var-button>
</var-space>
</var-space>
</template>

Expand Down Expand Up @@ -203,6 +231,7 @@ const value14 = ref('')
| --- | --- | --- | --- |
| `focus` | Focus | `-` | `-` |
| `blur` | Blur | `-` | `-` |
| `select` | Select all text in the input | `-` | `-` |
| `validate` | Trigger validate | `-` | `valid: Promise<boolean>` |
| `resetValidation` | Clear validate messages | `-` | `-` |
| `reset` | Clear the value of the binding and validate messages | `-` | `-` |
Expand All @@ -218,6 +247,7 @@ const value14 = ref('')
| `input` | Triggered on input | `value: string`, `event: Event` |
| `change` | Triggered on change | `value: string`, `event: Event` |


### Slots

| Name | Description | SlotProps |
Expand Down
17 changes: 17 additions & 0 deletions packages/varlet-ui/src/input/docs/zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
<script setup>
import { ref } from 'vue'
import { z } from 'zod'
import { Snackbar } from '@varlet/ui'

const value = ref('')
const value2 = ref('')
Expand All @@ -25,6 +26,12 @@ const value11 = ref('')
const value12 = ref('')
const value13 = ref('')
const value14 = ref('')
const value15 = ref('')
const inputRef = ref()

const selectAll = () => {
inputRef.value?.select()
}
</script>

<template>
Expand Down Expand Up @@ -69,6 +76,14 @@ const value14 = ref('')
<var-input placeholder="文本域" textarea v-model="value10" />
<var-input placeholder="小尺寸" size="small" v-model="value11" />
<var-input placeholder="移除空白字符" v-model.trim="value12" />
<var-space>
<var-input
ref="inputRef"
placeholder="输入文本后点击按钮全选"
v-model="value15"
/>
<var-button type="primary" @click="selectAll">全选</var-button>
</var-space>
</var-space>
</template>

Expand Down Expand Up @@ -203,6 +218,7 @@ const value14 = ref('')
| --- | --- | --- | --- |
| `focus` | 聚焦 | `-` | `-` |
| `blur` | 失焦 | `-` | `-` |
| `select` | 选中输入框中的所有文本 | `-` | `-` |
| `validate` | 触发校验 | `-` | `valid: Promise<boolean>` |
| `resetValidation` | 清空校验信息 | `-` | `-` |
| `reset` | 清空绑定的值和校验信息 | `-` | `-` |
Expand All @@ -218,6 +234,7 @@ const value14 = ref('')
| `input` | 输入时触发 | `value: string`, `event: Event` |
| `change` | 更新时触发 | `value: string`, `event: Event` |


### 插槽

| 插槽名 | 说明 | 参数 |
Expand Down
21 changes: 21 additions & 0 deletions packages/varlet-ui/src/input/example/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const standardValue11 = ref('')
const standardValue12 = ref('')
const standardValue13 = ref('')
const standardValue14 = ref('')
const standardValue15 = ref('')

const outlinedValue = ref('')
const outlinedValue2 = ref('')
Expand All @@ -33,6 +34,18 @@ const outlinedValue11 = ref('')
const outlinedValue12 = ref('')
const outlinedValue13 = ref('')
const outlinedValue14 = ref('')
const outlinedValue15 = ref('')

const inputRef = ref()
const outlinedInputRef = ref()

const selectAll = () => {
inputRef.value?.select()
}

const selectAllOutlined = () => {
outlinedInputRef.value?.select()
}

watchLang(use)
onThemeChange()
Expand Down Expand Up @@ -78,6 +91,10 @@ onThemeChange()
<var-input v-model="standardValue10" :placeholder="t('textarea')" textarea />
<var-input v-model="standardValue11" :placeholder="t('smallSize')" size="small" />
<var-input v-model.trim="standardValue12" :placeholder="t('trim')" />
<var-space align="center">
<var-input ref="inputRef" v-model="standardValue15" :placeholder="t('selectAll')" />
<var-button type="primary" @click="selectAll">{{ t('selectAllButton') }}</var-button>
</var-space>
</var-space>

<app-type style="margin-top: 10vmin">{{ t('outlined') }}</app-type>
Expand Down Expand Up @@ -124,6 +141,10 @@ onThemeChange()
<var-input v-model="outlinedValue10" variant="outlined" :placeholder="t('textarea')" textarea />
<var-input v-model="outlinedValue11" variant="outlined" :placeholder="t('smallSize')" size="small" />
<var-input v-model.trim="outlinedValue12" variant="outlined" :placeholder="t('trim')" />
<var-space align="center">
<var-input ref="outlinedInputRef" v-model="outlinedValue15" variant="outlined" :placeholder="t('selectAll')" />
<var-button type="primary" @click="selectAllOutlined">{{ t('selectAllButton') }}</var-button>
</var-space>
</var-space>

<div style="height: 40px"></div>
Expand Down
6 changes: 4 additions & 2 deletions packages/varlet-ui/src/input/example/locale/en-US.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,13 @@ export default {
clearable: 'Clearable',
clearIconSlot: 'Use the clear icon slot',
displayIcon: 'Display Icon',
customIconSize: 'Custom Icon Size',
customIconSize: 'Custom Clear Icon',
validate: 'Validate',
validateWithZod: 'Validate With Zod',
placeholder: 'Please enter text',
numberPlaceholder: 'Please enter number',
maxMessage: 'Text length must be greater than 6',
clearableText: 'Clearable Text',
clearableText: 'Clearable text',
selectAll: 'Type text and click button to select all',
selectAllButton: 'Select All',
}
2 changes: 2 additions & 0 deletions packages/varlet-ui/src/input/example/locale/zh-CN.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,6 @@ export default {
numberPlaceholder: '请输入数字',
maxMessage: '文本长度必须大于6',
clearableText: '可清除文本',
selectAll: '输入文本后点击按钮 全选',
selectAllButton: '全选',
}
2 changes: 2 additions & 0 deletions packages/varlet-ui/types/input.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ export class Input extends VarComponent {

blur(): void

select(): void

validate(): Promise<boolean>

resetValidation(): void
Expand Down