ci: merge feat-ripple-dev

This commit is contained in:
就眠儀式 2022-04-15 09:00:15 +08:00
parent 92360fb035
commit 8ad11a94e4
9 changed files with 4681 additions and 1041 deletions

File diff suppressed because it is too large Load Diff

View File

@ -8,17 +8,38 @@
</lay-input> </lay-input>
<template #content> <template #content>
<!-- 日期选择 --> <!-- 日期选择 -->
<div class="layui-laydate" v-show="showPane === 'date' || showPane === 'datetime'"> <div
class="layui-laydate"
v-show="showPane === 'date' || showPane === 'datetime'"
>
<div class="layui-laydate-main laydate-main-list-0"> <div class="layui-laydate-main laydate-main-list-0">
<div class="layui-laydate-header"> <div class="layui-laydate-header">
<i class="layui-icon laydate-icon laydate-prev-y" @click="changeYearOrMonth('year', -1)"></i> <i
<i class="layui-icon laydate-icon laydate-prev-m" @click="changeYearOrMonth('month', -1)"></i> class="layui-icon laydate-icon laydate-prev-y"
@click="changeYearOrMonth('year', -1)"
></i
>
<i
class="layui-icon laydate-icon laydate-prev-m"
@click="changeYearOrMonth('month', -1)"
></i
>
<div class="laydate-set-ym"> <div class="laydate-set-ym">
<span @click="showYearPanel">{{ currentYear }} </span> <span @click="showYearPanel">{{ currentYear }} </span>
<span @click="showPane = 'month'">{{ currentMonth + 1 }} </span> <span @click="showPane = 'month'"
>{{ currentMonth + 1 }} </span
>
</div> </div>
<i class="layui-icon laydate-icon laydate-next-m" @click="changeYearOrMonth('month', 1)"></i> <i
<i class="layui-icon laydate-icon laydate-next-y" @click="changeYearOrMonth('year', 1)"></i> class="layui-icon laydate-icon laydate-next-m"
@click="changeYearOrMonth('month', 1)"
></i
>
<i
class="layui-icon laydate-icon laydate-next-y"
@click="changeYearOrMonth('year', 1)"
></i
>
</div> </div>
<div class="layui-laydate-content"> <div class="layui-laydate-content">
<table> <table>
@ -28,17 +49,26 @@
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<template v-for="(o, i) of dateList.length % 7 == 0 <template
v-for="(o, i) of dateList.length % 7 == 0
? dateList.length / 7 ? dateList.length / 7
: Math.floor(dateList.length / 7) + 1" :key="i"> : Math.floor(dateList.length / 7) + 1"
:key="i"
>
<tr> <tr>
<td v-for="(item, index) of dateList.slice( <td
v-for="(item, index) of dateList.slice(
i * 7, i * 7,
i * 7 + 7 i * 7 + 7
)" :key="index" :data-unix="item.value" :class="{ )"
:key="index"
:data-unix="item.value"
:class="{
'laydate-day-prev': item.type !== 'current', 'laydate-day-prev': item.type !== 'current',
'layui-this': item.value === currentDay, 'layui-this': item.value === currentDay,
}" @click="handleDayClick(item)"> }"
@click="handleDayClick(item)"
>
{{ item.day }} {{ item.day }}
</td> </td>
</tr> </tr>
@ -48,37 +78,69 @@
</div> </div>
</div> </div>
<div class="layui-laydate-footer"> <div class="layui-laydate-footer">
<span v-if="type === 'datetime'" @click="showPane = 'time'" class="laydate-btns-time">选择时间</span> <span
v-if="type === 'datetime'"
@click="showPane = 'time'"
class="laydate-btns-time"
>选择时间</span
>
<div class="laydate-footer-btns"> <div class="laydate-footer-btns">
<span lay-type="clear" class="laydate-btns-clear" @click="clear">清空</span> <span lay-type="clear" class="laydate-btns-clear" @click="clear"
<span lay-type="now" class="laydate-btns-now" @click="now">现在</span> >清空</span
<span lay-type="confirm" class="laydate-btns-confirm" @click="ok">确定</span> >
<span lay-type="now" class="laydate-btns-now" @click="now"
>现在</span
>
<span lay-type="confirm" class="laydate-btns-confirm" @click="ok"
>确定</span
>
</div> </div>
</div> </div>
</div> </div>
<!-- 年份选择器 --> <!-- 年份选择器 -->
<div class="layui-laydate" v-show="showPane === 'year' || showPane === 'yearmonth'"> <div
class="layui-laydate"
v-show="showPane === 'year' || showPane === 'yearmonth'"
>
<div class="layui-laydate-main laydate-main-list-0 laydate-ym-show"> <div class="layui-laydate-main laydate-main-list-0 laydate-ym-show">
<div class="layui-laydate-header"> <div class="layui-laydate-header">
<div class="laydate-set-ym"> <div class="laydate-set-ym">
<span class="laydate-time-text">选择年份</span> <span class="laydate-time-text">选择年份</span>
</div> </div>
</div> </div>
<div class="layui-laydate-content" style="height: 220px; overflow-y: auto"> <div
class="layui-laydate-content"
style="height: 220px; overflow-y: auto"
>
<ul class="layui-laydate-list laydate-year-list"> <ul class="layui-laydate-list laydate-year-list">
<li v-for="item of yearList" :key="item" :class="[{ 'layui-this': currentYear === item }]" <li
@click="handleYearClick(item)"> v-for="item of yearList"
:key="item"
:class="[{ 'layui-this': currentYear === item }]"
@click="handleYearClick(item)"
>
{{ item }} {{ item }}
</li> </li>
</ul> </ul>
</div> </div>
</div> </div>
<div class="layui-laydate-footer"> <div class="layui-laydate-footer">
<span class="layui-laydate-preview" title="当前选中的结果" style="color: rgb(102, 102, 102)">{{ dateValue }}</span> <span
class="layui-laydate-preview"
title="当前选中的结果"
style="color: rgb(102, 102, 102)"
>{{ dateValue }}</span
>
<div class="laydate-footer-btns"> <div class="laydate-footer-btns">
<span lay-type="clear" class="laydate-btns-clear" @click="clear">清空</span> <span lay-type="clear" class="laydate-btns-clear" @click="clear"
<span lay-type="now" class="laydate-btns-now" @click="now">现在</span> >清空</span
<span lay-type="confirm" class="laydate-btns-confirm" @click="ok">确定</span> >
<span lay-type="now" class="laydate-btns-now" @click="now"
>现在</span
>
<span lay-type="confirm" class="laydate-btns-confirm" @click="ok"
>确定</span
>
</div> </div>
</div> </div>
</div> </div>
@ -86,30 +148,59 @@
<div class="layui-laydate" v-show="showPane === 'month'"> <div class="layui-laydate" v-show="showPane === 'month'">
<div class="layui-laydate-main laydate-main-list-0 laydate-ym-show"> <div class="layui-laydate-main laydate-main-list-0 laydate-ym-show">
<div class="layui-laydate-header"> <div class="layui-laydate-header">
<i class="layui-icon laydate-icon laydate-prev-y" @click="changeYearOrMonth('year', -1)"></i> <i
class="layui-icon laydate-icon laydate-prev-y"
@click="changeYearOrMonth('year', -1)"
></i
>
<div class="laydate-set-ym"> <div class="laydate-set-ym">
<span @click="showYearPanel" v-if="showPane === 'date' || showPane === 'datetime'">{{ currentYear }} <span
</span> @click="showYearPanel"
<span @click="showPane = 'month'">{{ currentMonth + 1 }} </span> v-if="showPane === 'date' || showPane === 'datetime'"
>{{ currentYear }} </span
>
<span @click="showPane = 'month'"
>{{ currentMonth + 1 }} </span
>
</div> </div>
<i class="layui-icon laydate-icon laydate-next-y" @click="changeYearOrMonth('year', 1)"></i> <i
class="layui-icon laydate-icon laydate-next-y"
@click="changeYearOrMonth('year', 1)"
></i
>
</div> </div>
<div class="layui-laydate-content" style="height: 220px"> <div class="layui-laydate-content" style="height: 220px">
<ul class="layui-laydate-list laydate-month-list"> <ul class="layui-laydate-list laydate-month-list">
<li v-for="item of MONTH_NAME" :key="item" :class="[ <li
v-for="item of MONTH_NAME"
:key="item"
:class="[
{ 'layui-this': MONTH_NAME.indexOf(item) === currentMonth }, { 'layui-this': MONTH_NAME.indexOf(item) === currentMonth },
]" @click="handleMonthClick(item)"> ]"
@click="handleMonthClick(item)"
>
{{ item.slice(0, 3) }} {{ item.slice(0, 3) }}
</li> </li>
</ul> </ul>
</div> </div>
</div> </div>
<div class="layui-laydate-footer"> <div class="layui-laydate-footer">
<span class="layui-laydate-preview" title="当前选中的结果" style="color: rgb(102, 102, 102)">{{ dateValue }}</span> <span
class="layui-laydate-preview"
title="当前选中的结果"
style="color: rgb(102, 102, 102)"
>{{ dateValue }}</span
>
<div class="laydate-footer-btns"> <div class="laydate-footer-btns">
<span lay-type="clear" class="laydate-btns-clear" @click="clear">清空</span> <span lay-type="clear" class="laydate-btns-clear" @click="clear"
<span lay-type="now" class="laydate-btns-now" @click="now">现在</span> >清空</span
<span lay-type="confirm" class="laydate-btns-confirm" @click="ok">确定</span> >
<span lay-type="now" class="laydate-btns-now" @click="now"
>现在</span
>
<span lay-type="confirm" class="laydate-btns-confirm" @click="ok"
>确定</span
>
</div> </div>
</div> </div>
</div> </div>
@ -125,13 +216,19 @@
<ul class="layui-laydate-list laydate-time-list"> <ul class="layui-laydate-list laydate-time-list">
<li class="num-list" v-for="item in els" :key="item.type"> <li class="num-list" v-for="item in els" :key="item.type">
<ol class="scroll" @click="choseTime"> <ol class="scroll" @click="choseTime">
<li v-for="(it, index) in item.count" :id="item.type + index.toString()" <li
:data-value="index.toString().padStart(2, '0')" :data-type="item.type" :key="it" :class="[ v-for="(it, index) in item.count"
:id="item.type + index.toString()"
:data-value="index.toString().padStart(2, '0')"
:data-type="item.type"
:key="it"
:class="[
'num', 'num',
index.toString().padStart(2, '0') == hms[item.type] index.toString().padStart(2, '0') == hms[item.type]
? 'layui-this' ? 'layui-this'
: '', : '',
]"> ]"
>
{{ index.toString().padStart(2, "0") }} {{ index.toString().padStart(2, "0") }}
</li> </li>
</ol> </ol>
@ -140,11 +237,22 @@
</div> </div>
</div> </div>
<div class="layui-laydate-footer"> <div class="layui-laydate-footer">
<span @click="showPane = 'date'" v-if="type != 'time'" class="laydate-btns-time">返回日期</span> <span
@click="showPane = 'date'"
v-if="type != 'time'"
class="laydate-btns-time"
>返回日期</span
>
<div class="laydate-footer-btns"> <div class="laydate-footer-btns">
<span lay-type="clear" class="laydate-btns-clear" @click="clear">清空</span> <span lay-type="clear" class="laydate-btns-clear" @click="clear"
<span lay-type="now" class="laydate-btns-now" @click="now">现在</span> >清空</span
<span lay-type="confirm" class="laydate-btns-confirm" @click="ok">确定</span> >
<span lay-type="now" class="laydate-btns-now" @click="now"
>现在</span
>
<span lay-type="confirm" class="laydate-btns-confirm" @click="ok"
>确定</span
>
</div> </div>
</div> </div>
</div> </div>

