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,76 @@
"use strict";
const common_vendor = require("../../../../common/vendor.js");
const uni_modules_wotDesignUni_components_common_util = require("../common/util.js");
const messageDefaultOptionKey = "__MESSAGE_OPTION__";
const None = Symbol("None");
const defaultOptions = {
title: "",
showCancelButton: false,
show: false,
closeOnClickModal: true,
msg: "",
type: "alert",
inputType: "text",
inputValue: "",
showErr: false,
zIndex: 99,
lazyRender: true,
inputError: ""
};
function useMessage(selector = "") {
const messageOptionKey = selector ? messageDefaultOptionKey + selector : messageDefaultOptionKey;
const messageOption = common_vendor.inject(messageOptionKey, common_vendor.ref(None));
if (messageOption.value === None) {
messageOption.value = defaultOptions;
common_vendor.provide(messageOptionKey, messageOption);
}
const createMethod = (type) => {
return (options) => {
const messageOptions = uni_modules_wotDesignUni_components_common_util.deepMerge({ type }, typeof options === "string" ? { title: options } : options);
if (messageOptions.type === "confirm" || messageOptions.type === "prompt") {
messageOptions.showCancelButton = true;
} else {
messageOptions.showCancelButton = false;
}
return show(messageOptions);
};
};
const show = (option) => {
return new Promise((resolve, reject) => {
const options = uni_modules_wotDesignUni_components_common_util.deepMerge(defaultOptions, typeof option === "string" ? { title: option } : option);
messageOption.value = uni_modules_wotDesignUni_components_common_util.deepMerge(options, {
show: true,
success: (res) => {
close();
resolve(res);
},
fail: (res) => {
close();
reject(res);
}
});
});
};
const alert = createMethod("alert");
const confirm = createMethod("confirm");
const prompt = createMethod("prompt");
const close = () => {
if (messageOption.value !== None) {
messageOption.value.show = false;
}
};
return {
show,
alert,
confirm,
prompt,
close
};
}
const getMessageDefaultOptionKey = (selector) => {
return selector ? `${messageDefaultOptionKey}${selector}` : messageDefaultOptionKey;
};
exports.defaultOptions = defaultOptions;
exports.getMessageDefaultOptionKey = getMessageDefaultOptionKey;
exports.useMessage = useMessage;
//# sourceMappingURL=../../../../../.sourcemap/mp-weixin/uni_modules/wot-design-uni/components/wd-message-box/index.js.map

View File

@@ -0,0 +1,15 @@
"use strict";
const uni_modules_wotDesignUni_components_common_props = require("../common/props.js");
const messageBoxProps = {
...uni_modules_wotDesignUni_components_common_props.baseProps,
/**
* 指定唯一标识
*/
selector: uni_modules_wotDesignUni_components_common_props.makeStringProp(""),
/**
* 是否从页面中脱离出来,用于解决各种 fixed 失效问题 (H5: teleport, APP: renderjs, 小程序: root-portal)
*/
rootPortal: uni_modules_wotDesignUni_components_common_props.makeBooleanProp(false)
};
exports.messageBoxProps = messageBoxProps;
//# sourceMappingURL=../../../../../.sourcemap/mp-weixin/uni_modules/wot-design-uni/components/wd-message-box/types.js.map

View File

