From 4db23c9f8a9a478b0a4568550f7d4f61d82acf2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=B1=E7=9C=A0=E5=84=80=E5=BC=8F?= <854085467@qq.com> Date: Sat, 24 Sep 2022 13:22:05 +0800 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8(component):=20update?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../component/src/component/input/index.vue | 16 +++++----- .../component/src/component/select/index.vue | 31 ++++++++++++++----- .../src/component/selectOption/index.vue | 16 +++++++--- .../src/component/tagInput/index.less | 15 +++++++-- .../src/component/tagInput/index.vue | 31 ++++++++++--------- .../src/document/zh-CN/components/tagInput.md | 27 ++++++++++++++++ .../src/document/zh-CN/guide/changelog.md | 30 +++++++++++------- 7 files changed, 117 insertions(+), 49 deletions(-) diff --git a/package/component/src/component/input/index.vue b/package/component/src/component/input/index.vue index 553ba6de..f0a99a86 100644 --- a/package/component/src/component/input/index.vue +++ b/package/component/src/component/input/index.vue @@ -166,14 +166,6 @@ const showPassword = () => { @compositionstart="onCompositionstart" @compositionend="onCompositionend" /> - - - - { + + + + diff --git a/package/component/src/component/select/index.vue b/package/component/src/component/select/index.vue index e72bacbb..d8251c39 100644 --- a/package/component/src/component/select/index.vue +++ b/package/component/src/component/select/index.vue @@ -10,9 +10,7 @@ import { provide, computed, WritableComputedRef, ref } from "vue"; import LayInput from "../input/index.vue"; import LayTagInput from "../tagInput/index.vue"; import LayDropdown from "../dropdown/index.vue"; -import LaySelectOption, { - LaySelectOptionProps, -} from "../selectOption/index.vue"; +import LaySelectOption, { LaySelectOptionProps } from "../selectOption/index.vue"; export interface LaySelectProps { name?: string; @@ -67,16 +65,35 @@ provide("multiple", multiple); - + + + + + + :placeholder="placeholder" + :allow-clear="true" + > + + + + - + (), { }); const selectedValue: WritableComputedRef = inject("selectedValue") as WritableComputedRef; -const searchValue: Ref = inject('searchValue') as Ref; +const searchValue: Ref = inject("searchValue") as Ref; const multiple: ComputedRef = inject("multiple") as ComputedRef; const handleSelect = () => { @@ -35,14 +35,16 @@ const selected = computed(() => { if (multiple.value) { return selectedValue.value.indexOf(props.value) != -1; } else { - // close dropdown return selectedValue.value === props.value; } }); const display = computed(() => { - return props.keyword.indexOf(searchValue.value) > -1 || props.label.indexOf(searchValue.value) > -1; -}) + return ( + props.keyword.indexOf(searchValue.value) > -1 || + props.label.indexOf(searchValue.value) > -1 + ); +}); @@ -52,7 +54,11 @@ const display = computed(() => { @click="handleSelect" > - + {{ label }} diff --git a/package/component/src/component/tagInput/index.less b/package/component/src/component/tagInput/index.less index c7996839..0c4431ca 100644 --- a/package/component/src/component/tagInput/index.less +++ b/package/component/src/component/tagInput/index.less @@ -28,7 +28,6 @@ border-style: solid; border-color: var(--input-border-color); border-radius: var(--input-border-radius); - padding: 0 5px; cursor: text; &-inner { @@ -48,8 +47,11 @@ } &-clear { - display: none; + flex: none; + display: flex; align-items: center; + padding-right: 10px; + color: rgba(0, 0, 0, 0.45); cursor: pointer; } @@ -112,7 +114,7 @@ } .layui-tag-input-inner { - padding: @@inner-padding 0; + padding: @@inner-padding 5px; } .layui-tag { @@ -129,6 +131,13 @@ .set-size(xs); } +.layui-tag-input-suffix { + display: flex; + flex: none; + align-items: center; + padding: 0 15px; +} + .layui-tag-input:hover, .layui-tag-input:focus-within { border-color: #d2d2d2 !important; diff --git a/package/component/src/component/tagInput/index.vue b/package/component/src/component/tagInput/index.vue index 85926e3e..63f7cdb0 100644 --- a/package/component/src/component/tagInput/index.vue +++ b/package/component/src/component/tagInput/index.vue @@ -46,7 +46,7 @@ const props = withDefaults(defineProps(), { disabledInput: false, placeholder: "", readonly: false, - allowClear: true, + allowClear: false, minCollapsedNum: 3, size: "md", }); @@ -245,23 +245,26 @@ defineExpose({ + ref="inputRefEl" + class="layui-tag-input-inner-input" + :style="inputStyle" + :disabled="disabled" + :placeholder="placeholder" + :readonly="readonly" + @keydown.enter="handleEnter" + @keyup="handleBackspaceKeyUp" + @input="handleInput" + @compositionstart="handleComposition" + @compositionupdate="handleComposition" + @compositionend="handleComposition" + /> + + + diff --git a/package/document-component/src/document/zh-CN/components/tagInput.md b/package/document-component/src/document/zh-CN/components/tagInput.md index 366f3583..bcd7c51a 100644 --- a/package/document-component/src/document/zh-CN/components/tagInput.md +++ b/package/document-component/src/document/zh-CN/components/tagInput.md @@ -86,4 +86,31 @@ export default { } +::: + +::: title 禁用状态 +::: + +::: demo 使用 `lay-tag-input` 标签, 创建标签输入框。 + + + + + + + ::: \ No newline at end of file diff --git a/package/document-component/src/document/zh-CN/guide/changelog.md b/package/document-component/src/document/zh-CN/guide/changelog.md index 5b7c548a..07c39391 100644 --- a/package/document-component/src/document/zh-CN/guide/changelog.md +++ b/package/document-component/src/document/zh-CN/guide/changelog.md @@ -10,23 +10,29 @@ ::: demo - + - + - 1.4.15 2022-09-27 - - [新增] tag-input 标签输入框组件。 + 1.5.0 2022-05-27 + + [新增] tag-input 标签输入框组件, 用于录入事物的属性与纬度。 [新增] table 组件 header 插槽, 用于在工具栏与表格之间插入元素。 - [新增] tabitem 组件 icon 属性, 用于自定义 tab-item 图标。 - [修复] layout 组件只引入了 footer 时, layui-layout-vertical样式不生效。 - [修复] cascader 外部清空modelValue, 内部displayValue不清空问题。 - [修复] tolltip 组件 content 自动定位。 - [修复] breadcrumb-item 组件无法正确传递 attrs 的问题。 - [优化] tag 组件 border background height 等默认样式。 - + [新增] tabitem 组件 icon 属性, 提供 title 属性前置 icon 设置。 + [修复] tolltip 组件 content 变化时, 位置无法自动计算调整的问题。 + [修复] breadcrumb-item 组件无法正确传递 attrs, 导致 @click 等自定义事件失效。 + [修复] layout 组件仅引入了 footer 作为内容元素时, layui-layout-vertical 样式不生效, 导致布局错误。 + [修复] select 组件 multiple 属性为 true 时, 删除选项时清空筛选条件的问题。 + [修复] cascader 外部清空 modelValue, 选中项仍不清楚的问题。 + [修复] select 组件位于 layer 底部时, 点击时出现滚动条。 + [修复] select 组件与 table 组件组合使用时, 下拉内容被遮盖。 + [优化] tag 组件 border background height 等, 使其更贴合 layui 的设计规范。 + [优化] input 组件 suffix 插槽与 allow-clear 启用时的显示顺序, clear > suffix。 + + +