no message

This commit is contained in:
2024-01-16 22:53:42 +08:00
commit 40e5198c79
479 changed files with 52166 additions and 0 deletions

View File

@@ -0,0 +1,156 @@
var e = require("../../../../common/vendor.js"),
t = {
name: "uniCollapseItem",
props: {
title: { type: String, default: "" },
name: { type: [Number, String], default: "" },
disabled: { type: Boolean, default: !1 },
showAnimation: { type: Boolean, default: !0 },
open: { type: Boolean, default: !1 },
thumb: { type: String, default: "" },
titleBorder: { type: String, default: "auto" },
border: { type: Boolean, default: !0 },
showArrow: { type: Boolean, default: !0 },
},
data: function () {
return {
isOpen: !1,
isheight: null,
height: 0,
elId: "Uni_".concat(Math.ceil(1e6 * Math.random()).toString(36)),
nameSync: 0,
};
},
watch: {
open: function (e) {
(this.isOpen = e), this.onClick(e, "init");
},
},
updated: function (e) {
var t = this;
this.$nextTick(function () {
t.init(!0);
});
},
created: function () {
(this.collapse = this.getCollapse()),
(this.oldHeight = 0),
this.onClick(this.open, "init");
},
unmounted: function () {
(this.__isUnmounted = !0), this.uninstall();
},
mounted: function () {
this.collapse &&
("" !== this.name
? (this.nameSync = this.name)
: (this.nameSync = this.collapse.childrens.length + ""),
-1 === this.collapse.names.indexOf(this.nameSync)
? this.collapse.names.push(this.nameSync)
: console.warn("name 值 ".concat(this.nameSync, " 重复")),
-1 === this.collapse.childrens.indexOf(this) &&
this.collapse.childrens.push(this),
this.init());
},
methods: {
init: function (e) {
this.getCollapseHeight(e);
},
uninstall: function () {
var e = this;
this.collapse &&
(this.collapse.childrens.forEach(function (t, i) {
t === e && e.collapse.childrens.splice(i, 1);
}),
this.collapse.names.forEach(function (t, i) {
t === e.nameSync && e.collapse.names.splice(i, 1);
}));
},
onClick: function (e, t) {
this.disabled ||
((this.isOpen = e),
this.isOpen && this.collapse && this.collapse.setAccordion(this),
"init" !== t && this.collapse.onChange(e, this));
},
getCollapseHeight: function (t) {
var i = this,
n =
arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 0;
e.index
.createSelectorQuery()
.in(this)
.select("#".concat(this.elId))
.fields({ size: !0 }, function (e) {
if (!(n >= 10)) {
if (!e) return n++, void i.getCollapseHeight(!1, n);
(i.height = e.height),
(i.isheight = !0),
t || i.onClick(i.isOpen, "init");
}
})
.exec();
},
getNvueHwight: function (e) {
var t = this;
dom.getComponentRect(this.$refs["collapse--hook"], function (i) {
if (i && i.result && i.size) {
if (((t.height = i.size.height), (t.isheight = !0), e)) return;
t.onClick(t.open, "init");
}
});
},
getCollapse: function () {
for (
var e =
arguments.length > 0 && void 0 !== arguments[0]
? arguments[0]
: "uniCollapse",
t = this.$parent,
i = t.$options.name;
i !== e;
) {
if (!(t = t.$parent)) return !1;
i = t.$options.name;
}
return t;
},
},
};
Array || e.resolveComponent("uni-icons")(), Math;
var i = e._export_sfc(t, [
[
"render",
function (t, i, n, o, s, l) {
return e.e(
{ a: n.thumb },
n.thumb ? { b: n.thumb } : {},
{ c: e.t(n.title), d: n.disabled ? 1 : "", e: n.showArrow },
n.showArrow
? {
f: e.p({
color: n.disabled ? "#ddd" : "#bbb",
size: "14",
type: "bottom",
}),
g: s.isOpen ? 1 : "",
h: !0 === n.showAnimation ? 1 : "",
}
: {},
{
i: e.o(function (e) {
return l.onClick(!s.isOpen);
}),
j: s.isOpen && "auto" === n.titleBorder ? 1 : "",
k: "none" !== n.titleBorder ? 1 : "",
l: s.elId,
m: s.isheight ? 1 : "",
n: n.border && s.isOpen ? 1 : "",
o: n.showAnimation ? 1 : "",
p: (s.isOpen ? s.height : 0) + "px",
}
);
},
],
]);
wx.createComponent(i);

View File

@@ -0,0 +1,6 @@
{
"component": true,
"usingComponents": {
"uni-icons": "../../../uni-icons/components/uni-icons/uni-icons"
}
}

View File

@@ -0,0 +1,44 @@
<view class="uni-collapse-item">
<view
bindtap="{{i}}"
class="{{['uni-collapse-item__title',j&&'is-open',k&&'uni-collapse-item-border']}}"
>
<view class="uni-collapse-item__title-wrap">
<slot name="title" wx:if="{{$slots.title}}"></slot>
<view
class="{{['uni-collapse-item__title-box',d&&'is-disabled']}}"
wx:else
>
<image
class="uni-collapse-item__title-img"
src="{{b}}"
wx:if="{{a}}"
></image>
<text class="uni-collapse-item__title-text">{{c}}</text>
</view>
</view>
<view
class="{{[g&&'uni-collapse-item__title-arrow-active',h&&'uni-collapse-item--animation','uni-collapse-item__title-arrow']}}"
wx:if="{{e}}"
>
<uni-icons
bind:__l="__l"
uI="600bad8f-0"
uP="{{f}}"
wx:if="{{f}}"
></uni-icons>
</view>
</view>
<view
class="{{['uni-collapse-item__wrap',o&&'is--transition']}}"
style="{{'height:'+p}}"
>
<view
class="{{['uni-collapse-item__wrap-content',m&&'open',n&&'uni-collapse-item--border']}}"
id="{{l}}"
ref="collapse--hook"
>
<slot></slot>
</view>
</view>
</view>

