Skip to content

Commit

Permalink
Merge pull request #65 from ecomfe/dev
Browse files Browse the repository at this point in the history
v0.2.5
  • Loading branch information
Justineo committed May 28, 2015
2 parents 073f705 + 0e508be commit e486943
Show file tree
Hide file tree
Showing 59 changed files with 1,098 additions and 704 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ npm-debug.log
.npmignore
.DS_Store
test/coverage
doc/api
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
* 0.2.5
- `QuickTip` 改用 `TipLayer``manual` 模式
- `RichBoxGroup` 支持设置 `singleSelect`
- `Image` 控件支持设置 `max-width``max-height`,去除 Flash 类型支持,调整样式
- 修正 `Uploader` 在非自动上传模式下设置 `extraArgs` 时失败的问题
- 扩展的 `u.constanize` 函数名优化为 `u.constantize`,老名字保留
- `util.genListLink``util.genListCommand` 方法 `extra` 选项现在改名为 `data`,对应于生成的 HTML 元素中的 `data-` 前缀属性,`extra` 仍保留。同时增加了 `attr` 选项,对应于无 `data-` 前缀的属性
- MVC 扩展代码切换为基于 `eoo` 实现
- ETpl 的依赖升级到 `3.0.0` 以上
- 增加了 `ListAction` 相关的模板,利用 etpl `3.0.0` 版本后的引用带入功能,支持通过重写 `block` 覆盖
- 支持列表页和表单页数据请求失败后继续进入 Action
- 使用 `filterRedirect` 拦截跳转,解决 `ListAction` 作为子 Action 时无法局部刷新的问题
- 大量代码根据规范优化
- 优化 `mvc` 模块的 JSDoc 注释

* 0.2.4
- 修正 `QuickTip` 未能正确处理 `mouseenter` / `mouseleave` 的问题
-`extension/ui/lib` 中为 `on` 在代理事件时增加了 `mouseenter` / `mouseleave` 的处理
Expand Down
26 changes: 26 additions & 0 deletions doc/conf.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"tags": {
"allowUnknownTags": false
},
"source": {
"include": ["src", "doc/meta", "README.md"],
"includePattern": ".+\\.(js|md)$"
},
"plugins": ["plugins/markdown"],
"templates": {
"cleverLinks": false,
"monospaceLinks": false,
"systemName": "bat-ria",
"footer": "{string}",
"copyright": "Baidu Inc. All rights reserved.",
"navType": "vertical",
"theme": "flatly",
"linenums": true,
"collapseSymbols": true
},
"opts": {
"destination": "doc/api/",
"encoding": "utf-8",
"recurse": true
}
}
4 changes: 4 additions & 0 deletions doc/meta/mvc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/**
* @namespace mvc
*/
var mvc = {};
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "bat-ria",
"version": "0.2.4",
"version": "0.2.5",
"description": "RIA extension for Brand Ads Team",
"main": "main.js",
"repository": {
Expand All @@ -14,13 +14,13 @@
],
"edp": {
"dependencies": {
"er": ">=3.1.0-beta.3",
"esui": ">=3.1.0-beta.3",
"ef": "3.1.x",
"er": "~3.1.0",
"esui": "~3.1.0",
"ef": "~3.1.0",
"er-track": "~0.9.1",
"underscore": ">=1.6.0",
"moment": "2.x",
"etpl": ">=2.0.8",
"etpl": ">=3.0.0",
"urijs": ">=1.12.0",
"eoo": "~0.0.9",
"mini-event": "~1.0.2"
Expand Down
4 changes: 2 additions & 2 deletions src/css/common.less
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
// Basic status
@bat-success-color: #008000;
@bat-warning-color: #ff9a00;
@bat-alert-color: #ff0000;
@bat-alert-color: #f00;
@bat-aux-color: #9c9a9c;

// link colors
@bat-link-color: #3377aa;
@bat-link-hover-color: #ff6600;
@bat-link-hover-color: #f60;

// background & border color
@bat-border-blue: #bad5f1;
Expand Down
10 changes: 5 additions & 5 deletions src/css/list.less
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* 列表头部区域 */
// 列表头部区域
@sys-list-header-background: @bat-bg-light-blue;
@sys-list-header-border-color: @bat-border-blue;
@sys-list-header-padding: 0;
Expand All @@ -12,7 +12,7 @@
}
}

