Skip to content

Commit

Permalink
Merge pull request #570 from ielgnaw/staging
Browse files Browse the repository at this point in the history
feat: bump to 2.5.9-beta.37
  • Loading branch information
ielgnaw authored Jul 31, 2024
2 parents 54f6f5c + 809704f commit 8896163
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 8 deletions.
8 changes: 8 additions & 0 deletions example/components/changelog/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,14 @@

<div class="changelog-wrapper">

### 2.5.9-beta.37 {page=#/changelog}

* **[add]**:
- [Input 输入框](#/input) 新增 `allow-emoji` 属性,配置文本框是否允许输入表情,默认为 `true`
* **[fix]**:
- bugfix(table): selection类型列 header-render失效 #559 & 配置化表格hover全选按钮会丢失填充背景色


### 2.5.9-beta.36 {page=#/changelog}

* **[fix]**:
Expand Down
6 changes: 2 additions & 4 deletions example/components/form/example.vue
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,9 @@
<section>
<div class="example-item">
<bk-form :label-width="200" :model="formData" :rules="rules" ref="validateForm1">
<bk-form-item label="测试环境地址" :property="'docker_hub'" :error-display-type="'normal'">
<bk-form-item label="test" :property="'docker_hub'" :error-display-type="'normal'" :desc="desc">
<bk-input v-model="formData.docker_hub"></bk-input>
</bk-form-item>
<bk-form-item label="涉及外部域名" :property="'extra_domains'" :error-display-type="'normal'">
<bk-input v-model="formData.extra_domains"></bk-input>
</bk-form-item>
</bk-form>
</div>
</section>
Expand All @@ -53,6 +50,7 @@ export default {
data () {
return {
isChecking: false,
desc: '<h1 style="color: red">asdsad</h1>',
formData: {
docker_hub: '',
extra_domains: ''
Expand Down
32 changes: 32 additions & 0 deletions example/components/input/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,37 @@
```
:::

### 不能允许输入表情 {page=#/input}

::: demo 通过 `allow-emoji` 属性,配置是否允许文本框输入表情,默认为 `true`,设置为 `false` 时,不允许输入表情,此时文本框会自动把输入的表情过滤掉
``` html
<template>
<div class="input-demo">
<bk-input :allow-emoji="false" v-model="value"></bk-input>
</div>
</template>
<script>
import { bkInput } from '{{BASE_LIB_NAME}}'
export default {
components: {
bkInput
},
data () {
return {
value: 'wwww'
}
}
}
</script>
<style lang="postcss">
.input-demo {
width: 500px;
}
</style>
```
:::

### hover 时才显示 clear 按钮{page=#/input}

::: demo 配置`show-clear-only-hover`为true时,清除按钮在hover时才会显示
Expand Down Expand Up @@ -712,6 +743,7 @@
| allow-number-paste | 允许type为number时可粘贴 | Boolean | —— | false |
| show-overflow-tooltips | 文本超出长度是否显示tooltips | Boolean | —— | false |
| initial-control-value | 设置上下键调整数值时的起始值 | Number | —— | —— |
| allow-emoji | 是否允许文本框输入表情,默认为 `true`,设置为 `false` 时,不允许输入表情,此时文本框会自动把输入的表情过滤 | Boolean | —— | true |

### 事件 {page=#/input}

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "bk-magic-vue",
"version": "2.5.9-beta.36",
"version": "2.5.9-beta.37",
"description": "基于蓝鲸 Magicbox 和 Vue 的前端组件库",
"main": "dist/bk-magic-vue.min.js",
"files": [
Expand Down
17 changes: 14 additions & 3 deletions src/components/input/input.vue
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,11 @@ export default {
type: Boolean,
default: false
},
initialControlValue: Number
initialControlValue: Number,
allowEmoji: {
type: Boolean,
default: true
}
},
data () {
return {
Expand Down Expand Up @@ -727,7 +731,6 @@ export default {
}
}
}

this.$emit('keydown', value, event)
},
handlerFocus (event) {
Expand Down Expand Up @@ -807,8 +810,16 @@ export default {
if (this.inputType === 'number' && this.isOnComposition) {
return
}

this.$nextTick(() => {
const value = event.target.value
let value = event.target.value
if (!this.allowEmoji) {
value = value.replace(
/[\uD83C|\uD83D|\uD83E][\uDC00-\uDFFF][\u200D|\uFE0F]|[\uD83C|\uD83D|\uD83E][\uDC00-\uDFFF]|[0-9|*|#]\uFE0F\u20E3|[0-9|#]\u20E3|[\u203C-\u3299]\uFE0F\u200D|[\u203C-\u3299]\uFE0F|[\u2122-\u2B55]|\u303D|[\A9|\AE]\u3030|\uA9|\uAE|\u3030/ig,
''
)
}

this.setCurValue(value)
this.$emit('input', value, event)
this.$emit('change', value, event)
Expand Down

0 comments on commit 8896163

Please sign in to comment.