first
This commit is contained in:
1
node_modules/vant/lib/collapse-item/index.css
generated
vendored
Normal file
1
node_modules/vant/lib/collapse-item/index.css
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
.van-collapse-item{position:relative}.van-collapse-item--border::after{position:absolute;box-sizing:border-box;content:' ';pointer-events:none;top:0;right:16px;left:16px;border-top:1px solid #ebedf0;-webkit-transform:scaleY(.5);transform:scaleY(.5)}.van-collapse-item__title .van-cell__right-icon::before{-webkit-transform:rotate(90deg) translateZ(0);transform:rotate(90deg) translateZ(0);-webkit-transition:-webkit-transform .3s;transition:-webkit-transform .3s;transition:transform .3s;transition:transform .3s,-webkit-transform .3s}.van-collapse-item__title::after{right:16px;display:none}.van-collapse-item__title--expanded .van-cell__right-icon::before{-webkit-transform:rotate(-90deg);transform:rotate(-90deg)}.van-collapse-item__title--expanded::after{display:block}.van-collapse-item__title--borderless::after{display:none}.van-collapse-item__title--disabled{cursor:not-allowed}.van-collapse-item__title--disabled,.van-collapse-item__title--disabled .van-cell__right-icon{color:#c8c9cc}.van-collapse-item__title--disabled:active{background-color:#fff}.van-collapse-item__wrapper{overflow:hidden;-webkit-transition:height .3s ease-in-out;transition:height .3s ease-in-out;will-change:height}.van-collapse-item__content{padding:12px 16px;color:#969799;font-size:14px;line-height:1.5;background-color:#fff}
|
217
node_modules/vant/lib/collapse-item/index.js
generated
vendored
Normal file
217
node_modules/vant/lib/collapse-item/index.js
generated
vendored
Normal file
@ -0,0 +1,217 @@
|
||||
"use strict";
|
||||
|
||||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
||||
|
||||
exports.__esModule = true;
|
||||
exports.default = void 0;
|
||||
|
||||
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
||||
|
||||
var _utils = require("../utils");
|
||||
|
||||
var _raf = require("../utils/dom/raf");
|
||||
|
||||
var _relation = require("../mixins/relation");
|
||||
|
||||
var _cell = _interopRequireDefault(require("../cell"));
|
||||
|
||||
var _shared = require("../cell/shared");
|
||||
|
||||
// Utils
|
||||
// Mixins
|
||||
// Components
|
||||
var _createNamespace = (0, _utils.createNamespace)('collapse-item'),
|
||||
createComponent = _createNamespace[0],
|
||||
bem = _createNamespace[1];
|
||||
|
||||
var CELL_SLOTS = ['title', 'icon', 'right-icon'];
|
||||
|
||||
var _default = createComponent({
|
||||
mixins: [(0, _relation.ChildrenMixin)('vanCollapse')],
|
||||
props: (0, _extends2.default)({}, _shared.cellProps, {
|
||||
name: [Number, String],
|
||||
disabled: Boolean,
|
||||
lazyRender: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
isLink: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
}
|
||||
}),
|
||||
data: function data() {
|
||||
return {
|
||||
show: null,
|
||||
inited: null
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
currentName: function currentName() {
|
||||
var _this$name;
|
||||
|
||||
return (_this$name = this.name) != null ? _this$name : this.index;
|
||||
},
|
||||
expanded: function expanded() {
|
||||
var _this = this;
|
||||
|
||||
if (!this.parent) {
|
||||
return null;
|
||||
}
|
||||
|
||||
var _this$parent = this.parent,
|
||||
value = _this$parent.value,
|
||||
accordion = _this$parent.accordion;
|
||||
|
||||
if (process.env.NODE_ENV === 'development' && !accordion && !Array.isArray(value)) {
|
||||
console.error('[Vant] Collapse: type of prop "value" should be Array');
|
||||
return;
|
||||
}
|
||||
|
||||
return accordion ? value === this.currentName : value.some(function (name) {
|
||||
return name === _this.currentName;
|
||||
});
|
||||
}
|
||||
},
|
||||
created: function created() {
|
||||
this.show = this.expanded;
|
||||
this.inited = this.expanded;
|
||||
},
|
||||
watch: {
|
||||
expanded: function expanded(_expanded, prev) {
|
||||
var _this2 = this;
|
||||
|
||||
if (prev === null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (_expanded) {
|
||||
this.show = true;
|
||||
this.inited = true;
|
||||
} // Use raf: flick when opened in safari
|
||||
// Use nextTick: closing animation failed when set `user-select: none`
|
||||
|
||||
|
||||
var nextTick = _expanded ? this.$nextTick : _raf.raf;
|
||||
nextTick(function () {
|
||||
var _this2$$refs = _this2.$refs,
|
||||
content = _this2$$refs.content,
|
||||
wrapper = _this2$$refs.wrapper;
|
||||
|
||||
if (!content || !wrapper) {
|
||||
return;
|
||||
}
|
||||
|
||||
var offsetHeight = content.offsetHeight;
|
||||
|
||||
if (offsetHeight) {
|
||||
var contentHeight = offsetHeight + "px";
|
||||
wrapper.style.height = _expanded ? 0 : contentHeight; // use double raf to ensure animation can start
|
||||
|
||||
(0, _raf.doubleRaf)(function () {
|
||||
wrapper.style.height = _expanded ? contentHeight : 0;
|
||||
});
|
||||
} else {
|
||||
_this2.onTransitionEnd();
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
onClick: function onClick() {
|
||||
if (!this.disabled) {
|
||||
this.toggle();
|
||||
}
|
||||
},
|
||||
// @exposed-api
|
||||
toggle: function toggle(expanded) {
|
||||
if (expanded === void 0) {
|
||||
expanded = !this.expanded;
|
||||
}
|
||||
|
||||
var parent = this.parent,
|
||||
currentName = this.currentName;
|
||||
var close = parent.accordion && currentName === parent.value;
|
||||
var name = close ? '' : currentName;
|
||||
this.parent.switch(name, expanded);
|
||||
},
|
||||
onTransitionEnd: function onTransitionEnd() {
|
||||
if (!this.expanded) {
|
||||
this.show = false;
|
||||
} else {
|
||||
this.$refs.wrapper.style.height = '';
|
||||
}
|
||||
},
|
||||
genTitle: function genTitle() {
|
||||
var _this3 = this;
|
||||
|
||||
var h = this.$createElement;
|
||||
var border = this.border,
|
||||
disabled = this.disabled,
|
||||
expanded = this.expanded;
|
||||
var titleSlots = CELL_SLOTS.reduce(function (slots, name) {
|
||||
if (_this3.slots(name)) {
|
||||
slots[name] = function () {
|
||||
return _this3.slots(name);
|
||||
};
|
||||
}
|
||||
|
||||
return slots;
|
||||
}, {});
|
||||
|
||||
if (this.slots('value')) {
|
||||
titleSlots.default = function () {
|
||||
return _this3.slots('value');
|
||||
};
|
||||
}
|
||||
|
||||
return h(_cell.default, {
|
||||
"attrs": {
|
||||
"role": "button",
|
||||
"tabindex": disabled ? -1 : 0,
|
||||
"aria-expanded": String(expanded)
|
||||
},
|
||||
"class": bem('title', {
|
||||
disabled: disabled,
|
||||
expanded: expanded,
|
||||
borderless: !border
|
||||
}),
|
||||
"on": {
|
||||
"click": this.onClick
|
||||
},
|
||||
"scopedSlots": titleSlots,
|
||||
"props": (0, _extends2.default)({}, this.$props)
|
||||
});
|
||||
},
|
||||
genContent: function genContent() {
|
||||
var h = this.$createElement;
|
||||
|
||||
if (this.inited || !this.lazyRender) {
|
||||
return h("div", {
|
||||
"directives": [{
|
||||
name: "show",
|
||||
value: this.show
|
||||
}],
|
||||
"ref": "wrapper",
|
||||
"class": bem('wrapper'),
|
||||
"on": {
|
||||
"transitionend": this.onTransitionEnd
|
||||
}
|
||||
}, [h("div", {
|
||||
"ref": "content",
|
||||
"class": bem('content')
|
||||
}, [this.slots()])]);
|
||||
}
|
||||
}
|
||||
},
|
||||
render: function render() {
|
||||
var h = arguments[0];
|
||||
return h("div", {
|
||||
"class": [bem({
|
||||
border: this.index && this.border
|
||||
})]
|
||||
}, [this.genTitle(), this.genContent()]);
|
||||
}
|
||||
});
|
||||
|
||||
exports.default = _default;
|
69
node_modules/vant/lib/collapse-item/index.less
generated
vendored
Normal file
69
node_modules/vant/lib/collapse-item/index.less
generated
vendored
Normal file
@ -0,0 +1,69 @@
|
||||
@import '../style/var';
|
||||
@import '../style/mixins/hairline';
|
||||
|
||||
.van-collapse-item {
|
||||
position: relative;
|
||||
|
||||
&--border {
|
||||
&::after {
|
||||
.hairline-top(@cell-border-color, @padding-md, @padding-md);
|
||||
}
|
||||
}
|
||||
|
||||
&__title {
|
||||
.van-cell__right-icon::before {
|
||||
// using translateZ to fix safari rendering issues
|
||||
// see: https://github.com/vant-ui/vant/issues/8608
|
||||
transform: rotate(90deg) translateZ(0);
|
||||
transition: transform @collapse-item-transition-duration;
|
||||
}
|
||||
|
||||
&::after {
|
||||
right: @padding-md;
|
||||
display: none;
|
||||
}
|
||||
|
||||
&--expanded {
|
||||
.van-cell__right-icon::before {
|
||||
transform: rotate(-90deg);
|
||||
}
|
||||
|
||||
&::after {
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
|
||||
&--borderless {
|
||||
&::after {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
&--disabled {
|
||||
cursor: not-allowed;
|
||||
|
||||
&,
|
||||
& .van-cell__right-icon {
|
||||
color: @collapse-item-title-disabled-color;
|
||||
}
|
||||
|
||||
&:active {
|
||||
background-color: @white;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&__wrapper {
|
||||
overflow: hidden;
|
||||
transition: height @collapse-item-transition-duration ease-in-out;
|
||||
will-change: height;
|
||||
}
|
||||
|
||||
&__content {
|
||||
padding: @collapse-item-content-padding;
|
||||
color: @collapse-item-content-text-color;
|
||||
font-size: @collapse-item-content-font-size;
|
||||
line-height: @collapse-item-content-line-height;
|
||||
background-color: @collapse-item-content-background-color;
|
||||
}
|
||||
}
|
5
node_modules/vant/lib/collapse-item/style/index.js
generated
vendored
Normal file
5
node_modules/vant/lib/collapse-item/style/index.js
generated
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
require('../../style/base.css');
|
||||
require('../../info/index.css');
|
||||
require('../../icon/index.css');
|
||||
require('../../cell/index.css');
|
||||
require('../index.css');
|
5
node_modules/vant/lib/collapse-item/style/less.js
generated
vendored
Normal file
5
node_modules/vant/lib/collapse-item/style/less.js
generated
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
require('../../style/base.less');
|
||||
require('../../info/index.less');
|
||||
require('../../icon/index.less');
|
||||
require('../../cell/index.less');
|
||||
require('../index.less');
|
Reference in New Issue
Block a user