@monolith-forensics/monolith-ui 1.1.82 → 1.1.84
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.
|
@@ -199,6 +199,8 @@ const DateInput = styled(({ className, defaultValue, format = "YYYY-MM-DD HH:mm:
|
|
|
199
199
|
const { getReferenceProps } = useInteractions([dismiss]);
|
|
200
200
|
const segments = useMemo(() => parseTimestamp(moment(value).toISOString(), format, utc), [value, format, utc]);
|
|
201
201
|
const checkValidRange = (value) => {
|
|
202
|
+
if (!value)
|
|
203
|
+
return false;
|
|
202
204
|
if (min && moment(value).isBefore(min))
|
|
203
205
|
return false;
|
|
204
206
|
if (max && moment(value).isAfter(max))
|
|
@@ -353,18 +355,28 @@ const DateInput = styled(({ className, defaultValue, format = "YYYY-MM-DD HH:mm:
|
|
|
353
355
|
}
|
|
354
356
|
};
|
|
355
357
|
const handleWheelEvent = (e) => {
|
|
356
|
-
if (!selectedSegment)
|
|
358
|
+
if (!selectedSegment) {
|
|
357
359
|
return;
|
|
360
|
+
}
|
|
358
361
|
setValue((prev) => {
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
362
|
+
let newValue = prev;
|
|
363
|
+
if (selectedSegment.type === "separator") {
|
|
364
|
+
newValue = prev; // skip all logic if separator
|
|
365
|
+
}
|
|
366
|
+
else if (!prev) {
|
|
367
|
+
newValue = isDateOnly
|
|
368
|
+
? moment().format(format)
|
|
369
|
+
: moment().toISOString();
|
|
370
|
+
}
|
|
371
|
+
else {
|
|
372
|
+
newValue =
|
|
373
|
+
e.deltaY > 0
|
|
374
|
+
? moment(newValue).subtract(1, selectedSegment.type).toISOString()
|
|
375
|
+
: moment(newValue).add(1, selectedSegment.type).toISOString();
|
|
376
|
+
}
|
|
377
|
+
if (!checkValidRange(newValue)) {
|
|
367
378
|
return prev;
|
|
379
|
+
}
|
|
368
380
|
newValue = isDateOnly ? moment(newValue).format(format) : newValue;
|
|
369
381
|
onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
|
|
370
382
|
return newValue;
|
|
@@ -280,7 +280,7 @@ const DropDownMenu = ({ data, children, defaultValue, variant, arrow, size, sear
|
|
|
280
280
|
const handleAddItem = (item) => {
|
|
281
281
|
setSelected((prev) => {
|
|
282
282
|
let newSelected = [...prev, item];
|
|
283
|
-
const diff =
|
|
283
|
+
const diff = [item];
|
|
284
284
|
onChange === null || onChange === void 0 ? void 0 : onChange(newSelected, diff);
|
|
285
285
|
return newSelected;
|
|
286
286
|
});
|
|
@@ -288,7 +288,7 @@ const DropDownMenu = ({ data, children, defaultValue, variant, arrow, size, sear
|
|
|
288
288
|
const handleRemoveItem = (item) => {
|
|
289
289
|
setSelected((prev) => {
|
|
290
290
|
let newSelected = prev.filter((i) => isObjectArray ? (i === null || i === void 0 ? void 0 : i.value) !== (item === null || item === void 0 ? void 0 : item.value) : i !== item);
|
|
291
|
-
const diff =
|
|
291
|
+
const diff = [item];
|
|
292
292
|
onChange === null || onChange === void 0 ? void 0 : onChange(newSelected, diff);
|
|
293
293
|
return newSelected;
|
|
294
294
|
});
|
|
@@ -312,7 +312,13 @@ const DropDownMenu = ({ data, children, defaultValue, variant, arrow, size, sear
|
|
|
312
312
|
if (item.items) {
|
|
313
313
|
return (_jsx(DropDownMenu, { data: item.items, children: item.label }));
|
|
314
314
|
}
|
|
315
|
-
return (_jsx(Tooltip, { content: TooltipContent ? _jsx(TooltipContent, { data: item.data }) : null, side: "left", children: _jsxs(MenuItem, { className: "MenuItem", "data-selected": isSelected, leftSection: multiselect && _jsx(CheckBox, { value: isSelected, size: size
|
|
315
|
+
return (_jsx(Tooltip, { content: TooltipContent ? _jsx(TooltipContent, { data: item.data }) : null, side: "left", children: _jsxs(MenuItem, { className: "MenuItem", "data-selected": isSelected, leftSection: multiselect && (_jsx(CheckBox, { value: isSelected, size: size, onChange: (newValue) => {
|
|
316
|
+
var _a;
|
|
317
|
+
newValue
|
|
318
|
+
? handleAddItem(item)
|
|
319
|
+
: handleRemoveItem(item);
|
|
320
|
+
(_a = item === null || item === void 0 ? void 0 : item.onClick) === null || _a === void 0 ? void 0 : _a.call(item, item);
|
|
321
|
+
} })), multiselect: multiselect, size: size, onClick: (e) => {
|
|
316
322
|
var _a;
|
|
317
323
|
e.preventDefault();
|
|
318
324
|
e.stopPropagation();
|
package/dist/TagBox/types.d.ts
CHANGED
|
@@ -34,7 +34,7 @@ export interface TagBoxProps {
|
|
|
34
34
|
data: any;
|
|
35
35
|
}) => JSX.Element | React.ReactNode;
|
|
36
36
|
onChange?: (value: any[]) => void;
|
|
37
|
-
onScroll?: () => void;
|
|
37
|
+
onScroll?: (e: any) => void;
|
|
38
38
|
onSearch?: (value: string) => void;
|
|
39
39
|
searchFn?: (value: string) => void;
|
|
40
40
|
onItemAdded?: (value: any) => void;
|