first commit

This commit is contained in:
PC-202306242200\Administrator
2026-03-28 23:10:55 +08:00
commit 1c24452b6c
1735 changed files with 150474 additions and 0 deletions

View File

@@ -0,0 +1,54 @@
"use strict";
const uni_modules_wotDesignUni_components_common_props = require("../common/props.js");
const noticeBarProps = {
...uni_modules_wotDesignUni_components_common_props.baseProps,
/**
* 设置通知栏文案
*/
text: {
type: [String, Array],
default: ""
},
/**
* 设置通知栏类型,可选值为:'warning' | 'info' | 'danger'
*/
type: uni_modules_wotDesignUni_components_common_props.makeStringProp("warning"),
/**
* 是否可滚动
*/
scrollable: uni_modules_wotDesignUni_components_common_props.makeBooleanProp(true),
/**
* 滚动延迟时间(秒)
*/
delay: uni_modules_wotDesignUni_components_common_props.makeNumberProp(1),
/**
* 滚动速度px/s
*/
speed: uni_modules_wotDesignUni_components_common_props.makeNumberProp(50),
/**
* 是否可关闭
*/
closable: uni_modules_wotDesignUni_components_common_props.makeBooleanProp(false),
/**
* 是否换行显示
*/
wrapable: uni_modules_wotDesignUni_components_common_props.makeBooleanProp(false),
/**
* 设置左侧图标,使用 icon 章节中的图标名
*/
prefix: String,
/**
* 文字、图标颜色
*/
color: String,
/**
* 背景颜色
*/
backgroundColor: String,
/**
* 滚动方向
*/
direction: uni_modules_wotDesignUni_components_common_props.makeStringProp("horizontal")
};
exports.noticeBarProps = noticeBarProps;
//# sourceMappingURL=../../../../../.sourcemap/mp-weixin/uni_modules/wot-design-uni/components/wd-notice-bar/types.js.map

View File