/* 列表头部 > 摘要数据区域 */
// 列表头部 > 摘要数据区域
@sys-list-summary-float: none;

.list-summary {
Expand Down Expand Up @@ -46,7 +46,7 @@
}
}

/* 列表头部 > 过滤表单区域 */
// 列表头部 > 过滤表单区域
.list-filter {
&:extend(.ui-row all);
background-color: @bat-bg-blue;
Expand All @@ -56,13 +56,13 @@
}
}

/* 列表头部 > 批量操作区域 */
// 列表头部 > 批量操作区域
.list-batch {
background-color: @bat-bg-blue;
&:extend(.ui-row all);
}

/* 列表头部 > 列表操作列区域 */
// 列表头部 > 列表操作列区域
.list-operation {
position: relative;
margin-left: 12px;
Expand Down
14 changes: 11 additions & 3 deletions src/css/ui.less
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* 处理同一行中的ESUI控件的对齐、间距 */
// 处理同一行中的ESUI控件的对齐、间距
.ui-row {
padding: 8px 10px;
.clearfix();
Expand All @@ -21,13 +21,13 @@
}
}

/* 禁用时鼠标指针增强 */
// 禁用时鼠标指针增强
.state-disabled,
.state-disabled:hover {
cursor: not-allowed;
}

/* 给一些ESUI控件的样式打patch */
// 给一些ESUI控件的样式打patch

.ui-table-subrow {

Expand All @@ -54,6 +54,14 @@
}

// esui/Pager
.ui-pager {
padding: 5px 10px;
}

.ui-pager-label {
margin-right: 5px;
}