@@ -0,0 +1,268 @@
"use strict";
const common_vendor = require("../../../../common/vendor.js");
const uni_modules_wotDesignUni_components_wdMessageBox_types = require("./types.js");
const uni_modules_wotDesignUni_components_wdMessageBox_index = require("./index.js");
const uni_modules_wotDesignUni_components_common_util = require("../common/util.js");
const uni_modules_wotDesignUni_components_composables_useTranslate = require("../composables/useTranslate.js");
if (!Math) {
(wdInput + wdButton + wdPopup)();
}
const wdPopup = () => "../wd-popup/wd-popup.js";
const wdButton = () => "../wd-button/wd-button.js";
const wdInput = () => "../wd-input/wd-input.js";
const __default__ = {
name: "wd-message-box",
options: {
virtualHost: true,
addGlobalClass: true,
styleIsolation: "shared"
}
};
const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
...__default__,
props: uni_modules_wotDesignUni_components_wdMessageBox_types.messageBoxProps,
setup(__props) {
const props = __props;
const { translate } = uni_modules_wotDesignUni_components_composables_useTranslate.useTranslate("message-box");
const rootClass = common_vendor.computed(() => {
return `wd-message-box__container ${props.customClass}`;
});
const bodyClass = common_vendor.computed(() => {
return `wd-message-box__body ${!messageState.title ? "is-no-title" : ""} ${messageState.type === "prompt" ? "is-prompt" : ""}`;
});
const messageOptionKey = uni_modules_wotDesignUni_components_wdMessageBox_index.getMessageDefaultOptionKey(props.selector);
const messageOption = common_vendor.inject(messageOptionKey, common_vendor.ref(uni_modules_wotDesignUni_components_wdMessageBox_index.defaultOptions));
const messageState = common_vendor.reactive({
msg: "",
// 消息内容
show: false,
// 是否显示弹框
title: "",
// 标题
showCancelButton: false,
// 是否展示取消按钮
closeOnClickModal: true,
// 是否支持点击蒙层关闭
confirmButtonText: "",
// 确定按钮文案
cancelButtonText: "",
// 取消按钮文案
type: "alert",
// 弹框类型
inputType: "text",
// 输入框类型
inputValue: "",
// 输入框初始值
inputPlaceholder: "",
// 输入框placeholder
inputError: "",
// 输入框错误提示文案
showErr: false,
// 是否显示错误提示
zIndex: 99,
// 弹窗层级
lazyRender: true
// 弹层内容懒渲染
});
const customConfirmProps = common_vendor.computed(() => {
const buttonProps = uni_modules_wotDesignUni_components_common_util.deepAssign(
{
block: true
},
uni_modules_wotDesignUni_components_common_util.isDef(messageState.confirmButtonProps) ? uni_modules_wotDesignUni_components_common_util.omitBy(messageState.confirmButtonProps, uni_modules_wotDesignUni_components_common_util.isUndefined) : {}
);
buttonProps.customClass = `${buttonProps.customClass || ""} wd-message-box__actions-btn`;
return buttonProps;
});
const customCancelProps = common_vendor.computed(() => {
const buttonProps = uni_modules_wotDesignUni_components_common_util.deepAssign(
{
block: true,
type: "info"
},
uni_modules_wotDesignUni_components_common_util.isDef(messageState.cancelButtonProps) ? uni_modules_wotDesignUni_components_common_util.omitBy(messageState.cancelButtonProps, uni_modules_wotDesignUni_components_common_util.isUndefined) : {}
);
buttonProps.customClass = `${buttonProps.customClass || ""} wd-message-box__actions-btn`;
return buttonProps;
});
common_vendor.watch(
() => messageOption.value,
(newVal) => {
reset(newVal);
},
{
deep: true,
immediate: true
}
);
common_vendor.watch(
() => messageState.show,
(newValue) => {
resetErr(!!newValue);
},
{
deep: true,
immediate: true
}
);
function toggleModal(action) {
if (action === "modal" && !messageState.closeOnClickModal) {
return;
}
if (messageState.type === "prompt" && action === "confirm" && !validate()) {
return;
}
switch (action) {
case "confirm":
if (messageState.beforeConfirm) {
messageState.beforeConfirm({
resolve: (isPass) => {
if (isPass) {
handleConfirm({
action,
value: messageState.inputValue
});
}
}
});
} else {
handleConfirm({
action,
value: messageState.inputValue
});
}
break;
case "cancel":
handleCancel({
action
});
break;
default:
handleCancel({
action: "modal"
});
break;
}
}
function handleConfirm(result) {
messageState.show = false;
if (uni_modules_wotDesignUni_components_common_util.isFunction(messageState.success)) {
messageState.success(result);
}
}
function handleCancel(result) {
messageState.show = false;
if (uni_modules_wotDesignUni_components_common_util.isFunction(messageState.fail)) {
messageState.fail(result);
}
}
function validate() {
if (messageState.inputPattern && !messageState.inputPattern.test(String(messageState.inputValue))) {
messageState.showErr = true;
return false;
}
if (typeof messageState.inputValidate === "function") {
const validateResult = messageState.inputValidate(messageState.inputValue);
if (!validateResult) {
messageState.showErr = true;
return false;
}
}
messageState.showErr = false;
return true;
}
function resetErr(val) {
if (val === false) {
messageState.showErr = false;
}
}
function inputValChange({ value }) {
if (value === "") {
messageState.showErr = false;
return;
}
messageState.inputValue = value;
}
function reset(option) {
if (option) {
messageState.title = uni_modules_wotDesignUni_components_common_util.isDef(option.title) ? option.title : "";
messageState.showCancelButton = uni_modules_wotDesignUni_components_common_util.isDef(option.showCancelButton) ? option.showCancelButton : false;
messageState.show = option.show;
messageState.closeOnClickModal = option.closeOnClickModal;
messageState.confirmButtonText = option.confirmButtonText;
messageState.cancelButtonText = option.cancelButtonText;
messageState.msg = option.msg;
messageState.type = option.type;
messageState.inputType = option.inputType;
messageState.inputSize = option.inputSize;
messageState.inputValue = option.inputValue;
messageState.inputPlaceholder = option.inputPlaceholder;
messageState.inputPattern = option.inputPattern;
messageState.inputValidate = option.inputValidate;
messageState.success = option.success;
messageState.fail = option.fail;
messageState.beforeConfirm = option.beforeConfirm;
messageState.inputError = option.inputError;
messageState.showErr = option.showErr;
messageState.zIndex = option.zIndex;
messageState.lazyRender = option.lazyRender;
messageState.confirmButtonProps = option.confirmButtonProps;
messageState.cancelButtonProps = option.cancelButtonProps;
}
}
return (_ctx, _cache) => {
return common_vendor.e({
a: messageState.title
}, messageState.title ? {
b: common_vendor.t(messageState.title)
} : {}, {
c: messageState.type === "prompt"
}, messageState.type === "prompt" ? common_vendor.e({
d: common_vendor.o(inputValChange),
e: common_vendor.o(($event) => messageState.inputValue = $event),
f: common_vendor.p({
type: messageState.inputType,
size: messageState.inputSize,
placeholder: messageState.inputPlaceholder,
modelValue: messageState.inputValue
}),
g: messageState.showErr
}, messageState.showErr ? {
h: common_vendor.t(messageState.inputError || common_vendor.unref(translate)("inputNoValidate"))
} : {}) : {}, {
i: common_vendor.t(messageState.msg),
j: common_vendor.n(bodyClass.value),
k: messageState.showCancelButton
}, messageState.showCancelButton ? {
l: common_vendor.t(messageState.cancelButtonText || common_vendor.unref(translate)("cancel")),
m: common_vendor.o(($event) => toggleModal("cancel")),
n: common_vendor.p({
...customCancelProps.value
})
} : {}, {
o: common_vendor.t(messageState.confirmButtonText || common_vendor.unref(translate)("confirm")),
p: common_vendor.o(($event) => toggleModal("confirm")),
q: common_vendor.p({
...customConfirmProps.value
}),
r: common_vendor.n(`wd-message-box__actions ${messageState.showCancelButton ? "wd-message-box__flex" : "wd-message-box__block"}`),
s: common_vendor.n(rootClass.value),
t: common_vendor.o(($event) => toggleModal("modal")),
v: common_vendor.o(($event) => messageState.show = $event),
w: common_vendor.p({
transition: "zoom-in",
["close-on-click-modal"]: messageState.closeOnClickModal,
["lazy-render"]: messageState.lazyRender,
["custom-class"]: "wd-message-box",
["z-index"]: messageState.zIndex,
duration: 200,
["root-portal"]: _ctx.rootPortal,
modelValue: messageState.show
})
});
};
}
});
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-c8139c88"]]);
wx.createComponent(Component);
//# sourceMappingURL=../../../../../.sourcemap/mp-weixin/uni_modules/wot-design-uni/components/wd-message-box/wd-message-box.js.map

