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.esm.js
CHANGED
|
@@ -7414,26 +7414,29 @@ const DebounceSelect = ({
|
|
|
7414
7414
|
}
|
|
7415
7415
|
window.history.replaceState({}, "", url);
|
|
7416
7416
|
};
|
|
7417
|
-
const handleSelect = (value, labelValue) => {
|
|
7417
|
+
const handleSelect = (value, labelValue, el) => {
|
|
7418
|
+
// console.log(el)
|
|
7418
7419
|
if (isMulti) {
|
|
7419
7420
|
const newItem = {
|
|
7421
|
+
...el,
|
|
7420
7422
|
value,
|
|
7421
7423
|
label: labelValue
|
|
7422
7424
|
};
|
|
7423
7425
|
const updated = selectedItems.some(item => item.value === value) ? selectedItems : [...selectedItems, newItem];
|
|
7424
7426
|
setSelectedItems(updated);
|
|
7425
|
-
onSelect(
|
|
7427
|
+
onSelect(value, newItem);
|
|
7426
7428
|
setInput("");
|
|
7427
7429
|
if (pushUrlParamObj) {
|
|
7428
7430
|
setUrlParam(updated.map(item => item.value).join(","));
|
|
7429
7431
|
}
|
|
7430
7432
|
} else {
|
|
7431
7433
|
const single = {
|
|
7434
|
+
...el,
|
|
7432
7435
|
value,
|
|
7433
7436
|
label: labelValue
|
|
7434
7437
|
};
|
|
7435
7438
|
setSelectedItems([single]);
|
|
7436
|
-
onSelect(single);
|
|
7439
|
+
onSelect(value, single);
|
|
7437
7440
|
setInput(labelValue);
|
|
7438
7441
|
if (pushUrlParamObj) {
|
|
7439
7442
|
setUrlParam(value);
|
|
@@ -7461,7 +7464,7 @@ const DebounceSelect = ({
|
|
|
7461
7464
|
if (typeof addItem === 'function') {
|
|
7462
7465
|
addItem(newOption);
|
|
7463
7466
|
}
|
|
7464
|
-
handleSelect(newOption.value, newOption.label);
|
|
7467
|
+
handleSelect(newOption.value, newOption.label, newOption);
|
|
7465
7468
|
};
|
|
7466
7469
|
|
|
7467
7470
|
// Handle double-click to fetch all when fetchAll is false
|
|
@@ -7543,14 +7546,17 @@ const DebounceSelect = ({
|
|
|
7543
7546
|
className: "basic-input-dropdown-menu"
|
|
7544
7547
|
}, loading ? /*#__PURE__*/React__default.createElement("div", {
|
|
7545
7548
|
className: "loading-dropdown-item"
|
|
7546
|
-
}, "Loading...") : options?.length > 0 ? /*#__PURE__*/React__default.createElement(React__default.Fragment, null, options.map(
|
|
7547
|
-
|
|
7548
|
-
|
|
7549
|
-
|
|
7550
|
-
|
|
7551
|
-
|
|
7552
|
-
|
|
7553
|
-
|
|
7549
|
+
}, "Loading...") : options?.length > 0 ? /*#__PURE__*/React__default.createElement(React__default.Fragment, null, options.map(el => {
|
|
7550
|
+
const {
|
|
7551
|
+
label,
|
|
7552
|
+
value
|
|
7553
|
+
} = el;
|
|
7554
|
+
return /*#__PURE__*/React__default.createElement("div", {
|
|
7555
|
+
key: value,
|
|
7556
|
+
className: "basic-input-dropdown-item",
|
|
7557
|
+
onMouseDown: () => handleSelect(value, label, el)
|
|
7558
|
+
}, translate(label));
|
|
7559
|
+
}), input.trim() && !inputExists && typeof addItem === 'function' && /*#__PURE__*/React__default.createElement("div", {
|
|
7554
7560
|
className: "basic-input-dropdown-item",
|
|
7555
7561
|
style: {
|
|
7556
7562
|
color: '#1677ff',
|
|
@@ -9953,6 +9959,28 @@ function RangePicker({
|
|
|
9953
9959
|
const newUrl = window.location.pathname + (params.toString() ? `?${params.toString()}` : "");
|
|
9954
9960
|
window.history.replaceState({}, "", newUrl);
|
|
9955
9961
|
}, [paramKey]);
|
|
9962
|
+
|
|
9963
|
+
// Extract HH:mm part from the current range value
|
|
9964
|
+
const getTimeValue = useCallback(which => {
|
|
9965
|
+
const val = which === 'start' ? range[0] : range[1];
|
|
9966
|
+
if (val && val.includes('T')) {
|
|
9967
|
+
return val.split('T')[1].slice(0, 5);
|
|
9968
|
+
}
|
|
9969
|
+
return which === 'start' ? timeStart || "" : timeEnd || "";
|
|
9970
|
+
}, [range, timeStart, timeEnd]);
|
|
9971
|
+
|
|
9972
|
+
// Update time while keeping the selected date
|
|
9973
|
+
const handleTimeChange = which => e => {
|
|
9974
|
+
const newTime = e.target.value;
|
|
9975
|
+
const currentVal = which === 'start' ? range[0] : range[1];
|
|
9976
|
+
const datePart = currentVal && currentVal.split('T')[0] || formatDate(new Date(), false);
|
|
9977
|
+
const newVal = `${datePart}T${newTime}`;
|
|
9978
|
+
const newRange = which === 'start' ? [newVal, range[1]] : [range[0], newVal];
|
|
9979
|
+
if (!controlledValue) setRange(newRange);
|
|
9980
|
+
setUrlParam(newRange);
|
|
9981
|
+
setSelectedRange("");
|
|
9982
|
+
onChange?.(newRange);
|
|
9983
|
+
};
|
|
9956
9984
|
const handleClear = () => {
|
|
9957
9985
|
if (!controlledValue) setRange(["", ""]);
|
|
9958
9986
|
setUrlParam(["", ""]);
|
|
@@ -10057,7 +10085,7 @@ function RangePicker({
|
|
|
10057
10085
|
background: dropdownOpen ? "#f0f8ff" : "#fff",
|
|
10058
10086
|
height: 34,
|
|
10059
10087
|
minHeight: 34,
|
|
10060
|
-
width:
|
|
10088
|
+
width: 300,
|
|
10061
10089
|
border: '1px solid #ccc',
|
|
10062
10090
|
borderRadius: 2,
|
|
10063
10091
|
display: 'flex',
|
|
@@ -10133,7 +10161,51 @@ function RangePicker({
|
|
|
10133
10161
|
timeStart: timeStart,
|
|
10134
10162
|
timeEnd: timeEnd,
|
|
10135
10163
|
startWith: startWith
|
|
10136
|
-
}),
|
|
10164
|
+
}), time && /*#__PURE__*/React__default.createElement("div", {
|
|
10165
|
+
style: {
|
|
10166
|
+
display: 'grid',
|
|
10167
|
+
gridTemplateColumns: '1fr 1fr',
|
|
10168
|
+
columnGap: 16,
|
|
10169
|
+
rowGap: 6,
|
|
10170
|
+
marginTop: 16,
|
|
10171
|
+
width: '99%',
|
|
10172
|
+
alignItems: 'center'
|
|
10173
|
+
}
|
|
10174
|
+
}, /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement("div", {
|
|
10175
|
+
style: {
|
|
10176
|
+
fontSize: 12,
|
|
10177
|
+
color: '#555',
|
|
10178
|
+
marginBottom: 6
|
|
10179
|
+
}
|
|
10180
|
+
}, "Start time"), /*#__PURE__*/React__default.createElement("input", {
|
|
10181
|
+
type: "time",
|
|
10182
|
+
value: getTimeValue('start'),
|
|
10183
|
+
onChange: handleTimeChange('start'),
|
|
10184
|
+
style: {
|
|
10185
|
+
width: '100%',
|
|
10186
|
+
padding: '4px 6px',
|
|
10187
|
+
border: '1px solid #d1d5db',
|
|
10188
|
+
borderRadius: 2,
|
|
10189
|
+
fontSize: 12
|
|
10190
|
+
}
|
|
10191
|
+
})), /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement("div", {
|
|
10192
|
+
style: {
|
|
10193
|
+
fontSize: 12,
|
|
10194
|
+
color: '#555',
|
|
10195
|
+
marginBottom: 6
|
|
10196
|
+
}
|
|
10197
|
+
}, "End time"), /*#__PURE__*/React__default.createElement("input", {
|
|
10198
|
+
type: "time",
|
|
10199
|
+
value: getTimeValue('end'),
|
|
10200
|
+
onChange: handleTimeChange('end'),
|
|
10201
|
+
style: {
|
|
10202
|
+
width: '100%',
|
|
10203
|
+
padding: '4px 6px',
|
|
10204
|
+
border: '1px solid #d1d5db',
|
|
10205
|
+
borderRadius: 2,
|
|
10206
|
+
fontSize: 12
|
|
10207
|
+
}
|
|
10208
|
+
}))), processedRanges && processedRanges.length > 0 && /*#__PURE__*/React__default.createElement("div", {
|
|
10137
10209
|
style: {
|
|
10138
10210
|
marginTop: 12,
|
|
10139
10211
|
paddingTop: 12,
|