@@ -0,0 +1,249 @@
"use strict";
const common_vendor = require("../../../../common/vendor.js");
const uni_modules_wotDesignUni_components_common_util = require("../common/util.js");
const uni_modules_wotDesignUni_components_wdNoticeBar_types = require("./types.js");
if (!Math) {
wdIcon();
}
const wdIcon = () => "../wd-icon/wd-icon.js";
const __default__ = {
name: "wd-notice-bar",
options: {
virtualHost: true,
addGlobalClass: true,
styleIsolation: "shared"
}
};
const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
...__default__,
props: uni_modules_wotDesignUni_components_wdNoticeBar_types.noticeBarProps,
emits: ["close", "next", "click"],
setup(__props, { expose: __expose, emit: __emit }) {
const $wrap = ".wd-notice-bar__wrap";
const $content = ".wd-notice-bar__content";
const props = __props;
const emit = __emit;
const wrapWidth = common_vendor.ref(0);
const show = common_vendor.ref(true);
const currentIndex = common_vendor.ref(0);
const textArray = common_vendor.computed(() => Array.isArray(props.text) ? props.text : [props.text]);
const currentText = common_vendor.computed(() => textArray.value[currentIndex.value]);
const verticalIndex = common_vendor.ref(0);
const wrapRect = common_vendor.ref(null);
const contentRect = common_vendor.ref(null);
const isHorizontal = common_vendor.computed(() => props.direction === "horizontal");
const isVertical = common_vendor.computed(() => props.direction === "vertical");
const transitionState = common_vendor.reactive({
transitionProperty: "unset",
transitionDelay: "unset",
transitionDuration: "unset",
transform: "none",
transitionTimingFunction: "linear"
});
const animation = common_vendor.computed(() => {
return uni_modules_wotDesignUni_components_common_util.objToStyle(transitionState);
});
const rootStyle = common_vendor.computed(() => {
const style = {};
if (uni_modules_wotDesignUni_components_common_util.isDef(props.color)) {
style.color = props.color;
}
if (uni_modules_wotDesignUni_components_common_util.isDef(props.backgroundColor)) {
style.background = props.backgroundColor;
}
return `${uni_modules_wotDesignUni_components_common_util.objToStyle(style)}${props.customStyle}`;
});
const noticeBarClass = common_vendor.computed(() => {
const { type, wrapable, scrollable } = props;
let noticeBarClasses = [];
type && noticeBarClasses.push(`is-${type}`);
if (isHorizontal.value) {
!wrapable && !scrollable && noticeBarClasses.push("wd-notice-bar--ellipse");
} else {
noticeBarClasses.push("wd-notice-bar--ellipse");
}
wrapable && !scrollable && noticeBarClasses.push("wd-notice-bar--wrap");
return noticeBarClasses.join(" ");
});
const { proxy } = common_vendor.getCurrentInstance();
common_vendor.watch(
() => props.text,
() => {
reset();
},
{ deep: true }
);
common_vendor.onMounted(() => {
startTransition();
});
common_vendor.onActivated(() => {
startTransition();
});
common_vendor.onDeactivated(() => {
stopTransition();
});
function reset() {
stopTransition();
startTransition();
}
function startTransition() {
common_vendor.nextTick$1(() => scroll());
}
function stopTransition() {
transitionState.transitionProperty = "unset";
transitionState.transitionDelay = "unset";
transitionState.transitionDuration = "unset";
transitionState.transform = "none";
transitionState.transitionTimingFunction = "linear";
currentIndex.value = 0;
verticalIndex.value = 0;
}
function handleClose() {
show.value = false;
emit("close");
}
function setTransition({ duration, delay, translate }) {
transitionState.transitionProperty = "all";
transitionState.transitionDelay = `${delay}s`;
transitionState.transitionDuration = `${duration}s`;
transitionState.transform = `${props.direction === "vertical" ? "translateY" : "translateX"}(${translate}px)`;
transitionState.transitionTimingFunction = "linear";
}
function queryRect() {
return Promise.all([uni_modules_wotDesignUni_components_common_util.getRect($wrap, false, proxy), uni_modules_wotDesignUni_components_common_util.getRect($content, false, proxy)]);
}
async function verticalAnimate(height) {
const translate = -(height / (textArray.value.length + 1)) * (currentIndex.value + 1);
setTransition({
duration: height / (textArray.value.length + 1) / props.speed,
delay: props.delay,
translate
});
}
async function scroll() {
const [wRect, cRect] = await queryRect();
if (!wRect.width || !cRect.width || !cRect.height)
return;
wrapRect.value = wRect;
contentRect.value = cRect;
wrapWidth.value = wRect.width;
if (isHorizontal.value) {
if (props.scrollable) {
setTransition({
duration: cRect.width / props.speed,
delay: props.delay,
translate: -cRect.width
});
}
} else {
if (textArray.value.length > 1) {
verticalAnimate(cRect.height);
}
}
}
function next() {
if (currentIndex.value >= textArray.value.length - 1) {
currentIndex.value = 0;
} else {
currentIndex.value++;
}
emit("next", currentIndex.value);
}
function animationEnd() {
if (isHorizontal.value) {
setTransition({
duration: 0,
delay: 0,
translate: wrapWidth.value + 1
});
} else {
if (++verticalIndex.value >= textArray.value.length) {
verticalIndex.value = 0;
setTransition({
duration: 0,
delay: 0,
translate: 0
});
}
}
const timer = setTimeout(() => {
next();
common_vendor.nextTick$1(async () => {
try {
const [wRect, cRect] = await queryRect();
wrapRect.value = wRect;
contentRect.value = cRect;
wrapWidth.value = wRect.width || 0;
} catch (error) {
}
if (!contentRect.value || !contentRect.value.width || !contentRect.value.height)
return;
if (isHorizontal.value) {
setTransition({
duration: (wrapWidth.value + contentRect.value.width) / props.speed,
delay: props.delay,
translate: -contentRect.value.width
});
} else {
verticalAnimate(contentRect.value.height);
}
});
clearTimeout(timer);
}, 20);
}
function handleClick() {
const result = uni_modules_wotDesignUni_components_common_util.isArray(props.text) ? {
index: currentIndex.value,
text: props.text[currentIndex.value]
} : {
index: 0,
text: props.text
};
emit("click", result);
}
__expose({ reset });
return (_ctx, _cache) => {
return common_vendor.e({
a: show.value
}, show.value ? common_vendor.e({
b: _ctx.prefix
}, _ctx.prefix ? {
c: common_vendor.p({
["custom-class"]: "wd-notice-bar__prefix",
name: _ctx.prefix
})
} : {}, {
d: isVertical.value
}, isVertical.value ? common_vendor.e({
e: common_vendor.f(textArray.value, (item, k0, i0) => {
return {
a: common_vendor.t(item),
b: item
};
}),
f: textArray.value.length > 1
}, textArray.value.length > 1 ? {
g: common_vendor.t(textArray.value[0])
} : {}) : {
h: common_vendor.t(currentText.value)
}, {
i: common_vendor.s(animation.value),
j: common_vendor.o(animationEnd),
k: common_vendor.o(handleClick),
l: _ctx.closable
}, _ctx.closable ? {
m: common_vendor.o(handleClose),
n: common_vendor.p({
["custom-class"]: "wd-notice-bar__suffix",
name: "close-bold"
})
} : {}, {
o: common_vendor.n(`wd-notice-bar ${_ctx.customClass} ${noticeBarClass.value}`),
p: common_vendor.s(rootStyle.value)
}) : {});
};
}
});
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-e7a73070"]]);
wx.createComponent(Component);
//# sourceMappingURL=../../../../../.sourcemap/mp-weixin/uni_modules/wot-design-uni/components/wd-notice-bar/wd-notice-bar.js.map

