Skip to content

Commit 7482ba9

Browse files
jevin98gitee-org
authored andcommitted
!304 2.x merge master
Merge pull request !304 from Jevin/2.x
2 parents 8e6297f + 15393d8 commit 7482ba9

File tree

18 files changed

+287
-160
lines changed

18 files changed

+287
-160
lines changed

docs/document-component/src/document/zh-CN/components/form.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ const submit = () => {
7575
<lay-input v-model="model1.like"></lay-input>
7676
</lay-form-item>
7777
<lay-form-item label="爱好" prop="hobby" mode="inline">
78-
<lay-select v-model="model4.hobby" multiple>
78+
<lay-select v-model="model1.hobby" multiple>
7979
<lay-select-option value="1" label="学习"></lay-select-option>
8080
<lay-select-option value="2" label="编码"></lay-select-option>
8181
<lay-select-option value="3" label="运动"></lay-select-option>
@@ -120,7 +120,8 @@ const submit = () => {
120120

121121
<script setup>
122122
import { ref, reactive } from 'vue'
123-
import {layer} from '@layui/layer-vue'
123+
import { layer } from '@layui/layer-vue'
124+
124125

125126
const model1 = reactive({})
126127

@@ -585,10 +586,10 @@ const submit2 = function(){
585586
::: title label超出隐藏
586587
:::
587588

588-
::: demo
589+
::: demo 通过 `isLabelTooltip` 属性开启超出隐藏,默认值为 `false`
589590

590591
<template>
591-
<lay-form :model="model3" :label-position="labelPosition3" required :tooltipProps="tooltipProps">
592+
<lay-form :model="model3" :label-position="labelPosition3" required isLabelTooltip :tooltipProps="tooltipProps">
592593
<lay-form-item label="label label label label" prop="username">
593594
<lay-input v-model="model3.username"></lay-input>
594595
</lay-form-item>
@@ -863,7 +864,7 @@ const submit10 = function(isValidate, model, errors) {
863864
| required | 是否必填 | `boolean` | `true` `false` | `false` |
864865
| rules | 表单校验规则; <br>可查看[async-validator](https://github.com/yiminghe/async-validator) `object` | - | - |
865866
| initValidate | 是否一开始就校验表单 | `boolean` | `true` `false` | `false` |
866-
| useCN | 是否使用中文错误提示 | `boolean` | `true` `false` | `false` |
867+
| useCN | 是否使用中文错误提示 | `boolean` | `true` `false` | `true` |
867868
| requiredIcons | 必填前缀图标`class` | `string` | - | `*` |
868869
| required-error-message | 必填错误提示信息 | `string` | - | `%s不能为空` |
869870
| validate-message | 自定义校验错误提示信息; <br>由于内置了中文错误提示,可按需求增量增加<br>可查看 [async-validator 内置错误提示](https://github.com/yiminghe/async-validator/blob/master/src/messages.ts)<br>也可参考 [layui-vue 内置中文错误提示](https://gitee.com/layui/layui-vue/blob/next/package/component/src/component/formItem/cnValidateMessage.ts) | `string` | - | `%s不能为空` |
@@ -872,6 +873,7 @@ const submit10 = function(isValidate, model, errors) {
872873
| size | 全局控件尺寸 | -- | -- | -- |
873874
| labelWidth | 全局标签宽度 | `string` | -- | -- |
874875
| mode | 全局表单项显示的模式,`块元素` / `行元素` | `string` | `block` `inline` | `block` |
876+
| isLabelTooltip(2.17.0) | Label是否超出隐藏省略号 | `boolean` | | `false` |
875877
| tooltipProps | 可查看[tooltip组件](http://www.layui-vue.com/zh-CN/components/tooltip) | `object` | | |
876878

877879
:::

docs/document-component/src/document/zh-CN/components/upload.md

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ export default {
336336
| url | 服务端上传接口的地址 | string | -- | -- |
337337
| data | 请求上传接口的额外参数 | object | -- | -- |
338338
| headers | 接口的请求头 | object | -- | -- |
339-
| acceptMime | 文件选择框时的可选文件类型 | string | `MIME_type` | `MIME_type` |
339+
| acceptMime | 文件选择框时的可选文件类型 | string | `MIME_type` | [文件类型可查看](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file) |
340340
| auto | 是否自动提交 | boolean | true | -- |
341341
| field | 设定文件域的字段名 | string | `file` | -- |
342342
| size | 设置文件最大可允许上传的大小,单位 KB。不支持 ie8/9 | number | `0(不限制)` | -- |
@@ -345,7 +345,7 @@ export default {
345345
| drag | 是否接受拖拽的文件上传,设置 false 可禁用。不支持 ie8/9 | boolean | true | -- |
346346
| disabled | 设置文件禁用 | boolean | false | -- |
347347
| disabledPreview | 设置文件预览插槽区域为禁用状态 | boolean | false | -- |
348-
| cut | 是否开启选择图片后检测,设置 true 可开启 | boolean | false | -- |
348+
| cut | 开启裁剪(`acceptMime`为image类型生效) | boolean | false | -- |
349349
| cutOptions | 开启剪裁的模态弹窗与剪裁框的配置 | object | { layerOption,copperOption } | -- |
350350
| text | 普通上传描述 | string | -- | -- |
351351
| dragText | 拖拽上传描述 | string | -- | -- |
@@ -371,13 +371,14 @@ export default {
371371
::: table
372372

373373
| 名称 | 描述 | 参数 |
374-
| -------- | ------------------------------------------------------------------------------------- | ---- |
375-
| choose | 打开系统选择文件窗体的回调 | -- |
374+
| -------- | ---------------------------- | ---- |
375+
| choose | 打开系统选择文件窗体的回调 |`currentTimeStamp` |
376+
| on-change(2.17.0) | 选择文件后回调 | `[File]`(文件数组) |
376377
| before | 上传事务开启前的回调 (在 1.9.4 版本新增 before-upload 属性,来代替该事件,仍向后兼容) | -- |
377-
| done | 上传事务结束的回调 | -- |
378-
| error | 上传事务中出现错误的回调 | -- |
379-
| cutdown | 剪裁完成 | -- |
380-
| cutclose | 剪裁取消 | -- |
378+
| done | 上传事务结束的回调 | {`currentTimeStamp`, `msg`, `data`} |
379+
| error | 上传事务中出现错误的回调 | {`currentTimeStamp`, `msg`} |
380+
| cutdone | 剪裁完成 | {`currentTimeStamp`, `cutResult`(剪裁后base64文件),`orgInfo`(原图片文件)} |
381+
| cutcancel | 剪裁取消 | {`currentTimeStamp`} |
381382

382383
:::
383384

packages/component/src/component/carousel/__tests__/carousel.test.tsx

Lines changed: 91 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import LayCarousel from "../index.vue";
66
import LayCarouselItem from "../../carouselItem/index.vue";
77

88
// https://github.com/vuejs/test-utils/issues/2409
9-
vi.spyOn(console, 'warn').mockImplementation(() => {});
9+
vi.spyOn(console, "warn").mockImplementation(() => {});
1010

1111
const data = [
1212
{
@@ -30,35 +30,37 @@ const generateCarouselItems = (_data?: any[]) => {
3030

3131
const _mount = (props?: any, list?: any[]) => {
3232
return mount({
33-
setup () {
33+
setup() {
3434
const data = reactive({
35-
modelValue: '1',
35+
modelValue: "1",
3636
autoplay: false,
37-
...props
38-
})
37+
...props,
38+
});
3939

4040
return () => (
41-
<LayCarousel autoplay={data.autoplay} {...props} v-model={data.modelValue}>
41+
<LayCarousel
42+
autoplay={data.autoplay}
43+
{...props}
44+
v-model={data.modelValue}
45+
>
4246
{generateCarouselItems(list)}
4347
</LayCarousel>
44-
)
45-
}
46-
})
47-
}
48-
48+
);
49+
},
50+
});
51+
};
4952

5053
describe("LayCarousel", () => {
51-
5254
test("Items length", async () => {
53-
const wrapper = _mount()
55+
const wrapper = _mount();
5456

5557
expect(wrapper.find("[carousel-item]").findAll("li").length).toEqual(3);
5658
});
5759

5860
test("vModel", async () => {
59-
const wrapper = _mount({modelValue: '2'})
61+
const wrapper = _mount({ modelValue: "2" });
6062
await nextTick();
61-
63+
6264
expect(
6365
(
6466
wrapper
@@ -80,100 +82,112 @@ describe("LayCarousel", () => {
8082
test("autoplay and interval", async () => {
8183
const wrapper = _mount({
8284
autoplay: true,
83-
interval: 500
84-
})
85+
interval: 500,
86+
});
8587

8688
await nextTick();
8789
await wait();
88-
const bodyItems = wrapper.vm.$el.querySelector('[carousel-item]').querySelectorAll('li')
89-
const indicatorItems = wrapper.vm.$el.querySelector('.layui-carousel-ind').querySelectorAll('li')
90-
expect(bodyItems[0].getAttribute('style').includes("visibility: inherit")).toBeTruthy();
91-
expect(indicatorItems[0].classList.contains('layui-this')).toBeTruthy()
90+
const bodyItems = wrapper.vm.$el
91+
.querySelector("[carousel-item]")
92+
.querySelectorAll("li");
93+
const indicatorItems = wrapper.vm.$el
94+
.querySelector(".layui-carousel-ind")
95+
.querySelectorAll("li");
96+
expect(
97+
bodyItems[0].getAttribute("style").includes("visibility: inherit")
98+
).toBeTruthy();
99+
expect(indicatorItems[0].classList.contains("layui-this")).toBeTruthy();
92100
await nextTick();
93101
await wait(600);
94-
expect(bodyItems[1].getAttribute('style').includes("visibility: inherit")).toBeTruthy();
95-
expect(indicatorItems[1].classList.contains('layui-this')).toBeTruthy()
96-
97-
})
102+
expect(
103+
bodyItems[1].getAttribute("style").includes("visibility: inherit")
104+
).toBeTruthy();
105+
expect(indicatorItems[1].classList.contains("layui-this")).toBeTruthy();
106+
});
98107

99-
test('pauseOnHover', async () => {
108+
test("pauseOnHover", async () => {
100109
const wrapper = _mount({
101110
autoplay: true,
102-
interval: 500
103-
})
111+
interval: 500,
112+
});
104113

105114
await nextTick();
106115
await wait();
107-
const bodyItems = wrapper.vm.$el.querySelector('[carousel-item]').querySelectorAll('li')
108-
109-
expect(bodyItems[0].getAttribute('style').includes("visibility: inherit")).toBeTruthy();
116+
const bodyItems = wrapper.vm.$el
117+
.querySelector("[carousel-item]")
118+
.querySelectorAll("li");
110119

111-
await wrapper.trigger('mouseenter')
112-
await nextTick()
113-
await wait(600)
114-
expect(bodyItems[0].getAttribute('style').includes("visibility: inherit")).toBeTruthy();
120+
expect(
121+
bodyItems[0].getAttribute("style").includes("visibility: inherit")
122+
).toBeTruthy();
115123

116-
await wrapper.trigger('mouseleave')
117-
await nextTick()
118-
await wait(600)
119-
expect(bodyItems[0].getAttribute('style').includes("visibility: inherit")).toBeFalsy();
120-
expect(bodyItems[1].getAttribute('style').includes("visibility: inherit")).toBeTruthy();
124+
await wrapper.trigger("mouseenter");
125+
await nextTick();
126+
await wait(600);
127+
expect(
128+
bodyItems[0].getAttribute("style").includes("visibility: inherit")
129+
).toBeTruthy();
121130

122-
})
131+
await wrapper.trigger("mouseleave");
132+
await nextTick();
133+
await wait(600);
134+
expect(
135+
bodyItems[0].getAttribute("style").includes("visibility: inherit")
136+
).toBeFalsy();
137+
expect(
138+
bodyItems[1].getAttribute("style").includes("visibility: inherit")
139+
).toBeTruthy();
140+
});
123141

124-
test('manual change', async () => {
125-
const wrapper = _mount()
142+
test("manual change", async () => {
143+
const wrapper = _mount();
126144

127145
const Carousel = wrapper.getComponent(LayCarousel);
128-
const btn = wrapper.vm.$el.querySelectorAll('.layui-carousel-arrow')
129-
130-
await btn[1].click()
131-
await nextTick()
132-
await wait();
133-
expect(Carousel.props('modelValue')).toBe('2')
146+
const btn = wrapper.vm.$el.querySelectorAll(".layui-carousel-arrow");
134147

135-
await btn[0].click()
136-
await nextTick()
148+
await btn[1].click();
149+
await nextTick();
137150
await wait();
138-
expect(Carousel.props('modelValue')).toBe('1')
151+
expect(Carousel.props("modelValue")).toBe("2");
139152

140-
await btn[1].click()
141-
await btn[1].click()
142-
await nextTick()
153+
await btn[0].click();
154+
await nextTick();
143155
await wait();
144-
expect(Carousel.props('modelValue')).toBe('3')
156+
expect(Carousel.props("modelValue")).toBe("1");
145157

146-
await btn[1].click()
147-
await nextTick()
158+
await btn[1].click();
159+
await btn[1].click();
160+
await nextTick();
148161
await wait();
149-
expect(Carousel.props('modelValue')).toBe('1')
162+
expect(Carousel.props("modelValue")).toBe("3");
150163

151-
})
164+
await btn[1].click();
165+
await nextTick();
166+
await wait();
167+
expect(Carousel.props("modelValue")).toBe("1");
168+
});
152169

153-
test('ref', async () => {
170+
test("ref", async () => {
154171
const wrapper = _mount({
155-
ref: 'carousel'
156-
})
172+
ref: "carousel",
173+
});
157174

158175
const Carousel = wrapper.getComponent(LayCarousel);
159-
const CarouselRef = wrapper.findComponent({ ref: 'carousel' }).vm
176+
const CarouselRef = wrapper.findComponent({ ref: "carousel" }).vm;
160177

161-
CarouselRef.next()
162-
await nextTick()
178+
CarouselRef.next();
179+
await nextTick();
163180
await wait();
164-
expect(Carousel.props('modelValue')).toBe('2')
181+
expect(Carousel.props("modelValue")).toBe("2");
165182

166-
CarouselRef.prev()
167-
await nextTick()
183+
CarouselRef.prev();
184+
await nextTick();
168185
await wait();
169-
expect(Carousel.props('modelValue')).toBe('1')
186+
expect(Carousel.props("modelValue")).toBe("1");
170187

171-
CarouselRef.setActive('3')
172-
await nextTick()
188+
CarouselRef.setActive("3");
189+
await nextTick();
173190
await wait();
174-
expect(Carousel.props('modelValue')).toBe('3')
175-
176-
})
177-
178-
191+
expect(Carousel.props("modelValue")).toBe("3");
192+
});
179193
});

packages/component/src/component/datePicker/index.less

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -547,6 +547,9 @@ html #layuicss-laydate {
547547
display: inline-flex;
548548
border-color: var(--input-border-color);
549549
border-radius: var(--input-border-radius);
550+
&:hover{
551+
border-color: #d2d2d2;
552+
}
550553
.range-separator{
551554
margin: 0 5px;
552555
color: var(--global-neutral-color-8);
@@ -605,4 +608,4 @@ html #layuicss-laydate {
605608
.laydate-time-list > li:hover ol::-webkit-scrollbar { width: 0px;}
606609
.layui-laydate-content::-webkit-scrollbar { width: 8px; height: 8px; }
607610
.layui-laydate-content::-webkit-scrollbar-thumb { border-radius: 10px; background-color: #eeeeee; }
608-
.layui-laydate-content::-webkit-scrollbar-thumb:hover { background-color: #dddddd; }
611+
.layui-laydate-content::-webkit-scrollbar-thumb:hover { background-color: #dddddd; }

packages/component/src/component/form/index.less

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@
246246
.layui-input-block,
247247
.layui-input-inline {
248248
.layui-form-danger {
249-
&, .layui-textarea, .layui-tag-input, .layui-input {
249+
&, .layui-textarea, .layui-tag-input, .layui-input, .laydate-range-inputs {
250250
border-color: var(--global-danger-color) !important;
251251
}
252252
}
@@ -341,4 +341,4 @@
341341
border-radius: 0 0 var(--global-border-radius) var(--global-border-radius);
342342
}
343343
}
344-
}
344+
}

packages/component/src/component/form/index.vue

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ export interface FormProps {
1919
useCN?: boolean;
2020
size?: string;
2121
mode?: string;
22+
isLabelTooltip?: boolean;
2223
tooltipProps?: LayTooltipContext;
2324
}
2425
@@ -35,6 +36,7 @@ const props = withDefaults(defineProps<FormProps>(), {
3536
labelPosition: "right",
3637
initValidate: false,
3738
pane: false,
39+
isLabelTooltip: false,
3840
});
3941
4042
const formItems: LayFormItemContext[] = [];

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy