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.

feat: use component manager in slider component (#6468)

Roman Sergeev3735670176ea
diff --git a/packages/ui/src/common/component-manager.ts b/packages/ui/src/common/component-manager.ts
index 0f36962751..68aed16df3 100644
--- a/packages/ui/src/common/component-manager.ts
+++ b/packages/ui/src/common/component-manager.ts
@@ -70,6 +70,7 @@ import {
HorizontalBorderDoubleIcon,
HorizontallyIcon,
HorizontalMergeIcon,
+ IncreaseIcon,
InnerBorderDoubleIcon,
InsertCellDownDoubleIcon,
InsertCellShiftRightDoubleIcon,
@@ -198,6 +199,7 @@ const iconList: Record<string, ForwardRefExoticComponent<any>> = {
HorizontalBorderDoubleIcon,
HorizontallyIcon,
HorizontalMergeIcon,
+ IncreaseIcon,
InnerBorderDoubleIcon,
InsertCellDownDoubleIcon,
InsertCellShiftRightDoubleIcon,
diff --git a/packages/ui/src/components/slider/Slider.tsx b/packages/ui/src/components/slider/Slider.tsx
index b31f8bc594..4e2f53a930 100644
--- a/packages/ui/src/components/slider/Slider.tsx
+++ b/packages/ui/src/components/slider/Slider.tsx
@@ -17,8 +17,8 @@
import type { IDropdownMenuProps } from '@univerjs/design';
import { LocaleService } from '@univerjs/core';
import { Button, clsx, DropdownMenu } from '@univerjs/design';
-import { IncreaseIcon, ReduceIcon } from '@univerjs/icons';
import React, { useMemo, useRef, useState } from 'react';
+import { ComponentManager } from '../../common';
import { useDependency } from '../../utils/di';
export interface ISliderProps {
@@ -63,6 +63,7 @@ const SLIDER_WIDTH = 116;
*/
export function Slider(props: ISliderProps) {
const localeService = useDependency(LocaleService);
+ const componentManager = useDependency(ComponentManager);
const { value, min = 0, max = 400, disabled = false, resetPoint = 100, shortcuts, onChange } = props;
@@ -159,6 +160,9 @@ export function Slider(props: ISliderProps) {
onSelect: (value: string) => handleSelectZoomLevel(+value),
}];
+ const ReduceIcon = componentManager.get('ReduceIcon');
+ const IncreaseIcon = componentManager.get('IncreaseIcon');
+
return (
<div
className={clsx('univer-flex univer-select-none univer-items-center univer-gap-1', {