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(base-sheet): fix incorrect rendering when the border type is set to outside (#532)

白熱956a0cc3b1f5
diff --git a/packages/base-sheets/src/commands/commands/set-border-command.ts b/packages/base-sheets/src/commands/commands/set-border-command.ts
index 1826e151df..f480c513c1 100644
--- a/packages/base-sheets/src/commands/commands/set-border-command.ts
+++ b/packages/base-sheets/src/commands/commands/set-border-command.ts
@@ -227,7 +227,9 @@ export const SetBorderCommand: ICommand = {
if (rectangle) {
if (reserve) {
- const style = mr.getValue(rectangle.startRow, rectangle.startColumn)?.s as IStyleData;
+ const style = Tools.deepClone(
+ mr.getValue(rectangle.startRow, rectangle.startColumn)?.s
+ ) as IStyleData;
bdStyle = style?.bd ? Object.assign(style.bd, defaultStyle) : defaultStyle;
}
mr.setValue(rectangle.startRow, rectangle.startColumn, {
@@ -237,7 +239,7 @@ export const SetBorderCommand: ICommand = {
});
} else {
if (reserve) {
- const style = mr.getValue(row, column)?.s as IStyleData;
+ const style = Tools.deepClone(mr.getValue(row, column)?.s) as IStyleData;
bdStyle = style?.bd ? Object.assign(style.bd, defaultStyle) : defaultStyle;
}
mr.setValue(row, column, { s: { bd: bdStyle } });
diff --git a/packages/base-ui/src/components/menu/Menu.tsx b/packages/base-ui/src/components/menu/Menu.tsx
index f5d6f7191f..e80c64740e 100644
--- a/packages/base-ui/src/components/menu/Menu.tsx
+++ b/packages/base-ui/src/components/menu/Menu.tsx
@@ -100,38 +100,46 @@ function MenuWrapper(props: IBaseMenuProps) {
function MenuOptionsWrapper(props: IBaseMenuProps) {
const { options, value, onOptionSelect, parentKey } = props;
- return options?.map((option: IValueOption, index: number) => {
- const key = `${parentKey}-${option.label ?? option.id}-${index}`;
+ return (
+ options?.map((option: IValueOption, index: number) => {
+ const key = `${parentKey}-${option.label ?? option.id}-${index}`;
- const onChange = (v: string | number) => {
- onOptionSelect?.({ value: v, label: option?.label });
- };
+ const onChange = (v: string | number) => {
+ onOptionSelect?.({ value: v, label: option?.label });
+ };
- const handleClick = () => {
- if (typeof option.value === 'undefined') return;
+ const handleClick = () => {
+ if (typeof option.value === 'undefined') return;
- onOptionSelect?.({
- ...option,
- });
- };
+ onOptionSelect?.({
+ ...option,
+ });
+ };
- const _className = clsx({
- [styles.menuItemNoHover]: typeof option.label !== 'string' && !option.label?.hoverable,
- });
+ const _className = clsx({
+ [styles.menuItemNoHover]: typeof option.label !== 'string' && !option.label?.hoverable,
+ });
- return (
- <DesignMenuItem key={key} eventKey={key} className={_className} onClick={handleClick}>
- <span className={clsx(styles.menuItemContent, styles.menuItemSelectable)}>
- {typeof value !== 'undefined' && String(value) === String(option.value) && (
- <span className={styles.menuItemSelectableIcon}>
- <CheckMarkSingle style={{ color: 'rgb(var(--success-color))' }} />
- </span>
- )}
- <CustomLabel value={option.value} label={option.label} icon={option.icon} onChange={onChange} />
- </span>
- </DesignMenuItem>
- );
- });
+ return (
+ <DesignMenuItem key={key} eventKey={key} className={_className} onClick={handleClick}>
+ <span
+ className={clsx(styles.menuItemContent, {
+ [styles.menuItemSelectable]: !(
+ typeof option.label !== 'string' && !option.label?.hoverable
+ ),
+ })}
+ >
+ {typeof value !== 'undefined' && String(value) === String(option.value) && (
+ <span className={styles.menuItemSelectableIcon}>
+ <CheckMarkSingle style={{ color: 'rgb(var(--success-color))' }} />
+ </span>
+ )}
+ <CustomLabel value={option.value} label={option.label} icon={option.icon} onChange={onChange} />
+ </span>
+ </DesignMenuItem>
+ );
+ }) ?? <></>
+ );
}
export const Menu = (props: IBaseMenuProps) => (