diff --git a/CHANGELOG.md b/CHANGELOG.md index 3b599889e7..c0ee5f7b03 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ # Change Log +## v5.0.0-Beta - UNRELEASED + ## v4.0.1 - 2018-05-02 ### Added diff --git a/client/.babelrc b/client/.babelrc index a6ae74fe1d..78a71f6368 100644 --- a/client/.babelrc +++ b/client/.babelrc @@ -5,6 +5,10 @@ "transform-object-assign", ["babel-plugin-transform-builtin-extend", { "globals": ["Error"] + }], + ["import", { + "libraryName": "antd", + "style": true }] ] } diff --git a/client/app/components/DateInput.jsx b/client/app/components/DateInput.jsx new file mode 100644 index 0000000000..24a5537490 --- /dev/null +++ b/client/app/components/DateInput.jsx @@ -0,0 +1,37 @@ +import moment from 'moment'; +import React from 'react'; +import PropTypes from 'prop-types'; +import { react2angular } from 'react2angular'; +import { DatePicker } from 'antd'; + +function DateInput({ + value, + onSelect, + clientConfig, +}) { + const format = clientConfig.dateFormat || 'YYYY-MM-DD'; + const defaultValue = moment(value, format); + return ( + + ); +} + +DateInput.propTypes = { + value: PropTypes.instanceOf(Date), + onSelect: PropTypes.func, +}; + +DateInput.defaultProps = { + value: Date.now(), + onSelect: () => {}, +}; + +export default function init(ngModule) { + ngModule.component('dateInput', react2angular(DateInput, null, ['clientConfig'])); +} + diff --git a/client/app/components/DateTimeInput.jsx b/client/app/components/DateTimeInput.jsx new file mode 100644 index 0000000000..029fa84e94 --- /dev/null +++ b/client/app/components/DateTimeInput.jsx @@ -0,0 +1,42 @@ +import moment from 'moment'; +import React from 'react'; +import PropTypes from 'prop-types'; +import { react2angular } from 'react2angular'; +import { DatePicker } from 'antd'; + +function DateTimeInput({ + value, + withSeconds, + onSelect, + clientConfig, +}) { + const format = (clientConfig.dateFormat || 'YYYY-MM-DD') + + (withSeconds ? ' HH:mm:ss' : ' HH:mm'); + const defaultValue = moment(value, format); + return ( + + ); +} + +DateTimeInput.propTypes = { + value: PropTypes.instanceOf(Date), + withSeconds: PropTypes.bool, + onSelect: PropTypes.func, +}; + +DateTimeInput.defaultProps = { + value: Date.now(), + withSeconds: false, + onSelect: () => {}, +}; + +export default function init(ngModule) { + ngModule.component('dateTimeInput', react2angular(DateTimeInput, null, ['clientConfig'])); +} + diff --git a/client/app/components/parameters.html b/client/app/components/parameters.html index d628d9ec09..05b442d81c 100644 --- a/client/app/components/parameters.html +++ b/client/app/components/parameters.html @@ -11,9 +11,12 @@ - - - + + +