Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
icarusion committed Jul 30, 2018
1 parent 1ea450a commit 8b5218e
Show file tree
Hide file tree
Showing 56 changed files with 938 additions and 15 deletions.
16 changes: 16 additions & 0 deletions dist/button/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ Component({
type: String,
value: '',
},
inline: {
type: Boolean,
value: false
},
// default, large, small
size: {
type: String,
Expand Down Expand Up @@ -59,6 +63,18 @@ Component({
if (this.data.disabled) return false;

this.triggerEvent('click');
},
bindgetuserinfo({ detail = {} } = {}) {
this.triggerEvent('getuserinfo', detail);
},
bindcontact({ detail = {} } = {}) {
this.triggerEvent('contact', detail);
},
bindgetphonenumber({ detail = {} } = {}) {
this.triggerEvent('getphonenumber', detail);
},
binderror({ detail = {} } = {}) {
this.triggerEvent('error', detail);
}
}
});
7 changes: 6 additions & 1 deletion dist/button/index.wxml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<button
class="i-class i-btn {{ long ? 'i-btn-long' : '' }} {{ 'i-btn-' + size }} {{ 'i-btn-' + type }} {{ 'i-btn-' + shape }} {{ loading ? 'i-btn-loading' : '' }} {{ disabled ? 'i-btn-disabled' : ''}}"
class="i-class i-btn {{ long ? 'i-btn-long' : '' }} {{ 'i-btn-' + size }} {{ 'i-btn-' + type }} {{ 'i-btn-' + shape }} {{ loading ? 'i-btn-loading' : '' }} {{ disabled ? 'i-btn-disabled' : ''}} {{ inline ? 'i-btn-inline' : '' }}"
hover-class="i-btn-hover"
bindtap="handleTap"
open-type="{{ openType }}"
app-parameter="{{ appParameter }}"
Expand All @@ -11,5 +12,9 @@
send-message-path="{{ sendMessagePath }}"
send-message-img="{{ sendMessageImg }}"
show-message-card="{{ showMessageCard }}"
bindcontact="bindcontact"
bindgetuserinfo="bindgetuserinfo"
bindgetphonenumber="bindgetphonenumber"
binderror="binderror"
plain="true"
><view class="i-btn-loading-inner" wx:if="{{loading}}"></view><slot></slot></button>
2 changes: 1 addition & 1 deletion dist/button/index.wxss
Original file line number Diff line number Diff line change
@@ -1 +1 @@
.i-btn{text-align:center;vertical-align:middle;touch-action:manipulation;cursor:pointer;background-image:none;white-space:nowrap;user-select:none;font-size:14px;border-radius:2px;border:0!important;position:relative;text-decoration:none;height:44px;line-height:44px;box-shadow:inset 0 0 0 1px rgba(0,0,0,.1);color:#fff!important;background:#f7f7f7!important;color:#495060!important;margin:10px}.i-btn-long{border-radius:0;margin:0;box-shadow:none}.i-btn-large{height:48px;line-height:48px}.i-btn-small{height:40px;line-height:40px}.i-btn-primary{color:#fff!important;background:#2d8cf0!important}.i-btn-ghost{color:#fff!important;background:#fff!important;color:#495060!important}.i-btn-success{color:#fff!important;background:#19be6b!important}.i-btn-warning{color:#fff!important;background:#f90!important}.i-btn-error{color:#fff!important;background:#ed3f14!important}.i-btn-info{color:#fff!important;background:#2db7f5!important}.i-btn-circle{border-radius:44px}.i-btn-large.i-btn-circle{border-radius:48px}.i-btn-small.i-btn-circle{border-radius:40px}.i-btn-loading{opacity:.6}.i-btn-loading-inner{display:inline-block;margin-right:12px;vertical-align:middle;width:14px;height:14px;background:0 0;border-radius:50%;border:2px solid #fff;border-color:#fff #fff #fff transparent;animation:btn-spin .6s linear;animation-iteration-count:infinite}.i-btn-disabled{color:#bbbec4!important;background:#f7f7f7!important}@keyframes btn-spin{0%{transform:rotate(0)}100%{transform:rotate(360deg)}}
.i-btn{text-align:center;vertical-align:middle;touch-action:manipulation;cursor:pointer;background-image:none;white-space:nowrap;user-select:none;font-size:14px;border-radius:2px;border:0!important;position:relative;text-decoration:none;height:44px;line-height:44px;box-shadow:inset 0 0 0 1px rgba(0,0,0,.1);color:#fff!important;background:#f7f7f7!important;color:#495060!important;margin:10px}.i-btn-hover{opacity:.9}.i-btn-long{border-radius:0;margin:0;box-shadow:none}.i-btn-large{height:48px;line-height:48px}.i-btn-small{height:40px;line-height:40px}.i-btn-primary{color:#fff!important;background:#2d8cf0!important}.i-btn-ghost{color:#fff!important;background:#fff!important;color:#495060!important}.i-btn-success{color:#fff!important;background:#19be6b!important}.i-btn-warning{color:#fff!important;background:#f90!important}.i-btn-error{color:#fff!important;background:#ed3f14!important}.i-btn-info{color:#fff!important;background:#2db7f5!important}.i-btn-circle{border-radius:44px}.i-btn-large.i-btn-circle{border-radius:48px}.i-btn-small.i-btn-circle{border-radius:40px}.i-btn-loading{opacity:.6}.i-btn-loading-inner{display:inline-block;margin-right:12px;vertical-align:middle;width:14px;height:14px;background:0 0;border-radius:50%;border:2px solid #fff;border-color:#fff #fff #fff transparent;animation:btn-spin .6s linear;animation-iteration-count:infinite}.i-btn-disabled{color:#bbbec4!important;background:#f7f7f7!important}.i-btn-inline{display:inline-block}@keyframes btn-spin{0%{transform:rotate(0)}100%{transform:rotate(360deg)}}
46 changes: 46 additions & 0 deletions dist/collapse-item/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
Component({
externalClasses: ['i-class-content', 'i-class-title', 'i-class'],

relations: {
'../collapse/index': {
type: 'parent',
linked: function (target) {
const options = {
accordion: target.data.accordion
}
if (target.data.name === this.data.name) {
options.showContent = 'i-collapse-item-show-content';
}
this.setData(options);
}
}
},

properties: {
title: String,
name: String
},

data: {
showContent: '',
accordion: false
},

options: {
multipleSlots: true
},

methods: {
trigger(e) {
const data = this.data;
if (data.accordion) {
this.triggerEvent('collapse', {name: data.name}, {composed: true, bubbles: true});
} else {
this.setData({
showContent: data.showContent ? '' : 'i-collapse-item-show-content'
});
}
},
}
});

7 changes: 7 additions & 0 deletions dist/collapse-item/index.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@

{
"component": true,
"usingComponents": {
"i-icon": "../icon/index"
}
}
9 changes: 9 additions & 0 deletions dist/collapse-item/index.wxml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<view id="{{name}}" class="i-class i-collapse-item ">
<view class="i-collapse-item-title-wrap" bindtap="trigger">
<i-icon size="16" type="enter" i-class="{{ showContent ? 'i-collapse-item-arrow-show' : 'i-collapse-item-arrow' }}"/>
<text class="i-collapse-item-title i-class-title">{{title}}</text>
</view>
<view class="i-collapse-item-content {{showContent}} i-class-content">
<slot name="content"></slot>
</view>
</view>
1 change: 1 addition & 0 deletions dist/collapse-item/index.wxss
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.i-collapse-item{padding:2px 8px;border-top:1px solid #dddee1}.i-collapse-item-title{vertical-align:middle}.i-collapse-item-title-wrap{padding:2px 0 0}.i-collapse-item-content{padding:6px;display:none}.i-collapse-item-show-content{display:block}.i-collapse-item-arrow{transition:transform .2s ease-in-out}.i-collapse-item-arrow-show{transition:transform .2s ease-in-out;transform:rotate(90deg)}
31 changes: 31 additions & 0 deletions dist/collapse/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
Component({
externalClasses: ['i-class'],

relations: {
'../collapse-item/index': {
type: 'child'
}
},
properties: {
name: String,
accordion: Boolean
},
methods: {
clickfn(e) {
const params = e.detail;
const allList = this.getRelationNodes('../collapse-item/index');
allList.forEach((item) => {
if (params.name === item.data.name) {
item.setData({
showContent: 'i-collapse-item-show-content'
});
} else {
item.setData({
showContent: ''
});
}
});
},
}
});

3 changes: 3 additions & 0 deletions dist/collapse/index.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"component": true
}
4 changes: 4 additions & 0 deletions dist/collapse/index.wxml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<view class="i-class i-collapse" bindcollapse="clickfn">
<slot></slot>
</view>

Empty file added dist/collapse/index.wxss
Empty file.
90 changes: 90 additions & 0 deletions dist/count-down/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
Component({
properties: {
target: Number,
showDay: Boolean,
callback: String,
format: Array,
clearTimer: Boolean
},
externalClasses: ['countdown-class'],
data: {
time: '',
resultFormat: [],
changeFormat: false
},
ready() {
this.getFormat();

},
methods: {
getFormat() {
const data = this.data;
const len = data.format.length;

if (!data.showDay) data.resultFormat.push('');

if (len >= 3) {
for (let i = 0; i < len; i++) {
if (data.resultFormat.length >= 4) break;
if (data.format[i]) {
data.resultFormat.push(data.format[i].toString());
}
}

if (data.resultFormat.length >= 4) data.changeFormat = true;
}

this.getLastTime();
},
init() {
const self = this;
setTimeout(function () {
self.getLastTime.call(self);
}, 1000);
},
getLastTime() {
const data = this.data;
const gapTime = Math.ceil((data.target - new Date().getTime()) / 1000);
let result = '';
let time = '00:00:00';
let day = '00';
const format = data.resultFormat;

if (gapTime > 0) {
day = this.formatNum(parseInt(gapTime / 86400));
let lastTime = gapTime % 86400;
const hour = this.formatNum(parseInt(lastTime / 3600));
lastTime = lastTime % 3600;
const minute = this.formatNum(parseInt(lastTime / 60));
const second = this.formatNum(lastTime % 60);

if (data.changeFormat) time = `${hour}${format[1]}${minute}${format[2]}${second}${format[3]}`;
else time = `${hour}:${minute}:${second}`;

if (!data.clearTimer) this.init.call(this);
} else {
this.endfn();
}

if (data.showDay) {
if (data.changeFormat) {
result = `${day}${format[0]} ${time}`;
} else {
result = `${day}d ${time}`;
}
} else {
result = time;
}
this.setData({
time: result
});

},
formatNum(num) {
return num > 9 ? num : `0${num}`;
},
endfn() {
this.triggerEvent('callback', {});
}
}
});
4 changes: 4 additions & 0 deletions dist/count-down/index.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

{
"component": true
}
4 changes: 4 additions & 0 deletions dist/count-down/index.wxml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<text class="countdown-class">
{{time}}
</text>

Empty file added dist/count-down/index.wxss
Empty file.
25 changes: 25 additions & 0 deletions dist/divider/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
Component({
externalClasses: ['i-class'],
properties: {
content: {
type: String,
value: ''
},
height : {
type: Number,
value: 48
},
color : {
type : String,
value : '#80848f'
},
lineColor : {
type : String,
value : '#e9eaec'
},
size : {
type: String,
value: 12
}
}
});
3 changes: 3 additions & 0 deletions dist/divider/index.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"component": true
}
19 changes: 19 additions & 0 deletions dist/divider/index.wxml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<view class="i-divider i-class" style="{{parse.getStyle(color,size,height)}}">
<view class="i-divider-content" wx:if="{{content !== ''}}">
{{content}}
</view>
<view class="i-divider-content" wx:else>
<slot></slot>
</view>
<view class="i-divider-line" style="background:{{lineColor}}"></view>
</view>
<wxs module="parse">
module.exports = {
getStyle : function(color,size,height){
var color = 'color:' + color +';';
var size = 'font-size:' + size + 'px;';
var height = 'height:' + height+'px;'
return color + size + height;
}
}
</wxs>
1 change: 1 addition & 0 deletions dist/divider/index.wxss
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.i-divider{width:100%;text-align:center;font-size:12px;position:relative;display:flex;align-items:center;justify-content:center}.i-divider-line{position:absolute;left:0;width:100%;height:1rpx;background-color:#f7f7f7;top:50%}.i-divider-content{background:#fff;position:relative;z-index:1;display:inline-block;padding:0 10px}
2 changes: 1 addition & 1 deletion dist/drawer/index.wxss
Original file line number Diff line number Diff line change
@@ -1 +1 @@
.i-drawer{visibility:hidden}.i-drawer-show{visibility:visible}.i-drawer-show .i-drawer-mask{display:block}.i-drawer-show .i-drawer-container{opacity:1}.i-drawer-show.i-drawer-left .i-drawer-container,.i-drawer-show.i-drawer-right .i-drawer-container{transform:translate3d(0,-50%,0)}.i-drawer-mask{display:none;position:fixed;top:0;left:0;right:0;bottom:0;z-index:6;background:rgba(0,0,0,.6)}.i-drawer-container{position:fixed;left:50%;top:50%;transform:translate3d(-50%,-50%,0);transform-origin:center;transition:all .4s ease;z-index:7;opacity:0}.i-drawer-left .i-drawer-container{left:0;top:50%;transform:translate3d(-100%,-50%,0)}.i-drawer-right .i-drawer-container{right:0;top:50%;left:auto;transform:translate3d(100%,-50%,0)}
.i-drawer{visibility:hidden}.i-drawer-show{visibility:visible}.i-drawer-show .i-drawer-mask{display:block;opacity:1}.i-drawer-show .i-drawer-container{opacity:1}.i-drawer-show.i-drawer-left .i-drawer-container,.i-drawer-show.i-drawer-right .i-drawer-container{transform:translate3d(0,-50%,0)}.i-drawer-mask{opacity:0;position:fixed;top:0;left:0;right:0;bottom:0;z-index:6;background:rgba(0,0,0,.6);transition:all .3s ease-in-out}.i-drawer-container{position:fixed;left:50%;top:50%;transform:translate3d(-50%,-50%,0);transform-origin:center;transition:all .3s ease-in-out;z-index:7;opacity:0}.i-drawer-left .i-drawer-container{left:0;top:50%;transform:translate3d(-100%,-50%,0)}.i-drawer-right .i-drawer-container{right:0;top:50%;left:auto;transform:translate3d(100%,-50%,0)}
2 changes: 1 addition & 1 deletion dist/grid-label/index.wxml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<view class="i-class i-grid-label"><slot></slot></view>
<view class="i-class i-grid-label"><slot></slot></view>
4 changes: 4 additions & 0 deletions dist/icon/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ Component({
type: String,
value: ''
},
custom: {
type: String,
value: ''
},
size: {
type: Number,
value: 14
Expand Down
2 changes: 1 addition & 1 deletion dist/icon/index.wxml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<view class="i-class i-icon i-icon-{{ type }}" style="font-size: {{ size }}px; {{ color ? 'color:' + color : '' }}"></view>
<view class="i-class i-icon {{ type === '' ? '' : 'i-icon-' + type }} {{ custom }}" style="font-size: {{ size }}px; {{ color ? 'color:' + color : '' }}"></view>
32 changes: 32 additions & 0 deletions dist/index-item/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
Component({
externalClasses: ['i-class'],
properties : {
name : {
type : String,
value : ''
}
},
relations : {
'../index/index' : {
type : 'parent'
}
},
data : {
top : 0,
height : 0,
currentName : ''
},
methods: {
updateDataChange() {
const className = '.i-index-item';
const query = wx.createSelectorQuery().in(this);
query.select( className ).boundingClientRect((res)=>{
this.setData({
top : res.top,
height : res.height,
currentName : this.data.name
})
}).exec()
}
}
})
3 changes: 3 additions & 0 deletions dist/index-item/index.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"component": true
}
11 changes: 11 additions & 0 deletions dist/index-item/index.wxml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<view class="i-index-item i-class">
<view class="i-index-item-header">{{name}}</view>
<view class="i-index-item-content">
<slot></slot>
</view>
</view>
<wxs module="parse">
module.exports = {

}
</wxs>
1 change: 1 addition & 0 deletions dist/index-item/index.wxss
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.i-index-item-header{height:30px;line-height:30px;background:#eee;font-size:14px;padding-left:10px;width:100%;box-sizing:border-box}.i-index-item-content{font-size:14px}
Loading

0 comments on commit 8b5218e

Please sign in to comment.