Skip to content

Commit

Permalink
feat:发布版本0.6.1
Browse files Browse the repository at this point in the history
  • Loading branch information
二一 committed Sep 9, 2019
2 parents 9495749 + 23eb5b7 commit 81cae3a
Show file tree
Hide file tree
Showing 240 changed files with 2,720 additions and 2,595 deletions.
1 change: 0 additions & 1 deletion .eslintignore

This file was deleted.

21 changes: 3 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,37 +17,22 @@
<div align="center">

![](https://img.shields.io/badge/build-passing-00d508.svg)
![](https://img.shields.io/badge/version-0.6.0-3963bc.svg)
![](https://img.shields.io/npm/v/lin-ui.svg)
![](https://img.shields.io/npm/dt/lin-ui.svg)
![](https://img.shields.io/badge/license-MIT-3963bc.svg)

</div>

<div align="center">

![](https://img.shields.io/badge/less-^2.7.3-00d508.svg)
![](https://img.shields.io/badge/eslint-^5.0.1-00d508.svg)
![](https://img.shields.io/badge/cli-0.0.1.alpha.1-3963bc.svg)
![](https://img.shields.io/badge/npm-v3.0.0+-00d508.svg)
![](https://img.shields.io/badge/gulp-v3.9.1-00d508.svg)
![](https://img.shields.io/badge/node-v8.11.0+-00d508.svg)
⚡️ 文档网站: http://doc.mini.7yue.pro/

</div>

# 简介

Lin UI 是基于 **微信小程序原生语法** 实现的组件库。遵循简洁,易用的设计规范。

## 最新版本

核心库:0.6.0

示例工程:0.0.1-alpha.2


## 文档地址

http://doc.mini.7yue.pro/

## 讨论交流
QQ群号:699501172 <br/>

Expand Down
14 changes: 0 additions & 14 deletions config/styles/_base.less
Original file line number Diff line number Diff line change
Expand Up @@ -89,17 +89,3 @@
@transition-time : .2s;
@ease-in-out : ease-in-out;

// Z-index
@zindex-spin : 8;
@zindex-affix : 10;
@zindex-back-top : 10;
@zindex-select : 900;
@zindex-modal : 1000;
@zindex-message : 1010;
@zindex-notification : 1010;
@zindex-tooltip : 1060;
@zindex-transfer : 1060;
@zindex-loading-bar : 2000;
@zindex-spin-fullscreen : 2010;


2 changes: 1 addition & 1 deletion dist/action-sheet/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import zIndex from '../behaviors/zIndex';

Component({
behaviors: [zIndex],
externalClasses: ['l-class-title', 'l-class-item', 'l-class-cancel'],
externalClasses: ['l-class-title', 'l-class-item', 'l-class-cancel','l-title-class','l-item-class','l-cancel-class'],
properties: {
locked: Boolean,
showCancel: Boolean,
Expand Down
9 changes: 5 additions & 4 deletions dist/action-sheet/index.wxml
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
<l-popup show="{{show}}" showMask="{{true}}" contentAlign="bottom" locked="{{locked}}" bind:lintap="handleClickPopUp" z-index="{{zIndex}}">
<view class='l-action-sheet'>
<view class="l-item-button l-class-title" wx:if="{{title}}">
<view class="l-item-button l-class-title l-title-class" wx:if="{{title}}">
{{ title }}
</view>
<view class="" wx:for="{{ itemList }}" wx:key="{{ item.name }}">
<l-button bind:lintap="handleClickItem" data-index="{{ index }}" data-item="{{ item }}" open-type="{{ item.openType }}" icon="{{ item.icon }}" type="ghost" size="large" special="{{true}}" long>
<view style="{{ item.color ? 'color: ' + item.color : '' }}" class="l-item-button l-class-item {{item.image || item.icon ? 'l-image-button':''}}">
<view style="{{ item.color ? 'color: ' + item.color : '' }}" class="l-item-button l-class-item l-item-class {{item.image || item.icon ? 'l-image-button':''}}">
<image wx:if="{{item.image}}" class="l-button-image" src="{{item.image}}" style="{{item.imageStyle}}"/>
<l-icon
wx:elif="{{ item.icon }}"
name="{{ item.icon }}"
l-class="l-item-button"
color="{{item.color}}"></l-icon>
size="{{ item.iconSize }}"
color="{{item.iconColor?item.iconColor:item.color}}"></l-icon>
<text class="l-button-text">{{ item.name }}</text>
</view>
</l-button>
</view>
<view class="l-cancel l-class-cancel {{isIphoneX ? 'l-cancel-x':''}}" wx:if="{{ showCancel }}">
<view class="l-cancel l-class-cancel l-cancel-class {{isIphoneX ? 'l-cancel-x':''}}" wx:if="{{ showCancel }}">
<l-button type="ghost" size="large" long="true" bind:lintap="handleClickCancel" special="{{true}}">
<view class="l-item-button l-cancel-button">{{ cancelText }}</view>
</l-button>
Expand Down
36 changes: 13 additions & 23 deletions dist/avatar/index.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
Component({
externalClasses: ['l-class', 'l-class-text'],
externalClasses: [
'l-class',
'l-class-text',
'l-text-class'
],
properties: {
icon: String,
text: String,
iconStyle: {
iconColor: {
type: String,
value: '#3963BC'
},
iconSize: {
type: String,
observer: '_parseCSSText'
value: '28'
},
text: String,
src: String,
openData: {
type: Array,
Expand Down Expand Up @@ -40,25 +48,7 @@ Component({
this._isHaveUserAvatarUrl(openData);
this._isHaveUserNickName(openData);
},
_parseCSSText: function parseCSSText(cssText) {
var cssTxt = cssText.replace('/\/\*(.|\s)*?\*\//g', ' ').replace('/\s+/g', ' ');
var style = {};
var properties = cssTxt.split(';').map(function (o) {
return o.split(':').map(function (x) {
return x && x.trim();
});
});
properties.forEach(function (property) {
var key = property[0];
var value = property[1];
style[key] = value;
});

this.setData({
_iconSize: style.size || this.data.size * 0.6,
_iconColor: style.color || '#ffffff',
});
},

_isHaveUserAvatarUrl: function (openData) {
this.setData({
_isHaveUserAvatarUrl: openData.indexOf('userAvatarUrl') !== -1
Expand Down
4 changes: 2 additions & 2 deletions dist/avatar/index.wxml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
<view class="l-avatar {{text||_isHaveUserNickName?'l-placement-'+placement:''}}" bindtap="tapAvatar">
<view class="l-avatar-image {{shape?'l-'+shape:''}} l-class" wx:if="{{_isHaveUserAvatarUrl||icon||src}}" style="width:{{size}}rpx;height:{{size}}rpx">
<open-data wx:if="{{_isHaveUserAvatarUrl}}" type="userAvatarUrl" />
<l-icon wx:elif="{{icon}}" size="{{_iconSize || size*0.6}}" color="{{_iconColor||'#ffffff'}}" name="{{icon}}" />
<l-icon wx:elif="{{icon}}" size="{{iconSize || size*0.6}}" color="{{iconColor||'#ffffff'}}" name="{{icon}}" />
<image wx:elif="{{src}}" src="{{src}}" mode="{{mode}}" style="width:{{size}}rpx;height:{{size}}rpx" />
</view>
<view class="l-avatar-text l-class-text" wx:if="{{text||_isHaveUserNickName}}">
<view class="l-avatar-text l-class-text l-text-class" wx:if="{{text||_isHaveUserNickName}}">
<open-data wx:if="{{_isHaveUserNickName}}" type="userNickName" />
<text wx:elif="{{text}}">{{text}}</text>
</view>
Expand Down
2 changes: 1 addition & 1 deletion dist/badge/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Component({
externalClasses: ['l-class', 'l-class-self'],
externalClasses: ['l-class', 'l-class-self','l-self-class'],
properties: {
// 红点模式
dot: {
Expand Down
6 changes: 3 additions & 3 deletions dist/badge/index.wxml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<view class="l-badge" bindtap="handleTap">
<slot/>
<block wx:if="{{show}}">
<view class="l-badge-content l-class l-class-self" wx:if="{{finalCount}}">{{finalCount}}</view>
<view wx:if="{{content}}" class="l-badge-content l-class l-class-self">{{content}}</view>
<view wx:if="{{dot}}" class="l-badge-dot l-class l-class-self"></view>
<view class="l-badge-content l-class l-class-self l-self-class" wx:if="{{finalCount}}">{{finalCount}}</view>
<view wx:if="{{content}}" class="l-badge-content l-class l-class-self l-self-class">{{content}}</view>
<view wx:if="{{dot}}" class="l-badge-dot l-class l-class-self l-self-class"></view>
</block>
</view>
3 changes: 2 additions & 1 deletion dist/behaviors/computeOffset.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
module.exports = Behavior({
// eslint-disable-next-line no-undef
export default Behavior({
behaviors: [],
properties: {},
data: {
Expand Down
5 changes: 3 additions & 2 deletions dist/behaviors/countdown.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
module.exports = Behavior({
// eslint-disable-next-line no-undef
export default Behavior({
behaviors: [],
properties: {
time: {
Expand All @@ -13,7 +14,7 @@ module.exports = Behavior({
status: {
type: Boolean,
value: true,
observer: function (newVal, oldVal, changedPath) {
observer: function (newVal) {
if (newVal) {
this.init();
} else if (!newVal) {
Expand Down
9 changes: 5 additions & 4 deletions dist/behaviors/rules.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import Schema from '../common/async-validator/index';
/**
* @param tipType String [toast , message , text]
*/
module.exports = Behavior({
// eslint-disable-next-line no-undef
export default Behavior({
behaviors: [],
properties: {
// 校验
Expand Down Expand Up @@ -55,7 +56,7 @@ module.exports = Behavior({
const validateValue = {
[this.data.name]: value
};
this.data.schema.validate(validateValue, (errors, fields) => {
this.data.schema.validate(validateValue, (errors) => {

this.triggerEvent('linvalidate', {
errors,
Expand All @@ -76,7 +77,7 @@ module.exports = Behavior({
wx.showToast({
icon: 'none',
title: `请在页面内引入${tipType}组件`
})
});
return;
}

Expand All @@ -95,4 +96,4 @@ module.exports = Behavior({

}
}
})
});
54 changes: 54 additions & 0 deletions dist/behaviors/scrollCenter.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
// eslint-disable-next-line no-undef
export default Behavior({
methods: {
getRect(selector, all = false) {
return new Promise((resolve, reject) => {
const query = wx.createSelectorQuery().in(this);
const type = all ? query.selectAll(selector) : query.select(selector);
type.boundingClientRect((res) => {
if (!res) return reject('找不到元素');
resolve(res);
}).exec();
});
},
queryScrollNode(res, currentIndex, type = 'width') {
const currentRect = res[currentIndex];

this.getRect('.l-tabsscroll').then(_ => {
const scrollWidth = _[type];

let transformDistance = res
.slice(0, currentIndex)
.reduce((prev, curr) => prev + curr[type], 0);

transformDistance += (currentRect[type] - scrollWidth) / 2;

if (type === 'width') {
this.setData({
transformX: transformDistance,
transformY: 0
});
} else {
this.setData({
transformX: 0,
transformY: transformDistance
});
}
});
},
queryMultipleNodes() {
const {
placement,
currentIndex
} = this.data;
this.getRect('.l-tabs-item', true)
.then((res) => {
if (['top', 'bottom'].indexOf(placement) !== -1) {
this.queryScrollNode(res, currentIndex);
} else {
this.queryScrollNode(res, currentIndex, 'height');
}
});
}
}
});
26 changes: 26 additions & 0 deletions dist/behaviors/wacthShow.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// eslint-disable-next-line no-undef
export default Behavior({
observers: {
'show': function (show) {
show && this.changeStatus();
if (!show) this.setData({
status: show
});
}
},
methods: {
changeStatus() {
this.setData({
status: true
});
if (this.data.timer) clearTimeout(this.data.timer);
this.data.timer = setTimeout(() => {
this.setData({
status: false
});
if (this.data.success) this.data.success();
this.data.timer = null;
}, this.properties.duration);
}
}
});
3 changes: 2 additions & 1 deletion dist/behaviors/zIndex.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
module.exports = Behavior({
// eslint-disable-next-line no-undef
export default Behavior({
behaviors: [],
properties: {
zIndex:{
Expand Down
4 changes: 0 additions & 4 deletions dist/button/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,6 @@ Component({
icon: String,
image: String,
bgColor: String,
iconStyle: {
type: String,
value: 'size:20;color:#3683D6'
},
iconColor: String,
iconSize: String,
openType: String,
Expand Down
Loading

0 comments on commit 81cae3a

Please sign in to comment.