diff --git a/CHANGELOG.md b/CHANGELOG.md
index 91d0659..f2ca6f7 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,12 @@
+#### v1.1.4 (2018-07-20)
+
+- 【修复】 percent拼写错误 #207
+- 【优化】 弹窗之后背景还是可以滑动的问题
+- 【优化】 `datePicker`默认选择当天 #196
+- 【优化】 `actionSheet`增加`title`参数
+
+
+
#### v1.1.3 (2017-11-08)
- 【优化】 `picker` 和 `actionSheet` 增加`onClose`
diff --git a/README.md b/README.md
index d7853a9..f54f29e 100644
--- a/README.md
+++ b/README.md
@@ -2,14 +2,13 @@ weui.js
=====
[![npm version](https://img.shields.io/npm/v/weui.js.svg)](https://www.npmjs.org/package/weui.js/)
-[![QQ](http://pub.idqqimg.com/wpa/images/group.png)](http://jq.qq.com/?_wv=1027&k=413HLfV)
### 概述
-[WeUI](https://github.com/weui/weui.git) 的轻量级 js 封装。
+[WeUI](https://github.com/Tencent/weui.git) 的轻量级 js 封装。
-注意:由于微信小程序不支持dom操作,所以weui.js并不适用于小程序。不过WeUI也为小程序开发了另外的版本,详情请看:https://github.com/weui/weui-wxss/
+注意:由于微信小程序不支持dom操作,所以weui.js并不适用于小程序。不过WeUI也为小程序开发了另外的版本,详情请看:https://github.com/Tencent/weui-wxss/
### 手机预览
@@ -23,7 +22,7 @@ weui.js
安装
```shell
-git clone https://github.com/weui/weui.js.git
+git clone https://github.com/Tencent/weui.js.git
cd weui.js
npm install
npm start
@@ -41,8 +40,8 @@ npm run build
#### global
```html
-
-
+
+
@@ -59,7 +58,7 @@ weui.alert('alert');
### 文档
-[Documents](https://github.com/weui/weui.js/tree/master/docs/README.md)
+[Documents](https://github.com/Tencent/weui.js/tree/master/docs/README.md)
### 贡献
diff --git a/__tests__/actionsheet.js b/__tests__/actionsheet.js
index 889b968..e8679e1 100644
--- a/__tests__/actionsheet.js
+++ b/__tests__/actionsheet.js
@@ -8,12 +8,14 @@ describe('actionsheet', function(){
[ {label: '拍照'}, {label: '从相册选择'}],
[ {label: '确定'}, {label: '取消'}],
{
+ title: 'title',
className: 'test'
}
);
const $actionsheet = $('.weui-actionsheet');
assert($actionsheet.length === 1);
assert(actionsheetWrp.classList.contains('test'));
+ assert($('.weui-actionsheet__title-text').text() == 'title');
});
it('should render menus', () => {
const $menu = $('.weui-actionsheet__menu');
diff --git a/dist/example/example.js b/dist/example/example.js
index 1d37a11..984abb2 100644
--- a/dist/example/example.js
+++ b/dist/example/example.js
@@ -42,7 +42,7 @@
/************************************************************************/
/******/ ([
/* 0 */
-/***/ function(module, exports, __webpack_require__) {
+/***/ (function(module, exports, __webpack_require__) {
'use strict';
@@ -118,6 +118,7 @@
console.log('取消');
}
}], {
+ title: 'actionTitle',
className: "custom-classname",
onClose: function onClose() {
console.log('关闭');
@@ -215,6 +216,37 @@
});
});
+ // 时间选择器
+ document.querySelector('#datePickerBtn100').addEventListener('click', function () {
+ _weui2.default.datePicker({
+ start: '1816-03-29',
+ end: '2030-12-29',
+ /**
+ * https://zh.wikipedia.org/wiki/Cron
+ * cron 表达式后三位
+ * 大于100年时 设置 cron 为 fasle,优化在 Safari 中弹出过慢的问题
+ * 示例:
+ * * * * 每天
+ * 5 * * 每个月的5日
+ * 1-10 * * 每个月的前10日
+ * 1,5,10 * * 每个月的1号、5号、10号
+ * *\/2 * * 每个月的 1、3、5、7...日,注意写的时候斜杠“/”前面没有反斜杠“\”,这是因为是注释所以需要转义
+ * * 2 0 2月的每个周日
+ * * * 0,6 每个周末
+ * * * 3 每周三
+ */
+ cron: false,
+ defaultValue: [2017, 7, 9],
+ onChange: function onChange(result) {
+ console.log(result);
+ },
+ onConfirm: function onConfirm(result) {
+ console.log(result);
+ },
+ id: 'datePicker'
+ });
+ });
+
// 多列选择器
document.querySelector('#multiPickerBtn').addEventListener('click', function () {
_weui2.default.picker([{
@@ -541,9 +573,9 @@
});
});
-/***/ },
+/***/ }),
/* 1 */
-/***/ function(module, exports, __webpack_require__) {
+/***/ (function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;;(function () {
'use strict';
@@ -1388,9 +1420,9 @@
}());
-/***/ },
+/***/ }),
/* 2 */
-/***/ function(module, exports, __webpack_require__) {
+/***/ (function(module, exports, __webpack_require__) {
'use strict';
@@ -1489,9 +1521,9 @@
};
module.exports = exports['default'];
-/***/ },
+/***/ }),
/* 3 */
-/***/ function(module, exports, __webpack_require__) {
+/***/ (function(module, exports, __webpack_require__) {
'use strict';
@@ -1610,6 +1642,9 @@
} else {
hide();
}
+ }).on('touchmove', function (evt) {
+ evt.stopPropagation();
+ evt.preventDefault();
});
_sington = $dialogWrap[0];
@@ -1619,9 +1654,9 @@
exports.default = dialog;
module.exports = exports['default'];
-/***/ },
+/***/ }),
/* 4 */
-/***/ function(module, exports, __webpack_require__) {
+/***/ (function(module, exports, __webpack_require__) {
'use strict';
@@ -1879,24 +1914,17 @@
* @returns {*}
*/
attr: function attr() {
- var _arguments2 = arguments,
- _this3 = this;
+ var _arguments2 = arguments;
if (_typeof(arguments[0]) == 'object') {
- var _ret = function () {
- var attrsObj = _arguments2[0];
- var that = _this3;
- Object.keys(attrsObj).forEach(function (attr) {
- that.forEach(function ($element) {
- $element.setAttribute(attr, attrsObj[attr]);
- });
+ var attrsObj = arguments[0];
+ var that = this;
+ Object.keys(attrsObj).forEach(function (attr) {
+ that.forEach(function ($element) {
+ $element.setAttribute(attr, attrsObj[attr]);
});
- return {
- v: _this3
- };
- }();
-
- if ((typeof _ret === 'undefined' ? 'undefined' : _typeof(_ret)) === "object") return _ret.v;
+ });
+ return this;
}
if (typeof arguments[0] == 'string' && arguments.length < 2) {
@@ -1985,9 +2013,9 @@
exports.default = _balajs2.default;
module.exports = exports['default'];
-/***/ },
+/***/ }),
/* 5 */
-/***/ function(module, exports) {
+/***/ (function(module, exports) {
// element-closest | CC0-1.0 | github.com/jonathantneal/closest
@@ -2024,12 +2052,19 @@
})(window.Element.prototype);
-/***/ },
+/***/ }),
/* 6 */
-/***/ function(module, exports) {
+/***/ (function(module, exports) {
+
+ /*
+ object-assign
+ (c) Sindre Sorhus
+ @license MIT
+ */
'use strict';
/* eslint-disable no-unused-vars */
+ var getOwnPropertySymbols = Object.getOwnPropertySymbols;
var hasOwnProperty = Object.prototype.hasOwnProperty;
var propIsEnumerable = Object.prototype.propertyIsEnumerable;
@@ -2050,7 +2085,7 @@
// Detect buggy property enumeration order in older V8 versions.
// https://bugs.chromium.org/p/v8/issues/detail?id=4118
- var test1 = new String('abc'); // eslint-disable-line
+ var test1 = new String('abc'); // eslint-disable-line no-new-wrappers
test1[5] = 'de';
if (Object.getOwnPropertyNames(test1)[0] === '5') {
return false;
@@ -2079,7 +2114,7 @@
}
return true;
- } catch (e) {
+ } catch (err) {
// We don't expect any of the above to throw, but better to be safe.
return false;
}
@@ -2099,8 +2134,8 @@
}
}
- if (Object.getOwnPropertySymbols) {
- symbols = Object.getOwnPropertySymbols(from);
+ if (getOwnPropertySymbols) {
+ symbols = getOwnPropertySymbols(from);
for (var i = 0; i < symbols.length; i++) {
if (propIsEnumerable.call(from, symbols[i])) {
to[symbols[i]] = from[symbols[i]];
@@ -2113,9 +2148,9 @@
};
-/***/ },
+/***/ }),
/* 7 */
-/***/ function(module, exports, __webpack_require__) {
+/***/ (function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function(root, $) {
$ = (function(document, s_addEventListener, s_querySelectorAll) {
@@ -2169,15 +2204,15 @@
})(this);
-/***/ },
+/***/ }),
/* 8 */
-/***/ function(module, exports) {
+/***/ (function(module, exports) {
module.exports = "
\">
weui-skin_android <% } %>\"> <% if(title){ %>
<%=title%>
<% } %>
<%=content%>
";
-/***/ },
+/***/ }),
/* 9 */
-/***/ function(module, exports, __webpack_require__) {
+/***/ (function(module, exports, __webpack_require__) {
'use strict';
@@ -2271,9 +2306,9 @@
exports.default = alert;
module.exports = exports['default'];
-/***/ },
+/***/ }),
/* 10 */
-/***/ function(module, exports, __webpack_require__) {
+/***/ (function(module, exports, __webpack_require__) {
'use strict';
@@ -2372,9 +2407,9 @@
exports.default = confirm;
module.exports = exports['default'];
-/***/ },
+/***/ }),
/* 11 */
-/***/ function(module, exports, __webpack_require__) {
+/***/ (function(module, exports, __webpack_require__) {
'use strict';
@@ -2473,15 +2508,15 @@
exports.default = toast;
module.exports = exports['default'];
-/***/ },
+/***/ }),
/* 12 */
-/***/ function(module, exports) {
+/***/ (function(module, exports) {
module.exports = " ";
-/***/ },
+/***/ }),
/* 13 */
-/***/ function(module, exports, __webpack_require__) {
+/***/ (function(module, exports, __webpack_require__) {
'use strict';
@@ -2573,15 +2608,15 @@
exports.default = loading;
module.exports = exports['default'];
-/***/ },
+/***/ }),
/* 14 */
-/***/ function(module, exports) {
+/***/ (function(module, exports) {
module.exports = " ";
-/***/ },
+/***/ }),
/* 15 */
-/***/ function(module, exports, __webpack_require__) {
+/***/ (function(module, exports, __webpack_require__) {
'use strict';
@@ -2628,6 +2663,7 @@
* @param {function} actions[].onClick 选项点击时的回调
*
* @param {object=} options 配置项
+ * @param {string=} options.title actionSheet的title,如果isAndroid=true,则不会显示
* @param {string=} options.className 自定义类名
* @param {function=} [options.onClose] actionSheet关闭后的回调
*
@@ -2674,6 +2710,7 @@
options = _util2.default.extend({
menus: menus,
actions: actions,
+ title: '',
className: '',
isAndroid: isAndroid,
onClose: _util2.default.noop
@@ -2724,15 +2761,15 @@
exports.default = actionSheet;
module.exports = exports['default'];
-/***/ },
+/***/ }),
/* 16 */
-/***/ function(module, exports) {
+/***/ (function(module, exports) {
- module.exports = "weui-skin_android <% } %><%= className %>\">
<% for(var j = 0; j < actions.length; j++){ %>
<%= actions[j].label %>
<% } %>
";
+ module.exports = "weui-skin_android <% } %><%= className %>\">
<% if(!isAndroid && title){ %>
<% } %>
<% for(var j = 0; j < actions.length; j++){ %>
<%= actions[j].label %>
<% } %>
";
-/***/ },
+/***/ }),
/* 17 */
-/***/ function(module, exports, __webpack_require__) {
+/***/ (function(module, exports, __webpack_require__) {
'use strict';
@@ -2844,15 +2881,15 @@
exports.default = topTips;
module.exports = exports['default'];
-/***/ },
+/***/ }),
/* 18 */
-/***/ function(module, exports) {
+/***/ (function(module, exports) {
module.exports = "\" style=display:block><%= content %>
";
-/***/ },
+/***/ }),
/* 19 */
-/***/ function(module, exports, __webpack_require__) {
+/***/ (function(module, exports, __webpack_require__) {
'use strict';
@@ -2946,9 +2983,9 @@
exports.default = searchBar;
module.exports = exports['default'];
-/***/ },
+/***/ }),
/* 20 */
-/***/ function(module, exports, __webpack_require__) {
+/***/ (function(module, exports, __webpack_require__) {
'use strict';
@@ -3049,9 +3086,9 @@
exports.default = tab;
module.exports = exports['default'];
-/***/ },
+/***/ }),
/* 21 */
-/***/ function(module, exports, __webpack_require__) {
+/***/ (function(module, exports, __webpack_require__) {
'use strict';
@@ -3059,22 +3096,6 @@
value: true
});
- var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; /*
- * Tencent is pleased to support the open source community by making WeUI.js available.
- *
- * Copyright (C) 2017 THL A29 Limited, a Tencent company. All rights reserved.
- *
- * Licensed under the MIT License (the "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://opensource.org/licenses/MIT
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License is
- * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
- * either express or implied. See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
var _util = __webpack_require__(4);
var _util2 = _interopRequireDefault(_util);
@@ -3085,6 +3106,22 @@
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+ /*
+ * Tencent is pleased to support the open source community by making WeUI.js available.
+ *
+ * Copyright (C) 2017 THL A29 Limited, a Tencent company. All rights reserved.
+ *
+ * Licensed under the MIT License (the "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://opensource.org/licenses/MIT
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is
+ * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+ * either express or implied. See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
function _findCellParent(ele) {
if (!ele || !ele.classList) return null;
if (ele.classList.contains('weui-cell')) return ele;
@@ -3105,45 +3142,33 @@
return 'empty';
} else if (input.type == 'checkbox') {
if (reg) {
- var _ret = function () {
- var checkboxInputs = $form.find('input[type="checkbox"][name="' + input.name + '"]');
- var regs = reg.replace(/[{\s}]/g, '').split(',');
- var count = 0;
+ var checkboxInputs = $form.find('input[type="checkbox"][name="' + input.name + '"]');
+ var regs = reg.replace(/[{\s}]/g, '').split(',');
+ var count = 0;
- if (regs.length != 2) {
- throw input.outerHTML + ' regexp is wrong.';
- }
+ if (regs.length != 2) {
+ throw input.outerHTML + ' regexp is wrong.';
+ }
- checkboxInputs.forEach(function (checkboxInput) {
- if (checkboxInput.checked) ++count;
- });
+ checkboxInputs.forEach(function (checkboxInput) {
+ if (checkboxInput.checked) ++count;
+ });
- if (regs[1] === '') {
- // {0,}
- if (count >= parseInt(regs[0])) {
- return {
- v: null
- };
- } else {
- return {
- v: count == 0 ? 'empty' : 'notMatch'
- };
- }
+ if (regs[1] === '') {
+ // {0,}
+ if (count >= parseInt(regs[0])) {
+ return null;
} else {
- // {0,2}
- if (parseInt(regs[0]) <= count && count <= parseInt(regs[1])) {
- return {
- v: null
- };
- } else {
- return {
- v: count == 0 ? 'empty' : 'notMatch'
- };
- }
+ return count == 0 ? 'empty' : 'notMatch';
}
- }();
-
- if ((typeof _ret === 'undefined' ? 'undefined' : _typeof(_ret)) === "object") return _ret.v;
+ } else {
+ // {0,2}
+ if (parseInt(regs[0]) <= count && count <= parseInt(regs[1])) {
+ return null;
+ } else {
+ return count == 0 ? 'empty' : 'notMatch';
+ }
+ }
} else {
return input.checked ? null : 'empty';
}
@@ -3344,9 +3369,9 @@
};
module.exports = exports['default'];
-/***/ },
+/***/ }),
/* 22 */
-/***/ function(module, exports, __webpack_require__) {
+/***/ (function(module, exports, __webpack_require__) {
'use strict';
@@ -3485,8 +3510,8 @@
*
* // return false; // 阻止文件上传
* },
- * onProgress: function(procent){
- * console.log(this, procent);
+ * onProgress: function(percent){
+ * console.log(this, percent);
* // return true; // 阻止默认行为,不使用默认的进度显示
* },
* onSuccess: function (ret) {
@@ -3564,82 +3589,70 @@
}
if (options.onBeforeQueued) {
- (function () {
- var onBeforeQueued = options.onBeforeQueued;
- options.onBeforeQueued = function (file, files) {
- var ret = onBeforeQueued.call(file, files);
- if (ret === false) {
- return false;
- }
- if (ret === true) {
- return;
- }
+ var onBeforeQueued = options.onBeforeQueued;
+ options.onBeforeQueued = function (file, files) {
+ var ret = onBeforeQueued.call(file, files);
+ if (ret === false) {
+ return false;
+ }
+ if (ret === true) {
+ return;
+ }
- var $item = (0, _util2.default)(_util2.default.render(_item2.default, {
- id: file.id
- }));
- $uploader.find('.weui-uploader__files').append($item);
- };
- })();
+ var $item = (0, _util2.default)(_util2.default.render(_item2.default, {
+ id: file.id
+ }));
+ $uploader.find('.weui-uploader__files').append($item);
+ };
}
if (options.onQueued) {
- (function () {
- var onQueued = options.onQueued;
- options.onQueued = function (file) {
- if (!onQueued.call(file)) {
- var $file = $uploader.find('[data-id="' + file.id + '"]');
- $file.css({
- backgroundImage: 'url("' + (file.base64 || file.url) + '")'
- });
- if (!options.auto) {
- clearFileStatus($uploader, file.id);
- }
+ var onQueued = options.onQueued;
+ options.onQueued = function (file) {
+ if (!onQueued.call(file)) {
+ var $file = $uploader.find('[data-id="' + file.id + '"]');
+ $file.css({
+ backgroundImage: 'url("' + (file.base64 || file.url) + '")'
+ });
+ if (!options.auto) {
+ clearFileStatus($uploader, file.id);
}
- };
- })();
+ }
+ };
}
if (options.onBeforeSend) {
- (function () {
- var onBeforeSend = options.onBeforeSend;
- options.onBeforeSend = function (file, data, headers) {
- var ret = onBeforeSend.call(file, data, headers);
- if (ret === false) {
- return false;
- }
- };
- })();
+ var onBeforeSend = options.onBeforeSend;
+ options.onBeforeSend = function (file, data, headers) {
+ var ret = onBeforeSend.call(file, data, headers);
+ if (ret === false) {
+ return false;
+ }
+ };
}
if (options.onSuccess) {
- (function () {
- var onSuccess = options.onSuccess;
- options.onSuccess = function (file, ret) {
- file.status = 'success';
- if (!onSuccess.call(file, ret)) {
- clearFileStatus($uploader, file.id);
- }
- };
- })();
+ var onSuccess = options.onSuccess;
+ options.onSuccess = function (file, ret) {
+ file.status = 'success';
+ if (!onSuccess.call(file, ret)) {
+ clearFileStatus($uploader, file.id);
+ }
+ };
}
if (options.onProgress) {
- (function () {
- var onProgress = options.onProgress;
- options.onProgress = function (file, percent) {
- if (!onProgress.call(file, percent)) {
- findFileCtn($uploader, file.id).html(percent + '%');
- }
- };
- })();
+ var onProgress = options.onProgress;
+ options.onProgress = function (file, percent) {
+ if (!onProgress.call(file, percent)) {
+ findFileCtn($uploader, file.id).html(percent + '%');
+ }
+ };
}
if (options.onError) {
- (function () {
- var onError = options.onError;
- options.onError = function (file, err) {
- file.status = 'fail';
- if (!onError.call(file, err)) {
- findFileCtn($uploader, file.id).html('');
- }
- };
- })();
+ var onError = options.onError;
+ options.onError = function (file, err) {
+ file.status = 'fail';
+ if (!onError.call(file, err)) {
+ findFileCtn($uploader, file.id).html('');
+ }
+ };
}
$uploader.find('input[type="file"]').on('change', function (evt) {
@@ -3677,15 +3690,15 @@
exports.default = uploader;
module.exports = exports['default'];
-/***/ },
+/***/ }),
/* 23 */
-/***/ function(module, exports) {
+/***/ (function(module, exports) {
module.exports = "\">
";
-/***/ },
+/***/ }),
/* 24 */
-/***/ function(module, exports) {
+/***/ (function(module, exports) {
'use strict';
@@ -3915,9 +3928,9 @@
};
module.exports = exports['default'];
-/***/ },
+/***/ }),
/* 25 */
-/***/ function(module, exports) {
+/***/ (function(module, exports) {
'use strict';
@@ -4020,9 +4033,9 @@
}
module.exports = exports['default'];
-/***/ },
+/***/ }),
/* 26 */
-/***/ function(module, exports, __webpack_require__) {
+/***/ (function(module, exports, __webpack_require__) {
'use strict';
@@ -4032,14 +4045,14 @@
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; /*
* Tencent is pleased to support the open source community by making WeUI.js available.
- *
+ *
* Copyright (C) 2017 THL A29 Limited, a Tencent company. All rights reserved.
- *
+ *
* Licensed under the MIT License (the "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
- *
+ *
* http://opensource.org/licenses/MIT
- *
+ *
* Unless required by applicable law or agreed to in writing, software distributed under the License is
* distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions and
@@ -4466,12 +4479,15 @@
* });
*/
function datePicker(options) {
+ var nowDate = new Date();
+
var defaults = _util2.default.extend({
id: 'datePicker',
onChange: _util2.default.noop,
onConfirm: _util2.default.noop,
- start: 2000,
- end: 2030,
+ start: nowDate.getFullYear() - 20,
+ end: nowDate.getFullYear() + 20,
+ defaultValue: [nowDate.getFullYear(), nowDate.getMonth() + 1, nowDate.getDate()],
cron: '* * *'
}, options);
@@ -4489,47 +4505,131 @@
var findBy = function findBy(array, key, value) {
for (var i = 0, len = array.length; i < len; i++) {
- var _obj = array[i];
- if (_obj[key] == value) {
- return _obj;
+ var obj = array[i];
+ if (obj[key] == value) {
+ return obj;
}
}
};
var date = [];
- var interval = _cron2.default.parse(defaults.cron, defaults.start, defaults.end);
- var obj = void 0;
- do {
- obj = interval.next();
-
- var year = obj.value.getFullYear();
- var month = obj.value.getMonth() + 1;
- var day = obj.value.getDate();
-
- var Y = findBy(date, 'value', year);
- if (!Y) {
- Y = {
- label: year + '年',
- value: year,
- children: []
- };
- date.push(Y);
+ if (typeof defaults.cron === 'string') {
+ var interval = _cron2.default.parse(defaults.cron, defaults.start, defaults.end);
+ var obj = void 0;
+ do {
+ obj = interval.next();
+
+ var year = obj.value.getFullYear();
+ var month = obj.value.getMonth() + 1;
+ var day = obj.value.getDate();
+
+ var Y = findBy(date, 'value', year);
+ if (!Y) {
+ Y = {
+ label: year + '年',
+ value: year,
+ children: []
+ };
+ date.push(Y);
+ }
+ var M = findBy(Y.children, 'value', month);
+ if (!M) {
+ M = {
+ label: month + '月',
+ value: month,
+ children: []
+ };
+ Y.children.push(M);
+ }
+ M.children.push({
+ label: day + '日',
+ value: day
+ });
+ } while (!obj.done);
+ return picker(date, defaults);
+ }
+
+ var date2arr = function date2arr(date) {
+ return [date.getFullYear(), date.getMonth() + 1, date.getDate()];
+ };
+ var hasLeapYear = function hasLeapYear(year) {
+ return year % 400 === 0 || year % 4 === 0 && year % 100 !== 0;
+ };
+ var createDaysArr = function createDaysArr(hasLeap, month, startMonth, endMonth, startDay, endDay) {
+ var daysArr = [];
+ var maxDays = hasLeap ? 29 : 28;
+ switch (month) {
+ case 1:
+ case 3:
+ case 5:
+ case 7:
+ case 8:
+ case 10:
+ case 12:
+ maxDays = 31;
+ break;
+ case 2:
+ maxDays = hasLeap ? 29 : 28;
+ break;
+ case 4:
+ case 6:
+ case 9:
+ case 11:
+ maxDays = 30;
+ break;
}
- var M = findBy(Y.children, 'value', month);
- if (!M) {
- M = {
- label: month + '月',
- value: month,
- children: []
- };
- Y.children.push(M);
+ startDay = startDay || 1;
+ endDay = endDay || maxDays;
+ if (month > startMonth) {
+ startDay = 1;
+ }
+ if (month < endMonth) {
+ endDay = maxDays;
+ }
+ if (startDay > maxDays) {
+ startDay = maxDays;
+ }
+ if (endDay > maxDays) {
+ endDay = maxDays;
}
- M.children.push({
- label: day + '日',
- value: day
+ for (var i = startDay; i <= endDay; i++) {
+ daysArr.push({ label: i + '日', value: i });
+ }
+ return daysArr;
+ };
+ var createMonthsObj = function createMonthsObj(year, startMonth, endMonth, startDay, endDay) {
+ var monthsArr = [];
+ var hasLeap = hasLeapYear(year);
+ for (var i = startMonth; i <= endMonth; i++) {
+ monthsArr.push({
+ label: i + '月',
+ value: i,
+ children: createDaysArr(hasLeap, i, startMonth, endMonth, startDay, endDay)
+ });
+ }
+ return monthsArr;
+ };
+ var startArr = date2arr(defaults.start);
+ var endArr = date2arr(defaults.end);
+ for (var _year = startArr[0]; _year <= endArr[0]; _year++) {
+ var startMonth = 1,
+ endMonth = 12,
+ startDay = void 0,
+ endDay = void 0;
+ if (_year === startArr[0]) {
+ startMonth = startArr[1];
+ startDay = startArr[2];
+ }
+ if (_year === endArr[0]) {
+ endMonth = endArr[1];
+ endDay = endArr[2];
+ }
+ date.push({
+ label: _year + '年',
+ value: _year,
+ children: createMonthsObj(_year, startMonth, endMonth, startDay, endDay)
});
- } while (!obj.done);
-
+ }
return picker(date, defaults);
}
@@ -4539,9 +4639,9 @@
};
module.exports = exports['default'];
-/***/ },
+/***/ }),
/* 27 */
-/***/ function(module, exports) {
+/***/ (function(module, exports) {
'use strict';
@@ -4748,9 +4848,9 @@
};
module.exports = exports['default'];
-/***/ },
+/***/ }),
/* 28 */
-/***/ function(module, exports, __webpack_require__) {
+/***/ (function(module, exports, __webpack_require__) {
'use strict';
@@ -5012,9 +5112,9 @@
}
};
-/***/ },
+/***/ }),
/* 29 */
-/***/ function(module, exports) {
+/***/ (function(module, exports) {
"use strict";
@@ -5045,21 +5145,21 @@
return depth;
};
-/***/ },
+/***/ }),
/* 30 */
-/***/ function(module, exports) {
+/***/ (function(module, exports) {
module.exports = " ";
-/***/ },
+/***/ }),
/* 31 */
-/***/ function(module, exports) {
+/***/ (function(module, exports) {
module.exports = "";
-/***/ },
+/***/ }),
/* 32 */
-/***/ function(module, exports, __webpack_require__) {
+/***/ (function(module, exports, __webpack_require__) {
'use strict';
@@ -5157,15 +5257,15 @@
exports.default = gallery;
module.exports = exports['default'];
-/***/ },
+/***/ }),
/* 33 */
-/***/ function(module, exports) {
+/***/ (function(module, exports) {
module.exports = " ";
-/***/ },
+/***/ }),
/* 34 */
-/***/ function(module, exports, __webpack_require__) {
+/***/ (function(module, exports, __webpack_require__) {
'use strict';
@@ -5316,5 +5416,5 @@
exports.default = slider;
module.exports = exports['default'];
-/***/ }
+/***/ })
/******/ ]);
\ No newline at end of file
diff --git a/dist/example/index.html b/dist/example/index.html
index 07bfd07..4e74329 100644
--- a/dist/example/index.html
+++ b/dist/example/index.html
@@ -1 +1 @@
- weui.js
\ No newline at end of file
+ weui.js
\ No newline at end of file
diff --git a/dist/weui.js b/dist/weui.js
index 7503890..dfaf284 100644
--- a/dist/weui.js
+++ b/dist/weui.js
@@ -1,6 +1,6 @@
/*!
- * weui.js v1.1.2 (https://weui.io)
- * Copyright 2017, wechat ui team
+ * weui.js v1.1.4 (https://weui.io)
+ * Copyright 2019, wechat ui team
* MIT license
*/
(function webpackUniversalModuleDefinition(root, factory) {
@@ -57,7 +57,7 @@ return /******/ (function(modules) { // webpackBootstrap
/************************************************************************/
/******/ ([
/* 0 */
-/***/ function(module, exports, __webpack_require__) {
+/***/ (function(module, exports, __webpack_require__) {
'use strict';
@@ -156,9 +156,9 @@ return /******/ (function(modules) { // webpackBootstrap
};
module.exports = exports['default'];
-/***/ },
+/***/ }),
/* 1 */
-/***/ function(module, exports, __webpack_require__) {
+/***/ (function(module, exports, __webpack_require__) {
'use strict';
@@ -277,6 +277,9 @@ return /******/ (function(modules) { // webpackBootstrap
} else {
hide();
}
+ }).on('touchmove', function (evt) {
+ evt.stopPropagation();
+ evt.preventDefault();
});
_sington = $dialogWrap[0];
@@ -286,9 +289,9 @@ return /******/ (function(modules) { // webpackBootstrap
exports.default = dialog;
module.exports = exports['default'];
-/***/ },
+/***/ }),
/* 2 */
-/***/ function(module, exports, __webpack_require__) {
+/***/ (function(module, exports, __webpack_require__) {
'use strict';
@@ -546,24 +549,17 @@ return /******/ (function(modules) { // webpackBootstrap
* @returns {*}
*/
attr: function attr() {
- var _arguments2 = arguments,
- _this3 = this;
+ var _arguments2 = arguments;
if (_typeof(arguments[0]) == 'object') {
- var _ret = function () {
- var attrsObj = _arguments2[0];
- var that = _this3;
- Object.keys(attrsObj).forEach(function (attr) {
- that.forEach(function ($element) {
- $element.setAttribute(attr, attrsObj[attr]);
- });
+ var attrsObj = arguments[0];
+ var that = this;
+ Object.keys(attrsObj).forEach(function (attr) {
+ that.forEach(function ($element) {
+ $element.setAttribute(attr, attrsObj[attr]);
});
- return {
- v: _this3
- };
- }();
-
- if ((typeof _ret === 'undefined' ? 'undefined' : _typeof(_ret)) === "object") return _ret.v;
+ });
+ return this;
}
if (typeof arguments[0] == 'string' && arguments.length < 2) {
@@ -652,9 +648,9 @@ return /******/ (function(modules) { // webpackBootstrap
exports.default = _balajs2.default;
module.exports = exports['default'];
-/***/ },
+/***/ }),
/* 3 */
-/***/ function(module, exports) {
+/***/ (function(module, exports) {
// element-closest | CC0-1.0 | github.com/jonathantneal/closest
@@ -691,12 +687,19 @@ return /******/ (function(modules) { // webpackBootstrap
})(window.Element.prototype);
-/***/ },
+/***/ }),
/* 4 */
-/***/ function(module, exports) {
+/***/ (function(module, exports) {
+
+ /*
+ object-assign
+ (c) Sindre Sorhus
+ @license MIT
+ */
'use strict';
/* eslint-disable no-unused-vars */
+ var getOwnPropertySymbols = Object.getOwnPropertySymbols;
var hasOwnProperty = Object.prototype.hasOwnProperty;
var propIsEnumerable = Object.prototype.propertyIsEnumerable;
@@ -717,7 +720,7 @@ return /******/ (function(modules) { // webpackBootstrap
// Detect buggy property enumeration order in older V8 versions.
// https://bugs.chromium.org/p/v8/issues/detail?id=4118
- var test1 = new String('abc'); // eslint-disable-line
+ var test1 = new String('abc'); // eslint-disable-line no-new-wrappers
test1[5] = 'de';
if (Object.getOwnPropertyNames(test1)[0] === '5') {
return false;
@@ -746,7 +749,7 @@ return /******/ (function(modules) { // webpackBootstrap
}
return true;
- } catch (e) {
+ } catch (err) {
// We don't expect any of the above to throw, but better to be safe.
return false;
}
@@ -766,8 +769,8 @@ return /******/ (function(modules) { // webpackBootstrap
}
}
- if (Object.getOwnPropertySymbols) {
- symbols = Object.getOwnPropertySymbols(from);
+ if (getOwnPropertySymbols) {
+ symbols = getOwnPropertySymbols(from);
for (var i = 0; i < symbols.length; i++) {
if (propIsEnumerable.call(from, symbols[i])) {
to[symbols[i]] = from[symbols[i]];
@@ -780,9 +783,9 @@ return /******/ (function(modules) { // webpackBootstrap
};
-/***/ },
+/***/ }),
/* 5 */
-/***/ function(module, exports, __webpack_require__) {
+/***/ (function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function(root, $) {
$ = (function(document, s_addEventListener, s_querySelectorAll) {
@@ -836,15 +839,15 @@ return /******/ (function(modules) { // webpackBootstrap
})(this);
-/***/ },
+/***/ }),
/* 6 */
-/***/ function(module, exports) {
+/***/ (function(module, exports) {
module.exports = "\">
weui-skin_android <% } %>\"> <% if(title){ %>
<%=title%>
<% } %>
<%=content%>
";
-/***/ },
+/***/ }),
/* 7 */
-/***/ function(module, exports, __webpack_require__) {
+/***/ (function(module, exports, __webpack_require__) {
'use strict';
@@ -938,9 +941,9 @@ return /******/ (function(modules) { // webpackBootstrap
exports.default = alert;
module.exports = exports['default'];
-/***/ },
+/***/ }),
/* 8 */
-/***/ function(module, exports, __webpack_require__) {
+/***/ (function(module, exports, __webpack_require__) {
'use strict';
@@ -1039,9 +1042,9 @@ return /******/ (function(modules) { // webpackBootstrap
exports.default = confirm;
module.exports = exports['default'];
-/***/ },
+/***/ }),
/* 9 */
-/***/ function(module, exports, __webpack_require__) {
+/***/ (function(module, exports, __webpack_require__) {
'use strict';
@@ -1140,15 +1143,15 @@ return /******/ (function(modules) { // webpackBootstrap
exports.default = toast;
module.exports = exports['default'];
-/***/ },
+/***/ }),
/* 10 */
-/***/ function(module, exports) {
+/***/ (function(module, exports) {
module.exports = " ";
-/***/ },
+/***/ }),
/* 11 */
-/***/ function(module, exports, __webpack_require__) {
+/***/ (function(module, exports, __webpack_require__) {
'use strict';
@@ -1240,15 +1243,15 @@ return /******/ (function(modules) { // webpackBootstrap
exports.default = loading;
module.exports = exports['default'];
-/***/ },
+/***/ }),
/* 12 */
-/***/ function(module, exports) {
+/***/ (function(module, exports) {
module.exports = " ";
-/***/ },
+/***/ }),
/* 13 */
-/***/ function(module, exports, __webpack_require__) {
+/***/ (function(module, exports, __webpack_require__) {
'use strict';
@@ -1295,6 +1298,7 @@ return /******/ (function(modules) { // webpackBootstrap
* @param {function} actions[].onClick 选项点击时的回调
*
* @param {object=} options 配置项
+ * @param {string=} options.title actionSheet的title,如果isAndroid=true,则不会显示
* @param {string=} options.className 自定义类名
* @param {function=} [options.onClose] actionSheet关闭后的回调
*
@@ -1341,6 +1345,7 @@ return /******/ (function(modules) { // webpackBootstrap
options = _util2.default.extend({
menus: menus,
actions: actions,
+ title: '',
className: '',
isAndroid: isAndroid,
onClose: _util2.default.noop
@@ -1391,15 +1396,15 @@ return /******/ (function(modules) { // webpackBootstrap
exports.default = actionSheet;
module.exports = exports['default'];
-/***/ },
+/***/ }),
/* 14 */
-/***/ function(module, exports) {
+/***/ (function(module, exports) {
- module.exports = "weui-skin_android <% } %><%= className %>\">
<% for(var j = 0; j < actions.length; j++){ %>
<%= actions[j].label %>
<% } %>
";
+ module.exports = "weui-skin_android <% } %><%= className %>\">
<% if(!isAndroid && title){ %>
<% } %>
<% for(var j = 0; j < actions.length; j++){ %>
<%= actions[j].label %>
<% } %>
";
-/***/ },
+/***/ }),
/* 15 */
-/***/ function(module, exports, __webpack_require__) {
+/***/ (function(module, exports, __webpack_require__) {
'use strict';
@@ -1511,15 +1516,15 @@ return /******/ (function(modules) { // webpackBootstrap
exports.default = topTips;
module.exports = exports['default'];
-/***/ },
+/***/ }),
/* 16 */
-/***/ function(module, exports) {
+/***/ (function(module, exports) {
module.exports = "\" style=display:block><%= content %>
";
-/***/ },
+/***/ }),
/* 17 */
-/***/ function(module, exports, __webpack_require__) {
+/***/ (function(module, exports, __webpack_require__) {
'use strict';
@@ -1613,9 +1618,9 @@ return /******/ (function(modules) { // webpackBootstrap
exports.default = searchBar;
module.exports = exports['default'];
-/***/ },
+/***/ }),
/* 18 */
-/***/ function(module, exports, __webpack_require__) {
+/***/ (function(module, exports, __webpack_require__) {
'use strict';
@@ -1716,9 +1721,9 @@ return /******/ (function(modules) { // webpackBootstrap
exports.default = tab;
module.exports = exports['default'];
-/***/ },
+/***/ }),
/* 19 */
-/***/ function(module, exports, __webpack_require__) {
+/***/ (function(module, exports, __webpack_require__) {
'use strict';
@@ -1726,22 +1731,6 @@ return /******/ (function(modules) { // webpackBootstrap
value: true
});
- var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; /*
- * Tencent is pleased to support the open source community by making WeUI.js available.
- *
- * Copyright (C) 2017 THL A29 Limited, a Tencent company. All rights reserved.
- *
- * Licensed under the MIT License (the "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://opensource.org/licenses/MIT
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License is
- * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
- * either express or implied. See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
var _util = __webpack_require__(2);
var _util2 = _interopRequireDefault(_util);
@@ -1752,6 +1741,22 @@ return /******/ (function(modules) { // webpackBootstrap
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+ /*
+ * Tencent is pleased to support the open source community by making WeUI.js available.
+ *
+ * Copyright (C) 2017 THL A29 Limited, a Tencent company. All rights reserved.
+ *
+ * Licensed under the MIT License (the "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://opensource.org/licenses/MIT
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is
+ * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+ * either express or implied. See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
function _findCellParent(ele) {
if (!ele || !ele.classList) return null;
if (ele.classList.contains('weui-cell')) return ele;
@@ -1772,45 +1777,33 @@ return /******/ (function(modules) { // webpackBootstrap
return 'empty';
} else if (input.type == 'checkbox') {
if (reg) {
- var _ret = function () {
- var checkboxInputs = $form.find('input[type="checkbox"][name="' + input.name + '"]');
- var regs = reg.replace(/[{\s}]/g, '').split(',');
- var count = 0;
+ var checkboxInputs = $form.find('input[type="checkbox"][name="' + input.name + '"]');
+ var regs = reg.replace(/[{\s}]/g, '').split(',');
+ var count = 0;
- if (regs.length != 2) {
- throw input.outerHTML + ' regexp is wrong.';
- }
+ if (regs.length != 2) {
+ throw input.outerHTML + ' regexp is wrong.';
+ }
- checkboxInputs.forEach(function (checkboxInput) {
- if (checkboxInput.checked) ++count;
- });
+ checkboxInputs.forEach(function (checkboxInput) {
+ if (checkboxInput.checked) ++count;
+ });
- if (regs[1] === '') {
- // {0,}
- if (count >= parseInt(regs[0])) {
- return {
- v: null
- };
- } else {
- return {
- v: count == 0 ? 'empty' : 'notMatch'
- };
- }
+ if (regs[1] === '') {
+ // {0,}
+ if (count >= parseInt(regs[0])) {
+ return null;
} else {
- // {0,2}
- if (parseInt(regs[0]) <= count && count <= parseInt(regs[1])) {
- return {
- v: null
- };
- } else {
- return {
- v: count == 0 ? 'empty' : 'notMatch'
- };
- }
+ return count == 0 ? 'empty' : 'notMatch';
}
- }();
-
- if ((typeof _ret === 'undefined' ? 'undefined' : _typeof(_ret)) === "object") return _ret.v;
+ } else {
+ // {0,2}
+ if (parseInt(regs[0]) <= count && count <= parseInt(regs[1])) {
+ return null;
+ } else {
+ return count == 0 ? 'empty' : 'notMatch';
+ }
+ }
} else {
return input.checked ? null : 'empty';
}
@@ -2011,9 +2004,9 @@ return /******/ (function(modules) { // webpackBootstrap
};
module.exports = exports['default'];
-/***/ },
+/***/ }),
/* 20 */
-/***/ function(module, exports, __webpack_require__) {
+/***/ (function(module, exports, __webpack_require__) {
'use strict';
@@ -2152,8 +2145,8 @@ return /******/ (function(modules) { // webpackBootstrap
*
* // return false; // 阻止文件上传
* },
- * onProgress: function(procent){
- * console.log(this, procent);
+ * onProgress: function(percent){
+ * console.log(this, percent);
* // return true; // 阻止默认行为,不使用默认的进度显示
* },
* onSuccess: function (ret) {
@@ -2231,82 +2224,70 @@ return /******/ (function(modules) { // webpackBootstrap
}
if (options.onBeforeQueued) {
- (function () {
- var onBeforeQueued = options.onBeforeQueued;
- options.onBeforeQueued = function (file, files) {
- var ret = onBeforeQueued.call(file, files);
- if (ret === false) {
- return false;
- }
- if (ret === true) {
- return;
- }
+ var onBeforeQueued = options.onBeforeQueued;
+ options.onBeforeQueued = function (file, files) {
+ var ret = onBeforeQueued.call(file, files);
+ if (ret === false) {
+ return false;
+ }
+ if (ret === true) {
+ return;
+ }
- var $item = (0, _util2.default)(_util2.default.render(_item2.default, {
- id: file.id
- }));
- $uploader.find('.weui-uploader__files').append($item);
- };
- })();
+ var $item = (0, _util2.default)(_util2.default.render(_item2.default, {
+ id: file.id
+ }));
+ $uploader.find('.weui-uploader__files').append($item);
+ };
}
if (options.onQueued) {
- (function () {
- var onQueued = options.onQueued;
- options.onQueued = function (file) {
- if (!onQueued.call(file)) {
- var $file = $uploader.find('[data-id="' + file.id + '"]');
- $file.css({
- backgroundImage: 'url("' + (file.base64 || file.url) + '")'
- });
- if (!options.auto) {
- clearFileStatus($uploader, file.id);
- }
+ var onQueued = options.onQueued;
+ options.onQueued = function (file) {
+ if (!onQueued.call(file)) {
+ var $file = $uploader.find('[data-id="' + file.id + '"]');
+ $file.css({
+ backgroundImage: 'url("' + (file.base64 || file.url) + '")'
+ });
+ if (!options.auto) {
+ clearFileStatus($uploader, file.id);
}
- };
- })();
+ }
+ };
}
if (options.onBeforeSend) {
- (function () {
- var onBeforeSend = options.onBeforeSend;
- options.onBeforeSend = function (file, data, headers) {
- var ret = onBeforeSend.call(file, data, headers);
- if (ret === false) {
- return false;
- }
- };
- })();
+ var onBeforeSend = options.onBeforeSend;
+ options.onBeforeSend = function (file, data, headers) {
+ var ret = onBeforeSend.call(file, data, headers);
+ if (ret === false) {
+ return false;
+ }
+ };
}
if (options.onSuccess) {
- (function () {
- var onSuccess = options.onSuccess;
- options.onSuccess = function (file, ret) {
- file.status = 'success';
- if (!onSuccess.call(file, ret)) {
- clearFileStatus($uploader, file.id);
- }
- };
- })();
+ var onSuccess = options.onSuccess;
+ options.onSuccess = function (file, ret) {
+ file.status = 'success';
+ if (!onSuccess.call(file, ret)) {
+ clearFileStatus($uploader, file.id);
+ }
+ };
}
if (options.onProgress) {
- (function () {
- var onProgress = options.onProgress;
- options.onProgress = function (file, percent) {
- if (!onProgress.call(file, percent)) {
- findFileCtn($uploader, file.id).html(percent + '%');
- }
- };
- })();
+ var onProgress = options.onProgress;
+ options.onProgress = function (file, percent) {
+ if (!onProgress.call(file, percent)) {
+ findFileCtn($uploader, file.id).html(percent + '%');
+ }
+ };
}
if (options.onError) {
- (function () {
- var onError = options.onError;
- options.onError = function (file, err) {
- file.status = 'fail';
- if (!onError.call(file, err)) {
- findFileCtn($uploader, file.id).html('');
- }
- };
- })();
+ var onError = options.onError;
+ options.onError = function (file, err) {
+ file.status = 'fail';
+ if (!onError.call(file, err)) {
+ findFileCtn($uploader, file.id).html('');
+ }
+ };
}
$uploader.find('input[type="file"]').on('change', function (evt) {
@@ -2344,15 +2325,15 @@ return /******/ (function(modules) { // webpackBootstrap
exports.default = uploader;
module.exports = exports['default'];
-/***/ },
+/***/ }),
/* 21 */
-/***/ function(module, exports) {
+/***/ (function(module, exports) {
module.exports = "\">
";
-/***/ },
+/***/ }),
/* 22 */
-/***/ function(module, exports) {
+/***/ (function(module, exports) {
'use strict';
@@ -2582,9 +2563,9 @@ return /******/ (function(modules) { // webpackBootstrap
};
module.exports = exports['default'];
-/***/ },
+/***/ }),
/* 23 */
-/***/ function(module, exports) {
+/***/ (function(module, exports) {
'use strict';
@@ -2687,9 +2668,9 @@ return /******/ (function(modules) { // webpackBootstrap
}
module.exports = exports['default'];
-/***/ },
+/***/ }),
/* 24 */
-/***/ function(module, exports, __webpack_require__) {
+/***/ (function(module, exports, __webpack_require__) {
'use strict';
@@ -2699,14 +2680,14 @@ return /******/ (function(modules) { // webpackBootstrap
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; /*
* Tencent is pleased to support the open source community by making WeUI.js available.
- *
+ *
* Copyright (C) 2017 THL A29 Limited, a Tencent company. All rights reserved.
- *
+ *
* Licensed under the MIT License (the "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
- *
+ *
* http://opensource.org/licenses/MIT
- *
+ *
* Unless required by applicable law or agreed to in writing, software distributed under the License is
* distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions and
@@ -3133,12 +3114,15 @@ return /******/ (function(modules) { // webpackBootstrap
* });
*/
function datePicker(options) {
+ var nowDate = new Date();
+
var defaults = _util2.default.extend({
id: 'datePicker',
onChange: _util2.default.noop,
onConfirm: _util2.default.noop,
- start: 2000,
- end: 2030,
+ start: nowDate.getFullYear() - 20,
+ end: nowDate.getFullYear() + 20,
+ defaultValue: [nowDate.getFullYear(), nowDate.getMonth() + 1, nowDate.getDate()],
cron: '* * *'
}, options);
@@ -3156,47 +3140,131 @@ return /******/ (function(modules) { // webpackBootstrap
var findBy = function findBy(array, key, value) {
for (var i = 0, len = array.length; i < len; i++) {
- var _obj = array[i];
- if (_obj[key] == value) {
- return _obj;
+ var obj = array[i];
+ if (obj[key] == value) {
+ return obj;
}
}
};
var date = [];
- var interval = _cron2.default.parse(defaults.cron, defaults.start, defaults.end);
- var obj = void 0;
- do {
- obj = interval.next();
-
- var year = obj.value.getFullYear();
- var month = obj.value.getMonth() + 1;
- var day = obj.value.getDate();
-
- var Y = findBy(date, 'value', year);
- if (!Y) {
- Y = {
- label: year + '年',
- value: year,
- children: []
- };
- date.push(Y);
+ if (typeof defaults.cron === 'string') {
+ var interval = _cron2.default.parse(defaults.cron, defaults.start, defaults.end);
+ var obj = void 0;
+ do {
+ obj = interval.next();
+
+ var year = obj.value.getFullYear();
+ var month = obj.value.getMonth() + 1;
+ var day = obj.value.getDate();
+
+ var Y = findBy(date, 'value', year);
+ if (!Y) {
+ Y = {
+ label: year + '年',
+ value: year,
+ children: []
+ };
+ date.push(Y);
+ }
+ var M = findBy(Y.children, 'value', month);
+ if (!M) {
+ M = {
+ label: month + '月',
+ value: month,
+ children: []
+ };
+ Y.children.push(M);
+ }
+ M.children.push({
+ label: day + '日',
+ value: day
+ });
+ } while (!obj.done);
+ return picker(date, defaults);
+ }
+
+ var date2arr = function date2arr(date) {
+ return [date.getFullYear(), date.getMonth() + 1, date.getDate()];
+ };
+ var hasLeapYear = function hasLeapYear(year) {
+ return year % 400 === 0 || year % 4 === 0 && year % 100 !== 0;
+ };
+ var createDaysArr = function createDaysArr(hasLeap, month, startMonth, endMonth, startDay, endDay) {
+ var daysArr = [];
+ var maxDays = hasLeap ? 29 : 28;
+ switch (month) {
+ case 1:
+ case 3:
+ case 5:
+ case 7:
+ case 8:
+ case 10:
+ case 12:
+ maxDays = 31;
+ break;
+ case 2:
+ maxDays = hasLeap ? 29 : 28;
+ break;
+ case 4:
+ case 6:
+ case 9:
+ case 11:
+ maxDays = 30;
+ break;
}
- var M = findBy(Y.children, 'value', month);
- if (!M) {
- M = {
- label: month + '月',
- value: month,
- children: []
- };
- Y.children.push(M);
+ startDay = startDay || 1;
+ endDay = endDay || maxDays;
+ if (month > startMonth) {
+ startDay = 1;
+ }
+ if (month < endMonth) {
+ endDay = maxDays;
+ }
+ if (startDay > maxDays) {
+ startDay = maxDays;
+ }
+ if (endDay > maxDays) {
+ endDay = maxDays;
+ }
+ for (var i = startDay; i <= endDay; i++) {
+ daysArr.push({ label: i + '日', value: i });
+ }
+ return daysArr;
+ };
+ var createMonthsObj = function createMonthsObj(year, startMonth, endMonth, startDay, endDay) {
+ var monthsArr = [];
+ var hasLeap = hasLeapYear(year);
+ for (var i = startMonth; i <= endMonth; i++) {
+ monthsArr.push({
+ label: i + '月',
+ value: i,
+ children: createDaysArr(hasLeap, i, startMonth, endMonth, startDay, endDay)
+ });
+ }
+ return monthsArr;
+ };
+ var startArr = date2arr(defaults.start);
+ var endArr = date2arr(defaults.end);
+ for (var _year = startArr[0]; _year <= endArr[0]; _year++) {
+ var startMonth = 1,
+ endMonth = 12,
+ startDay = void 0,
+ endDay = void 0;
+ if (_year === startArr[0]) {
+ startMonth = startArr[1];
+ startDay = startArr[2];
}
- M.children.push({
- label: day + '日',
- value: day
+ if (_year === endArr[0]) {
+ endMonth = endArr[1];
+ endDay = endArr[2];
+ }
+ date.push({
+ label: _year + '年',
+ value: _year,
+ children: createMonthsObj(_year, startMonth, endMonth, startDay, endDay)
});
- } while (!obj.done);
-
+ }
return picker(date, defaults);
}
@@ -3206,9 +3274,9 @@ return /******/ (function(modules) { // webpackBootstrap
};
module.exports = exports['default'];
-/***/ },
+/***/ }),
/* 25 */
-/***/ function(module, exports) {
+/***/ (function(module, exports) {
'use strict';
@@ -3415,9 +3483,9 @@ return /******/ (function(modules) { // webpackBootstrap
};
module.exports = exports['default'];
-/***/ },
+/***/ }),
/* 26 */
-/***/ function(module, exports, __webpack_require__) {
+/***/ (function(module, exports, __webpack_require__) {
'use strict';
@@ -3679,9 +3747,9 @@ return /******/ (function(modules) { // webpackBootstrap
}
};
-/***/ },
+/***/ }),
/* 27 */
-/***/ function(module, exports) {
+/***/ (function(module, exports) {
"use strict";
@@ -3712,21 +3780,21 @@ return /******/ (function(modules) { // webpackBootstrap
return depth;
};
-/***/ },
+/***/ }),
/* 28 */
-/***/ function(module, exports) {
+/***/ (function(module, exports) {
module.exports = " ";
-/***/ },
+/***/ }),
/* 29 */
-/***/ function(module, exports) {
+/***/ (function(module, exports) {
module.exports = "";
-/***/ },
+/***/ }),
/* 30 */
-/***/ function(module, exports, __webpack_require__) {
+/***/ (function(module, exports, __webpack_require__) {
'use strict';
@@ -3824,15 +3892,15 @@ return /******/ (function(modules) { // webpackBootstrap
exports.default = gallery;
module.exports = exports['default'];
-/***/ },
+/***/ }),
/* 31 */
-/***/ function(module, exports) {
+/***/ (function(module, exports) {
module.exports = " ";
-/***/ },
+/***/ }),
/* 32 */
-/***/ function(module, exports, __webpack_require__) {
+/***/ (function(module, exports, __webpack_require__) {
'use strict';
@@ -3983,7 +4051,7 @@ return /******/ (function(modules) { // webpackBootstrap
exports.default = slider;
module.exports = exports['default'];
-/***/ }
+/***/ })
/******/ ])
});
;
\ No newline at end of file
diff --git a/dist/weui.min.js b/dist/weui.min.js
index 385d968..a388388 100644
--- a/dist/weui.min.js
+++ b/dist/weui.min.js
@@ -1,7 +1,11 @@
/*!
- * weui.js v1.1.2 (https://weui.io)
- * Copyright 2017, wechat ui team
+ * weui.js v1.1.4 (https://weui.io)
+ * Copyright 2019, wechat ui team
* MIT license
*/
-!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.weui=t():e.weui=t()}(this,function(){return function(e){function t(i){if(n[i])return n[i].exports;var o=n[i]={exports:{},id:i,loaded:!1};return e[i].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(1),a=i(o),r=n(7),u=i(r),l=n(8),s=i(l),d=n(9),f=i(d),c=n(11),p=i(c),h=n(13),v=i(h),m=n(15),y=i(m),w=n(17),g=i(w),_=n(18),b=i(_),k=n(19),x=i(k),C=n(20),M=i(C),j=n(24),E=n(30),S=i(E),O=n(32),P=i(O);t.default={dialog:a.default,alert:u.default,confirm:s.default,toast:f.default,loading:p.default,actionSheet:v.default,topTips:y.default,searchBar:g.default,tab:b.default,form:x.default,uploader:M.default,picker:j.picker,datePicker:j.datePicker,gallery:S.default,slider:P.default},e.exports=t.default},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function o(){function e(t){e=r.default.noop,u.addClass("weui-animate-fade-out"),a.addClass("weui-animate-fade-out").on("animationend webkitAnimationEnd",function(){o.remove(),s=!1,t&&t()})}function t(t){e(t)}var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(s)return s;var i=r.default.os.android;n=r.default.extend({title:null,content:"",className:"",buttons:[{label:"确定",type:"primary",onClick:r.default.noop}],isAndroid:i},n);var o=(0,r.default)(r.default.render(l.default,n)),a=o.find(".weui-dialog"),u=o.find(".weui-mask");return(0,r.default)("body").append(o),u.addClass("weui-animate-fade-in"),a.addClass("weui-animate-fade-in"),o.on("click",".weui-dialog__btn",function(e){var i=(0,r.default)(this).index();n.buttons[i].onClick?n.buttons[i].onClick.call(this,e)!==!1&&t():t()}),s=o[0],s.hide=t,s}Object.defineProperty(t,"__esModule",{value:!0});var a=n(2),r=i(a),u=n(6),l=i(u),s=void 0;t.default=o,e.exports=t.default},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function o(e){var t=this.os={},n=e.match(/(Android);?[\s\/]+([\d.]+)?/);n&&(t.android=!0,t.version=n[2])}Object.defineProperty(t,"__esModule",{value:!0});var a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};n(3);var r=n(4),u=i(r),l=n(5),s=i(l);o.call(s.default,navigator.userAgent),(0,u.default)(s.default.fn,{append:function(e){return e instanceof HTMLElement||(e=e[0]),this.forEach(function(t){t.appendChild(e)}),this},remove:function(){return this.forEach(function(e){e.parentNode.removeChild(e)}),this},find:function(e){return(0,s.default)(e,this)},addClass:function(e){return this.forEach(function(t){t.classList.add(e)}),this},removeClass:function(e){return this.forEach(function(t){t.classList.remove(e)}),this},eq:function(e){return(0,s.default)(this[e])},show:function(){return this.forEach(function(e){e.style.display="block"}),this},hide:function(){return this.forEach(function(e){e.style.display="none"}),this},html:function(e){return this.forEach(function(t){t.innerHTML=e}),this},css:function(e){var t=this;return Object.keys(e).forEach(function(n){t.forEach(function(t){t.style[n]=e[n]})}),this},on:function(e,t,n){var i="string"==typeof t&&"function"==typeof n;return i||(n=t),this.forEach(function(o){e.split(" ").forEach(function(e){o.addEventListener(e,function(e){i?this.contains(e.target.closest(t))&&n.call(e.target,e):n.call(this,e)})})}),this},off:function(e,t,n){return"function"==typeof t&&(n=t,t=null),this.forEach(function(i){e.split(" ").forEach(function(e){"string"==typeof t?i.querySelectorAll(t).forEach(function(t){t.removeEventListener(e,n)}):i.removeEventListener(e,n)})}),this},index:function(){var e=this[0],t=e.parentNode;return Array.prototype.indexOf.call(t.children,e)},offAll:function(){var e=this;return this.forEach(function(t,n){var i=t.cloneNode(!0);t.parentNode.replaceChild(i,t),e[n]=i}),this},val:function(){var e=arguments;return arguments.length?(this.forEach(function(t){t.value=e[0]}),this):this[0].value},attr:function(){var e=arguments,t=this;if("object"==a(arguments[0])){var n=function(){var n=e[0],i=t;return Object.keys(n).forEach(function(e){i.forEach(function(t){t.setAttribute(e,n[e])})}),{v:t}}();if("object"===("undefined"==typeof n?"undefined":a(n)))return n.v}return"string"==typeof arguments[0]&&arguments.length<2?this[0].getAttribute(arguments[0]):(this.forEach(function(t){t.setAttribute(e[0],e[1])}),this)}}),(0,u.default)(s.default,{extend:u.default,noop:function(){},render:function(e,t){var n="var p=[];with(this){p.push('"+e.replace(/[\r\t\n]/g," ").split("<%").join("\t").replace(/((^|%>)[^\t]*)'/g,"$1\r").replace(/\t=(.*?)%>/g,"',$1,'").split("\t").join("');").split("%>").join("p.push('").split("\r").join("\\'")+"');}return p.join('');";return new Function(n).apply(t)},getStyle:function(e,t){var n,i=(e.ownerDocument||document).defaultView;return i&&i.getComputedStyle?(t=t.replace(/([A-Z])/g,"-$1").toLowerCase(),i.getComputedStyle(e,null).getPropertyValue(t)):e.currentStyle?(t=t.replace(/\-(\w)/g,function(e,t){return t.toUpperCase()}),n=e.currentStyle[t],/^\d+(em|pt|%|ex)?$/i.test(n)?function(t){var n=e.style.left,i=e.runtimeStyle.left;return e.runtimeStyle.left=e.currentStyle.left,e.style.left=t||0,t=e.style.pixelLeft+"px",e.style.left=n,e.runtimeStyle.left=i,t}(n):n):void 0}}),t.default=s.default,e.exports=t.default},function(e,t){!function(e){"function"!=typeof e.matches&&(e.matches=e.msMatchesSelector||e.mozMatchesSelector||e.webkitMatchesSelector||function(e){for(var t=this,n=(t.document||t.ownerDocument).querySelectorAll(e),i=0;n[i]&&n[i]!==t;)++i;return Boolean(n[i])}),"function"!=typeof e.closest&&(e.closest=function(e){for(var t=this;t&&1===t.nodeType;){if(t.matches(e))return t;t=t.parentNode}return null})}(window.Element.prototype)},function(e,t){"use strict";function n(e){if(null===e||void 0===e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}function i(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;var i=Object.getOwnPropertyNames(t).map(function(e){return t[e]});if("0123456789"!==i.join(""))return!1;var o={};return"abcdefghijklmnopqrst".split("").forEach(function(e){o[e]=e}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},o)).join("")}catch(e){return!1}}var o=Object.prototype.hasOwnProperty,a=Object.prototype.propertyIsEnumerable;e.exports=i()?Object.assign:function(e,t){for(var i,r,u=n(e),l=1;l <% if(title){ %>
<%=title%>
<% } %>
<%=content%>
'},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function o(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:u.default.noop,n=arguments[2];return"object"===("undefined"==typeof t?"undefined":a(t))&&(n=t,t=u.default.noop),n=u.default.extend({content:e,buttons:[{label:"确定",type:"primary",onClick:t}]},n),(0,s.default)(n)}Object.defineProperty(t,"__esModule",{value:!0});var a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r=n(2),u=i(r),l=n(1),s=i(l);t.default=o,e.exports=t.default},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function o(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:u.default.noop,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:u.default.noop,i=arguments[3];return"object"===("undefined"==typeof t?"undefined":a(t))?(i=t,t=u.default.noop):"object"===("undefined"==typeof n?"undefined":a(n))&&(i=n,n=u.default.noop),i=u.default.extend({content:e,buttons:[{label:"取消",type:"default",onClick:n},{label:"确定",type:"primary",onClick:t}]},i),(0,s.default)(i)}Object.defineProperty(t,"__esModule",{value:!0});var a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r=n(2),u=i(r),l=n(1),s=i(l);t.default=o,e.exports=t.default},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function o(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(s)return s;"number"==typeof t&&(t={duration:t}),"function"==typeof t&&(t={callback:t}),t=r.default.extend({content:e,duration:3e3,callback:r.default.noop,className:""},t);var n=(0,r.default)(r.default.render(l.default,t)),i=n.find(".weui-toast"),o=n.find(".weui-mask");return(0,r.default)("body").append(n),i.addClass("weui-animate-fade-in"),o.addClass("weui-animate-fade-in"),setTimeout(function(){o.addClass("weui-animate-fade-out"),i.addClass("weui-animate-fade-out").on("animationend webkitAnimationEnd",function(){n.remove(),s=!1,t.callback()})},t.duration),s=n[0],n[0]}Object.defineProperty(t,"__esModule",{value:!0});var a=n(2),r=i(a),u=n(10),l=i(u),s=void 0;t.default=o,e.exports=t.default},function(e,t){e.exports=' '},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function o(){function e(t){e=r.default.noop,u.addClass("weui-animate-fade-out"),a.addClass("weui-animate-fade-out").on("animationend webkitAnimationEnd",function(){o.remove(),s=!1,t&&t()})}function t(t){e(t)}var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(s)return s;i=r.default.extend({content:n,className:""},i);var o=(0,r.default)(r.default.render(l.default,i)),a=o.find(".weui-toast"),u=o.find(".weui-mask");return(0,r.default)("body").append(o),a.addClass("weui-animate-fade-in"),u.addClass("weui-animate-fade-in"),s=o[0],s.hide=t,s}Object.defineProperty(t,"__esModule",{value:!0});var a=n(2),r=i(a),u=n(12),l=i(u),s=void 0;t.default=o,e.exports=t.default},function(e,t){e.exports=' '},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function o(){function e(t){e=r.default.noop,d.addClass(o.isAndroid?"weui-animate-fade-out":"weui-animate-slide-down"),f.addClass("weui-animate-fade-out").on("animationend webkitAnimationEnd",function(){u.remove(),s=!1,o.onClose(),t&&t()})}function t(t){e(t)}var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(s)return s;var a=r.default.os.android;o=r.default.extend({menus:n,actions:i,className:"",isAndroid:a,onClose:r.default.noop},o);var u=(0,r.default)(r.default.render(l.default,o)),d=u.find(".weui-actionsheet"),f=u.find(".weui-mask");return(0,r.default)("body").append(u),r.default.getStyle(d[0],"transform"),d.addClass(o.isAndroid?"weui-animate-fade-in":"weui-animate-slide-up"),f.addClass("weui-animate-fade-in").on("click",function(){t()}),u.find(".weui-actionsheet__menu").on("click",".weui-actionsheet__cell",function(e){var i=(0,r.default)(this).index();n[i].onClick.call(this,e),t()}),u.find(".weui-actionsheet__action").on("click",".weui-actionsheet__cell",function(e){var n=(0,r.default)(this).index();i[n].onClick.call(this,e),t()}),s=u[0],s.hide=t,s}Object.defineProperty(t,"__esModule",{value:!0});var a=n(2),r=i(a),u=n(14),l=i(u),s=void 0;t.default=o,e.exports=t.default},function(e,t){e.exports=' <% for(var j = 0; j < actions.length; j++){ %>
<%= actions[j].label %>
<% } %>
'},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function o(e){function t(e){t=r.default.noop,o.remove(),e&&e(),i.callback(),s=null}function n(e){t(e)}var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};"number"==typeof i&&(i={duration:i}),"function"==typeof i&&(i={callback:i}),i=r.default.extend({content:e,duration:3e3,callback:r.default.noop,className:""},i);var o=(0,r.default)(r.default.render(l.default,i));return(0,r.default)("body").append(o),s&&(clearTimeout(s.timeout),s.hide()),s={hide:n},s.timeout=setTimeout(n,i.duration),o[0].hide=n,o[0]}Object.defineProperty(t,"__esModule",{value:!0});var a=n(2),r=i(a),u=n(16),l=i(u),s=null;t.default=o,e.exports=t.default},function(e,t){e.exports='<%= content %>
'},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function o(e){var t=(0,r.default)(e);return t.forEach(function(e){function t(){o.val(""),n.removeClass("weui-search-bar_focusing")}var n=(0,r.default)(e),i=n.find(".weui-search-bar__label"),o=n.find(".weui-search-bar__input"),a=n.find(".weui-icon-clear"),u=n.find(".weui-search-bar__cancel-btn");i.on("click",function(){n.addClass("weui-search-bar_focusing"),o[0].focus()}),o.on("blur",function(){this.value.length||t()}),a.on("click",function(){o.val(""),o[0].focus()}),u.on("click",function(){t(),o[0].blur()})}),t}Object.defineProperty(t,"__esModule",{value:!0});var a=n(2),r=i(a);t.default=o,e.exports=t.default},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function o(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=(0,r.default)(e);return t=r.default.extend({defaultIndex:0,onChange:r.default.noop},t),n.forEach(function(e){var n=(0,r.default)(e),i=n.find(".weui-navbar__item, .weui-tabbar__item"),o=n.find(".weui-tab__content");i.eq(t.defaultIndex).addClass("weui-bar__item_on"),o.eq(t.defaultIndex).show(),i.on("click",function(){var e=(0,r.default)(this),n=e.index();i.removeClass("weui-bar__item_on"),e.addClass("weui-bar__item_on"),o.hide(),o.eq(n).show(),t.onChange.call(this,n)})}),this}Object.defineProperty(t,"__esModule",{value:!0});var a=n(2),r=i(a);t.default=o,e.exports=t.default},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function o(e){return e&&e.classList?e.classList.contains("weui-cell")?e:o(e.parentNode):null}function a(e,t,n){var i=e[0],o=e.val();if("INPUT"==i.tagName||"TEXTAREA"==i.tagName){var a=i.getAttribute("pattern")||"";if("radio"==i.type){for(var r=t.find('input[type="radio"][name="'+i.name+'"]'),u=0,l=r.length;u=parseInt(n[0])?{v:null}:{v:0==o?"empty":"notMatch"}:parseInt(n[0])<=o&&o<=parseInt(n[1])?{v:null}:{v:0==o?"empty":"notMatch"}}();if("object"===("undefined"==typeof s?"undefined":d(s)))return s.v}else if(o.length)return null;return"empty"}function r(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:c.default.noop,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=(0,c.default)(e);return i.forEach(function(e){var i=(0,c.default)(e),o=i.find("[required]");"function"!=typeof t&&(t=l);for(var r=0,u=o.length;r1&&void 0!==arguments[1]?arguments[1]:{},n=(0,c.default)(e);return n.forEach(function(e){var n=(0,c.default)(e);n.find("[required]").on("blur",function(){if("checkbox"!=this.type&&"radio"!=this.type){var e=(0,c.default)(this);if(!(e.val().length<1)){var i=a(e,n,t.regexp);i&&l({ele:e[0],msg:i})}}}).on("focus",function(){s(this)})}),this}function l(e){if(e){var t=(0,c.default)(e.ele),n=e.msg,i=t.attr(n+"Tips")||t.attr("tips")||t.attr("placeholder");if(i&&(0,h.default)(i),"checkbox"==e.ele.type||"radio"==e.ele.type)return;var a=o(e.ele);a&&a.classList.add("weui-cell_warn")}}function s(e){var t=o(e);t&&t.classList.remove("weui-cell_warn")}Object.defineProperty(t,"__esModule",{value:!0});var d="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},f=n(2),c=i(f),p=n(15),h=i(p);t.default={showErrorTips:l,hideErrorTips:s,validate:r,checkIfBlur:u},e.exports=t.default},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function o(e,t){function n(e,t){var n=e.find('[data-id="'+t+'"]'),i=n.find(".weui-uploader__file-content");return i.length||(i=(0,r.default)(''),n.append(i)),n.addClass("weui-uploader__file_status"),i}function i(e,t){var n=e.find('[data-id="'+t+'"]').removeClass("weui-uploader__file_status");n.find(".weui-uploader__file-content").remove()}function o(e){e.url=u.createObjectURL(e),e.status="ready",e.upload=function(){(0,f.default)(r.default.extend({$uploader:a,file:e},t))},e.stop=function(){this.xhr.abort()},t.onQueued(e),t.auto&&e.upload()}var a=(0,r.default)(e),u=window.URL||window.webkitURL||window.mozURL;t=r.default.extend({url:"",auto:!0,type:"file",fileVal:"file",xhrFields:{},onBeforeQueued:r.default.noop,onQueued:r.default.noop,onBeforeSend:r.default.noop,onSuccess:r.default.noop,onProgress:r.default.noop,onError:r.default.noop},t),t.compress!==!1&&(t.compress=r.default.extend({width:1600,height:1600,quality:.8},t.compress)),t.onBeforeQueued&&!function(){var e=t.onBeforeQueued;t.onBeforeQueued=function(t,n){var i=e.call(t,n);if(i===!1)return!1;if(i!==!0){var o=(0,r.default)(r.default.render(l.default,{id:t.id}));a.find(".weui-uploader__files").append(o)}}}(),t.onQueued&&!function(){var e=t.onQueued;t.onQueued=function(n){if(!e.call(n)){var o=a.find('[data-id="'+n.id+'"]');o.css({backgroundImage:'url("'+(n.base64||n.url)+'")'}),t.auto||i(a,n.id)}}}(),t.onBeforeSend&&!function(){var e=t.onBeforeSend;t.onBeforeSend=function(t,n,i){var o=e.call(t,n,i);if(o===!1)return!1}}(),t.onSuccess&&!function(){var e=t.onSuccess;t.onSuccess=function(t,n){t.status="success",e.call(t,n)||i(a,t.id)}}(),t.onProgress&&!function(){var e=t.onProgress;t.onProgress=function(t,i){e.call(t,i)||n(a,t.id).html(i+"%")}}(),t.onError&&!function(){var e=t.onError;t.onError=function(t,i){t.status="fail",e.call(t,i)||n(a,t.id).html('')}}(),a.find('input[type="file"]').on("change",function(e){var n=e.target.files;0!==n.length&&(t.compress===!1&&"file"==t.type?Array.prototype.forEach.call(n,function(e){e.id=++c,t.onBeforeQueued(e,n)!==!1&&o(e)}):Array.prototype.forEach.call(n,function(e){e.id=++c,t.onBeforeQueued(e,n)!==!1&&(0,s.compress)(e,t,function(e){e&&o(e)})}),this.value="")})}Object.defineProperty(t,"__esModule",{value:!0});var a=n(2),r=i(a),u=n(21),l=i(u),s=n(22),d=n(23),f=i(d),c=0;t.default=o,e.exports=t.default},function(e,t){e.exports='
'},function(e,t){"use strict";function n(e){var t,n=e.naturalHeight,i=document.createElement("canvas");i.width=1,i.height=n;var o=i.getContext("2d");o.drawImage(e,0,0);try{t=o.getImageData(0,0,1,n).data}catch(e){return 1}for(var a=0,r=n,u=n;u>a;){var l=t[4*(u-1)+3];0===l?r=u:a=u,u=r+a>>1}var s=u/n;return 0===s?1:s}function i(e){for(var t=atob(e.split(",")[1]),n=new ArrayBuffer(t.length),i=new Uint8Array(n),o=0;o4&&(e.width=o,e.height=i),n){case 2:t.translate(i,0),t.scale(-1,1);break;case 3:t.translate(i,o),t.rotate(Math.PI);break;case 4:t.translate(0,o),t.scale(1,-1);break;case 5:t.rotate(.5*Math.PI),t.scale(1,-1);break;case 6:t.rotate(.5*Math.PI),t.translate(0,-o);break;case 7:t.rotate(.5*Math.PI),t.translate(i,-o),t.scale(-1,1);break;case 8:t.rotate(-.5*Math.PI),t.translate(-i,0)}}function u(e,t,u){var l=new FileReader;l.onload=function(l){if(t.compress===!1)return e.base64=l.target.result,void u(e);var s=new Image;s.onload=function(){var l=n(s),d=a(i(s.src)),f=document.createElement("canvas"),c=f.getContext("2d"),p=t.compress.width,h=t.compress.height,v=s.width,m=s.height,y=void 0;if(vh?(v=parseInt(h*s.width/s.height),m=h):v>=m&&v>p&&(m=parseInt(p*s.height/s.width),v=p),f.width=v,f.height=m,d>0&&r(f,c,d),c.drawImage(s,0,0,v,m/l),y=/image\/jpeg/.test(e.type)||/image\/jpg/.test(e.type)?f.toDataURL("image/jpeg",t.compress.quality):f.toDataURL(e.type),"file"==t.type)if(/;base64,null/.test(y)||/;base64,$/.test(y))u(e);else{var w=o(y);w.id=e.id,w.name=e.name,w.lastModified=e.lastModified,w.lastModifiedDate=e.lastModifiedDate,u(w)}else/;base64,null/.test(y)||/;base64,$/.test(y)?(t.onError(e,new Error("Compress fail, dataURL is "+y+".")),u()):(e.base64=y,u(e))},s.src=l.target.result},l.readAsDataURL(e)}Object.defineProperty(t,"__esModule",{value:!0}),t.default={compress:u},e.exports=t.default},function(e,t){"use strict";function n(e){var t=e.url,n=e.file,i=e.fileVal,o=e.onBeforeSend,a=e.onProgress,r=e.onError,u=e.onSuccess,l=e.xhrFields,s=n.name,d=n.type,f=n.lastModifiedDate,c={name:s,type:d,size:"file"==e.type?n.size:n.base64.length,lastModifiedDate:f},p={};if(o(n,c,p)!==!1){n.status="progress",a(n,0);var h=new FormData,v=new XMLHttpRequest;n.xhr=v,Object.keys(c).forEach(function(e){h.append(e,c[e])}),"file"==e.type?h.append(i,n,s):h.append(i,n.base64),v.onreadystatechange=function(){if(4==v.readyState)if(200==v.status)try{var e=JSON.parse(v.responseText);u(n,e)}catch(e){r(n,e)}else r(n,new Error("XMLHttpRequest response status is "+v.status))},v.upload.addEventListener("progress",function(e){if(0!=e.total){var t=100*Math.ceil(e.loaded/e.total);a(n,t)}},!1),v.open("POST",t),Object.keys(l).forEach(function(e){v[e]=l[e]}),Object.keys(p).forEach(function(e){v.setRequestHeader(e,p[e])}),v.send(h)}}Object.defineProperty(t,"__esModule",{value:!0}),t.default=n,e.exports=t.default},function(e,t,n){"use strict";function i(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}function o(e){return e&&e.__esModule?e:{default:e}}function a(e){"object"!=("undefined"==typeof e?"undefined":l(e))&&(e={label:e,value:e}),d.default.extend(this,e)}function r(){function e(){(0,d.default)(r.container).append(v),d.default.getStyle(v[0],"transform"),v.find(".weui-mask").addClass("weui-animate-fade-in"),v.find(".weui-picker").addClass("weui-animate-slide-up")}function t(e){t=d.default.noop,v.find(".weui-mask").addClass("weui-animate-fade-out"),v.find(".weui-picker").addClass("weui-animate-slide-down").on("animationend webkitAnimationEnd",function(){v.remove(),g=!1,r.onClose(),e&&e()})}function n(e){t(e)}function i(e,t){if(void 0===p[t]&&r.defaultValue&&void 0!==r.defaultValue[t]){var n=r.defaultValue[t],o=0,u=e.length;if("object"==l(e[o]))for(;o0)v.find(".weui-picker__group").eq(t+1).show(),!s&&i(e.children,t+1);else{var o=v.find(".weui-picker__group");o.forEach(function(e,n){n>t&&(0,d.default)(e).hide()}),c.splice(t+1),r.onChange(c)}},onConfirm:r.onConfirm})}if(g)return g;var o=arguments[arguments.length-1],r=d.default.extend({id:"default",className:"",container:"body",onChange:d.default.noop,onConfirm:d.default.noop,onClose:d.default.noop},o),u=void 0,s=!1;if(arguments.length>2){var f=0;for(u=[];fe.length)throw new Error("No selectable item.");return t},d=function(e,t,n){var i=s(n);return(e-i)*t},f=function(e,t){return e*t},c=function(e,t,n){return-(t*(n-e-1))};r.default.fn.scroll=function(e){function t(e){y=e,g=+new Date}function n(e){w=e;var t=w-y;u(m,0),l(m,_+t),g=+new Date,b.push({time:g,y:w}),b.length>40&&b.shift()}function i(e){if(y){var t=(new Date).getTime(),n=k-p.bodyHeight/2;if(w=e,t-g>100)M(Math.abs(w-y)>10?w-y:n-w);else if(Math.abs(w-y)>10){for(var i=b.length-1,o=i,a=i;a>0&&g-b[a].time<100;a--)o=a;if(o!==i){var r=b[i],u=b[o],l=r.time-u.time,s=r.y-u.y,d=s/l,f=150*d+(w-y);M(f)}else M(0)}else M(n-w);y=null}}var a=this,p=r.default.extend({items:[],scrollable:".weui-picker__content",offset:3,rowHeight:34,onChange:r.default.noop,temp:null,bodyHeight:238},e),h=p.items.map(function(e){return''+("object"==("undefined"==typeof e?"undefined":o(e))?e.label:e)+"
"}).join(""),v=(0,r.default)(this);v.find(".weui-picker__content").html(h);var m=v.find(p.scrollable),y=void 0,w=void 0,g=void 0,_=void 0,b=[],k=window.innerHeight;
-if(null!==p.temp&&p.tempt&&(_=t),_0?++i:--i;_=(p.offset-i)*p.rowHeight,u(m,.3),l(m,_),p.onChange.call(a,p.items[i],i)};m=v.offAll().on("touchstart",function(e){t(e.changedTouches[0].pageY)}).on("touchmove",function(e){n(e.changedTouches[0].pageY),e.preventDefault()}).on("touchend",function(e){i(e.changedTouches[0].pageY)}).find(p.scrollable);var j="ontouchstart"in window||window.DocumentTouch&&document instanceof window.DocumentTouch;j||v.on("mousedown",function(e){t(e.pageY),e.stopPropagation(),e.preventDefault()}).on("mousemove",function(e){y&&(n(e.pageY),e.stopPropagation(),e.preventDefault())}).on("mouseup mouseleave",function(e){i(e.pageY),e.stopPropagation(),e.preventDefault()})}},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.depthOf=function e(t){var n=1;return t.children&&t.children[0]&&(n=e(t.children[0])+1),n}},function(e,t){e.exports=' '},function(e,t){e.exports=""},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function o(e){function t(e){t=r.default.noop,o.addClass("weui-animate-fade-out").on("animationend webkitAnimationEnd",function(){o.remove(),s=!1,e&&e()})}function n(e){t(e)}var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(s)return s;i=r.default.extend({className:"",onDelete:r.default.noop},i);var o=(0,r.default)(r.default.render(l.default,r.default.extend({url:e},i)));return(0,r.default)("body").append(o),o.find(".weui-gallery__img").on("click",function(){n()}),o.find(".weui-gallery__del").on("click",function(){i.onDelete.call(this,e)}),o.show().addClass("weui-animate-fade-in"),s=o[0],s.hide=n,s}Object.defineProperty(t,"__esModule",{value:!0});var a=n(2),r=i(a),u=n(31),l=i(u),s=void 0;t.default=o,e.exports=t.default},function(e,t){e.exports=' '},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function o(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=(0,r.default)(e);if(t=r.default.extend({step:void 0,defaultValue:0,onChange:r.default.noop},t),void 0!==t.step&&(t.step=parseFloat(t.step),!t.step||t.step<0))throw new Error("Slider step must be a positive number.");if(void 0!==t.defaultValue&&t.defaultValue<0||t.defaultValue>100)throw new Error("Slider defaultValue must be >= 0 and <= 100.");return n.forEach(function(e){function n(){var e=r.default.getStyle(l[0],"left");return e=/%/.test(e)?s*parseFloat(e)/100:parseFloat(e)}function i(n){var i=void 0,o=void 0;t.step&&(n=Math.round(n/p)*p),i=f+n,i=i<0?0:i>s?s:i,o=100*i/s,u.css({width:o+"%"}),l.css({left:o+"%"}),t.onChange.call(e,o)}var o=(0,r.default)(e),a=o.find(".weui-slider__inner"),u=o.find(".weui-slider__track"),l=o.find(".weui-slider__handler"),s=parseInt(r.default.getStyle(a[0],"width")),d=a[0].offsetLeft,f=0,c=0,p=void 0;t.step&&(p=s*t.step/100),t.defaultValue&&i(s*t.defaultValue/100),o.on("click",function(e){e.preventDefault(),f=n(),i(e.pageX-d-f)}),l.on("touchstart",function(e){f=n(),c=e.changedTouches[0].clientX}).on("touchmove",function(e){e.preventDefault(),i(e.changedTouches[0].clientX-c)})}),this}Object.defineProperty(t,"__esModule",{value:!0});var a=n(2),r=i(a);t.default=o,e.exports=t.default}])});
\ No newline at end of file
+!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.weui=t():e.weui=t()}(this,function(){return function(e){function t(i){if(n[i])return n[i].exports;var a=n[i]={exports:{},id:i,loaded:!1};return e[i].call(a.exports,a,a.exports,t),a.loaded=!0,a.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var a=n(1),o=i(a),r=n(7),u=i(r),l=n(8),s=i(l),d=n(9),f=i(d),c=n(11),p=i(c),h=n(13),v=i(h),m=n(15),g=i(m),w=n(17),y=i(w),_=n(18),b=i(_),k=n(19),x=i(k),M=n(20),C=i(M),E=n(24),j=n(30),S=i(j),O=n(32),P=i(O);t.default={dialog:o.default,alert:u.default,confirm:s.default,toast:f.default,loading:p.default,actionSheet:v.default,topTips:g.default,searchBar:y.default,tab:b.default,form:x.default,uploader:C.default,picker:E.picker,datePicker:E.datePicker,gallery:S.default,slider:P.default},e.exports=t.default},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function a(){function e(t){e=r.default.noop,u.addClass("weui-animate-fade-out"),o.addClass("weui-animate-fade-out").on("animationend webkitAnimationEnd",function(){a.remove(),s=!1,t&&t()})}function t(t){e(t)}var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(s)return s;var i=r.default.os.android;n=r.default.extend({title:null,content:"",className:"",buttons:[{label:"确定",type:"primary",onClick:r.default.noop}],isAndroid:i},n);var a=(0,r.default)(r.default.render(l.default,n)),o=a.find(".weui-dialog"),u=a.find(".weui-mask");return(0,r.default)("body").append(a),u.addClass("weui-animate-fade-in"),o.addClass("weui-animate-fade-in"),a.on("click",".weui-dialog__btn",function(e){var i=(0,r.default)(this).index();n.buttons[i].onClick?n.buttons[i].onClick.call(this,e)!==!1&&t():t()}).on("touchmove",function(e){e.stopPropagation(),e.preventDefault()}),s=a[0],s.hide=t,s}Object.defineProperty(t,"__esModule",{value:!0});var o=n(2),r=i(o),u=n(6),l=i(u),s=void 0;t.default=a,e.exports=t.default},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function a(e){var t=this.os={},n=e.match(/(Android);?[\s\/]+([\d.]+)?/);n&&(t.android=!0,t.version=n[2])}Object.defineProperty(t,"__esModule",{value:!0});var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};n(3);var r=n(4),u=i(r),l=n(5),s=i(l);a.call(s.default,navigator.userAgent),(0,u.default)(s.default.fn,{append:function(e){return e instanceof HTMLElement||(e=e[0]),this.forEach(function(t){t.appendChild(e)}),this},remove:function(){return this.forEach(function(e){e.parentNode.removeChild(e)}),this},find:function(e){return(0,s.default)(e,this)},addClass:function(e){return this.forEach(function(t){t.classList.add(e)}),this},removeClass:function(e){return this.forEach(function(t){t.classList.remove(e)}),this},eq:function(e){return(0,s.default)(this[e])},show:function(){return this.forEach(function(e){e.style.display="block"}),this},hide:function(){return this.forEach(function(e){e.style.display="none"}),this},html:function(e){return this.forEach(function(t){t.innerHTML=e}),this},css:function(e){var t=this;return Object.keys(e).forEach(function(n){t.forEach(function(t){t.style[n]=e[n]})}),this},on:function(e,t,n){var i="string"==typeof t&&"function"==typeof n;return i||(n=t),this.forEach(function(a){e.split(" ").forEach(function(e){a.addEventListener(e,function(e){i?this.contains(e.target.closest(t))&&n.call(e.target,e):n.call(this,e)})})}),this},off:function(e,t,n){return"function"==typeof t&&(n=t,t=null),this.forEach(function(i){e.split(" ").forEach(function(e){"string"==typeof t?i.querySelectorAll(t).forEach(function(t){t.removeEventListener(e,n)}):i.removeEventListener(e,n)})}),this},index:function(){var e=this[0],t=e.parentNode;return Array.prototype.indexOf.call(t.children,e)},offAll:function(){var e=this;return this.forEach(function(t,n){var i=t.cloneNode(!0);t.parentNode.replaceChild(i,t),e[n]=i}),this},val:function(){var e=arguments;return arguments.length?(this.forEach(function(t){t.value=e[0]}),this):this[0].value},attr:function(){var e=arguments;if("object"==o(arguments[0])){var t=arguments[0],n=this;return Object.keys(t).forEach(function(e){n.forEach(function(n){n.setAttribute(e,t[e])})}),this}return"string"==typeof arguments[0]&&arguments.length<2?this[0].getAttribute(arguments[0]):(this.forEach(function(t){t.setAttribute(e[0],e[1])}),this)}}),(0,u.default)(s.default,{extend:u.default,noop:function(){},render:function(e,t){var n="var p=[];with(this){p.push('"+e.replace(/[\r\t\n]/g," ").split("<%").join("\t").replace(/((^|%>)[^\t]*)'/g,"$1\r").replace(/\t=(.*?)%>/g,"',$1,'").split("\t").join("');").split("%>").join("p.push('").split("\r").join("\\'")+"');}return p.join('');";return new Function(n).apply(t)},getStyle:function(e,t){var n,i=(e.ownerDocument||document).defaultView;return i&&i.getComputedStyle?(t=t.replace(/([A-Z])/g,"-$1").toLowerCase(),i.getComputedStyle(e,null).getPropertyValue(t)):e.currentStyle?(t=t.replace(/\-(\w)/g,function(e,t){return t.toUpperCase()}),n=e.currentStyle[t],/^\d+(em|pt|%|ex)?$/i.test(n)?function(t){var n=e.style.left,i=e.runtimeStyle.left;return e.runtimeStyle.left=e.currentStyle.left,e.style.left=t||0,t=e.style.pixelLeft+"px",e.style.left=n,e.runtimeStyle.left=i,t}(n):n):void 0}}),t.default=s.default,e.exports=t.default},function(e,t){!function(e){"function"!=typeof e.matches&&(e.matches=e.msMatchesSelector||e.mozMatchesSelector||e.webkitMatchesSelector||function(e){for(var t=this,n=(t.document||t.ownerDocument).querySelectorAll(e),i=0;n[i]&&n[i]!==t;)++i;return Boolean(n[i])}),"function"!=typeof e.closest&&(e.closest=function(e){for(var t=this;t&&1===t.nodeType;){if(t.matches(e))return t;t=t.parentNode}return null})}(window.Element.prototype)},function(e,t){/*
+ object-assign
+ (c) Sindre Sorhus
+ @license MIT
+ */
+"use strict";function n(e){if(null===e||void 0===e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}function i(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;var i=Object.getOwnPropertyNames(t).map(function(e){return t[e]});if("0123456789"!==i.join(""))return!1;var a={};return"abcdefghijklmnopqrst".split("").forEach(function(e){a[e]=e}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},a)).join("")}catch(e){return!1}}var a=Object.getOwnPropertySymbols,o=Object.prototype.hasOwnProperty,r=Object.prototype.propertyIsEnumerable;e.exports=i()?Object.assign:function(e,t){for(var i,u,l=n(e),s=1;s <% if(title){ %>
<%=title%>
<% } %>
<%=content%>
'},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function a(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:u.default.noop,n=arguments[2];return"object"===("undefined"==typeof t?"undefined":o(t))&&(n=t,t=u.default.noop),n=u.default.extend({content:e,buttons:[{label:"确定",type:"primary",onClick:t}]},n),(0,s.default)(n)}Object.defineProperty(t,"__esModule",{value:!0});var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r=n(2),u=i(r),l=n(1),s=i(l);t.default=a,e.exports=t.default},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function a(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:u.default.noop,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:u.default.noop,i=arguments[3];return"object"===("undefined"==typeof t?"undefined":o(t))?(i=t,t=u.default.noop):"object"===("undefined"==typeof n?"undefined":o(n))&&(i=n,n=u.default.noop),i=u.default.extend({content:e,buttons:[{label:"取消",type:"default",onClick:n},{label:"确定",type:"primary",onClick:t}]},i),(0,s.default)(i)}Object.defineProperty(t,"__esModule",{value:!0});var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r=n(2),u=i(r),l=n(1),s=i(l);t.default=a,e.exports=t.default},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function a(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(s)return s;"number"==typeof t&&(t={duration:t}),"function"==typeof t&&(t={callback:t}),t=r.default.extend({content:e,duration:3e3,callback:r.default.noop,className:""},t);var n=(0,r.default)(r.default.render(l.default,t)),i=n.find(".weui-toast"),a=n.find(".weui-mask");return(0,r.default)("body").append(n),i.addClass("weui-animate-fade-in"),a.addClass("weui-animate-fade-in"),setTimeout(function(){a.addClass("weui-animate-fade-out"),i.addClass("weui-animate-fade-out").on("animationend webkitAnimationEnd",function(){n.remove(),s=!1,t.callback()})},t.duration),s=n[0],n[0]}Object.defineProperty(t,"__esModule",{value:!0});var o=n(2),r=i(o),u=n(10),l=i(u),s=void 0;t.default=a,e.exports=t.default},function(e,t){e.exports=' '},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function a(){function e(t){e=r.default.noop,u.addClass("weui-animate-fade-out"),o.addClass("weui-animate-fade-out").on("animationend webkitAnimationEnd",function(){a.remove(),s=!1,t&&t()})}function t(t){e(t)}var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(s)return s;i=r.default.extend({content:n,className:""},i);var a=(0,r.default)(r.default.render(l.default,i)),o=a.find(".weui-toast"),u=a.find(".weui-mask");return(0,r.default)("body").append(a),o.addClass("weui-animate-fade-in"),u.addClass("weui-animate-fade-in"),s=a[0],s.hide=t,s}Object.defineProperty(t,"__esModule",{value:!0});var o=n(2),r=i(o),u=n(12),l=i(u),s=void 0;t.default=a,e.exports=t.default},function(e,t){e.exports=' '},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function a(){function e(t){e=r.default.noop,d.addClass(a.isAndroid?"weui-animate-fade-out":"weui-animate-slide-down"),f.addClass("weui-animate-fade-out").on("animationend webkitAnimationEnd",function(){u.remove(),s=!1,a.onClose(),t&&t()})}function t(t){e(t)}var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(s)return s;var o=r.default.os.android;a=r.default.extend({menus:n,actions:i,title:"",className:"",isAndroid:o,onClose:r.default.noop},a);var u=(0,r.default)(r.default.render(l.default,a)),d=u.find(".weui-actionsheet"),f=u.find(".weui-mask");return(0,r.default)("body").append(u),r.default.getStyle(d[0],"transform"),d.addClass(a.isAndroid?"weui-animate-fade-in":"weui-animate-slide-up"),f.addClass("weui-animate-fade-in").on("click",function(){t()}),u.find(".weui-actionsheet__menu").on("click",".weui-actionsheet__cell",function(e){var i=(0,r.default)(this).index();n[i].onClick.call(this,e),t()}),u.find(".weui-actionsheet__action").on("click",".weui-actionsheet__cell",function(e){var n=(0,r.default)(this).index();i[n].onClick.call(this,e),t()}),s=u[0],s.hide=t,s}Object.defineProperty(t,"__esModule",{value:!0});var o=n(2),r=i(o),u=n(14),l=i(u),s=void 0;t.default=a,e.exports=t.default},function(e,t){e.exports=' <% if(!isAndroid && title){ %>
<% } %>
<% for(var j = 0; j < actions.length; j++){ %>
<%= actions[j].label %>
<% } %>
'},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function a(e){function t(e){t=r.default.noop,a.remove(),e&&e(),i.callback(),s=null}function n(e){t(e)}var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};"number"==typeof i&&(i={duration:i}),"function"==typeof i&&(i={callback:i}),i=r.default.extend({content:e,duration:3e3,callback:r.default.noop,className:""},i);var a=(0,r.default)(r.default.render(l.default,i));return(0,r.default)("body").append(a),s&&(clearTimeout(s.timeout),s.hide()),s={hide:n},s.timeout=setTimeout(n,i.duration),a[0].hide=n,a[0]}Object.defineProperty(t,"__esModule",{value:!0});var o=n(2),r=i(o),u=n(16),l=i(u),s=null;t.default=a,e.exports=t.default},function(e,t){e.exports='<%= content %>
'},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function a(e){var t=(0,r.default)(e);return t.forEach(function(e){function t(){a.val(""),n.removeClass("weui-search-bar_focusing")}var n=(0,r.default)(e),i=n.find(".weui-search-bar__label"),a=n.find(".weui-search-bar__input"),o=n.find(".weui-icon-clear"),u=n.find(".weui-search-bar__cancel-btn");i.on("click",function(){n.addClass("weui-search-bar_focusing"),a[0].focus()}),a.on("blur",function(){this.value.length||t()}),o.on("click",function(){a.val(""),a[0].focus()}),u.on("click",function(){t(),a[0].blur()})}),t}Object.defineProperty(t,"__esModule",{value:!0});var o=n(2),r=i(o);t.default=a,e.exports=t.default},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function a(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=(0,r.default)(e);return t=r.default.extend({defaultIndex:0,onChange:r.default.noop},t),n.forEach(function(e){var n=(0,r.default)(e),i=n.find(".weui-navbar__item, .weui-tabbar__item"),a=n.find(".weui-tab__content");i.eq(t.defaultIndex).addClass("weui-bar__item_on"),a.eq(t.defaultIndex).show(),i.on("click",function(){var e=(0,r.default)(this),n=e.index();i.removeClass("weui-bar__item_on"),e.addClass("weui-bar__item_on"),a.hide(),a.eq(n).show(),t.onChange.call(this,n)})}),this}Object.defineProperty(t,"__esModule",{value:!0});var o=n(2),r=i(o);t.default=a,e.exports=t.default},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function a(e){return e&&e.classList?e.classList.contains("weui-cell")?e:a(e.parentNode):null}function o(e,t,n){var i=e[0],a=e.val();if("INPUT"==i.tagName||"TEXTAREA"==i.tagName){var o=i.getAttribute("pattern")||"";if("radio"==i.type){for(var r=t.find('input[type="radio"][name="'+i.name+'"]'),u=0,l=r.length;u=parseInt(d[0])?null:0==f?"empty":"notMatch":parseInt(d[0])<=f&&f<=parseInt(d[1])?null:0==f?"empty":"notMatch"}return i.checked?null:"empty"}if(o){if(/^REG_/.test(o)){if(!n)throw"RegExp "+o+" is empty.";if(o=o.replace(/^REG_/,""),!n[o])throw"RegExp "+o+" has not found.";o=n[o]}return new RegExp(o).test(a)?null:e.val().length?"notMatch":"empty"}return e.val().length?null:"empty"}return a.length?null:"empty"}function r(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:f.default.noop,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=(0,f.default)(e);return i.forEach(function(e){var i=(0,f.default)(e),a=i.find("[required]");"function"!=typeof t&&(t=l);for(var r=0,u=a.length;r1&&void 0!==arguments[1]?arguments[1]:{},n=(0,f.default)(e);return n.forEach(function(e){var n=(0,f.default)(e);n.find("[required]").on("blur",function(){if("checkbox"!=this.type&&"radio"!=this.type){var e=(0,f.default)(this);if(!(e.val().length<1)){var i=o(e,n,t.regexp);i&&l({ele:e[0],msg:i})}}}).on("focus",function(){s(this)})}),this}function l(e){if(e){var t=(0,f.default)(e.ele),n=e.msg,i=t.attr(n+"Tips")||t.attr("tips")||t.attr("placeholder");if(i&&(0,p.default)(i),"checkbox"==e.ele.type||"radio"==e.ele.type)return;var o=a(e.ele);o&&o.classList.add("weui-cell_warn")}}function s(e){var t=a(e);t&&t.classList.remove("weui-cell_warn")}Object.defineProperty(t,"__esModule",{value:!0});var d=n(2),f=i(d),c=n(15),p=i(c);t.default={showErrorTips:l,hideErrorTips:s,validate:r,checkIfBlur:u},e.exports=t.default},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function a(e,t){function n(e,t){var n=e.find('[data-id="'+t+'"]'),i=n.find(".weui-uploader__file-content");return i.length||(i=(0,r.default)(''),n.append(i)),n.addClass("weui-uploader__file_status"),i}function i(e,t){var n=e.find('[data-id="'+t+'"]').removeClass("weui-uploader__file_status");n.find(".weui-uploader__file-content").remove()}function a(e){e.url=u.createObjectURL(e),e.status="ready",e.upload=function(){(0,f.default)(r.default.extend({$uploader:o,file:e},t))},e.stop=function(){this.xhr.abort()},t.onQueued(e),t.auto&&e.upload()}var o=(0,r.default)(e),u=window.URL||window.webkitURL||window.mozURL;if(t=r.default.extend({url:"",auto:!0,type:"file",fileVal:"file",xhrFields:{},onBeforeQueued:r.default.noop,onQueued:r.default.noop,onBeforeSend:r.default.noop,onSuccess:r.default.noop,onProgress:r.default.noop,onError:r.default.noop},t),t.compress!==!1&&(t.compress=r.default.extend({width:1600,height:1600,quality:.8},t.compress)),t.onBeforeQueued){var d=t.onBeforeQueued;t.onBeforeQueued=function(e,t){var n=d.call(e,t);if(n===!1)return!1;if(n!==!0){var i=(0,r.default)(r.default.render(l.default,{id:e.id}));o.find(".weui-uploader__files").append(i)}}}if(t.onQueued){var p=t.onQueued;t.onQueued=function(e){if(!p.call(e)){var n=o.find('[data-id="'+e.id+'"]');n.css({backgroundImage:'url("'+(e.base64||e.url)+'")'}),t.auto||i(o,e.id)}}}if(t.onBeforeSend){var h=t.onBeforeSend;t.onBeforeSend=function(e,t,n){var i=h.call(e,t,n);if(i===!1)return!1}}if(t.onSuccess){var v=t.onSuccess;t.onSuccess=function(e,t){e.status="success",v.call(e,t)||i(o,e.id)}}if(t.onProgress){var m=t.onProgress;t.onProgress=function(e,t){m.call(e,t)||n(o,e.id).html(t+"%")}}if(t.onError){var g=t.onError;t.onError=function(e,t){e.status="fail",g.call(e,t)||n(o,e.id).html('')}}o.find('input[type="file"]').on("change",function(e){var n=e.target.files;0!==n.length&&(t.compress===!1&&"file"==t.type?Array.prototype.forEach.call(n,function(e){e.id=++c,t.onBeforeQueued(e,n)!==!1&&a(e)}):Array.prototype.forEach.call(n,function(e){e.id=++c,t.onBeforeQueued(e,n)!==!1&&(0,s.compress)(e,t,function(e){e&&a(e)})}),this.value="")})}Object.defineProperty(t,"__esModule",{value:!0});var o=n(2),r=i(o),u=n(21),l=i(u),s=n(22),d=n(23),f=i(d),c=0;t.default=a,e.exports=t.default},function(e,t){e.exports='
'},function(e,t){"use strict";function n(e){var t,n=e.naturalHeight,i=document.createElement("canvas");i.width=1,i.height=n;var a=i.getContext("2d");a.drawImage(e,0,0);try{t=a.getImageData(0,0,1,n).data}catch(e){return 1}for(var o=0,r=n,u=n;u>o;){var l=t[4*(u-1)+3];0===l?r=u:o=u,u=r+o>>1}var s=u/n;return 0===s?1:s}function i(e){for(var t=atob(e.split(",")[1]),n=new ArrayBuffer(t.length),i=new Uint8Array(n),a=0;a4&&(e.width=a,e.height=i),n){case 2:t.translate(i,0),t.scale(-1,1);break;case 3:t.translate(i,a),t.rotate(Math.PI);break;case 4:t.translate(0,a),t.scale(1,-1);break;case 5:t.rotate(.5*Math.PI),t.scale(1,-1);break;case 6:t.rotate(.5*Math.PI),t.translate(0,-a);break;case 7:t.rotate(.5*Math.PI),t.translate(i,-a),t.scale(-1,1);break;case 8:t.rotate(-.5*Math.PI),t.translate(-i,0)}}function u(e,t,u){var l=new FileReader;l.onload=function(l){if(t.compress===!1)return e.base64=l.target.result,void u(e);var s=new Image;s.onload=function(){var l=n(s),d=o(i(s.src)),f=document.createElement("canvas"),c=f.getContext("2d"),p=t.compress.width,h=t.compress.height,v=s.width,m=s.height,g=void 0;if(vh?(v=parseInt(h*s.width/s.height),m=h):v>=m&&v>p&&(m=parseInt(p*s.height/s.width),v=p),f.width=v,f.height=m,d>0&&r(f,c,d),c.drawImage(s,0,0,v,m/l),g=/image\/jpeg/.test(e.type)||/image\/jpg/.test(e.type)?f.toDataURL("image/jpeg",t.compress.quality):f.toDataURL(e.type),"file"==t.type)if(/;base64,null/.test(g)||/;base64,$/.test(g))u(e);else{var w=a(g);w.id=e.id,w.name=e.name,w.lastModified=e.lastModified,w.lastModifiedDate=e.lastModifiedDate,u(w)}else/;base64,null/.test(g)||/;base64,$/.test(g)?(t.onError(e,new Error("Compress fail, dataURL is "+g+".")),u()):(e.base64=g,u(e))},s.src=l.target.result},l.readAsDataURL(e)}Object.defineProperty(t,"__esModule",{value:!0}),t.default={compress:u},e.exports=t.default},function(e,t){"use strict";function n(e){var t=e.url,n=e.file,i=e.fileVal,a=e.onBeforeSend,o=e.onProgress,r=e.onError,u=e.onSuccess,l=e.xhrFields,s=n.name,d=n.type,f=n.lastModifiedDate,c={name:s,type:d,size:"file"==e.type?n.size:n.base64.length,lastModifiedDate:f},p={};if(a(n,c,p)!==!1){n.status="progress",o(n,0);var h=new FormData,v=new XMLHttpRequest;n.xhr=v,Object.keys(c).forEach(function(e){h.append(e,c[e])}),"file"==e.type?h.append(i,n,s):h.append(i,n.base64),v.onreadystatechange=function(){if(4==v.readyState)if(200==v.status)try{var e=JSON.parse(v.responseText);u(n,e)}catch(e){r(n,e)}else r(n,new Error("XMLHttpRequest response status is "+v.status))},v.upload.addEventListener("progress",function(e){if(0!=e.total){var t=100*Math.ceil(e.loaded/e.total);o(n,t)}},!1),v.open("POST",t),Object.keys(l).forEach(function(e){v[e]=l[e]}),Object.keys(p).forEach(function(e){v.setRequestHeader(e,p[e])}),v.send(h)}}Object.defineProperty(t,"__esModule",{value:!0}),t.default=n,e.exports=t.default},function(e,t,n){"use strict";function i(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}function a(e){return e&&e.__esModule?e:{default:e}}function o(e){"object"!=("undefined"==typeof e?"undefined":l(e))&&(e={label:e,value:e}),d.default.extend(this,e)}function r(){function e(){(0,d.default)(r.container).append(v),d.default.getStyle(v[0],"transform"),v.find(".weui-mask").addClass("weui-animate-fade-in"),v.find(".weui-picker").addClass("weui-animate-slide-up")}function t(e){t=d.default.noop,v.find(".weui-mask").addClass("weui-animate-fade-out"),v.find(".weui-picker").addClass("weui-animate-slide-down").on("animationend webkitAnimationEnd",function(){v.remove(),y=!1,r.onClose(),e&&e()})}function n(e){t(e)}function i(e,t){if(void 0===p[t]&&r.defaultValue&&void 0!==r.defaultValue[t]){var n=r.defaultValue[t],a=0,u=e.length;if("object"==l(e[a]))for(;a0)v.find(".weui-picker__group").eq(t+1).show(),!s&&i(e.children,t+1);else{var a=v.find(".weui-picker__group");a.forEach(function(e,n){n>t&&(0,d.default)(e).hide()}),c.splice(t+1),r.onChange(c)}},onConfirm:r.onConfirm})}if(y)return y;var a=arguments[arguments.length-1],r=d.default.extend({id:"default",className:"",container:"body",onChange:d.default.noop,onConfirm:d.default.noop,onClose:d.default.noop},a),u=void 0,s=!1;if(arguments.length>2){var f=0;for(u=[];fn&&(a=1),tu&&(a=u),o>u&&(o=u);for(var l=a;l<=o;l++)r.push({label:l+"日",value:l});return r},w=function(e,t,n,i,a){for(var o=[],r=m(e),u=t;u<=n;u++)o.push({label:u+"月",value:u,children:g(r,u,t,n,i,a)});return o},y=v(n.start),_=v(n.end),b=y[0];b<=_[0];b++){var k=1,x=12,M=void 0,C=void 0;b===y[0]&&(k=y[1],M=y[2]),b===_[0]&&(x=_[1],C=_[2]),a.push({label:b+"年",value:b,children:w(b,k,x,M,C)})}return r(a,n)}Object.defineProperty(t,"__esModule",{value:!0});var l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},s=n(2),d=a(s),f=n(25),c=a(f);n(26);var p=n(27),h=i(p),v=n(28),m=a(v),g=n(29),w=a(g);o.prototype.toString=function(){return this.value},o.prototype.valueOf=function(){return this.value};var y=void 0,_={};t.default={picker:r,datePicker:u},e.exports=t.default},function(e,t){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){var n=t[0],i=t[1],a=[],o=void 0;e=e.replace(/\*/g,n+"-"+i);for(var u=e.split(","),l=0,s=u.length;le.length)throw new Error("No selectable item.");return t},d=function(e,t,n){var i=s(n);return(e-i)*t},f=function(e,t){return e*t},c=function(e,t,n){return-(t*(n-e-1))};r.default.fn.scroll=function(e){function t(e){g=e,y=+new Date}function n(e){w=e;var t=w-g;u(m,0),l(m,_+t),y=+new Date,b.push({time:y,y:w}),b.length>40&&b.shift()}function i(e){if(g){var t=(new Date).getTime(),n=k-p.bodyHeight/2;if(w=e,t-y>100)C(Math.abs(w-g)>10?w-g:n-w);else if(Math.abs(w-g)>10){for(var i=b.length-1,a=i,o=i;o>0&&y-b[o].time<100;o--)a=o;if(a!==i){var r=b[i],u=b[a],l=r.time-u.time,s=r.y-u.y,d=s/l,f=150*d+(w-g);C(f)}else C(0)}else C(n-w);g=null}}var o=this,p=r.default.extend({items:[],scrollable:".weui-picker__content",offset:3,rowHeight:34,onChange:r.default.noop,temp:null,bodyHeight:238},e),h=p.items.map(function(e){return''+("object"==("undefined"==typeof e?"undefined":a(e))?e.label:e)+"
"}).join(""),v=(0,r.default)(this);v.find(".weui-picker__content").html(h);var m=v.find(p.scrollable),g=void 0,w=void 0,y=void 0,_=void 0,b=[],k=window.innerHeight;if(null!==p.temp&&p.tempt&&(_=t),_0?++i:--i;_=(p.offset-i)*p.rowHeight,u(m,.3),l(m,_),p.onChange.call(o,p.items[i],i)};m=v.offAll().on("touchstart",function(e){t(e.changedTouches[0].pageY)}).on("touchmove",function(e){n(e.changedTouches[0].pageY),e.preventDefault()}).on("touchend",function(e){i(e.changedTouches[0].pageY)}).find(p.scrollable);var E="ontouchstart"in window||window.DocumentTouch&&document instanceof window.DocumentTouch;E||v.on("mousedown",function(e){t(e.pageY),e.stopPropagation(),e.preventDefault()}).on("mousemove",function(e){g&&(n(e.pageY),e.stopPropagation(),e.preventDefault())}).on("mouseup mouseleave",function(e){i(e.pageY),e.stopPropagation(),e.preventDefault()})}},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.depthOf=function e(t){var n=1;return t.children&&t.children[0]&&(n=e(t.children[0])+1),n}},function(e,t){e.exports=' '},function(e,t){e.exports=""},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function a(e){function t(e){t=r.default.noop,a.addClass("weui-animate-fade-out").on("animationend webkitAnimationEnd",function(){a.remove(),s=!1,e&&e()})}function n(e){t(e)}var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(s)return s;i=r.default.extend({className:"",onDelete:r.default.noop},i);var a=(0,r.default)(r.default.render(l.default,r.default.extend({url:e},i)));return(0,r.default)("body").append(a),a.find(".weui-gallery__img").on("click",function(){n()}),a.find(".weui-gallery__del").on("click",function(){i.onDelete.call(this,e)}),a.show().addClass("weui-animate-fade-in"),s=a[0],s.hide=n,s}Object.defineProperty(t,"__esModule",{value:!0});var o=n(2),r=i(o),u=n(31),l=i(u),s=void 0;t.default=a,e.exports=t.default},function(e,t){e.exports=' '},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function a(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=(0,r.default)(e);if(t=r.default.extend({step:void 0,defaultValue:0,onChange:r.default.noop},t),void 0!==t.step&&(t.step=parseFloat(t.step),!t.step||t.step<0))throw new Error("Slider step must be a positive number.");if(void 0!==t.defaultValue&&t.defaultValue<0||t.defaultValue>100)throw new Error("Slider defaultValue must be >= 0 and <= 100.");return n.forEach(function(e){function n(){var e=r.default.getStyle(l[0],"left");return e=/%/.test(e)?s*parseFloat(e)/100:parseFloat(e)}function i(n){var i=void 0,a=void 0;t.step&&(n=Math.round(n/p)*p),i=f+n,i=i<0?0:i>s?s:i,a=100*i/s,u.css({width:a+"%"}),l.css({left:a+"%"}),t.onChange.call(e,a)}var a=(0,r.default)(e),o=a.find(".weui-slider__inner"),u=a.find(".weui-slider__track"),l=a.find(".weui-slider__handler"),s=parseInt(r.default.getStyle(o[0],"width")),d=o[0].offsetLeft,f=0,c=0,p=void 0;t.step&&(p=s*t.step/100),t.defaultValue&&i(s*t.defaultValue/100),a.on("click",function(e){e.preventDefault(),f=n(),i(e.pageX-d-f)}),l.on("touchstart",function(e){f=n(),c=e.changedTouches[0].clientX}).on("touchmove",function(e){e.preventDefault(),i(e.changedTouches[0].clientX-c)})}),this}Object.defineProperty(t,"__esModule",{value:!0});var o=n(2),r=i(o);t.default=a,e.exports=t.default}])});
\ No newline at end of file
diff --git a/docs/component/picker.md b/docs/component/picker.md
index 30afce2..96f42b9 100644
--- a/docs/component/picker.md
+++ b/docs/component/picker.md
@@ -31,15 +31,137 @@ picker 多列选择器。
**Example**
```js
-// 单列picker
weui.picker([
{
label: '飞机票',
value: 0,
disabled: true // 不可用
},
{
label: '火车票',
value: 1
},
{
label: '汽车票',
value: 3
},
{
label: '公车票',
value: 4,
}
], {
className: 'custom-classname',
container: 'body',
defaultValue: [3],
onChange: function (result) {
console.log(result)
},
onConfirm: function (result) {
console.log(result)
},
id: 'singleLinePicker'
});
+// 单列picker
+weui.picker([
+{
+ label: '飞机票',
+ value: 0,
+ disabled: true // 不可用
+},
+{
+ label: '火车票',
+ value: 1
+},
+{
+ label: '汽车票',
+ value: 3
+},
+{
+ label: '公车票',
+ value: 4,
+}
+], {
+ className: 'custom-classname',
+ container: 'body',
+ defaultValue: [3],
+ onChange: function (result) {
+ console.log(result)
+ },
+ onConfirm: function (result) {
+ console.log(result)
+ },
+ id: 'singleLinePicker'
+});
```
**Example**
```js
-// 多列picker
weui.picker([
{
label: '1',
value: '1'
}, {
label: '2',
value: '2'
}, {
label: '3',
value: '3'
}
], [
{
label: 'A',
value: 'A'
}, {
label: 'B',
value: 'B'
}, {
label: 'C',
value: 'C'
}
], {
defaultValue: ['3', 'A'],
onChange: function (result) {
console.log(result);
},
onConfirm: function (result) {
console.log(result);
},
id: 'multiPickerBtn'
});
+// 多列picker
+weui.picker([
+ {
+ label: '1',
+ value: '1'
+ }, {
+ label: '2',
+ value: '2'
+ }, {
+ label: '3',
+ value: '3'
+ }
+], [
+ {
+ label: 'A',
+ value: 'A'
+ }, {
+ label: 'B',
+ value: 'B'
+ }, {
+ label: 'C',
+ value: 'C'
+ }
+], {
+ defaultValue: ['3', 'A'],
+ onChange: function (result) {
+ console.log(result);
+ },
+ onConfirm: function (result) {
+ console.log(result);
+ },
+ id: 'multiPickerBtn'
+});
```
**Example**
```js
-// 级联picker
weui.picker([
{
label: '飞机票',
value: 0,
children: [
{
label: '经济舱',
value: 1
},
{
label: '商务舱',
value: 2
}
]
},
{
label: '火车票',
value: 1,
children: [
{
label: '卧铺',
value: 1,
disabled: true // 不可用
},
{
label: '坐票',
value: 2
},
{
label: '站票',
value: 3
}
]
},
{
label: '汽车票',
value: 3,
children: [
{
label: '快班',
value: 1
},
{
label: '普通',
value: 2
}
]
}
], {
className: 'custom-classname',
container: 'body',
defaultValue: [1, 3],
onChange: function (result) {
console.log(result)
},
onConfirm: function (result) {
console.log(result)
},
id: 'doubleLinePicker'
});
+// 级联picker
+weui.picker([
+{
+ label: '飞机票',
+ value: 0,
+ children: [
+ {
+ label: '经济舱',
+ value: 1
+ },
+ {
+ label: '商务舱',
+ value: 2
+ }
+ ]
+},
+{
+ label: '火车票',
+ value: 1,
+ children: [
+ {
+ label: '卧铺',
+ value: 1,
+ disabled: true // 不可用
+ },
+ {
+ label: '坐票',
+ value: 2
+ },
+ {
+ label: '站票',
+ value: 3
+ }
+ ]
+},
+{
+ label: '汽车票',
+ value: 3,
+ children: [
+ {
+ label: '快班',
+ value: 1
+ },
+ {
+ label: '普通',
+ value: 2
+ }
+ ]
+}
+], {
+ className: 'custom-classname',
+ container: 'body',
+ defaultValue: [1, 3],
+ onChange: function (result) {
+ console.log(result)
+ },
+ onConfirm: function (result) {
+ console.log(result)
+ },
+ id: 'doubleLinePicker'
+});
```
@@ -54,7 +176,7 @@ datePicker 时间选择器,由picker拓展而来,提供年、月、日的选
| [options.id] | string
| "datePicker"
| 作为picker的唯一标识 |
| [options.start] | number
| string
| Date
| 2000
| 起始年份,如果是 `Number` 类型,表示起始年份;如果是 `String` 类型,格式为 'YYYY-MM-DD';如果是 `Date` 类型,就传一个 Date |
| [options.end] | number
| string
| Date
| 2030
| 结束年份,同上 |
-| [options.cron] | string
| "* * *"
| cron 表达式,三位,分别是 dayOfMonth[1-31],month[1-12] 和 dayOfWeek[0-6](周日-周六) |
+| [options.cron] | string
| "* * *"
| `false` | cron 表达式,三位,分别是 dayOfMonth[1-31],month[1-12] 和 dayOfWeek[0-6](周日-周六);设置为 `false` 时,忽略之(优化在 Safari 中 时间间隔大于100年时弹出过慢的问题) |
| [options.className] | string
| | 自定义类名 |
| [options.defaultValue] | array
| | 默认选项的value数组, 如 [1991, 6, 9] |
| [options.onChange] | function
| | 在picker选中的值发生变化的时候回调 |
@@ -62,5 +184,59 @@ datePicker 时间选择器,由picker拓展而来,提供年、月、日的选
**Example**
```js
-// 示例1:
weui.datePicker({
start: 1990,
end: 2000,
defaultValue: [1991, 6, 9],
onChange: function(result){
console.log(result);
},
onConfirm: function(result){
console.log(result);
},
id: 'datePicker'
});
// 示例2:
weui.datePicker({
start: new Date(), // 从今天开始
end: 2030,
defaultValue: [2020, 6, 9],
onChange: function(result){
console.log(result);
},
onConfirm: function(result){
console.log(result);
},
id: 'datePicker'
});
// 示例3:
weui.datePicker({
start: new Date(), // 从今天开始
end: 2030,
cron: '* * 0,6', // 每逢周日、周六
onChange: function(result){
console.log(result);
},
onConfirm: function(result){
console.log(result);
},
id: 'datePicker'
});
// 示例4:
weui.datePicker({
start: new Date(), // 从今天开始
end: 2030,
cron: '1-10 * *', // 每月1日-10日
onChange: function(result){
console.log(result);
},
onConfirm: function(result){
console.log(result);
},
id: 'datePicker'
});
+// 示例1:
+weui.datePicker({
+ start: 1990,
+ end: 2000,
+ defaultValue: [1991, 6, 9],
+ onChange: function(result){
+ console.log(result);
+ },
+ onConfirm: function(result){
+ console.log(result);
+ },
+ id: 'datePicker'
+});
+
+// 示例2:
+weui.datePicker({
+ start: new Date(), // 从今天开始
+ end: 2030,
+ defaultValue: [2020, 6, 9],
+ onChange: function(result){
+ console.log(result);
+ },
+ onConfirm: function(result){
+ console.log(result);
+ },
+ id: 'datePicker'
+ });
+
+ // 示例3:
+weui.datePicker({
+ start: new Date(), // 从今天开始
+ end: 2030,
+ cron: '* * 0,6', // 每逢周日、周六
+ onChange: function(result){
+ console.log(result);
+ },
+ onConfirm: function(result){
+ console.log(result);
+ },
+ id: 'datePicker'
+ });
+
+ // 示例4:
+weui.datePicker({
+ start: new Date(), // 从今天开始
+ end: 2030,
+ cron: '1-10 * *', // 每月1日-10日
+ onChange: function(result){
+ console.log(result);
+ },
+ onConfirm: function(result){
+ console.log(result);
+ },
+ id: 'datePicker'
+ });
```
diff --git a/example/example.js b/example/example.js
index be64306..58ecb2b 100644
--- a/example/example.js
+++ b/example/example.js
@@ -71,6 +71,7 @@ document.querySelector('#actionSheetBtn').addEventListener('click', function ()
}
}
], {
+ title: 'actionTitle',
className: "custom-classname",
onClose: function(){
console.log('关闭');
@@ -170,6 +171,37 @@ document.querySelector('#datePickerBtn').addEventListener('click', function () {
});
});
+// 时间选择器
+document.querySelector('#datePickerBtn100').addEventListener('click', function () {
+ weui.datePicker({
+ start: '1816-03-29',
+ end: '2030-12-29',
+ /**
+ * https://zh.wikipedia.org/wiki/Cron
+ * cron 表达式后三位
+ * 大于100年时 设置 cron 为 fasle,优化在 Safari 中弹出过慢的问题
+ * 示例:
+ * * * * 每天
+ * 5 * * 每个月的5日
+ * 1-10 * * 每个月的前10日
+ * 1,5,10 * * 每个月的1号、5号、10号
+ * *\/2 * * 每个月的 1、3、5、7...日,注意写的时候斜杠“/”前面没有反斜杠“\”,这是因为是注释所以需要转义
+ * * 2 0 2月的每个周日
+ * * * 0,6 每个周末
+ * * * 3 每周三
+ */
+ cron: false,
+ defaultValue: [2017, 7, 9],
+ onChange: function (result) {
+ console.log(result);
+ },
+ onConfirm: function (result) {
+ console.log(result);
+ },
+ id: 'datePicker'
+ });
+});
+
// 多列选择器
document.querySelector('#multiPickerBtn').addEventListener('click', function () {
weui.picker([
diff --git a/example/index.html b/example/index.html
index 77eb100..95b60ba 100644
--- a/example/index.html
+++ b/example/index.html
@@ -63,6 +63,7 @@
TopTips
Picker
DatePicker
+ DatePicker 大于100年
Multi-Picker
Cascade-Picker
@@ -143,7 +144,7 @@
-
+
diff --git a/package.json b/package.json
index 713e827..2aff9db 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "weui.js",
- "version": "1.1.3",
+ "version": "1.1.4",
"description": "weui.js",
"main": "./dist/weui.min.js",
"scripts": {
diff --git a/src/actionSheet/actionSheet.html b/src/actionSheet/actionSheet.html
index c0bce9b..5f30e3f 100644
--- a/src/actionSheet/actionSheet.html
+++ b/src/actionSheet/actionSheet.html
@@ -1,6 +1,11 @@
+ <% if(!isAndroid && title){ %>
+
+ <% } %>