Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-mobile-datepicker

Package Overview
Dependencies
Maintainers
1
Versions
39
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-mobile-datepicker - npm Package Compare versions

Comparing version 1.0.11 to 1.0.12

6

CHANGELOG.md

@@ -0,1 +1,7 @@

v1.0.12 - Sun, 26 Jun 2016 02:20:39 GMT
---------------------------------------
- [37441d7](../../commit/37441d7) [added] 添加注释, 测试用例
v1.0.11 - Fri, 24 Jun 2016 02:35:43 GMT

@@ -2,0 +8,0 @@ ---------------------------------------

51

lib/DatePicker.js
/**
* @module DatePicker组件
*/
import './index.css';
import React, { Component, PropTypes } from 'react';

@@ -29,5 +29,5 @@ import { nextTime, getTimeName } from './time.js';

this.animating = false;
this.touchY = 0;
this.angle = 0;
this.animating = false; // 判断是否在transition过渡动画之中
this.touchY = 0; // 保存touchstart的pageY
this.angle = 0; // 容器转过的角度
this.state = {

@@ -45,2 +45,7 @@ angle: 0,

/**
* 根据角度返回透明度(0-1之间)
* @param {number} angle 角度
* @return
*/
_setOpacity(angle) {

@@ -52,2 +57,7 @@ return angle > 0

/**
* 清除对象的transition样式
* @param {Dom} obj 指定的对象
* @return {undefined}
*/
_clearTransition(obj) {

@@ -57,2 +67,7 @@ obj.style[TRANSITION] = ''; // eslint-disable-line

/**
* 滑动到下一日期
* @param {number} direction 滑动方向
* @return {undefined}
*/
_moveToNext(direction) {

@@ -77,2 +92,8 @@ const scroll = this.refs.scroll;

/**
* 添加滑动动画
* @param {DOM} obj DOM对象
* @param {number} angle 角度
* @return {undefined}
*/
_moveTo(obj, angle) {

@@ -86,2 +107,6 @@ this.animating = true;

/**
* 点击完成按钮事件
* @return {undefined}
*/
handleFinishBtnClick() {

@@ -92,2 +117,7 @@ const date = this.state.dates.find(value => value.angle + this.state.angle === 0);

/**
* 滑动日期选择器事件
* @param {Object} event 事件对象
* @return {undefined}
*/
handleContentTouch(event) {

@@ -117,2 +147,6 @@ event.preventDefault();

/**
* transition过渡完成事件
* @return {undefined}
*/
handleContentTransitionEnd() {

@@ -137,2 +171,7 @@ const { dates, angle } = this.state;

/**
* 渲染一个日期DOM对象
* @param {Object} date date数据
* @return {Object} JSX对象
*/
renderDatepickerItem(date) {

@@ -153,2 +192,6 @@ const itemStyle = {

/**
* render函数
* @return {Object} JSX对象
*/
render() {

@@ -155,0 +198,0 @@ const { layerBackground, btnColor } = this.props;

@@ -0,2 +1,3 @@

import './index.css';
import DatePicker from './DatePicker.js';
export default DatePicker;

@@ -0,1 +1,5 @@

/**
* @module time工具
*/
function convertDate(timestamp, formate) {

@@ -19,3 +23,7 @@ const date = new Date(timestamp);

/**
* 获取相对日期的偏移日期
* @param {Date} 日期
* @return {number} 相对的天数
*/
export function nextTime(now = new Date(), index = 1) {

@@ -31,2 +39,7 @@ if (Object.prototype.toString.call(now, null) !== '[object Date]') {

/**
* 获取指定日期的格式化日期名称
* @param {Date} 日期
* @return {String} 格式化日期名称
*/
export function getTimeName(now) {

@@ -33,0 +46,0 @@ if (Object.prototype.toString.call(now, null) !== '[object Date]') {

4

lib/transition.js

@@ -9,3 +9,3 @@ let TRANSITION = null;

} else if (typeof document.body.style.webkitTransition === 'string') {
TRANSITION = 'webkitTransition';
TRANSITION = 'WebkitTransition';
TRANSITION_CSS = '-webkit-transition';

@@ -21,3 +21,3 @@ TRANSITIONEND = 'webkitTransitionEnd';

} else if (typeof document.body.style.webkitTransform === 'string') {
TRANSFORM = 'webkitTransform';
TRANSFORM = 'WebkitTransform';
TRANSFORM_CSS = '-webkit-transform';

@@ -24,0 +24,0 @@ }

{
"name": "react-mobile-datepicker",
"version": "1.0.11",
"version": "1.0.12",
"description": "一个移动端时间选择器react组件",

@@ -11,3 +11,3 @@ "main": "./dist/mobile-datepicker.js",

"start": "webpack-dev-server",
"release": "scripts/release",
"release": "npm install build;scripts/release",
"preview-release": "scripts/preview-release",

@@ -24,2 +24,3 @@ "mocha": "./node_modules/.bin/mocha --compilers js:babel-core/register --require ./test/helper.js --recursive",

"babel-loader": "^6.2.4",
"babel-polyfill": "^6.9.1",
"babel-preset-es2015": "^6.9.0",

@@ -32,2 +33,3 @@ "babel-preset-react": "^6.5.0",

"cssnext": "^1.8.4",
"enzyme": "^2.3.0",
"eslint": "^2.10.2",

@@ -47,3 +49,5 @@ "eslint-config-airbnb": "9.0.1",

"postcss-nested": "^1.0.0",
"react-addons-test-utils": "^15.1.0",
"rf-release": "^0.4.0",
"sinon": "^1.17.4",
"style-loader": "^0.13.1",

@@ -50,0 +54,0 @@ "webpack": "^1.13.1",

@@ -20,7 +20,7 @@ # react-mobile-datepicker

import DatePicker from 'react-mobile-datepicker';
import 'react-mobile-datepicker/dist/react-mobile-datepicker.css'; // Make sure to import the default stylesheet
import 'react-mobile-datepicker/dist/mobile-datepicker.css'; // Make sure to import the default stylesheet
// Not using an ES6 transpiler
var DatePicker = require('react-mobile-datepicker');
require('react-mobile-datepicker/dist/react-mobile-datepicker.css');
require('react-mobile-datepicker/dist/mobile-datepicker.css');
```

@@ -35,4 +35,4 @@

import { render } from 'react-dom';
import DatePicker from 'react-mobile-datepicker';
import 'react-mobile-datepicker/dist/react-mobile-datepicker.css'; // only needs to be imported once
import DatePicker from 'mobile-datepicker';
import 'react-mobile-datepicker/dist/mobile-datepicker.css'; // only needs to be imported once

@@ -39,0 +39,0 @@ // Render the Calendar

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc