This commit is contained in:
2026-01-05 12:47:14 +08:00
commit 1fc846fae3
1614 changed files with 162035 additions and 0 deletions

View File

@@ -0,0 +1,130 @@
"use strict";
const common_vendor = require("../../../../common/vendor.js");
const uni_modules_nutuiUni_components__constants_prefix = require("../_constants/prefix.js");
const uni_modules_nutuiUni_components__hooks_useInject = require("../_hooks/useInject.js");
require("../_utils/env.js");
const uni_modules_nutuiUni_components__utils_pxCheck = require("../_utils/pxCheck.js");
const uni_modules_nutuiUni_components__utils_style = require("../_utils/style.js");
const uni_modules_nutuiUni_components_avatargroup_avatargroup = require("../avatargroup/avatargroup.js");
const uni_modules_nutuiUni_components__utils_props = require("../_utils/props.js");
const uni_modules_nutuiUni_components_avatar_type = require("./type.js");
const avatarProps = {
...uni_modules_nutuiUni_components__utils_props.commonProps,
/**
* @description 头像的大小,可选值为:`large`、`normal`、`small`,支持直接输入数字
*/
size: uni_modules_nutuiUni_components__utils_props.makeNumericProp(void 0),
/**
* @description 头像的形状,可选值为:`square`、`round`
*/
shape: uni_modules_nutuiUni_components__utils_props.makeStringProp(void 0),
/**
* @description 背景色
*/
bgColor: uni_modules_nutuiUni_components__utils_props.makeStringProp("#eee"),
/**
* @description 字体颜色
*/
customColor: uni_modules_nutuiUni_components__utils_props.makeStringProp("#666")
};
const componentName = `${uni_modules_nutuiUni_components__constants_prefix.PREFIX}-avatar`;
const __default__ = common_vendor.defineComponent({
name: componentName,
options: {
virtualHost: true,
addGlobalClass: true,
styleIsolation: "shared"
}
});
const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
...__default__,
props: avatarProps,
setup(__props) {
const props = __props;
const instance = common_vendor.getCurrentInstance();
const { parent } = uni_modules_nutuiUni_components__hooks_useInject.useInject(uni_modules_nutuiUni_components_avatargroup_avatargroup.AVATAR_GROUP_KEY);
const show = common_vendor.ref(true);
const innerZIndex = common_vendor.ref(void 0);
common_vendor.watch(() => ({
maxCount: parent == null ? void 0 : parent.props.maxCount,
children: parent == null ? void 0 : parent.internalChildren
}), ({ maxCount, children }) => {
if (maxCount == null || Number(maxCount) <= 0 || children == null || instance == null) {
show.value = true;
innerZIndex.value = void 0;
return;
}
const index = children.findIndex((item) => {
var _a;
return item.uid === instance.uid && !((_a = item.props.customClass) == null ? void 0 : _a.includes("avatar-fold"));
});
if (index < 0) {
show.value = true;
innerZIndex.value = void 0;
return;
}
show.value = index < Number(maxCount);
if ((parent == null ? void 0 : parent.props.zIndex) === "right")
innerZIndex.value = children.length - index;
else
innerZIndex.value = void 0;
}, {
immediate: true,
deep: true
});
function getTrulySize() {
if (props.size != null)
return props.size;
if (parent != null && parent.props.size != null)
return parent.props.size;
return "normal";
}
const finalSize = common_vendor.computed(() => {
const size = getTrulySize();
const preset = uni_modules_nutuiUni_components_avatar_type.avatarSize.includes(size);
return {
preset,
value: preset ? size : uni_modules_nutuiUni_components__utils_pxCheck.pxCheck(size)
};
});
const finalShape = common_vendor.computed(() => {
if (props.shape != null)
return props.shape;
if (parent != null && parent.props.shape != null)
return parent.props.shape;
return "round";
});
const classes = common_vendor.computed(() => {
const value = {
[`nut-avatar-${finalShape.value}`]: true,
"nut-hidden": !show.value
};
if (finalSize.value.preset)
value[`nut-avatar-${finalSize.value.value}`] = true;
return uni_modules_nutuiUni_components__utils_style.getMainClass(props, componentName, value);
});
const styles = common_vendor.computed(() => {
const value = {
backgroundColor: props.bgColor,
color: props.customColor
};
if (!finalSize.value.preset) {
value.width = finalSize.value.value;
value.height = finalSize.value.value;
}
if (parent == null ? void 0 : parent.props.span)
value.marginLeft = uni_modules_nutuiUni_components__utils_pxCheck.pxCheck(parent == null ? void 0 : parent.props.span);
if (innerZIndex.value !== void 0)
value.zIndex = innerZIndex.value;
return uni_modules_nutuiUni_components__utils_style.getMainStyle(props, value);
});
return (_ctx, _cache) => {
return {
a: common_vendor.s(styles.value),
b: common_vendor.n(classes.value)
};
};
}
});
wx.createComponent(_sfc_main);
//# sourceMappingURL=../../../../../.sourcemap/mp-weixin/uni_modules/nutui-uni/components/avatar/avatar.js.map

