@elliemae/ds-date-range-selector 3.0.0-next.2 → 3.0.0-next.3
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/dist/cjs/DSDateRangeSelector.js +89 -0
- package/dist/cjs/DSDateRangeSelector.js.map +7 -0
- package/dist/cjs/components/CustomOptionRender/CustomOptionRender.js +46 -0
- package/dist/cjs/components/CustomOptionRender/CustomOptionRender.js.map +7 -0
- package/dist/cjs/components/DateRangeSelectorImpl.js +197 -0
- package/dist/cjs/components/DateRangeSelectorImpl.js.map +7 -0
- package/dist/cjs/index.js +38 -0
- package/dist/cjs/index.js.map +7 -0
- package/dist/cjs/options/dropdownPreselectedOptions.js +71 -0
- package/dist/cjs/options/dropdownPreselectedOptions.js.map +7 -0
- package/dist/esm/DSDateRangeSelector.js +64 -0
- package/dist/esm/DSDateRangeSelector.js.map +7 -0
- package/dist/esm/components/CustomOptionRender/CustomOptionRender.js +17 -0
- package/dist/esm/components/CustomOptionRender/CustomOptionRender.js.map +7 -0
- package/dist/esm/components/DateRangeSelectorImpl.js +170 -0
- package/dist/esm/components/DateRangeSelectorImpl.js.map +7 -0
- package/dist/esm/index.js +12 -0
- package/dist/esm/index.js.map +7 -0
- package/dist/esm/options/dropdownPreselectedOptions.js +42 -0
- package/dist/esm/options/dropdownPreselectedOptions.js.map +7 -0
- package/package.json +38 -29
- package/cjs/DSDateRangeSelector.js +0 -69
- package/cjs/components/CustomOptionRender/CustomOptionRender.js +0 -40
- package/cjs/components/DateRangeSelectorImpl.js +0 -233
- package/cjs/index.js +0 -12
- package/cjs/options/dropdownPreselectedOptions.js +0 -36
- package/esm/DSDateRangeSelector.js +0 -57
- package/esm/components/CustomOptionRender/CustomOptionRender.js +0 -34
- package/esm/components/DateRangeSelectorImpl.js +0 -224
- package/esm/index.js +0 -2
- package/esm/options/dropdownPreselectedOptions.js +0 -30
- package/types/DSDateRangeSelector.d.ts +0 -113
- package/types/components/CustomOptionRender/CustomOptionRender.d.ts +0 -18
- package/types/components/DateRangeSelectorImpl.d.ts +0 -17
- package/types/index.d.ts +0 -2
- package/types/options/dropdownPreselectedOptions.d.ts +0 -13
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defProps = Object.defineProperties;
|
|
3
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
+
var __spreadValues = (a, b) => {
|
|
9
|
+
for (var prop in b || (b = {}))
|
|
10
|
+
if (__hasOwnProp.call(b, prop))
|
|
11
|
+
__defNormalProp(a, prop, b[prop]);
|
|
12
|
+
if (__getOwnPropSymbols)
|
|
13
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
+
if (__propIsEnum.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
}
|
|
17
|
+
return a;
|
|
18
|
+
};
|
|
19
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
+
import * as React from "react";
|
|
21
|
+
import React2, { Component } from "react";
|
|
22
|
+
import moment from "moment";
|
|
23
|
+
import { components } from "react-select";
|
|
24
|
+
import "react-dates/initialize";
|
|
25
|
+
import { DayPickerRangeController } from "react-dates";
|
|
26
|
+
import { convertPropToCssClassName } from "@elliemae/ds-classnames";
|
|
27
|
+
import { DSComboBox } from "@elliemae/ds-form";
|
|
28
|
+
import DSPopper from "@elliemae/ds-popper";
|
|
29
|
+
import { DatePickerDay, DatePickerNavigation } from "@elliemae/ds-date-picker";
|
|
30
|
+
import { ChevronLeft } from "@elliemae/ds-icons";
|
|
31
|
+
import { CUSTOM_OPTION_VALUE } from "../options/dropdownPreselectedOptions";
|
|
32
|
+
const START_DATE = "startDate";
|
|
33
|
+
const END_DATE = "endDate";
|
|
34
|
+
const advanceOption = {
|
|
35
|
+
label: "Custom",
|
|
36
|
+
value: CUSTOM_OPTION_VALUE,
|
|
37
|
+
isAdvance: true
|
|
38
|
+
};
|
|
39
|
+
const { cssClassName, classNameElement, classNameBlock } = convertPropToCssClassName("date-range-selector");
|
|
40
|
+
const { classNameElement: pickerNameElement } = convertPropToCssClassName("datepicker");
|
|
41
|
+
class DateTimeRecurenceSelectorImpl extends Component {
|
|
42
|
+
constructor(props) {
|
|
43
|
+
super(props);
|
|
44
|
+
this.onChange = () => {
|
|
45
|
+
const { onChange } = this.props;
|
|
46
|
+
const { customRange, selected } = this.state;
|
|
47
|
+
onChange(selected, customRange);
|
|
48
|
+
};
|
|
49
|
+
this.onChangeDropdown = (value) => {
|
|
50
|
+
const { dropdownPreselectedOptions } = this.props;
|
|
51
|
+
const selected = dropdownPreselectedOptions.find((op) => op.value === value);
|
|
52
|
+
const { onChange } = this.props;
|
|
53
|
+
if (!selected) {
|
|
54
|
+
this.setState({ selected: value });
|
|
55
|
+
this.handleOpenModal();
|
|
56
|
+
} else if (selected) {
|
|
57
|
+
onChange(value);
|
|
58
|
+
this.setState({ selected: value, openModal: false });
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
this.handleConfirm = () => {
|
|
62
|
+
const { customOptionRender: CustomOptionRender } = this.props;
|
|
63
|
+
const { customRange } = this.state;
|
|
64
|
+
advanceOption.label = /* @__PURE__ */ React2.createElement(CustomOptionRender, {
|
|
65
|
+
customRange
|
|
66
|
+
});
|
|
67
|
+
this.onChange();
|
|
68
|
+
this.handleCloseModal();
|
|
69
|
+
};
|
|
70
|
+
this.handleOpenModal = () => this.setState({ openModal: true });
|
|
71
|
+
this.handleCloseModal = () => this.setState({ openModal: false });
|
|
72
|
+
const customRange = {
|
|
73
|
+
startDate: props.startDate ? moment(props.startDate) : moment(),
|
|
74
|
+
endDate: props.endDate ? moment(props.endDate) : moment()
|
|
75
|
+
};
|
|
76
|
+
this.state = {
|
|
77
|
+
openModal: false,
|
|
78
|
+
selected: props.value,
|
|
79
|
+
focusedInput: START_DATE,
|
|
80
|
+
customRange
|
|
81
|
+
};
|
|
82
|
+
const { customOptionRender: CustomOptionRender } = props;
|
|
83
|
+
advanceOption.label = /* @__PURE__ */ React2.createElement(CustomOptionRender, {
|
|
84
|
+
customRange
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
onDatesChange({ startDate, endDate }) {
|
|
88
|
+
this.setState({
|
|
89
|
+
customRange: {
|
|
90
|
+
startDate,
|
|
91
|
+
endDate
|
|
92
|
+
}
|
|
93
|
+
}, () => {
|
|
94
|
+
this.onChange();
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
onFocusChange() {
|
|
98
|
+
this.setState(({ focusedInput }) => ({
|
|
99
|
+
focusedInput: focusedInput === START_DATE ? END_DATE : START_DATE
|
|
100
|
+
}));
|
|
101
|
+
}
|
|
102
|
+
render() {
|
|
103
|
+
const {
|
|
104
|
+
placeholder,
|
|
105
|
+
dropdownPreselectedOptions,
|
|
106
|
+
displayFormatDay,
|
|
107
|
+
className,
|
|
108
|
+
disableCustomOption,
|
|
109
|
+
containerProps
|
|
110
|
+
} = this.props;
|
|
111
|
+
const {
|
|
112
|
+
selected,
|
|
113
|
+
openModal,
|
|
114
|
+
focusedInput,
|
|
115
|
+
customRange: { startDate, endDate }
|
|
116
|
+
} = this.state;
|
|
117
|
+
let options = [...dropdownPreselectedOptions];
|
|
118
|
+
if (!disableCustomOption) {
|
|
119
|
+
options = [...options, advanceOption];
|
|
120
|
+
}
|
|
121
|
+
return /* @__PURE__ */ React2.createElement("div", __spreadProps(__spreadValues({}, containerProps), {
|
|
122
|
+
className: `${cssClassName} ${className}`
|
|
123
|
+
}), /* @__PURE__ */ React2.createElement("div", {
|
|
124
|
+
className: `${classNameBlock("container-selector")}`
|
|
125
|
+
}, /* @__PURE__ */ React2.createElement(DSComboBox, {
|
|
126
|
+
className: `${classNameElement("dropdown-field-selector")}`,
|
|
127
|
+
components: {
|
|
128
|
+
Option: (props) => /* @__PURE__ */ React2.createElement(components.Option, __spreadValues({}, props)),
|
|
129
|
+
IndicatorSeparator: () => null
|
|
130
|
+
},
|
|
131
|
+
onChange: this.onChangeDropdown,
|
|
132
|
+
onKeyDown: this.onKeyDown,
|
|
133
|
+
options,
|
|
134
|
+
placeholder,
|
|
135
|
+
value: selected,
|
|
136
|
+
keepTypedValue: false
|
|
137
|
+
})), /* @__PURE__ */ React2.createElement(DSPopper, {
|
|
138
|
+
contentComponent: /* @__PURE__ */ React2.createElement("div", {
|
|
139
|
+
className: classNameBlock("wrap-day-picker")
|
|
140
|
+
}, /* @__PURE__ */ React2.createElement(DayPickerRangeController, {
|
|
141
|
+
endDate,
|
|
142
|
+
focusedInput,
|
|
143
|
+
hideKeyboardShortcutsPanel: true,
|
|
144
|
+
navNext: /* @__PURE__ */ React2.createElement(DatePickerNavigation, {
|
|
145
|
+
className: pickerNameElement("navigation-next")
|
|
146
|
+
}),
|
|
147
|
+
navPrev: /* @__PURE__ */ React2.createElement(DatePickerNavigation, {
|
|
148
|
+
className: pickerNameElement("navigation-prev"),
|
|
149
|
+
icon: ChevronLeft
|
|
150
|
+
}),
|
|
151
|
+
onDatesChange: this.onDatesChange,
|
|
152
|
+
onFocusChange: this.onFocusChange,
|
|
153
|
+
onOutsideClick: this.handleConfirm,
|
|
154
|
+
renderDayContents: (date) => /* @__PURE__ */ React2.createElement(DatePickerDay, {
|
|
155
|
+
className: pickerNameElement("day-contents"),
|
|
156
|
+
date: date.format(displayFormatDay)
|
|
157
|
+
}),
|
|
158
|
+
startDate
|
|
159
|
+
})),
|
|
160
|
+
isOpen: openModal,
|
|
161
|
+
showArrow: false,
|
|
162
|
+
triggerComponent: /* @__PURE__ */ React2.createElement("div", null)
|
|
163
|
+
}));
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
var DateRangeSelectorImpl_default = DateTimeRecurenceSelectorImpl;
|
|
167
|
+
export {
|
|
168
|
+
DateRangeSelectorImpl_default as default
|
|
169
|
+
};
|
|
170
|
+
//# sourceMappingURL=DateRangeSelectorImpl.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/components/DateRangeSelectorImpl.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable react/prop-types */\nimport React, { Component } from 'react';\nimport moment from 'moment';\nimport { components } from 'react-select';\nimport 'react-dates/initialize';\nimport { DayPickerRangeController } from 'react-dates';\nimport { convertPropToCssClassName } from '@elliemae/ds-classnames';\nimport { DSComboBox } from '@elliemae/ds-form';\nimport DSPopper from '@elliemae/ds-popper';\nimport { DatePickerDay, DatePickerNavigation } from '@elliemae/ds-date-picker';\nimport { ChevronLeft } from '@elliemae/ds-icons';\nimport { CUSTOM_OPTION_VALUE } from '../options/dropdownPreselectedOptions';\n\nconst START_DATE = 'startDate';\nconst END_DATE = 'endDate';\n\nconst advanceOption = {\n label: 'Custom',\n value: CUSTOM_OPTION_VALUE,\n isAdvance: true,\n};\nconst { cssClassName, classNameElement, classNameBlock } = convertPropToCssClassName('date-range-selector');\n\nconst { classNameElement: pickerNameElement } = convertPropToCssClassName('datepicker');\n\nclass DateTimeRecurenceSelectorImpl extends Component {\n constructor(props) {\n super(props);\n\n const customRange = {\n startDate: props.startDate ? moment(props.startDate) : moment(),\n endDate: props.endDate ? moment(props.endDate) : moment(),\n };\n this.state = {\n openModal: false,\n selected: props.value,\n focusedInput: START_DATE,\n customRange,\n };\n const { customOptionRender: CustomOptionRender } = props;\n advanceOption.label = <CustomOptionRender customRange={customRange} />;\n }\n\n onChange = () => {\n const { onChange } = this.props;\n const { customRange, selected } = this.state;\n onChange(selected, customRange);\n };\n\n onChangeDropdown = (value) => {\n const { dropdownPreselectedOptions } = this.props;\n const selected = dropdownPreselectedOptions.find((op) => op.value === value);\n const { onChange } = this.props;\n if (!selected) {\n this.setState({ selected: value });\n this.handleOpenModal();\n } else if (selected) {\n onChange(value);\n this.setState({ selected: value, openModal: false });\n }\n };\n\n onDatesChange({ startDate, endDate }) {\n this.setState(\n {\n customRange: {\n startDate,\n endDate,\n },\n },\n () => {\n this.onChange();\n },\n );\n }\n\n onFocusChange() {\n this.setState(({ focusedInput }) => ({\n focusedInput: focusedInput === START_DATE ? END_DATE : START_DATE,\n }));\n }\n\n handleConfirm = () => {\n const { customOptionRender: CustomOptionRender } = this.props;\n const { customRange } = this.state;\n advanceOption.label = <CustomOptionRender customRange={customRange} />;\n this.onChange();\n this.handleCloseModal();\n };\n\n handleOpenModal = () => this.setState({ openModal: true });\n\n handleCloseModal = () => this.setState({ openModal: false });\n\n render() {\n const {\n placeholder,\n dropdownPreselectedOptions,\n displayFormatDay,\n className,\n disableCustomOption,\n containerProps,\n } = this.props;\n const {\n selected,\n openModal,\n focusedInput,\n customRange: { startDate, endDate },\n } = this.state;\n\n let options = [...dropdownPreselectedOptions];\n if (!disableCustomOption) {\n options = [...options, advanceOption];\n // eslint-disable-next-line max-lines\n }\n\n return (\n <div {...containerProps} className={`${cssClassName} ${className}`}>\n <div className={`${classNameBlock('container-selector')}`}>\n <DSComboBox\n className={`${classNameElement('dropdown-field-selector')}`}\n components={{\n Option: (props) => <components.Option {...props} />,\n IndicatorSeparator: () => null,\n }}\n onChange={this.onChangeDropdown}\n onKeyDown={this.onKeyDown}\n options={options}\n placeholder={placeholder}\n value={selected}\n keepTypedValue={false} // TEMPORARY FIX\n />\n </div>\n <DSPopper\n contentComponent={\n <div className={classNameBlock('wrap-day-picker')}>\n <DayPickerRangeController\n endDate={endDate}\n focusedInput={focusedInput}\n hideKeyboardShortcutsPanel\n navNext={<DatePickerNavigation className={pickerNameElement('navigation-next')} />}\n navPrev={<DatePickerNavigation className={pickerNameElement('navigation-prev')} icon={ChevronLeft} />}\n onDatesChange={this.onDatesChange}\n onFocusChange={this.onFocusChange}\n onOutsideClick={this.handleConfirm}\n renderDayContents={(date) => (\n <DatePickerDay className={pickerNameElement('day-contents')} date={date.format(displayFormatDay)} />\n )}\n startDate={startDate}\n />\n </div>\n }\n isOpen={openModal}\n showArrow={false}\n triggerComponent={<div />}\n />\n </div>\n );\n }\n}\n\nexport default DateTimeRecurenceSelectorImpl;\n"],
|
|
5
|
+
"mappings": "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",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import {
|
|
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
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/index.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export {\n default,\n DateRangeRecurrenceSelectorWithSchema,\n} from './DSDateRangeSelector';\nexport { CUSTOM_OPTION_VALUE } from './DSDateRangeSelector';\n"],
|
|
5
|
+
"mappings": "AAAA;ACAA;AAAA;AAAA;AAAA;AAIA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
const DropdownOptionsTypes = {
|
|
3
|
+
TODAY: "today",
|
|
4
|
+
YESTERDAY: "yesterday",
|
|
5
|
+
LAST_7_DAYS: "7days",
|
|
6
|
+
LAST_30_DAYS: "30days",
|
|
7
|
+
THIS_MONTH: "thismonth",
|
|
8
|
+
LAST_MONTH: "lastmonth"
|
|
9
|
+
};
|
|
10
|
+
const dropdownPreselectedOptions = [
|
|
11
|
+
{
|
|
12
|
+
label: "Today",
|
|
13
|
+
value: DropdownOptionsTypes.TODAY
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
label: "Yesterday",
|
|
17
|
+
value: DropdownOptionsTypes.YESTERDAY
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
label: "Last 7 Days",
|
|
21
|
+
value: DropdownOptionsTypes.LAST_7_DAYS
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
label: "Last 30 days",
|
|
25
|
+
value: DropdownOptionsTypes.LAST_30_DAYS
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
label: "This month",
|
|
29
|
+
value: DropdownOptionsTypes.THIS_MONTH
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
label: "Last month",
|
|
33
|
+
value: DropdownOptionsTypes.LAST_MONTH
|
|
34
|
+
}
|
|
35
|
+
];
|
|
36
|
+
const CUSTOM_OPTION_VALUE = "custom-option-value";
|
|
37
|
+
export {
|
|
38
|
+
CUSTOM_OPTION_VALUE,
|
|
39
|
+
DropdownOptionsTypes,
|
|
40
|
+
dropdownPreselectedOptions
|
|
41
|
+
};
|
|
42
|
+
//# sourceMappingURL=dropdownPreselectedOptions.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/options/dropdownPreselectedOptions.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export const DropdownOptionsTypes = {\n TODAY: 'today',\n YESTERDAY: 'yesterday',\n LAST_7_DAYS: '7days',\n LAST_30_DAYS: '30days',\n THIS_MONTH: 'thismonth',\n LAST_MONTH: 'lastmonth',\n};\nexport const dropdownPreselectedOptions = [\n {\n label: 'Today',\n value: DropdownOptionsTypes.TODAY,\n },\n {\n label: 'Yesterday',\n value: DropdownOptionsTypes.YESTERDAY,\n },\n {\n label: 'Last 7 Days',\n value: DropdownOptionsTypes.LAST_7_DAYS,\n },\n {\n label: 'Last 30 days',\n value: DropdownOptionsTypes.LAST_30_DAYS,\n },\n {\n label: 'This month',\n value: DropdownOptionsTypes.THIS_MONTH,\n },\n {\n label: 'Last month',\n value: DropdownOptionsTypes.LAST_MONTH,\n },\n];\n\nexport const CUSTOM_OPTION_VALUE = 'custom-option-value';\n"],
|
|
5
|
+
"mappings": "AAAA;ACAO,MAAM,uBAAuB;AAAA,EAClC,OAAO;AAAA,EACP,WAAW;AAAA,EACX,aAAa;AAAA,EACb,cAAc;AAAA,EACd,YAAY;AAAA,EACZ,YAAY;AAAA;AAEP,MAAM,6BAA6B;AAAA,EACxC;AAAA,IACE,OAAO;AAAA,IACP,OAAO,qBAAqB;AAAA;AAAA,EAE9B;AAAA,IACE,OAAO;AAAA,IACP,OAAO,qBAAqB;AAAA;AAAA,EAE9B;AAAA,IACE,OAAO;AAAA,IACP,OAAO,qBAAqB;AAAA;AAAA,EAE9B;AAAA,IACE,OAAO;AAAA,IACP,OAAO,qBAAqB;AAAA;AAAA,EAE9B;AAAA,IACE,OAAO;AAAA,IACP,OAAO,qBAAqB;AAAA;AAAA,EAE9B;AAAA,IACE,OAAO;AAAA,IACP,OAAO,qBAAqB;AAAA;AAAA;AAIzB,MAAM,sBAAsB;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/package.json
CHANGED
|
@@ -1,31 +1,34 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elliemae/ds-date-range-selector",
|
|
3
|
-
"version": "3.0.0-next.
|
|
3
|
+
"version": "3.0.0-next.3",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "ICE MT - Dimsum - Date Range Selector",
|
|
6
|
-
"
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
"files": [
|
|
7
|
+
"dist"
|
|
8
|
+
],
|
|
9
|
+
"module": "./dist/esm/index.js",
|
|
10
|
+
"main": "./dist/cjs/index.js",
|
|
11
|
+
"types": "./dist/types/index.d.ts",
|
|
9
12
|
"exports": {
|
|
10
13
|
".": {
|
|
11
|
-
"import": "./esm/index.js",
|
|
12
|
-
"require": "./cjs/index.js"
|
|
14
|
+
"import": "./dist/esm/index.js",
|
|
15
|
+
"require": "./dist/cjs/index.js"
|
|
13
16
|
},
|
|
14
17
|
"./options/dropdownPreselectedOptions": {
|
|
15
|
-
"import": "./esm/options/dropdownPreselectedOptions.js",
|
|
16
|
-
"require": "./cjs/options/dropdownPreselectedOptions.js"
|
|
18
|
+
"import": "./dist/esm/options/dropdownPreselectedOptions.js",
|
|
19
|
+
"require": "./dist/cjs/options/dropdownPreselectedOptions.js"
|
|
17
20
|
},
|
|
18
21
|
"./DSDateRangeSelector": {
|
|
19
|
-
"import": "./esm/DSDateRangeSelector.js",
|
|
20
|
-
"require": "./cjs/DSDateRangeSelector.js"
|
|
22
|
+
"import": "./dist/esm/DSDateRangeSelector.js",
|
|
23
|
+
"require": "./dist/cjs/DSDateRangeSelector.js"
|
|
21
24
|
},
|
|
22
25
|
"./components/DateRangeSelectorImpl": {
|
|
23
|
-
"import": "./esm/components/DateRangeSelectorImpl.js",
|
|
24
|
-
"require": "./cjs/components/DateRangeSelectorImpl.js"
|
|
26
|
+
"import": "./dist/esm/components/DateRangeSelectorImpl.js",
|
|
27
|
+
"require": "./dist/cjs/components/DateRangeSelectorImpl.js"
|
|
25
28
|
},
|
|
26
29
|
"./components/CustomOptionRender/CustomOptionRender": {
|
|
27
|
-
"import": "./esm/components/CustomOptionRender/CustomOptionRender.js",
|
|
28
|
-
"require": "./cjs/components/CustomOptionRender/CustomOptionRender.js"
|
|
30
|
+
"import": "./dist/esm/components/CustomOptionRender/CustomOptionRender.js",
|
|
31
|
+
"require": "./dist/cjs/components/CustomOptionRender/CustomOptionRender.js"
|
|
29
32
|
}
|
|
30
33
|
},
|
|
31
34
|
"sideEffects": [
|
|
@@ -37,26 +40,26 @@
|
|
|
37
40
|
"url": "https://git.elliemae.io/platform-ui/dimsum.git"
|
|
38
41
|
},
|
|
39
42
|
"engines": {
|
|
40
|
-
"
|
|
41
|
-
"node": ">=
|
|
43
|
+
"pnpm": ">=6",
|
|
44
|
+
"node": ">=16"
|
|
42
45
|
},
|
|
43
46
|
"author": "ICE MT",
|
|
44
|
-
"
|
|
45
|
-
"
|
|
46
|
-
"
|
|
47
|
-
"
|
|
48
|
-
"
|
|
47
|
+
"jestSonar": {
|
|
48
|
+
"sonar56x": true,
|
|
49
|
+
"reportPath": "reports",
|
|
50
|
+
"reportFile": "tests.xml",
|
|
51
|
+
"indent": 4
|
|
49
52
|
},
|
|
50
53
|
"dependencies": {
|
|
51
|
-
"@elliemae/ds-classnames": "3.0.0-next.
|
|
52
|
-
"@elliemae/ds-date-picker": "3.0.0-next.
|
|
53
|
-
"@elliemae/ds-form": "3.0.0-next.
|
|
54
|
-
"@elliemae/ds-icons": "3.0.0-next.
|
|
55
|
-
"@elliemae/ds-popper": "3.0.0-next.
|
|
54
|
+
"@elliemae/ds-classnames": "3.0.0-next.3",
|
|
55
|
+
"@elliemae/ds-date-picker": "3.0.0-next.3",
|
|
56
|
+
"@elliemae/ds-form": "3.0.0-next.3",
|
|
57
|
+
"@elliemae/ds-icons": "3.0.0-next.3",
|
|
58
|
+
"@elliemae/ds-popper": "3.0.0-next.3",
|
|
56
59
|
"moment": "~2.29.1",
|
|
57
60
|
"react-dates": "~21.8.0",
|
|
58
61
|
"react-desc": "~4.1.3",
|
|
59
|
-
"react-select": "4.3.
|
|
62
|
+
"react-select": "4.3.1"
|
|
60
63
|
},
|
|
61
64
|
"peerDependencies": {
|
|
62
65
|
"lodash": "^4.17.21",
|
|
@@ -65,7 +68,13 @@
|
|
|
65
68
|
},
|
|
66
69
|
"publishConfig": {
|
|
67
70
|
"access": "public",
|
|
68
|
-
"
|
|
69
|
-
|
|
71
|
+
"typeSafety": false
|
|
72
|
+
},
|
|
73
|
+
"scripts": {
|
|
74
|
+
"dev": "cross-env NODE_ENV=development node ../../scripts/build/build.mjs --watch",
|
|
75
|
+
"test": "node ../../scripts/testing/test.mjs",
|
|
76
|
+
"lint": "node ../../scripts/lint.mjs",
|
|
77
|
+
"dts": "node ../../scripts/dts.mjs",
|
|
78
|
+
"build": "cross-env NODE_ENV=production node ../../scripts/build/build.mjs"
|
|
70
79
|
}
|
|
71
80
|
}
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var _jsx = require('@babel/runtime/helpers/jsx');
|
|
6
|
-
require('react');
|
|
7
|
-
var reactDesc = require('react-desc');
|
|
8
|
-
var moment = require('moment');
|
|
9
|
-
var DateRangeSelectorImpl = require('./components/DateRangeSelectorImpl.js');
|
|
10
|
-
var dropdownPreselectedOptions = require('./options/dropdownPreselectedOptions.js');
|
|
11
|
-
var CustomOptionRender = require('./components/CustomOptionRender/CustomOptionRender.js');
|
|
12
|
-
|
|
13
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
14
|
-
|
|
15
|
-
var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
|
|
16
|
-
var moment__default = /*#__PURE__*/_interopDefaultLegacy(moment);
|
|
17
|
-
|
|
18
|
-
const DSDateRangeSelector = _ref => {
|
|
19
|
-
let {
|
|
20
|
-
containerProps = {},
|
|
21
|
-
className = '',
|
|
22
|
-
preselectedOptions = dropdownPreselectedOptions.dropdownPreselectedOptions,
|
|
23
|
-
onChange = () => null,
|
|
24
|
-
placeholder = 'Select Range',
|
|
25
|
-
value = null,
|
|
26
|
-
customOptionRender = CustomOptionRender,
|
|
27
|
-
startDate = null,
|
|
28
|
-
endDate = null,
|
|
29
|
-
displayFormatDay = 'D',
|
|
30
|
-
disableCustomOption = false
|
|
31
|
-
} = _ref;
|
|
32
|
-
return /*#__PURE__*/_jsx__default["default"](DateRangeSelectorImpl, {
|
|
33
|
-
className: className,
|
|
34
|
-
containerProps: containerProps,
|
|
35
|
-
customOptionRender: customOptionRender,
|
|
36
|
-
disableCustomOption: disableCustomOption,
|
|
37
|
-
displayFormatDay: displayFormatDay,
|
|
38
|
-
dropdownPreselectedOptions: preselectedOptions,
|
|
39
|
-
endDate: endDate,
|
|
40
|
-
onChange: onChange,
|
|
41
|
-
placeholder: placeholder,
|
|
42
|
-
startDate: startDate,
|
|
43
|
-
value: value
|
|
44
|
-
});
|
|
45
|
-
};
|
|
46
|
-
const dateRangeRecurrenceSelectorProps = {
|
|
47
|
-
containerProps: reactDesc.PropTypes.object.description('Set of properties attached to the main container'),
|
|
48
|
-
className: reactDesc.PropTypes.string.description('html class attribute'),
|
|
49
|
-
preselectedOptions: reactDesc.PropTypes.arrayOf(reactDesc.PropTypes.shape({
|
|
50
|
-
label: reactDesc.PropTypes.string,
|
|
51
|
-
value: reactDesc.PropTypes.string
|
|
52
|
-
})).description('options to display in dropdown menu'),
|
|
53
|
-
onChange: reactDesc.PropTypes.func.description('function executed when selection changes'),
|
|
54
|
-
placeholder: reactDesc.PropTypes.string.description('inputs placeholder').defaultValue('Select Range'),
|
|
55
|
-
value: reactDesc.PropTypes.oneOf([reactDesc.PropTypes.string, reactDesc.PropTypes.number]).description('selected value'),
|
|
56
|
-
customOptionRender: reactDesc.PropTypes.element.description('custom renderer for options'),
|
|
57
|
-
startDate: reactDesc.PropTypes.instanceOf(Date, moment__default["default"]).description('moment object of start date'),
|
|
58
|
-
endDate: reactDesc.PropTypes.instanceOf(Date, moment__default["default"]).description('moment object of end date'),
|
|
59
|
-
displayFormatDay: reactDesc.PropTypes.string.description('format to display date').defaultValue('D'),
|
|
60
|
-
disableCustomOption: reactDesc.PropTypes.bool.description('disables custom options').defaultValue(false)
|
|
61
|
-
};
|
|
62
|
-
const DateRangeRecurrenceSelectorWithSchema = reactDesc.describe(DSDateRangeSelector);
|
|
63
|
-
DateRangeRecurrenceSelectorWithSchema.propTypes = dateRangeRecurrenceSelectorProps;
|
|
64
|
-
|
|
65
|
-
exports.CUSTOM_OPTION_VALUE = dropdownPreselectedOptions.CUSTOM_OPTION_VALUE;
|
|
66
|
-
exports.DropdownOptionsTypes = dropdownPreselectedOptions.DropdownOptionsTypes;
|
|
67
|
-
exports.dropdownPreselectedOptions = dropdownPreselectedOptions.dropdownPreselectedOptions;
|
|
68
|
-
exports.DateRangeRecurrenceSelectorWithSchema = DateRangeRecurrenceSelectorWithSchema;
|
|
69
|
-
exports["default"] = DSDateRangeSelector;
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var _jsx = require('@babel/runtime/helpers/jsx');
|
|
4
|
-
require('react');
|
|
5
|
-
var dsClassnames = require('@elliemae/ds-classnames');
|
|
6
|
-
|
|
7
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
8
|
-
|
|
9
|
-
var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
|
|
10
|
-
|
|
11
|
-
const {
|
|
12
|
-
cssClassName
|
|
13
|
-
} = dsClassnames.convertPropToCssClassName('date-range-selector-customoption');
|
|
14
|
-
/**
|
|
15
|
-
* @param root0
|
|
16
|
-
* @param root0.customRange
|
|
17
|
-
* @param root0.customRange.startDate
|
|
18
|
-
* @param root0.customRange.endDate
|
|
19
|
-
* @customRange {
|
|
20
|
-
endDate
|
|
21
|
-
startDate
|
|
22
|
-
}
|
|
23
|
-
*/
|
|
24
|
-
|
|
25
|
-
const CustomOptionRender = _ref => {
|
|
26
|
-
let {
|
|
27
|
-
customRange: {
|
|
28
|
-
startDate,
|
|
29
|
-
endDate
|
|
30
|
-
}
|
|
31
|
-
} = _ref;
|
|
32
|
-
const start = startDate ? startDate.format('MM/DD/YYYY') : null;
|
|
33
|
-
const end = endDate ? endDate.format('MM/DD/YYYY') : null;
|
|
34
|
-
const display = "From ".concat(start, " to ").concat(end) || 'Custom';
|
|
35
|
-
return /*#__PURE__*/_jsx__default["default"]("em", {
|
|
36
|
-
className: cssClassName
|
|
37
|
-
}, void 0, display);
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
module.exports = CustomOptionRender;
|