@elliemae/ds-date-range-selector 2.2.0-alpha.3 → 3.0.0-next.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/DSDateRangeSelector.js +65 -85
- package/cjs/components/CustomOptionRender/CustomOptionRender.js +38 -44
- package/cjs/components/DateRangeSelectorImpl.js +174 -124
- package/cjs/index.js +12 -38
- package/cjs/options/dropdownPreselectedOptions.js +34 -69
- package/esm/DSDateRangeSelector.js +50 -57
- package/esm/components/CustomOptionRender/CustomOptionRender.js +32 -15
- package/esm/components/DateRangeSelectorImpl.js +161 -91
- package/esm/index.js +2 -12
- package/esm/options/dropdownPreselectedOptions.js +28 -40
- package/package.json +6 -6
- package/cjs/DSDateRangeSelector.js.map +0 -7
- package/cjs/components/CustomOptionRender/CustomOptionRender.js.map +0 -7
- package/cjs/components/DateRangeSelectorImpl.js.map +0 -7
- package/cjs/index.js.map +0 -7
- package/cjs/options/dropdownPreselectedOptions.js.map +0 -7
- package/esm/DSDateRangeSelector.js.map +0 -7
- package/esm/components/CustomOptionRender/CustomOptionRender.js.map +0 -7
- package/esm/components/DateRangeSelectorImpl.js.map +0 -7
- package/esm/index.js.map +0 -7
- package/esm/options/dropdownPreselectedOptions.js.map +0 -7
package/cjs/index.js
CHANGED
|
@@ -1,38 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(module2))
|
|
15
|
-
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
|
|
16
|
-
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return target;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (module2, isNodeMode) => {
|
|
21
|
-
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
22
|
-
};
|
|
23
|
-
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
24
|
-
return (module2, temp) => {
|
|
25
|
-
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
26
|
-
};
|
|
27
|
-
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
28
|
-
var src_exports = {};
|
|
29
|
-
__export(src_exports, {
|
|
30
|
-
CUSTOM_OPTION_VALUE: () => import_DSDateRangeSelector2.CUSTOM_OPTION_VALUE,
|
|
31
|
-
DateRangeRecurrenceSelectorWithSchema: () => import_DSDateRangeSelector.DateRangeRecurrenceSelectorWithSchema,
|
|
32
|
-
default: () => import_DSDateRangeSelector.default
|
|
33
|
-
});
|
|
34
|
-
var React = __toESM(require("react"));
|
|
35
|
-
var import_DSDateRangeSelector = __toESM(require("./DSDateRangeSelector"));
|
|
36
|
-
var import_DSDateRangeSelector2 = __toESM(require("./DSDateRangeSelector"));
|
|
37
|
-
module.exports = __toCommonJS(src_exports);
|
|
38
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var DSDateRangeSelector = require('./DSDateRangeSelector.js');
|
|
6
|
+
var dropdownPreselectedOptions = require('./options/dropdownPreselectedOptions.js');
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
exports.DateRangeRecurrenceSelectorWithSchema = DSDateRangeSelector.DateRangeRecurrenceSelectorWithSchema;
|
|
11
|
+
exports["default"] = DSDateRangeSelector["default"];
|
|
12
|
+
exports.CUSTOM_OPTION_VALUE = dropdownPreselectedOptions.CUSTOM_OPTION_VALUE;
|
|
@@ -1,71 +1,36 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __reExport = (target, module2, copyDefault, desc) => {
|
|
13
|
-
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(module2))
|
|
15
|
-
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
|
|
16
|
-
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return target;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (module2, isNodeMode) => {
|
|
21
|
-
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
22
|
-
};
|
|
23
|
-
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
24
|
-
return (module2, temp) => {
|
|
25
|
-
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
26
|
-
};
|
|
27
|
-
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
28
|
-
var dropdownPreselectedOptions_exports = {};
|
|
29
|
-
__export(dropdownPreselectedOptions_exports, {
|
|
30
|
-
CUSTOM_OPTION_VALUE: () => CUSTOM_OPTION_VALUE,
|
|
31
|
-
DropdownOptionsTypes: () => DropdownOptionsTypes,
|
|
32
|
-
dropdownPreselectedOptions: () => dropdownPreselectedOptions
|
|
33
|
-
});
|
|
34
|
-
var React = __toESM(require("react"));
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
35
5
|
const DropdownOptionsTypes = {
|
|
36
|
-
TODAY:
|
|
37
|
-
YESTERDAY:
|
|
38
|
-
LAST_7_DAYS:
|
|
39
|
-
LAST_30_DAYS:
|
|
40
|
-
THIS_MONTH:
|
|
41
|
-
LAST_MONTH:
|
|
6
|
+
TODAY: 'today',
|
|
7
|
+
YESTERDAY: 'yesterday',
|
|
8
|
+
LAST_7_DAYS: '7days',
|
|
9
|
+
LAST_30_DAYS: '30days',
|
|
10
|
+
THIS_MONTH: 'thismonth',
|
|
11
|
+
LAST_MONTH: 'lastmonth'
|
|
42
12
|
};
|
|
43
|
-
const dropdownPreselectedOptions = [
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
}
|
|
68
|
-
];
|
|
69
|
-
const CUSTOM_OPTION_VALUE = "custom-option-value";
|
|
70
|
-
module.exports = __toCommonJS(dropdownPreselectedOptions_exports);
|
|
71
|
-
//# sourceMappingURL=dropdownPreselectedOptions.js.map
|
|
13
|
+
const dropdownPreselectedOptions = [{
|
|
14
|
+
label: 'Today',
|
|
15
|
+
value: DropdownOptionsTypes.TODAY
|
|
16
|
+
}, {
|
|
17
|
+
label: 'Yesterday',
|
|
18
|
+
value: DropdownOptionsTypes.YESTERDAY
|
|
19
|
+
}, {
|
|
20
|
+
label: 'Last 7 Days',
|
|
21
|
+
value: DropdownOptionsTypes.LAST_7_DAYS
|
|
22
|
+
}, {
|
|
23
|
+
label: 'Last 30 days',
|
|
24
|
+
value: DropdownOptionsTypes.LAST_30_DAYS
|
|
25
|
+
}, {
|
|
26
|
+
label: 'This month',
|
|
27
|
+
value: DropdownOptionsTypes.THIS_MONTH
|
|
28
|
+
}, {
|
|
29
|
+
label: 'Last month',
|
|
30
|
+
value: DropdownOptionsTypes.LAST_MONTH
|
|
31
|
+
}];
|
|
32
|
+
const CUSTOM_OPTION_VALUE = 'custom-option-value';
|
|
33
|
+
|
|
34
|
+
exports.CUSTOM_OPTION_VALUE = CUSTOM_OPTION_VALUE;
|
|
35
|
+
exports.DropdownOptionsTypes = DropdownOptionsTypes;
|
|
36
|
+
exports.dropdownPreselectedOptions = dropdownPreselectedOptions;
|
|
@@ -1,64 +1,57 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import { PropTypes, describe } from
|
|
4
|
-
import moment from
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
});
|
|
1
|
+
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
2
|
+
import 'react';
|
|
3
|
+
import { PropTypes, describe } from 'react-desc';
|
|
4
|
+
import moment from 'moment';
|
|
5
|
+
import DateTimeRecurenceSelectorImpl from './components/DateRangeSelectorImpl.js';
|
|
6
|
+
import { dropdownPreselectedOptions } from './options/dropdownPreselectedOptions.js';
|
|
7
|
+
export { CUSTOM_OPTION_VALUE, DropdownOptionsTypes, dropdownPreselectedOptions } from './options/dropdownPreselectedOptions.js';
|
|
8
|
+
import CustomOptionRender from './components/CustomOptionRender/CustomOptionRender.js';
|
|
9
|
+
|
|
10
|
+
const DSDateRangeSelector = _ref => {
|
|
11
|
+
let {
|
|
12
|
+
containerProps = {},
|
|
13
|
+
className = '',
|
|
14
|
+
preselectedOptions = dropdownPreselectedOptions,
|
|
15
|
+
onChange = () => null,
|
|
16
|
+
placeholder = 'Select Range',
|
|
17
|
+
value = null,
|
|
18
|
+
customOptionRender = CustomOptionRender,
|
|
19
|
+
startDate = null,
|
|
20
|
+
endDate = null,
|
|
21
|
+
displayFormatDay = 'D',
|
|
22
|
+
disableCustomOption = false
|
|
23
|
+
} = _ref;
|
|
24
|
+
return /*#__PURE__*/_jsx(DateTimeRecurenceSelectorImpl, {
|
|
25
|
+
className: className,
|
|
26
|
+
containerProps: containerProps,
|
|
27
|
+
customOptionRender: customOptionRender,
|
|
28
|
+
disableCustomOption: disableCustomOption,
|
|
29
|
+
displayFormatDay: displayFormatDay,
|
|
30
|
+
dropdownPreselectedOptions: preselectedOptions,
|
|
31
|
+
endDate: endDate,
|
|
32
|
+
onChange: onChange,
|
|
33
|
+
placeholder: placeholder,
|
|
34
|
+
startDate: startDate,
|
|
35
|
+
value: value
|
|
36
|
+
});
|
|
37
|
+
};
|
|
37
38
|
const dateRangeRecurrenceSelectorProps = {
|
|
38
|
-
containerProps: PropTypes.object.description(
|
|
39
|
-
className: PropTypes.string.description(
|
|
39
|
+
containerProps: PropTypes.object.description('Set of properties attached to the main container'),
|
|
40
|
+
className: PropTypes.string.description('html class attribute'),
|
|
40
41
|
preselectedOptions: PropTypes.arrayOf(PropTypes.shape({
|
|
41
42
|
label: PropTypes.string,
|
|
42
43
|
value: PropTypes.string
|
|
43
|
-
})).description(
|
|
44
|
-
onChange: PropTypes.func.description(
|
|
45
|
-
placeholder: PropTypes.string.description(
|
|
46
|
-
value: PropTypes.oneOf([PropTypes.string, PropTypes.number]).description(
|
|
47
|
-
customOptionRender: PropTypes.element.description(
|
|
48
|
-
startDate: PropTypes.instanceOf(Date, moment).description(
|
|
49
|
-
endDate: PropTypes.instanceOf(Date, moment).description(
|
|
50
|
-
displayFormatDay: PropTypes.string.description(
|
|
51
|
-
disableCustomOption: PropTypes.bool.description(
|
|
44
|
+
})).description('options to display in dropdown menu'),
|
|
45
|
+
onChange: PropTypes.func.description('function executed when selection changes'),
|
|
46
|
+
placeholder: PropTypes.string.description('inputs placeholder').defaultValue('Select Range'),
|
|
47
|
+
value: PropTypes.oneOf([PropTypes.string, PropTypes.number]).description('selected value'),
|
|
48
|
+
customOptionRender: PropTypes.element.description('custom renderer for options'),
|
|
49
|
+
startDate: PropTypes.instanceOf(Date, moment).description('moment object of start date'),
|
|
50
|
+
endDate: PropTypes.instanceOf(Date, moment).description('moment object of end date'),
|
|
51
|
+
displayFormatDay: PropTypes.string.description('format to display date').defaultValue('D'),
|
|
52
|
+
disableCustomOption: PropTypes.bool.description('disables custom options').defaultValue(false)
|
|
52
53
|
};
|
|
53
|
-
DSDateRangeSelector.propTypes = dateRangeRecurrenceSelectorProps;
|
|
54
54
|
const DateRangeRecurrenceSelectorWithSchema = describe(DSDateRangeSelector);
|
|
55
55
|
DateRangeRecurrenceSelectorWithSchema.propTypes = dateRangeRecurrenceSelectorProps;
|
|
56
|
-
|
|
57
|
-
export {
|
|
58
|
-
CUSTOM_OPTION_VALUE,
|
|
59
|
-
DateRangeRecurrenceSelectorWithSchema,
|
|
60
|
-
DropdownOptionsTypes,
|
|
61
|
-
DSDateRangeSelector_default as default,
|
|
62
|
-
dropdownPreselectedOptions
|
|
63
|
-
};
|
|
64
|
-
//# sourceMappingURL=DSDateRangeSelector.js.map
|
|
56
|
+
|
|
57
|
+
export { DateRangeRecurrenceSelectorWithSchema, DSDateRangeSelector as default };
|
|
@@ -1,17 +1,34 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import { convertPropToCssClassName } from
|
|
4
|
-
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
2
|
+
import 'react';
|
|
3
|
+
import { convertPropToCssClassName } from '@elliemae/ds-classnames';
|
|
4
|
+
|
|
5
|
+
const {
|
|
6
|
+
cssClassName
|
|
7
|
+
} = convertPropToCssClassName('date-range-selector-customoption');
|
|
8
|
+
/**
|
|
9
|
+
* @param root0
|
|
10
|
+
* @param root0.customRange
|
|
11
|
+
* @param root0.customRange.startDate
|
|
12
|
+
* @param root0.customRange.endDate
|
|
13
|
+
* @customRange {
|
|
14
|
+
endDate
|
|
15
|
+
startDate
|
|
16
|
+
}
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
const CustomOptionRender = _ref => {
|
|
20
|
+
let {
|
|
21
|
+
customRange: {
|
|
22
|
+
startDate,
|
|
23
|
+
endDate
|
|
24
|
+
}
|
|
25
|
+
} = _ref;
|
|
26
|
+
const start = startDate ? startDate.format('MM/DD/YYYY') : null;
|
|
27
|
+
const end = endDate ? endDate.format('MM/DD/YYYY') : null;
|
|
28
|
+
const display = "From ".concat(start, " to ").concat(end) || 'Custom';
|
|
29
|
+
return /*#__PURE__*/_jsx("em", {
|
|
10
30
|
className: cssClassName
|
|
11
|
-
}, display);
|
|
31
|
+
}, void 0, display);
|
|
12
32
|
};
|
|
13
|
-
|
|
14
|
-
export {
|
|
15
|
-
CustomOptionRender_default as default
|
|
16
|
-
};
|
|
17
|
-
//# sourceMappingURL=CustomOptionRender.js.map
|
|
33
|
+
|
|
34
|
+
export { CustomOptionRender as default };
|
|
@@ -1,56 +1,108 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import {
|
|
12
|
-
import
|
|
13
|
-
|
|
14
|
-
|
|
1
|
+
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
2
|
+
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
3
|
+
import 'core-js/modules/esnext.async-iterator.find.js';
|
|
4
|
+
import 'core-js/modules/esnext.iterator.constructor.js';
|
|
5
|
+
import 'core-js/modules/esnext.iterator.find.js';
|
|
6
|
+
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
7
|
+
import 'core-js/modules/esnext.async-iterator.filter.js';
|
|
8
|
+
import 'core-js/modules/esnext.iterator.filter.js';
|
|
9
|
+
import 'core-js/modules/esnext.async-iterator.for-each.js';
|
|
10
|
+
import 'core-js/modules/esnext.iterator.for-each.js';
|
|
11
|
+
import { Component } from 'react';
|
|
12
|
+
import moment from 'moment';
|
|
13
|
+
import { components } from 'react-select';
|
|
14
|
+
import 'react-dates/initialize';
|
|
15
|
+
import { DayPickerRangeController } from 'react-dates';
|
|
16
|
+
import { convertPropToCssClassName } from '@elliemae/ds-classnames';
|
|
17
|
+
import { DSComboBox } from '@elliemae/ds-form';
|
|
18
|
+
import DSPopper from '@elliemae/ds-popper';
|
|
19
|
+
import { DatePickerNavigation, DatePickerDay } from '@elliemae/ds-date-picker';
|
|
20
|
+
import { ChevronLeft } from '@elliemae/ds-icons';
|
|
21
|
+
import { CUSTOM_OPTION_VALUE } from '../options/dropdownPreselectedOptions.js';
|
|
22
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
23
|
+
|
|
24
|
+
var _div;
|
|
25
|
+
|
|
26
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
27
|
+
|
|
28
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
29
|
+
const START_DATE = 'startDate';
|
|
30
|
+
const END_DATE = 'endDate';
|
|
15
31
|
const advanceOption = {
|
|
16
|
-
label:
|
|
32
|
+
label: 'Custom',
|
|
17
33
|
value: CUSTOM_OPTION_VALUE,
|
|
18
34
|
isAdvance: true
|
|
19
35
|
};
|
|
20
|
-
const {
|
|
21
|
-
|
|
36
|
+
const {
|
|
37
|
+
cssClassName,
|
|
38
|
+
classNameElement,
|
|
39
|
+
classNameBlock
|
|
40
|
+
} = convertPropToCssClassName('date-range-selector');
|
|
41
|
+
const {
|
|
42
|
+
classNameElement: pickerNameElement
|
|
43
|
+
} = convertPropToCssClassName('datepicker');
|
|
44
|
+
|
|
22
45
|
class DateTimeRecurenceSelectorImpl extends Component {
|
|
23
46
|
constructor(props) {
|
|
24
47
|
super(props);
|
|
48
|
+
|
|
25
49
|
this.onChange = () => {
|
|
26
|
-
const {
|
|
27
|
-
|
|
50
|
+
const {
|
|
51
|
+
onChange
|
|
52
|
+
} = this.props;
|
|
53
|
+
const {
|
|
54
|
+
customRange,
|
|
55
|
+
selected
|
|
56
|
+
} = this.state;
|
|
28
57
|
onChange(selected, customRange);
|
|
29
58
|
};
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
const
|
|
33
|
-
|
|
59
|
+
|
|
60
|
+
this.onChangeDropdown = value => {
|
|
61
|
+
const {
|
|
62
|
+
dropdownPreselectedOptions
|
|
63
|
+
} = this.props;
|
|
64
|
+
const selected = dropdownPreselectedOptions.find(op => op.value === value);
|
|
65
|
+
const {
|
|
66
|
+
onChange
|
|
67
|
+
} = this.props;
|
|
68
|
+
|
|
34
69
|
if (!selected) {
|
|
35
|
-
this.setState({
|
|
70
|
+
this.setState({
|
|
71
|
+
selected: value
|
|
72
|
+
});
|
|
36
73
|
this.handleOpenModal();
|
|
37
74
|
} else if (selected) {
|
|
38
75
|
onChange(value);
|
|
39
|
-
this.setState({
|
|
76
|
+
this.setState({
|
|
77
|
+
selected: value,
|
|
78
|
+
openModal: false
|
|
79
|
+
});
|
|
40
80
|
}
|
|
41
81
|
};
|
|
82
|
+
|
|
42
83
|
this.handleConfirm = () => {
|
|
43
|
-
const {
|
|
44
|
-
|
|
45
|
-
|
|
84
|
+
const {
|
|
85
|
+
customOptionRender: CustomOptionRender
|
|
86
|
+
} = this.props;
|
|
87
|
+
const {
|
|
46
88
|
customRange
|
|
89
|
+
} = this.state;
|
|
90
|
+
advanceOption.label = /*#__PURE__*/_jsx(CustomOptionRender, {
|
|
91
|
+
customRange: customRange
|
|
47
92
|
});
|
|
48
93
|
this.onChange();
|
|
49
94
|
this.handleCloseModal();
|
|
50
95
|
};
|
|
51
|
-
|
|
52
|
-
this.
|
|
53
|
-
|
|
96
|
+
|
|
97
|
+
this.handleOpenModal = () => this.setState({
|
|
98
|
+
openModal: true
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
this.handleCloseModal = () => this.setState({
|
|
102
|
+
openModal: false
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
const _customRange = {
|
|
54
106
|
startDate: props.startDate ? moment(props.startDate) : moment(),
|
|
55
107
|
endDate: props.endDate ? moment(props.endDate) : moment()
|
|
56
108
|
};
|
|
@@ -58,14 +110,23 @@ class DateTimeRecurenceSelectorImpl extends Component {
|
|
|
58
110
|
openModal: false,
|
|
59
111
|
selected: props.value,
|
|
60
112
|
focusedInput: START_DATE,
|
|
61
|
-
customRange
|
|
113
|
+
customRange: _customRange
|
|
62
114
|
};
|
|
63
|
-
const {
|
|
64
|
-
|
|
65
|
-
|
|
115
|
+
const {
|
|
116
|
+
customOptionRender: _CustomOptionRender
|
|
117
|
+
} = props;
|
|
118
|
+
advanceOption.label = /*#__PURE__*/_jsx(_CustomOptionRender, {
|
|
119
|
+
customRange: _customRange
|
|
66
120
|
});
|
|
121
|
+
this.onDatesChange = this.onDatesChange.bind(this);
|
|
122
|
+
this.onFocusChange = this.onFocusChange.bind(this);
|
|
67
123
|
}
|
|
68
|
-
|
|
124
|
+
|
|
125
|
+
onDatesChange(_ref) {
|
|
126
|
+
let {
|
|
127
|
+
startDate,
|
|
128
|
+
endDate
|
|
129
|
+
} = _ref;
|
|
69
130
|
this.setState({
|
|
70
131
|
customRange: {
|
|
71
132
|
startDate,
|
|
@@ -75,11 +136,18 @@ class DateTimeRecurenceSelectorImpl extends Component {
|
|
|
75
136
|
this.onChange();
|
|
76
137
|
});
|
|
77
138
|
}
|
|
139
|
+
|
|
78
140
|
onFocusChange() {
|
|
79
|
-
this.setState(
|
|
80
|
-
|
|
81
|
-
|
|
141
|
+
this.setState(_ref2 => {
|
|
142
|
+
let {
|
|
143
|
+
focusedInput
|
|
144
|
+
} = _ref2;
|
|
145
|
+
return {
|
|
146
|
+
focusedInput: focusedInput === START_DATE ? END_DATE : START_DATE
|
|
147
|
+
};
|
|
148
|
+
});
|
|
82
149
|
}
|
|
150
|
+
|
|
83
151
|
render() {
|
|
84
152
|
const {
|
|
85
153
|
placeholder,
|
|
@@ -93,62 +161,64 @@ class DateTimeRecurenceSelectorImpl extends Component {
|
|
|
93
161
|
selected,
|
|
94
162
|
openModal,
|
|
95
163
|
focusedInput,
|
|
96
|
-
customRange: {
|
|
164
|
+
customRange: {
|
|
165
|
+
startDate,
|
|
166
|
+
endDate
|
|
167
|
+
}
|
|
97
168
|
} = this.state;
|
|
98
169
|
let options = [...dropdownPreselectedOptions];
|
|
170
|
+
|
|
99
171
|
if (!disableCustomOption) {
|
|
100
|
-
options = [...options, advanceOption];
|
|
172
|
+
options = [...options, advanceOption]; // eslint-disable-next-line max-lines
|
|
101
173
|
}
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
className:
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
174
|
+
|
|
175
|
+
return /*#__PURE__*/jsxs("div", _objectSpread(_objectSpread({}, containerProps), {}, {
|
|
176
|
+
className: "".concat(cssClassName, " ").concat(className),
|
|
177
|
+
children: [/*#__PURE__*/_jsx("div", {
|
|
178
|
+
className: "".concat(classNameBlock('container-selector'))
|
|
179
|
+
}, void 0, /*#__PURE__*/_jsx(DSComboBox, {
|
|
180
|
+
className: "".concat(classNameElement('dropdown-field-selector')),
|
|
181
|
+
components: {
|
|
182
|
+
Option: props => /*#__PURE__*/jsx(components.Option, _objectSpread({}, props)),
|
|
183
|
+
IndicatorSeparator: () => null
|
|
184
|
+
},
|
|
185
|
+
onChange: this.onChangeDropdown,
|
|
186
|
+
onKeyDown: this.onKeyDown,
|
|
187
|
+
options: options,
|
|
188
|
+
placeholder: placeholder,
|
|
189
|
+
value: selected,
|
|
190
|
+
keepTypedValue: false // TEMPORARY FIX
|
|
191
|
+
|
|
192
|
+
})), /*#__PURE__*/_jsx(DSPopper, {
|
|
193
|
+
contentComponent: /*#__PURE__*/_jsx("div", {
|
|
194
|
+
className: classNameBlock('wrap-day-picker')
|
|
195
|
+
}, void 0, /*#__PURE__*/_jsx(DayPickerRangeController, {
|
|
196
|
+
endDate: endDate,
|
|
197
|
+
focusedInput: focusedInput,
|
|
198
|
+
hideKeyboardShortcutsPanel: true,
|
|
199
|
+
navNext: /*#__PURE__*/_jsx(DatePickerNavigation, {
|
|
200
|
+
className: pickerNameElement('navigation-next')
|
|
201
|
+
}),
|
|
202
|
+
navPrev: /*#__PURE__*/_jsx(DatePickerNavigation, {
|
|
203
|
+
className: pickerNameElement('navigation-prev'),
|
|
204
|
+
icon: ChevronLeft
|
|
205
|
+
}),
|
|
206
|
+
onDatesChange: this.onDatesChange,
|
|
207
|
+
onFocusChange: this.onFocusChange,
|
|
208
|
+
onOutsideClick: this.handleConfirm,
|
|
209
|
+
renderDayContents: date => /*#__PURE__*/_jsx(DatePickerDay, {
|
|
210
|
+
className: pickerNameElement('day-contents'),
|
|
211
|
+
date: date.format(displayFormatDay)
|
|
212
|
+
}),
|
|
213
|
+
startDate: startDate
|
|
214
|
+
})),
|
|
215
|
+
isOpen: openModal,
|
|
216
|
+
showArrow: false,
|
|
217
|
+
triggerComponent: _div || (_div = /*#__PURE__*/_jsx("div", {}))
|
|
218
|
+
})]
|
|
147
219
|
}));
|
|
148
220
|
}
|
|
221
|
+
|
|
149
222
|
}
|
|
150
|
-
|
|
151
|
-
export {
|
|
152
|
-
DateRangeSelectorImpl_default as default
|
|
153
|
-
};
|
|
154
|
-
//# sourceMappingURL=DateRangeSelectorImpl.js.map
|
|
223
|
+
|
|
224
|
+
export { DateTimeRecurenceSelectorImpl as default };
|
package/esm/index.js
CHANGED
|
@@ -1,12 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
default as default2,
|
|
4
|
-
DateRangeRecurrenceSelectorWithSchema
|
|
5
|
-
} from "./DSDateRangeSelector";
|
|
6
|
-
import { CUSTOM_OPTION_VALUE } from "./DSDateRangeSelector";
|
|
7
|
-
export {
|
|
8
|
-
CUSTOM_OPTION_VALUE,
|
|
9
|
-
DateRangeRecurrenceSelectorWithSchema,
|
|
10
|
-
default2 as default
|
|
11
|
-
};
|
|
12
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
export { DateRangeRecurrenceSelectorWithSchema, default } from './DSDateRangeSelector.js';
|
|
2
|
+
export { CUSTOM_OPTION_VALUE } from './options/dropdownPreselectedOptions.js';
|