New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

bee-datepicker

Package Overview
Dependencies
Maintainers
11
Versions
276
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bee-datepicker - npm Package Compare versions

Comparing version 1.0.20 to 1.0.21

4

build/RangePicker.js

@@ -39,4 +39,2 @@ "use strict";

require("moment/locale/en-gb");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }

@@ -127,3 +125,3 @@

defaultValue: [now, now.clone().add(1, 'months')],
locale: cn ? _zh_CN2["default"] : _en_US2["default"],
locale: props.locale || _zh_CN2["default"],
onChange: props.onChange,

@@ -130,0 +128,0 @@ disabledDate: props.disabledDate

@@ -15,2 +15,4 @@ /**

import Icon from 'bee-icon';
import 'moment/locale/zh-cn';
moment.locale('zh-cn');

@@ -17,0 +19,0 @@ const format = "YYYY-MM-DD";

@@ -12,3 +12,2 @@ /**

import zhCN from "rc-calendar/lib/locale/zh_CN";
import enUS from "rc-calendar/lib/locale/en_US";
import moment from "moment/moment";

@@ -70,3 +69,2 @@

onChange={this.onChange.bind(this)}
locale={zhCN}
showClear={true}

@@ -76,2 +74,3 @@ showOk={true}

defaultValue={this.state.value}
placeholder={'开始 ~ 结束'}
/>

@@ -78,0 +77,0 @@ </Col>

@@ -13,3 +13,3 @@ import {Col, Row} from 'bee-layout';

var Demo1 = require("./demolist/Demo1");var Demo2 = require("./demolist/Demo2");var Demo3 = require("./demolist/Demo3");var Demo4 = require("./demolist/Demo4");var Demo5 = require("./demolist/Demo5");var Demo6 = require("./demolist/Demo6");var Demo7 = require("./demolist/Demo7");var Demo8 = require("./demolist/Demo8");var Demo9 = require("./demolist/Demo9");var DemoArray = [{"example":<Demo1 />,"title":" 选择日期","code":"/**\n *\n * @title 选择日期\n * @description 以「日期」为基本单位,基础的日期选择控件\n */\n\nimport React, { Component } from \"react\";\nimport { Row, Col } from \"bee-layout\";\nimport DatePicker from \"../../src/index\";\n\nimport zhCN from \"rc-calendar/lib/locale/zh_CN\";\nimport enUS from \"rc-calendar/lib/locale/en_US\";\nimport moment from \"moment\";\nimport Icon from 'bee-icon';\n\nconst format = \"YYYY-MM-DD\";\n\nconst dateInputPlaceholder = \"选择日期\";\n\nfunction onSelect(d) {\n // console.log(d);\n}\n\n\n\nclass Demo1 extends Component {\n constructor(props) {\n super(props);\n this.state = {\n value: ''\n };\n }\n onChange = d => {\n console.log(d.format(format));\n this.setState({\n value:d\n })\n };\n clear = d => {\n this.setState({\n value:''\n })\n }\n render() {\n var self = this;\n return (\n <div>\n <Row>\n <Col md={8}>\n <DatePicker\n format={format}\n onSelect={onSelect}\n onChange={this.onChange}\n locale={zhCN}\n //defaultValue={this.state.value}\n value={this.state.value}\n placeholder={dateInputPlaceholder}\n autofocus={false}\n />\n </Col>\n <Col md={3}>\n <button className=\"u-button\" onClick={this.clear}>清空</button>\n </Col>\n </Row>\n </div>\n );\n }\n}\n\n\n","desc":" 以「日期」为基本单位,基础的日期选择控件"},{"example":<Demo2 />,"title":" 选择年月","code":"/**\n *\n * @title 选择年月\n * @description 以「年月」为基本单位,基础的年月选择控件\n */\n\nimport React, { Component } from \"react\";\nimport { Row, Col } from \"bee-layout\";\nimport DatePicker from \"../../src/index\";\nimport moment from \"moment\";\n\nimport zhCN from \"rc-calendar/lib/locale/zh_CN\";\nimport enUS from \"rc-calendar/lib/locale/en_US\";\n\nconst { MonthPicker } = DatePicker;\n\nconst format2 = \"YYYY-MM\";\n\nfunction onSelect(d) {\n console.log(d);\n}\n\nfunction onChange(d) {\n console.log(d);\n}\n\nclass Demo2 extends Component {\n render() {\n return (\n <div>\n <Row>\n <Col md={12}>\n <MonthPicker\n format={format2}\n onSelect={onSelect}\n onChange={onChange}\n locale={zhCN}\n defaultValue={moment()}\n placeholder={\"选择年月\"}\n />\n </Col>\n </Row>\n </div>\n );\n }\n}\n\n\n","desc":" 以「年月」为基本单位,基础的年月选择控件"},{"example":<Demo3 />,"title":" 日期范围","code":"/**\n *\n * @title 日期范围\n * @description 以「日期范围」为基本单位,基础的日期范围选择控件\n */\n\nimport React, {Component} from \"react\";\nimport {Row, Col} from \"bee-layout\";\nimport DatePicker from \"../../src/index\";\n\nimport zhCN from \"rc-calendar/lib/locale/zh_CN\";\nimport enUS from \"rc-calendar/lib/locale/en_US\";\nimport moment from \"moment/moment\";\n\nconst now = moment();\n\nconst {RangePicker} = DatePicker;\n\nconst format3 = \"YYYY-MM-DD\";\n\nfunction formatValue(value, format) {\n return (value && value.format(format)) || '';\n}\n\nfunction onSelect(d) {\n //console.log(d);\n}\n\n\n\nclass Demo3 extends Component {\n constructor(props) {\n super(props);\n this.state = {\n value: [moment('2017-01-11'), moment('2017-01-19')],\n v:''\n };\n }\n\n onStartChange = (value) => {\n this.setState({\n startValue: value[0],\n startOpen: false,\n endOpen: true,\n });\n }\n\n remove() {\n this.setState({value: ''})\n }\n\n onChange (d) {\n this.setState({\n value:d,\n })\n }\n\n render() {\n const props = this.props;\n console.log(this.state.v);\n return (\n <div>\n <Row>\n <Col md={8}>\n <RangePicker\n format={format3}\n onSelect={onSelect}\n onChange={this.onChange.bind(this)}\n locale={zhCN}\n showClear={true}\n showOk={true}\n className={'range-fixed'}\n defaultValue={this.state.value}\n />\n </Col>\n <Col md={3}>\n <button className=\"u-button\" onClick={this.remove.bind(this)}>清空</button>\n </Col>\n </Row>\n </div>\n );\n }\n}\n\n\n","desc":" 以「日期范围」为基本单位,基础的日期范围选择控件"},{"example":<Demo4 />,"title":" 动态的改变时间","code":"/**\n *\n * @title 动态的改变时间\n * @description 以「日期时间」为基本单位,基础的日期时间选择控件\n */\n\nimport React, { Component } from \"react\";\nimport DatePicker from \"../../src/index\";\nimport moment from \"moment\";\nimport zhCN from \"rc-calendar/lib/locale/zh_CN\";\nimport { Row, Col } from \"bee-layout\";\nimport Button from \"bee-button\";\nconst format = \"YYYY-MM-DD HH:mm:ss\";\nconst dateInputPlaceholder = \"选择日期\";\n\nclass Demo4 extends Component {\n constructor(props) {\n super(props);\n this.state = {\n value: moment()\n };\n }\n\n handleChange = value => {\n this.setState({\n value: value\n });\n };\n onSelect = d => {\n console.log(d);\n };\n\n handlerChangeDate = () => {\n this.setState({\n value: moment(\"2011-11-11 11:11:11\")\n });\n console.log(\"click\");\n };\n render() {\n return (\n <div>\n <Row>\n <Col md={8}>\n <DatePicker\n format={format}\n locale={zhCN}\n onSelect={this.onSelect}\n onChange={this.handleChange}\n value={this.state.value}\n placeholder={dateInputPlaceholder}\n />\n </Col>\n <Col md={3}>\n <Button onClick={this.handlerChangeDate}>变</Button>\n </Col>\n </Row>\n </div>\n );\n }\n}\n\n\n","desc":" 以「日期时间」为基本单位,基础的日期时间选择控件"},{"example":<Demo5 />,"title":" 选择周","code":"/**\n *\n * @title 选择周\n * @description 以「周」为基本单位,基础的周选择控件\n */\n\nimport React, { Component } from \"react\";\nimport { Row, Col } from \"bee-layout\";\nimport DatePicker from \"../../src/index\";\nconst { WeekPicker } = DatePicker;\nimport moment from \"moment\";\n\nfunction onSelect(d) {\n console.log(d);\n}\n\nfunction onChange(d) {\n console.log(d);\n}\n\nclass Demo5 extends Component {\n render() {\n return (\n <div>\n <Row>\n <Col md={12}>\n <WeekPicker defaultValue={moment()} placeholder=\"选择周\" />\n </Col>\n </Row>\n </div>\n );\n }\n}\n\n\n","desc":" 以「周」为基本单位,基础的周选择控件"},{"example":<Demo6 />,"title":" 选择日期时间","code":"/**\n *\n * @title 选择日期时间\n * @description 以「日期时间」为基本单位,可以选择日期和时间\n */\n\nimport React, { Component } from \"react\";\nimport { Row, Col } from \"bee-layout\";\nimport DatePicker from \"../../src/index\";\n\nimport zhCN from \"rc-calendar/lib/locale/zh_CN\";\nimport enUS from \"rc-calendar/lib/locale/en_US\";\nimport moment from \"moment\";\n\nconst format = \"YYYY-MM-DD HH:mm:ss\";\n\nconst dateInputPlaceholder = \"选择日期\";\n\nfunction onSelect(d) {\n console.log(d);\n}\n\nfunction onChange(d) {\n console.log(d);\n}\n\nclass Demo6 extends Component {\n render() {\n return (\n <div>\n <Row>\n <Col md={12}>\n <DatePicker\n format={format}\n showTime={true}\n onSelect={onSelect}\n onChange={onChange}\n locale={zhCN}\n defaultValue={moment()}\n placeholder={dateInputPlaceholder}\n />\n </Col>\n </Row>\n </div>\n );\n }\n}\n\n\n","desc":" 以「日期时间」为基本单位,可以选择日期和时间"},{"example":<Demo7 />,"title":" 禁用日期","code":"/**\n *\n * @title 禁用日期\n * @description 禁用日期\n */\n\nimport React, { Component } from \"react\";\nimport { Row, Col } from \"bee-layout\";\nimport DatePicker from \"../../src/index\";\n\nimport zhCN from \"rc-calendar/lib/locale/zh_CN\";\nimport enUS from \"rc-calendar/lib/locale/en_US\";\nimport moment from \"moment\";\n\nconst format = \"YYYY-MM-DD\";\n\nconst dateInputPlaceholder = \"选择日期\";\n\nfunction onSelect(d) {\n console.log(d);\n}\n\nfunction onChange(d) {\n console.log(d);\n}\n\nclass Demo7 extends Component {\n render() {\n return (\n <div>\n <Row>\n <Col md={12}>\n <DatePicker\n format={format}\n onSelect={onSelect}\n onChange={onChange}\n locale={zhCN}\n defaultValue={moment()}\n placeholder={dateInputPlaceholder}\n disabled={true}\n />\n </Col>\n </Row>\n </div>\n );\n }\n}\n\n\n","desc":" 禁用日期"},{"example":<Demo8 />,"title":" 不可选择日期和时间","code":"/**\n *\n * @title 不可选择日期和时间\n * @description 可用 disabledDate 和 disabledTime 分别禁止选择部分日期和时间,其中 disabledTime 需要和 showTime 一起使用。\n */\n\nimport React, { Component } from \"react\";\nimport { Row, Col } from \"bee-layout\";\nimport DatePicker from \"../../src/index\";\n\nimport zhCN from \"rc-calendar/lib/locale/zh_CN\";\nimport moment from \"moment\";\n\nconst format = \"YYYY-MM-DD\";\n\nconst dateInputPlaceholder = \"选择日期\";\n\nfunction onSelect(d) {\n console.log(d);\n}\n\nfunction onChange(d) {\n console.log(d);\n}\n\nfunction disabledDate(current) {\n return current && current.valueOf() < Date.now();\n}\n\nclass Demo7 extends Component {\n render() {\n return (\n <div>\n <Row>\n <Col md={12}>\n <DatePicker\n format={format}\n onSelect={onSelect}\n onChange={onChange}\n locale={zhCN}\n disabledDate={disabledDate}\n defaultValue={moment()}\n placeholder={dateInputPlaceholder}\n />\n </Col>\n </Row>\n </div>\n );\n }\n}\n\n\n","desc":" 可用 disabledDate 和 disabledTime 分别禁止选择部分日期和时间,其中 disabledTime 需要和 showTime 一起使用。"},{"example":<Demo9 />,"title":" 自定义日期渲染父级容器","code":"/**\n *\n * @title 自定义日期渲染父级容器\n * @description 以「日期」为基本单位,基础的日期选择控件\n */\n\nimport React, { Component } from \"react\";\nimport { Row, Col } from \"bee-layout\";\nimport DatePicker from \"../../src/index\";\n\nimport zhCN from \"rc-calendar/lib/locale/zh_CN\";\nimport enUS from \"rc-calendar/lib/locale/en_US\";\nimport moment from \"moment\";\nimport Icon from 'bee-icon';\n\nconst format = \"YYYY-MM-DD\";\n\nconst dateInputPlaceholder = \"选择日期\";\n\nfunction onSelect(d) {\n // console.log(d);\n}\n\nfunction onChange(d) {\n this.setState({\n value: ''\n });\n}\n\nclass Demo1 extends Component {\n constructor(props) {\n super(props);\n this.state = {\n value: ''\n };\n }\n getCalendarContainer() {\n return this.d || document.getElementById('d');\n }\n onChange = d => {\n console.log(d)\n\n this.setState({\n value: ''\n });\n };\n render() {\n return (\n <div id=\"d\" ref=\"d\">\n <Row>\n <Col md={12}>\n <DatePicker\n format={format}\n onSelect={onSelect}\n onChange={this.onChange}\n locale={zhCN}\n defaultValue={this.state.value}\n placeholder={dateInputPlaceholder}\n getCalendarContainer={this.getCalendarContainer}\n />\n </Col>\n </Row>\n </div>\n );\n }\n}\n\n\n","desc":" 以「日期」为基本单位,基础的日期选择控件"}]
var Demo1 = require("./demolist/Demo1");var Demo2 = require("./demolist/Demo2");var Demo3 = require("./demolist/Demo3");var Demo4 = require("./demolist/Demo4");var Demo5 = require("./demolist/Demo5");var Demo6 = require("./demolist/Demo6");var Demo7 = require("./demolist/Demo7");var Demo8 = require("./demolist/Demo8");var Demo9 = require("./demolist/Demo9");var DemoArray = [{"example":<Demo1 />,"title":" 选择日期","code":"/**\n *\n * @title 选择日期\n * @description 以「日期」为基本单位,基础的日期选择控件\n */\n\nimport React, { Component } from \"react\";\nimport { Row, Col } from \"bee-layout\";\nimport DatePicker from \"../../src/index\";\n\nimport zhCN from \"rc-calendar/lib/locale/zh_CN\";\nimport enUS from \"rc-calendar/lib/locale/en_US\";\nimport moment from \"moment\";\nimport Icon from 'bee-icon';\nimport 'moment/locale/zh-cn';\nmoment.locale('zh-cn');\n\nconst format = \"YYYY-MM-DD\";\n\nconst dateInputPlaceholder = \"选择日期\";\n\nfunction onSelect(d) {\n // console.log(d);\n}\n\n\n\nclass Demo1 extends Component {\n constructor(props) {\n super(props);\n this.state = {\n value: ''\n };\n }\n onChange = d => {\n console.log(d.format(format));\n this.setState({\n value:d\n })\n };\n clear = d => {\n this.setState({\n value:''\n })\n }\n render() {\n var self = this;\n return (\n <div>\n <Row>\n <Col md={8}>\n <DatePicker\n format={format}\n onSelect={onSelect}\n onChange={this.onChange}\n locale={zhCN}\n //defaultValue={this.state.value}\n value={this.state.value}\n placeholder={dateInputPlaceholder}\n autofocus={false}\n />\n </Col>\n <Col md={3}>\n <button className=\"u-button\" onClick={this.clear}>清空</button>\n </Col>\n </Row>\n </div>\n );\n }\n}\n\n\n","desc":" 以「日期」为基本单位,基础的日期选择控件"},{"example":<Demo2 />,"title":" 选择年月","code":"/**\n *\n * @title 选择年月\n * @description 以「年月」为基本单位,基础的年月选择控件\n */\n\nimport React, { Component } from \"react\";\nimport { Row, Col } from \"bee-layout\";\nimport DatePicker from \"../../src/index\";\nimport moment from \"moment\";\n\nimport zhCN from \"rc-calendar/lib/locale/zh_CN\";\nimport enUS from \"rc-calendar/lib/locale/en_US\";\n\nconst { MonthPicker } = DatePicker;\n\nconst format2 = \"YYYY-MM\";\n\nfunction onSelect(d) {\n console.log(d);\n}\n\nfunction onChange(d) {\n console.log(d);\n}\n\nclass Demo2 extends Component {\n render() {\n return (\n <div>\n <Row>\n <Col md={12}>\n <MonthPicker\n format={format2}\n onSelect={onSelect}\n onChange={onChange}\n locale={zhCN}\n defaultValue={moment()}\n placeholder={\"选择年月\"}\n />\n </Col>\n </Row>\n </div>\n );\n }\n}\n\n\n","desc":" 以「年月」为基本单位,基础的年月选择控件"},{"example":<Demo3 />,"title":" 日期范围","code":"/**\n *\n * @title 日期范围\n * @description 以「日期范围」为基本单位,基础的日期范围选择控件\n */\n\nimport React, {Component} from \"react\";\nimport {Row, Col} from \"bee-layout\";\nimport DatePicker from \"../../src/index\";\n\nimport zhCN from \"rc-calendar/lib/locale/zh_CN\";\nimport moment from \"moment/moment\";\n\nconst now = moment();\n\nconst {RangePicker} = DatePicker;\n\nconst format3 = \"YYYY-MM-DD\";\n\nfunction formatValue(value, format) {\n return (value && value.format(format)) || '';\n}\n\nfunction onSelect(d) {\n //console.log(d);\n}\n\n\n\nclass Demo3 extends Component {\n constructor(props) {\n super(props);\n this.state = {\n value: [moment('2017-01-11'), moment('2017-01-19')],\n v:''\n };\n }\n\n onStartChange = (value) => {\n this.setState({\n startValue: value[0],\n startOpen: false,\n endOpen: true,\n });\n }\n\n remove() {\n this.setState({value: ''})\n }\n\n onChange (d) {\n this.setState({\n value:d,\n })\n }\n\n render() {\n const props = this.props;\n console.log(this.state.v);\n return (\n <div>\n <Row>\n <Col md={8}>\n <RangePicker\n format={format3}\n onSelect={onSelect}\n onChange={this.onChange.bind(this)}\n showClear={true}\n showOk={true}\n className={'range-fixed'}\n defaultValue={this.state.value}\n placeholder={'开始 ~ 结束'}\n />\n </Col>\n <Col md={3}>\n <button className=\"u-button\" onClick={this.remove.bind(this)}>清空</button>\n </Col>\n </Row>\n </div>\n );\n }\n}\n\n\n","desc":" 以「日期范围」为基本单位,基础的日期范围选择控件"},{"example":<Demo4 />,"title":" 动态的改变时间","code":"/**\n *\n * @title 动态的改变时间\n * @description 以「日期时间」为基本单位,基础的日期时间选择控件\n */\n\nimport React, { Component } from \"react\";\nimport DatePicker from \"../../src/index\";\nimport moment from \"moment\";\nimport zhCN from \"rc-calendar/lib/locale/zh_CN\";\nimport { Row, Col } from \"bee-layout\";\nimport Button from \"bee-button\";\nconst format = \"YYYY-MM-DD HH:mm:ss\";\nconst dateInputPlaceholder = \"选择日期\";\n\nclass Demo4 extends Component {\n constructor(props) {\n super(props);\n this.state = {\n value: moment()\n };\n }\n\n handleChange = value => {\n this.setState({\n value: value\n });\n };\n onSelect = d => {\n console.log(d);\n };\n\n handlerChangeDate = () => {\n this.setState({\n value: moment(\"2011-11-11 11:11:11\")\n });\n console.log(\"click\");\n };\n render() {\n return (\n <div>\n <Row>\n <Col md={8}>\n <DatePicker\n format={format}\n locale={zhCN}\n onSelect={this.onSelect}\n onChange={this.handleChange}\n value={this.state.value}\n placeholder={dateInputPlaceholder}\n />\n </Col>\n <Col md={3}>\n <Button onClick={this.handlerChangeDate}>变</Button>\n </Col>\n </Row>\n </div>\n );\n }\n}\n\n\n","desc":" 以「日期时间」为基本单位,基础的日期时间选择控件"},{"example":<Demo5 />,"title":" 选择周","code":"/**\n *\n * @title 选择周\n * @description 以「周」为基本单位,基础的周选择控件\n */\n\nimport React, { Component } from \"react\";\nimport { Row, Col } from \"bee-layout\";\nimport DatePicker from \"../../src/index\";\nconst { WeekPicker } = DatePicker;\nimport moment from \"moment\";\n\nfunction onSelect(d) {\n console.log(d);\n}\n\nfunction onChange(d) {\n console.log(d);\n}\n\nclass Demo5 extends Component {\n render() {\n return (\n <div>\n <Row>\n <Col md={12}>\n <WeekPicker defaultValue={moment()} placeholder=\"选择周\" />\n </Col>\n </Row>\n </div>\n );\n }\n}\n\n\n","desc":" 以「周」为基本单位,基础的周选择控件"},{"example":<Demo6 />,"title":" 选择日期时间","code":"/**\n *\n * @title 选择日期时间\n * @description 以「日期时间」为基本单位,可以选择日期和时间\n */\n\nimport React, { Component } from \"react\";\nimport { Row, Col } from \"bee-layout\";\nimport DatePicker from \"../../src/index\";\n\nimport zhCN from \"rc-calendar/lib/locale/zh_CN\";\nimport enUS from \"rc-calendar/lib/locale/en_US\";\nimport moment from \"moment\";\n\nconst format = \"YYYY-MM-DD HH:mm:ss\";\n\nconst dateInputPlaceholder = \"选择日期\";\n\nfunction onSelect(d) {\n console.log(d);\n}\n\nfunction onChange(d) {\n console.log(d);\n}\n\nclass Demo6 extends Component {\n render() {\n return (\n <div>\n <Row>\n <Col md={12}>\n <DatePicker\n format={format}\n showTime={true}\n onSelect={onSelect}\n onChange={onChange}\n locale={zhCN}\n defaultValue={moment()}\n placeholder={dateInputPlaceholder}\n />\n </Col>\n </Row>\n </div>\n );\n }\n}\n\n\n","desc":" 以「日期时间」为基本单位,可以选择日期和时间"},{"example":<Demo7 />,"title":" 禁用日期","code":"/**\n *\n * @title 禁用日期\n * @description 禁用日期\n */\n\nimport React, { Component } from \"react\";\nimport { Row, Col } from \"bee-layout\";\nimport DatePicker from \"../../src/index\";\n\nimport zhCN from \"rc-calendar/lib/locale/zh_CN\";\nimport enUS from \"rc-calendar/lib/locale/en_US\";\nimport moment from \"moment\";\n\nconst format = \"YYYY-MM-DD\";\n\nconst dateInputPlaceholder = \"选择日期\";\n\nfunction onSelect(d) {\n console.log(d);\n}\n\nfunction onChange(d) {\n console.log(d);\n}\n\nclass Demo7 extends Component {\n render() {\n return (\n <div>\n <Row>\n <Col md={12}>\n <DatePicker\n format={format}\n onSelect={onSelect}\n onChange={onChange}\n locale={zhCN}\n defaultValue={moment()}\n placeholder={dateInputPlaceholder}\n disabled={true}\n />\n </Col>\n </Row>\n </div>\n );\n }\n}\n\n\n","desc":" 禁用日期"},{"example":<Demo8 />,"title":" 不可选择日期和时间","code":"/**\n *\n * @title 不可选择日期和时间\n * @description 可用 disabledDate 和 disabledTime 分别禁止选择部分日期和时间,其中 disabledTime 需要和 showTime 一起使用。\n */\n\nimport React, { Component } from \"react\";\nimport { Row, Col } from \"bee-layout\";\nimport DatePicker from \"../../src/index\";\n\nimport zhCN from \"rc-calendar/lib/locale/zh_CN\";\nimport moment from \"moment\";\n\nconst format = \"YYYY-MM-DD\";\n\nconst dateInputPlaceholder = \"选择日期\";\n\nfunction onSelect(d) {\n console.log(d);\n}\n\nfunction onChange(d) {\n console.log(d);\n}\n\nfunction disabledDate(current) {\n return current && current.valueOf() < Date.now();\n}\n\nclass Demo7 extends Component {\n render() {\n return (\n <div>\n <Row>\n <Col md={12}>\n <DatePicker\n format={format}\n onSelect={onSelect}\n onChange={onChange}\n locale={zhCN}\n disabledDate={disabledDate}\n defaultValue={moment()}\n placeholder={dateInputPlaceholder}\n />\n </Col>\n </Row>\n </div>\n );\n }\n}\n\n\n","desc":" 可用 disabledDate 和 disabledTime 分别禁止选择部分日期和时间,其中 disabledTime 需要和 showTime 一起使用。"},{"example":<Demo9 />,"title":" 自定义日期渲染父级容器","code":"/**\n *\n * @title 自定义日期渲染父级容器\n * @description 以「日期」为基本单位,基础的日期选择控件\n */\n\nimport React, { Component } from \"react\";\nimport { Row, Col } from \"bee-layout\";\nimport DatePicker from \"../../src/index\";\n\nimport zhCN from \"rc-calendar/lib/locale/zh_CN\";\nimport enUS from \"rc-calendar/lib/locale/en_US\";\nimport moment from \"moment\";\nimport Icon from 'bee-icon';\n\nconst format = \"YYYY-MM-DD\";\n\nconst dateInputPlaceholder = \"选择日期\";\n\nfunction onSelect(d) {\n // console.log(d);\n}\n\nfunction onChange(d) {\n this.setState({\n value: ''\n });\n}\n\nclass Demo1 extends Component {\n constructor(props) {\n super(props);\n this.state = {\n value: ''\n };\n }\n getCalendarContainer() {\n return this.d || document.getElementById('d');\n }\n onChange = d => {\n console.log(d)\n\n this.setState({\n value: ''\n });\n };\n render() {\n return (\n <div id=\"d\" ref=\"d\">\n <Row>\n <Col md={12}>\n <DatePicker\n format={format}\n onSelect={onSelect}\n onChange={this.onChange}\n locale={zhCN}\n defaultValue={this.state.value}\n placeholder={dateInputPlaceholder}\n getCalendarContainer={this.getCalendarContainer}\n />\n </Col>\n </Row>\n </div>\n );\n }\n}\n\n\n","desc":" 以「日期」为基本单位,基础的日期选择控件"}]

@@ -16,0 +16,0 @@

{
"name": "bee-datepicker",
"version": "1.0.20",
"version": "1.0.21",
"description": "DatePicker ui component for react",

@@ -5,0 +5,0 @@ "keywords": [

@@ -15,3 +15,2 @@ /**

import "moment/locale/zh-cn";
import "moment/locale/en-gb";

@@ -82,3 +81,3 @@ function format(v) {

defaultValue={[now, now.clone().add(1, 'months')]}
locale={cn ? zhCN : enUS}
locale={props.locale || zhCN }
onChange={props.onChange}

@@ -85,0 +84,0 @@ disabledDate={props.disabledDate}

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

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