From 809704fee001bc36edf1f2bdbd641a44c7e7214f Mon Sep 17 00:00:00 2001 From: ielgnaw Date: Wed, 31 Jul 2024 15:44:09 +0800 Subject: [PATCH] feat: bump to 2.5.9-beta.37 --- example/components/changelog/readme.md | 8 +++++++ example/components/form/example.vue | 6 ++--- example/components/input/readme.md | 32 ++++++++++++++++++++++++++ package.json | 2 +- src/components/input/input.vue | 17 +++++++++++--- 5 files changed, 57 insertions(+), 8 deletions(-) diff --git a/example/components/changelog/readme.md b/example/components/changelog/readme.md index 1b92835a..bdc2022e 100644 --- a/example/components/changelog/readme.md +++ b/example/components/changelog/readme.md @@ -8,6 +8,14 @@
+### 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]**: diff --git a/example/components/form/example.vue b/example/components/form/example.vue index 60333276..bbaa2547 100644 --- a/example/components/form/example.vue +++ b/example/components/form/example.vue @@ -30,12 +30,9 @@
- + - - -
@@ -53,6 +50,7 @@ export default { data () { return { isChecking: false, + desc: '

asdsad

', formData: { docker_hub: '', extra_domains: '' diff --git a/example/components/input/readme.md b/example/components/input/readme.md index 8ade440c..a74147bb 100644 --- a/example/components/input/readme.md +++ b/example/components/input/readme.md @@ -101,6 +101,37 @@ ``` ::: +### 不能允许输入表情 {page=#/input} + +::: demo 通过 `allow-emoji` 属性,配置是否允许文本框输入表情,默认为 `true`,设置为 `false` 时,不允许输入表情,此时文本框会自动把输入的表情过滤掉 +``` html + + + +``` +::: + ### hover 时才显示 clear 按钮{page=#/input} ::: demo 配置`show-clear-only-hover`为true时,清除按钮在hover时才会显示 @@ -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} diff --git a/package.json b/package.json index 8a5a9f90..a91224c7 100644 --- a/package.json +++ b/package.json @@ -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": [ diff --git a/src/components/input/input.vue b/src/components/input/input.vue index 379c3203..e5329a75 100644 --- a/src/components/input/input.vue +++ b/src/components/input/input.vue @@ -280,7 +280,11 @@ export default { type: Boolean, default: false }, - initialControlValue: Number + initialControlValue: Number, + allowEmoji: { + type: Boolean, + default: true + } }, data () { return { @@ -727,7 +731,6 @@ export default { } } } - this.$emit('keydown', value, event) }, handlerFocus (event) { @@ -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)