[build] 3.0.7

This commit is contained in:
pangxie 2018-07-10 16:33:11 +08:00
parent 66d6f4fc03
commit 3adc6cacc0
23 changed files with 189 additions and 41 deletions

2
dist/btn/index.js vendored
View File

@ -3,7 +3,7 @@
var nativeButtonBehavior = require('./native-button-behaviors');
Component({
externalClasses: ['custom-class'],
externalClasses: ['custom-class', 'theme-class'],
behaviors: [nativeButtonBehavior],
relations: {
'../btn-group/index': {

2
dist/btn/index.wxml vendored
View File

@ -1,5 +1,5 @@
<button
class="custom-class zan-btn {{ inGroup ? 'zan-btn--group' : '' }} {{ isLast ? 'zan-btn--last' : '' }} {{size ? 'zan-btn--'+size : ''}} {{size === 'mini' ? 'zan-btn--plain' : ''}} {{plain ? 'zan-btn--plain' : ''}} {{type ? 'zan-btn--'+type : ''}} {{loading ? 'zan-btn--loading' : ''}} {{disabled ? 'zan-btn--disabled' : ''}}"
class="custom-class theme-class zan-btn {{ inGroup ? 'zan-btn--group' : '' }} {{ isLast ? 'zan-btn--last' : '' }} {{size ? 'zan-btn--'+size : ''}} {{size === 'mini' ? 'zan-btn--plain' : ''}} {{plain ? 'zan-btn--plain' : ''}} {{type ? 'zan-btn--'+type : ''}} {{loading ? 'zan-btn--loading' : ''}} {{disabled ? 'zan-btn--disabled' : ''}}"
disabled="{{ disabled }}"
hover-class="button-hover"
open-type="{{ openType }}"

View File

@ -1,6 +1,7 @@
'use strict';
Component({
externalClasses: ['custom-class'],
/**
* 组件的属性列表
* 用于组件自定义设置

View File

@ -1,4 +1,4 @@
<view class="zan-capsule zan-capsule--{{type}}">
<view class="custom-class zan-capsule zan-capsule--{{type}}">
<block wx:if="{{color}}">
<view
class="zan-capsule__left"

2
dist/card/index.js vendored
View File

@ -5,7 +5,7 @@ Component({
multipleSlots: true
},
externalClasses: ['card-class'],
externalClasses: ['card-class', 'thumb-class'],
properties: {
useThumbSlot: {

View File

@ -1,7 +1,7 @@
<view class="zan-card card-class">
<view class="card-class zan-card">
<!-- 左侧图片 -->
<view class="zan-card__thumb">
<view class="thumb-class zan-card__thumb">
<image class="zan-card__img"
src="{{ thumb }}"
mode="aspectFit"

View File

@ -1,6 +1,7 @@
<view
catchtap="cellTap"
class="cell-class zan-cell {{ isLastCell ? 'last-cell' : '' }} {{ isLink ? 'zan-cell--access' : '' }}">
class="cell-class zan-cell {{ isLastCell ? 'last-cell' : '' }} {{ isLink ? 'zan-cell--access' : '' }}"
>
<view class="zan-cell__icon">
<slot name="icon"></slot>

29
dist/checkbox-group/index.js vendored Normal file
View File

@ -0,0 +1,29 @@
'use strict';
var _relations;
var CHECKBOX_PATH = '../checkbox/index';
Component({
relations: (_relations = {}, _relations[CHECKBOX_PATH] = {
type: 'child',
linked: function linked() {
this.updateChildren(CHECKBOX_PATH);
}
}, _relations),
data: {
elementUpdateTimeout: 0
},
methods: {
updateChildren: function updateChildren(childPath) {
// 把checkbox标记为在group中设置不同样式
var elements = this.getRelationNodes(childPath);
elements.forEach(function (checkbox, index) {
checkbox.updateData({ isInGroup: true });
});
}
}
});

3
dist/checkbox-group/index.json vendored Normal file
View File

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

3
dist/checkbox-group/index.wxml vendored Normal file
View File

@ -0,0 +1,3 @@
<view class="checkbox-group">
<slot></slot>
</view>

1
dist/checkbox-group/index.wxss vendored Normal file
View File

@ -0,0 +1 @@
.checkbox-group{padding-bottom:10px;background-color:#fff}.checkbox-group .zan-checkbox{margin-top:10px}

44
dist/checkbox/index.js vendored Normal file
View File

@ -0,0 +1,44 @@
'use strict';
var _relations;
var CHECKBOX_GROUP_PATH = '../checkbox-group/index';
Component({
externalClasses: ['checkbox-class'],
relations: (_relations = {}, _relations[CHECKBOX_GROUP_PATH] = {
type: 'parent'
}, _relations),
properties: {
checked: Boolean,
disabled: Boolean,
isInGroup: Boolean,
labelDisabled: Boolean,
type: String
},
data: function data() {
return {
isInGroup: false,
isInCell: false
};
},
methods: {
handleClick: function handleClick() {
if (this.data.disabled) {
return;
}
var checked = !this.data.checked;
this.triggerEvent('change', checked);
this.setData({ checked: checked });
},
updateData: function updateData(data) {
this.setData(data);
}
}
});

6
dist/checkbox/index.json vendored Normal file
View File

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

25
dist/checkbox/index.wxml vendored Normal file
View File

@ -0,0 +1,25 @@
<view
class="checkbox-class zan-checkbox {{ isInGroup ? 'zan-checkbox__item' : ''}} {{ type === 'list' ? 'zan-checkbox__list-item' : ''}}"
bindtap="{{ labelDisabled ? '' : 'handleClick' }}"
data-id="test"
>
<zan-icon
type="{{ checked ? 'checked' : 'check'}}"
class="zan-checkbox__icon {{ 'zan-checkbox--' + shape }} {{ disabled ? 'zan-checkbox--disabled' : '' }} {{ checked ? 'zan-checkbox--checked' : '' }}"
bindtap="{{ labelDisabled ? 'handleClick': '' }}"
></zan-icon>
<text class="zan-checkbox__label">
<slot></slot>
</text>
</view>
<wxs module="parse">
function getColor(color) {
color = color || '#ff4444'
return color;
}
module.exports = {
getColor: getColor
};
</wxs>

1
dist/checkbox/index.wxss vendored Normal file
View File

@ -0,0 +1 @@
.zan-checkbox{display:inline-block;padding:0 10px;font-size:14px}.zan-checkbox__item{display:block;margin-top:10px}.zan-checkbox__list-item{display:block;padding:10px 10px 10px 0;margin-left:10px;border-bottom:1px solid #e5e5e5}.zan-checkbox__list-item .zan-checkbox__icon{float:right}.zan-checkbox__icon{display:-webkit-inline-box;display:inline-flex;-webkit-box-align:center;align-items:center;color:#aaa}.zan-checkbox__icon.zan-checkbox--checked{color:#06bf04}.zan-checkbox__icon.zan-checkbox--disabled{color:#e5e5e5}.zan-checkbox__label{display:inline-block;margin-left:10px}

View File

@ -28,6 +28,7 @@ Component({
if (/^[0-9]+$/.test(value)) {
value = +value;
}
!this._inited && this._init();
this.updateDate(value);
}
},
@ -40,39 +41,43 @@ Component({
transPos: [0, 0, 0, 0, 0, 0]
},
attached: function attached() {
var _this = this;
this.use = {};
['years', 'months', 'days', 'hours', 'minutes', 'seconds'].forEach(function (item) {
if ((_this.data.notUse || []).indexOf(item) === -1) {
_this.use[item] = true;
}
});
this.picker = new DatePicker(this.data.date);
var _picker$getData = this.picker.getData(this.data.date),
dataList = _picker$getData.dataList,
selected = _picker$getData.selected;
// 鬼他么知道为什么 dataList, selected 不能一起 setData
this.setData({
use: this.use,
dataList: dataList
}, function () {
_this.setData({
selected: selected
});
});
this._indexs = selected;
!this._inited && this._init();
},
methods: {
_init: function _init() {
var _this = this;
this._inited = true;
this.use = {};
['years', 'months', 'days', 'hours', 'minutes', 'seconds'].forEach(function (item) {
if ((_this.data.notUse || []).indexOf(item) === -1) {
_this.use[item] = true;
}
});
this.picker = new DatePicker(this.data.date);
var _picker$getData = this.picker.getData(this.data.date),
dataList = _picker$getData.dataList,
selected = _picker$getData.selected;
// 鬼他么知道为什么 dataList, selected 不能一起 setData
this.setData({
use: this.use,
dataList: dataList
}, function () {
_this.setData({
selected: selected
});
});
this._indexs = selected;
},
updatePicker: function updatePicker() {
var updateData = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];

2
dist/index.js vendored
View File

@ -2,4 +2,4 @@
exports.Dialog = require('./dialog/dialog');
exports.Toast = require('./toast/toast');
// exports.TopTips = require('./toptips/index');
exports.TopTips = require('./toptips/toptips');

View File

@ -1,6 +1,8 @@
'use strict';
Component({
externalClasses: ['custom-class', 'theme-class'],
properties: {
checked: {
type: Boolean,

View File

@ -1,5 +1,5 @@
<view
class="zan-switch zan-switch--{{ checked ? 'on' : 'off' }} {{ disabled ? 'zan-swtich--disabled' : '' }}"
class="custom-class theme-class zan-switch zan-switch--{{ checked ? 'on' : 'off' }} {{ disabled ? 'zan-swtich--disabled' : '' }}"
checked="{{ checked }}"
loading="{{ loading }}"
disabled="{{ disabled }}"

21
dist/tab/index.js vendored
View File

@ -26,10 +26,31 @@ Component({
}
},
data: {
scrollLeft: 0
},
methods: {
_handleScroll: function _handleScroll(selectedId) {
var _this = this;
var query = wx.createSelectorQuery().in(this);
query.select('#item-' + selectedId).boundingClientRect();
query.select('#scroll-view').boundingClientRect();
query.select('#scroll-view').scrollOffset();
query.exec(function (res) {
_this.setData({
scrollLeft: res[2].scrollLeft + res[0].left + res[0].width / 2 - res[1].width / 2
});
});
},
_handleZanTabChange: function _handleZanTabChange(e) {
var selectedId = e.currentTarget.dataset.itemId;
if (this.data.scroll) {
this._handleScroll(selectedId);
}
this.setData({
selectedId: selectedId
});

6
dist/tab/index.wxml vendored
View File

@ -4,8 +4,11 @@
>
<block wx:if="{{ scroll }}">
<scroll-view
id="scroll-view"
class="zan-tab__bd zan-tab__bd--scroll {{ fixed ? 'zan-tab__bd--fixed' : '' }}"
scroll-x="true"
scroll-x
scroll-with-animation
scroll-left="{{ scrollLeft }}"
style="height: {{ height ? height + 'px' : 'auto' }}"
>
<template
@ -34,6 +37,7 @@
wx:for="{{ list }}"
wx:key="id"
class="zan-tab__item {{ selectedId == item.id ? 'zan-tab__item--selected' : '' }}"
id="item-{{ item.id }}"
data-item-id="{{ item.id }}"
bindtap="_handleZanTabChange"
>

4
dist/tag/index.js vendored
View File

@ -1,6 +1,8 @@
"use strict";
'use strict';
Component({
externalClasses: ['custom-class', 'theme-class'],
properties: {
type: {
type: String

2
dist/tag/index.wxml vendored
View File

@ -1,6 +1,6 @@
<view
class="zan-tag {{type ? 'zan-tag--'+type : ''}} {{disabled ? 'zan-tag--disabled' : ''}} {{plain ? 'zan-tag--plain' : ''}}"
class="custom-class theme-class zan-tag {{type ? 'zan-tag--'+type : ''}} {{disabled ? 'zan-tag--disabled' : ''}} {{plain ? 'zan-tag--plain' : ''}}"
>
<slot></slot>
</view>