View File

@@ -0,0 +1,6 @@
{
"component": true,
"usingComponents": {
"wd-icon": "../wd-icon/wd-icon"
}
}

View File

@@ -0,0 +1 @@
<view wx:if="{{a}}" class="{{['data-v-e7a73070', o]}}" style="{{p}}"><wd-icon wx:if="{{b}}" class="data-v-e7a73070" u-i="e7a73070-0" bind:__l="__l" u-p="{{c}}"></wd-icon><slot wx:else name="prefix"></slot><view class="wd-notice-bar__wrap data-v-e7a73070"><view class="wd-notice-bar__content data-v-e7a73070" style="{{i}}" bindtransitionend="{{j}}" bindtap="{{k}}"><block wx:if="{{d}}"><view wx:for="{{e}}" wx:for-item="item" wx:key="b" class="data-v-e7a73070">{{item.a}}</view><view wx:if="{{f}}" class="data-v-e7a73070">{{g}}</view></block><block wx:else><block wx:if="{{$slots.d}}"><slot></slot></block><block wx:else>{{h}}</block></block></view></view><wd-icon wx:if="{{l}}" class="data-v-e7a73070" bindclick="{{m}}" u-i="e7a73070-1" bind:__l="__l" u-p="{{n}}"></wd-icon><slot wx:else name="suffix"></slot></view>

View File

