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.cjs.js
CHANGED
|
@@ -9973,6 +9973,28 @@ function RangePicker({
|
|
|
9973
9973
|
const newUrl = window.location.pathname + (params.toString() ? `?${params.toString()}` : "");
|
|
9974
9974
|
window.history.replaceState({}, "", newUrl);
|
|
9975
9975
|
}, [paramKey]);
|
|
9976
|
+
|
|
9977
|
+
// Extract HH:mm part from the current range value
|
|
9978
|
+
const getTimeValue = React.useCallback(which => {
|
|
9979
|
+
const val = which === 'start' ? range[0] : range[1];
|
|
9980
|
+
if (val && val.includes('T')) {
|
|
9981
|
+
return val.split('T')[1].slice(0, 5);
|
|
9982
|
+
}
|
|
9983
|
+
return which === 'start' ? timeStart || "" : timeEnd || "";
|
|
9984
|
+
}, [range, timeStart, timeEnd]);
|
|
9985
|
+
|
|
9986
|
+
// Update time while keeping the selected date
|
|
9987
|
+
const handleTimeChange = which => e => {
|
|
9988
|
+
const newTime = e.target.value;
|
|
9989
|
+
const currentVal = which === 'start' ? range[0] : range[1];
|
|
9990
|
+
const datePart = currentVal && currentVal.split('T')[0] || formatDate(new Date(), false);
|
|
9991
|
+
const newVal = `${datePart}T${newTime}`;
|
|
9992
|
+
const newRange = which === 'start' ? [newVal, range[1]] : [range[0], newVal];
|
|
9993
|
+
if (!controlledValue) setRange(newRange);
|
|
9994
|
+
setUrlParam(newRange);
|
|
9995
|
+
setSelectedRange("");
|
|
9996
|
+
onChange?.(newRange);
|
|
9997
|
+
};
|
|
9976
9998
|
const handleClear = () => {
|
|
9977
9999
|
if (!controlledValue) setRange(["", ""]);
|
|
9978
10000
|
setUrlParam(["", ""]);
|
|
@@ -10153,7 +10175,51 @@ function RangePicker({
|
|
|
10153
10175
|
timeStart: timeStart,
|
|
10154
10176
|
timeEnd: timeEnd,
|
|
10155
10177
|
startWith: startWith
|
|
10156
|
-
}),
|
|
10178
|
+
}), time && /*#__PURE__*/React.createElement("div", {
|
|
10179
|
+
style: {
|
|
10180
|
+
display: 'grid',
|
|
10181
|
+
gridTemplateColumns: '1fr 1fr',
|
|
10182
|
+
columnGap: 16,
|
|
10183
|
+
rowGap: 6,
|
|
10184
|
+
marginTop: 16,
|
|
10185
|
+
width: '99%',
|
|
10186
|
+
alignItems: 'center'
|
|
10187
|
+
}
|
|
10188
|
+
}, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
|
|
10189
|
+
style: {
|
|
10190
|
+
fontSize: 12,
|
|
10191
|
+
color: '#555',
|
|
10192
|
+
marginBottom: 6
|
|
10193
|
+
}
|
|
10194
|
+
}, "Start time"), /*#__PURE__*/React.createElement("input", {
|
|
10195
|
+
type: "time",
|
|
10196
|
+
value: getTimeValue('start'),
|
|
10197
|
+
onChange: handleTimeChange('start'),
|
|
10198
|
+
style: {
|
|
10199
|
+
width: '100%',
|
|
10200
|
+
padding: '4px 6px',
|
|
10201
|
+
border: '1px solid #d1d5db',
|
|
10202
|
+
borderRadius: 2,
|
|
10203
|
+
fontSize: 12
|
|
10204
|
+
}
|
|
10205
|
+
})), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
|
|
10206
|
+
style: {
|
|
10207
|
+
fontSize: 12,
|
|
10208
|
+
color: '#555',
|
|
10209
|
+
marginBottom: 6
|
|
10210
|
+
}
|
|
10211
|
+
}, "End time"), /*#__PURE__*/React.createElement("input", {
|
|
10212
|
+
type: "time",
|
|
10213
|
+
value: getTimeValue('end'),
|
|
10214
|
+
onChange: handleTimeChange('end'),
|
|
10215
|
+
style: {
|
|
10216
|
+
width: '100%',
|
|
10217
|
+
padding: '4px 6px',
|
|
10218
|
+
border: '1px solid #d1d5db',
|
|
10219
|
+
borderRadius: 2,
|
|
10220
|
+
fontSize: 12
|
|
10221
|
+
}
|
|
10222
|
+
}))), processedRanges && processedRanges.length > 0 && /*#__PURE__*/React.createElement("div", {
|
|
10157
10223
|
style: {
|
|
10158
10224
|
marginTop: 12,
|
|
10159
10225
|
paddingTop: 12,
|