Skip to content

Commit

Permalink
feat: release v3.0.15
Browse files Browse the repository at this point in the history
  • Loading branch information
xupaopaopaopao committed Dec 18, 2017
1 parent 9e9d26a commit 505ed24
Show file tree
Hide file tree
Showing 51 changed files with 962 additions and 811 deletions.
31 changes: 16 additions & 15 deletions builder/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,22 +124,23 @@ function tryUpdateUsageFolder(styleFolderPath) {
});
}

function rewriteUsageRefs(styleFolderPath) {
var usageChildren = fs.readdirSync(styleFolderPath);
function rewriteUsageRefs(searchPath) {
var packageName = require('../package.json').name;
usageChildren.forEach(function (usageChild) {
if(usageChild && usageChild.charAt(0) === '.') {
return;
}
fs.readdirSync(Path.resolve(styleFolderPath, usageChild)).forEach(function (scssFile) {
var libImport = /@import\s+(['"])\.\.\/\.\.\/lib/g;
var scssPath = Path.resolve(styleFolderPath, usageChild, scssFile);
var scssCode = fs.readFileSync(scssPath, 'utf8');
scssCode = scssCode.replace(libImport, '@import $1~' + packageName + '/style/lib');
fs.writeFileSync(scssPath, scssCode);
var libImport = /@import\s+(['"])\.\.\/\.\.\/lib/g;
if (fs.existsSync(searchPath)) {
fs.readdirSync(searchPath).forEach(function(item) {
const currentPath = Path.join(searchPath, item);
if (fs.lstatSync(currentPath).isDirectory()) { // recurse
rewriteUsageRefs(currentPath);
} else { // delete item
var scssCode = fs.readFileSync(currentPath, 'utf8');
scssCode = scssCode.replace(libImport, '@import $1~' + packageName + '/style/lib');
fs.writeFileSync(currentPath, scssCode);
console.log('write', currentPath);
}
});
});
}
}
};

function rewriteLibRefs(styleFolderPath) {
var libFolderPath = Path.resolve(CWD, 'style', 'lib');
Expand All @@ -161,4 +162,4 @@ module.exports = {
writeTransformedFileToDestFolder: writeTransformedFileToDestFolder,
relocateStyleRef: relocateStyleRef,
copyStyleToDestFolder: copyStyleToDestFolder
};
};
8 changes: 8 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
## v3.0.15 (2017-12-15)

### Bug Fixes
* 修复自定义样式目录中有多层目录时 `post install` 脚本报错的问题。

### New Features
* `Alert``Confirm` 组件增加 `extraClass` 属性,`content` 属性支持传入 jsx。

## v3.0.14 (2017-11-17)

### Bug Fixes
Expand Down
5 changes: 5 additions & 0 deletions component_dev/alert/demo/demo.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,20 @@
<meta charset="UTF-8">
<title>alert demo</title>
<meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no"/>
<link rel="stylesheet" href="../../../prd/component_dev/alert/demo/demo.css" />
<style>
.demo {
margin: .1rem 0;
}
.extra {
color: red;
}
</style>
</head>
<body>
<button class="yo-btn yo-btn-m yo-btn-stacked demo">normal alert</button>
<button class="yo-btn yo-btn-m yo-btn-stacked demo">noTitle alert</button>
<button class="yo-btn yo-btn-m yo-btn-stacked demo">custom alert</button>
<script src="../../../prd/component_dev/alert/demo/demo.js"></script>
</body>
</html>
17 changes: 17 additions & 0 deletions component_dev/alert/demo/demo.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
'use strict';

import React from 'react';
import Alert from '../src';

let node = document.getElementById('content'),
Expand All @@ -25,3 +26,19 @@ btn[1].addEventListener('click', function () {
console.log('second then function2 ' + name)
});
}, false)

btn[2].addEventListener('click', function () {
console.log('alert3')
Alert({
content: () => (<h1>ssssss</h1>),
btnText: 'nonono',
animation: 'none',
extraClass: 'extra'
}).then(function (show) {
console.log('then function2 ' + show);
return 'qunar';
}).then(function (name) {
console.log('second then function2 ' + name)
});
}, false)

10 changes: 6 additions & 4 deletions component_dev/alert/src/alert.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,23 @@ import yoConfirm from '../../confirm/src/confirm';
/**
* @method Alert
* @description Alert API,调用以后在屏幕正中弹出一个Alert,可以按照option对象参数调用,也可以使用简易
* 调用方式如 ``Alert(content, title, btnText, animation)``
* 调用方式如 ``Alert(content, title, btnText, animation, extraClass)``
* @param {Object} option 配置对象,里面可以接受如下属性:
* @param {String} [option.content] 组件显示的内容
* @param {String | Function} [option.content] 组件显示的内容,支持字符串和 jsx(返回 jsx 的回调函数,`() => jsx`)
* @param {String} [option.title] 组件显示的标题
* @param {String} [option.btnText] <3.0.1> 组件按钮的文本
* @param {String | Object} [option.animation] 组件显隐执行的动画,格式同Dialog组件
* @param {String} [option.extraClass] <3.0.15> 附加给组件根节点的额外className。
* @constructor Alert API
*/
export default function Alert(content = '', title = '', btnText = ['确定', ''], animation = 'fade') {
export default function Alert(content = '', title = '', btnText = ['确定', ''], animation = 'fade', extraClass = '') {
if (typeof content === 'object') {
const opt = content;
content = opt.content != null ? opt.content : '';
title = opt.title != null ? opt.title : '';
btnText = opt.btnText != null ? [opt.btnText, ''] : ['确定', ''];
animation = opt.animation || 'fade';
extraClass = opt.extraClass != null ? opt.extraClass : '';
}
return yoConfirm(content, title, btnText, animation, false);
return yoConfirm(content, title, btnText, animation, false, extraClass);
}
20 changes: 14 additions & 6 deletions component_dev/confirm/src/confirm.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import Dialog from '../../dialog/src/dialog';
import React, { Component } from 'react';
import ReactDOM from 'react-dom';
import { isFunction } from '../../common/util';

let that = null;
const container = document.createElement('div');
Expand All @@ -30,20 +31,22 @@ class ConfirmReact extends Component {
onOk() {
},
onCancel() {
}
},
extraClass: ''
};
that = this;
}

render() {
const { show, title, content, animation, onOk, onCancel, btnText } = this.state;
const { show, title, content, animation, onOk, onCancel, btnText, extraClass } = this.state;
return (
<Dialog
show={show} title={title} onOk={onOk.bind(this)}
animation={animation}
okText={btnText[0] != null && btnText[0]}
cancelText={btnText[1] != null && btnText[1]}
onCancel={onCancel ? onCancel.bind(this) : false}
extraClass={extraClass}
>
{content}
</Dialog>
Expand All @@ -56,28 +59,32 @@ ReactDOM.render(<ConfirmReact />, container);
/**
* @method Confirm
* @param {Object} option 配置对象,可以接受以下属性:
* @param {String} [option.content] 组件显示的内容
* @param {String | Function} [option.content] 组件显示的内容,支持字符串和 jsx(返回 jsx 的回调函数,`() => jsx`)
* @param {String} [option.title] 组件显示标题
* @param {Array} [option.btnText] <3.0.1> 按钮的文本,两个元素分别表示左/右按钮的文本
* @param {Object} [option.animation] 组件显隐过程的动画,格式同Dialog组件
* @param {Boolean} [option.cancel] 组件是否有取消按钮
* @param {String} [option.extraClass] <3.0.15> 附加给组件根节点的额外className。
* @returns {Promise} 返回一个Promise实例对象
* @description 确认弹框组件的调用方法,调用以后在屏幕正中弹出一个Confirm,可以按照option对象参数调用,也可以使用简易
* 调用方式如 ``Confirm(content, title, btnText, animation, cancel)``
* 调用方式如 ``Confirm(content, title, btnText, animation, cancel, extraClass)``
*/
export default function Confirm(content = '',
title = '',
btnText = ['确定', '取消'],
animation = 'fade',
cancel = true) {
cancel = true,
extraClass = '') {
if (typeof content === 'object') {
const opt = content;
title = opt.title != null ? opt.title : '';
content = opt.content != null ? opt.content : '';
btnText = opt.btnText != null ? opt.btnText : ['确定', '取消'];
animation = opt.animation != null ? opt.animation : 'fade';
cancel = opt.cancel != null ? !!opt.cancel : true;
extraClass = opt.extraClass != null ? opt.extraClass : '';
}
content = isFunction(content) ? content() : content;

return new Promise((resolve) => {
// duration的默认值是300
Expand Down Expand Up @@ -108,7 +115,8 @@ export default function Confirm(content = '',
btnText,
animation,
onOk: okBtn,
onCancel: cancel ? cancelBtn : false
onCancel: cancel ? cancelBtn : false,
extraClass: extraClass
});
});
}
16 changes: 9 additions & 7 deletions doc/animate.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,22 @@
<html lang="zh-CN">

<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta name="format-detection" content="telephone=no,email=no" />
<meta http-equiv="X-UA-Compatible" content="ie=edge, chrome=1">
<meta name="description" content="description of your site">
<meta name="author" content="author of the site">
<title>Yo Documentation 动画</title>



<link rel="shortcut icon" href="./images/favicon.ico" />
<link rel="stylesheet" href="source/main.css" />



<link rel="stylesheet" href="styles/ydoc.css" />


<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta name="format-detection" content="telephone=no,email=no" />
<meta http-equiv="X-UA-Compatible" content="ie=edge, chrome=1">
</head>
<body class=animate >
<div class="ydoc">
Expand Down Expand Up @@ -93,7 +95,7 @@ <h1 >动画</h1>


<div class="ydoc-container">

<div class="ydoc-container-content ">


Expand Down
22 changes: 14 additions & 8 deletions doc/changelog.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,22 @@
<html lang="zh-CN">

<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta name="format-detection" content="telephone=no,email=no" />
<meta http-equiv="X-UA-Compatible" content="ie=edge, chrome=1">
<meta name="description" content="description of your site">
<meta name="author" content="author of the site">
<title>Yo Documentation 版本</title>



<link rel="shortcut icon" href="./images/favicon.ico" />
<link rel="stylesheet" href="source/main.css" />



<link rel="stylesheet" href="styles/ydoc.css" />


<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta name="format-detection" content="telephone=no,email=no" />
<meta http-equiv="X-UA-Compatible" content="ie=edge, chrome=1">
</head>
<body class=changelog >
<div class="ydoc">
Expand Down Expand Up @@ -93,11 +95,15 @@ <h1 >版本</h1>


<div class="ydoc-container">

<div class="ydoc-container-content " id="readme">

<article class="markdown-body">
<h2 class="subject" id="v3.0.14__2017-11-17_">v3.0.14 (2017-11-17) <a class="hashlink" href="#v3.0.14__2017-11-17_">#</a></h2><h3 class="subject" id="Bug_Fixes">Bug Fixes <a class="hashlink" href="#Bug_Fixes">#</a></h3><ul>
<h2 class="subject" id="v3.0.15__2017-12-15_">v3.0.15 (2017-12-15) <a class="hashlink" href="#v3.0.15__2017-12-15_">#</a></h2><h3 class="subject" id="Bug_Fixes">Bug Fixes <a class="hashlink" href="#Bug_Fixes">#</a></h3><ul>
<li>修复自定义样式目录中有多层目录时 <code>post install</code> 脚本报错的问题。</li></ul>
<h3 class="subject" id="New_Features">New Features <a class="hashlink" href="#New_Features">#</a></h3><ul>
<li><code>Alert</code><code>Confirm</code> 组件增加 <code>extraClass</code> 属性,<code>content</code> 属性支持传入 jsx。</li></ul>
<h2 class="subject" id="v3.0.14__2017-11-17_">v3.0.14 (2017-11-17) <a class="hashlink" href="#v3.0.14__2017-11-17_">#</a></h2><h3 class="subject" id="Bug_Fixes">Bug Fixes <a class="hashlink" href="#Bug_Fixes">#</a></h3><ul>
<li>修复 <code>scroller.js</code> 中因 <code>refs.wrapper</code> 不存在而报错的问题</li></ul>
<h2 class="subject" id="v3.0.13__2017-10-20_">v3.0.13 (2017-10-20) <a class="hashlink" href="#v3.0.13__2017-10-20_">#</a></h2><h3 class="subject" id="New_Features">New Features <a class="hashlink" href="#New_Features">#</a></h3><ul>
<li><code>Scroller/List/GroupList/SwipeMenuList</code> 添加 <code>contentInset</code> 参数,用来在内容区域底部加上间隙(主要用于适配 iPhoneX,在内容最下方留出空间)。</li><li>添加 <code>autoBlur</code> 工具函数,可以通过 <code>import { autoBlur } from &#39;yo3/component/common/util.js</code> 来使用。</li><li><code>Toast</code> 支持传入回调函数,详见 <code>Toast</code> 使用说明。</li><li><code>ellipsis</code> 方法内置强制换行(当 <code>$line-clamp</code> 大于 <code>1</code> 时,即多行截断)。</li></ul>
Expand Down
22 changes: 12 additions & 10 deletions doc/component-ActionSheet.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,22 @@
<html lang="zh-CN">

<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta name="format-detection" content="telephone=no,email=no" />
<meta http-equiv="X-UA-Compatible" content="ie=edge, chrome=1">
<meta name="description" content="description of your site">
<meta name="author" content="author of the site">
<title>Yo Documentation 组件</title>
<title>ActionSheet - Yo Documentation 组件</title>



<link rel="shortcut icon" href="./images/favicon.ico" />
<link rel="stylesheet" href="source/main.css" />



<link rel="stylesheet" href="styles/ydoc.css" />


<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta name="format-detection" content="telephone=no,email=no" />
<meta http-equiv="X-UA-Compatible" content="ie=edge, chrome=1">
</head>
<body class=component-ActionSheet >
<div class="ydoc">
Expand Down Expand Up @@ -93,7 +95,7 @@ <h1 >组件</h1>


<div class="ydoc-container">

<div class="ydoc-container-content ">


Expand Down Expand Up @@ -308,8 +310,8 @@ <h2 id="ActionSheet">
<h4 id="-">引用方式</h4>
<pre><code><span class="token keyword">import</span> <span class="token punctuation">{</span> ActionSheet <span class="token punctuation">}</span> <span class="token keyword">from</span> <span class="token string">'$yo-component'</span><span class="token punctuation">;</span>

<span class="token comment" spellcheck="true">// 如果你的项目中未使用最新的 ykit-config-yo 插件,可能无法使用上面这个语法糖</span>
<span class="token comment" spellcheck="true">// 你仍然可以通过下面这种方式来引用</span>
<span class="token comment">// 如果你的项目中未使用最新的 ykit-config-yo 插件,可能无法使用上面这个语法糖</span>
<span class="token comment">// 你仍然可以通过下面这种方式来引用</span>
<span class="token keyword">import</span> ActionSheet <span class="token keyword">from</span> <span class="token string">'yo3/component/actionsheet'</span><span class="token punctuation">;</span>
</code></pre><h4 id="-">基本用法</h4>
<p><code>ActionSheet</code> 接收一个<code>option</code>对象作为参数。
Expand Down
Loading

0 comments on commit 505ed24

Please sign in to comment.