trotl-filter 1.0.8 → 1.0.10
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 +86 -14
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +86 -14
- package/dist/index.esm.js.map +1 -1
- package/package.json +2 -2
package/dist/index.cjs.js
CHANGED
|
@@ -7434,26 +7434,29 @@ const DebounceSelect = ({
|
|
|
7434
7434
|
}
|
|
7435
7435
|
window.history.replaceState({}, "", url);
|
|
7436
7436
|
};
|
|
7437
|
-
const handleSelect = (value, labelValue) => {
|
|
7437
|
+
const handleSelect = (value, labelValue, el) => {
|
|
7438
|
+
// console.log(el)
|
|
7438
7439
|
if (isMulti) {
|
|
7439
7440
|
const newItem = {
|
|
7441
|
+
...el,
|
|
7440
7442
|
value,
|
|
7441
7443
|
label: labelValue
|
|
7442
7444
|
};
|
|
7443
7445
|
const updated = selectedItems.some(item => item.value === value) ? selectedItems : [...selectedItems, newItem];
|
|
7444
7446
|
setSelectedItems(updated);
|
|
7445
|
-
onSelect(
|
|
7447
|
+
onSelect(value, newItem);
|
|
7446
7448
|
setInput("");
|
|
7447
7449
|
if (pushUrlParamObj) {
|
|
7448
7450
|
setUrlParam(updated.map(item => item.value).join(","));
|
|
7449
7451
|
}
|
|
7450
7452
|
} else {
|
|
7451
7453
|
const single = {
|
|
7454
|
+
...el,
|
|
7452
7455
|
value,
|
|
7453
7456
|
label: labelValue
|
|
7454
7457
|
};
|
|
7455
7458
|
setSelectedItems([single]);
|
|
7456
|
-
onSelect(single);
|
|
7459
|
+
onSelect(value, single);
|
|
7457
7460
|
setInput(labelValue);
|
|
7458
7461
|
if (pushUrlParamObj) {
|
|
7459
7462
|
setUrlParam(value);
|
|
@@ -7481,7 +7484,7 @@ const DebounceSelect = ({
|
|
|
7481
7484
|
if (typeof addItem === 'function') {
|
|
7482
7485
|
addItem(newOption);
|
|
7483
7486
|
}
|
|
7484
|
-
handleSelect(newOption.value, newOption.label);
|
|
7487
|
+
handleSelect(newOption.value, newOption.label, newOption);
|
|
7485
7488
|
};
|
|
7486
7489
|
|
|
7487
7490
|
// Handle double-click to fetch all when fetchAll is false
|
|
@@ -7563,14 +7566,17 @@ const DebounceSelect = ({
|
|
|
7563
7566
|
className: "basic-input-dropdown-menu"
|
|
7564
7567
|
}, loading ? /*#__PURE__*/React.createElement("div", {
|
|
7565
7568
|
className: "loading-dropdown-item"
|
|
7566
|
-
}, "Loading...") : options?.length > 0 ? /*#__PURE__*/React.createElement(React.Fragment, null, options.map(
|
|
7567
|
-
|
|
7568
|
-
|
|
7569
|
-
|
|
7570
|
-
|
|
7571
|
-
|
|
7572
|
-
|
|
7573
|
-
|
|
7569
|
+
}, "Loading...") : options?.length > 0 ? /*#__PURE__*/React.createElement(React.Fragment, null, options.map(el => {
|
|
7570
|
+
const {
|
|
7571
|
+
label,
|
|
7572
|
+
value
|
|
7573
|
+
} = el;
|
|
7574
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
7575
|
+
key: value,
|
|
7576
|
+
className: "basic-input-dropdown-item",
|
|
7577
|
+
onMouseDown: () => handleSelect(value, label, el)
|
|
7578
|
+
}, translate(label));
|
|
7579
|
+
}), input.trim() && !inputExists && typeof addItem === 'function' && /*#__PURE__*/React.createElement("div", {
|
|
7574
7580
|
className: "basic-input-dropdown-item",
|
|
7575
7581
|
style: {
|
|
7576
7582
|
color: '#1677ff',
|
|
@@ -9973,6 +9979,28 @@ function RangePicker({
|
|
|
9973
9979
|
const newUrl = window.location.pathname + (params.toString() ? `?${params.toString()}` : "");
|
|
9974
9980
|
window.history.replaceState({}, "", newUrl);
|
|
9975
9981
|
}, [paramKey]);
|
|
9982
|
+
|
|
9983
|
+
// Extract HH:mm part from the current range value
|
|
9984
|
+
const getTimeValue = React.useCallback(which => {
|
|
9985
|
+
const val = which === 'start' ? range[0] : range[1];
|
|
9986
|
+
if (val && val.includes('T')) {
|
|
9987
|
+
return val.split('T')[1].slice(0, 5);
|
|
9988
|
+
}
|
|
9989
|
+
return which === 'start' ? timeStart || "" : timeEnd || "";
|
|
9990
|
+
}, [range, timeStart, timeEnd]);
|
|
9991
|
+
|
|
9992
|
+
// Update time while keeping the selected date
|
|
9993
|
+
const handleTimeChange = which => e => {
|
|
9994
|
+
const newTime = e.target.value;
|
|
9995
|
+
const currentVal = which === 'start' ? range[0] : range[1];
|
|
9996
|
+
const datePart = currentVal && currentVal.split('T')[0] || formatDate(new Date(), false);
|
|
9997
|
+
const newVal = `${datePart}T${newTime}`;
|
|
9998
|
+
const newRange = which === 'start' ? [newVal, range[1]] : [range[0], newVal];
|
|
9999
|
+
if (!controlledValue) setRange(newRange);
|
|
10000
|
+
setUrlParam(newRange);
|
|
10001
|
+
setSelectedRange("");
|
|
10002
|
+
onChange?.(newRange);
|
|
10003
|
+
};
|
|
9976
10004
|
const handleClear = () => {
|
|
9977
10005
|
if (!controlledValue) setRange(["", ""]);
|
|
9978
10006
|
setUrlParam(["", ""]);
|
|
@@ -10077,7 +10105,7 @@ function RangePicker({
|
|
|
10077
10105
|
background: dropdownOpen ? "#f0f8ff" : "#fff",
|
|
10078
10106
|
height: 34,
|
|
10079
10107
|
minHeight: 34,
|
|
10080
|
-
width:
|
|
10108
|
+
width: 300,
|
|
10081
10109
|
border: '1px solid #ccc',
|
|
10082
10110
|
borderRadius: 2,
|
|
10083
10111
|
display: 'flex',
|
|
@@ -10153,7 +10181,51 @@ function RangePicker({
|
|
|
10153
10181
|
timeStart: timeStart,
|
|
10154
10182
|
timeEnd: timeEnd,
|
|
10155
10183
|
startWith: startWith
|
|
10156
|
-
}),
|
|
10184
|
+
}), time && /*#__PURE__*/React.createElement("div", {
|
|
10185
|
+
style: {
|
|
10186
|
+
display: 'grid',
|
|
10187
|
+
gridTemplateColumns: '1fr 1fr',
|
|
10188
|
+
columnGap: 16,
|
|
10189
|
+
rowGap: 6,
|
|
10190
|
+
marginTop: 16,
|
|
10191
|
+
width: '99%',
|
|
10192
|
+
alignItems: 'center'
|
|
10193
|
+
}
|
|
10194
|
+
}, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
|
|
10195
|
+
style: {
|
|
10196
|
+
fontSize: 12,
|
|
10197
|
+
color: '#555',
|
|
10198
|
+
marginBottom: 6
|
|
10199
|
+
}
|
|
10200
|
+
}, "Start time"), /*#__PURE__*/React.createElement("input", {
|
|
10201
|
+
type: "time",
|
|
10202
|
+
value: getTimeValue('start'),
|
|
10203
|
+
onChange: handleTimeChange('start'),
|
|
10204
|
+
style: {
|
|
10205
|
+
width: '100%',
|
|
10206
|
+
padding: '4px 6px',
|
|
10207
|
+
border: '1px solid #d1d5db',
|
|
10208
|
+
borderRadius: 2,
|
|
10209
|
+
fontSize: 12
|
|
10210
|
+
}
|
|
10211
|
+
})), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
|
|
10212
|
+
style: {
|
|
10213
|
+
fontSize: 12,
|
|
10214
|
+
color: '#555',
|
|
10215
|
+
marginBottom: 6
|
|
10216
|
+
}
|
|
10217
|
+
}, "End time"), /*#__PURE__*/React.createElement("input", {
|
|
10218
|
+
type: "time",
|
|
10219
|
+
value: getTimeValue('end'),
|
|
10220
|
+
onChange: handleTimeChange('end'),
|
|
10221
|
+
style: {
|
|
10222
|
+
width: '100%',
|
|
10223
|
+
padding: '4px 6px',
|
|
10224
|
+
border: '1px solid #d1d5db',
|
|
10225
|
+
borderRadius: 2,
|
|
10226
|
+
fontSize: 12
|
|
10227
|
+
}
|
|
10228
|
+
}))), processedRanges && processedRanges.length > 0 && /*#__PURE__*/React.createElement("div", {
|
|
10157
10229
|
style: {
|
|
10158
10230
|
marginTop: 12,
|
|
10159
10231
|
paddingTop: 12,
|