intelicoreact 0.0.63 → 0.0.64
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/Atomic/FormElements/InputDateRange/InputDateRange.js +51 -35
- package/dist/Atomic/FormElements/InputDateRange/InputDateRange.stories.js +159 -3
- package/dist/Atomic/FormElements/InputDateRange/dependencies.js +8 -0
- package/package.json +1 -1
- package/src/Atomic/FormElements/InputDateRange/InputDateRange.js +226 -213
- package/src/Atomic/FormElements/InputDateRange/InputDateRange.stories.js +101 -11
- package/src/Atomic/FormElements/InputDateRange/dependencies.js +8 -0
|
@@ -86,6 +86,25 @@ var InputDateRange = function InputDateRange(props) {
|
|
|
86
86
|
var internalContainerRef = (0, _react.useRef)(null);
|
|
87
87
|
var isEndDateNearFuture = (0, _momentTimezone.default)(actualValues === null || actualValues === void 0 ? void 0 : actualValues.end).isSameOrAfter((0, _momentTimezone.default)());
|
|
88
88
|
|
|
89
|
+
var handleChange = function handleChange(input) {
|
|
90
|
+
var newValue = (0, _dependencies.getActualDateRange)(input);
|
|
91
|
+
|
|
92
|
+
var formatedValue = _objectSpread(_objectSpread(_objectSpread({
|
|
93
|
+
intervalKey: newValue.intervalKey,
|
|
94
|
+
start: newValue.start ? (0, _momentTimezone.default)(newValue.start).format('YYYY-MM-DDTHH:mm') : newValue.start,
|
|
95
|
+
end: newValue.end ? (0, _momentTimezone.default)(newValue.end).format('YYYY-MM-DDTHH:mm') : newValue.end
|
|
96
|
+
}, newValue.compare ? {
|
|
97
|
+
compare: newValue.compare
|
|
98
|
+
} : {}), newValue.startPrevDate ? {
|
|
99
|
+
startPrevDate: (0, _momentTimezone.default)(newValue.startPrevDate).format('YYYY-MM-DDTHH:mm')
|
|
100
|
+
} : {}), newValue.endPrevDate ? {
|
|
101
|
+
endPrevDate: (0, _momentTimezone.default)(newValue.endPrevDate).format('YYYY-MM-DDTHH:mm')
|
|
102
|
+
} : {});
|
|
103
|
+
|
|
104
|
+
onChange(formatedValue);
|
|
105
|
+
return formatedValue;
|
|
106
|
+
};
|
|
107
|
+
|
|
89
108
|
var Range = function Range() {
|
|
90
109
|
var SYMBOLS_QUANTITY_IF_TIME_ADDED = 13;
|
|
91
110
|
var start = actualValues.start,
|
|
@@ -116,8 +135,7 @@ var InputDateRange = function InputDateRange(props) {
|
|
|
116
135
|
var start = actualValues.start,
|
|
117
136
|
end = actualValues.end;
|
|
118
137
|
var intervalHoursCount = (0, _momentTimezone.default)(end).diff(start, 'hours');
|
|
119
|
-
var newEnd;
|
|
120
|
-
var newStart;
|
|
138
|
+
var newEnd, newStart;
|
|
121
139
|
var endHours = (0, _momentTimezone.default)(end).hours();
|
|
122
140
|
var startHours = (0, _momentTimezone.default)(start).hours();
|
|
123
141
|
|
|
@@ -131,7 +149,7 @@ var InputDateRange = function InputDateRange(props) {
|
|
|
131
149
|
|
|
132
150
|
var startPrevDate = (0, _momentTimezone.default)(newStart).subtract(intervalHoursCount, 'hours').subtract(1, 'seconds');
|
|
133
151
|
var endPrevDate = (0, _momentTimezone.default)(newEnd).subtract(1, 'seconds');
|
|
134
|
-
|
|
152
|
+
handleChange(_objectSpread(_objectSpread({}, value), {}, {
|
|
135
153
|
intervalKey: (_getActualDateRange = (0, _dependencies.getActualDateRange)({
|
|
136
154
|
start: newStart,
|
|
137
155
|
end: newEnd
|
|
@@ -146,36 +164,34 @@ var InputDateRange = function InputDateRange(props) {
|
|
|
146
164
|
var handleArrowClick = function handleArrowClick(type) {
|
|
147
165
|
slideInterval(type === 'right' ? 'forward' : 'back');
|
|
148
166
|
toggleOff();
|
|
149
|
-
};
|
|
167
|
+
}; // const absData = useMemo(
|
|
168
|
+
// () => ({
|
|
169
|
+
// body: OpenedPart,
|
|
170
|
+
// props: {
|
|
171
|
+
// ...props,
|
|
172
|
+
// key: `${actualValues.start}-${actualValues.end}-${actualValues.intervalKey}-${current}-${isCompare}`,
|
|
173
|
+
// actualValues,
|
|
174
|
+
// current,
|
|
175
|
+
// setCurrent,
|
|
176
|
+
// isCompare,
|
|
177
|
+
// setIsCompare,
|
|
178
|
+
// toggleOff,
|
|
179
|
+
// onChange,
|
|
180
|
+
// },
|
|
181
|
+
// clickOutsideCallback: () => toggleOff(),
|
|
182
|
+
// top: internalContainerRef.current?.getBoundingClientRect()?.bottom || 0,
|
|
183
|
+
// left: internalContainerRef.current?.getBoundingClientRect()?.left || 0,
|
|
184
|
+
// }),
|
|
185
|
+
// [isToggled, value, actualValues, current, isCompare],
|
|
186
|
+
// );
|
|
187
|
+
// useEffect(() => {
|
|
188
|
+
// if (current && isUseAbs && absTooltip) onChange(current, 'absTooltip/props/current');
|
|
189
|
+
// }, [current]);
|
|
190
|
+
// useEffect(() => {
|
|
191
|
+
// if (isUseAbs) onChange(isToggled ? absData : null, 'absTooltip');
|
|
192
|
+
// }, [isToggled]);
|
|
193
|
+
|
|
150
194
|
|
|
151
|
-
var absData = (0, _react.useMemo)(function () {
|
|
152
|
-
var _internalContainerRef, _internalContainerRef2, _internalContainerRef3, _internalContainerRef4;
|
|
153
|
-
|
|
154
|
-
return {
|
|
155
|
-
body: _OpenedPart.default,
|
|
156
|
-
props: _objectSpread(_objectSpread({}, props), {}, {
|
|
157
|
-
key: "".concat(actualValues.start, "-").concat(actualValues.end, "-").concat(actualValues.intervalKey, "-").concat(current, "-").concat(isCompare),
|
|
158
|
-
actualValues: actualValues,
|
|
159
|
-
current: current,
|
|
160
|
-
setCurrent: setCurrent,
|
|
161
|
-
isCompare: isCompare,
|
|
162
|
-
setIsCompare: setIsCompare,
|
|
163
|
-
toggleOff: toggleOff,
|
|
164
|
-
onChange: onChange
|
|
165
|
-
}),
|
|
166
|
-
clickOutsideCallback: function clickOutsideCallback() {
|
|
167
|
-
return toggleOff();
|
|
168
|
-
},
|
|
169
|
-
top: ((_internalContainerRef = internalContainerRef.current) === null || _internalContainerRef === void 0 ? void 0 : (_internalContainerRef2 = _internalContainerRef.getBoundingClientRect()) === null || _internalContainerRef2 === void 0 ? void 0 : _internalContainerRef2.bottom) || 0,
|
|
170
|
-
left: ((_internalContainerRef3 = internalContainerRef.current) === null || _internalContainerRef3 === void 0 ? void 0 : (_internalContainerRef4 = _internalContainerRef3.getBoundingClientRect()) === null || _internalContainerRef4 === void 0 ? void 0 : _internalContainerRef4.left) || 0
|
|
171
|
-
};
|
|
172
|
-
}, [isToggled, value, actualValues, current, isCompare]);
|
|
173
|
-
(0, _react.useEffect)(function () {
|
|
174
|
-
if (current && isUseAbs && absTooltip) onChange(current, 'absTooltip/props/current');
|
|
175
|
-
}, [current]);
|
|
176
|
-
(0, _react.useEffect)(function () {
|
|
177
|
-
if (isUseAbs) onChange(isToggled ? absData : null, 'absTooltip');
|
|
178
|
-
}, [isToggled]);
|
|
179
195
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
180
196
|
ref: internalContainerRef,
|
|
181
197
|
className: (0, _classnames.default)('date-range-input', className, {
|
|
@@ -220,14 +236,14 @@ var InputDateRange = function InputDateRange(props) {
|
|
|
220
236
|
type: "left",
|
|
221
237
|
className: "date-range-input__arrow",
|
|
222
238
|
onClick: function onClick() {
|
|
223
|
-
return handleArrowClick(
|
|
239
|
+
return handleArrowClick("left");
|
|
224
240
|
},
|
|
225
241
|
disabled: disabled || (actualValues === null || actualValues === void 0 ? void 0 : actualValues.intervalKey) === _dependencies.ALL_TIME_KEY
|
|
226
242
|
}), /*#__PURE__*/_react.default.createElement(_Arrow.default, {
|
|
227
243
|
type: "right",
|
|
228
244
|
className: "date-range-input__arrow",
|
|
229
245
|
onClick: function onClick() {
|
|
230
|
-
return handleArrowClick(
|
|
246
|
+
return handleArrowClick("right");
|
|
231
247
|
},
|
|
232
248
|
disabled: disabled || (actualValues === null || actualValues === void 0 ? void 0 : actualValues.intervalKey) === _dependencies.ALL_TIME_KEY || (actualValues === null || actualValues === void 0 ? void 0 : actualValues.intervalKey) === 'today' || (0, _momentTimezone.default)(actualValues === null || actualValues === void 0 ? void 0 : actualValues.end).add((0, _momentTimezone.default)(actualValues === null || actualValues === void 0 ? void 0 : actualValues.end).diff(actualValues === null || actualValues === void 0 ? void 0 : actualValues.start, 'hours'), 'hours').isAfter((0, _momentTimezone.default)().add(1, 'day').startOf('day'))
|
|
233
249
|
}))), isToggled && !isUseAbs && /*#__PURE__*/_react.default.createElement(_OpenedPart.default, (0, _extends2.default)({}, props, {
|
|
@@ -238,7 +254,7 @@ var InputDateRange = function InputDateRange(props) {
|
|
|
238
254
|
isCompare: isCompare,
|
|
239
255
|
setIsCompare: setIsCompare,
|
|
240
256
|
toggleOff: toggleOff,
|
|
241
|
-
onChange:
|
|
257
|
+
onChange: handleChange
|
|
242
258
|
})))), error && /*#__PURE__*/_react.default.createElement("span", {
|
|
243
259
|
className: "date-range-input__error-block"
|
|
244
260
|
}, error));
|
|
@@ -11,6 +11,8 @@ exports.InputDateRangeTemplate = exports.default = void 0;
|
|
|
11
11
|
|
|
12
12
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
13
13
|
|
|
14
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
15
|
+
|
|
14
16
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
15
17
|
|
|
16
18
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
@@ -19,12 +21,18 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
19
21
|
|
|
20
22
|
var _InputDateRange = _interopRequireDefault(require("./InputDateRange"));
|
|
21
23
|
|
|
24
|
+
var _Table = _interopRequireDefault(require("../Table/Table"));
|
|
25
|
+
|
|
22
26
|
var _excluded = ["dateRange"];
|
|
23
27
|
|
|
24
28
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
25
29
|
|
|
26
30
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
27
31
|
|
|
32
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
33
|
+
|
|
34
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
35
|
+
|
|
28
36
|
global.lng = 'en';
|
|
29
37
|
var _default = {
|
|
30
38
|
title: 'Form Elements/InputDateRange',
|
|
@@ -38,23 +46,171 @@ var _default = {
|
|
|
38
46
|
}
|
|
39
47
|
};
|
|
40
48
|
exports.default = _default;
|
|
49
|
+
var tableData = {
|
|
50
|
+
header: [{
|
|
51
|
+
id: 1,
|
|
52
|
+
label: 'state'
|
|
53
|
+
}, {
|
|
54
|
+
id: 2,
|
|
55
|
+
label: 'Tags'
|
|
56
|
+
}, {
|
|
57
|
+
id: 3,
|
|
58
|
+
label: 'status'
|
|
59
|
+
}, {
|
|
60
|
+
id: 4,
|
|
61
|
+
label: 'loanAmountApproved'
|
|
62
|
+
}, {
|
|
63
|
+
id: 5,
|
|
64
|
+
label: 'loanAmountRejected'
|
|
65
|
+
}, {
|
|
66
|
+
id: 6,
|
|
67
|
+
label: 'approveRate'
|
|
68
|
+
}, {
|
|
69
|
+
id: 7,
|
|
70
|
+
label: 'actions',
|
|
71
|
+
type: 'actions'
|
|
72
|
+
}],
|
|
73
|
+
rows: [{
|
|
74
|
+
id: 1,
|
|
75
|
+
link: {
|
|
76
|
+
label: 'CA',
|
|
77
|
+
link: '#s'
|
|
78
|
+
},
|
|
79
|
+
tags: [{
|
|
80
|
+
label: 'Label 1'
|
|
81
|
+
}],
|
|
82
|
+
status: {
|
|
83
|
+
value: '90',
|
|
84
|
+
status: 'active'
|
|
85
|
+
},
|
|
86
|
+
loanAmountApproved: {
|
|
87
|
+
value: '$70,000'
|
|
88
|
+
},
|
|
89
|
+
loanAmountRejected: {
|
|
90
|
+
value: '$30,000'
|
|
91
|
+
},
|
|
92
|
+
approveRate: {
|
|
93
|
+
value: '70%'
|
|
94
|
+
}
|
|
95
|
+
}, {
|
|
96
|
+
id: 2,
|
|
97
|
+
link: {
|
|
98
|
+
label: 'NY',
|
|
99
|
+
link: '#s'
|
|
100
|
+
},
|
|
101
|
+
advancedTags: [{
|
|
102
|
+
labelLeft: 'home',
|
|
103
|
+
labelRight: 'hoods',
|
|
104
|
+
active: 3,
|
|
105
|
+
pause: 1,
|
|
106
|
+
merchants: 5
|
|
107
|
+
}, {
|
|
108
|
+
labelRight: 'jewelry',
|
|
109
|
+
active: 3,
|
|
110
|
+
pause: 1,
|
|
111
|
+
merchants: 5
|
|
112
|
+
}, {
|
|
113
|
+
labelLeft: 'home',
|
|
114
|
+
labelRight: 'improvement',
|
|
115
|
+
active: 0,
|
|
116
|
+
pause: 0,
|
|
117
|
+
warnLeft: true,
|
|
118
|
+
warnLeftMsg: 'landerNotIncluded',
|
|
119
|
+
warnRightMsg: 'noMerchants'
|
|
120
|
+
}, {
|
|
121
|
+
labelLeft: 'home',
|
|
122
|
+
labelRight: 'hoods',
|
|
123
|
+
active: 3,
|
|
124
|
+
pause: 1,
|
|
125
|
+
merchants: 5
|
|
126
|
+
}, {
|
|
127
|
+
labelRight: 'jewelry',
|
|
128
|
+
active: 3,
|
|
129
|
+
pause: 1,
|
|
130
|
+
merchants: 5
|
|
131
|
+
}],
|
|
132
|
+
status: {
|
|
133
|
+
label: 'Active',
|
|
134
|
+
className: 'color--green-haze'
|
|
135
|
+
},
|
|
136
|
+
loanAmountApproved: {
|
|
137
|
+
value: '$3,000'
|
|
138
|
+
},
|
|
139
|
+
loanAmountRejected: {
|
|
140
|
+
value: '$7,000'
|
|
141
|
+
},
|
|
142
|
+
approveRate: {
|
|
143
|
+
value: '30%'
|
|
144
|
+
}
|
|
145
|
+
}, {
|
|
146
|
+
id: 3,
|
|
147
|
+
link: {
|
|
148
|
+
label: 'NH',
|
|
149
|
+
link: '#s'
|
|
150
|
+
},
|
|
151
|
+
tags: [{
|
|
152
|
+
label: 'Label 1'
|
|
153
|
+
}, {
|
|
154
|
+
label: 'Label 2'
|
|
155
|
+
}, {
|
|
156
|
+
label: 'Label 3'
|
|
157
|
+
}],
|
|
158
|
+
status: {
|
|
159
|
+
status: 'error'
|
|
160
|
+
},
|
|
161
|
+
loanAmountApproved: {
|
|
162
|
+
value: '$70,000'
|
|
163
|
+
},
|
|
164
|
+
loanAmountRejected: {
|
|
165
|
+
value: '$30,000'
|
|
166
|
+
},
|
|
167
|
+
approveRate: {
|
|
168
|
+
value: '70%'
|
|
169
|
+
}
|
|
170
|
+
}]
|
|
171
|
+
};
|
|
41
172
|
|
|
42
173
|
var Template = function Template(args) {
|
|
174
|
+
var _state$rows;
|
|
175
|
+
|
|
43
176
|
var dateRange = args.dateRange,
|
|
44
177
|
restOfProps = (0, _objectWithoutProperties2.default)(args, _excluded);
|
|
45
178
|
|
|
46
179
|
var _useState = (0, _react.useState)(dateRange),
|
|
47
180
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
48
181
|
value = _useState2[0],
|
|
49
|
-
setValue = _useState2[1];
|
|
50
|
-
|
|
182
|
+
setValue = _useState2[1];
|
|
183
|
+
|
|
184
|
+
var _useState3 = (0, _react.useState)(tableData),
|
|
185
|
+
_useState4 = (0, _slicedToArray2.default)(_useState3, 2),
|
|
186
|
+
state = _useState4[0],
|
|
187
|
+
setState = _useState4[1];
|
|
188
|
+
|
|
189
|
+
var rowsWithActions = state === null || state === void 0 ? void 0 : (_state$rows = state.rows) === null || _state$rows === void 0 ? void 0 : _state$rows.map(function (row) {
|
|
190
|
+
return _objectSpread(_objectSpread({}, row), {}, {
|
|
191
|
+
actions: row.isDeleted ? [{
|
|
192
|
+
type: 'undo'
|
|
193
|
+
}] : [{
|
|
194
|
+
type: 'download'
|
|
195
|
+
}, {
|
|
196
|
+
type: 'edit'
|
|
197
|
+
}, {
|
|
198
|
+
type: 'delete'
|
|
199
|
+
}]
|
|
200
|
+
});
|
|
201
|
+
}); // useEffect(() => console.log(value), [value]);
|
|
202
|
+
// return <InputDateRange {...restOfProps} value={value} onChange={setValue} />;
|
|
51
203
|
|
|
52
204
|
return /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("div", {
|
|
53
205
|
className: "mb20"
|
|
54
206
|
}, /*#__PURE__*/_react.default.createElement(_InputDateRange.default, (0, _extends2.default)({}, restOfProps, {
|
|
55
207
|
value: value,
|
|
56
208
|
onChange: setValue
|
|
57
|
-
})))
|
|
209
|
+
}))), /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(_Table.default, {
|
|
210
|
+
header: state.header,
|
|
211
|
+
rows: rowsWithActions,
|
|
212
|
+
onChange: setState
|
|
213
|
+
})));
|
|
58
214
|
};
|
|
59
215
|
|
|
60
216
|
var InputDateRangeTemplate = Template.bind({});
|
|
@@ -221,6 +221,14 @@ var getActualDateRange = function getActualDateRange(inputDateRange) {
|
|
|
221
221
|
return null;
|
|
222
222
|
}();
|
|
223
223
|
|
|
224
|
+
if (actualIntervalKey === ALL_TIME_KEY) return {
|
|
225
|
+
intervalKey: ALL_TIME_KEY,
|
|
226
|
+
start: null,
|
|
227
|
+
end: null,
|
|
228
|
+
compare: inputDateRange.compare,
|
|
229
|
+
startPrevDate: null,
|
|
230
|
+
endPrevDate: null
|
|
231
|
+
};
|
|
224
232
|
var actualValues = {
|
|
225
233
|
// intervalKey: inputDateRange.intervalKey || customIntervalKey,
|
|
226
234
|
intervalKey: actualIntervalKey || CUSTOM_INTERVAL_KEY,
|
package/package.json
CHANGED
|
@@ -7,228 +7,241 @@ import { useClickOutside, useToggle, getActualDateRange, INTERVALS, ALL_TIME_KEY
|
|
|
7
7
|
import OpenedPart from './components/OpenedPart';
|
|
8
8
|
import Arrow from '../../UI/Arrow/Arrow';
|
|
9
9
|
|
|
10
|
-
import './InputDateRange.scss'
|
|
10
|
+
import './InputDateRange.scss'
|
|
11
11
|
|
|
12
12
|
const InputDateRange = props => {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
13
|
+
const {
|
|
14
|
+
txt,
|
|
15
|
+
id,
|
|
16
|
+
label,
|
|
17
|
+
className,
|
|
18
|
+
buttonsTypes,
|
|
19
|
+
value,
|
|
20
|
+
onChange = () => {},
|
|
21
|
+
error,
|
|
22
|
+
disabled,
|
|
23
|
+
isHoverable,
|
|
24
|
+
short,
|
|
25
|
+
isCompact = false,
|
|
26
|
+
// isFocused = false,
|
|
27
|
+
isIntervalsHidden = false,
|
|
28
|
+
isCompareHidden = false,
|
|
29
|
+
hideArrows = false,
|
|
30
|
+
isOptionsRight,
|
|
31
|
+
limitRange,
|
|
32
|
+
isUseAbs,
|
|
33
|
+
absTooltip,
|
|
34
|
+
} = props;
|
|
35
|
+
|
|
36
|
+
const actualValues = getActualDateRange(value);
|
|
37
|
+
const { isToggled, toggle, toggleOn, toggleOff } = useToggle(false);
|
|
38
|
+
const [current, setCurrent] = useState(actualValues?.intervalKey);
|
|
39
|
+
const [isCompare, setIsCompare] = useState(actualValues?.compare);
|
|
40
|
+
|
|
41
|
+
const ref = !isUseAbs ? useClickOutside(toggleOff) : useRef(null);
|
|
42
|
+
const internalContainerRef = useRef(null);
|
|
43
|
+
const isEndDateNearFuture = moment(actualValues?.end).isSameOrAfter(moment());
|
|
44
|
+
|
|
45
|
+
const handleChange = input => {
|
|
46
|
+
const newValue = getActualDateRange(input);
|
|
47
|
+
const formatedValue = {
|
|
48
|
+
intervalKey: newValue.intervalKey,
|
|
49
|
+
start: newValue.start ? moment(newValue.start).format('YYYY-MM-DDTHH:mm') : newValue.start,
|
|
50
|
+
end: newValue.end ? moment(newValue.end).format('YYYY-MM-DDTHH:mm') : newValue.end,
|
|
51
|
+
...(newValue.compare ? {compare: newValue.compare} : {}),
|
|
52
|
+
...(newValue.startPrevDate ? {startPrevDate: moment(newValue.startPrevDate).format('YYYY-MM-DDTHH:mm')} : {}),
|
|
53
|
+
...(newValue.endPrevDate ? {endPrevDate: moment(newValue.endPrevDate).format('YYYY-MM-DDTHH:mm')} : {}),
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
onChange(formatedValue);
|
|
57
|
+
return formatedValue;
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
const Range = () => {
|
|
61
|
+
const SYMBOLS_QUANTITY_IF_TIME_ADDED = 13;
|
|
62
|
+
const { start, end } = actualValues;
|
|
63
|
+
if (!start || !end) return null;
|
|
64
|
+
|
|
65
|
+
const startTime = moment(start).format('HH:mm');
|
|
66
|
+
const endTime = moment(end).format('HH:mm');
|
|
67
|
+
|
|
68
|
+
const firstPart = `${moment(start).format('ll')} ${startTime !== '00:00' ? `(${startTime})` : ''}`;
|
|
69
|
+
const secondPart = `${(endTime !== '00:00' ? moment(end) : moment(end).subtract(1, 'days')).format('ll')} ${
|
|
70
|
+
endTime !== '00:00' ? `(${endTime})` : ''
|
|
71
|
+
}`;
|
|
72
|
+
|
|
73
|
+
const getClasses = base => cn('date-range-input__range-text', {
|
|
74
|
+
'date-range-input__range-text_little': base.length > SYMBOLS_QUANTITY_IF_TIME_ADDED
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
return (
|
|
78
|
+
<>
|
|
79
|
+
<span className={getClasses(firstPart)}>
|
|
80
|
+
{firstPart}
|
|
81
|
+
{endTime === '00:00' && moment(end).isSame(moment(start).add(1, 'days'), 'day') ? '' : ` - `}
|
|
82
|
+
</span>
|
|
83
|
+
{endTime === '00:00' && moment(end).isSame(moment(start).add(1, 'days'), 'day')
|
|
84
|
+
? null
|
|
85
|
+
:<span className={getClasses(secondPart)}>{secondPart}</span>
|
|
62
86
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
{firstPart}
|
|
67
|
-
{endTime === '00:00' && moment(end).isSame(moment(start).add(1, 'days'), 'day') ? '' : ` - `}
|
|
68
|
-
</span>
|
|
69
|
-
{endTime === '00:00' && moment(end).isSame(moment(start).add(1, 'days'), 'day') ? null : (
|
|
70
|
-
<span className={getClasses(secondPart)}>{secondPart}</span>
|
|
71
|
-
)}
|
|
72
|
-
</>
|
|
73
|
-
);
|
|
74
|
-
};
|
|
75
|
-
|
|
76
|
-
const slideInterval = (direction = 'forward') => {
|
|
77
|
-
const { start, end } = actualValues;
|
|
78
|
-
const intervalHoursCount = moment(end).diff(start, 'hours');
|
|
79
|
-
let newEnd;
|
|
80
|
-
let newStart;
|
|
81
|
-
const endHours = moment(end).hours();
|
|
82
|
-
const startHours = moment(start).hours();
|
|
83
|
-
if (direction === 'forward') {
|
|
84
|
-
newStart = moment(end)
|
|
85
|
-
.add(endHours === 0 ? 0 : 1, 'day')
|
|
86
|
-
.hours(startHours)
|
|
87
|
-
.toDate();
|
|
88
|
-
newEnd = moment(newStart).add(intervalHoursCount, 'hours');
|
|
89
|
-
} else {
|
|
90
|
-
newEnd = moment(start)
|
|
91
|
-
.subtract(endHours === 0 ? 0 : 1, 'day')
|
|
92
|
-
.hours(endHours)
|
|
93
|
-
.toDate();
|
|
94
|
-
newStart = moment(newEnd).subtract(intervalHoursCount, 'hours');
|
|
87
|
+
}
|
|
88
|
+
</>
|
|
89
|
+
)
|
|
95
90
|
}
|
|
96
|
-
|
|
97
|
-
const
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
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
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
91
|
+
|
|
92
|
+
const slideInterval = (direction = 'forward') => {
|
|
93
|
+
const { start, end } = actualValues;
|
|
94
|
+
const intervalHoursCount = moment(end).diff(start, 'hours');
|
|
95
|
+
let newEnd, newStart;
|
|
96
|
+
const endHours = moment(end).hours();
|
|
97
|
+
const startHours = moment(start).hours();
|
|
98
|
+
if (direction === 'forward') {
|
|
99
|
+
newStart = moment(end)
|
|
100
|
+
.add(endHours === 0 ? 0 : 1, 'day')
|
|
101
|
+
.hours(startHours)
|
|
102
|
+
.toDate();
|
|
103
|
+
newEnd = moment(newStart).add(intervalHoursCount, 'hours');
|
|
104
|
+
} else {
|
|
105
|
+
newEnd = moment(start)
|
|
106
|
+
.subtract(endHours === 0 ? 0 : 1, 'day')
|
|
107
|
+
.hours(endHours)
|
|
108
|
+
.toDate();
|
|
109
|
+
newStart = moment(newEnd).subtract(intervalHoursCount, 'hours');
|
|
110
|
+
}
|
|
111
|
+
const startPrevDate = moment(newStart).subtract(intervalHoursCount, 'hours').subtract(1, 'seconds');
|
|
112
|
+
const endPrevDate = moment(newEnd).subtract(1, 'seconds');
|
|
113
|
+
handleChange({
|
|
114
|
+
...value,
|
|
115
|
+
intervalKey: getActualDateRange({
|
|
116
|
+
start: newStart,
|
|
117
|
+
end: newEnd,
|
|
118
|
+
})?.intervalKey,
|
|
119
|
+
start: newStart,
|
|
120
|
+
end: newEnd,
|
|
121
|
+
startPrevDate,
|
|
122
|
+
endPrevDate,
|
|
123
|
+
});
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
const handleArrowClick = type => {
|
|
127
|
+
slideInterval(type === 'right' ? 'forward' : 'back');
|
|
128
|
+
toggleOff();
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
// const absData = useMemo(
|
|
132
|
+
// () => ({
|
|
133
|
+
// body: OpenedPart,
|
|
134
|
+
// props: {
|
|
135
|
+
// ...props,
|
|
136
|
+
// key: `${actualValues.start}-${actualValues.end}-${actualValues.intervalKey}-${current}-${isCompare}`,
|
|
137
|
+
// actualValues,
|
|
138
|
+
// current,
|
|
139
|
+
// setCurrent,
|
|
140
|
+
// isCompare,
|
|
141
|
+
// setIsCompare,
|
|
142
|
+
// toggleOff,
|
|
143
|
+
// onChange,
|
|
144
|
+
// },
|
|
145
|
+
// clickOutsideCallback: () => toggleOff(),
|
|
146
|
+
// top: internalContainerRef.current?.getBoundingClientRect()?.bottom || 0,
|
|
147
|
+
// left: internalContainerRef.current?.getBoundingClientRect()?.left || 0,
|
|
148
|
+
// }),
|
|
149
|
+
// [isToggled, value, actualValues, current, isCompare],
|
|
150
|
+
// );
|
|
151
|
+
|
|
152
|
+
// useEffect(() => {
|
|
153
|
+
// if (current && isUseAbs && absTooltip) onChange(current, 'absTooltip/props/current');
|
|
154
|
+
// }, [current]);
|
|
155
|
+
|
|
156
|
+
// useEffect(() => {
|
|
157
|
+
// if (isUseAbs) onChange(isToggled ? absData : null, 'absTooltip');
|
|
158
|
+
// }, [isToggled]);
|
|
159
|
+
|
|
160
|
+
return (
|
|
158
161
|
<div
|
|
159
|
-
|
|
160
|
-
'date-range-
|
|
161
|
-
|
|
162
|
+
ref={internalContainerRef}
|
|
163
|
+
className={cn('date-range-input', className, {
|
|
164
|
+
'date-range-input_compact': isCompact,
|
|
165
|
+
'date-range-input_hide-arrows': hideArrows,
|
|
166
|
+
'date-range-input_focused': isToggled,
|
|
167
|
+
'date-range-input_error': error,
|
|
168
|
+
'date-range-input_disabled': disabled,
|
|
169
|
+
})}
|
|
162
170
|
>
|
|
163
|
-
|
|
164
|
-
<
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
// { 'form-select__input--disabled': disabled },
|
|
170
|
-
// { 'form-select__input--opened': isToggled },
|
|
171
|
-
// { 'form-select__input--focused': isToggled },
|
|
172
|
-
// className,
|
|
173
|
-
// )}
|
|
174
|
-
disabled={disabled}
|
|
175
|
-
onClick={!disabled && !isHoverable ? toggle : undefined}
|
|
171
|
+
<span className="date-range-input__label" >{label}</span>
|
|
172
|
+
<div
|
|
173
|
+
className="date-range-input__wraper"
|
|
174
|
+
ref={ref}
|
|
175
|
+
onMouseEnter={isHoverable && toggleOn}
|
|
176
|
+
onMouseLeave={isHoverable && toggleOff}
|
|
176
177
|
>
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
(
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
178
|
+
<div className={cn('date-range-input__absolut-wraper', {
|
|
179
|
+
'date-range-input__absolut-wraper_right-position': isOptionsRight,
|
|
180
|
+
})}>
|
|
181
|
+
<div className={cn('date-range-input__static-part')}>
|
|
182
|
+
<button
|
|
183
|
+
id={id}
|
|
184
|
+
className={cn('date-range-input__toggle-button')}
|
|
185
|
+
// className={cn(
|
|
186
|
+
// 'date-range-input__toggle-button',
|
|
187
|
+
// { 'form-select__input--disabled': disabled },
|
|
188
|
+
// { 'form-select__input--opened': isToggled },
|
|
189
|
+
// { 'form-select__input--focused': isToggled },
|
|
190
|
+
// className,
|
|
191
|
+
// )}
|
|
192
|
+
disabled={disabled}
|
|
193
|
+
onClick={!disabled && !isHoverable ? toggle : undefined}
|
|
194
|
+
>
|
|
195
|
+
<div className="date-range-input__interval-key">
|
|
196
|
+
<span>
|
|
197
|
+
{(txt?.labels && txt.labels[actualValues?.intervalKey]) ?? (INTERVALS[actualValues?.intervalKey]?.label || CUSTOM_INTERVAL_KEY_TEXT)}
|
|
198
|
+
</span>
|
|
199
|
+
{current !== ALL_TIME_KEY && <span>:</span>}
|
|
200
|
+
</div>
|
|
201
|
+
{!isCompact && <div className={cn('date-range-input__range', {})}><Range /></div>}
|
|
202
|
+
</button>
|
|
203
|
+
{!isCompact && !hideArrows && (
|
|
204
|
+
<div className={cn('date-range-input__arrows-block')}>
|
|
205
|
+
<Arrow
|
|
206
|
+
type="left"
|
|
207
|
+
className="date-range-input__arrow"
|
|
208
|
+
onClick={() => handleArrowClick("left")}
|
|
209
|
+
disabled={disabled || actualValues?.intervalKey === ALL_TIME_KEY}
|
|
210
|
+
/>
|
|
211
|
+
<Arrow
|
|
212
|
+
type="right"
|
|
213
|
+
className="date-range-input__arrow"
|
|
214
|
+
onClick={() => handleArrowClick("right")}
|
|
215
|
+
disabled={
|
|
216
|
+
disabled ||
|
|
217
|
+
actualValues?.intervalKey === ALL_TIME_KEY ||
|
|
218
|
+
actualValues?.intervalKey === 'today' ||
|
|
219
|
+
moment(actualValues?.end)
|
|
220
|
+
.add(moment(actualValues?.end).diff(actualValues?.start, 'hours'), 'hours')
|
|
221
|
+
.isAfter(moment().add(1, 'day').startOf('day'))
|
|
222
|
+
}
|
|
223
|
+
/>
|
|
224
|
+
</div>
|
|
225
|
+
)}
|
|
226
|
+
</div>
|
|
227
|
+
{isToggled && !isUseAbs && (
|
|
228
|
+
<OpenedPart
|
|
229
|
+
{...props}
|
|
230
|
+
ref={internalContainerRef}
|
|
231
|
+
actualValues={actualValues}
|
|
232
|
+
current={current}
|
|
233
|
+
setCurrent={setCurrent}
|
|
234
|
+
isCompare={isCompare}
|
|
235
|
+
setIsCompare={setIsCompare}
|
|
236
|
+
toggleOff={toggleOff}
|
|
237
|
+
onChange={handleChange}
|
|
238
|
+
/>
|
|
239
|
+
)}
|
|
187
240
|
</div>
|
|
188
|
-
|
|
189
|
-
</
|
|
190
|
-
{!isCompact && !hideArrows && (
|
|
191
|
-
<div className={cn('date-range-input__arrows-block')}>
|
|
192
|
-
<Arrow
|
|
193
|
-
type="left"
|
|
194
|
-
className="date-range-input__arrow"
|
|
195
|
-
onClick={() => handleArrowClick('left')}
|
|
196
|
-
disabled={disabled || actualValues?.intervalKey === ALL_TIME_KEY}
|
|
197
|
-
/>
|
|
198
|
-
<Arrow
|
|
199
|
-
type="right"
|
|
200
|
-
className="date-range-input__arrow"
|
|
201
|
-
onClick={() => handleArrowClick('right')}
|
|
202
|
-
disabled={
|
|
203
|
-
disabled ||
|
|
204
|
-
actualValues?.intervalKey === ALL_TIME_KEY ||
|
|
205
|
-
actualValues?.intervalKey === 'today' ||
|
|
206
|
-
moment(actualValues?.end)
|
|
207
|
-
.add(moment(actualValues?.end).diff(actualValues?.start, 'hours'), 'hours')
|
|
208
|
-
.isAfter(moment().add(1, 'day').startOf('day'))
|
|
209
|
-
}
|
|
210
|
-
/>
|
|
211
|
-
</div>
|
|
212
|
-
)}
|
|
213
|
-
</div>
|
|
214
|
-
{isToggled && !isUseAbs && (
|
|
215
|
-
<OpenedPart
|
|
216
|
-
{...props}
|
|
217
|
-
ref={internalContainerRef}
|
|
218
|
-
actualValues={actualValues}
|
|
219
|
-
current={current}
|
|
220
|
-
setCurrent={setCurrent}
|
|
221
|
-
isCompare={isCompare}
|
|
222
|
-
setIsCompare={setIsCompare}
|
|
223
|
-
toggleOff={toggleOff}
|
|
224
|
-
onChange={onChange}
|
|
225
|
-
/>
|
|
226
|
-
)}
|
|
241
|
+
</div>
|
|
242
|
+
{error && <span className="date-range-input__error-block">{error}</span>}
|
|
227
243
|
</div>
|
|
228
|
-
|
|
229
|
-
{error && <span className="date-range-input__error-block">{error}</span>}
|
|
230
|
-
</div>
|
|
231
|
-
);
|
|
244
|
+
);
|
|
232
245
|
};
|
|
233
246
|
|
|
234
247
|
export default React.memo(InputDateRange);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import React, { useState } from 'react';
|
|
1
|
+
import React, { /*useEffect,*/ useState } from 'react';
|
|
2
2
|
import InputDateRange from './InputDateRange';
|
|
3
|
+
import Table from '../Table/Table';
|
|
3
4
|
|
|
4
5
|
global.lng = 'en';
|
|
5
6
|
|
|
@@ -16,18 +17,107 @@ export default {
|
|
|
16
17
|
}
|
|
17
18
|
};
|
|
18
19
|
|
|
20
|
+
const tableData = {
|
|
21
|
+
header: [
|
|
22
|
+
{ id: 1, label: 'state' },
|
|
23
|
+
{ id: 2, label: 'Tags' },
|
|
24
|
+
{ id: 3, label: 'status' },
|
|
25
|
+
{ id: 4, label: 'loanAmountApproved' },
|
|
26
|
+
{ id: 5, label: 'loanAmountRejected' },
|
|
27
|
+
{ id: 6, label: 'approveRate' },
|
|
28
|
+
{ id: 7, label: 'actions', type: 'actions' }
|
|
29
|
+
],
|
|
30
|
+
rows: [
|
|
31
|
+
{
|
|
32
|
+
id: 1,
|
|
33
|
+
link: { label: 'CA', link: '#s' },
|
|
34
|
+
tags: [{ label: 'Label 1' }],
|
|
35
|
+
status: { value: '90', status: 'active' },
|
|
36
|
+
loanAmountApproved: { value: '$70,000' },
|
|
37
|
+
loanAmountRejected: { value: '$30,000' },
|
|
38
|
+
approveRate: { value: '70%' }
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
id: 2,
|
|
42
|
+
link: { label: 'NY', link: '#s' },
|
|
43
|
+
advancedTags: [
|
|
44
|
+
{
|
|
45
|
+
labelLeft: 'home',
|
|
46
|
+
labelRight: 'hoods',
|
|
47
|
+
active: 3,
|
|
48
|
+
pause: 1,
|
|
49
|
+
merchants: 5
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
labelRight: 'jewelry',
|
|
53
|
+
active: 3,
|
|
54
|
+
pause: 1,
|
|
55
|
+
merchants: 5
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
labelLeft: 'home',
|
|
59
|
+
labelRight: 'improvement',
|
|
60
|
+
active: 0,
|
|
61
|
+
pause: 0,
|
|
62
|
+
warnLeft: true,
|
|
63
|
+
warnLeftMsg: 'landerNotIncluded',
|
|
64
|
+
warnRightMsg: 'noMerchants'
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
labelLeft: 'home',
|
|
68
|
+
labelRight: 'hoods',
|
|
69
|
+
active: 3,
|
|
70
|
+
pause: 1,
|
|
71
|
+
merchants: 5
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
labelRight: 'jewelry',
|
|
75
|
+
active: 3,
|
|
76
|
+
pause: 1,
|
|
77
|
+
merchants: 5
|
|
78
|
+
}
|
|
79
|
+
],
|
|
80
|
+
status: { label: 'Active', className: 'color--green-haze' },
|
|
81
|
+
loanAmountApproved: { value: '$3,000' },
|
|
82
|
+
loanAmountRejected: { value: '$7,000' },
|
|
83
|
+
approveRate: { value: '30%' }
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
id: 3,
|
|
87
|
+
link: { label: 'NH', link: '#s' },
|
|
88
|
+
tags: [{ label: 'Label 1' }, { label: 'Label 2' }, { label: 'Label 3' }],
|
|
89
|
+
status: { status: 'error' },
|
|
90
|
+
loanAmountApproved: { value: '$70,000' },
|
|
91
|
+
loanAmountRejected: { value: '$30,000' },
|
|
92
|
+
approveRate: { value: '70%' }
|
|
93
|
+
}
|
|
94
|
+
]
|
|
95
|
+
};
|
|
96
|
+
|
|
19
97
|
const Template = args => {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
98
|
+
const { dateRange, ...restOfProps } = args;
|
|
99
|
+
const [value, setValue] = useState(dateRange);
|
|
100
|
+
|
|
101
|
+
const [state, setState] = useState(tableData);
|
|
102
|
+
|
|
103
|
+
const rowsWithActions = state?.rows?.map(row => ({
|
|
104
|
+
...row,
|
|
105
|
+
actions: row.isDeleted ? [{ type: 'undo' }] : [{ type: 'download' }, { type: 'edit' }, { type: 'delete' }]
|
|
106
|
+
}));
|
|
107
|
+
|
|
108
|
+
// useEffect(() => console.log(value), [value]);
|
|
109
|
+
|
|
110
|
+
// return <InputDateRange {...restOfProps} value={value} onChange={setValue} />;
|
|
111
|
+
return (
|
|
112
|
+
<div>
|
|
113
|
+
<div className="mb20">
|
|
114
|
+
<InputDateRange {...restOfProps} value={value} onChange={setValue} />
|
|
115
|
+
</div>
|
|
116
|
+
<div>
|
|
117
|
+
<Table header={state.header} rows={rowsWithActions} onChange={setState} />
|
|
118
|
+
</div>
|
|
28
119
|
</div>
|
|
29
|
-
|
|
30
|
-
);
|
|
120
|
+
);
|
|
31
121
|
};
|
|
32
122
|
|
|
33
123
|
export const InputDateRangeTemplate = Template.bind({});
|
|
@@ -130,6 +130,14 @@ export const getActualDateRange = inputDateRange => {
|
|
|
130
130
|
}
|
|
131
131
|
return null;
|
|
132
132
|
})();
|
|
133
|
+
if (actualIntervalKey === ALL_TIME_KEY) return {
|
|
134
|
+
intervalKey: ALL_TIME_KEY,
|
|
135
|
+
start: null,
|
|
136
|
+
end: null,
|
|
137
|
+
compare: inputDateRange.compare,
|
|
138
|
+
startPrevDate: null,
|
|
139
|
+
endPrevDate:null
|
|
140
|
+
};
|
|
133
141
|
const actualValues = {
|
|
134
142
|
// intervalKey: inputDateRange.intervalKey || customIntervalKey,
|
|
135
143
|
intervalKey: actualIntervalKey || CUSTOM_INTERVAL_KEY,
|