@@ -0,0 +1,227 @@
/* 水平间距 */
/* 水平间距 */
/**
* 辅助函数
*/
/**
* SCSS 配置项命名空间以及BEM
*/
/* 转换成字符串 */
/* 判断是否存在 Modifier */
/* 判断是否存在伪类 */
/**
* 主题色切换
* @params $theme-color 主题色
* @params $type 变暗dark 变亮 'light'
* @params $mix-color 自己设置的混色
*/
/**
* 颜色结果切换, 如果开启线性渐变色 使用渐变色,如果没有开启,那么使用主题色
* @params $open-linear 是否开启线性渐变色
* @params $deg 渐变色角度
* @params $theme-color 当前配色
* @params [Array] $set 主题色明暗设置,与 $color-list 数量对应
* @params [Array] $color-list 渐变色顺序, $color-list 和 $per-list 数量相同
* @params [Array] $per-list 渐变色比例
*/
/**
* UI规范基础变量
*/
/*----------------------------------------- Theme color. start ----------------------------------------*/
/* 主题颜色 */
/* 辅助色 */
/* 文字颜色(默认浅色背景下 */
/* 暗黑模式 */
/* 图形颜色 */
/*----------------------------------------- Theme color. end -------------------------------------------*/
/*-------------------------------- Theme color application size. start --------------------------------*/
/* 文字字号 */
/* 文字字重 */
/* 尺寸 */
/*-------------------------------- Theme color application size. end --------------------------------*/
/* component var */
/* action-sheet */
/* badge */
/* button */
/* cell */
/* calendar */
/* checkbox */
/* collapse */
/* divider */
/* drop-menu */
/* input-number */
/* input */
/* textarea */
/* loadmore */
/* message-box */
/* notice-bar */
/* pagination */
/* picker */
/* col-picker */
/* overlay */
/* popup */
/* progress */
/* radio */
/* search */
/* slider */
/* sort-button */
/* steps */
/* switch */
/* tabs */
/* tag */
/* toast */
/* loading */
/* tooltip */
/* popover */
/* grid-item */
/* statustip */
/* card */
/* upload */
/* curtain */
/* notify */
/* skeleton */
/* circle */
/* swiper */
/* swiper-nav */
/* segmented */
/* tabbar */
/* tabbar-item */
/* navbar */
/* navbar-capsule */
/* table */
/* sidebar */
/* sidebar-item */
/* fab */
/* count-down */
/* keyboard */
/* number-keyboard */
/* passwod-input */
/* form-item */
/* backtop */
/* index-bar */
/* text */
/* video-preview */
/* img-cropper */
/* floating-panel */
/* signature */
/**
* 混合宏
*/
/**
* SCSS 配置项命名空间以及BEM
*/
/**
* 辅助函数
*/
/**
* SCSS 配置项命名空间以及BEM
*/
/* 转换成字符串 */
/* 判断是否存在 Modifier */
/* 判断是否存在伪类 */
/**
* 主题色切换
* @params $theme-color 主题色
* @params $type 变暗dark 变亮 'light'
* @params $mix-color 自己设置的混色
*/
/**
* 颜色结果切换, 如果开启线性渐变色 使用渐变色,如果没有开启,那么使用主题色
* @params $open-linear 是否开启线性渐变色
* @params $deg 渐变色角度
* @params $theme-color 当前配色
* @params [Array] $set 主题色明暗设置,与 $color-list 数量对应
* @params [Array] $color-list 渐变色顺序, $color-list 和 $per-list 数量相同
* @params [Array] $per-list 渐变色比例
*/
/**
* BEM定义块b)
*/
/* 定义元素e对于伪类会自动将 e 嵌套在 伪类 底下 */
/* 此方法用于生成穿透样式 */
/* 定义元素e对于伪类会自动将 e 嵌套在 伪类 底下 */
/* 定义状态m */
/* 定义状态m */
/* 对于需要需要嵌套在 m 底下的 e调用这个混合宏一般在切换整个组件的状态如切换颜色的时候 */
/* 状态,生成 is-$state 类名 */
/**
* 常用混合宏
*/
/* 单行超出隐藏 */
/* 多行超出隐藏 */
/* 清除浮动 */
/* 0.5px 边框 指定方向*/
/* 0.5px 边框 环绕 */
/**
* 三角形实现尖角样式,适用于背景透明情况
* @param $size 三角形高,底边为 $size * 2
* @param $bg 三角形背景颜色
*/
/**
* 正方形实现尖角样式,适用于背景不透明情况
* @param $size 正方形边长
* @param $bg 正方形背景颜色
* @param $z-index z-index属性值不得大于外部包裹器
* @param $box-shadow 阴影
*/
.wd-notice-bar.data-v-e7a73070 {
display: flex;
padding: var(--wot-notice-bar-padding, 9px 20px 9px 15px);
align-items: center;
font-size: var(--wot-notice-bar-fs, 12px);
border-radius: var(--wot-notice-bar-border-radius, 8px);
position: relative;
box-sizing: border-box;
}
.wd-notice-bar.is-warning.data-v-e7a73070 {
background: var(--wot-notice-bar-warning-bg, #fff6c8);
color: var(--wot-notice-bar-warning-color, var(--wot-color-warning, #f0883a));
}
.wd-notice-bar.is-info.data-v-e7a73070 {
background: var(--wot-notice-bar-info-bg, #f4f9ff);
color: var(--wot-notice-bar-info-color, var(--wot-color-theme, #4d80f0));
}
.wd-notice-bar.is-danger.data-v-e7a73070 {
background: var(--wot-notice-bar-danger-bg, #feeced);
color: var(--wot-notice-bar-danger-color, var(--wot-color-danger, #fa4350));
}
.data-v-e7a73070 .wd-notice-bar__prefix {
padding-right: 4px;
font-size: var(--wot-notice-bar-prefix-size, 18px);
}
.data-v-e7a73070 .wd-notice-bar__suffix {
text-align: center;
font-size: var(--wot-notice-bar-close-size, 18px);
display: inline-block;
background-color: var(--wot-notice-bar-close-bg, rgba(0, 0, 0, 0.15));
color: var(--wot-notice-bar-close-color, var(--wot-color-white, white));
padding: 0;
border-radius: 0px 8px 0px 4px;
position: absolute;
right: 0;
top: 0;
}
.wd-notice-bar__wrap.data-v-e7a73070 {
position: relative;
flex: 1;
height: var(--wot-notice-bar-line-height, 18px);
overflow: hidden;
line-height: var(--wot-notice-bar-line-height, 18px);
}
.wd-notice-bar__content.data-v-e7a73070 {
position: absolute;
white-space: nowrap;
}
.wd-notice-bar--ellipse .wd-notice-bar__content.data-v-e7a73070 {
position: static;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.wd-notice-bar--wrap .wd-notice-bar__wrap.data-v-e7a73070 {
height: auto;
}
.wd-notice-bar--wrap .wd-notice-bar__content.data-v-e7a73070 {
position: static;
white-space: normal;
}