trotl-filter 1.0.8 → 1.0.9
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/index.cjs.js +67 -1
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +67 -1
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -9953,6 +9953,28 @@ function RangePicker({
|
|
|
9953
9953
|
const newUrl = window.location.pathname + (params.toString() ? `?${params.toString()}` : "");
|
|
9954
9954
|
window.history.replaceState({}, "", newUrl);
|
|
9955
9955
|
}, [paramKey]);
|
|
9956
|
+
|
|
9957
|
+
// Extract HH:mm part from the current range value
|
|
9958
|
+
const getTimeValue = useCallback(which => {
|
|
9959
|
+
const val = which === 'start' ? range[0] : range[1];
|
|
9960
|
+
if (val && val.includes('T')) {
|
|
9961
|
+
return val.split('T')[1].slice(0, 5);
|
|
9962
|
+
}
|
|
9963
|
+
return which === 'start' ? timeStart || "" : timeEnd || "";
|
|
9964
|
+
}, [range, timeStart, timeEnd]);
|
|
9965
|
+
|
|
9966
|
+
// Update time while keeping the selected date
|
|
9967
|
+
const handleTimeChange = which => e => {
|
|
9968
|
+
const newTime = e.target.value;
|
|
9969
|
+
const currentVal = which === 'start' ? range[0] : range[1];
|
|
9970
|
+
const datePart = currentVal && currentVal.split('T')[0] || formatDate(new Date(), false);
|
|
9971
|
+
const newVal = `${datePart}T${newTime}`;
|
|
9972
|
+
const newRange = which === 'start' ? [newVal, range[1]] : [range[0], newVal];
|
|
9973
|
+
if (!controlledValue) setRange(newRange);
|
|
9974
|
+
setUrlParam(newRange);
|
|
9975
|
+
setSelectedRange("");
|
|
9976
|
+
onChange?.(newRange);
|
|
9977
|
+
};
|
|
9956
9978
|
const handleClear = () => {
|
|
9957
9979
|
if (!controlledValue) setRange(["", ""]);
|
|
9958
9980
|
setUrlParam(["", ""]);
|
|
@@ -10133,7 +10155,51 @@ function RangePicker({
|
|
|
10133
10155
|
timeStart: timeStart,
|
|
10134
10156
|
timeEnd: timeEnd,
|
|
10135
10157
|
startWith: startWith
|
|
10136
|
-
}),
|
|
10158
|
+
}), time && /*#__PURE__*/React__default.createElement("div", {
|
|
10159
|
+
style: {
|
|
10160
|
+
display: 'grid',
|
|
10161
|
+
gridTemplateColumns: '1fr 1fr',
|
|
10162
|
+
columnGap: 16,
|
|
10163
|
+
rowGap: 6,
|
|
10164
|
+
marginTop: 16,
|
|
10165
|
+
width: '99%',
|
|
10166
|
+
alignItems: 'center'
|
|
10167
|
+
}
|
|
10168
|
+
}, /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement("div", {
|
|
10169
|
+
style: {
|
|
10170
|
+
fontSize: 12,
|
|
10171
|
+
color: '#555',
|
|
10172
|
+
marginBottom: 6
|
|
10173
|
+
}
|
|
10174
|
+
}, "Start time"), /*#__PURE__*/React__default.createElement("input", {
|
|
10175
|
+
type: "time",
|
|
10176
|
+
value: getTimeValue('start'),
|
|
10177
|
+
onChange: handleTimeChange('start'),
|
|
10178
|
+
style: {
|
|
10179
|
+
width: '100%',
|
|
10180
|
+
padding: '4px 6px',
|
|
10181
|
+
border: '1px solid #d1d5db',
|
|
10182
|
+
borderRadius: 2,
|
|
10183
|
+
fontSize: 12
|
|
10184
|
+
}
|
|
10185
|
+
})), /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement("div", {
|
|
10186
|
+
style: {
|
|
10187
|
+
fontSize: 12,
|
|
10188
|
+
color: '#555',
|
|
10189
|
+
marginBottom: 6
|
|
10190
|
+
}
|
|
10191
|
+
}, "End time"), /*#__PURE__*/React__default.createElement("input", {
|
|
10192
|
+
type: "time",
|
|
10193
|
+
value: getTimeValue('end'),
|
|
10194
|
+
onChange: handleTimeChange('end'),
|
|
10195
|
+
style: {
|
|
10196
|
+
width: '100%',
|
|
10197
|
+
padding: '4px 6px',
|
|
10198
|
+
border: '1px solid #d1d5db',
|
|
10199
|
+
borderRadius: 2,
|
|
10200
|
+
fontSize: 12
|
|
10201
|
+
}
|
|
10202
|
+
}))), processedRanges && processedRanges.length > 0 && /*#__PURE__*/React__default.createElement("div", {
|
|
10137
10203
|
style: {
|
|
10138
10204
|
marginTop: 12,
|
|
10139
10205
|
paddingTop: 12,
|