Skip to content

Commit

Permalink
release 1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
icarusion committed Jun 1, 2018
1 parent 63019de commit 7e18b29
Show file tree
Hide file tree
Showing 158 changed files with 2,352 additions and 3 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ npm-debug.log
*.swo
*.log
examples/dist/
dist/
yarn-error.log
test/unit/coverage
examples/project.config.json
Expand Down
47 changes: 47 additions & 0 deletions dist/action-sheet/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
Component({
externalClasses: ['i-class', 'i-class-mask', 'i-class-header'],

options: {
multipleSlots: true
},

properties: {
visible: {
type: Boolean,
value: false
},
maskClosable: {
type: Boolean,
value: true
},
showCancel: {
type: Boolean,
value: false
},
cancelText: {
type: String,
value: '取消'
},
actions: {
type: Array,
value: []
}
},

methods: {
handleClickMask () {
if (!this.data.maskClosable) return;
this.handleClickCancel();
},

handleClickItem ({ currentTarget = {} }) {
const dataset = currentTarget.dataset || {};
const { index } = dataset;
this.triggerEvent('click', { index });
},

handleClickCancel () {
this.triggerEvent('cancel');
}
}
});
8 changes: 8 additions & 0 deletions dist/action-sheet/index.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"component": true,
"usingComponents":
{
"i-button": "../button/index",
"i-icon": "../icon/index"
}
}
23 changes: 23 additions & 0 deletions dist/action-sheet/index.wxml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<view class="i-as-mask i-class-mask {{ visible ? 'i-as-mask-show' : '' }}" bindtap="handleClickMask"></view>
<view class="i-class i-as {{ visible ? 'i-as-show' : '' }}">
<view class="i-as-header i-class-header"><slot name="header"></slot></view>
<view class="i-as-actions">
<view class="i-as-action-item" wx:for="{{ actions }}" wx:key="{{ item.name }}">
<i-button
bind:click="handleClickItem"
data-index="{{ index }}"
open-type="{{ item.openType }}"
type="ghost"
size="large"
long
>
<view class="i-as-btn-loading" wx:if="{{ item.loading }}"></view>
<i-icon wx:if="{{ item.icon }}" type="{{ item.icon }}" i-class="i-as-btn-icon"></i-icon>
<view class="i-as-btn-text" style="{{ item.color ? 'color: ' + item.color : '' }}">{{ item.name }}</view>
</i-button>
</view>
</view>
<view class="i-as-cancel" wx:if="{{ showCancel }}">
<i-button i-class="i-as-cancel-btn" type="ghost" size="large" long="true" bind:click="handleClickCancel">{{ cancelText }}</i-button>
</view>
</view>
1 change: 1 addition & 0 deletions dist/action-sheet/index.wxss
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.i-as{position:fixed;width:100%;box-sizing:border-box;left:0;right:0;bottom:0;background:#f7f7f7;transform:translate3d(0,100%,0);transform-origin:center;transition:all .2s ease-in-out;z-index:900;visibility:hidden}.i-as-show{transform:translate3d(0,0,0);visibility:visible}.i-as-mask{position:fixed;top:0;left:0;right:0;bottom:0;background:rgba(0,0,0,.7);z-index:900;transition:all .2s ease-in-out;opacity:0;visibility:hidden}.i-as-mask-show{opacity:1;visibility:visible}.i-as-action-item{position:relative}.i-as-action-item::after{content:'';position:absolute;top:0;left:0;width:200%;height:200%;transform:scale(.5);transform-origin:0 0;pointer-events:none;box-sizing:border-box;border:0 solid #e9eaec;border-bottom-width:1px}.i-as-header{background:#fff;text-align:center;position:relative;font-size:12px;color:#80848f}.i-as-header::after{content:'';position:absolute;top:0;left:0;width:200%;height:200%;transform:scale(.5);transform-origin:0 0;pointer-events:none;box-sizing:border-box;border:0 solid #e9eaec;border-bottom-width:1px}.i-as-cancel{margin-top:6px}.i-as-btn-loading{display:inline-block;vertical-align:middle;margin-right:10px;width:12px;height:12px;background:0 0;border-radius:50%;border:2px solid #e5e5e5;border-color:#666 #e5e5e5 #e5e5e5 #e5e5e5;animation:btn-spin .6s linear;animation-iteration-count:infinite}.i-as-btn-text{display:inline-block;vertical-align:middle}.i-as-btn-icon{font-size:14px!important;margin-right:4px}@keyframes btn-spin{0%{transform:rotate(0)}100%{transform:rotate(360deg)}}
60 changes: 60 additions & 0 deletions dist/alert/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
Component({
externalClasses: ['i-class'],
options: {
multipleSlots: true
},
properties: {
//info, success, warning, error
type: {
type: String,
value: 'info',
observer: 'setIconType'
},
closable: {
type: Boolean,
value: false
},
showIcon: {
type: Boolean,
default: false
},
desc: {
type: Boolean,
default: false
},
},
data: {
closed: false,
iconType: '',
},
methods: {
setIconType() {
let type = '';

switch (this.data.type) {
case 'success':
type = 'success';
break;
case 'info':
type = 'prompt';
break;
case 'warning':
type = 'warning';
break;
case 'error':
type = 'delete';
break;
}
this.setData({
iconType: type
});
},
handleTap() {
this.setData({
closed: !this.data.closed,
});
this.triggerEvent('click');
},

}
});
7 changes: 7 additions & 0 deletions dist/alert/index.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"component": true,
"usingComponents":
{
"i-icon": "../icon/index"
}
}
12 changes: 12 additions & 0 deletions dist/alert/index.wxml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<view class="i-class i-alert {{'i-alert-'+type}} {{showIcon?'i-alert-with-icon':''}} {{desc?'i-alert-with-desc':''}}" wx:if="{{!closed}}">
<view wx:if="{{showIcon}}" class="i-alert-icon">
<i-icon type="{{iconType}}" size="{{desc?24:16}}"></i-icon>
</view>
<slot></slot>
<view class="i-alert-desc">
<slot name="desc"></slot>
</view>
<view class="i-alert-close" wx:if="{{ closable }}" bindtap="handleTap">
<i-icon type="close"></i-icon>
</view>
</view>
1 change: 1 addition & 0 deletions dist/alert/index.wxss
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.i-alert{position:relative;margin:10px;padding:8px 48px 8px 16px;font-size:14px;border-radius:2px;color:#fff;background:#f7f7f7;color:#495060}.i-alert.i-alert-with-icon{padding:8px 48px 8px 38px}.i-alert-info{color:#fff;background:#2db7f5}.i-alert-success{color:#fff;background:#19be6b}.i-alert-warning{color:#fff;background:#f90}.i-alert-error{color:#fff;background:#ed3f14}.i-alert-icon{position:absolute;top:9px;left:16px;font-size:14px}.i-alert-desc{font-size:12px}.i-alert-with-desc{padding:16px;position:relative}.i-alert-with-desc.i-alert-with-icon{padding:16px 16px 16px 69px}.i-alert-with-desc .i-alert-icon{top:50%;left:24px;margin-top:-21px;font-size:28px}.i-alert-close{font-size:12px;position:absolute;right:16px;top:8px;overflow:hidden;cursor:pointer}
20 changes: 20 additions & 0 deletions dist/avatar/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
Component({
externalClasses: ['i-class'],

properties: {
// circle || square
shape: {
type: String,
value: 'circle'
},
// small || large || default
size: {
type: String,
value: 'default'
},
src: {
type: String,
value: ''
}
}
});
3 changes: 3 additions & 0 deletions dist/avatar/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/avatar/index.wxml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<view class="i-class i-avatar i-avatar-{{ shape }} i-avatar-{{ size }} {{ src ? 'i-avatar-image' : '' }}">
<image src="{{ src }}" wx:if="{{ src !== '' }}"></image>
<view class="i-avatar-string" wx:else><slot></slot></view>
</view>
1 change: 1 addition & 0 deletions dist/avatar/index.wxss
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.i-avatar{display:inline-block;text-align:center;background:#ccc;color:#fff;white-space:nowrap;position:relative;overflow:hidden;vertical-align:middle;width:32px;height:32px;line-height:32px;border-radius:16px;font-size:18px}.i-avatar .ivu-avatar-string{line-height:32px}.i-avatar-large{width:40px;height:40px;line-height:40px;border-radius:20px;font-size:24px}.i-avatar-large .ivu-avatar-string{line-height:40px}.i-avatar-small{width:24px;height:24px;line-height:24px;border-radius:12px;font-size:14px}.i-avatar-small .ivu-avatar-string{line-height:24px}.i-avatar-image{background:0 0}.i-avatar-square{border-radius:4px}.i-avatar>image{width:100%;height:100%}
29 changes: 29 additions & 0 deletions dist/badge/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
Component({
externalClasses: ['i-class', 'i-class-alone'],

properties: {
count: {
type: Number,
value: 0,
observer: 'finalCount'
},
overflowCount: {
type: Number,
value: 99
},
dot: {
type: Boolean,
value: false
},
},
data: {
finalCount: 0
},
methods: {
finalCount() {
this.setData({
finalCount: parseInt(this.data.count) >= parseInt(this.data.overflowCount) ? `${this.data.overflowCount}+` : this.data.count
});
},
}
});
3 changes: 3 additions & 0 deletions dist/badge/index.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"component": true
}
5 changes: 5 additions & 0 deletions dist/badge/index.wxml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<view class="i-class i-badge">
<slot></slot>
<view class="i-badge-dot" wx:if="{{ dot }}"></view>
<view class="i-badge-count i-class-alone" wx:elif="{{ count !== 0 }}">{{ finalCount }}</view>
</view>
1 change: 1 addition & 0 deletions dist/badge/index.wxss
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.i-badge{position:relative;display:inline-block;line-height:1;vertical-align:middle}.i-badge-count{position:absolute;transform:translateX(50%);top:-6px;right:0;height:18px;border-radius:9px;min-width:18px;background:#ed3f14;border:1px solid transparent;color:#fff;line-height:18px;text-align:center;padding:0 5px;font-size:12px;white-space:nowrap;transform-origin:-10% center;z-index:10;box-shadow:0 0 0 1px #fff;box-sizing:border-box;text-rendering:optimizeLegibility}.i-badge-count-alone{top:auto;display:block;position:relative;transform:translateX(0)}.i-badge-dot{position:absolute;transform:translateX(-50%);transform-origin:0 center;top:-4px;right:-8px;height:8px;width:8px;border-radius:100%;background:#ed3f14;z-index:10;box-shadow:0 0 0 1px #fff}
37 changes: 37 additions & 0 deletions dist/base/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
function getCtx (selector) {
const pages = getCurrentPages();
const ctx = pages[pages.length - 1];

const componentCtx = ctx.selectComponent(selector);

if (!componentCtx) {
console.error('无法找到对应的组件,请按文档说明使用组件');
return null;
}
return componentCtx;
}

function Toast(options) {
const { selector = '#toast' } = options;
const ctx = getCtx(selector);

ctx.handleShow(options);
}

Toast.hide = function (selector = '#toast') {
const ctx = getCtx(selector);

ctx.handleHide();
};

function Message(options) {
const { selector = '#message' } = options;
const ctx = getCtx(selector);

ctx.handleShow(options);
}

module.exports = {
$Toast: Toast,
$Message: Message
};
64 changes: 64 additions & 0 deletions dist/button/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
Component({
externalClasses: ['i-class'],

properties: {
// default, primary, ghost, info, success, warning, error
type: {
type: String,
value: '',
},
// default, large, small
size: {
type: String,
value: '',
},
// circle, square
shape: {
type: String,
value: 'square'
},
disabled: {
type: Boolean,
value: false,
},
loading: {
type: Boolean,
value: false,
},
long: {
type: Boolean,
value: false
},
openType: String,
appParameter: String,
hoverStopPropagation: Boolean,
hoverStartTime: {
type: Number,
value: 20
},
hoverStayTime: {
type: Number,
value: 70
},
lang: {
type: String,
value: 'en'
},
sessionFrom: {
type: String,
value: ''
},
sendMessageTitle: String,
sendMessagePath: String,
sendMessageImg: String,
showMessageCard: String
},

methods: {
handleTap () {
if (this.data.disabled) return false;

this.triggerEvent('click');
}
}
});
3 changes: 3 additions & 0 deletions dist/button/index.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"component": true
}
15 changes: 15 additions & 0 deletions dist/button/index.wxml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<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' : ''}}"
bindtap="handleTap"
open-type="{{ openType }}"
app-parameter="{{ appParameter }}"
hover-stop-propagation="{{ hoverStopPropagation }}"
hover-start-time="{{ hoverStartTime }}"
hover-stay-time="{{ hoverStayTime }}"
session-from="{{ sessionFrom }}"
send-message-title="{{ sendMessageTitle }}"
send-message-path="{{ sendMessagePath }}"
send-message-img="{{ sendMessageImg }}"
show-message-card="{{ showMessageCard }}"
plain="true"
><view class="i-btn-loading-inner" wx:if="{{loading}}"></view><slot></slot></button>
1 change: 1 addition & 0 deletions dist/button/index.wxss
Original file line number Diff line number Diff line change
@@ -0,0 +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)}}
Loading

0 comments on commit 7e18b29

Please sign in to comment.