View File

@@ -0,0 +1,8 @@
{
"component": true,
"usingComponents": {
"wd-popup": "../wd-popup/wd-popup",
"wd-button": "../wd-button/wd-button",
"wd-input": "../wd-input/wd-input"
}
}

View File

@@ -0,0 +1 @@
<view class="data-v-c8139c88"><wd-popup wx:if="{{w}}" class="data-v-c8139c88" u-s="{{['d']}}" bindclickModal="{{t}}" u-i="c8139c88-0" bind:__l="__l" bindupdateModelValue="{{v}}" u-p="{{w}}"><view class="{{['data-v-c8139c88', s]}}"><view class="{{['data-v-c8139c88', j]}}"><view wx:if="{{a}}" class="wd-message-box__title data-v-c8139c88">{{b}}</view><view class="wd-message-box__content data-v-c8139c88"><block wx:if="{{c}}"><wd-input wx:if="{{f}}" class="data-v-c8139c88" bindinput="{{d}}" u-i="c8139c88-1,c8139c88-0" bind:__l="__l" bindupdateModelValue="{{e}}" u-p="{{f}}"/><view wx:if="{{g}}" class="wd-message-box__input-error data-v-c8139c88">{{h}}</view></block><block wx:if="{{$slots.d}}"><slot></slot></block><block wx:else>{{i}}</block></view></view><view class="{{['data-v-c8139c88', r]}}"><wd-button wx:if="{{k}}" class="data-v-c8139c88" u-s="{{['d']}}" bindclick="{{m}}" u-i="c8139c88-2,c8139c88-0" bind:__l="__l" u-p="{{n}}">{{l}}</wd-button><wd-button wx:if="{{q}}" class="data-v-c8139c88" u-s="{{['d']}}" bindclick="{{p}}" u-i="c8139c88-3,c8139c88-0" bind:__l="__l" u-p="{{q}}">{{o}}</wd-button></view></view></wd-popup></view>