View File

@@ -0,0 +1,101 @@
.uni-collapse-item {
box-sizing: border-box;
}
.uni-collapse-item__title {
align-items: center;
box-sizing: border-box;
display: -webkit-flex;
display: flex;
flex-direction: row;
transition: border-bottom-color 0.3s;
width: 100%;
}
.uni-collapse-item__title-wrap {
flex: 1;
width: 100%;
}
.uni-collapse-item__title-box {
align-items: center;
background-color: #fff;
box-sizing: border-box;
color: #303133;
display: -webkit-flex;
display: flex;
flex-direction: row;
font-size: 13px;
font-weight: 500;
height: 48px;
justify-content: space-between;
line-height: 48px;
padding: 0 15px;
width: 100%;
}
.uni-collapse-item__title-box.is-disabled .uni-collapse-item__title-text {
color: #999;
}
.uni-collapse-item__title.uni-collapse-item-border {
border-bottom: 1px solid #ebeef5;
}
.uni-collapse-item__title.is-open {
border-bottom-color: transparent;
}
.uni-collapse-item__title-img {
height: 22px;
margin-right: 10px;
width: 22px;
}
.uni-collapse-item__title-text {
color: inherit;
flex: 1;
font-size: 14px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.uni-collapse-item__title-arrow {
align-items: center;
box-sizing: border-box;
display: -webkit-flex;
display: flex;
height: 20px;
justify-content: center;
margin-right: 10px;
transform: rotate(0);
width: 20px;
}
.uni-collapse-item__title-arrow-active {
transform: rotate(-180deg);
}
.uni-collapse-item__wrap {
background-color: #fff;
box-sizing: border-box;
height: 0;
overflow: hidden;
position: relative;
will-change: height;
}
.uni-collapse-item__wrap.is--transition {
transition-duration: 0.3s;
transition-property: height, border-bottom-width;
will-change: height;
}
.uni-collapse-item__wrap-content {
border-bottom: 0 solid transparent;
color: #303133;
font-size: 13px;
position: absolute;
}
.uni-collapse-item__wrap-content.uni-collapse-item--border {
border-bottom-color: #ebeef5;
border-bottom-width: 1px;
}
.uni-collapse-item__wrap-content.open {
position: relative;
}
.uni-collapse-item--animation {
transition-duration: 0.3s;
transition-property: -webkit-transform;
transition-property: transform;
transition-property: transform, -webkit-transform;
transition-timing-function: ease;
}

View File

@@ -0,0 +1,99 @@
var e = require("../../../../common/vendor.js"),
t = {
name: "uniCollapse",
emits: ["change", "activeItem", "input", "update:modelValue"],
props: {
value: { type: [String, Array], default: "" },
modelValue: { type: [String, Array], default: "" },
accordion: { type: [Boolean, String], default: !1 },
},
data: function () {
return {};
},
computed: {
dataValue: function () {
var e =
("string" == typeof this.value && "" === this.value) ||
(Array.isArray(this.value) && 0 === this.value.length);
return (
("string" == typeof this.modelValue && "" === this.modelValue) ||
(Array.isArray(this.modelValue) && this.modelValue.length),
e ? this.modelValue : this.value
);
},
},
watch: {
dataValue: function (e) {
this.setOpen(e);
},
},
created: function () {
(this.childrens = []), (this.names = []);
},
mounted: function () {
var e = this;
this.$nextTick(function () {
e.setOpen(e.dataValue);
});
},
methods: {
setOpen: function (e) {
var t = this,
n = "string" == typeof e,
i = Array.isArray(e);
this.childrens.forEach(function (a, o) {
if (n && e === a.nameSync) {
if (!t.accordion)
return void console.warn(
"accordion 属性为 false ,v-model 类型应该为 array"
);
a.isOpen = !0;
}
i &&
e.forEach(function (e) {
if (e === a.nameSync) {
if (t.accordion)
return void console.warn(
"accordion 属性为 true ,v-model 类型应该为 string"
);
a.isOpen = !0;
}
});
}),
this.emit(e);
},
setAccordion: function (e) {
this.accordion &&
this.childrens.forEach(function (t, n) {
e !== t && (t.isOpen = !1);
});
},
resize: function () {
this.childrens.forEach(function (e, t) {
e.getCollapseHeight();
});
},
onChange: function (e, t) {
var n = [];
this.accordion
? (n = e ? t.nameSync : "")
: this.childrens.forEach(function (e, t) {
e.isOpen && n.push(e.nameSync);
}),
this.$emit("change", n),
this.emit(n);
},
emit: function (e) {
this.$emit("input", e), this.$emit("update:modelValue", e);
},
},
},
n = e._export_sfc(t, [
[
"render",
function (e, t, n, i, a, o) {
return {};
},
],
]);
wx.createComponent(n);

View File

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

View File

@@ -0,0 +1,3 @@
<view class="uni-collapse">
<slot></slot>
</view>

View File

@@ -0,0 +1,7 @@
.uni-collapse {
background-color: #fff;
display: -webkit-flex;
display: flex;
flex-direction: column;
width: 100%;
}