.ui-pager-main li {
font-family: inherit;
}
Expand Down
8 changes: 4 additions & 4 deletions src/extension/hooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ define(function (require) {
var io = require('../io/serverIO');

if (hooks.ADD_ADER_ID) {
io.hooks.filterIndexUrl = function(url) {
io.hooks.filterIndexUrl = function (url) {
return uri(url).addQuery(getAderArgMap()).toString();
};

Expand All @@ -57,7 +57,7 @@ define(function (require) {
};
}

io.hooks.beforeRequest = function(options) {
io.hooks.beforeRequest = function (options) {
if (hooks.ADD_ADER_ID) {
var url = options.url;
var argMap = getAderArgMap();
Expand All @@ -74,14 +74,14 @@ define(function (require) {
};

if (hooks.SHOW_LOADING) {
io.hooks.afterComplete = function() {
io.hooks.afterComplete = function () {
loading.hide();
};
}

if (hooks.ADD_ER_REQUEST_HEADER) {
var ajax = require('er/ajax');
ajax.hooks.beforeSend = function(xhr) {
ajax.hooks.beforeSend = function (xhr) {
xhr.setRequestHeader('X-Request-By', 'ERApplication');
};
}
Expand Down
2 changes: 1 addition & 1 deletion src/extension/track.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* https://github.com/ecomfe/er-track
**/

define(function(require) {
define(function (require) {
var u = require('underscore');

function activate() {
Expand Down
8 changes: 4 additions & 4 deletions src/extension/ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@ define(
function addControlLinkMode() {
var CommandMenu = require('esui/CommandMenu');

CommandMenu.prototype.linkTemplate =
'<a target="${target}" href="${href}">${text}</a>';
CommandMenu.prototype.linkTemplate = ''
+ '<a target="${target}" href="${href}">${text}</a>';

CommandMenu.prototype.getItemHTML = function (item) {
var data = {
Expand Down Expand Up @@ -289,8 +289,8 @@ define(
* @type {string}
* @override
*/
Crumb.prototype.linkNodeTemplate =
'<a class="${classes}" href="${href}" data-redirect="${scope}">${text}</a>';
Crumb.prototype.linkNodeTemplate = ''
+ '<a class="${classes}" href="${href}" data-redirect="${scope}">${text}</a>';

/**
* 获取节点的HTML内容
Expand Down
18 changes: 11 additions & 7 deletions src/extension/underscore.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,11 @@ define(function (require) {
u.each(
object,
function (value, key) {
var isDefaultNull =
value == null || value === '';
var isInDefaults =
defaults.hasOwnProperty(key) && defaults[key] === value;
var isDefaultNull = value == null || value === '';
var isInDefaults = defaults.hasOwnProperty(key) && defaults[key] === value;
if (!isDefaultNull && !isInDefaults) {
if (deep && typeof value === 'object') {
purifiedObject[key] =
purify(value, defaults[key], deep);
purifiedObject[key] = purify(value, defaults[key], deep);
}
else {
purifiedObject[key] = value;
Expand Down Expand Up @@ -233,12 +230,19 @@ define(function (require) {
* @param {string} s 输入的字符串
* @return {string}
*/
util.constanize = function (s) {
util.constantize = function (s) {
s = util.dasherize(s);
s = s.replace(/-/g, '_');
return s.toUpperCase();
};

/**
* 参见{@link util#constantize}
*
* @deprecated
*/
util.constanize = util.constantize;

/**
* 将一个单词转为复数
*
Expand Down
8 changes: 4 additions & 4 deletions src/io/serverIO.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ define(function (require) {
if (message.redirect === '') {
title = '登录超时';
content = '登录超时,请重新登录!';
onok = function() {
onok = function () {
loc.reload(true);
};
}
Expand Down Expand Up @@ -261,7 +261,7 @@ define(function (require) {
* @param {Object} options 请求选项
* @return {meta.Promise} 请求Promise
*/
io.request = function(url, data, options) {
io.request = function (url, data, options) {
var defaults = {
url: url,
data: data,
Expand Down Expand Up @@ -294,7 +294,7 @@ define(function (require) {
* @param {Object} options 请求选项
* @return {meta.Promise} 请求Promise
*/
io.get = function(url, data, options) {
io.get = function (url, data, options) {
u.extend(options, {
method: 'GET'
});
Expand All @@ -309,7 +309,7 @@ define(function (require) {
* @param {Object} options 请求选项
* @return {meta.Promise} 请求Promise
*/
io.post = function(url, data, options) {
io.post = function (url, data, options) {
u.extend(options, {
method: 'POST'
});
Expand Down
2 changes: 1 addition & 1 deletion src/location.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* @author Justineo
*/

define(function(require) {
define(function (require) {

var loc = {};

Expand Down
16 changes: 6 additions & 10 deletions src/mvc/BaseAction.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,22 @@
*/

define(function (require) {
var util = require('er/util');
var u = require('underscore');
var Action = require('er/Action');

/**
* `Action`基类
*
* @class mvc.BaseAction
* @extends er.Action
* @constructor
*/
function BaseAction() {
Action.apply(this, arguments);
}

util.inherits(BaseAction, Action);
var exports = {};

/**
* @override
*/
BaseAction.prototype.createModel = function (args) {
var model = Action.prototype.createModel.apply(this, arguments);
exports.createModel = function (args) {
var model = this.$super(arguments);

// `Action`基类的默认返回值是一个空对象`{}`,
// 但是普通的`Model`对象因为方法和属性全在`prototype`上,也会被判断为空
Expand All @@ -45,7 +40,7 @@ define(function (require) {
* @protected
* @override
*/
BaseAction.prototype.back = function (defaultURL, isForce) {
exports.back = function (defaultURL, isForce) {
if (typeof arguments[0] === 'boolean') {
isForce = defaultURL;
defaultURL = null;
Expand All @@ -63,5 +58,6 @@ define(function (require) {
}
};

var BaseAction = require('eoo').create(Action, exports);
return BaseAction;
});
Loading

0 comments on commit e486943

Please sign in to comment.