View File

@@ -0,0 +1,246 @@
/* 水平间距 */
/* 水平间距 */
/**
* 辅助函数
*/
/**
* 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 阴影
*/
.wot-theme-dark .wd-message-box__body.data-v-c8139c88 {
background-color: var(--wot-dark-background2, #1b1b1b);
}
.wot-theme-dark .wd-message-box__title.data-v-c8139c88 {
color: var(--wot-dark-color, var(--wot-color-white, white));
}
.wot-theme-dark .wd-message-box__content.data-v-c8139c88 {
color: var(--wot-dark-color3, rgba(232, 230, 227, 0.8));
}
.wot-theme-dark .wd-message-box__content.data-v-c8139c88::-webkit-scrollbar-thumb {
background: var(--wot-dark-border-color, #3a3a3c);
}
.data-v-c8139c88 .wd-message-box {
border-radius: var(--wot-message-box-radius, 16px);
overflow: hidden;
}
.wd-message-box.data-v-c8139c88 {
border-radius: var(--wot-message-box-radius, 16px);
overflow: hidden;
}
.wd-message-box__container.data-v-c8139c88 {
width: var(--wot-message-box-width, 300px);
box-sizing: border-box;
}
.wd-message-box__body.data-v-c8139c88 {
background-color: var(--wot-message-box-bg, var(--wot-color-white, white));
padding: var(--wot-message-box-padding, 25px 24px 0);
}
.wd-message-box__body.is-no-title.data-v-c8139c88 {
padding: 25px 24px 0px;
}
.wd-message-box__title.data-v-c8139c88 {
text-align: center;
font-size: var(--wot-message-box-title-fs, 16px);
color: var(--wot-message-box-title-color, rgba(0, 0, 0, 0.85));
line-height: 20px;
font-weight: 500;
padding-top: 5px;
padding-bottom: 10px;
}
.wd-message-box__content.data-v-c8139c88 {
max-height: var(--wot-message-box-content-max-height, 264px);
color: var(--wot-message-box-content-color, #666666);
font-size: var(--wot-message-box-content-fs, 14px);
text-align: center;
overflow: auto;
line-height: 20px;
}
.wd-message-box__content.data-v-c8139c88::-webkit-scrollbar {
width: var(--wot-message-box-content-scrollbar-width, 4px);
}
.wd-message-box__content.data-v-c8139c88::-webkit-scrollbar-thumb {
width: var(--wot-message-box-content-scrollbar-width, 4px);
background: var(--wot-message-box-content-scrollbar-color, rgba(0, 0, 0, 0.1));
border-radius: calc(var(--wot-message-box-content-scrollbar-width, 4px) / 2);
}
.wd-message-box__input-error.data-v-c8139c88 {
min-height: 18px;
margin-top: 2px;
color: var(--wot-message-box-input-error-color, var(--wot-input-error-color, var(--wot-color-danger, #fa4350)));
text-align: left;
}
.wd-message-box__input-error.is-hidden.data-v-c8139c88 {
visibility: hidden;
}
.wd-message-box__actions.data-v-c8139c88 {
padding: 24px;
}
.data-v-c8139c88 .wd-message-box__actions-btn:not(:last-child) {
margin-right: 16px;
}
.wd-message-box__flex.data-v-c8139c88 {
display: flex;
}
.wd-message-box__block.data-v-c8139c88 {
display: block;
}
.wd-message-box__cancel.data-v-c8139c88 {
margin-right: 16px;
}