EnxDev commented on code in PR #42614:
URL: https://github.com/apache/superset/pull/42614#discussion_r3684527864
##########
superset-frontend/src/explore/components/controls/ControlPopover/ControlPopover.tsx:
##########
@@ -48,12 +49,31 @@ export type PopoverProps = BasePopoverProps & {
getVisibilityRatio?: typeof getElementVisibilityRatio;
};
+/** Placements antd already shifts, capped so the arrow keeps touching its
trigger. */
+const SHIFTING_PLACEMENTS = new Set(['top', 'bottom', 'left', 'right']);
+
+// `shiftX`/`shiftY` work but are missing from `AdjustOverflow`, hence the
cast.
+export const SHIFT_INTO_VIEWPORT = {
+ adjustX: 1,
+ adjustY: 1,
+ shiftX: true,
+ shiftY: true,
+} as unknown as BasePopoverProps['autoAdjustOverflow'];
Review Comment:
Agreed, done. There's now a local type that extends Ant Design's
`AdjustOverflow` with `shiftX`/`shiftY` and references the `rc-trigger`
`useAlign` source.
It's also worth noting that the cast was hiding more than just those two
extra fields. `adjustX`/`adjustY` weren't being properly checked either. With
the declared type, for example, `adjustX: 5` correctly fails with `Type '5' is
not assignable to type '0 | 1 | undefined'`, while the previous cast allowed it.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]