View File

@@ -0,0 +1,4 @@
{
"component": true,
"usingComponents": {}
}

View File

@@ -0,0 +1 @@
<view style="{{a}}" class="{{b}}"><slot/></view>

View File

@@ -0,0 +1,97 @@
/**
* 这里是uni-app内置的常用样式变量
*
* uni-app 官方扩展插件及插件市场https://ext.dcloud.net.cn上很多三方插件均使用了这些样式变量
* 如果你是插件开发者建议你使用scss预处理并在插件代码中直接使用这些变量无需 import 这个文件方便用户通过搭积木的方式开发整体风格一致的App
*
*/
/**
* 如果你是App开发者插件使用者你可以通过修改这些变量来定制自己的插件主题实现自定义主题功能
*
* 如果你的项目同样使用了scss预处理你也可以直接在你的 scss 代码中使用如下变量,同时无需 import 这个文件
*/
/* 颜色变量 */
/* 行为相关颜色 */
/* 文字基本颜色 */
/* 背景颜色 */
/* 边框颜色 */
/* 尺寸变量 */
/* 文字尺寸 */
/* 图片尺寸 */
/* Border Radius */
/* 水平间距 */
/* 垂直间距 */
/* 透明度 */
/* 文章场景相关 */
/**
* 这里是uni-app内置的常用样式变量
*
* uni-app 官方扩展插件及插件市场https://ext.dcloud.net.cn上很多三方插件均使用了这些样式变量
* 如果你是插件开发者建议你使用scss预处理并在插件代码中直接使用这些变量无需 import 这个文件方便用户通过搭积木的方式开发整体风格一致的App
*
*/
/**
* 如果你是App开发者插件使用者你可以通过修改这些变量来定制自己的插件主题实现自定义主题功能
*
* 如果你的项目同样使用了scss预处理你也可以直接在你的 scss 代码中使用如下变量,同时无需 import 这个文件
*/
/* 颜色变量 */
/* 行为相关颜色 */
/* 文字基本颜色 */
/* 背景颜色 */
/* 边框颜色 */
/* 尺寸变量 */
/* 文字尺寸 */
/* 图片尺寸 */
/* Border Radius */
/* 水平间距 */
/* 垂直间距 */
/* 透明度 */
/* 文章场景相关 */
.nut-avatar {
position: relative;
display: inline-block;
flex: 0 0 auto;
text-align: center;
vertical-align: top;
background-repeat: no-repeat;
background-position: center center;
background-size: 100% 100%;
}
.nut-avatar image {
display: block;
width: 100%;
height: 100%;
}
.nut-avatar .nut-icon {
position: absolute;
top: 50%;
left: 50%;
background-size: 100% 100%;
transform: translate(-50%, -50%);
}
.nut-avatar-large {
width: var(--nut-avatar-large-width, 60px);
height: var(--nut-avatar-large-height, 60px);
line-height: var(--nut-avatar-large-height, 60px);
}
.nut-avatar-normal {
width: var(--nut-avatar-normal-width, 40px);
height: var(--nut-avatar-normal-height, 40px);
line-height: var(--nut-avatar-normal-height, 40px);
}
.nut-avatar-small {
width: var(--nut-avatar-small-width, 32px);
height: var(--nut-avatar-small-height, 32px);
line-height: var(--nut-avatar-small-height, 32px);
}
.nut-avatar-square {
border-radius: var(--nut-avatar-square, 5px);
}
.nut-avatar-round {
border-radius: 50%;
}
.nut-avatar-square,
.nut-avatar-round {
overflow: hidden;
}

View File

@@ -0,0 +1,4 @@
"use strict";
const avatarSize = ["large", "normal", "small"];
exports.avatarSize = avatarSize;
//# sourceMappingURL=../../../../../.sourcemap/mp-weixin/uni_modules/nutui-uni/components/avatar/type.js.map