View File

@ -19,7 +19,15 @@
{{ text }} {{ text }}
</div> </div>
<div class="notice-bar-warp-slot" v-else> <div class="notice-bar-warp-slot" v-else>
<lay-carousel v-model="active4" :interval="3000" :autoplay="true" anim="updown" indicator="none" arrow="none" style="height:40px;"> <lay-carousel
v-model="active4"
:interval="3000"
:autoplay="true"
anim="updown"
indicator="none"
arrow="none"
style="height: 40px"
>
<lay-carousel-item :id="ind" v-for="(item, ind) in arrays"> <lay-carousel-item :id="ind" v-for="(item, ind) in arrays">
<div>{{ item }}</div> <div>{{ item }}</div>
</lay-carousel-item> </lay-carousel-item>
@ -46,13 +54,13 @@ import {
onMounted, onMounted,
nextTick, nextTick,
} from "vue"; } from "vue";
import LayCarousel from '../carousel/index.vue' import LayCarousel from "../carousel/index.vue";
import LayCarouselItem from '../carouselItem/index.vue' import LayCarouselItem from "../carouselItem/index.vue";
export default defineComponent({ export default defineComponent({
name: "LayNoticeBar", name: "LayNoticeBar",
components: { components: {
LayCarousel, LayCarousel,
LayCarouselItem LayCarouselItem,
}, },
props: { props: {
mode: { mode: {
@ -220,7 +228,13 @@ export default defineComponent({
width: 100%; width: 100%;
white-space: nowrap; white-space: nowrap;
} }
.notice-bar .notice-bar-warp .notice-bar-warp-text-box .notice-bar-warp-slot .layui-carousel >[carousel-item] * { .notice-bar
.notice-bar-warp
.notice-bar-warp-text-box
.notice-bar-warp-slot
.layui-carousel
> [carousel-item]
* {
display: flex; display: flex;
align-items: center; align-items: center;
} }

View File

@ -9,12 +9,12 @@ import { computed, onMounted, ref, watch } from "vue";
import "./index.less"; import "./index.less";
export interface LayRippletProps { export interface LayRippletProps {
type?: 'out' | 'inset'; type?: "out" | "inset";
color?: string; color?: string;
borderRadius?: string; borderRadius?: string;
spreadWidth?: string; spreadWidth?: string;
spreadSize?: string; spreadSize?: string;
trigger?: 'always' | 'mouseenter' | 'click'; trigger?: "always" | "mouseenter" | "click";
center?: boolean; center?: boolean;
} }
@ -29,13 +29,13 @@ const props = withDefaults(defineProps<LayRippletProps>(), {
const isActiveRef = ref(false); const isActiveRef = ref(false);
// //
const spreadSizeRef = ref<string>("0px") const spreadSizeRef = ref<string>("0px");
const ripplesRefEl = ref<HTMLElement | null>(null); const ripplesRefEl = ref<HTMLElement | null>(null);
const waterRipplesContainerRefEl = ref<HTMLElement | null>(null); const waterRipplesContainerRefEl = ref<HTMLElement | null>(null);
const isOut = computed(() => { const isOut = computed(() => {
return props.type === "out" return props.type === "out";
}) });
const rippleX = ref<string | number | undefined>(undefined); const rippleX = ref<string | number | undefined>(undefined);
const rippleY = ref<string | number | undefined>(undefined); const rippleY = ref<string | number | undefined>(undefined);
@ -45,17 +45,17 @@ const onActive = function (event: Event) {
// //
if (props.type === "inset" && !props.spreadSize && !props.center) { if (props.type === "inset" && !props.spreadSize && !props.center) {
const el = event.currentTarget const el = event.currentTarget;
const rect = el.getBoundingClientRect(); const rect = el.getBoundingClientRect();
const rippleOffsetLeft = event.clientX - rect.left; const rippleOffsetLeft = event.clientX - rect.left;
const rippleOffsetTop = event.clientY - rect.top; const rippleOffsetTop = event.clientY - rect.top;
const sizeX = Math.max(rippleOffsetLeft, rect.width - rippleOffsetLeft); const sizeX = Math.max(rippleOffsetLeft, rect.width - rippleOffsetLeft);
const sizeY = Math.max(rippleOffsetTop, rect.height - rippleOffsetTop); const sizeY = Math.max(rippleOffsetTop, rect.height - rippleOffsetTop);
rippleX.value = rippleOffsetLeft + 'px'; rippleX.value = rippleOffsetLeft + "px";
rippleY.value = rippleOffsetTop + 'px'; rippleY.value = rippleOffsetTop + "px";
spreadSizeRef.value = Math.sqrt(sizeX ** 2 + sizeY ** 2) * 2 + 'px' spreadSizeRef.value = Math.sqrt(sizeX ** 2 + sizeY ** 2) * 2 + "px";
}
} }
};
const initWidth = function () { const initWidth = function () {
let container = waterRipplesContainerRefEl.value; let container = waterRipplesContainerRefEl.value;
@ -66,40 +66,54 @@ const initWidth = function () {
} else { } else {
container.style.overflow = "hidden"; container.style.overflow = "hidden";
if (!props.spreadSize || props.center) { if (!props.spreadSize || props.center) {
spreadSizeRef.value = container.clientWidth * 1.1 + "px" spreadSizeRef.value = container.clientWidth * 1.1 + "px";
} else { } else {
spreadSizeRef.value = props.spreadSize spreadSizeRef.value = props.spreadSize;
} }
} }
ripples.addEventListener('animationend', () => { ripples.addEventListener(
isActiveRef.value = false "animationend",
}, false); () => {
} isActiveRef.value = false;
},
false
);
};
onMounted(() => { onMounted(() => {
initWidth(); initWidth();
}) });
watch( watch(
() => props.trigger, () => props.trigger,
(val) => isActiveRef.value = (val === 'always'), (val) => (isActiveRef.value = val === "always"),
{ immediate: true } { immediate: true }
) );
</script> </script>
<template> <template>
<div class="layui-water-ripples-container" ref="waterRipplesContainerRefEl" @[trigger]="onActive"> <div
class="layui-water-ripples-container"
ref="waterRipplesContainerRefEl"
@[trigger]="onActive"
>
<div <div
ref="ripplesRefEl" ref="ripplesRefEl"
:class="{ :class="{
'layui-out-ripples': isOut, 'layui-out-ripples': isOut,
'layui-inset-ripples': type == 'inset', 'layui-inset-ripples': type == 'inset',
'layui-animate-always--out': isActiveRef && trigger == 'always' && type == 'out', 'layui-animate-always--out':
'layui-animate-once--out': isActiveRef && (trigger == 'mouseenter' || trigger == 'click') && type == 'out', isActiveRef && trigger == 'always' && type == 'out',
'layui-animate-always--inset': isActiveRef && trigger == 'always' && type == 'inset', 'layui-animate-once--out':
'layui-animate-once--inset': isActiveRef && (trigger == 'mouseenter' || trigger == 'click') && type == 'inset', isActiveRef &&
(trigger == 'mouseenter' || trigger == 'click') &&
type == 'out',
'layui-animate-always--inset':
isActiveRef && trigger == 'always' && type == 'inset',
'layui-animate-once--inset':
isActiveRef &&
(trigger == 'mouseenter' || trigger == 'click') &&
type == 'inset',
}" }"
:style="{ :style="{
borderRadius: isOut ? borderRadius : '50%', borderRadius: isOut ? borderRadius : '50%',

View File

@ -1,22 +1,29 @@
<template> <template>
<div id="sliderVerify" class="slider-item"> <div id="sliderVerify" class="slider-item">
<div class="slider-bg layui-bg-green"></div> <div class="slider-bg layui-bg-green"></div>
<div class="slider-text">{{ prototype.isOk == false ? prototype.text : prototype.success}}</div> <div class="slider-text">
<div :class="prototype.isOk == false ? 'slider-btn layui-icon layui-icon-next' : 'slider-btn layui-icon layui-icon-ok-circle slider-btn-success'" {{ prototype.isOk == false ? prototype.text : prototype.success }}
@mousedown.stop="down"></div> </div>
<div
:class="
prototype.isOk == false
? 'slider-btn layui-icon layui-icon-next'
: 'slider-btn layui-icon layui-icon-ok-circle slider-btn-success'
"
@mousedown.stop="down"
></div>
</div> </div>
</template> </template>
<script setup lang='ts'> <script setup lang="ts">
import { reactive, ref, defineProps } from 'vue' import { reactive, ref, defineProps } from "vue";
import { on, off } from "evtd"; import { on, off } from "evtd";
import { throttle, handle_select } from "./utils/index"; import { throttle, handle_select } from "./utils/index";
interface Prop { interface Prop {
disabled?: boolean; disabled?: boolean;
bg?: string, bg?: string;
text?: string, text?: string;
end?: string, end?: string;
success?: Function success?: Function;
} }
const props = withDefaults(defineProps<Prop>(), { const props = withDefaults(defineProps<Prop>(), {
@ -27,12 +34,11 @@ const props = withDefaults(defineProps<Prop>(), {
const prototype = reactive({ const prototype = reactive({
isOk: false, isOk: false,
bg: props.bg, // bg: props.bg, //
text: props.text ? props.text : '请拖动滑块验证', text: props.text ? props.text : "请拖动滑块验证",
success: props.end ? props.end : '验证通过', success: props.end ? props.end : "验证通过",
ok: props.success ok: props.success,
}); });
// //
/* prototype.isMobile = function () { /* prototype.isMobile = function () {
return ( return (
@ -45,14 +51,14 @@ const prototype = reactive({
}; */ }; */
const moveAction = throttle(move); const moveAction = throttle(move);
let distance let distance;
let downX let downX;
// //
const down = function (e) { const down = function (e) {
e = e || window.event e = e || window.event;
console.log(e.path) console.log(e.path);
distance = e.path[1].offsetWidth - e.path[0].offsetWidth distance = e.path[1].offsetWidth - e.path[0].offsetWidth;
// //
downX = e.clientX; downX = e.clientX;
on("selectstart", window, handle_select, { once: true }); on("selectstart", window, handle_select, { once: true });
@ -60,11 +66,9 @@ const down = function (e) {
on("mousemove", window, moveAction); on("mousemove", window, moveAction);
}; };
// //
function move(e) { function move(e) {
e = e || window.event e = e || window.event;
let moveX = e.clientX; let moveX = e.clientX;
// - // -
let offsetX = moveX - downX; let offsetX = moveX - downX;
@ -73,16 +77,15 @@ function move(e) {
e.path[1].childNodes[0].style.width = offsetX + "px"; e.path[1].childNodes[0].style.width = offsetX + "px";
// >= // >=
if (offsetX >= distance) { if (offsetX >= distance) {
prototype.isOk = true prototype.isOk = true;
// //
off("mousedown", window, down); off("mousedown", window, down);
off("mousemove", window, moveAction); off("mousemove", window, moveAction);
// //
if (prototype.ok) prototype.ok() if (prototype.ok) prototype.ok();
}
} }
} }
};
// //
const stop = function (e) { const stop = function (e) {
@ -114,7 +117,7 @@ const stop = function (e) {
position: absolute; position: absolute;
width: 40px; width: 40px;
height: 100%; height: 100%;
z-index: 100 z-index: 100;
} }
.slider-btn { .slider-btn {
@ -128,16 +131,14 @@ const stop = function (e) {
user-select: none; user-select: none;
color: #666; color: #666;
z-index: 120; z-index: 120;
} }
.slider-btn:hover { .slider-btn:hover {
cursor: pointer;
cursor: pointer
} }
.slider-btn-success { .slider-btn-success {
font-size: 22px font-size: 22px;
} }
.slider-text { .slider-text {
@ -148,7 +149,7 @@ const stop = function (e) {
user-select: none; user-select: none;
font-size: 14px; font-size: 14px;
color: #fff; color: #fff;
z-index: 120 z-index: 120;
} }
.slider-error { .slider-error {
@ -157,11 +158,11 @@ const stop = function (e) {
@keyframes glow { @keyframes glow {
0% { 0% {
border-color: #e6e6e6 border-color: #e6e6e6;
} }
100% { 100% {
border-color: #ff5722 border-color: #ff5722;
} }
} }
</style> </style>

View File

@ -385,14 +385,12 @@ const zhCN = [
}, },
{ {
path: "/zh-CN/components/ripple", path: "/zh-CN/components/ripple",
component: () => component: () => import("../document/zh-CN/components/ripple.md"),
import("../document/zh-CN/components/ripple.md"),
meta: { title: "水波纹" }, meta: { title: "水波纹" },
}, },
{ {
path: "/zh-CN/components/area", path: "/zh-CN/components/area",
component: () => component: () => import("../document/zh-CN/components/area.md"),
import("../document/zh-CN/components/area.md"),
meta: { title: "地址选择器" }, meta: { title: "地址选择器" },
}, },
], ],