mirror of
https://github.com/apache/superset.git
synced 2026-04-22 17:45:21 +00:00
chore(deps-dev): bump oxlint from 1.48.0 to 1.49.0 in /superset-frontend (#38115)
Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: hainenber <dotronghai96@gmail.com>
This commit is contained in:
@@ -36,6 +36,16 @@ const CustomPopover: React.FC<Props> = ({
|
||||
const triggerRef = useRef<HTMLDivElement>(null);
|
||||
const popoverRef = useRef<HTMLDivElement>(null);
|
||||
|
||||
const handleClickOutside = (event: MouseEvent) => {
|
||||
if (
|
||||
popoverRef.current &&
|
||||
!popoverRef.current.contains(event.target as Node) &&
|
||||
!triggerRef.current?.contains(event.target as Node)
|
||||
) {
|
||||
onClose();
|
||||
}
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
const updatePosition = () => {
|
||||
const rect = triggerRef.current?.getBoundingClientRect();
|
||||
@@ -73,16 +83,6 @@ const CustomPopover: React.FC<Props> = ({
|
||||
};
|
||||
}, [isOpen]);
|
||||
|
||||
const handleClickOutside = (event: MouseEvent) => {
|
||||
if (
|
||||
popoverRef.current &&
|
||||
!popoverRef.current.contains(event.target as Node) &&
|
||||
!triggerRef.current?.contains(event.target as Node)
|
||||
) {
|
||||
onClose();
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<PopoverWrapper>
|
||||
{cloneElement(children, { ref: triggerRef })}
|
||||
|
||||
@@ -246,6 +246,47 @@ function formatValueForOperator(
|
||||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Format a date string to ISO format expected by Superset, preserving local timezone
|
||||
*/
|
||||
export function formatDateForSuperset(dateStr: string): string {
|
||||
// AG Grid typically provides dates in format: "YYYY-MM-DD HH:MM:SS"
|
||||
// Superset expects: "YYYY-MM-DDTHH:MM:SS" in local timezone (not UTC)
|
||||
const date = new Date(dateStr);
|
||||
if (Number.isNaN(date.getTime())) {
|
||||
return dateStr; // Return as-is if invalid
|
||||
}
|
||||
|
||||
// Format date in local timezone, not UTC
|
||||
const year = date.getFullYear();
|
||||
const month = String(date.getMonth() + 1).padStart(2, '0');
|
||||
const day = String(date.getDate()).padStart(2, '0');
|
||||
const hours = String(date.getHours()).padStart(2, '0');
|
||||
const minutes = String(date.getMinutes()).padStart(2, '0');
|
||||
const seconds = String(date.getSeconds()).padStart(2, '0');
|
||||
|
||||
const formatted = `${year}-${month}-${day}T${hours}:${minutes}:${seconds}`;
|
||||
return formatted;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the start of day (00:00:00) for a given date string
|
||||
*/
|
||||
export function getStartOfDay(dateStr: string): string {
|
||||
const date = new Date(dateStr);
|
||||
date.setHours(0, 0, 0, 0);
|
||||
return formatDateForSuperset(date.toISOString());
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the end of day (23:59:59) for a given date string
|
||||
*/
|
||||
export function getEndOfDay(dateStr: string): string {
|
||||
const date = new Date(dateStr);
|
||||
date.setHours(23, 59, 59, 999);
|
||||
return formatDateForSuperset(date.toISOString());
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a date filter to a WHERE clause
|
||||
* @param columnName - Column name
|
||||
@@ -418,47 +459,6 @@ function compoundFilterToWhereClause(
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Format a date string to ISO format expected by Superset, preserving local timezone
|
||||
*/
|
||||
export function formatDateForSuperset(dateStr: string): string {
|
||||
// AG Grid typically provides dates in format: "YYYY-MM-DD HH:MM:SS"
|
||||
// Superset expects: "YYYY-MM-DDTHH:MM:SS" in local timezone (not UTC)
|
||||
const date = new Date(dateStr);
|
||||
if (Number.isNaN(date.getTime())) {
|
||||
return dateStr; // Return as-is if invalid
|
||||
}
|
||||
|
||||
// Format date in local timezone, not UTC
|
||||
const year = date.getFullYear();
|
||||
const month = String(date.getMonth() + 1).padStart(2, '0');
|
||||
const day = String(date.getDate()).padStart(2, '0');
|
||||
const hours = String(date.getHours()).padStart(2, '0');
|
||||
const minutes = String(date.getMinutes()).padStart(2, '0');
|
||||
const seconds = String(date.getSeconds()).padStart(2, '0');
|
||||
|
||||
const formatted = `${year}-${month}-${day}T${hours}:${minutes}:${seconds}`;
|
||||
return formatted;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the start of day (00:00:00) for a given date string
|
||||
*/
|
||||
export function getStartOfDay(dateStr: string): string {
|
||||
const date = new Date(dateStr);
|
||||
date.setHours(0, 0, 0, 0);
|
||||
return formatDateForSuperset(date.toISOString());
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the end of day (23:59:59) for a given date string
|
||||
*/
|
||||
export function getEndOfDay(dateStr: string): string {
|
||||
const date = new Date(dateStr);
|
||||
date.setHours(23, 59, 59, 999);
|
||||
return formatDateForSuperset(date.toISOString());
|
||||
}
|
||||
|
||||
// Converts date filters to TEMPORAL_RANGE format for Superset backend
|
||||
function convertDateFilter(
|
||||
columnName: string,
|
||||
|
||||
Reference in New Issue
Block a user