Skip to content

Build your own AI office with Univer Office SDK. Bring editing, calculation, collaboration, and file processing into your product for people and AI agents. Built on an extensible open-source core.

fix(ui): support calendar RTL and reset ribbon dropdown state (#7229)

白熱b388ba2acc71
diff --git a/packages/design/src/components/calendar/Calendar.tsx b/packages/design/src/components/calendar/Calendar.tsx
index 31805cd411..9031ce75b4 100644
--- a/packages/design/src/components/calendar/Calendar.tsx
+++ b/packages/design/src/components/calendar/Calendar.tsx
@@ -65,7 +65,7 @@ interface ICalendarProps {
export function Calendar(props: ICalendarProps) {
const { className, max, min, showTime = false, value, onValueChange } = props;
- const { locale } = useContext(ConfigContext);
+ const { direction = 'ltr', locale } = useContext(ConfigContext);
const { ariaLabels, year, weekDays, months } = locale?.Calendar as {
ariaLabels: {
@@ -193,6 +193,7 @@ export function Calendar(props: ICalendarProps) {
return (
<div
data-u-comp="calendar"
+ dir={direction}
className={clsx(`
univer-mx-auto univer-max-w-xs univer-select-none univer-rounded univer-bg-white univer-text-gray-900
dark:!univer-bg-gray-900 dark:!univer-text-white
@@ -209,7 +210,12 @@ export function Calendar(props: ICalendarProps) {
aria-label={ariaLabels.previousMonth}
onClick={prevMonth}
>
- <MoreRightIcon className="univer-rotate-180" />
+ <MoreRightIcon
+ className="
+ univer-rotate-180
+ rtl:!univer-rotate-0
+ "
+ />
</DayButton>
<span className="univer-flex univer-items-center univer-gap-0.5 univer-text-sm univer-font-medium">
<Dropdown
@@ -278,7 +284,7 @@ export function Calendar(props: ICalendarProps) {
aria-label={ariaLabels.nextMonth}
onClick={nextMonth}
>
- <MoreRightIcon />
+ <MoreRightIcon className="rtl:univer-rotate-180" />
</DayButton>
</nav>
diff --git a/packages/ui/src/views/components/ribbon/Ribbon.tsx b/packages/ui/src/views/components/ribbon/Ribbon.tsx
index 49eb204816..6b6509344e 100644
--- a/packages/ui/src/views/components/ribbon/Ribbon.tsx
+++ b/packages/ui/src/views/components/ribbon/Ribbon.tsx
@@ -306,7 +306,7 @@ export function Ribbon(props: IRibbonProps) {
role="toolbar"
aria-label={localeService.t(activatedTabTitle)}
>
- <ToolbarDropdownProvider>
+ <ToolbarDropdownProvider key={activatedTab}>
{activeGroup.visibleGroups.map((groupItem) => (groupItem.children?.length || groupItem.item) && (
<Fragment key={groupItem.key}>
<div