tbom
Version:
Taobao Open Platform Modules
1,535 lines (1,291 loc) • 286 kB
JavaScript
// {"framework" : "Rax"}
define("index.bundle", function(require) {/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, {
/******/ configurable: false,
/******/ enumerable: true,
/******/ get: getter
/******/ });
/******/ }
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 6);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ (function(module, exports) {
module.exports = (function(){ var mod;if (!mod) { try { mod = require("rax") } catch(e) {} }return mod;})();
/***/ }),
/* 1 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var _typeof2 = 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; };
Object.defineProperty(exports, "__esModule", {
value: true
});
var _typeof = typeof Symbol === "function" && _typeof2(Symbol.iterator) === "symbol" ? function (obj) {
return typeof obj === "undefined" ? "undefined" : _typeof2(obj);
} : function (obj) {
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj === "undefined" ? "undefined" : _typeof2(obj);
};
// https://www.w3.org/TR/html5/webappapis.html#dom-navigator-appcodename
var isWeb = exports.isWeb = (typeof navigator === 'undefined' ? 'undefined' : _typeof(navigator)) === 'object' && (navigator.appCodeName === 'Mozilla' || navigator.product === 'Gecko');
var isNode = exports.isNode = typeof process !== 'undefined' && !!(process.versions && process.versions.node);
var isWeex = exports.isWeex = typeof callNative === 'function';
var isReactNative = exports.isReactNative = typeof __fbBatchedBridgeConfig !== 'undefined';
/***/ }),
/* 2 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
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; };
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends = Object.assign || function (target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}return target;
};
var _createClass = function () {
function defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];descriptor.enumerable = descriptor.enumerable || false;descriptor.configurable = true;if ("value" in descriptor) descriptor.writable = true;Object.defineProperty(target, descriptor.key, descriptor);
}
}return function (Constructor, protoProps, staticProps) {
if (protoProps) defineProperties(Constructor.prototype, protoProps);if (staticProps) defineProperties(Constructor, staticProps);return Constructor;
};
}();
var _class, _temp;
var _rax = __webpack_require__(0);
var _universalEnv = __webpack_require__(1);
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
function _possibleConstructorReturn(self, call) {
if (!self) {
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
}return call && ((typeof call === "undefined" ? "undefined" : _typeof(call)) === "object" || typeof call === "function") ? call : self;
}
function _inherits(subClass, superClass) {
if (typeof superClass !== "function" && superClass !== null) {
throw new TypeError("Super expression must either be null or a function, not " + (typeof superClass === "undefined" ? "undefined" : _typeof(superClass)));
}subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } });if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
}
var View = (_temp = _class = function (_Component) {
_inherits(View, _Component);
function View() {
_classCallCheck(this, View);
return _possibleConstructorReturn(this, (View.__proto__ || Object.getPrototypeOf(View)).apply(this, arguments));
}
_createClass(View, [{
key: 'render',
value: function render() {
var props = this.props;
if (_universalEnv.isWeex) {
// TODO: do not pass object value in props
return (0, _rax.createElement)('div', props);
} else {
var styleProps = _extends({}, styles.initial, props.style);
return (0, _rax.createElement)('div', _extends({}, props, { style: styleProps }));
}
}
}]);
return View;
}(_rax.Component), _class.propTypes = {}, _temp);
var styles = {
initial: {
border: '0 solid black',
position: 'relative',
boxSizing: 'border-box',
display: 'flex',
flexDirection: 'column',
alignContent: 'flex-start',
flexShrink: 0
}
};
exports.default = View;
module.exports = exports['default'];
/***/ }),
/* 3 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var _typeof2 = 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; };
Object.defineProperty(exports, "__esModule", {
value: true
});
var _typeof = typeof Symbol === "function" && _typeof2(Symbol.iterator) === "symbol" ? function (obj) {
return typeof obj === "undefined" ? "undefined" : _typeof2(obj);
} : function (obj) {
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj === "undefined" ? "undefined" : _typeof2(obj);
};
var _extends = Object.assign || function (target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}return target;
};
var _createClass = function () {
function defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];descriptor.enumerable = descriptor.enumerable || false;descriptor.configurable = true;if ("value" in descriptor) descriptor.writable = true;Object.defineProperty(target, descriptor.key, descriptor);
}
}return function (Constructor, protoProps, staticProps) {
if (protoProps) defineProperties(Constructor.prototype, protoProps);if (staticProps) defineProperties(Constructor, staticProps);return Constructor;
};
}();
var _class, _temp2;
var _rax = __webpack_require__(0);
var _universalEnv = __webpack_require__(1);
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
function _possibleConstructorReturn(self, call) {
if (!self) {
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
}return call && ((typeof call === "undefined" ? "undefined" : _typeof2(call)) === "object" || typeof call === "function") ? call : self;
}
function _inherits(subClass, superClass) {
if (typeof superClass !== "function" && superClass !== null) {
throw new TypeError("Super expression must either be null or a function, not " + (typeof superClass === "undefined" ? "undefined" : _typeof2(superClass)));
}subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } });if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
}
var Text = (_temp2 = _class = function (_Component) {
_inherits(Text, _Component);
function Text() {
var _ref;
var _temp, _this, _ret;
_classCallCheck(this, Text);
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
return _ret = (_temp = (_this = _possibleConstructorReturn(this, (_ref = Text.__proto__ || Object.getPrototypeOf(Text)).call.apply(_ref, [this].concat(args))), _this), _this.renderText = function () {
var props = _this.props;
var nativeProps = _extends({}, props, {
style: props.style || {}
});
var textString = '';
if (props.children != null) {
if (!Array.isArray(props.children)) {
textString = props.children.toString();
} else {
textString = props.children.join('');
}
}
if (_this.context.isInAParentText) {
return (0, _rax.createElement)('span', nativeProps, textString);
}
if (props.onPress) {
nativeProps.onClick = props.onPress;
}
if (_universalEnv.isWeex) {
if (props.numberOfLines) {
nativeProps.style.lines = props.numberOfLines;
}
nativeProps.value = textString;
return (0, _rax.createElement)('text', nativeProps);
} else {
var styleProps = _extends({}, styles.text, nativeProps.style);
var numberOfLines = props.numberOfLines;
if (numberOfLines) {
if (parseInt(numberOfLines) === 1) {
styleProps.whiteSpace = 'nowrap';
} else {
styleProps.display = '-webkit-box';
styleProps.webkitBoxOrient = 'vertical';
styleProps.webkitLineClamp = String(numberOfLines);
}
styleProps.overflow = 'hidden';
}
return (0, _rax.createElement)('span', _extends({}, nativeProps, { style: styleProps }), textString);
}
}, _this.renderRichText = function () {
var props = _this.props;
var children = props.children;
var nativeProps = _extends({}, props, {
style: props.style || {}
});
var styleProps = _extends({}, styles.richtext, nativeProps.style);
if (_universalEnv.isWeex) {
children = transformChildren(children, _this);
}
return (0, _rax.createElement)('p', _extends({}, nativeProps, { style: styleProps }), children);
}, _temp), _possibleConstructorReturn(_this, _ret);
}
_createClass(Text, [{
key: 'getChildContext',
value: function getChildContext() {
return {
isInAParentText: true
};
}
}, {
key: 'render',
value: function render() {
var props = this.props;
var children = props.children;
if (!Array.isArray(children)) {
children = [children];
}
var nested = false;
for (var i = 0; i < children.length; i++) {
var child = children[i];
if (child && (typeof child === 'undefined' ? 'undefined' : _typeof(child)) === 'object') {
nested = true;
break;
}
}
return nested ? this.renderRichText() : this.renderText();
}
}]);
return Text;
}(_rax.Component), _class.propTypes = {}, _class.contextTypes = {
isInAParentText: _rax.PropTypes.bool
}, _class.childContextTypes = {
isInAParentText: _rax.PropTypes.bool
}, _temp2);
function transformChild(child, instance) {
var ChildComponent = child.type,
props = child.props;
var children = props.children;
if (typeof ChildComponent === 'function') {
var childInstance = new ChildComponent();
childInstance.props = props;
if (children) {
childInstance.props.children = transformChildren(children, instance);
}
childInstance.context = instance.getChildContext();
return childInstance.render();
} else {
return child;
}
}
function transformChildren(children, instance) {
var elements = [];
if (!Array.isArray(children)) {
children = [children];
}
for (var i = 0; i < children.length; i++) {
var child = children[i];
if (typeof child === 'string') {
elements.push(child);
} else if ((typeof child === 'undefined' ? 'undefined' : _typeof(child)) === 'object') {
elements.push(transformChild(child, instance));
}
}
return elements;
}
var styles = {
text: {
border: '0 solid black',
position: 'relative',
boxSizing: 'border-box',
display: 'block',
flexDirection: 'column',
alignContent: 'flex-start',
flexShrink: 0,
fontSize: 32
},
richtext: {
marginTop: 0,
marginBottom: 0
}
};
exports.default = Text;
module.exports = exports['default'];
/***/ }),
/* 4 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
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; };
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends = Object.assign || function (target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}return target;
};
var _createClass = function () {
function defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];descriptor.enumerable = descriptor.enumerable || false;descriptor.configurable = true;if ("value" in descriptor) descriptor.writable = true;Object.defineProperty(target, descriptor.key, descriptor);
}
}return function (Constructor, protoProps, staticProps) {
if (protoProps) defineProperties(Constructor.prototype, protoProps);if (staticProps) defineProperties(Constructor, staticProps);return Constructor;
};
}();
var _class, _temp;
var _rax = __webpack_require__(0);
var _universalEnv = __webpack_require__(1);
var _raxView = __webpack_require__(2);
var _raxView2 = _interopRequireDefault(_raxView);
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : { default: obj };
}
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
function _possibleConstructorReturn(self, call) {
if (!self) {
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
}return call && ((typeof call === "undefined" ? "undefined" : _typeof(call)) === "object" || typeof call === "function") ? call : self;
}
function _inherits(subClass, superClass) {
if (typeof superClass !== "function" && superClass !== null) {
throw new TypeError("Super expression must either be null or a function, not " + (typeof superClass === "undefined" ? "undefined" : _typeof(superClass)));
}subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } });if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
}
var Image = (_temp = _class = function (_Component) {
_inherits(Image, _Component);
function Image() {
_classCallCheck(this, Image);
return _possibleConstructorReturn(this, (Image.__proto__ || Object.getPrototypeOf(Image)).apply(this, arguments));
}
_createClass(Image, [{
key: 'render',
value: function render() {
var nativeProps = _extends({}, this.props);
var source = nativeProps.source;
// Source must a object
if (source && source.uri) {
var style = nativeProps.style;
var width = source.width,
height = source.height,
uri = source.uri;
// Default is 0
if (width == null && height == null && style.height == null && style.width == null) {
width = 0;
height = 0;
}
nativeProps.style = _extends(_extends({}, !this.context.isInAParentText && { display: 'flex' }, {
width: width,
height: height
}), style);
nativeProps.src = uri;
delete nativeProps.source;
var NativeImage = void 0;
if (_universalEnv.isWeex) {
NativeImage = 'image';
} else {
NativeImage = 'img';
}
// for cover and contain
var resizeMode = nativeProps.resizeMode || nativeProps.style.resizeMode;
if (resizeMode) {
if (_universalEnv.isWeex) {
nativeProps.resize = resizeMode;
nativeProps.style.resizeMode = resizeMode;
} else {
nativeProps.style.objectFit = resizeMode;
}
}
if (this.props.children) {
nativeProps.children = null;
return (0, _rax.createElement)(_raxView2.default, { style: nativeProps.style }, (0, _rax.createElement)(NativeImage, nativeProps), (0, _rax.createElement)(_raxView2.default, { style: styles.absoluteImage }, this.props.children));
} else {
return (0, _rax.createElement)(NativeImage, nativeProps);
}
}
return null;
}
}]);
return Image;
}(_rax.Component), _class.propTypes = {}, _class.resizeMode = {
contain: 'contain',
cover: 'cover',
stretch: 'stretch',
center: 'center',
repeat: 'repeat'
}, _class.contextTypes = {
isInAParentText: _rax.PropTypes.bool
}, _temp);
var styles = {
absoluteImage: {
left: 0,
top: 0,
position: 'absolute'
}
};
exports.default = Image;
module.exports = exports['default'];
/***/ }),
/* 5 */
/***/ (function(module, exports) {
module.exports = require("@weex-module/dom");
/***/ }),
/* 6 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _rax = __webpack_require__(0);
var _raxView = __webpack_require__(2);
var _raxView2 = _interopRequireDefault(_raxView);
var _raxText = __webpack_require__(3);
var _raxText2 = _interopRequireDefault(_raxText);
var _raxLink = __webpack_require__(7);
var _raxLink2 = _interopRequireDefault(_raxLink);
var _raxImage = __webpack_require__(4);
var _raxImage2 = _interopRequireDefault(_raxImage);
var _raxIcon = __webpack_require__(8);
var _raxIcon2 = _interopRequireDefault(_raxIcon);
var _raxScrollview = __webpack_require__(9);
var _raxScrollview2 = _interopRequireDefault(_raxScrollview);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var demos = {
base: {
// mtop: require('./mtop'),
// fetch: require('./fetch'),
jsonp: __webpack_require__(11)
// storage: require('./storage')
}
// interface: {
// navigator: require('./navigator'),
// toast: require('./toast')
// },
// device: {
// env: require('./env'),
// geolocation: require('./geolocation'),
// network: require('./network')
// },
// social: {
// share: require('./share'),
// follow: require('./follow')
// },
// other: {
// wangwang: require('./wangwang'),
// user: require('./user'),
// scancode: require('./scancode')
// }
};
var Index = function (_Component) {
_inherits(Index, _Component);
function Index() {
var _ref;
var _temp, _this, _ret;
_classCallCheck(this, Index);
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
return _ret = (_temp = (_this = _possibleConstructorReturn(this, (_ref = Index.__proto__ || Object.getPrototypeOf(Index)).call.apply(_ref, [this].concat(args))), _this), _this.state = {
part: function () {
var m = window.location.href.match(/part=([^#&?$]+)/);
return m && m[1];
}(),
demo: function () {
var m = window.location.href.match(/demo=([^#&?$]+)/);
return m && m[1];
}()
}, _temp), _possibleConstructorReturn(_this, _ret);
}
_createClass(Index, [{
key: 'changeDemoName',
value: function changeDemoName(part, demo) {
this.setState({
part: part,
demo: demo
});
if (window.history && window.history.replaceState) {
window.history.replaceState(null, null, '?part=' + part + '&demo=' + demo);
}
}
}, {
key: 'renderItem',
value: function renderItem(DemoName) {
var _this2 = this;
var demo = this.state.demo;
return (0, _rax.createElement)(
_raxView2.default,
{ style: [styles.itemWrapper, styles.wholeWrapper] },
(0, _rax.createElement)(
_raxView2.default,
{ style: styles.titleWrapper },
(0, _rax.createElement)(
_raxView2.default,
{ style: styles.itemIconLink, onClick: function onClick() {
return _this2.changeDemoName(null, null);
} },
(0, _rax.createElement)(_raxIcon2.default, {
style: styles.itemIcon,
fontFamily: 'iconfont',
source: { uri: '//at.alicdn.com/t/font_383853_eoj22s8ewx6flxr.ttf', codePoint: '\uE607' }
}),
(0, _rax.createElement)(_raxText2.default, null)
),
(0, _rax.createElement)(
_raxText2.default,
{ style: styles.itemTitle },
'Tida-',
demo
)
),
(0, _rax.createElement)(
_raxScrollview2.default,
{ ref: function ref(scrollview) {
_this2.scrollview = scrollview;
} },
(0, _rax.createElement)(
_raxView2.default,
{ style: [styles.pWrapper, { marginTop: 40 }] },
(0, _rax.createElement)(
_raxView2.default,
{ style: styles.pindexTitle },
(0, _rax.createElement)(
_raxText2.default,
{ style: styles.pTitleText },
'\u5F15\u7528\u65B9\u5F0F'
)
),
(0, _rax.createElement)(
_raxView2.default,
{ style: styles.install },
(0, _rax.createElement)(
_raxText2.default,
null,
'require(\'tida/',
demo,
'\')'
)
)
),
(0, _rax.createElement)(
_raxView2.default,
{ style: styles.pWrapper },
(0, _rax.createElement)(
_raxView2.default,
{ style: styles.pindexTitle },
(0, _rax.createElement)(
_raxText2.default,
{ style: styles.pTitleText },
'\u6548\u679C\u6F14\u793A'
)
)
),
(0, _rax.createElement)(DemoName, null),
(0, _rax.createElement)(
_raxView2.default,
{ style: styles.footer },
(0, _rax.createElement)(
_raxText2.default,
{ style: styles.footerText, onclick: function onclick() {
return _this2.changeDemoName(null);
} },
'\xA9 TOBM - Tida'
)
)
)
);
}
}, {
key: 'renderIndex',
value: function renderIndex() {
var _this3 = this;
return (0, _rax.createElement)(
_raxView2.default,
{ style: [styles.indexWrapper, styles.wholeWrapper] },
(0, _rax.createElement)(
_raxScrollview2.default,
null,
(0, _rax.createElement)(
_raxView2.default,
{ style: styles.header },
(0, _rax.createElement)(
_raxText2.default,
{ style: styles.headerText },
'Tida / \u6A21\u5757\u5217\u8868'
)
),
Object.keys(demos).map(function (part) {
var coms = demos[part];
return (0, _rax.createElement)(
_raxView2.default,
null,
(0, _rax.createElement)(
_raxView2.default,
{ style: styles.indexTitle },
(0, _rax.createElement)(
_raxText2.default,
{ style: styles.indexTitleText },
firstLetterUpperCase(part)
)
),
Object.keys(coms).map(function (demo) {
return (0, _rax.createElement)(
_raxView2.default,
{ style: styles.list },
(0, _rax.createElement)(
_raxView2.default,
{ style: styles.item, onClick: function onClick() {
return _this3.changeDemoName(part, demo);
} },
(0, _rax.createElement)(_raxIcon2.default, {
style: styles.icon,
fontFamily: 'iconfont',
source: { uri: '//at.alicdn.com/t/font_383853_eoj22s8ewx6flxr.ttf', codePoint: '\uE644' }
}),
(0, _rax.createElement)(
_raxText2.default,
{ style: styles.itemText },
firstLetterUpperCase(demo)
),
(0, _rax.createElement)(_raxIcon2.default, {
style: styles.iconArrow,
fontFamily: 'iconfont',
source: { uri: '//at.alicdn.com/t/font_383853_eoj22s8ewx6flxr.ttf', codePoint: icons.right }
})
)
);
})
);
})
)
);
}
}, {
key: 'render',
value: function render() {
var part = this.state.part;
var demo = this.state.demo;
var showItem = part && demo && demos[part] && demos[part][demo];
if (!showItem) {
return this.renderIndex();
} else {
return this.renderItem(showItem);
}
}
}]);
return Index;
}(_rax.Component);
function firstLetterUpperCase(text) {
return text.charAt(0).toUpperCase() + text.slice(1);
}
var styles = {
wholeWrapper: {
position: 'absolute',
top: 0,
left: 0,
right: 0,
bottom: 0
},
itemWrapper: {
backgroundColor: '#FFF'
},
indexWrapper: {
backgroundColor: '#f2f3f4'
},
header: {
backgroundColor: '#FFF',
padding: 20,
marginBottom: 20,
display: 'flex',
alignItems: 'center',
borderBottom: '1px solid #e0e0e0'
},
headerText: {
fontSize: 40,
color: '#F60'
},
indexTitle: {
width: 750,
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
height: 120,
lineHeight: 120
},
indexTitleText: {
fontSize: 40,
color: '#555'
},
list: {
backgroundColor: '#FFF',
borderTop: '1px solid #f2f3f4'
},
item: {
display: 'flex',
height: 90,
flexDirection: 'row',
justifyContent: 'flex-start',
alignItems: 'center',
padding: 20,
borderBottomWidth: 2,
borderBottomStyle: 'solid',
borderBottomColor: '#f2f3f4',
position: 'relative'
},
itemText: {
color: '#555'
},
icon: {
color: '#F60',
fontSize: 34,
marginRight: 18
},
iconArrow: {
color: '#999',
position: 'absolute',
fontSize: 24,
right: 20
},
pWrapper: {
padding: 20
},
pTitleText: {
borderLeftWidth: 8,
borderLeftStyle: 'solid',
borderLeftColor: '#F60',
paddingLeft: 20,
paddingRight: 20,
paddingTop: 16,
paddingBottom: 18,
color: '#666',
fontSize: 32,
backgroundColor: '#f2f3f4'
},
install: {
padding: 20,
color: '#666',
marginTop: 20,
fontFamily: 'Consolas, sans-serif'
},
itemIconLink: {
width: 50,
height: 50,
position: 'absolute',
top: 20,
left: 14
},
itemIcon: {
color: '#F60',
fontSize: 36
},
titleWrapper: {
display: 'flex',
flexDirection: 'row',
justifyContent: 'center',
alignItems: 'center',
borderBottom: '1px solid #E0E0E0',
position: 'relative',
backgroundColor: '#f2f3f4'
},
itemTitle: {
paddingTop: 20,
paddingBottom: 20,
fontSize: 40,
fontFamily: 'Consolas, sans-serif',
color: '#777'
},
container: {
borderStyle: 'solid',
borderColor: '#dddddd',
borderWidth: 1,
marginLeft: 20,
marginRight: 20,
marginBottom: 10
},
footer: {
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
marginTop: 40,
marginBottom: 20
},
footerText: {
color: '#f60',
fontSize: 24
}
};
var icons = {
share: '\uE644',
image: '\uE600',
waterfall: '\uE62F',
video: '\uEA21',
refreshcontrol: '\uE6C7',
gotop: '\uE616',
button: '\uE904',
icon: '\uE622',
calendar: '\uE6BD',
slider: '\uE617',
input: '\uE64E',
countdown: '\uE618',
recyclerview: '\uE60D',
text: '\uE6CA',
multirow: '\uE83D',
view: '\uE8CB',
listview: '\uE6B4',
scrollview: '\uE61D',
link: '\uE62C',
picker: '\uE624',
modal: '\uE685',
right: '\uE643'
};
(0, _rax.render)((0, _rax.createElement)(Index, null));
/***/ }),
/* 7 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
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; };
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends = Object.assign || function (target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}return target;
};
var _createClass = function () {
function defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];descriptor.enumerable = descriptor.enumerable || false;descriptor.configurable = true;if ("value" in descriptor) descriptor.writable = true;Object.defineProperty(target, descriptor.key, descriptor);
}
}return function (Constructor, protoProps, staticProps) {
if (protoProps) defineProperties(Constructor.prototype, protoProps);if (staticProps) defineProperties(Constructor, staticProps);return Constructor;
};
}();
var _class, _temp;
var _rax = __webpack_require__(0);
var _universalEnv = __webpack_require__(1);
var _raxText = __webpack_require__(3);
var _raxText2 = _interopRequireDefault(_raxText);
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : { default: obj };
}
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
function _possibleConstructorReturn(self, call) {
if (!self) {
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
}return call && ((typeof call === "undefined" ? "undefined" : _typeof(call)) === "object" || typeof call === "function") ? call : self;
}
function _inherits(subClass, superClass) {
if (typeof superClass !== "function" && superClass !== null) {
throw new TypeError("Super expression must either be null or a function, not " + (typeof superClass === "undefined" ? "undefined" : _typeof(superClass)));
}subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } });if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
}
var Link = (_temp = _class = function (_Component) {
_inherits(Link, _Component);
function Link() {
_classCallCheck(this, Link);
return _possibleConstructorReturn(this, (Link.__proto__ || Object.getPrototypeOf(Link)).apply(this, arguments));
}
_createClass(Link, [{
key: 'getChildContext',
value: function getChildContext() {
return {
isInAParentLink: true
};
}
}, {
key: 'render',
value: function render() {
// https://www.w3.org/TR/html4/struct/links.html#h-12.2.2
if (this.context.isInAParentLink) {
return console.error('Nested links are illegal');
}
var props = this.props;
var children = props.children;
var nativeProps = _extends({}, props);
var style = _extends({}, styles.initial, nativeProps.style);
var textStyle = {
color: style.color,
lines: style.lines,
fontSize: style.fontSize,
fontStyle: style.fontStyle,
fontWeight: style.fontWeight,
textDecoration: style.textDecoration,
textAlign: style.textAlign,
fontFamily: style.fontFamily,
textOverflow: style.textOverflow
};
if (nativeProps.onPress) {
nativeProps.onClick = nativeProps.onPress;
delete nativeProps.onPress;
}
var content = children;
if (typeof children === 'string' && !this.context.isInAParentText) {
content = (0, _rax.createElement)(_raxText2.default, { style: textStyle }, children);
}
if (_universalEnv.isWeex) {
return (0, _rax.createElement)('a', nativeProps, content);
} else {
return (0, _rax.createElement)('a', _extends({}, nativeProps, { style: style }), content);
}
}
}]);
return Link;
}(_rax.Component), _class.contextTypes = {
isInAParentLink: _rax.PropTypes.bool,
isInAParentText: _rax.PropTypes.bool
}, _class.childContextTypes = {
isInAParentLink: _rax.PropTypes.bool
}, _temp);
var styles = {
initial: {
textDecoration: 'none'
}
};
exports.default = Link;
module.exports = exports['default'];
/***/ }),
/* 8 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
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; };
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends = Object.assign || function (target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}return target;
};
var _createClass = function () {
function defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];descriptor.enumerable = descriptor.enumerable || false;descriptor.configurable = true;if ("value" in descriptor) descriptor.writable = true;Object.defineProperty(target, descriptor.key, descriptor);
}
}return function (Constructor, protoProps, staticProps) {
if (protoProps) defineProperties(Constructor.prototype, protoProps);if (staticProps) defineProperties(Constructor, staticProps);return Constructor;
};
}();
var _class, _temp;
exports.createIconSet = createIconSet;
var _rax = __webpack_require__(0);
var _universalEnv = __webpack_require__(1);
var _raxView = __webpack_require__(2);
var _raxView2 = _interopRequireDefault(_raxView);
var _raxText = __webpack_require__(3);
var _raxText2 = _interopRequireDefault(_raxText);
var _raxImage = __webpack_require__(4);
var _raxImage2 = _interopRequireDefault(_raxImage);
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : { default: obj };
}
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
function _possibleConstructorReturn(self, call) {
if (!self) {
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
}return call && ((typeof call === "undefined" ? "undefined" : _typeof(call)) === "object" || typeof call === "function") ? call : self;
}
function _inherits(subClass, superClass) {
if (typeof superClass !== "function" && superClass !== null) {
throw new TypeError("Super expression must either be null or a function, not " + (typeof superClass === "undefined" ? "undefined" : _typeof(superClass)));
}subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } });if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
}
var Icon = (_temp = _class = function (_Component) {
_inherits(Icon, _Component);
function Icon() {
_classCallCheck(this, Icon);
return _possibleConstructorReturn(this, (Icon.__proto__ || Object.getPrototypeOf(Icon)).apply(this, arguments));
}
_createClass(Icon, [{
key: 'render',
value: function render() {
var style = this.props.style || {};
// for images
if (this.props.source.uri && !this.props.source.codePoint) {
return (0, _rax.createElement)(_raxImage2.default, {
source: { uri: this.props.source.uri },
style: style
});
}
// for iconfont
var uri = this.props.source.uri;
var fontFamily = this.props.fontFamily;
var iconStyle = _extends({}, style, {
fontFamily: fontFamily
});
if (_universalEnv.isWeb) {
var FontFace = window.FontFace;
var iconfont = new FontFace(fontFamily, 'url(' + uri + ')');
document.fonts.add(iconfont);
}
if (_universalEnv.isWeex) {
var domModule = __webpack_require__(5);
domModule.addRule('fontFace', {
'fontFamily': fontFamily,
'src': "url('" + uri + "')" // single quotes are required around uri, and double quotes can not work
});
}
return (0, _rax.createElement)(_raxText2.default, { style: iconStyle }, this.props.source.codePoint);
}
}]);
return Icon;
}(_rax.Component), _class.propTypes = {
fontFamily: _rax.PropTypes.string,
source: _rax.PropTypes.object
}, _temp);
exports.default = Icon;
function createIconSet(glyphMap, fontFamily, uri) {
var IconFont = function (_Component2) {
_inherits(IconFont, _Component2);
function IconFont() {
_classCallCheck(this, IconFont);
return _possibleConstructorReturn(this, (IconFont.__proto__ || Object.getPrototypeOf(IconFont)).apply(this, arguments));
}
_createClass(IconFont, [{
key: 'render',
value: function render() {
var codePoint = '';
if (this.props.codePoint) {
codePoint = this.props.codePoint;
} else if (this.props.name) {
codePoint = glyphMap[this.props.name];
}
return (0, _rax.createElement)(Icon, {
style: this.props.style,
fontFamily: fontFamily,
source: {
uri: uri,
codePoint: codePoint
} });
}
}]);
return IconFont;
}(_rax.Component);
return IconFont;
}
/***/ }),
/* 9 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
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; };
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends = Object.assign || function (target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}return target;
};
var _createClass = function () {
function defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];descriptor.enumerable = descriptor.enumerable || false;descriptor.configurable = true;if ("value" in descriptor) descriptor.writable = true;Object.defineProperty(target, descriptor.key, descriptor);
}
}return function (Constructor, protoProps, staticProps) {
if (protoProps) defineProperties(Constructor.prototype, protoProps);if (staticProps) defineProperties(Constructor, staticProps);return Constructor;
};
}();
var _class, _temp;
var _rax = __webpack_require__(0);
var _universalEnv = __webpack_require__(1);
var _raxView = __webpack_require__(2);
var _raxView2 = _interopRequireDefault(_raxView);
var _raxRefreshcontrol = __webpack_require__(10);
var _raxRefreshcontrol2 = _interopRequireDefault(_raxRefreshcontrol);
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : { default: obj };
}
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
function _possibleConstructorReturn(self, call) {
if (!self) {
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
}return call && ((typeof call === "undefined" ? "undefined" : _typeof(call)) === "object" || typeof call === "function") ? call : self;
}
function _inherits(subClass, superClass) {
if (typeof superClass !== "function" && superClass !== null) {
throw new TypeError("Super expression must either be null or a function, not " + (typeof superClass === "undefined" ? "undefined" : _typeof(superClass)));
}subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } });if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
}
var DEFAULT_END_REACHED_THRESHOLD = 500;
var DEFAULT_SCROLL_CALLBACK_THROTTLE = 50;
var FULL_WIDTH = 750;
var ScrollView = (_temp = _class = function (_Component) {
_inherits(ScrollView, _Component);
function ScrollView(props) {
_classCallCheck(this, ScrollView);
var _this = _possibleConstructorReturn(this, (ScrollView.__proto__ || Object.getPrototypeOf(ScrollView)).call(this, props));
_this.lastScrollDistance = 0;
_this.lastScrollContentSize = 0;
_this.loadmoreretry = 1;
_this.handleScroll = function (e) {
if (_universalEnv.isWeb) {
if (_this.props.onScroll) {
e.nativeEvent = {
get contentOffset() {
return {
x: e.target.scrollLeft,
y: e.target.scrollTop
};
}
};
_this.props.onScroll(e);
}
if (_this.props.onEndReached) {
if (!_this.scrollerNode) {
_this.scrollerNode = (0, _rax.findDOMNode)(_this.refs.scroller);
_this.scrollerContentNode = (0, _rax.findDOMNode)(_this.refs.contentContainer);
_this.scrollerNodeSize = _this.props.horizontal ? _this.scrollerNode.offsetWidth : _this.scrollerNode.offsetHeight;
}
// NOTE:in iOS7/8 offsetHeight/Width is is inaccurate ( use scrollHeight/Width )
var scrollContentSize = _this.props.horizontal ? _this.scrollerNode.scrollWidth : _this.scrollerNode.scrollHeight;
var scrollDistance = _this.props.horizontal ? _this.scrollerNode.scrollLeft : _this.scrollerNode.scrollTop;
var isEndReached = scrollContentSize - scrollDistance - _this.scrollerNodeSize < _this.props.onEndReachedThreshold;
var isScrollToEnd = scrollDistance > _this.lastScrollDistance;
var isLoadedMoreContent = scrollContentSize != _this.lastScrollContentSize;
if (isEndReached && isScrollToEnd && isLoadedMoreContent) {
_this.lastScrollContentSize = scrollContentSize;
_this.props.onEndReached(e);
}
_this.lastScrollDistance = scrollDistance;
}
}
if (_universalEnv.isWeex) {
e.nativeEvent = {
contentOffset: {
// HACK: weex scroll event value is opposite of web
x: -e.contentOffset.x,
y: -e.contentOffset.y
}
};
_this.props.onScroll(e);
}
};
_this.resetScroll = function () {
if (_universalEnv.isWeb) {
_this.lastScrollContentSize = 0;
_this.lastScrollDistance = 0;
} else {
_this.setState({
loadmoreretry: _this.loadmoreretry++
});
}
};
_this.scrollTo = function (options) {
var x = parseInt(options.x);
var y = parseInt(options.y);
if (_universalEnv.isWeex) {
var dom = __webpack_require__(5);
var contentContainer = (0, _rax.findDOMNode)(_this.refs.contentContainer);
dom.scrollToElement(contentContainer.ref, {
offset: x || y || 0,
animated: options && typeof options.animated !== 'undefined' ? options.animated : true
});
} else {
var pixelRatio = document.documentElement.clientWidth / FULL_WIDTH;
if (x >= 0) {
(0, _rax.findDOMNode)(_this.refs.scroller).scrollLeft = pixelRatio * x;
}
if (y >= 0) {
(0, _rax.findDOMNode)(_this.refs.scroller).scrollTop = pixelRatio * y;
}
}
};
_this.state = {
loadmoreretry: 0
};
return _this;
}
_createClass(ScrollView, [{
key: 'render',
value: function render() {
var _this2 = this;
var _props = this.props,
id = _props.id,
style = _props.style,
scrollEventThrottle = _props.scrollEventThrottle,
showsHorizontalScrollIndicator = _props.showsHorizontalScrollIndicator,
showsVerticalScrollIndicator = _props.showsVerticalScrollIndicator,
onEndReached = _props.onEndReached,
onEndReachedThreshold = _props.onEndReachedThreshold,
onScroll = _props.onScroll,
children = _props.children;
// In weex must be int value
onEndReachedThreshold = parseInt(onEndReachedThreshold, 10);
var contentContainerStyle = [this.props.horizontal && s