|
24384 | 24384 | },
|
24385 | 24385 | /* 416 */
|
24386 | 24386 | /***/ function(module, exports) {
|
24387 |
| - module.exports = function(hljs) { |
24388 |
| - // TODO support filter tags like :javascript, support inline HTML |
| 24387 | + module.exports = function(hljs) { // TODO support filter tags like :javascript, support inline HTML |
24389 | 24388 | return {
|
24390 | 24389 | case_insensitive: true,
|
24391 | 24390 | contains: [
|
|
30325 | 30324 | },
|
30326 | 30325 | /* 475 */
|
30327 | 30326 | /***/ function(module, exports) {
|
30328 |
| - module.exports = function(hljs) { |
30329 |
| - // Base deafult colors in PB IDE: background: #FFFFDF; foreground: #000000; |
| 30327 | + module.exports = function(hljs) { // Base deafult colors in PB IDE: background: #FFFFDF; foreground: #000000; |
30330 | 30328 | var STRINGS = {
|
30331 | 30329 | // PB IDE color: #0080FF (Azure Radiance)
|
30332 | 30330 | className: "string",
|
|
35220 | 35218 | /**
|
35221 | 35219 | * General datepicker component.
|
35222 | 35220 | */
|
| 35221 | + var INPUT_ERR_1 = "Date input not valid."; |
35223 | 35222 |
|
35224 | 35223 | var DatePicker = (function(_React$Component) {
|
35225 | 35224 | _inherits(DatePicker, _React$Component);
|
|
35247 | 35246 |
|
35248 | 35247 | preventOpenOnFocus: false,
|
35249 | 35248 | onYearChange: function onYearChange() {},
|
| 35249 | + onInputError: function onInputError() {}, |
35250 | 35250 |
|
35251 | 35251 | monthsShown: 1,
|
35252 | 35252 | readOnly: false,
|
|
35256 | 35256 | timeIntervals: 30,
|
35257 | 35257 | timeCaption: "Time",
|
35258 | 35258 | previousMonthButtonLabel: "Previous Month",
|
35259 |
| - nextMonthButtonLabel: "Next month" |
| 35259 | + nextMonthButtonLabel: "Next month", |
| 35260 | + renderDayContents: function renderDayContents(date) { |
| 35261 | + return date; |
| 35262 | + } |
35260 | 35263 | };
|
35261 | 35264 | }
|
35262 | 35265 | }
|
@@ -35356,14 +35359,21 @@
|
35356 | 35359 | function() {
|
35357 | 35360 | !skipSetBlur && _this.setBlur();
|
35358 | 35361 |
|
35359 |
| - _this.setState({ inputValue: null, preSelection: null }); |
| 35362 | + _this.setState({ inputValue: null }); |
35360 | 35363 | }
|
35361 | 35364 | );
|
35362 | 35365 | }
|
35363 | 35366 | }
|
35364 | 35367 | );
|
35365 | 35368 | };
|
35366 | 35369 |
|
| 35370 | + _this.inputOk = function() { |
| 35371 | + return ( |
| 35372 | + (0, _date_utils.isMoment)(_this.state.preSelection) || |
| 35373 | + (0, _date_utils.isDate)(_this.state.preSelection) |
| 35374 | + ); |
| 35375 | + }; |
| 35376 | + |
35367 | 35377 | _this.isCalendarOpen = function() {
|
35368 | 35378 | return _this.props.open === undefined
|
35369 | 35379 | ? _this.state.open &&
|
|
35554 | 35564 | });
|
35555 | 35565 |
|
35556 | 35566 | _this.props.onChange(changedDate);
|
35557 |
| - _this.setOpen(false); |
| 35567 | + if (_this.props.shouldCloseOnSelect) { |
| 35568 | + _this.setOpen(false); |
| 35569 | + } |
35558 | 35570 | _this.setState({ inputValue: null });
|
35559 | 35571 | };
|
35560 | 35572 |
|
|
35583 | 35595 | if (eventKey === "Enter") {
|
35584 | 35596 | event.preventDefault();
|
35585 | 35597 | if (
|
35586 |
| - ((0, _date_utils.isMoment)(_this.state.preSelection) || |
35587 |
| - (0, _date_utils.isDate)(_this.state.preSelection)) && |
| 35598 | + _this.inputOk() && |
35588 | 35599 | _this.state.lastPreSelectChange ===
|
35589 | 35600 | PRESELECT_CHANGE_VIA_NAVIGATE
|
35590 | 35601 | ) {
|
|
35597 | 35608 | event.preventDefault();
|
35598 | 35609 |
|
35599 | 35610 | _this.setOpen(false);
|
| 35611 | + if (!_this.inputOk()) { |
| 35612 | + _this.props.onInputError({ code: 1, msg: INPUT_ERR_1 }); |
| 35613 | + } |
35600 | 35614 | } else if (eventKey === "Tab") {
|
35601 | 35615 | _this.setOpen(false, true);
|
35602 | 35616 | } else if (!_this.props.disabledKeyboardNavigation) {
|
|
35627 | 35641 | newSelection = (0, _date_utils.addYears)(copy, 1);
|
35628 | 35642 | break;
|
35629 | 35643 | }
|
35630 |
| - if (!newSelection) return; // Let the input component handle this keydown |
| 35644 | + if (!newSelection) { |
| 35645 | + if (_this.props.onInputError) { |
| 35646 | + _this.props.onInputError({ code: 1, msg: INPUT_ERR_1 }); |
| 35647 | + } |
| 35648 | + return; // Let the input component handle this keydown |
| 35649 | + } |
35631 | 35650 | event.preventDefault();
|
35632 | 35651 | _this.setState({
|
35633 | 35652 | lastPreSelectChange: PRESELECT_CHANGE_VIA_NAVIGATE
|
|
35729 | 35748 | nextMonthButtonLabel: _this.props.nextMonthButtonLabel,
|
35730 | 35749 | disabledKeyboardNavigation:
|
35731 | 35750 | _this.props.disabledKeyboardNavigation,
|
35732 |
| - renderCustomHeader: _this.props.renderCustomHeader |
| 35751 | + renderCustomHeader: _this.props.renderCustomHeader, |
| 35752 | + popperProps: _this.props.popperProps, |
| 35753 | + renderDayContents: _this.props.renderDayContents |
35733 | 35754 | },
|
35734 | 35755 | _this.props.children
|
35735 | 35756 | );
|
|
35874 | 35895 | ),
|
35875 | 35896 | popperContainer: this.props.popperContainer,
|
35876 | 35897 | popperComponent: calendar,
|
35877 |
| - popperPlacement: this.props.popperPlacement |
| 35898 | + popperPlacement: this.props.popperPlacement, |
| 35899 | + popperProps: this.props.popperProps |
35878 | 35900 | });
|
35879 | 35901 | };
|
35880 | 35902 |
|
|
35931 | 35953 | onKeyDown: _propTypes2.default.func,
|
35932 | 35954 | onMonthChange: _propTypes2.default.func,
|
35933 | 35955 | onYearChange: _propTypes2.default.func,
|
| 35956 | + onInputError: _propTypes2.default.func, |
35934 | 35957 | open: _propTypes2.default.bool,
|
35935 | 35958 | openToDate: _propTypes2.default.object,
|
35936 | 35959 | peekNextMonth: _propTypes2.default.bool,
|
|
35941 | 35964 | popperPlacement: _propTypes2.default.oneOf(
|
35942 | 35965 | _popper_component.popperPlacementPositions
|
35943 | 35966 | ), // <PopperComponent/> props
|
| 35967 | + popperProps: _propTypes2.default.object, |
35944 | 35968 | preventOpenOnFocus: _propTypes2.default.bool,
|
35945 | 35969 | readOnly: _propTypes2.default.bool,
|
35946 | 35970 | required: _propTypes2.default.bool,
|
|
35983 | 36007 | clearButtonTitle: _propTypes2.default.string,
|
35984 | 36008 | previousMonthButtonLabel: _propTypes2.default.string,
|
35985 | 36009 | nextMonthButtonLabel: _propTypes2.default.string,
|
35986 |
| - renderCustomHeader: _propTypes2.default.func |
| 36010 | + renderCustomHeader: _propTypes2.default.func, |
| 36011 | + renderDayContents: _propTypes2.default.func |
35987 | 36012 | };
|
35988 | 36013 | exports.default = DatePicker;
|
35989 | 36014 |
|
|
36836 | 36861 | endDate: _this.props.endDate,
|
36837 | 36862 | peekNextMonth: _this.props.peekNextMonth,
|
36838 | 36863 | utcOffset: _this.props.utcOffset,
|
| 36864 | + renderDayContents: _this.props.renderDayContents, |
36839 | 36865 | disabledKeyboardNavigation:
|
36840 | 36866 | _this.props.disabledKeyboardNavigation
|
36841 | 36867 | })
|
|
37015 | 37041 | showDisabledMonthNavigation: _propTypes2.default.bool,
|
37016 | 37042 | previousMonthButtonLabel: _propTypes2.default.string,
|
37017 | 37043 | nextMonthButtonLabel: _propTypes2.default.string,
|
37018 |
| - renderCustomHeader: _propTypes2.default.func |
| 37044 | + renderCustomHeader: _propTypes2.default.func, |
| 37045 | + renderDayContents: _propTypes2.default.func |
37019 | 37046 | };
|
37020 | 37047 | exports.default = Calendar;
|
37021 | 37048 |
|
|
57925 | 57952 | dayClassName: _this.props.dayClassName,
|
57926 | 57953 | utcOffset: _this.props.utcOffset,
|
57927 | 57954 | disabledKeyboardNavigation:
|
57928 |
| - _this.props.disabledKeyboardNavigation |
| 57955 | + _this.props.disabledKeyboardNavigation, |
| 57956 | + renderDayContents: _this.props.renderDayContents |
57929 | 57957 | })
|
57930 | 57958 | );
|
57931 | 57959 |
|
|
58016 | 58044 | utcOffset: _propTypes2.default.oneOfType([
|
58017 | 58045 | _propTypes2.default.number,
|
58018 | 58046 | _propTypes2.default.string
|
58019 |
| - ]) |
| 58047 | + ]), |
| 58048 | + renderDayContents: _propTypes2.default.func |
58020 | 58049 | };
|
58021 | 58050 | exports.default = Month;
|
58022 | 58051 |
|
|
58192 | 58221 | endDate: _this.props.endDate,
|
58193 | 58222 | dayClassName: _this.props.dayClassName,
|
58194 | 58223 | utcOffset: _this.props.utcOffset,
|
| 58224 | + renderDayContents: _this.props.renderDayContents, |
58195 | 58225 | disabledKeyboardNavigation:
|
58196 | 58226 | _this.props.disabledKeyboardNavigation
|
58197 | 58227 | });
|
|
58241 | 58271 | utcOffset: _propTypes2.default.oneOfType([
|
58242 | 58272 | _propTypes2.default.number,
|
58243 | 58273 | _propTypes2.default.string
|
58244 |
| - ]) |
| 58274 | + ]), |
| 58275 | + renderDayContents: _propTypes2.default.func |
58245 | 58276 | };
|
58246 | 58277 | exports.default = Week;
|
58247 | 58278 |
|
|
58536 | 58567 | "aria-label": "day-" + (0, _date_utils.getDate)(this.props.day),
|
58537 | 58568 | role: "option"
|
58538 | 58569 | },
|
58539 |
| - (0, _date_utils.getDate)(this.props.day) |
| 58570 | + this.props.renderDayContents |
| 58571 | + ? this.props.renderDayContents( |
| 58572 | + (0, _date_utils.getDate)(this.props.day) |
| 58573 | + ) |
| 58574 | + : (0, _date_utils.getDate)(this.props.day) |
58540 | 58575 | );
|
58541 | 58576 | };
|
58542 | 58577 |
|
|
58562 | 58597 | utcOffset: _propTypes2.default.oneOfType([
|
58563 | 58598 | _propTypes2.default.number,
|
58564 | 58599 | _propTypes2.default.string
|
58565 |
| - ]) |
| 58600 | + ]), |
| 58601 | + renderDayContents: _propTypes2.default.func |
58566 | 58602 | };
|
58567 | 58603 | exports.default = Day;
|
58568 | 58604 |
|
|
59141 | 59177 | popperComponent = _props.popperComponent,
|
59142 | 59178 | popperModifiers = _props.popperModifiers,
|
59143 | 59179 | popperPlacement = _props.popperPlacement,
|
| 59180 | + popperProps = _props.popperProps, |
59144 | 59181 | targetComponent = _props.targetComponent;
|
59145 | 59182 |
|
59146 | 59183 | var popper = void 0;
|
|
59152 | 59189 | );
|
59153 | 59190 | popper = _react2.default.createElement(
|
59154 | 59191 | _reactPopper.Popper,
|
59155 |
| - { modifiers: popperModifiers, placement: popperPlacement }, |
| 59192 | + _extends( |
| 59193 | + { |
| 59194 | + modifiers: popperModifiers, |
| 59195 | + placement: popperPlacement |
| 59196 | + }, |
| 59197 | + popperProps |
| 59198 | + ), |
59156 | 59199 | function(_ref) {
|
59157 | 59200 | var ref = _ref.ref,
|
59158 | 59201 | style = _ref.style,
|
@@ -59184,25 +59227,21 @@
|
59184 | 59227 | }
|
59185 | 59228 |
|
59186 | 59229 | return _react2.default.createElement(
|
59187 |
| - "div", |
| 59230 | + _reactPopper.Manager, |
59188 | 59231 | null,
|
59189 | 59232 | _react2.default.createElement(
|
59190 |
| - _reactPopper.Manager, |
| 59233 | + _reactPopper.Reference, |
59191 | 59234 | null,
|
59192 |
| - _react2.default.createElement( |
59193 |
| - _reactPopper.Reference, |
59194 |
| - null, |
59195 |
| - function(_ref2) { |
59196 |
| - var ref = _ref2.ref; |
59197 |
| - return _react2.default.createElement( |
59198 |
| - "div", |
59199 |
| - { ref: ref, className: "react-datepicker-wrapper" }, |
59200 |
| - targetComponent |
59201 |
| - ); |
59202 |
| - } |
59203 |
| - ), |
59204 |
| - popper |
59205 |
| - ) |
| 59235 | + function(_ref2) { |
| 59236 | + var ref = _ref2.ref; |
| 59237 | + return _react2.default.createElement( |
| 59238 | + "div", |
| 59239 | + { ref: ref, className: "react-datepicker-wrapper" }, |
| 59240 | + targetComponent |
| 59241 | + ); |
| 59242 | + } |
| 59243 | + ), |
| 59244 | + popper |
59206 | 59245 | );
|
59207 | 59246 | };
|
59208 | 59247 |
|
|
59219 | 59258 | boundariesElement: "viewport"
|
59220 | 59259 | }
|
59221 | 59260 | },
|
| 59261 | + popperProps: {}, |
59222 | 59262 | popperPlacement: "bottom-start"
|
59223 | 59263 | };
|
59224 | 59264 | }
|
|
59235 | 59275 | popperModifiers: _propTypes2.default.object, // <datepicker/> props
|
59236 | 59276 | popperPlacement: _propTypes2.default.oneOf(popperPlacementPositions), // <datepicker/> props
|
59237 | 59277 | popperContainer: _propTypes2.default.func,
|
| 59278 | + popperProps: _propTypes2.default.object, |
59238 | 59279 | targetComponent: _propTypes2.default.element
|
59239 | 59280 | };
|
59240 | 59281 | exports.default = PopperComponent;
|
|
71509 | 71550 | });
|
71510 | 71551 |
|
71511 | 71552 | for (
|
71512 |
| - var es6Symbols = "hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables".split( // 19.4.2.2, 19.4.2.3, 19.4.2.4, 19.4.2.6, 19.4.2.8, 19.4.2.9, 19.4.2.10, 19.4.2.11, 19.4.2.12, 19.4.2.13, 19.4.2.14 |
| 71553 | + var es6Symbols = // 19.4.2.2, 19.4.2.3, 19.4.2.4, 19.4.2.6, 19.4.2.8, 19.4.2.9, 19.4.2.10, 19.4.2.11, 19.4.2.12, 19.4.2.13, 19.4.2.14 |
| 71554 | + "hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables".split( |
71513 | 71555 | ","
|
71514 | 71556 | ),
|
71515 | 71557 | j = 0;
|
|
0 commit comments